Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
HI guys,

I have crystal report in asp.net using c#.

when i m generating report for 09/16/2014.. it is,
but when i want to generate for 09/17/2014 then it is generating only 09/16/2014,
same report for all the date...

getting same report for each day... instead on date wise.

Stored Procedure:
ALTER PROC [dbo].[Sp_Get_DailyReport]
@ReportDate datetime2
as

-- Sp_Get_DailyReport '09/28/2014' 

BEGIN

DECLARE @TempTable table
(
			JPID int
           ,DepartmentID int
           ,UnitID int
           ,RigID varchar(250)
           ,WellID varchar(250)
           ,Job_Process varchar(250)
           ,NPS_Job varchar(250)
           ,Crew_Status varchar(250)
           ,Operator varchar(250)
           ,Job_Status varchar(250)
           ,EQ_Status varchar(50)
           ,isShow bit
           ,Posted_Date datetime2(7)
           ,Ticket_Number varchar(250)
           ,Issues varchar(250)
           ,Details varchar(250)
           ,Contract_Ref_Number varchar(250)
           ,RPO_Number varchar(250)
           ,DRSS_Number varchar(250)
)

--DECLARE @MaxDate DATE

--SELECT @MaxDate = MAX(Posted_Date) from tbl_JobPosted where Posted_Date <= @ReportDate

--print @MaxDate

-- select reverse( substring ( reverse([Job_Process]), 1,3)) as j, [Job_Process] FROM tbl_JobPosted

INSERT INTO @TempTable
(			
			[JPID]
           ,[DepartmentID]
           ,[UnitID]
           ,[RigID]
           ,[WellID]
           ,[Job_Process]
           ,[NPS_Job]
           ,[Crew_Status]
           ,[Operator]
           ,[Job_Status]
           ,[EQ_Status]
           ,[isShow]
           ,[Posted_Date]
           ,[Ticket_Number]
           ,[Issues]
           ,[Details]
           ,[Contract_Ref_Number]
           ,[RPO_Number]
           ,[DRSS_Number]
)
SELECT 
			[JPID]
           ,[DepartmentID]
           ,[UnitID]
           ,r.Rig_Name
           ,w.Well_Name
           ,[Job_Process]
           ,[NPS_Job]
           ,[Crew_Status]
           ,[Operator]
           ,[Job_Status]
           ,[EQ_Status]
           ,j.[isShow]
           ,[Posted_Date]
           ,[Ticket_Number]
           ,[Issues]
           ,[Details]
           ,[Contract_Ref_Number]
           ,[RPO_Number]
           ,[DRSS_Number]
FROM tbl_JobPosted j
LEFT JOIN tbl_Rigs r on r.RigID = j.RigID
LEFT JOIN tbl_Wells w on w.WellID  = j.WellID
WHERE j.Posted_Date = @ReportDate

SELECT 
			j.[JPID]
           ,d.Department_Name
           ,CASE	WHEN CONVERT(VARCHAR(11), u.Unit_Name) = 'FLARE STACK' 
					THEN 'F.S.'+ reverse( substring ( reverse(u.Unit_Name), 1,2)) 
					WHEN CONVERT(VARCHAR(14), u.Unit_Name) = 'MERCEDES TRUCK' 
					THEN 'M.T.'+ reverse( substring ( reverse(u.Unit_Name), 1,4))
					ELSE u.Unit_Name
					END AS 'Unit_Name'
           ,ISNULL([RigID], '-') AS 'RigID'
           ,ISNULL([WellID], '-') AS 'WellID'
           ,ISNULL([Job_Process], '-') AS 'Job_Process'
           ,ISNULL([NPS_Job], '-') AS 'NPS_Job'
           ,ISNULL([Crew_Status], '-') AS 'Crew_Status'
           ,ISNULL([Operator], '-') AS 'Operator'
           ,ISNULL([Job_Status], '-') AS 'Job_Status'
           ,[EQ_Status]
           ,j.[isShow]
           ,CONVERT(VARCHAR(10), [Posted_Date], 101) AS 'Posted_Date'
           ,[Ticket_Number]
           ,ISNULL([Issues], '-') AS 'Issues'
           ,ISNULL([Details], '-') AS 'Details'
           ,[Contract_Ref_Number]
           ,[RPO_Number]
           ,[DRSS_Number]
FROM @TempTable j
RIGHT JOIN tbl_Units u on u.UnitID = j.UnitID
RIGHT JOIN tbl_Departments d on d.DepartmentID = u.DepartmentID
ORDER BY d.DepartmentID

END



c# code:
try
{
    Button1.Enabled = true;
    // CrystalReportViewer1.RefreshReport();
    int PRJID = Convert.ToInt32(Request.QueryString["RecID"]);
    ReportDocument rd = new ReportDocument();

    rd.Load(Page.Server.MapPath("JobDailyReport.rpt"));

    rd.SetParameterValue("@ReportDate", rDate);
    rd.SetParameterValue("@ReportDate", rDate, "Workshop");
    rd.SetDatabaseLogon("DB_9B08BD_automobile_admin", "webclient786");

    Session["Report"] = rd;

    CrystalReportViewer1.ReportSource = (ReportDocument)Session["Report"];
    CrystalReportViewer1.DataBind();
    CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;
    CrystalReportViewer1.HasPrintButton = false;
    CrystalReportViewer1.HasExportButton = false;

}
catch (Exception ex)
{
    Response.Write(ex.Message);
}

plz help me...

Thanks
Posted
Updated 28-Sep-14 19:46pm
v4
Comments
[no name] 28-Sep-14 9:28am    
PLZ write down the formula you use , sql statement to get data and some sample for the data.,
[no name] 28-Sep-14 9:31am    
Bumping your question is rude. Your vague question is not any more important than anyone else's. If your report is only showing data from the 16th then chances are you are only telling your query to get data from the 16th, change it if you don't like it.
M.Farrukh Abbas 29-Sep-14 1:25am    
Show your code and SQL for generate report
Sinisa Hajnal 29-Sep-14 2:30am    
What's in your rDate variable? If you have fixed it somewhere at 16th then that's what you'll get...
abdul subhan mohammed 29-Sep-14 11:57am    
No, i haven't fixed anything, the rDate is the date which will b provided by the user.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900