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;
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