private void CommonTemplate_Load(object sender, EventArgs e) { try { ProgressBarControl progressBar = new ProgressBarControl(); ProjectFunctions.ToolStripVisualize(Menu_ToolStrip); lbl.Text = Title; _RangeSelector = new RangeSelector() { StartDate = GlobalVariables.FinYearStartDate, EndDate = GlobalVariables.FinYearEndDate }; //_RangeSelector.DtFrom.EditValue = GlobalVariables.FinYearStartDate; //_RangeSelector.DtEnd.EditValue = GlobalVariables.FinYearEndDate; _RangeSelector.BtnLoad.Click += new EventHandler(BtnLoad_Click); _RangeSelector.Controls.Add(Chk_Selected); Chk_Selected.Text = "Select Party"; Chk_Selected.CheckedChanged += Chk_Selected_CheckedChanged; //RangeSelector.Chk_Selected.CheckedChanged += new EventHandler(Selected_CheckedChanged); Controls.Add(_RangeSelector); Controls.Add(progressBar); progressBar.Dock = DockStyle.Fill; _RangeSelector.Hide(); ProjectFunctions.ButtonVisualize(_RangeSelector.BtnLoad); ProjectFunctions.DatePickerVisualize(_RangeSelector); } catch (Exception ex) { ProjectFunctions.SpeakError(ex.Message); } }
private void BtnLoad_Click(object sender, EventArgs e) { try { Cursor.Current = Cursors.WaitCursor; StartDate = _RangeSelector.DtFrom.DateTime.Date; EndDate = _RangeSelector.DtEnd.DateTime.Date; DataRow Currentrow = HelpGrid.GetDataRow(HelpGrid.FocusedRowHandle); switch (GlobalVariables.ProgCode) { case "PROG143": DataSet Ds = ProjectFunctions.GetDataSet(string.Format("Exec [Sp_CashBookRpt] '{0:yyyy-MM-dd}', '{1:yyyy-MM-dd}'", StartDate.Date, EndDate.Date)); rpt_CashBook RptDoc1 = new rpt_CashBook(); (RptDoc1.ReportDefinition.ReportObjects["txtCompanyName"] as TextObject).Text = GlobalVariables.CompanyName; (RptDoc1.ReportDefinition.ReportObjects["txtReportHead"] as TextObject).Text = "CASH BOOK"; (RptDoc1.ReportDefinition.ReportObjects["txtDateRange"] as TextObject).Text = string.Format("From ({0} to {1}) ", StartDate.Date.ToString("dd-MM-yyyy"), EndDate.Date.ToString("dd-MM-yyyy")); RptDoc1.SetDataSource(Ds.Tables[0]); lbl.Text = string.Format(Title + " ({0} to {1}) ", StartDate.Date.ToString("dd-MM-yyyy"), EndDate.Date.ToString("dd-MM-yyyy")); crystalReportViewer1.ReportSource = RptDoc1; _RangeSelector.Hide(); break; case "PROG144": HelpGrid.CloseEditor(); HelpGrid.UpdateCurrentRow(); DataSet DsRecoBank = ProjectFunctions.GetDataSet(string.Format("Exec [SP_RecoBank] '{0:yyyy-MM-dd}', '253'", EndDate.Date)); rpt_BankReco RptDoc2 = new rpt_BankReco(); (RptDoc2.ReportDefinition.ReportObjects["txtCompanyName"] as TextObject).Text = GlobalVariables.CompanyName; (RptDoc2.ReportDefinition.ReportObjects["txtReportName"] as TextObject).Text = "Bank Reco"; (RptDoc2.ReportDefinition.ReportObjects["txtDateRange"] as TextObject).Text = string.Format("From ({0} to {1}) ", StartDate.Date.ToString("dd-MM-yyyy"), EndDate.Date.ToString("dd-MM-yyyy")); RptDoc2.SetDataSource(DsRecoBank.Tables[0]); lbl.Text = string.Format(Title + " ({0} to {1}) ", StartDate.Date.ToString("dd-MM-yyyy"), EndDate.Date.ToString("dd-MM-yyyy")); crystalReportViewer1.ReportSource = RptDoc2; crystalReportViewer1.Show(); crystalReportViewer1.BringToFront(); _RangeSelector.Hide(); HelpGridCtrl.Hide(); break; case "PROG145": DataSet dsDayBook = ProjectFunctions.GetDataSet(string.Format("[Sp_PrepareDayBook] '{0:yyyy-MM-dd}', '{1:yyyy-MM-dd}'", StartDate.Date, EndDate.Date)); rpt_DayBook RptDoc3 = new rpt_DayBook(); (RptDoc3.ReportDefinition.ReportObjects["txtCompanyName"] as TextObject).Text = GlobalVariables.CompanyName; (RptDoc3.ReportDefinition.ReportObjects["txtReportHead"] as TextObject).Text = "Day Book"; (RptDoc3.ReportDefinition.ReportObjects["txtDateRange"] as TextObject).Text = string.Format("From ({0} to {1}) ", StartDate.Date.ToString("dd-MM-yyyy"), EndDate.Date.ToString("dd-MM-yyyy")); RptDoc3.SetDataSource(dsDayBook.Tables[0]); lbl.Text = string.Format(Title + " ({0} to {1}) ", StartDate.Date.ToString("dd-MM-yyyy"), EndDate.Date.ToString("dd-MM-yyyy")); crystalReportViewer1.ReportSource = RptDoc3; crystalReportViewer1.Show(); crystalReportViewer1.BringToFront(); _RangeSelector.Hide(); break; case "PROG147": DataSet ds = ProjectFunctions.GetDataSet(string.Format("[Sp_PrepareBankBook] '{0:yyyy-MM-dd}', '{1:yyyy-MM-dd}'", StartDate.Date, EndDate.Date)); Rpt_BankBook RptDoc = new Rpt_BankBook(); (RptDoc.Section2.ReportObjects["txtCompanyName"] as TextObject).Text = GlobalVariables.CompanyName; (RptDoc.Section2.ReportObjects["txtReportName"] as TextObject).Text = "Bank Book"; (RptDoc.Section2.ReportObjects["txtDateRange"] as TextObject).Text = string.Format("From ({0} to {1}) ", StartDate.Date.ToString("dd-MM-yyyy"), EndDate.Date.ToString("dd-MM-yyyy")); lbl.Text = string.Format(Title + " ({0} to {1})", StartDate.Date.ToString("dd-MM-yyyy"), EndDate.Date.ToString("dd-MM-yyyy")); RptDoc.SetDataSource(ds.Tables[0]); crystalReportViewer1.ReportSource = RptDoc; crystalReportViewer1.Show(); crystalReportViewer1.BringToFront(); _RangeSelector.Hide(); break; case "PROG165": if (Currentrow != null) { DataSet dsLedger = ProjectFunctions.GetDataSet(string.Format("[sp_ZoomPartyAct] '{0:yyyy-MM-dd}', '{1:yyyy-MM-dd}','{2}'", StartDate.Date, EndDate.Date, Currentrow["AccCode"].ToString())); PartyLedger RptLedger = new PartyLedger(); (RptLedger.Section2.ReportObjects["txtCompanyName"] as TextObject).Text = GlobalVariables.CompanyName; (RptLedger.Section2.ReportObjects["txtReportName"] as TextObject).Text = "Party Ledger"; (RptLedger.Section2.ReportObjects["txtDateRange"] as TextObject).Text = string.Format("From ({0} to {1}) ", StartDate.Date.ToString("dd-MM-yyyy"), EndDate.Date.ToString("dd-MM-yyyy")); lbl.Text = string.Format(Title + " ({0} to {1})", StartDate.Date.ToString("dd-MM-yyyy"), EndDate.Date.ToString("dd-MM-yyyy")); RptLedger.SetDataSource(dsLedger.Tables[0]); crystalReportViewer1.ReportSource = RptLedger; crystalReportViewer1.Show(); crystalReportViewer1.BringToFront(); _RangeSelector.Hide(); } else { ProjectFunctions.SpeakError("Plz Select Party First"); } break; default: break; } } catch (Exception ex) { XtraMessageBox.Show(ex.Message); } }