protected void btnReport_Click(object sender, EventArgs e) { try { lblAllTran.Text = ""; divPrint.Visible = true; DateTime startDate, endDate; int iLedgerID = 0; string sLedgerName = string.Empty; Double totalBal = 0.0d; DataSet ds = new DataSet(); ReportsBL.ReportClass rptSalesReport; rptSalesReport = new ReportsBL.ReportClass(); iLedgerID = Convert.ToInt32(drpLedgerName.SelectedItem.Value); sLedgerName = drpLedgerName.SelectedItem.Text; startDate = Convert.ToDateTime(txtStartDate.Text); endDate = Convert.ToDateTime(txtEndDate.Text); ds = rptSalesReport.GenerateSalesBillwise(sDataSource, startDate, endDate, iLedgerID); gvSales.DataSource = ds; gvSales.DataBind(); ds = rptSalesReport.GenerateSalesReturnBillwise(sDataSource, startDate, endDate, iLedgerID); gvSalesReturn.DataSource = ds; gvSalesReturn.DataBind(); ds = rptSalesReport.GenerateSalesDetails(sDataSource, startDate, endDate, iLedgerID); gvSalesBill.DataSource = ds; gvSalesBill.DataBind(); ds = rptSalesReport.GenerateSalesReturnDetails(sDataSource, startDate, endDate, iLedgerID); gvSalesReturnBill.DataSource = ds; gvSalesReturnBill.DataBind(); ds = rptSalesReport.GenerateSalesItemwise(sDataSource, startDate, endDate, iLedgerID); if (ds != null && ds.Tables[0].Rows.Count > 0) { gvSalesItemwise.DataSource = ds; gvSalesItemwise.DataBind(); } else { gvSalesItemwise.DataSource = null; gvSalesItemwise.DataBind(); lblSales.Text = "0.00"; } ds = rptSalesReport.GenerateSalesReturnItemwise(sDataSource, startDate, endDate, iLedgerID); if (ds != null && ds.Tables[0].Rows.Count > 0) { gvSalesReturnItemwise.DataSource = ds; gvSalesReturnItemwise.DataBind(); } else { lblSalesReturn.Text = "0.00"; gvSalesReturnItemwise.DataSource = null; gvSalesReturnItemwise.DataBind(); } ds = rptSalesReport.GenerateCreditDebitTran(sDataSource, startDate, endDate, iLedgerID); gvTran.DataSource = ds; gvTran.DataBind(); totalBal = Convert.ToDouble(lblSales.Text) - Convert.ToDouble(lblSalesReturn.Text); lblBalance.Text = totalBal.ToString("#0.00"); lblTotalSalesTran.Text = lblTotalBill.Text; lblTotalSalesReturnTran.Text = lblTotalReturnBill.Text; //ExportToExcel(); } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
protected void btnReport_Click(object sender, EventArgs e) { try { lblAllTran.Text = ""; divPrint.Visible = true; DateTime startDate, endDate; int iLedgerID = 0; string sLedgerName = string.Empty; Double totalBal = 0.0d; DataSet ds = new DataSet(); ReportsBL.ReportClass rptSalesReport; rptSalesReport = new ReportsBL.ReportClass(); iLedgerID = Convert.ToInt32(drpLedgerName.SelectedItem.Value); sLedgerName = drpLedgerName.SelectedItem.Text; startDate = Convert.ToDateTime(txtStartDate.Text); endDate = Convert.ToDateTime(txtEndDate.Text); ds = rptSalesReport.GenerateSalesBillwise(sDataSource, startDate, endDate, iLedgerID); gvSales.DataSource = ds; gvSales.DataBind(); ds = rptSalesReport.GenerateSalesReturnBillwise(sDataSource, startDate, endDate, iLedgerID); gvSalesReturn.DataSource = ds; gvSalesReturn.DataBind(); ds = rptSalesReport.GenerateSalesDetails(sDataSource, startDate, endDate, iLedgerID); gvSalesBill.DataSource = ds; gvSalesBill.DataBind(); ds = rptSalesReport.GenerateSalesReturnDetails(sDataSource, startDate, endDate, iLedgerID); gvSalesReturnBill.DataSource = ds; gvSalesReturnBill.DataBind(); ds = rptSalesReport.GenerateSalesItemwise(sDataSource, startDate, endDate, iLedgerID); if (ds != null && ds.Tables[0].Rows.Count > 0) { gvSalesItemwise.DataSource = ds; gvSalesItemwise.DataBind(); } else { gvSalesItemwise.DataSource = null; gvSalesItemwise.DataBind(); lblSales.Text = "0.00"; } ds = rptSalesReport.GenerateSalesReturnItemwise(sDataSource, startDate, endDate, iLedgerID); if (ds != null && ds.Tables[0].Rows.Count > 0) { gvSalesReturnItemwise.DataSource = ds; gvSalesReturnItemwise.DataBind(); } else { lblSalesReturn.Text = "0.00"; gvSalesReturnItemwise.DataSource = null; gvSalesReturnItemwise.DataBind(); } ds = rptSalesReport.GenerateCreditDebitTran(sDataSource, startDate, endDate, iLedgerID); gvTran.DataSource = ds; gvTran.DataBind(); totalBal = Convert.ToDouble(lblSales.Text) - Convert.ToDouble(lblSalesReturn.Text); lblBalance.Text = totalBal.ToString("#0.00"); lblTotalSalesTran.Text = lblTotalBill.Text; lblTotalSalesReturnTran.Text = lblTotalReturnBill.Text; Response.Write("<script language='javascript'> window.open('SalesPerformanceDealerReport1.aspx?iLedgerID=" + iLedgerID + "&sLedgerName=" + sLedgerName + "&startDate=" + Convert.ToDateTime(startDate) + "&endDate=" + Convert.ToDateTime(endDate) + " ' , 'window','height=700,width=1000,left=172,top=10,toolbar=yes,scrollbars=yes,resizable=yes');</script>"); divPrint.Visible = false; //ExportToExcel(); } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
protected void Page_Load(object sender, EventArgs e) { try { sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString(); if (!IsPostBack) { loadLedger(); txtStartDate.Text = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).ToShortDateString(); DateTime indianStd = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.Now, "India Standard Time"); string dtaa = Convert.ToDateTime(indianStd).ToString("dd/MM/yyyy"); txtEndDate.Text = dtaa; //txtEndDate.Text = DateTime.Now.ToShortDateString(); lblAllTran.Text = ""; divPrint.Visible = true; DateTime startDate, endDate; int iLedgerID = 0; string sLedgerName = string.Empty; Double totalBal = 0.0d; DataSet ds = new DataSet(); ReportsBL.ReportClass rptSalesReport; rptSalesReport = new ReportsBL.ReportClass(); iLedgerID = Convert.ToInt32(drpLedgerName.SelectedItem.Value); sLedgerName = drpLedgerName.SelectedItem.Text; DateTime stdt = Convert.ToDateTime(txtStartDate.Text); DateTime etdt = Convert.ToDateTime(txtEndDate.Text); if (Request.QueryString["startDate"] != null) { stdt = Convert.ToDateTime(Request.QueryString["startDate"].ToString()); } if (Request.QueryString["endDate"] != null) { etdt = Convert.ToDateTime(Request.QueryString["endDate"].ToString()); } startDate = Convert.ToDateTime(stdt); endDate = Convert.ToDateTime(etdt); if (Request.QueryString["iLedgerID"] != null) { iLedgerID = Convert.ToInt32(Request.QueryString["iLedgerID"].ToString()); } if (Request.QueryString["sLedgerName"] != null) { sLedgerName = Request.QueryString["sLedgerName"].ToString(); } ds = rptSalesReport.GenerateSalesBillwise(sDataSource, startDate, endDate, iLedgerID); gvSales.DataSource = ds; gvSales.DataBind(); ds = rptSalesReport.GenerateSalesReturnBillwise(sDataSource, startDate, endDate, iLedgerID); gvSalesReturn.DataSource = ds; gvSalesReturn.DataBind(); ds = rptSalesReport.GenerateSalesDetails(sDataSource, startDate, endDate, iLedgerID); gvSalesBill.DataSource = ds; gvSalesBill.DataBind(); ds = rptSalesReport.GenerateSalesReturnDetails(sDataSource, startDate, endDate, iLedgerID); gvSalesReturnBill.DataSource = ds; gvSalesReturnBill.DataBind(); ds = rptSalesReport.GenerateSalesItemwise(sDataSource, startDate, endDate, iLedgerID); if (ds != null && ds.Tables[0].Rows.Count > 0) { gvSalesItemwise.DataSource = ds; gvSalesItemwise.DataBind(); } else { gvSalesItemwise.DataSource = null; gvSalesItemwise.DataBind(); lblSales.Text = "0.00"; } ds = rptSalesReport.GenerateSalesReturnItemwise(sDataSource, startDate, endDate, iLedgerID); if (ds != null && ds.Tables[0].Rows.Count > 0) { gvSalesReturnItemwise.DataSource = ds; gvSalesReturnItemwise.DataBind(); } else { lblSalesReturn.Text = "0.00"; gvSalesReturnItemwise.DataSource = null; gvSalesReturnItemwise.DataBind(); } ds = rptSalesReport.GenerateCreditDebitTran(sDataSource, startDate, endDate, iLedgerID); gvTran.DataSource = ds; gvTran.DataBind(); totalBal = Convert.ToDouble(lblSales.Text) - Convert.ToDouble(lblSalesReturn.Text); lblBalance.Text = totalBal.ToString("#0.00"); lblTotalSalesTran.Text = lblTotalBill.Text; lblTotalSalesReturnTran.Text = lblTotalReturnBill.Text; div1.Visible = false; } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }