示例#1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            OpenChargesAppliedToDealer rpt = new OpenChargesAppliedToDealer();

            rpt.Site = this.Site;
            return(rpt);
        }
示例#2
0
        private void PrintChargesAppliedtoDealer(ReportViewer rptViewer)
        {
            String lsDealerNum = comboBoxDealer.Text.TrimEnd().TrimStart();

            if (lsDealerNum.Length == 0 && (nullableDateTimePickerStartDate.Value == null && nullableDateTimePickerEndDate.Value == null))
            {
                // No Dealer or Date Range
                OpenChargesAppliedToDealerTableAdapter.Fill(iACDataSet.OpenChargesAppliedToDealer, null, null, null);
            }
            else
            if (lsDealerNum.Length == 3 && (nullableDateTimePickerStartDate.Value == null && nullableDateTimePickerEndDate.Value == null))
            {
                // Dealer but no Date Range
                OpenChargesAppliedToDealerTableAdapter.Fill(iACDataSet.OpenChargesAppliedToDealer, lsDealerNum, null, null);
            }
            else
            if (lsDealerNum.Length == 3 && (nullableDateTimePickerStartDate.Value != null && nullableDateTimePickerEndDate.Value != null))
            {
                // Dealer and Date Range
                OpenChargesAppliedToDealerTableAdapter.Fill(iACDataSet.OpenChargesAppliedToDealer, lsDealerNum, (DateTime)nullableDateTimePickerStartDate.Value, (DateTime)nullableDateTimePickerEndDate.Value);
            }
            else
            if (lsDealerNum.Length == 0 && (nullableDateTimePickerStartDate.Value != null && nullableDateTimePickerEndDate.Value != null))
            {
                // No Dealer but Date Range
                OpenChargesAppliedToDealerTableAdapter.Fill(iACDataSet.OpenChargesAppliedToDealer, null, (DateTime)nullableDateTimePickerStartDate.Value, (DateTime)nullableDateTimePickerEndDate.Value);
            }

            if (iACDataSet.OpenChargesAppliedToDealer.Rows.Count == 0)
            {
                MessageBox.Show("*** Sorry there are no Charges Applied To Dealer records for the DATES and / or DEALER you selected!!! ***");
            }
            else
            {
                OpenChargesAppliedToDealer myReportObject = new OpenChargesAppliedToDealer();
                myReportObject.SetDataSource(iACDataSet);
                myReportObject.SetParameterValue("gdFromDate", (nullableDateTimePickerStartDate.Value != null) ? (DateTime)nullableDateTimePickerStartDate.Value : Convert.ToDateTime("01/01/1900"));
                myReportObject.SetParameterValue("gdToDate", (nullableDateTimePickerEndDate.Value != null) ? (DateTime)nullableDateTimePickerEndDate.Value : Convert.ToDateTime("01/01/1900"));
                myReportObject.SetParameterValue("gsUserID", Program.gsUserID);
                myReportObject.SetParameterValue("gsUserName", Program.gsUserName);
                rptViewer.crystalReportViewer.ReportSource = myReportObject;
                rptViewer.crystalReportViewer.Refresh();
                rptViewer.Show();
            }
        }