private void btnPaySmryRoute_Click(object sender, EventArgs e)
        {
            DataTable dataSetReport = new DataTable();

            dataSetReport.TableName = "SupplierPaymentsSummaryTown";

            BoughtLeafBusinessLayer.MothlyPaymentSummary myMonthlySummary = new BoughtLeafBusinessLayer.MothlyPaymentSummary();

            dataSetReport = myMonthlySummary.getSupplierPaymentsDetailByRoute(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString())).Tables[0];

            dataSetReport.WriteXml("SupplierPaymentsSummaryTown.xml");
            SupplierPaymentSummaryRouteRPT myReport = new SupplierPaymentSummaryRouteRPT();

            myReport.SetDataSource(dataSetReport);
            ReportViewer rptViewer = new ReportViewer();

            myReport.SetParameterValue("Company", BoughtLeafBusinessLayer.BLUser.getCompanyName());
            myReport.SetParameterValue("PayRate", mySettings.getKiloRate(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString())).ToString("N2"));
            myReport.SetParameterValue("CheckTotal", myBank.getCheckPaymentTotal(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString())));
            myReport.SetParameterValue("BankTotal", myMonthlySummary.getBankPaymentSummaryTotal(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString())));
            myReport.SetParameterValue("CashTotal", myMonthlySummary.getCashPaymentSummaryTotal(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString())));
            myReport.SetParameterValue("Year", cmbYear.Text);
            myReport.SetParameterValue("SupCount", myMonthlySummary.getMonthlyActiveSupplier(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString())));
            myReport.SetParameterValue("Month", cmbMonth.SelectedValue.ToString());
            rptViewer.crystalReportViewer1.ReportSource = myReport;

            rptViewer.Show();
        }
        private void btnPaySmry_Click(object sender, EventArgs e)
        {
            DataTable dataSetReport = new DataTable();

            dataSetReport.TableName = "SupplierPaymentsSummary";

            BoughtLeafBusinessLayer.MothlyPaymentSummary myMonthlySummary = new BoughtLeafBusinessLayer.MothlyPaymentSummary();

            string supCode = string.Empty;

            if (chkSupplier.Checked == true)
            {
                supCode = "%";
            }
            else
            {
                supCode = cmbSupplier.SelectedValue.ToString();
            }

            string strRoute = "%";

            if (chkRoute.Checked)
            {
                strRoute = "%";
            }
            else
            {
                strRoute = cmbRoute.SelectedValue.ToString();
            }

            dataSetReport = myMonthlySummary.getSupplierPaymentsDetail(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), supCode, strRoute).Tables[0];
            dataSetReport.WriteXml("SupplierPaymentsSummary.xml");
            SupplierPaymentSummaryRPT myReport = new SupplierPaymentSummaryRPT();

            myReport.SetDataSource(dataSetReport);
            ReportViewer rptViewer = new ReportViewer();

            myReport.SetParameterValue("Company", BoughtLeafBusinessLayer.BLUser.getCompanyName());
            myReport.SetParameterValue("Year", cmbYear.Text);
            myReport.SetParameterValue("Month", cmbMonth.SelectedValue.ToString());
            myReport.SetParameterValue("payRate", mySettings.getKiloRate(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue)));
            myReport.SetParameterValue("CheckTotal", myBank.getCheckPaymentTotal(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString())));
            myReport.SetParameterValue("BankTotal", myMonthlySummary.getBankPaymentSummaryTotal(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString())));
            myReport.SetParameterValue("CashTotal", myMonthlySummary.getCashPaymentSummaryTotal(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString())));

            rptViewer.crystalReportViewer1.ReportSource = myReport;
            rptViewer.Show();
        }