Esempio n. 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            crNewCustMoneyLedger rpt = new crNewCustMoneyLedger();

            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            dtCustmoneyLedger    = new DataTable();
            DataTable            dtCustBasicInfo      = new DataTable();
            LoadCommonInfo       CmmInfo = new LoadCommonInfo();

            crNewCustMoneyLedger crNewCustMoneyledger = new crNewCustMoneyLedger();
            crCustMoneyLedger    crCustMoneyledger    = new crCustMoneyLedger();

            CustMoneyLedgerViewer moneyLedgerViewer = new CustMoneyLedgerViewer();
            frmReportViewer       viewer            = new frmReportViewer();

            RecordLevelFilteringBAL obj = new RecordLevelFilteringBAL(ResourceName.Customer_Money_Ledger);

            if (tempMenuPurpose != newCustomerMoneyBalance)
            {
                string T_custCode = obj.FilterCustCode(_custCode, ResourceName.Customer_Money_Ledger);
                dtCustBasicInfo = moneyLedgerReportBal.GetCustBasicInfo(T_custCode);
            }
            //else if (tempMenuPurpose == newCustomerMoneyBalance)
            //{
            //    dtCustBasicInfo = moneyLedgerReportBal.GetCustBasicInfo(_custCode);
            //}
            if (dtCustBasicInfo.Rows.Count > 0)
            {
                ((TextObject)crCustMoneyledger.ReportDefinition.Sections[2].ReportObjects["txtCustName"]).Text =
                    dtCustBasicInfo.Rows[0]["Cust_Name"].ToString();
                ((TextObject)crCustMoneyledger.ReportDefinition.Sections[2].ReportObjects["txtCustCode"]).Text =
                    dtCustBasicInfo.Rows[0]["Cust_Code"].ToString();
                ((TextObject)crCustMoneyledger.ReportDefinition.Sections[2].ReportObjects["Text6"]).Text =
                    "Balance Before " + dtFromDate.Value.ToString("dd-MMM-yy") + " :";
                ((TextObject)crCustMoneyledger.ReportDefinition.Sections[2].ReportObjects["txtduration"]).Text =
                    "Duration : " + dtFromDate.Value.ToString("dd-MMM-yyyy") + " To " +
                    dtToDate.Value.ToString("dd-MMM-yyyy");
                ((TextObject)crCustMoneyledger.ReportDefinition.Sections[2].ReportObjects["txtreportName"]).Text =
                    "Customer Money Ledger";
            }
            if (tempMenuPurpose == newCustomerMoneyBalance)
            {
                ((TextObject)crNewCustMoneyledger.ReportDefinition.Sections[2].ReportObjects["txtCustCode"]).Text = txtCustCode.Text;

                ((TextObject)crNewCustMoneyledger.ReportDefinition.Sections[2].ReportObjects["txtreportName"]).Text =
                    "Customer Money Ledger";
            }
            if (tempMenuPurpose != newCustomerMoneyBalance)
            {
                string temp_custCode = obj.FilterCustCode(_custCode, ResourceName.Customer_Money_Ledger);

                if (tempMenuPurpose == Interest_Service_Charge)
                {
                    dtCustmoneyLedger = moneyLedgerReportBal.GetInterestServiceCharge(temp_custCode, _fromDate, _toDate);
                }
                else
                {
                    dtCustmoneyLedger = moneyLedgerReportBal.GetCustMoneyLedger(temp_custCode, _fromDate, _toDate);
                }
            }
            else
            {
                dtCustmoneyLedger = moneyLedgerReportBal.GetNewCustMoneyLedger(_custCode, _fromDate, _toDate);
            }
            if (tempMenuPurpose == newCustomerMoneyBalance)
            {
                crNewCustMoneyledger.SetDataSource(dtCustmoneyLedger);
            }
            else
            {
                crCustMoneyledger.SetDataSource(dtCustmoneyLedger);
            }

            GetCommonInfo();
            if (tempMenuPurpose != newCustomerMoneyBalance)
            {
                ((TextObject)crCustMoneyledger.ReportDefinition.Sections[2].ReportObjects["txtCompanyName"]).Text =
                    _CommpanyName;

                ///// Load Branch Name
                ((TextObject)crCustMoneyledger.ReportDefinition.Sections[2].ReportObjects["txtBranchName"]).Text =
                    "Branch Name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber;
                moneyLedgerViewer.crvCustMoneyLedgerReportViewer.DisplayGroupTree = false;
            }
            else if (tempMenuPurpose == newCustomerMoneyBalance)
            {
                ((TextObject)crNewCustMoneyledger.ReportDefinition.Sections[2].ReportObjects["txtCompanyName"]).Text =
                    _CommpanyName;

                ///// Load Branch Name
                ((TextObject)crNewCustMoneyledger.ReportDefinition.Sections[2].ReportObjects["txtBranchName"]).Text =
                    "Branch Name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber;
            }
            if (tempMenuPurpose == newCustomerMoneyBalance)
            {
                viewer.crvReportViewer.ReportSource = crNewCustMoneyledger;
                viewer.Show();
            }
            else
            {
                moneyLedgerViewer.crvCustMoneyLedgerReportViewer.ReportSource = crCustMoneyledger;
                moneyLedgerViewer.Show();
            }
        }