Beispiel #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            KTFLPayslip rpt = new KTFLPayslip();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void btnDouble_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbMonth.SelectedIndex == -1)
                {
                    MessageBox.Show("Please Select The Month");
                }
                else
                {
                    if (radioButton1.Checked == true && radioButton1.Text == "Sinhala")
                    {
                        //MessageBox.Show("dasdasd");
                        DataSet dsGeneral = new DataSet();

                        BoughtLeafBusinessLayer.Reports myReports = new BoughtLeafBusinessLayer.Reports();

                        dsGeneral = myReports.GetSupplierPaymentForPaySlipGeneral(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbRoute.SelectedValue.ToString());
                        dsGeneral.Tables[0].TableName = "GetSupplierPaymentForPaySlipGeneral";
                        //dataSetReport.WriteXml("PaymentSlip.xml");

                        DataSet dsGreenLeaf = myReports.GetSupplierPaymentForPaySlipGreenLeaf(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbRoute.SelectedValue.ToString());
                        dsGreenLeaf.Tables[0].TableName = "GetSupplierPaymentForPaySlipGreenLeaf";
                        // NewDt.WriteXml("DayGreenLeaf.xml");

                        DataSet dsThisMonthIssues = myReports.GetSupplierPaymentForPaySlipThisMonthIssues(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbRoute.SelectedValue.ToString());
                        dsThisMonthIssues.Tables[0].TableName = "GetSupplierPaymentForPaySlipThisMonthIssues";
                        PayslipRPT_Sinhala myaclist = new PayslipRPT_Sinhala();

                        myaclist.Database.Tables["GetSupplierPaymentForPaySlipGeneral"].SetDataSource(dsGeneral.Tables[0]);
                        myaclist.Database.Tables["GetSupplierPaymentForPaySlipGreenLeaf"].SetDataSource(dsGreenLeaf.Tables[0]);
                        myaclist.Database.Tables["GetSupplierPaymentForPaySlipThisMonthIssues"].SetDataSource(dsThisMonthIssues.Tables[0]);

                        ReportViewer myReportViewer = new ReportViewer();

                        myReportViewer.crystalReportViewer1.ReportSource = myaclist;
                        myaclist.SetParameterValue("company", BoughtLeafBusinessLayer.BLUser.getCompanyName());
                        myaclist.SetParameterValue("factory", BoughtLeafBusinessLayer.BLUser.getFactoryName());
                        myReportViewer.crystalReportViewer1.DisplayGroupTree = true;
                        myReportViewer.Show();
                    }
                    else if (radioButton2.Checked == true && radioButton2.Text == "English")
                    {
                        //;

                        DataSet dsGeneral = new DataSet();

                        BoughtLeafBusinessLayer.Reports myReports = new BoughtLeafBusinessLayer.Reports();

                        dsGeneral = myReports.GetSupplierPaymentForPaySlipGeneral(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbRoute.SelectedValue.ToString());
                        dsGeneral.Tables[0].TableName = "GetSupplierPaymentForPaySlipGeneral";
                        //dataSetReport.WriteXml("PaymentSlip.xml");

                        DataSet dsGreenLeaf = myReports.GetSupplierPaymentForPaySlipGreenLeaf(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbRoute.SelectedValue.ToString());
                        dsGreenLeaf.Tables[0].TableName = "GetSupplierPaymentForPaySlipGreenLeaf";
                        // NewDt.WriteXml("DayGreenLeaf.xml");

                        DataSet dsThisMonthIssues = myReports.GetSupplierPaymentForPaySlipThisMonthIssues(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbRoute.SelectedValue.ToString());
                        dsThisMonthIssues.Tables[0].TableName = "GetSupplierPaymentForPaySlipThisMonthIssues";
                        PayslipRPT_English myaclist = new PayslipRPT_English();

                        myaclist.Database.Tables["GetSupplierPaymentForPaySlipGeneral"].SetDataSource(dsGeneral.Tables[0]);
                        myaclist.Database.Tables["GetSupplierPaymentForPaySlipGreenLeaf"].SetDataSource(dsGreenLeaf.Tables[0]);
                        myaclist.Database.Tables["GetSupplierPaymentForPaySlipThisMonthIssues"].SetDataSource(dsThisMonthIssues.Tables[0]);

                        ReportViewer myReportViewer = new ReportViewer();

                        myReportViewer.crystalReportViewer1.ReportSource = myaclist;
                        myaclist.SetParameterValue("company", BoughtLeafBusinessLayer.BLUser.getCompanyName());
                        myaclist.SetParameterValue("factory", BoughtLeafBusinessLayer.BLUser.getFactoryName());
                        myReportViewer.crystalReportViewer1.DisplayGroupTree = true;
                        myReportViewer.Show();
                    }
                    else if (radioButton1.Checked == true && radioButton1.Text == "Pre Printed")
                    {
                        if (BoughtLeafBusinessLayer.BLUser.getCompanyCode().ToUpper() == "APL")
                        {
                            DataSet dsGeneral = new DataSet();

                            BoughtLeafBusinessLayer.Reports myReports = new BoughtLeafBusinessLayer.Reports();

                            dsGeneral = myReports.GetSupplierPaymentForPaySlipGeneral(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbRoute.SelectedValue.ToString());
                            dsGeneral.Tables[0].TableName = "GetSupplierPaymentForPaySlipGeneral";
                            //dataSetReport.WriteXml("PaymentSlip.xml");

                            DataSet dsGreenLeaf = myReports.GetSupplierPaymentForPaySlipGreenLeaf(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbRoute.SelectedValue.ToString());
                            dsGreenLeaf.Tables[0].TableName = "GetSupplierPaymentForPaySlipGreenLeaf";
                            // NewDt.WriteXml("DayGreenLeaf.xml");

                            DataSet dsThisMonthIssues = myReports.GetSupplierPaymentForPaySlipThisMonthIssues(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbRoute.SelectedValue.ToString());
                            dsThisMonthIssues.Tables[0].TableName = "GetSupplierPaymentForPaySlipThisMonthIssues";

                            APLPayslipRPT myaclist = new APLPayslipRPT();

                            myaclist.Database.Tables["GetSupplierPaymentForPaySlipGeneral"].SetDataSource(dsGeneral.Tables[0]);
                            myaclist.Database.Tables["GetSupplierPaymentForPaySlipGreenLeaf"].SetDataSource(dsGreenLeaf.Tables[0]);
                            myaclist.Database.Tables["GetSupplierPaymentForPaySlipThisMonthIssues"].SetDataSource(dsThisMonthIssues.Tables[0]);

                            ReportViewer myReportViewer = new ReportViewer();

                            myReportViewer.crystalReportViewer1.ReportSource = myaclist;
                            myaclist.SetParameterValue("company", BoughtLeafBusinessLayer.BLUser.getCompanyName());
                            myaclist.SetParameterValue("factory", BoughtLeafBusinessLayer.BLUser.getFactoryName());
                            myReportViewer.crystalReportViewer1.DisplayGroupTree = true;
                            myReportViewer.Show();
                        }
                        else if (BoughtLeafBusinessLayer.BLUser.getCompanyCode().ToUpper() == "KTFL")
                        {
                            DataSet dsGeneral = new DataSet();

                            BoughtLeafBusinessLayer.Reports myReports = new BoughtLeafBusinessLayer.Reports();

                            dsGeneral = myReports.GetSupplierPaymentForPaySlipGeneral(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbRoute.SelectedValue.ToString());
                            dsGeneral.Tables[0].TableName = "GetSupplierPaymentForPaySlipGeneral";
                            //dataSetReport.WriteXml("PaymentSlip.xml");

                            DataSet dsGreenLeaf = myReports.GetSupplierPaymentForPaySlipGreenLeaf(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbRoute.SelectedValue.ToString());
                            dsGreenLeaf.Tables[0].TableName = "GetSupplierPaymentForPaySlipGreenLeaf";
                            // NewDt.WriteXml("DayGreenLeaf.xml");

                            DataSet dsThisMonthIssues = myReports.GetSupplierPaymentForPaySlipThisMonthIssues(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), cmbRoute.SelectedValue.ToString());
                            dsThisMonthIssues.Tables[0].TableName = "GetSupplierPaymentForPaySlipThisMonthIssues";
                            dsThisMonthIssues.WriteXml("ThisMonthIssuesXml.xml");
                            KTFLPayslip myaclist = new KTFLPayslip();

                            myaclist.Database.Tables["GetSupplierPaymentForPaySlipGeneral"].SetDataSource(dsGeneral.Tables[0]);
                            myaclist.Database.Tables["GetSupplierPaymentForPaySlipGreenLeaf"].SetDataSource(dsGreenLeaf.Tables[0]);
                            myaclist.Database.Tables["GetSupplierPaymentForPaySlipThisMonthIssues"].SetDataSource(dsThisMonthIssues.Tables[0]);

                            ReportViewer myReportViewer = new ReportViewer();

                            myReportViewer.crystalReportViewer1.ReportSource = myaclist;
                            //myaclist.SetParameterValue("company", BoughtLeafBusinessLayer.BLUser.getCompanyName());
                            // myaclist.SetParameterValue("factory", BoughtLeafBusinessLayer.BLUser.getFactoryName());
                            myReportViewer.crystalReportViewer1.DisplayGroupTree = true;
                            myReportViewer.Show();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }