Ejemplo n.º 1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            MonthDeductionRegisterWithTodateGLRPT rpt = new MonthDeductionRegisterWithTodateGLRPT();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void btnDeductRegWithLeaf_Click(object sender, EventArgs e)
        {
            string supCode = cmbSupplier.SelectedValue.ToString();

            if (chkSupplier.Checked)
            {
                supCode = "%";
            }

            String strAllDeductionsGroup = "%";

            if (!chkAllGroup.Checked)
            {
                strAllDeductionsGroup = cmbDeductionGroup.SelectedValue.ToString();
            }

            String strAllDeductions = "%";

            if (!chkDeduction.Checked)
            {
                strAllDeductions = cmbDeductionCode.SelectedValue.ToString();
            }

            String route = "%";

            if (!chkRoute.Checked)
            {
                route = cmbRoute.SelectedValue.ToString();
            }

            DataSet dataSet = objReg.getMonthlyDeductionRegisterWithLeafTodate(route, Convert.ToInt32(cmbYear.SelectedValue), Convert.ToInt32(cmbMonth.SelectedValue), supCode, strAllDeductions, strAllDeductionsGroup);

            dataSet.WriteXml("MonthDeductionRegister.xml");
            MonthDeductionRegisterWithTodateGLRPT myReport = new MonthDeductionRegisterWithTodateGLRPT();

            myReport.SetDataSource(dataSet);

            myReport.SetParameterValue("Year", cmbYear.SelectedValue.ToString());
            myReport.SetParameterValue("Month", cmbMonth.Text);
            myReport.SetParameterValue("Company", BoughtLeafBusinessLayer.BLUser.getCompanyName());

            if (chkDeduction.Checked == true)
            {
                myReport.SetParameterValue("Deduction", "All Deduction");
            }
            else
            {
                myReport.SetParameterValue("Deduction", cmbDeductionCode.Text);
            }

            if (chkRoute.Checked == true)
            {
                myReport.SetParameterValue("Route", "All Route");
            }
            else
            {
                myReport.SetParameterValue("Route", cmbRoute.Text);
            }

            ReportViewer rptViewer = new ReportViewer();

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