Esempio n. 1
0
        private void barButtonItem1_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (grdViewReceipt.FocusedRowHandle < 0)
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            int    p_RecpId = Convert.ToInt32(grdViewReceipt.GetRowCellValue(grdViewReceipt.FocusedRowHandle, "ReceiptId"));
            int    iCCId    = Convert.ToInt32(grdViewReceipt.GetRowCellValue(grdViewReceipt.FocusedRowHandle, "CostCentreId"));
            string sFlatNo  = grdViewReceipt.GetRowCellValue(grdViewReceipt.FocusedRowHandle, "FlatNo").ToString();
            string sAns     = ReceiptDetailBL.GetReceiptPrint(sFlatNo, iCCId, p_RecpId);

            ReportDocument cryRpt        = new ReportDocument();
            string         strReportPath = Application.StartupPath + "\\CRMReceiptPrePrint.Rpt";

            cryRpt.Load(strReportPath);
            string s = "{ReceiptRegister.ReceiptId}=" + p_RecpId + " ";

            string[] DataFiles = new string[] { 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_sCRMDBName, BsfGlobal.g_sWorkFlowDBName,
                                                BsfGlobal.g_sCRMDBName, BsfGlobal.g_sCRMDBName, BsfGlobal.g_sCRMDBName };

            frmReport objReport = new frmReport();

            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["Payment"].Text = "'" + string.Format(sAns.ToString()) + "'";// string.Format(sAns.ToString());
            objReport.WindowState = FormWindowState.Maximized;
            objReport.rptViewer.Refresh();
            objReport.Show();

            Cursor.Current = Cursors.Default;
        }