private void btnOK_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { grdViewDemand.FocusedRowHandle = grdViewDemand.FocusedRowHandle + 1; if (grdViewDemand.RowCount == 0) { Close(); return; } if (grdViewDemand.FocusedRowHandle < 0) { Close(); return; } Cursor.Current = Cursors.WaitCursor; if (m_sType == "DL") { GetLeadId(); GetBillId(); if (m_sLeadId == "") { Close(); return; } ReportDocument cryRpt = new ReportDocument(); string strReportPath = ""; if (m_sReportName == "") { strReportPath = Application.StartupPath + "\\DemandLetter.Rpt"; } else { strReportPath = Application.StartupPath + "\\" + m_sReportName + ""; } cryRpt.Load(strReportPath); string[] DataFiles = new string[] { BsfGlobal.g_sCRMDBName, BsfGlobal.g_sCRMDBName, BsfGlobal.g_sCRMDBName, BsfGlobal.g_sCRMDBName, BsfGlobal.g_sCRMDBName, BsfGlobal.g_sCRMDBName, BsfGlobal.g_sWorkFlowDBName, BsfGlobal.g_sWorkFlowDBName, BsfGlobal.g_sWorkFlowDBName, BsfGlobal.g_sWorkFlowDBName, BsfGlobal.g_sCRMDBName, BsfGlobal.g_sCRMDBName, BsfGlobal.g_sRateAnalDBName, BsfGlobal.g_sCRMDBName, BsfGlobal.g_sRateAnalDBName }; frmReport objReport = new frmReport(); objReport.Text = "Report : " + strReportPath; objReport.ReportConvert(cryRpt, DataFiles); objReport.rptViewer.ReportSource = null; objReport.rptViewer.ReportSource = cryRpt; if (cryRpt.Database.Tables.Count > 1) { string s = "{ProgressBillRegister.LeadId} In [" + m_sLeadId.TrimEnd(',') + "] And {ProgressBillRegister.PBillId} In [" + m_sBillId.TrimEnd(',') + "]"; if (s.Length > 0) { cryRpt.RecordSelectionFormula = s; } objReport.rptViewer.SelectionFormula = s; } else { DataTable dt = new DataTable(); dt = ProgBillBL.GetDemandLetterFirstPrint(m_iCCId, m_sBillId, m_sLeadId); cryRpt.SetDataSource(dt); } if (cryRpt.Subreports.Count != 0) { string[] Sub_DataFiles = new string[] { BsfGlobal.g_sCRMDBName, BsfGlobal.g_sCRMDBName, BsfGlobal.g_sCRMDBName }; objReport.Sub_ReportConvert(cryRpt, DataFiles, 0); } objReport.WindowState = FormWindowState.Maximized; objReport.rptViewer.Refresh(); objReport.Show(); } else { if (grdViewDemand.RowCount == 0) { Close(); return; } ProgBillBL.InsertDLStatus(dtStatus, m_iAgeId); FillGridStatus(); } grdViewDemand.FocusedRowHandle = grdViewDemand.FocusedRowHandle - 1; Cursor.Current = Cursors.Default; }
private void btnNote_ItemClick(object sender, ItemClickEventArgs e) { if (grdPBTransView.FocusedRowHandle < 0) { return; } int p_FlatId = 0, p_BillId = 0, p_ProgRegId = 0; p_FlatId = Convert.ToInt32(grdPBTransView.GetRowCellValue(grdPBTransView.FocusedRowHandle, "FlatId")); p_ProgRegId = Convert.ToInt32(grdPBTransView.GetRowCellValue(grdPBTransView.FocusedRowHandle, "ProgRegId")); p_BillId = Convert.ToInt32(grdPBTransView.GetRowCellValue(grdPBTransView.FocusedRowHandle, "PBillId")); DataTable dt = new DataTable(); dt = ProgBillBL.GetDNPrint(p_FlatId, p_BillId, p_ProgRegId); string strReportPath = string.Empty; Cursor.Current = Cursors.WaitCursor; frmReport objReport = new frmReport(); strReportPath = Application.StartupPath + "\\DemandNote.rpt"; objReport.Text = "Report : " + strReportPath; ReportDocument cryRpt = new ReportDocument(); cryRpt.Load(strReportPath); cryRpt.SetDataSource(dt); //cryRpt.DataDefinition.FormulaFields["CompanyName"].Text = String.Format("'{0}'", BsfGlobal.g_sCompanyName); objReport.rptViewer.ReportSource = cryRpt; objReport.rptViewer.Refresh(); objReport.Show(); //try //{ // if (gridView1.FocusedRowHandle < 0) return; // int p_FlatId = 0, p_BillId = 0, p_PlotId = 0; decimal d_SchPer = 0; // string s = ""; frmReport objReport; ReportDocument cryRpt; // string[] DataFiles; // if (m_sBussinessType == "B") // { // p_FlatId = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "FlatId")); // d_SchPer = ProgBillBL.GetSchPer(p_FlatId); // p_BillId = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "ProgRegId")); // int CCId = Convert.ToInt32(gridView1.GetFocusedRowCellValue("CostCentreId").ToString()); // objReport = new frmReport(); // string strReportPath = Application.StartupPath + "\\DemandNote.Rpt"; // cryRpt = new ReportDocument(); // cryRpt.Load(strReportPath); // s = "{ProgressBillRegister.FlatId}=" + p_FlatId + ""; // DataFiles = new string[] { BsfGlobal.g_sCRMDBName, BsfGlobal.g_sCRMDBName,BsfGlobal.g_sCRMDBName, // BsfGlobal.g_sCRMDBName,BsfGlobal.g_sCRMDBName,BsfGlobal.g_sCRMDBName, // BsfGlobal.g_sWorkFlowDBName,BsfGlobal.g_sWorkFlowDBName}; // } // else // { // p_PlotId = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PlotDetailsId")); // p_BillId = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PBillId")); // int CCId = Convert.ToInt32(gridView1.GetFocusedRowCellValue("CostCentreId").ToString()); // objReport = new frmReport(); // string strReportPath = Application.StartupPath + "\\DemandNote.Rpt"; // cryRpt = new ReportDocument(); // cryRpt.Load(strReportPath); // s = "{PlotProgressBillRegister.FlatId}=" + p_FlatId + ""; // DataFiles = new string[] { BsfGlobal.g_sCRMDBName, BsfGlobal.g_sCRMDBName,BsfGlobal.g_sCRMDBName, BsfGlobal.g_sCRMDBName,BsfGlobal.g_sCRMDBName, BsfGlobal.g_sCRMDBName, // BsfGlobal.g_sWorkFlowDBName,BsfGlobal.g_sWorkFlowDBName,BsfGlobal.g_sWorkFlowDBName,BsfGlobal.g_sWorkFlowDBName,BsfGlobal.g_sCRMDBName,BsfGlobal.g_sCRMDBName,BsfGlobal.g_sCRMDBName,BsfGlobal.g_sCRMDBName}; // } // objReport.ReportConvert(cryRpt, DataFiles); // if (s.Length > 0) // cryRpt.RecordSelectionFormula = s; // objReport.rptViewer.ReportSource = null; // objReport.rptViewer.SelectionFormula = s; // objReport.rptViewer.ReportSource = cryRpt; // cryRpt.DataDefinition.FormulaFields["Decimal"].Text = string.Format(CommFun.g_iCurrencyDigit.ToString()); // cryRpt.DataDefinition.FormulaFields["Percent"].Text = d_SchPer.ToString(); // objReport.WindowState = FormWindowState.Maximized; // objReport.Show(); //} //catch (Exception ex) //{ // BsfGlobal.CustomException(ex.Message, ex.StackTrace); //} }
private void barButtonItem5_ItemClick(object sender, ItemClickEventArgs e) { if (DGvTransView.FocusedRowHandle < 0) { return; } int p_FlatId = 0; DataTable dt = new DataTable(); int p_MaintanceId = 0; string s = ""; frmReport objReport; ReportDocument cryRpt; decimal dBillAmount = 0, dArrear = 0; DateTime dStartDate = DateTime.Today;; DateTime dEndDate = DateTime.Today;; string[] DataFiles; string sHeader = ""; int sMonth = 0; int sYear = 0; DateTime sFifetDate = DateTime.Today; p_FlatId = Convert.ToInt32(DGvTransView.GetRowCellValue(DGvTransView.FocusedRowHandle, "FlatId")); p_MaintanceId = Convert.ToInt32(DGvTransView.GetRowCellValue(DGvTransView.FocusedRowHandle, "MaintenanceId")); dt = MaintenanceBL.GetReport(p_FlatId, p_MaintanceId); if (dt.Rows.Count > 0) { dBillAmount = Convert.ToDecimal(CommFun.IsNullCheck(dt.Rows[0]["BillAmount"], CommFun.datatypes.vartypenumeric)); dArrear = Convert.ToDecimal(CommFun.IsNullCheck(dt.Rows[0]["Arrear"], CommFun.datatypes.vartypenumeric)); if (dArrear == 0) { dStartDate = Convert.ToDateTime(CommFun.IsNullCheck(DGvTransView.GetRowCellValue(DGvTransView.FocusedRowHandle, "StartDate"), CommFun.datatypes.VarTypeDate)); dEndDate = Convert.ToDateTime(CommFun.IsNullCheck(DGvTransView.GetRowCellValue(DGvTransView.FocusedRowHandle, "EndDate"), CommFun.datatypes.VarTypeDate)); sMonth = dStartDate.Month; sYear = dStartDate.Year; sFifetDate = Convert.ToDateTime("15" + "/" + sMonth + "/" + sYear); } else { dStartDate = Convert.ToDateTime(CommFun.IsNullCheck(dt.Rows[0]["FromDate"], CommFun.datatypes.VarTypeDate)); dEndDate = Convert.ToDateTime(CommFun.IsNullCheck(dt.Rows[0]["ToDate"], CommFun.datatypes.VarTypeDate)); sMonth = dEndDate.Month; sYear = dEndDate.Year; sFifetDate = Convert.ToDateTime("15" + "/" + sMonth + "/" + sYear); } //dEndDate = Convert.ToDateTime(CommFun.IsNullCheck(dt.Rows[0]["ToDate"], CommFun.datatypes.VarTypeDate)); } decimal dTotalPayAmt = Convert.ToDecimal(dBillAmount + dArrear); objReport = new frmReport(); string strReportPath = Application.StartupPath + "\\Maintenance.Rpt"; cryRpt = new ReportDocument(); cryRpt.Load(strReportPath); s = "{MaintenanceDet.FlatId}=" + p_FlatId + " "; DataFiles = new string[] { BsfGlobal.g_sCRMDBName, BsfGlobal.g_sCRMDBName, BsfGlobal.g_sCRMDBName, BsfGlobal.g_sCRMDBName, BsfGlobal.g_sWorkFlowDBName, BsfGlobal.g_sWorkFlowDBName, BsfGlobal.g_sWorkFlowDBName, BsfGlobal.g_sWorkFlowDBName, BsfGlobal.g_sCRMDBName }; objReport.ReportConvert(cryRpt, DataFiles); if (s.Length > 0) { cryRpt.RecordSelectionFormula = s; } objReport.rptViewer.ReportSource = null; objReport.rptViewer.SelectionFormula = s; objReport.rptViewer.ReportSource = cryRpt; cryRpt.DataDefinition.FormulaFields["Decimal"].Text = string.Format(CommFun.g_iCurrencyDigit.ToString()); cryRpt.DataDefinition.FormulaFields["MainAmt"].Text = "'" + string.Format(dBillAmount.ToString()) + "'"; cryRpt.DataDefinition.FormulaFields["Arrear"].Text = "'" + string.Format(dArrear.ToString()) + "'"; cryRpt.DataDefinition.FormulaFields["TotalPay"].Text = "'" + string.Format(dTotalPayAmt.ToString()) + "'"; if (dArrear == 0) { cryRpt.DataDefinition.FormulaFields["EndFiftenDate"].Text = String.Format("'{0}'", sHeader = sHeader = String.Format(" {0} ", sFifetDate.ToString("dd-MMM-yyyy"))); cryRpt.DataDefinition.FormulaFields["StartfiftenDate"].Text = String.Format("'{0}'", sHeader = sHeader = String.Format(" {0} ", sFifetDate.ToString("dd-MMM-yyyy"))); } else { cryRpt.DataDefinition.FormulaFields["EndFiftenDate"].Text = String.Format("'{0}'", sHeader = sHeader = String.Format(" {0} ", sFifetDate.ToString("dd-MMM-yyyy"))); cryRpt.DataDefinition.FormulaFields["StartfiftenDate"].Text = String.Format("'{0}'", sHeader = sHeader = String.Format(" {0} ", sFifetDate.ToString("dd-MMM-yyyy"))); } cryRpt.DataDefinition.FormulaFields["Period"].Text = String.Format("'{0}'", sHeader = sHeader = String.Format(" {0} to {1} ", dStartDate.ToString("dd-MMM-yyyy"), dEndDate.ToString("dd-MMM-yyyy"))); objReport.WindowState = FormWindowState.Maximized; objReport.rptViewer.Refresh(); objReport.Show(); }
private void btnRep_ItemClick(object sender, ItemClickEventArgs e) { if (grdPBTransView.FocusedRowHandle < 0) { return; } int p_FlatId = 0, p_BillId = 0, p_ProgRegId = 0; p_FlatId = Convert.ToInt32(grdPBTransView.GetRowCellValue(grdPBTransView.FocusedRowHandle, "FlatId")); p_ProgRegId = Convert.ToInt32(grdPBTransView.GetRowCellValue(grdPBTransView.FocusedRowHandle, "ProgRegId")); p_BillId = Convert.ToInt32(grdPBTransView.GetRowCellValue(grdPBTransView.FocusedRowHandle, "PBillId")); DataTable dt = new DataTable(); DataTable dtP = new DataTable(); dt = ProgBillBL.GetDNPrint(p_FlatId, p_BillId, p_ProgRegId); dtP = ProgBillBL.GetDNPaymentSchPrint(p_FlatId, p_BillId, p_ProgRegId); DataView view = new DataView(dtP); // Sort by State and ZipCode column in descending order view.Sort = "PaymentSchId ASC"; dtP = view.ToTable(); string strReportPath = string.Empty; Cursor.Current = Cursors.WaitCursor; frmReport objReport = new frmReport() { WindowState = FormWindowState.Maximized }; strReportPath = Application.StartupPath + "\\DemandLetter.rpt"; objReport.Text = "Report : " + strReportPath; ReportDocument cryRpt = new ReportDocument(); cryRpt.Load(strReportPath); cryRpt.SetDataSource(dt); //cryRpt.DataDefinition.FormulaFields["CompanyName"].Text = String.Format("'{0}'", BsfGlobal.g_sCompanyName); int iCnt = 0; foreach (ReportDocument subreport in cryRpt.Subreports) { if (subreport.Name.ToUpper() == "RECEIPT") { cryRpt.Subreports[iCnt].SetDataSource(dtP); } iCnt += 1; } //cryRpt.Subreports[0].SetDataSource(dtP); objReport.rptViewer.ReportSource = cryRpt; objReport.rptViewer.Refresh(); objReport.Show(); //if (gridView1.FocusedRowHandle < 0) return; //int p_FlatId = 0, p_BillId = 0, p_PlotId = 0; //string s = ""; frmReport objReport; ReportDocument cryRpt; //string[] DataFiles; //if (m_sBussinessType == "B") //{ // p_FlatId = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "FlatId")); // p_BillId = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PBillId")); // int CCId = Convert.ToInt32(gridView1.GetFocusedRowCellValue("CostCentreId").ToString()); // objReport = new frmReport(); // string strReportPath = Application.StartupPath + "\\ProgressBillMaster.Rpt"; // cryRpt = new ReportDocument(); // cryRpt.Load(strReportPath); // s = "{ProgressBillRegister.PBillId}=" + p_BillId + ""; // DataFiles = new string[] { BsfGlobal.g_sCRMDBName, BsfGlobal.g_sCRMDBName,BsfGlobal.g_sCRMDBName, // BsfGlobal.g_sCRMDBName,BsfGlobal.g_sCRMDBName,BsfGlobal.g_sCRMDBName, // BsfGlobal.g_sWorkFlowDBName,BsfGlobal.g_sWorkFlowDBName}; //} //else //{ // p_PlotId = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PlotDetailsId")); // p_BillId = Convert.ToInt32(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PBillId")); // int CCId = Convert.ToInt32(gridView1.GetFocusedRowCellValue("CostCentreId").ToString()); // objReport = new frmReport(); // string strReportPath = Application.StartupPath + "\\PlotProgressBill.Rpt"; // cryRpt = new ReportDocument(); // cryRpt.Load(strReportPath); // s = "{PlotProgressBillRegister.PBillId}=" + p_BillId + ""; // DataFiles = new string[] { BsfGlobal.g_sCRMDBName, BsfGlobal.g_sCRMDBName, // BsfGlobal.g_sWorkFlowDBName,BsfGlobal.g_sWorkFlowDBName,BsfGlobal.g_sCRMDBName,BsfGlobal.g_sRateAnalDBName}; //} //objReport.ReportConvert(cryRpt, DataFiles); //if (s.Length > 0) // cryRpt.RecordSelectionFormula = s; //objReport.rptViewer.ReportSource = null; //objReport.rptViewer.SelectionFormula = s; //objReport.rptViewer.ReportSource = cryRpt; //cryRpt.DataDefinition.FormulaFields["Decimal"].Text = string.Format(CommFun.g_iCurrencyDigit.ToString()); //objReport.WindowState = FormWindowState.Maximized; //objReport.rptViewer.Refresh(); //objReport.Show(); }
private void btnPrint1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Cursor.Current = Cursors.WaitCursor; DataTable dtUnit = new DataTable(); dtUnit = grdUnit.DataSource as DataTable; DataTable dtOC = new DataTable(); dtOC = grdOC.DataSource as DataTable; DataTable dtPS = new DataTable(); dtPS = grdPayment.DataSource as DataTable; string strReportPath = string.Empty; Cursor.Current = Cursors.WaitCursor; frmReport objReport = new frmReport() { WindowState = FormWindowState.Maximized }; strReportPath = Application.StartupPath + "\\TermSheet.rpt"; objReport.Text = "Report : " + strReportPath; ReportDocument cryRpt = new ReportDocument(); cryRpt.Load(strReportPath); cryRpt.SetDataSource(dtUnit); cryRpt.DataDefinition.FormulaFields["H2"].Text = String.Format(" 'TERM SHEET - {0}' ", dtUnit.Rows[5]["Actual"].ToString()); cryRpt.DataDefinition.FormulaFields["H1"].Text = String.Format(" '{0}' ", dtUnit.Rows[6]["Actual"].ToString()); cryRpt.DataDefinition.FormulaFields["LeadName"].Text = String.Format(" '{0}' ", dtUnit.Rows[0]["Actual"].ToString()); cryRpt.DataDefinition.FormulaFields["BlockName"].Text = String.Format(" '{0}' ", dtUnit.Rows[1]["Actual"].ToString()); cryRpt.DataDefinition.FormulaFields["LevelName"].Text = String.Format(" '{0}' ", dtUnit.Rows[2]["Actual"].ToString()); cryRpt.DataDefinition.FormulaFields["FlatType"].Text = String.Format(" '{0}' ", dtUnit.Rows[3]["Actual"].ToString()); cryRpt.DataDefinition.FormulaFields["FlatNo"].Text = String.Format(" '{0}' ", dtUnit.Rows[4]["Actual"].ToString()); cryRpt.DataDefinition.FormulaFields["Area"].Text = String.Format(" '{0}' ", dtUnit.Rows[7]["ActualValue"].ToString()); cryRpt.DataDefinition.FormulaFields["BasicRate"].Text = String.Format(" '{0}' ", dtUnit.Rows[8]["ActualValue"].ToString()); cryRpt.DataDefinition.FormulaFields["TotalApartmentCost"].Text = String.Format(" '{0}' ", dtUnit.Rows[9]["ActualValue"].ToString()); cryRpt.DataDefinition.FormulaFields["PLC"].Text = String.Format(" '{0}' ", dtUnit.Rows[10]["ActualValue"].ToString()); cryRpt.DataDefinition.FormulaFields["UDS"].Text = String.Format(" '{0}' ", dtUnit.Rows[11]["ActualValue"].ToString()); cryRpt.DataDefinition.FormulaFields["UDSValue"].Text = String.Format(" '{0}' ", dtUnit.Rows[12]["ActualValue"].ToString()); cryRpt.DataDefinition.FormulaFields["LessUDSValue"].Text = String.Format(" '{0}' ", dtUnit.Rows[13]["ActualValue"].ToString()); cryRpt.DataDefinition.FormulaFields["ServiceTax"].Text = String.Format(" '{0}' ", dtUnit.Rows[14]["ActualValue"].ToString()); //cryRpt.DataDefinition.FormulaFields["CompanyName"].Text = String.Format("'{0}'", BsfGlobal.g_sCompanyName); int iCnt = 0; foreach (ReportDocument subreport in cryRpt.Subreports) { if (subreport.Name.ToUpper() == "OTHERCOST") { cryRpt.Subreports[iCnt].SetDataSource(dtOC); cryRpt.Subreports[iCnt].DataDefinition.FormulaFields["TotalApartmentCost"].Text = String.Format(" '{0}' ", dtUnit.Rows[9]["ActualValue"].ToString()); cryRpt.Subreports[iCnt].DataDefinition.FormulaFields["ServiceTax"].Text = String.Format(" '{0}' ", dtUnit.Rows[14]["ActualValue"].ToString()); } if (subreport.Name.ToUpper() == "PAYMENTSCHEDULE") { cryRpt.Subreports[iCnt].SetDataSource(dtPS); } iCnt += 1; } objReport.rptViewer.ReportSource = cryRpt; objReport.rptViewer.Refresh(); objReport.Show(); Cursor.Current = Cursors.Default; }