Exemple #1
0
        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);
            //}
        }
Exemple #2
0
        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();
        }