void calReport() { var strrevenue = Session["Revenue"].ToString(); var startdate = Session["Startdate"].ToString(); var enddate = Session["Enddate"].ToString(); //var end= Session["Enddate1"].ToString(); var end = Convert.ToDateTime(Session["Enddate1"].ToString()).ToString("dd/MM/yyyy"); //var strat = Session["startdate1"].ToString(); var strat = Convert.ToDateTime(Session["startdate1"].ToString()).ToString("dd/MM/yyyy"); //DateTime dt = DateTime.ParseExact(startdate, "dd/mm/yyyy", CultureInfo.InvariantCulture); //DateTime dt2 = DateTime.ParseExact(enddate, "dd/mm/yyyy", CultureInfo.InvariantCulture); //Console.WriteLine(dt.ToString("yyyy-MM-dd")); //var gb = dt.ToString("yyyy-MM-dd"); //var gb2 = dt2.ToString("yyyy-MM-dd"); //XtraRepPayment obj_Rpt = new XtraRepPayment(); XtraRepPayment2 obj_Rpt = new XtraRepPayment2(); SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet(); string strquery = String.Format("SELECT * FROM ViewPayment WHERE PaymentDate BETWEEN '{0}' AND '{1}' and RevenueCode ='{2}' ORDER BY PaymentDate ASC", startdate, enddate, strrevenue); using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString)) { connect.Open(); _command = new SqlCommand(strquery, connect) { CommandType = CommandType.Text }; _command.CommandTimeout = 0; responses.Clear(); _adp = new SqlDataAdapter(_command); _adp.Fill(responses); connect.Close(); } if (responses.Tables[0] != null && responses.Tables[0].Rows.Count > 1) { obj_Rpt.xrLabel10.Text = string.Format("From {0:dd/MM/yyyy} To {1:dd/MM/yyyy}", strat, end); obj_Rpt.xrLabel8.Text = Session["RevenueName"].ToString(); obj_Rpt.Report.DataSource = responses; obj_Rpt.Report.DataMember = responses.Tables[0].TableName; ASPxWebDocumentViewer1.OpenReport(obj_Rpt); } //var cachedReportSource = new CachedReportSourceWeb(new XtraRepPayment()); }
void calReport() { var strrevenue = Session["Revenue"].ToString(); var startdate = Session["Startdate"].ToString(); var enddate = Session["Enddate"].ToString(); //var end= Session["Enddate1"].ToString(); var end = Convert.ToDateTime(Session["Enddate1"].ToString()).ToString("dd/MM/yyyy"); //var strat = Session["startdate1"].ToString(); var strat = Convert.ToDateTime(Session["startdate1"].ToString()).ToString("dd/MM/yyyy"); XtraRepPayment2 obj_Rpt = new XtraRepPayment2(); SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet(); if (sessions.MerchantCode.ToString() == "DTSS") { //obj_Rpt = "DELTA STATE GOVERNMENT"; obj_Rpt.xrPictureBox1.Visible = true; obj_Rpt.xrPictureBox2.Visible = false; obj_Rpt.xrPictureBox3.Visible = false; } if (sessions.MerchantCode.ToString() == "OGSS") { //strheader = "OGUN STATE GOVERNMENT"; obj_Rpt.xrPictureBox1.Visible = false; obj_Rpt.xrPictureBox2.Visible = true; obj_Rpt.xrPictureBox3.Visible = false; } if (sessions.MerchantCode.ToString() == "OYSS") { //strheader = "OYO STATE GOVERNMENT"; obj_Rpt.xrPictureBox1.Visible = false; obj_Rpt.xrPictureBox2.Visible = false; obj_Rpt.xrPictureBox3.Visible = true; } string strquery = String.Format("SELECT * FROM ViewPayment WHERE PaymentDate BETWEEN '{0}' AND '{1}' and RevenueCode ='{2}' ORDER BY PaymentDate ASC", startdate, enddate, strrevenue); using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString)) { connect.Open(); _command = new SqlCommand(strquery, connect) { CommandType = CommandType.Text }; _command.CommandTimeout = 0; responses.Clear(); _adp = new SqlDataAdapter(_command); _adp.Fill(responses); connect.Close(); } if (responses.Tables[0] != null && responses.Tables[0].Rows.Count > 1) { obj_Rpt.xrLabel10.Text = string.Format("From {0:dd/MM/yyyy} To {1:dd/MM/yyyy}", strat, end); obj_Rpt.xrLabel8.Text = Session["RevenueName"].ToString(); obj_Rpt.Report.DataSource = responses; obj_Rpt.Report.DataMember = responses.Tables[0].TableName; ASPxWebDocumentViewer1.OpenReport(obj_Rpt); } //var cachedReportSource = new CachedReportSourceWeb(new XtraRepPayment()); }