void calReport() { //var vryearfrom = Session["yearFrom"].ToString(); //var vryearto = Session["yearTo"].ToString(); //var varofficename = Session["Revenueoffice"].ToString(); var varofficename = Session["RevenueOfficename"].ToString(); var varyear = Session["TaxYear"].ToString(); //var varyear = Session["TaxYear"].ToString(); XtraRepTccDetails2 obj_Rpt = new XtraRepTccDetails2(); SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet(); string strquery = String.Format("SELECT * FROM dbo.ViewTccDetailsInfors WHERE YEAR(IssuedDate) BETWEEN {0} AND {0} AND RevenueOfficeName='{1}' ORDER BY PayerName ASC, TccNo ASC, TaxYear DESC", varyear, varofficename); //string strquery = String.Format("SELECT * FROM dbo.ViewTccDetails WHERE YEAR(IssuedDate) BETWEEN {0} AND {1} AND RevenueOfficeName='{2}' AND AssessmentYear = YEAR(IssuedDate) - 1 ORDER BY PayerName ASC", vryearfrom, vryearto, varofficename); 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 > 0) { //obj_Rpt.xrLabel10.Text = string.Format("From {0} to {1}", vryearfrom, vryearto); //obj_Rpt.xrLabel11.Text = string.Format("{0} ", varofficename); obj_Rpt.xrLabel10.Text = string.Format("{0} ", varyear); obj_Rpt.xrLabel11.Text = string.Format("{0} ", varofficename); obj_Rpt.Report.DataSource = responses; obj_Rpt.Report.DataMember = responses.Tables[0].TableName; ASPxWebDocumentViewer1.OpenReport(obj_Rpt); } }
void calReport() { var vryearfrom = Session["yearFrom"].ToString(); var vryearto = Session["yearTo"].ToString(); var varofficename = Session["Revenueoffice"].ToString(); //var varyear = Session["TaxYear"].ToString(); string strheader = String.Empty; XtraRepTccDetails2 obj_Rpt = new XtraRepTccDetails2(); SqlCommand _command; SqlDataAdapter _adp; System.Data.DataSet responses = new System.Data.DataSet(); if (sessions.MerchantCode.ToString() == "DTSS") { strheader = "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 dbo.ViewTccDetailsInfors WHERE YEAR(IssuedDate) BETWEEN {0} AND {1} AND RevenueOfficeName='{2}' ORDER BY PayerName ASC, TccNo ASC, TaxYear DESC", vryearfrom, vryearto, varofficename); 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 > 0) { obj_Rpt.xrLabel10.Text = string.Format("From {0} to {1}", vryearfrom, vryearto); obj_Rpt.xrLabel11.Text = string.Format("{0} ", varofficename); obj_Rpt.Report.DataSource = responses; obj_Rpt.Report.DataMember = responses.Tables[0].TableName; ASPxWebDocumentViewer1.OpenReport(obj_Rpt); } }