Exemplo n.º 1
0
        private void btnView_Click(object sender, EventArgs e)
        {
            FTSPayRollBL.Reports myAddition = new FTSPayRollBL.Reports();

            if (allemp == true)
            {
                DataSet ds = new DataSet();
                myAddition.StrDivisionID = cmbDivision.SelectedValue.ToString();
                myAddition.IntMonth      = Convert.ToInt32(cmbMonth.SelectedValue.ToString());
                myAddition.IntYear       = Convert.ToInt32(cmbYear.SelectedValue.ToString());
                ds = myAddition.DivisionWiseAdditionRegisterAllEmp();

                if (ds.Tables[0].Rows.Count > 0)
                {
                    ds.WriteXml("DivisionwiseAdditionRegister.xml");

                    DivisionwiseAdditionRegisterRPT myAdditionAllEmp = new DivisionwiseAdditionRegisterRPT();
                    myAdditionAllEmp.SetDataSource(ds);
                    myAdditionAllEmp.SetParameterValue("Estate", "Estate : " + mydiv.ListEstates().Rows[0][0].ToString());
                    myAdditionAllEmp.SetParameterValue("Division", "Division : " + cmbDivision.Text);
                    //myAdditionAllEmp.SetParameterValue("Period","For the Month of : " + cmbMonth.Text + "  /  " + cmbYear.Text);
                    ReportViewer myReportViewer = new ReportViewer();
                    myReportViewer.crystalReportViewer1.ReportSource = myAdditionAllEmp;
                    myReportViewer.Show();
                }
                else
                {
                    MessageBox.Show("No Data to Preview..!");
                }
            }

            else
            {
                DataSet ds = new DataSet();
                myAddition.StrDivisionID = cmbDivision.SelectedValue.ToString();
                myAddition.IntMonth      = Convert.ToInt32(cmbMonth.SelectedValue.ToString());
                myAddition.IntYear       = Convert.ToInt32(cmbYear.SelectedValue.ToString());
                ds = myAddition.DivisionWiseAdditionRegisterAllEmp(cmbEmpNo.SelectedValue.ToString());

                if (ds.Tables[0].Rows.Count > 0)
                {
                    ds.WriteXml("DivisionwiseAdditionRegister.xml");

                    DivisionwiseAdditionRegisterRPT myAdditionAllEmp = new DivisionwiseAdditionRegisterRPT();
                    myAdditionAllEmp.SetDataSource(ds);
                    myAdditionAllEmp.SetParameterValue("Estate", "Estate : " + mydiv.ListEstates().Rows[0][0].ToString());
                    myAdditionAllEmp.SetParameterValue("Division", "Division : " + cmbDivision.Text);
                    //myAdditionAllEmp.SetParameterValue("Period", "For the Month of : " + cmbMonth.Text + "  /  " + cmbYear.Text);
                    ReportViewer myReportViewer = new ReportViewer();
                    myReportViewer.crystalReportViewer1.ReportSource = myAdditionAllEmp;
                    myReportViewer.Show();
                }
                else
                {
                    MessageBox.Show("No Data to Preview..!");
                }
            }
        }
        private void btnView_Click(object sender, EventArgs e)
        {
            FTSPayRollBL.Reports myDeduction = new FTSPayRollBL.Reports();

            if (allemp == true)
            {
                DataSet ds = new DataSet();
                myDeduction.StrDivisionID = cmbDivision.SelectedValue.ToString();
                myDeduction.IntMonth      = Convert.ToInt32(cmbMonth.SelectedValue.ToString());
                myDeduction.IntYear       = Convert.ToInt32(cmbYear.SelectedValue.ToString());
                ds = myDeduction.DivisionWiseDeductionRegisterAllEmp();
                ds.WriteXml("DivisionWiseDeductionRegisterAllEmp.xml");

                DivisionWiseDeductionRegisterAllEmp myDeductionAllEmp = new DivisionWiseDeductionRegisterAllEmp();
                myDeductionAllEmp.SetDataSource(ds);
                myDeductionAllEmp.SetParameterValue("CompanyName", FTSPayRollBL.Company.getCompanyName());
                myDeductionAllEmp.SetParameterValue("Estate", "Estate : " + mydiv.ListEstates().Rows[0][0].ToString());
                myDeductionAllEmp.SetParameterValue("Division", "Division : " + cmbDivision.Text);
                myDeductionAllEmp.SetParameterValue("Period", "For the Month of : " + cmbMonth.Text + "  /  " + cmbYear.Text);

                ReportViewer myReportViewer = new ReportViewer();

                myReportViewer.crystalReportViewer1.ReportSource = myDeductionAllEmp;
                myReportViewer.Show();
            }

            else
            {
                DataSet ds = new DataSet();
                myDeduction.StrDivisionID = cmbDivision.SelectedValue.ToString();
                myDeduction.IntMonth      = Convert.ToInt32(cmbMonth.SelectedValue.ToString());
                myDeduction.IntYear       = Convert.ToInt32(cmbYear.SelectedValue.ToString());
                ds = myDeduction.DivisionWiseDeductionRegisterAllEmp(cmbEmpNo.SelectedValue.ToString());
                ds.WriteXml("DivisionWiseDeductionRegisterAllEmp.xml");


                DivisionWiseDeductionRegisterAllEmp myDeductionAllEmp = new DivisionWiseDeductionRegisterAllEmp();
                myDeductionAllEmp.SetDataSource(ds);
                myDeductionAllEmp.SetParameterValue("CompanyName", FTSPayRollBL.Company.getCompanyName());
                myDeductionAllEmp.SetParameterValue("Estate", "Estate : " + mydiv.ListEstates().Rows[0][0].ToString());
                myDeductionAllEmp.SetParameterValue("Division", "Division : " + cmbDivision.Text);
                myDeductionAllEmp.SetParameterValue("Period", "For the Month of : " + cmbMonth.Text + "  /  " + cmbYear.Text);

                ReportViewer myReportViewer = new ReportViewer();

                myReportViewer.crystalReportViewer1.ReportSource = myDeductionAllEmp;
                myReportViewer.Show();
            }
        }