Пример #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            crAccruedBalance rpt = new crAccruedBalance();

            rpt.Site = this.Site;
            return(rpt);
        }
        public void ShowCustMoneyLedgerReport()
        {
            _branchId = GlobalVariableBO._branchId;
            _fromDate = Convert.ToDateTime(dtFromDate.Value.ToShortDateString());
            _toDate   = Convert.ToDateTime(dtToDate.Value.ToShortDateString());
            _custCode = txtCustCode.Text;

            MoneyLadgerReportBAL moneyLedgerReportBal = new MoneyLadgerReportBAL();
            DataTable            dtAccruedBalance     = new DataTable();
            DataTable            dtCustBasicInfo      = new DataTable();
            LoadCommonInfo       CmmInfo = new LoadCommonInfo();

            crAccruedBalance rpt    = new crAccruedBalance();
            frmReportViewer  viewer = new frmReportViewer();

            RecordLevelFilteringBAL obj = new RecordLevelFilteringBAL(ResourceName.Customer_Money_Ledger);

            string T_custCode = obj.FilterCustCode(_custCode, ResourceName.Customer_Money_Ledger);

            dtCustBasicInfo = moneyLedgerReportBal.GetCustBasicInfo(T_custCode);

            if (dtCustBasicInfo.Rows.Count > 0)
            {
                ((TextObject)rpt.ReportDefinition.Sections[2].ReportObjects["txtCustName"]).Text =
                    "Cust. Name: " + dtCustBasicInfo.Rows[0]["Cust_Name"].ToString();
                ((TextObject)rpt.ReportDefinition.Sections[2].ReportObjects["txtCustCode"]).Text =
                    "Cust. Code:  " + dtCustBasicInfo.Rows[0]["Cust_Code"].ToString();
                ((TextObject)rpt.ReportDefinition.Sections[2].ReportObjects["txtBalanceBefore"]).Text =
                    "Balance Before :  " + dtFromDate.Value.ToString("dd-MMM-yy");
                ((TextObject)rpt.ReportDefinition.Sections[2].ReportObjects["txtduration"]).Text =
                    "Duration :  " + dtFromDate.Value.ToString("dd-MMM-yyyy") + " To " +
                    dtToDate.Value.ToString("dd-MMM-yyyy");
                ((TextObject)rpt.ReportDefinition.Sections[2].ReportObjects["txtreportName"]).Text =
                    "Accrued Balance Report";
            }
            else
            {
                ((TextObject)rpt.ReportDefinition.Sections[2].ReportObjects["txtduration"]).Text =
                    "Duration :  " + dtFromDate.Value.ToString("dd-MMM-yyyy") + " To " +
                    dtToDate.Value.ToString("dd-MMM-yyyy");
                ((TextObject)rpt.ReportDefinition.Sections[2].ReportObjects["txtreportName"]).Text =
                    "Accrued Balance Report";
            }
            dtAccruedBalance = moneyLedgerReportBal.GetAccruedBalanceData(T_custCode, _fromDate, _toDate);
            rpt.SetDataSource(dtAccruedBalance);

            GetCommonInfo();
            ((TextObject)rpt.ReportDefinition.Sections[2].ReportObjects["txtCompanyName"]).Text = _CommpanyName;
            ((TextObject)rpt.ReportDefinition.Sections[2].ReportObjects["txtBranchName"]).Text  =
                "Branch Name: " + _branchName + "," + _branchAddress + ". Phone: " + _branchContactNumber;
            viewer.crvReportViewer.ReportSource = rpt;
            viewer.Show();
        }