コード例 #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            cr_CustNegBalDateRange rpt = new cr_CustNegBalDateRange();

            rpt.Site = this.Site;
            return(rpt);
        }
コード例 #2
0
        public void ShowReviewReport()
        {
            _branchId            = GlobalVariableBO._branchId;
            _possitive           = rdoPossitiveBal.Checked;
            _negetive            = rdoNegetive.Checked;
            _negSpecific         = rdoNegetiveSpecificer.Checked;
            _negTillSpecificDate = rdoNegetiveSpecificerTillSpecificDate.Checked;
            _posTillSpecificDate = rdoPositiveSpecificerTillSpecificDate.Checked;
            _posSpecific         = rdoPositiveSpecific.Checked;
            _negDateRange        = rdoNegetiveDateRange.Checked;
            _fromDate            = dtpFromDate.Value;
            _toDate = dtpToDate.Value;//dtpToDate.Value;

            int isSorted = 0;

            if (chbOrder.Checked)
            {
                isSorted = 1;
            }
            else
            {
                isSorted = 0;
            }

            CustReviewBalanceBAL   custReviewBalanceBal = new CustReviewBalanceBAL();
            crCustPossitiveBalance crCustBalance        = new crCustPossitiveBalance();
            CustPositiveBalViewer  custRptViewer        = new CustPositiveBalViewer();
            DataTable dtCustPositiveBalance             = new DataTable();

            GetCommonInfo();

            if (_possitive)
            {
                dtCustPositiveBalance = custReviewBalanceBal.GetCustPositiveBalance(isSorted);
                crCustBalance.SetDataSource(dtCustPositiveBalance);
                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtReportTitle"]).Text = "Customer With Postive Balance[Over All]";
                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtReportDate"]).Text  = "Printed On " + DateTime.Now.ToString("dd-MMM-yyyy");
                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtCompanyName"]).Text = _CommpanyName;
                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtBranchName"]).Text  = _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber;
                custRptViewer.crvCustPositiveBalReportViewer.ReportSource     = crCustBalance;
                custRptViewer.crvCustPositiveBalReportViewer.DisplayGroupTree = false;
                custRptViewer.Show();
            }
            else if (_negetive)
            {
                DataTable dtCustNegetiveBalance = new DataTable();
                dtCustNegetiveBalance = custReviewBalanceBal.GetCustNegetiveBalance(isSorted);
                crCustBalance.SetDataSource(dtCustNegetiveBalance);

                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtReportTitle"]).Text = "Customer With Negative Balance[Over All]";
                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtReportDate"]).Text  = "Printed On " + DateTime.Now.ToString("dd-MMM-yyyy");
                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtCompanyName"]).Text = _CommpanyName;
                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtBranchName"]).Text  = "Branch Name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber;

                custRptViewer.crvCustPositiveBalReportViewer.ReportSource     = crCustBalance;
                custRptViewer.crvCustPositiveBalReportViewer.DisplayGroupTree = false;
                custRptViewer.Show();
            }

            /* else if (_negetiveToday)
             * {
             *   crCustNegTodayBalance crCustNegTodaybalance = new crCustNegTodayBalance();
             *   CustNegTodayBalViewer negTodayBalViewer = new CustNegTodayBalViewer();
             *   DataTable dtCustNegTodayBalance = new DataTable();
             *   dtCustNegTodayBalance = custReviewBalanceBal.GetCustNegetiveBalanceToday();
             *   crCustNegTodaybalance.SetDataSource(dtCustNegTodayBalance);
             *   ///// Load Company Name
             *   ((TextObject)crCustNegTodaybalance.ReportDefinition.Sections[2].ReportObjects["txtCompanyName"]).Text = _CommpanyName;
             *
             *   ///// Load Branch Name
             *   ((TextObject)crCustNegTodaybalance.ReportDefinition.Sections[2].ReportObjects["txtBranchName"]).Text = "Branch Name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber;
             *   negTodayBalViewer.crvCustNegTodayBalReportViewer.ReportSource = crCustNegTodaybalance;
             *   negTodayBalViewer.Show();
             *
             * }*/

            else if (_negSpecific)
            {
                DataTable dtCustNegTodayBalance = new DataTable();
                dtCustNegTodayBalance = custReviewBalanceBal.GetCustNegSpecificBalance(_toDate, isSorted);
                crCustBalance.SetDataSource(dtCustNegTodayBalance);

                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtReportTitle"]).Text = "Customer With Negative Balance On";
                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtReportDate"]).Text  = _fromDate.ToString("dd-MMMM-yyyy");
                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtCompanyName"]).Text = _CommpanyName;
                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtBranchName"]).Text  = "Branch Name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber;

                custRptViewer.crvCustPositiveBalReportViewer.ReportSource     = crCustBalance;
                custRptViewer.crvCustPositiveBalReportViewer.DisplayGroupTree = false;
                custRptViewer.Show();
            }
            else if (_negTillSpecificDate)
            {
                DataTable dtCustNegTodayBalance = new DataTable();
                //dtCustNegTodayBalance = custReviewBalanceBal.CustomisedDSE_NewGetCustNegBalanceTillSpecificDate(_toDate, isSorted);
                dtCustNegTodayBalance = custReviewBalanceBal.GetCustNegBalanceTillSpecificDate(_toDate, isSorted);
                crCustBalance.SetDataSource(dtCustNegTodayBalance);

                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtReportTitle"]).Text = "Customer With Negative Balance Till Date";
                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtReportDate"]).Text  = _toDate.ToString("dd-MMMM-yyyy");
                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtCompanyName"]).Text = _CommpanyName;
                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtBranchName"]).Text  = "Branch Name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber;

                custRptViewer.crvCustPositiveBalReportViewer.ReportSource     = crCustBalance;
                custRptViewer.crvCustPositiveBalReportViewer.DisplayGroupTree = false;
                custRptViewer.Show();
            }

            else if (_posTillSpecificDate)
            {
                DataTable dtCustNegTodayBalance = new DataTable();
                //dtCustNegTodayBalance = custReviewBalanceBal.CustomisedDSE_NewGetCustPosBalanceTillSpecificDate(_toDate, isSorted);
                dtCustNegTodayBalance = custReviewBalanceBal.GetCustPosBalanceTillSpecificDate(_toDate, isSorted);
                crCustBalance.SetDataSource(dtCustNegTodayBalance);

                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtReportTitle"]).Text = "Customer With Positive Balance Till Date";
                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtReportDate"]).Text  = _toDate.ToString("dd-MMMM-yyyy");
                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtCompanyName"]).Text = _CommpanyName;
                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtBranchName"]).Text  = "Branch Name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber;

                custRptViewer.crvCustPositiveBalReportViewer.ReportSource     = crCustBalance;
                custRptViewer.crvCustPositiveBalReportViewer.DisplayGroupTree = false;
                custRptViewer.Show();
            }


            else if (_posSpecific)
            {
                DataTable dtCustPosBalance = new DataTable();

                dtCustPosBalance = custReviewBalanceBal.GetCustPosSpecificBalance(_toDate, isSorted);
                crCustBalance.SetDataSource(dtCustPosBalance);


                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtReportTitle"]).Text = "Customer With Postive Balance On";
                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtReportDate"]).Text  = _fromDate.ToString("dd-MMMM-yyyy");
                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtCompanyName"]).Text = _CommpanyName;
                ((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtBranchName"]).Text  = "Branch Name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber;

                custRptViewer.crvCustPositiveBalReportViewer.ReportSource     = crCustBalance;
                custRptViewer.crvCustPositiveBalReportViewer.DisplayGroupTree = false;
                custRptViewer.Show();
            }
            else if (_negDateRange)
            {
                cr_CustNegBalDateRange crNegBalDateRange = new cr_CustNegBalDateRange();
                DataTable dt = new DataTable();
                dt = custReviewBalanceBal.GetCustNegBalanceBetweenDateRang(_fromDate, _toDate, isSorted);

                crNegBalDateRange.SetDataSource(dt);

                //((TextObject)crCustBalance.ReportDefinition.Sections[2].ReportObjects["txtReportTitle"]).Text = "Customer With Negetive Balance Between Date Range";
                ((TextObject)crNegBalDateRange.ReportDefinition.Sections[2].ReportObjects["txtdateRange"]).Text   = "From " + _fromDate.ToString("dd-MMMM-yyyy") + " To " + _toDate.ToString("dd-MMMM-yyyy");
                ((TextObject)crNegBalDateRange.ReportDefinition.Sections[2].ReportObjects["txtCompanyName"]).Text = _CommpanyName;
                ((TextObject)crNegBalDateRange.ReportDefinition.Sections[2].ReportObjects["txtBranchName"]).Text  = "Branch Name:" + _branchName + "," + _branchAddress + ". Phone:" + _branchContactNumber;

                custRptViewer.crvCustPositiveBalReportViewer.ReportSource     = crNegBalDateRange;
                custRptViewer.crvCustPositiveBalReportViewer.DisplayGroupTree = false;
                custRptViewer.Show();
            }

            else
            {
                MessageBox.Show("Please Select the report category first.");
            }
        }