public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            EmpWorkDetailsWorkcodeRPT rpt = new EmpWorkDetailsWorkcodeRPT();

            rpt.Site = this.Site;
            return(rpt);
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            String  strDiv      = "%";
            String  strWorkType = "%";
            DataSet ds          = new DataSet();

            if (ChkAll.Checked)
            {
                strDiv = "%";
            }
            else
            {
                strDiv = cmbDivision.SelectedValue.ToString();
            }
            if (rbtNormal.Checked)
            {
                strWorkType = "1";
                ds          = myReports.GetEmpWorkDetailManDaysWorkCode(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), strWorkType, strDiv);
            }
            else
            {
                strWorkType = "2";
                ds          = myReports.GetEmpWorkDetailManDaysWorkCode(Convert.ToInt32(cmbYear.Text), Convert.ToInt32(cmbMonth.SelectedValue.ToString()), strWorkType, strDiv);
            }
            if (ds.Tables[0].Rows.Count > 0)
            {
                ds.WriteXml("EmployeeWorkDetailMandaysWorkCode.xml");

                if (chkWithManDays.Checked)
                {
                    EmpWorkDetailsMandaysWorkCodeRPT myWorkAtt = new EmpWorkDetailsMandaysWorkCodeRPT();
                    myWorkAtt.SetDataSource(ds);
                    myWorkAtt.SetParameterValue("Company Name", FTSPayRollBL.Company.getCompanyName());
                    myWorkAtt.SetParameterValue("Estate", myEstate.ListEstates().Rows[0][0].ToString());

                    if (ChkAll.Checked)
                    {
                        myWorkAtt.SetParameterValue("Options", "Division : ALL / Month:" + cmbMonth.Text + "/" + cmbYear.Text);
                    }
                    else
                    {
                        myWorkAtt.SetParameterValue("Options", "Division : " + cmbDivision.Text + " Month: " + cmbMonth.Text + "/" + cmbYear.Text);
                    }
                    if (strWorkType == "1")
                    {
                        myWorkAtt.SetParameterValue("WorkType", "Work Type : Normal Work");
                    }
                    else
                    {
                        myWorkAtt.SetParameterValue("WorkType", "Work Type : Cash Work");
                    }

                    ReportViewer myReportViewer = new ReportViewer();
                    myReportViewer.crystalReportViewer1.ReportSource = myWorkAtt;
                    myReportViewer.Show();
                }
                else
                {
                    EmpWorkDetailsWorkcodeRPT myWorkAtt = new EmpWorkDetailsWorkcodeRPT();
                    myWorkAtt.SetDataSource(ds);
                    myWorkAtt.SetParameterValue("Company Name", FTSPayRollBL.Company.getCompanyName());
                    myWorkAtt.SetParameterValue("Estate", myEstate.ListEstates().Rows[0][0].ToString());

                    if (ChkAll.Checked)
                    {
                        myWorkAtt.SetParameterValue("Options", "Division : ALL / Month:" + cmbMonth.Text + "/" + cmbYear.Text);
                    }
                    else
                    {
                        myWorkAtt.SetParameterValue("Options", "Division : " + cmbDivision.Text + " Month: " + cmbMonth.Text + "/" + cmbYear.Text);
                    }
                    if (strWorkType == "1")
                    {
                        myWorkAtt.SetParameterValue("WorkType", "Work Type : Normal Work");
                    }
                    else
                    {
                        myWorkAtt.SetParameterValue("WorkType", "Work Type : Cash Work");
                    }

                    ReportViewer myReportViewer = new ReportViewer();
                    myReportViewer.crystalReportViewer1.ReportSource = myWorkAtt;
                    myReportViewer.Show();
                }
            }
            else
            {
                MessageBox.Show("No Data to Preview..!");
            }
        }