コード例 #1
0
        private void PrintDoc()
        {
            if (cmb_customers.SelectedValue == null)
            {
                MessageBox.Show("Please select a customer to continue", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            string reporttitle = "";

            reporttitle = "Customer Balance Report".ToUpper();


            ReportViwer rpt = new ReportViwer();

            rpt.MdiParent      = frm_main.ActiveForm;
            rpt.FormHeadertext = reporttitle;

            ParameterField         paramField         = new ParameterField();
            ParameterFields        paramFields        = new ParameterFields();
            ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();

            paramFields = ReportRepository.AddCrystalParamsWithLoca(reporttitle, commonFunctions.Loginuser.ToUpper(), commonFunctions.GlobalLocation, "01", commonFunctions.GlobalCompany, commonFunctions.CompanyAddress);

            paramField.Name          = "status";
            paramDiscreteValue.Value = "Original".ToUpper();
            paramField.CurrentValues.Add(paramDiscreteValue);
            paramFields.Add(paramField);

            Rpt_CustomerBalanceReport rptBank = new Rpt_CustomerBalanceReport();

            rptBank.SetDataSource(ReportRepository.GetCustomerBalance(commonFunctions.ToInt(cmb_customers.SelectedValue.ToString())));
            rpt.RepViewer.ParameterFieldInfo = paramFields;
            rpt.RepViewer.ReportSource       = rptBank;
            rpt.RepViewer.Refresh();
            rpt.MdiParent = frm_main.ActiveForm;
            rpt.Show();
        }
コード例 #2
0
        private void PrintDoc(int typex, bool filter)
        {
            if (cmb_days.SelectedValue == null)
            {
                MessageBox.Show("Please select a day to continue", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            string reporttitle = "";

            if (typex == 1)
            {
                reporttitle = "Daily Collection Details".ToUpper();
            }
            else
            {
                reporttitle = "Daily Collection Summary".ToUpper();
            }

            ReportViwer rpt = new ReportViwer();

            rpt.MdiParent      = frm_main.ActiveForm;
            rpt.FormHeadertext = reporttitle;

            ParameterField         paramField         = new ParameterField();
            ParameterFields        paramFields        = new ParameterFields();
            ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();

            paramFields = ReportRepository.AddCrystalParamsWithLoca(reporttitle, commonFunctions.Loginuser.ToUpper(), commonFunctions.GlobalLocation, "01", commonFunctions.GlobalCompany, commonFunctions.CompanyAddress);

            paramField.Name          = "status";
            paramDiscreteValue.Value = "Original".ToUpper();
            paramField.CurrentValues.Add(paramDiscreteValue);
            paramFields.Add(paramField);



            if (typex == 1)
            {
                if (!filter)
                {
                    Rpt_dailyCollectionSummary rptBank = new Rpt_dailyCollectionSummary();
                    rptBank.SetDataSource(ReportRepository.GetDailyCollections(commonFunctions.ToInt(cmb_days.SelectedValue.ToString()), 0, 1));
                    rpt.RepViewer.ParameterFieldInfo = paramFields;
                    rpt.RepViewer.ReportSource       = rptBank;
                    rpt.RepViewer.Refresh();
                    rpt.MdiParent = frm_main.ActiveForm;
                    rpt.Show();
                }
                else
                {
                    if (cmb_pumper.SelectedValue == null)
                    {
                        MessageBox.Show("Please select a pumper to continue", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    Rpt_dailyCollectionSummary rptBank = new Rpt_dailyCollectionSummary();
                    rptBank.SetDataSource(ReportRepository.GetDailyCollections(commonFunctions.ToInt(cmb_days.SelectedValue.ToString()), commonFunctions.ToInt(cmb_pumper.SelectedValue.ToString()), 2));
                    rpt.RepViewer.ParameterFieldInfo = paramFields;
                    rpt.RepViewer.ReportSource       = rptBank;
                    rpt.RepViewer.Refresh();
                    rpt.MdiParent = frm_main.ActiveForm;
                    rpt.Show();
                }
            }
            else
            {
                if (!filter)
                {
                    Rpt_DailyColSummary rptBank = new Rpt_DailyColSummary();
                    var com = ReportRepository.GetDailyCollectionsForSummary(commonFunctions.ToInt(cmb_days.SelectedValue.ToString()), 0, 3);
                    rptBank.SetDataSource(com);
                    rpt.RepViewer.ParameterFieldInfo = paramFields;
                    rpt.RepViewer.ReportSource       = rptBank;
                    rpt.RepViewer.Refresh();
                    rpt.MdiParent = frm_main.ActiveForm;
                    rpt.Show();
                }
                else
                {
                    if (cmb_pumper.SelectedValue == null)
                    {
                        MessageBox.Show("Please select a pumper to continue", Messaging.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    Rpt_DailyColSummaryForPumper rptBank = new Rpt_DailyColSummaryForPumper();
                    var com = ReportRepository.GetDailyCollectionsForSummary(commonFunctions.ToInt(cmb_days.SelectedValue.ToString()), commonFunctions.ToInt(cmb_pumper.SelectedValue.ToString()), 4);
                    rptBank.SetDataSource(com);
                    rpt.RepViewer.ParameterFieldInfo = paramFields;
                    rpt.RepViewer.ReportSource       = rptBank;
                    rpt.RepViewer.Refresh();
                    rpt.MdiParent = frm_main.ActiveForm;
                    rpt.Show();
                }
            }
        }