コード例 #1
0
        private void btnReport_Click(object sender, EventArgs e)
        {
            if (chkAllDiv.Checked)
            {
                DataSet dsEmpGangsReport = new DataSet();
                dsEmpGangsReport = objempCurrentStatus.ListEmployeeStatusChangeLog("%", Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()));
                dsEmpGangsReport.WriteXml("EmployeeStatusChangeLog.xml");

                EmployeeStatusChangeLogRPT objReport = new EmployeeStatusChangeLogRPT();
                objReport.SetDataSource(dsEmpGangsReport);
                ReportViewerForm objReportViewer = new ReportViewerForm();

                objReport.SetParameterValue("Company", FTSPayRollBL.Company.getCompanyName());
                objReport.SetParameterValue("Estate", EstDivBlock.ListEstates().Rows[0][0].ToString());
                objReportViewer.crystalReportViewer1.ReportSource = objReport;
                objReportViewer.Show();
            }
            else
            {
                DataSet dsEmpGangsReport = new DataSet();
                dsEmpGangsReport = objempCurrentStatus.ListEmployeeStatusChangeLog(cmbDivision.SelectedValue.ToString());
                dsEmpGangsReport.WriteXml("EmployeeStatusChangeLog.xml");

                EmployeeStatusChangeLogRPT objReport = new EmployeeStatusChangeLogRPT();
                objReport.SetDataSource(dsEmpGangsReport);
                ReportViewerForm objReportViewer = new ReportViewerForm();

                objReport.SetParameterValue("Company", FTSPayRollBL.Company.getCompanyName());
                objReport.SetParameterValue("Estate", EstDivBlock.ListEstates().Rows[0][0].ToString());
                objReportViewer.crystalReportViewer1.ReportSource = objReport;
                objReportViewer.Show();
            }
        }
コード例 #2
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            EmployeeStatusChangeLogRPT rpt = new EmployeeStatusChangeLogRPT();

            rpt.Site = this.Site;
            return(rpt);
        }
コード例 #3
0
        private void btnAutoProcess_Click(object sender, EventArgs e)
        {
            String    strMessageText = "";
            String    strStatus      = "";
            Boolean   boolOk         = true;
            DataTable dtDivisions    = EstDivBlock.ListEstateDivisions();
            DataTable dtEmployees;

            foreach (DataRow drow in dtDivisions.Rows)
            {
                //Active to Inactive
                dtEmployees = objempCurrentStatus.getListOfEmployeesAboveToChangeStatus(EstDivBlock.getEstateId(), drow[0].ToString(), "Active", Convert.ToInt32(dtInactiveDuration.Rows[0][0].ToString()), true);
                if (dtEmployees.Rows.Count > 0)
                {
                    foreach (DataRow drowEmp in dtEmployees.Rows)
                    {
                        try
                        {
                            objempCurrentStatus.DtTxDate         = DateTime.Now.Date;
                            objempCurrentStatus.StrEmpEstate     = EstDivBlock.getEstateId();
                            objempCurrentStatus.StrEmpDivision   = drow[0].ToString();
                            objempCurrentStatus.StrEmpNo         = drowEmp[2].ToString();
                            objempCurrentStatus.StrCurrentStatus = "Active";
                            objempCurrentStatus.StrNewStatus     = "Inactive";
                            objempCurrentStatus.StrReason        = "AbsentToWork";
                            objempCurrentStatus.StrChangedMethod = "ByAutoProcess";
                            objempCurrentStatus.StrUserID        = User.StrUserName;
                            objempCurrentStatus.DtLastWorkedDate = Convert.ToDateTime(drowEmp[7].ToString());
                            objempCurrentStatus.DecLastWorkRate  = Convert.ToDecimal(drowEmp[9].ToString());
                            strStatus = objempCurrentStatus.EmployeeStatusChange();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Error On Status Change, " + ex.Message);
                            boolOk = false;
                        }
                    }
                    if (boolOk)
                    {
                        strMessageText += drow[1].ToString() + " Employees Status Changed From Active To Inactive Successfully.\r\n";
                    }
                    else
                    {
                        strMessageText += drow[1].ToString() + " Employees Status Changed From Active To Inactive Complted With Errors.\r\n";
                    }
                }
            }
            if (strMessageText.Length > 0)
            {
                MessageBox.Show(strMessageText);
            }

            //Terminate employees
            foreach (DataRow drow in dtDivisions.Rows)
            {
                //Inactive to Terminate
                dtEmployees = objempCurrentStatus.getListOfEmployeesAboveToChangeStatus(EstDivBlock.getEstateId(), drow[0].ToString(), "Terminate", Convert.ToInt32(dtInactiveDuration.Rows[0][0].ToString()), false);
                if (dtEmployees.Rows.Count > 0)
                {
                    foreach (DataRow drowEmp in dtEmployees.Rows)
                    {
                        try
                        {
                            objempCurrentStatus.DtTxDate         = DateTime.Now.Date;
                            objempCurrentStatus.StrEmpEstate     = EstDivBlock.getEstateId();
                            objempCurrentStatus.StrEmpDivision   = drow[0].ToString();
                            objempCurrentStatus.StrEmpNo         = drowEmp[2].ToString();
                            objempCurrentStatus.StrCurrentStatus = "Inactive";
                            objempCurrentStatus.StrNewStatus     = "Terminated";
                            objempCurrentStatus.StrReason        = "AbsentToWork";
                            objempCurrentStatus.StrChangedMethod = "ByAutoProcess";
                            objempCurrentStatus.StrUserID        = User.StrUserName;
                            objempCurrentStatus.DtLastWorkedDate = Convert.ToDateTime(drowEmp[7].ToString());
                            objempCurrentStatus.DecLastWorkRate  = Convert.ToDecimal(drowEmp[9].ToString());
                            strStatus = objempCurrentStatus.EmployeeStatusChange();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Error On Status Change, " + ex.Message);
                            boolOk = false;
                        }
                    }
                    if (boolOk)
                    {
                        strMessageText += drow[1].ToString() + " Employees Status Changed From Active To Inactive Successfully.\r\n";
                    }
                    else
                    {
                        strMessageText += drow[1].ToString() + " Employees Status Changed From Active To Inactive Complted With Errors.\r\n";
                    }
                }
            }
            if (strMessageText.Length > 0)
            {
                MessageBox.Show(strMessageText);
            }
            //-------------------------------------
            DataSet dsEmpGangsReport = new DataSet();

            dsEmpGangsReport = objempCurrentStatus.ListEmployeeStatusChangeLog("%", Convert.ToDateTime(DateTime.Now.Date.ToShortDateString()));
            if (dsEmpGangsReport.Tables[0].Rows.Count > 0)
            {
                dsEmpGangsReport.WriteXml("EmployeeStatusChangeLog.xml");

                EmployeeStatusChangeLogRPT objReport = new EmployeeStatusChangeLogRPT();
                objReport.SetDataSource(dsEmpGangsReport);
                ReportViewerForm objReportViewer = new ReportViewerForm();

                objReport.SetParameterValue("Company", FTSPayRollBL.Company.getCompanyName());
                objReport.SetParameterValue("Estate", EstDivBlock.ListEstates().Rows[0][0].ToString());
                objReportViewer.crystalReportViewer1.ReportSource = objReport;
                objReportViewer.Show();
            }
        }