コード例 #1
0
    protected void Copy_Click(object sender, EventArgs e)
    {
        int           new_CurID = -1;
        EPayrollGroup o         = new EPayrollGroup();

        o.PayGroupID = CurID;
        if (EPayrollGroup.db.select(dbConn, o))
        {
            EPayrollGroup  newPayrollGroup         = o.Copy(dbConn);
            EPayrollPeriod oldCurrentPayrollPeriod = new EPayrollPeriod();
            oldCurrentPayrollPeriod.PayPeriodID = o.CurrentPayPeriodID;
            if (EPayrollPeriod.db.select(dbConn, oldCurrentPayrollPeriod))
            {
                EPayrollPeriod newPayPeriod = oldCurrentPayrollPeriod.Copy(dbConn, newPayrollGroup.PayGroupID);
                newPayrollGroup.CurrentPayPeriodID = newPayPeriod.PayPeriodID;
                EPayrollGroup.db.update(dbConn, newPayrollGroup);
                new_CurID = newPayrollGroup.PayGroupID;
            }

            // Start 0000069, Ricky So, 2014-08-08
            DBFilter m_filter = new DBFilter();
            m_filter.add(new Match("PayGroupID", CurID));
            foreach (EPayrollGroupUsers users in EPayrollGroupUsers.db.select(dbConn, m_filter))
            {
                EPayrollGroupUsers new_users = new EPayrollGroupUsers();
                new_users.PayGroupID = new_CurID;
                new_users.UserID     = users.UserID;

                EPayrollGroupUsers.db.insert(dbConn, new_users);
            }
            // End 0000069, Ricky So, 2014-08-08

            HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Payroll_Group_View.aspx?PayGroupID=" + newPayrollGroup.PayGroupID);
        }
    }
コード例 #2
0
    protected void RefreshMinimumWagesInfo()
    {
        DBFilter filter = new DBFilter();

        filter.add(new Match("EmpPayrollID", CurID));
        filter.add(WebUtils.AddRankFilter(Session, "EmpID", true));
        ArrayList empPayrollList = EEmpPayroll.db.select(dbConn, filter);

        if (empPayrollList.Count == 0)
        {
            TotalWagesForMinimumWages.Text = string.Empty;
            MinimumWagesRequired.Text      = string.Empty;
            return;
        }
        EEmpPayroll empPayroll = (EEmpPayroll)empPayrollList[0];

        double dblTotalWagesForMinimumWages = 0;
        double dblMinimumWagesRequired      = 0;

        EPayrollPeriod payPeriod = new EPayrollPeriod();

        payPeriod.PayPeriodID = empPayroll.PayPeriodID;
        if (EPayrollPeriod.db.select(dbConn, payPeriod))
        {
            dblTotalWagesForMinimumWages = HROne.Payroll.PayrollProcess.GetTotalWagesWithoutRestDayPayment(dbConn, empPayroll.EmpID, payPeriod.PayPeriodFr, payPeriod.PayPeriodTo, null);
        }

        double totalWorkingHour = HROne.Payroll.PayrollProcess.GetTotalEmpPayrollWorkingHours(dbConn, empPayroll.EmpID, empPayroll.PayPeriodID);

        lblTotalWorkingHours.Text = totalWorkingHour.ToString();


        dblMinimumWagesRequired        = ((double)(HROne.Payroll.PayrollProcess.GetMinimumWages(dbConn, empPayroll.EmpID, payPeriod.PayPeriodTo) * totalWorkingHour));
        TotalWagesForMinimumWages.Text = dblTotalWagesForMinimumWages.ToString("#,##0.00");
        MinimumWagesRequired.Text      = dblMinimumWagesRequired.ToString("#,##0.00");
        if (dblMinimumWagesRequired - dblTotalWagesForMinimumWages <= 0.01)
        {
            btnAddAdditionalRemuneration.Visible = false;
        }
        else
        {
            EPayrollGroup payGroup = new EPayrollGroup();
            payGroup.PayGroupID = payPeriod.PayGroupID;
            if (EPayrollGroup.db.select(dbConn, payGroup))
            {
                if (payGroup.PayGroupAdditionalRemunerationPayCodeID > 0)
                {
                    btnAddAdditionalRemuneration.Visible = true & toolBar.EditButton_Visible;
                }
                else
                {
                    btnAddAdditionalRemuneration.Visible = false;
                }
            }
            else
            {
                btnAddAdditionalRemuneration.Visible = false;
            }
        }
    }
コード例 #3
0
    protected void Copy_Click(object sender, EventArgs e)
    {
        ArrayList list = WebUtils.SelectedRepeaterItemToBaseObjectList(db, Repeater, "ItemSelect");

        foreach (EPayrollGroup o in list)
        {
            if (EPayrollGroup.db.select(dbConn, o))
            {
                EPayrollGroup  newPayrollGroup         = o.Copy(dbConn);
                EPayrollPeriod oldCurrentPayrollPeriod = new EPayrollPeriod();
                oldCurrentPayrollPeriod.PayPeriodID = o.CurrentPayPeriodID;
                if (EPayrollPeriod.db.select(dbConn, oldCurrentPayrollPeriod))
                {
                    EPayrollPeriod newPayPeriod = oldCurrentPayrollPeriod.Copy(dbConn, newPayrollGroup.PayGroupID);
                    newPayrollGroup.CurrentPayPeriodID = newPayPeriod.PayPeriodID;
                    EPayrollGroup.db.update(dbConn, newPayrollGroup);
                }
                // Start 0000069, Ricky So, 2014-08-08
                DBFilter m_filter = new DBFilter();
                m_filter.add(new Match("PayGroupID", o.PayGroupID));
                foreach (EPayrollGroupUsers users in EPayrollGroupUsers.db.select(dbConn, m_filter))
                {
                    EPayrollGroupUsers new_users = new EPayrollGroupUsers();
                    new_users.PayGroupID = newPayrollGroup.PayGroupID;
                    new_users.UserID     = users.UserID;

                    EPayrollGroupUsers.db.insert(dbConn, new_users);
                }
                // End 0000069, Ricky So, 2014-08-08
            }
        }
        loadData(info, db, Repeater);
    }
コード例 #4
0
    protected void btnProcessEnd_Click(object sender, EventArgs e)
    {
        PageErrors     errors         = PageErrors.getErrors(db, Page.Master);
        PayrollProcess payrollProcess = new PayrollProcess(dbConn);

        WebUtils.StartFunction(Session, FUNCTION_CODE);
        payrollProcess.PayrollProcessEnd(CurPayPeriodID, WebUtils.GetCurUser(Session).UserID);
        EPayrollPeriod payPeriod = payrollProcess.GenerateNextPayrollPeriod(CurID);

        WebUtils.EndFunction(dbConn);
        errors.addError("Complete");

        panelNotConfirmEmployeeList.Visible  = false;
        panelNotTrialRunEmployeeList.Visible = false;
        panelProcessEndOption.Visible        = false;
        //CurPayPeriodID = payPeriod.PayPeriodID;
        //binding.init(Request, Session);

        ////loadState();
        //if (CurID > 0)
        //{
        //    panelPayPeriod.Visible = true;
        //    loadObject();
        //    NotConfirmEmpView = loadNotConfirmData(NotConfirmEmpInfo, EEmpPayroll.db, NotConfirm_Repeater);
        //    NotTrialRunEmpView = loadNotTrialRunData(NotTrialRunEmpInfo, EEmpPersonalInfo.db, NotTrialRun_Repeater);
        //}
        //else
        //{
        //    panelPayPeriod.Visible = false;
        //    panelProcessEndOption.Visible = false;
        //}
        //        Response.Redirect(Request.Url.LocalPath + "?" + Request.QueryString);
    }
コード例 #5
0
    protected void Add_Click(object sender, EventArgs e)
    {
        Repeater.EditItemIndex = -1;
        EORSORecord c = new EORSORecord();

        Hashtable values = new Hashtable();

        newBinding.toValues(values);

        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();


        db.validate(errors, values);

        if (!errors.isEmpty())
        {
            return;
        }


        db.parse(values, c);
        c.ORSORecType = "A";

        EEmpPayroll empPayroll = new EEmpPayroll();

        empPayroll.EmpPayrollID = c.EmpPayrollID;
        if (EEmpPayroll.db.select(dbConn, empPayroll))
        {
            EPayrollPeriod payPeriod = new EPayrollPeriod();
            payPeriod.PayPeriodID = empPayroll.PayPeriodID;

            if (EPayrollPeriod.db.select(dbConn, payPeriod))
            {
                if (c.ORSORecPeriodFr <= payPeriod.PayPeriodTo && c.ORSORecPeriodTo <= payPeriod.PayPeriodTo)
                {
                    WebUtils.StartFunction(Session, m_FunctionCode, empPayroll.EmpID);
                    db.insert(dbConn, c);
                    WebUtils.EndFunction(dbConn);
                }
                else
                {
                    errors.addError(HROne.Translation.PageErrorMessage.ERROR_INVALID_PERIOD);
                    return;
                }
            }
        }
        ORSORecPeriodFr.TextBox.Text = string.Empty;
        ORSORecPeriodTo.TextBox.Text = string.Empty;
        ORSORecActRI.Text            = string.Empty;
        ORSORecActER.Text            = string.Empty;
        ORSORecActEE.Text            = string.Empty;
        ORSOPlanID.SelectedIndex     = 0;

        view = loadData(info, db, Repeater);
        //Response.Redirect(Request.Url.LocalPath + "?" + Request.QueryString);
    }
コード例 #6
0
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        ArrayList list = new ArrayList();

        foreach (RepeaterItem i in Repeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                EEmpPayroll o = (EEmpPayroll)EEmpPayroll.db.createObject();
                WebFormUtils.GetKeys(EEmpPayroll.db, o, cb);
                list.Add(o);
            }
        }

        DateTime processDateTime = AppUtils.ServerDateTime();


        if (list.Count > 0)
        {
            int UserID = WebUtils.GetCurUser(Session).UserID;


            EPayrollPeriod payPeriod = new EPayrollPeriod();
            payPeriod.PayPeriodID          = CurPayPeriodID;
            payPeriod.PayPeriodStatus      = "C";
            payPeriod.PayPeriodConfirmDate = processDateTime;
            payPeriod.PayPeriodConfirmBy   = UserID;
            EPayrollPeriod.db.update(dbConn, payPeriod);

            EPayrollBatch payBatch = new EPayrollBatch();
            payBatch.PayBatchConfirmDate = processDateTime;
            payBatch.PayBatchRemark      = txtRemark.Text;
            EPayrollBatch.db.insert(dbConn, payBatch);

            PayrollProcess payrollProcess = new PayrollProcess(dbConn);
            WebUtils.StartFunction(Session, FUNCTION_CODE, 0, true);
            foreach (EEmpPayroll o in list)
            {
                if (EEmpPayroll.db.select(dbConn, o))
                {
                    AppUtils.StartChildFunction(dbConn, o.EmpID);
                    payrollProcess.PayrollConfirm(o, payBatch.PayBatchID, UserID);
                    AppUtils.EndChildFunction(dbConn);
                }
            }
            WebUtils.EndFunction(dbConn);
            PageErrors.getErrors(db, Page).addError("Complete");
            txtRemark.Text = string.Empty;
            //Response.Write("<script>alert('Completed'); </script>");
        }
        loadObject();
        loadData(info, EEmpPayroll.db, Repeater);
    }
コード例 #7
0
        private bool GenerateORSOData(int PaySlipID, ArrayList orsoRecords)
        {
            bool hasORSO = false;

            DataSet.Payroll_PaySlip.PaySlip_ORSORow orsoRow = null;
            foreach (EORSORecord orsoRecord in orsoRecords)
            {
                hasORSO = true;

                if (orsoRow == null)
                {
                    orsoRow = CreatePaySlipORSORow(PaySlipID, orsoRecord.ORSORecPeriodFr, orsoRecord.ORSORecPeriodTo);
                }
                if (!(orsoRecord.ORSORecPeriodFr.Equals(orsoRow.PeriodFr) && orsoRecord.ORSORecPeriodTo.Equals(orsoRow.PeriodTo)))
                {
                    dataSet.PaySlip_ORSO.Rows.Add(orsoRow);
                    orsoRow = CreatePaySlipORSORow(PaySlipID, orsoRecord.ORSORecPeriodFr, orsoRecord.ORSORecPeriodTo);
                }
                // Start 0000206, Ricky So, 2015-05-22
                //orsoRow.RelevantIncome += orsoRecord.ORSORecActRI;
                // End 0000206, Ricky So, 2015-05-22
                orsoRow.EE += orsoRecord.ORSORecActEE;
                orsoRow.ER += orsoRecord.ORSORecActER;
            }
            // Start 0000206, Ricky So, 2015-05-22
            if (orsoRow != null)
            {
                EEmpPayroll    m_empPayroll = EEmpPayroll.GetObject(dbConn, ((EORSORecord)orsoRecords[0]).EmpPayrollID);
                EPayrollPeriod m_payPeriod  = EPayrollPeriod.GetObject(dbConn, m_empPayroll.PayPeriodID);

                DBFilter m_basicSalaryFilter = new DBFilter();
                m_basicSalaryFilter.add(AppUtils.GetPayemntCodeDBTermByPaymentType(dbConn, "PayCodeID", "BASICSAL"));
                m_basicSalaryFilter.add(new Match("EmpID", m_empPayroll.EmpID));
                m_basicSalaryFilter.add(new Match("EmpRPEffFr", "<=", m_payPeriod.PayPeriodTo));

                OR m_or = new OR();
                m_or.add(new Match("EmpRPEffTo", ">=", m_payPeriod.PayPeriodFr));
                m_or.add(new NullTerm("EmpRPEffTo"));

                m_basicSalaryFilter.add(m_or);

                foreach (EEmpRecurringPayment m_payment in EEmpRecurringPayment.db.select(dbConn, m_basicSalaryFilter))
                {
                    orsoRow.RelevantIncome += m_payment.EmpRPAmount;
                }
            }
            // End 0000206, Ricky So, 2015-05-22

            if (orsoRow != null)
            {
                dataSet.PaySlip_ORSO.Rows.Add(orsoRow);
            }
            return(hasORSO);
        }
コード例 #8
0
        public PayrollDetailProcess(DatabaseConnection dbConn, IList EmpList, ReportType reportType, int PayPeriodID, IList PayBatchList, IList HLevelIDDisplayList)
            : base(dbConn)
        {
            EPayrollPeriod payPeriod = new EPayrollPeriod();

            payPeriod.PayPeriodID = PayPeriodID;
            ArrayList payPeriodList = new ArrayList();

            payPeriodList.Add(payPeriod);
            Init(EmpList, reportType, payPeriodList, PayBatchList, HLevelIDDisplayList);
        }
コード例 #9
0
        public AutopayListProcess(DatabaseConnection dbConn, System.Data.DataSet dataSet, int PayPeriodID)
            : base(dbConn)
        {
            this.dataSet = dataSet;
            EPayrollPeriod payPeriod = new EPayrollPeriod();

            payPeriod.PayPeriodID = PayPeriodID;
            if (EPayrollPeriod.db.select(dbConn, payPeriod))
            {
                PayPeriodFr = payPeriod.PayPeriodFr;
            }
        }
コード例 #10
0
    protected void Delete_Click(object sender, EventArgs e)
    {
        EPayrollPeriod c = new EPayrollPeriod();

        c.PayPeriodID = CurID;
        if (EPayrollPeriod.db.select(dbConn, c))
        {
            WebUtils.StartFunction(Session, FUNCTION_CODE);
            db.delete(dbConn, c);
            WebUtils.EndFunction(dbConn);
        }
        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Payroll_Group_View.aspx?PayGroupID=" + c.PayGroupID);
    }
コード例 #11
0
        public AutopayListProcess(DatabaseConnection dbConn, ArrayList EmpList, ArrayList PayBatchList, int PayPeriodID)
            : base(dbConn)
        {
            this.EmpList      = EmpList;
            this.PayBatchList = PayBatchList;

            EPayrollPeriod payPeriod = new EPayrollPeriod();

            payPeriod.PayPeriodID = PayPeriodID;
            if (EPayrollPeriod.db.select(dbConn, payPeriod))
            {
                PayPeriodFr = payPeriod.PayPeriodFr;
            }
        }
コード例 #12
0
    protected bool loadObject()
    {
        EPayrollGroup obj   = new EPayrollGroup();
        bool          isNew = WebFormWorkers.loadKeys(db, obj, DecryptedRequest);

        if (!db.select(dbConn, obj))
        {
            return(false);
        }

        Hashtable values = new Hashtable();

        db.populate(obj, values);
        binding.toControl(values);
        if (CurPayPeriodID <= 0)
        {
            CurPayPeriodID = obj.CurrentPayPeriodID;
        }
        PayPeriodID.SelectedValue = CurPayPeriodID.ToString();
        ucPayroll_PeriodInfo.CurrentPayPeriodID = CurPayPeriodID;

        if (CurPayPeriodID > 0)
        {
            EPayrollPeriod payPeriod = new EPayrollPeriod();
            payPeriod.PayPeriodID = CurPayPeriodID;
            if (EPayrollPeriod.db.select(dbConn, payPeriod))
            {
                if (payPeriod.PayPeriodStatus.Equals("N"))
                {
                    PayPeriodEdit.Visible = true;
                }
                else
                {
                    PayPeriodEdit.Visible = false;
                }
            }
        }
        StatutoryHolidayOptionSection.Visible = !obj.PayGroupIsSkipStatHol;
        if (string.IsNullOrEmpty(obj.PayGroupFreq) || obj.PayGroupFreq.Equals("M", StringComparison.CurrentCultureIgnoreCase))
        {
            SemiMonthlyDayOptionsRow.Visible = false;
        }
        else
        {
            SemiMonthlyDayOptionsRow.Visible = true;
        }
        return(true);
    }
コード例 #13
0
    protected bool loadObject()
    {
        obj = new EPayrollPeriod();
        bool isNew = WebFormWorkers.loadKeys(db, obj, DecryptedRequest);

        if (!db.select(dbConn, obj))
        {
            return(false);
        }

        Hashtable values = new Hashtable();

        db.populate(obj, values);
        binding.toControl(values);
        ucPayroll_PeriodInfo.CurrentPayPeriodID = obj.PayPeriodID;
        return(true);
    }
コード例 #14
0
    protected bool loadObject()
    {
        obj = new EPayrollPeriod();
        if (string.IsNullOrEmpty(PayPeriodID.Value))
        {
            obj.PayPeriodID = 0;
        }
        else
        {
            obj.PayPeriodID = int.Parse(PayPeriodID.Value);
        }

        bool result = !db.select(dbConn, obj);

        Hashtable values = new Hashtable();

        db.populate(obj, values);
        binding.toControl(values);
        return(result);
    }
コード例 #15
0
 protected void PayPeriodID_SelectedIndexChanged(object sender, EventArgs e)
 {
     ucPayroll_PeriodInfo.CurrentPayPeriodID = CurPayPeriodID;
     PayPeriodID.SelectedValue = CurPayPeriodID.ToString();
     if (CurPayPeriodID > 0)
     {
         EPayrollPeriod payPeriod = new EPayrollPeriod();
         payPeriod.PayPeriodID = CurPayPeriodID;
         if (EPayrollPeriod.db.select(dbConn, payPeriod))
         {
             if (payPeriod.PayPeriodStatus.Equals("N"))
             {
                 PayPeriodEdit.Visible = true;
             }
             else
             {
                 PayPeriodEdit.Visible = false;
             }
         }
     }
     //Response.Redirect(Request.Url.LocalPath + "?PayGroupID=" + DecryptedRequest["PayGroupID"] + "&PayPeriodID=" + PayPeriodID.SelectedValue);
 }
コード例 #16
0
        public static ArrayList ORSOTrialRun(DatabaseConnection dbConn, int EmpID, EPayrollPeriod payrollPeriod, ArrayList paymentRecords, EMPFRecord mpfRecord)
        {
            ArrayList orsoRecords = new ArrayList();

            DBFilter dbFilter = new DBFilter();

            dbFilter.add(new Match("EmpID", EmpID));
            dbFilter.add(new Match("EmpORSOEffFr", "<=", payrollPeriod.PayPeriodTo));
            dbFilter.add("EmpORSOEffFr", true);
            ArrayList oEmpORSOs = EEmpORSOPlan.db.select(dbConn, dbFilter);

            if (oEmpORSOs.Count > 0)
            {
                EEmpORSOPlan oEmpORSO = (EEmpORSOPlan)oEmpORSOs[0];

                DateTime ORSOJoinDate = oEmpORSO.EmpORSOEffFr;

                if (ORSOJoinDate <= payrollPeriod.PayPeriodTo && ORSOJoinDate >= payrollPeriod.PayPeriodFr)
                {
                    ArrayList newJoinORSORecords = CreateNewJoinORSORecords(dbConn, EmpID, oEmpORSO.EmpORSOEffFr, ORSOJoinDate);
                    if (newJoinORSORecords != null)
                    {
                        orsoRecords.AddRange(newJoinORSORecords);
                    }
                    orsoRecords.Add(CreateORSORecord(dbConn, EmpID, payrollPeriod, paymentRecords, oEmpORSO.EmpORSOEffFr, ORSOJoinType.NewJoin, mpfRecord));
                }
                else if (ORSOJoinDate < payrollPeriod.PayPeriodFr)
                {
                    orsoRecords.Add(CreateORSORecord(dbConn, EmpID, payrollPeriod, paymentRecords, oEmpORSO.EmpORSOEffFr, ORSOJoinType.Existing, mpfRecord));
                }
                else if (payrollPeriod.PayPeriodTo < ORSOJoinDate)
                {
                }
                else
                {
                }
            }
            return(orsoRecords);
        }
コード例 #17
0
    protected bool loadObject()
    {
        obj = new EPayrollPeriod();
        bool isNew = WebFormWorkers.loadKeys(db, obj, DecryptedRequest);

        if (!db.select(dbConn, obj))
        {
            return(false);
        }

        Hashtable values = new Hashtable();

        db.populate(obj, values);
        binding.toControl(values);

        if (!obj.PayPeriodStatus.Equals("N"))
        {
            toolBar.SaveButton_Visible   = false;
            toolBar.DeleteButton_Visible = false;
        }

        if (obj.PayGroupID > 0)
        {
            EPayrollGroup payGroup = new EPayrollGroup();
            payGroup.PayGroupID    = obj.PayGroupID;
            HiddenPayGroupID.Value = obj.PayGroupID.ToString();
            if (EPayrollGroup.db.select(dbConn, payGroup))
            {
                if (payGroup.CurrentPayPeriodID == obj.PayPeriodID)
                {
                    toolBar.DeleteButton_Visible = false;
                }
            }
        }

        return(true);
    }
コード例 #18
0
        public override ReportDocument GenerateReport()
        {
            dataSet = new DataSet.Payroll_EEOverallPayrollSummary();


            if (PayPeriodFr.Ticks != 0 && EmpList.Count > 0)
            {
                //  initialize Payment Code for Employer Contribution

                ArrayList    mcERPaymentCodeList = HROne.Payroll.PayrollProcess.GetPaymentCodeByPaymentType(dbConn, EPaymentType.SystemPaymentType.MPFEmployerMandatoryContributionPaymentType(dbConn).PaymentTypeCode);
                EPaymentCode mpfMCERPaymentCode;
                if (mcERPaymentCodeList.Count > 0)
                {
                    mpfMCERPaymentCode = (EPaymentCode)mcERPaymentCodeList[0];
                }
                else
                {
                    mpfMCERPaymentCode = new EPaymentCode();
                    mpfMCERPaymentCode.PaymentCodeID   = -1;
                    mpfMCERPaymentCode.PaymentCode     = "MCER";
                    mpfMCERPaymentCode.PaymentCodeDesc = "Employer Mandatory Contribution";
                }

                ArrayList    vcERPaymentCodeList = HROne.Payroll.PayrollProcess.GetPaymentCodeByPaymentType(dbConn, EPaymentType.SystemPaymentType.MPFEmployerVoluntaryContributionPaymentType(dbConn).PaymentTypeCode);
                EPaymentCode mpfVCERPaymentCode;
                if (vcERPaymentCodeList.Count > 0)
                {
                    mpfVCERPaymentCode = (EPaymentCode)vcERPaymentCodeList[0];
                }
                else
                {
                    mpfVCERPaymentCode = new EPaymentCode();
                    mpfVCERPaymentCode.PaymentCodeID   = -2;
                    mpfVCERPaymentCode.PaymentCode     = "VCER";
                    mpfVCERPaymentCode.PaymentCodeDesc = "Employer Voluntary Contribution";
                }

                ArrayList    pfundERPaymentCodeList = HROne.Payroll.PayrollProcess.GetPaymentCodeByPaymentType(dbConn, EPaymentType.SystemPaymentType.PFundEmployerContributionPaymentType(dbConn).PaymentTypeCode);
                EPaymentCode pFundERPaymentCode;
                if (pfundERPaymentCodeList.Count > 0)
                {
                    pFundERPaymentCode = (EPaymentCode)pfundERPaymentCodeList[0];
                }
                else
                {
                    pFundERPaymentCode = new EPaymentCode();
                    pFundERPaymentCode.PaymentCodeID   = -3;
                    pFundERPaymentCode.PaymentCode     = "PFUNDER";
                    pFundERPaymentCode.PaymentCodeDesc = "Employer P-Fund Contribution";
                }

                dtPayPeriodFr = PayPeriodFr;
                dtPayPeriodTo = dtPayPeriodFr.AddMonths(12).AddDays(-1);


                string strPrintPeriod = string.Empty;
                //if (lngPayPeriodFr != 0 && lngPayPeriodTo != 0)
                strPrintPeriod = dtPayPeriodFr.ToString("yyyy-MM-dd") + " - " + dtPayPeriodTo.ToString("yyyy-MM-dd");

                DataSet.Payroll_EEOverallPayrollSummary.EmpInfoDataTable        empInfoTable = dataSet.EmpInfo;
                DataSet.Payroll_EEOverallPayrollSummary.OverallPaymentDataTable payTable     = dataSet.OverallPayment;

                DataSet.Payroll_EEOverallPayrollSummary.OverallContributionDataTable contributionTable = dataSet.OverallContribution;
                foreach (EEmpPersonalInfo empInfo in EmpList)
                {
                    EEmpPersonalInfo.db.select(dbConn, empInfo);


                    DBFilter positionFilter = new DBFilter();
                    positionFilter.add(new Match("EmpID", empInfo.EmpID));
                    //if (lngPayPeriodFr != 0 && lngPayPeriodTo != 0)
                    //{
                    positionFilter.add(new Match("EmpPosEffFr", "<=", dtPayPeriodTo.CompareTo(AppUtils.ServerDateTime()) < 0 ? dtPayPeriodTo : AppUtils.ServerDateTime()));
                    OR orPosEffToTerms = new OR();
                    orPosEffToTerms.add(new Match("EmpPosEffTo", ">=", dtPayPeriodFr));
                    orPosEffToTerms.add(new NullTerm("EmpPosEffTo"));
                    positionFilter.add(orPosEffToTerms);
                    //}
                    positionFilter.add("EmpPosEffFr", false);

                    ArrayList        empPositionInfos = EEmpPositionInfo.db.select(dbConn, positionFilter);
                    EEmpPositionInfo empPositionInfo;
                    if (empPositionInfos.Count > 0)
                    {
                        empPositionInfo = (EEmpPositionInfo)empPositionInfos[0];
                    }
                    else
                    {
                        empPositionInfo = new EEmpPositionInfo();
                    }

                    ECompany company = new ECompany();
                    company.CompanyID = empPositionInfo.CompanyID;
                    ECompany.db.select(dbConn, company);

                    EPosition position = new EPosition();
                    position.PositionID = empPositionInfo.PositionID;
                    EPosition.db.select(dbConn, position);

                    DataSet.Payroll_EEOverallPayrollSummary.EmpInfoRow empInfoRow = empInfoTable.NewEmpInfoRow();
                    empInfoRow.EmpID       = empInfo.EmpID;
                    empInfoRow.EmpNo       = empInfo.EmpNo;
                    empInfoRow.EmpName     = empInfo.EmpEngFullName;
                    empInfoRow.JoinDate    = empInfo.EmpDateOfJoin;
                    empInfoRow.CompanyCode = company.CompanyCode;
                    empInfoRow.CompanyName = company.CompanyName;
                    //                empInfoRow.PrintPeriod = strPrintPeriod;
                    empInfoRow.PositionDesc = position.PositionDesc;

                    empInfoTable.Rows.Add(empInfoRow);

                    DBFilter payPeriodFilter = new DBFilter();
                    //if (lngPayPeriodFr != 0 && lngPayPeriodTo != 0)
                    //{
                    payPeriodFilter.add(new Match("pp.PayPeriodTo", "<=", dtPayPeriodTo));
                    payPeriodFilter.add(new Match("pp.PayPeriodTo", ">=", dtPayPeriodFr));
                    //}
                    DBFilter empPayrollFilter = new DBFilter();
                    empPayrollFilter.add(new Match("EmpID", empInfo.EmpID));
                    empPayrollFilter.add(new IN("PayPeriodID", "Select PayPeriodID from PayrollPeriod pp", payPeriodFilter));


                    DBFilter payRecordFilter = new DBFilter();
                    payRecordFilter.add(new IN("EmpPayrollID", "Select EmpPayrollID from EmpPayroll", empPayrollFilter));
                    ArrayList payRecords = EPaymentRecord.db.select(dbConn, payRecordFilter);

                    ArrayList mpfRecords = EMPFRecord.db.select(dbConn, payRecordFilter);

                    ArrayList orsoRecords = EORSORecord.db.select(dbConn, payRecordFilter);
                    foreach (EPaymentRecord payRecord in payRecords)
                    {
                        EEmpPayroll empPayroll = new EEmpPayroll();
                        empPayroll.EmpPayrollID = payRecord.EmpPayrollID;
                        EEmpPayroll.db.select(dbConn, empPayroll);

                        EPayrollPeriod payrollPeriod = new EPayrollPeriod();
                        payrollPeriod.PayPeriodID = empPayroll.PayPeriodID;
                        EPayrollPeriod.db.select(dbConn, payrollPeriod);

                        EPaymentCode payCode = new EPaymentCode();
                        payCode.PaymentCodeID = payRecord.PaymentCodeID;
                        EPaymentCode.db.select(dbConn, payCode);

                        DataSet.Payroll_EEOverallPayrollSummary.OverallPaymentRow payRow = payTable.NewOverallPaymentRow();

                        payRow.EmpID                   = empInfo.EmpID;
                        payRow.PaymentCode             = payCode.PaymentCode;
                        payRow.PaymentCodeDisplaySeqNo = payCode.PaymentCodeDisplaySeqNo;

                        DBFilter taxPaymentMapFilter = new DBFilter();
                        taxPaymentMapFilter.add(new Match("PaymentCodeID", payRecord.PaymentCodeID));
                        if (ETaxPaymentMap.db.count(dbConn, taxPaymentMapFilter) > 0)
                        {
                            payRow.IsTaxable = true;
                        }
                        else
                        {
                            payRow.IsTaxable = false;
                        }

                        for (int fieldsNo = 1; fieldsNo < 13; fieldsNo++)
                        {
                            payRow["Amount" + fieldsNo.ToString("00")] = 0;
                        }

                        payRow["Amount" + ((payrollPeriod.PayPeriodTo.Month + 12 - dtPayPeriodFr.Month) % 12 + 1).ToString("00")] = payRecord.PayRecActAmount;

                        payTable.Rows.Add(payRow);
                        try
                        {
                            DataSet.Payroll_EEOverallPayrollSummary.PaymentCodeDataTable paymentCodeTable = dataSet.PaymentCode;
                            DataSet.Payroll_EEOverallPayrollSummary.PaymentCodeRow       paymentCodeRow   = paymentCodeTable.NewPaymentCodeRow();
                            paymentCodeRow.EmpID           = empInfo.EmpID;
                            paymentCodeRow.PaymentCodeID   = payCode.PaymentCodeID;
                            paymentCodeRow.PaymentCode     = payCode.PaymentCode;
                            paymentCodeRow.PaymentCodeDesc = payCode.PaymentCodeDesc;
                            paymentCodeTable.Rows.Add(paymentCodeRow);
                        }
                        catch
                        {
                        }
                        try
                        {
                            DataSet.Payroll_EEOverallPayrollSummary.GrandTotalPaymentCodeDataTable paymentCodeTable = dataSet.GrandTotalPaymentCode;
                            if (paymentCodeTable.Select("PaymentCodeID=" + payCode.PaymentCodeID.ToString()).Length <= 0)
                            {
                                DataSet.Payroll_EEOverallPayrollSummary.GrandTotalPaymentCodeRow paymentCodeRow = paymentCodeTable.NewGrandTotalPaymentCodeRow();
                                paymentCodeRow.PaymentCodeID   = payCode.PaymentCodeID;
                                paymentCodeRow.PaymentCode     = payCode.PaymentCode;
                                paymentCodeRow.PaymentCodeDesc = payCode.PaymentCodeDesc;
                                paymentCodeTable.Rows.Add(paymentCodeRow);
                            }
                        }
                        catch
                        {
                        }
                    }
                    foreach (EMPFRecord mpfRecord in mpfRecords)
                    {
                        EEmpPayroll empPayroll = new EEmpPayroll();
                        empPayroll.EmpPayrollID = mpfRecord.EmpPayrollID;
                        EEmpPayroll.db.select(dbConn, empPayroll);

                        EPayrollPeriod payrollPeriod = new EPayrollPeriod();
                        payrollPeriod.PayPeriodID = empPayroll.PayPeriodID;
                        EPayrollPeriod.db.select(dbConn, payrollPeriod);


                        DataSet.Payroll_EEOverallPayrollSummary.OverallContributionRow contributionRow = contributionTable.NewOverallContributionRow();

                        contributionRow.EmpID       = empInfo.EmpID;
                        contributionRow.PaymentCode = mpfMCERPaymentCode.PaymentCode;


                        for (int fieldsNo = 1; fieldsNo < 13; fieldsNo++)
                        {
                            contributionRow["Amount" + fieldsNo.ToString("00")] = 0;
                        }

                        contributionRow["Amount" + ((payrollPeriod.PayPeriodTo.Month + 12 - dtPayPeriodFr.Month) % 12 + 1).ToString("00")] = mpfRecord.MPFRecActMCER;

                        contributionTable.Rows.Add(contributionRow);

                        contributionRow = contributionTable.NewOverallContributionRow();

                        contributionRow.EmpID       = empInfo.EmpID;
                        contributionRow.PaymentCode = mpfVCERPaymentCode.PaymentCode;


                        for (int fieldsNo = 1; fieldsNo < 13; fieldsNo++)
                        {
                            contributionRow["Amount" + fieldsNo.ToString("00")] = 0;
                        }

                        contributionRow["Amount" + ((payrollPeriod.PayPeriodTo.Month + 12 - dtPayPeriodFr.Month) % 12 + 1).ToString("00")] = mpfRecord.MPFRecActVCER;

                        contributionTable.Rows.Add(contributionRow);
                        try
                        {
                            DataSet.Payroll_EEOverallPayrollSummary.PaymentCodeDataTable paymentCodeTable = dataSet.PaymentCode;
                            DataSet.Payroll_EEOverallPayrollSummary.PaymentCodeRow       paymentCodeRow   = paymentCodeTable.NewPaymentCodeRow();
                            paymentCodeRow.EmpID           = empInfo.EmpID;
                            paymentCodeRow.PaymentCodeID   = mpfMCERPaymentCode.PaymentCodeID;
                            paymentCodeRow.PaymentCode     = mpfMCERPaymentCode.PaymentCode;
                            paymentCodeRow.PaymentCodeDesc = mpfMCERPaymentCode.PaymentCodeDesc;
                            paymentCodeTable.Rows.Add(paymentCodeRow);
                        }
                        catch
                        {
                        }
                        try
                        {
                            DataSet.Payroll_EEOverallPayrollSummary.GrandTotalPaymentCodeDataTable paymentCodeTable = dataSet.GrandTotalPaymentCode;
                            if (paymentCodeTable.Select("PaymentCodeID=" + mpfMCERPaymentCode.PaymentCodeID.ToString()).Length <= 0)
                            {
                                DataSet.Payroll_EEOverallPayrollSummary.GrandTotalPaymentCodeRow paymentCodeRow = paymentCodeTable.NewGrandTotalPaymentCodeRow();
                                paymentCodeRow.PaymentCodeID   = mpfMCERPaymentCode.PaymentCodeID;
                                paymentCodeRow.PaymentCode     = mpfMCERPaymentCode.PaymentCode;
                                paymentCodeRow.PaymentCodeDesc = mpfMCERPaymentCode.PaymentCodeDesc;
                                paymentCodeTable.Rows.Add(paymentCodeRow);
                            }
                        }
                        catch
                        {
                        }

                        try
                        {
                            DataSet.Payroll_EEOverallPayrollSummary.PaymentCodeDataTable paymentCodeTable = dataSet.PaymentCode;
                            DataSet.Payroll_EEOverallPayrollSummary.PaymentCodeRow       paymentCodeRow   = paymentCodeTable.NewPaymentCodeRow();
                            paymentCodeRow.EmpID           = empInfo.EmpID;
                            paymentCodeRow.PaymentCodeID   = mpfVCERPaymentCode.PaymentCodeID;
                            paymentCodeRow.PaymentCode     = mpfVCERPaymentCode.PaymentCode;
                            paymentCodeRow.PaymentCodeDesc = mpfVCERPaymentCode.PaymentCodeDesc;
                            paymentCodeTable.Rows.Add(paymentCodeRow);
                        }
                        catch
                        {
                        }
                        try
                        {
                            DataSet.Payroll_EEOverallPayrollSummary.GrandTotalPaymentCodeDataTable paymentCodeTable = dataSet.GrandTotalPaymentCode;
                            if (paymentCodeTable.Select("PaymentCodeID=" + mpfVCERPaymentCode.PaymentCodeID.ToString()).Length <= 0)
                            {
                                DataSet.Payroll_EEOverallPayrollSummary.GrandTotalPaymentCodeRow paymentCodeRow = paymentCodeTable.NewGrandTotalPaymentCodeRow();
                                paymentCodeRow.PaymentCodeID   = mpfVCERPaymentCode.PaymentCodeID;
                                paymentCodeRow.PaymentCode     = mpfVCERPaymentCode.PaymentCode;
                                paymentCodeRow.PaymentCodeDesc = mpfVCERPaymentCode.PaymentCodeDesc;
                                paymentCodeTable.Rows.Add(paymentCodeRow);
                            }
                        }
                        catch
                        {
                        }
                    }
                    foreach (EORSORecord orsoRecord in orsoRecords)
                    {
                        EEmpPayroll empPayroll = new EEmpPayroll();
                        empPayroll.EmpPayrollID = orsoRecord.EmpPayrollID;
                        EEmpPayroll.db.select(dbConn, empPayroll);

                        EPayrollPeriod payrollPeriod = new EPayrollPeriod();
                        payrollPeriod.PayPeriodID = empPayroll.PayPeriodID;
                        EPayrollPeriod.db.select(dbConn, payrollPeriod);


                        DataSet.Payroll_EEOverallPayrollSummary.OverallContributionRow contributionRow = contributionTable.NewOverallContributionRow();

                        contributionRow.EmpID       = empInfo.EmpID;
                        contributionRow.PaymentCode = pFundERPaymentCode.PaymentCode;


                        for (int fieldsNo = 1; fieldsNo < 13; fieldsNo++)
                        {
                            contributionRow["Amount" + fieldsNo.ToString("00")] = 0;
                        }

                        contributionRow["Amount" + ((payrollPeriod.PayPeriodTo.Month + 12 - dtPayPeriodFr.Month) % 12 + 1).ToString("00")] = orsoRecord.ORSORecActER;

                        contributionTable.Rows.Add(contributionRow);


                        try
                        {
                            DataSet.Payroll_EEOverallPayrollSummary.PaymentCodeDataTable paymentCodeTable = dataSet.PaymentCode;
                            DataSet.Payroll_EEOverallPayrollSummary.PaymentCodeRow       paymentCodeRow   = paymentCodeTable.NewPaymentCodeRow();
                            paymentCodeRow.EmpID           = empInfo.EmpID;
                            paymentCodeRow.PaymentCodeID   = pFundERPaymentCode.PaymentCodeID;
                            paymentCodeRow.PaymentCode     = pFundERPaymentCode.PaymentCode;
                            paymentCodeRow.PaymentCodeDesc = pFundERPaymentCode.PaymentCode;
                            paymentCodeTable.Rows.Add(paymentCodeRow);
                        }
                        catch
                        {
                        }
                        try
                        {
                            DataSet.Payroll_EEOverallPayrollSummary.GrandTotalPaymentCodeDataTable paymentCodeTable = dataSet.GrandTotalPaymentCode;
                            if (paymentCodeTable.Select("PaymentCodeID=" + pFundERPaymentCode.PaymentCodeID.ToString()).Length <= 0)
                            {
                                DataSet.Payroll_EEOverallPayrollSummary.GrandTotalPaymentCodeRow paymentCodeRow = paymentCodeTable.NewGrandTotalPaymentCodeRow();
                                paymentCodeRow.PaymentCodeID   = pFundERPaymentCode.PaymentCodeID;
                                paymentCodeRow.PaymentCode     = pFundERPaymentCode.PaymentCode;
                                paymentCodeRow.PaymentCodeDesc = pFundERPaymentCode.PaymentCode;
                                paymentCodeTable.Rows.Add(paymentCodeRow);
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                if (reportDocument == null)
                {
                    reportDocument = new ReportTemplate.Report_Payroll_EEOverallPaymentSummary();
                    //reportDocument.Load(@"ReportTemplate\Report_Payroll_DiscrepancyList.rpt");
                }
                else
                {
                }



                return(base.GenerateReport());
            }
            else
            {
                return(null);
            }
        }
コード例 #19
0
        public virtual void LoadBankFileDetail(ArrayList PayrollBatchList, ArrayList EmpList)
        {
            BankFileDetails.Clear();
            m_TotalAmount = 0;

            //  Move autoPayList out of the EmpList loop for sharing bank account feature between roles
            Dictionary <EmpBankTransactionBreakDownKey, GenericBankFileDetail> autoPayList = new Dictionary <EmpBankTransactionBreakDownKey, GenericBankFileDetail>();
            List <int> PayPeriodIDList = new List <int>();

            foreach (EEmpPersonalInfo empInfo in EmpList)
            {
                Dictionary <EmpBankTransactionBreakDownKey, GenericBankFileDetail> chequePaymentList = new Dictionary <EmpBankTransactionBreakDownKey, GenericBankFileDetail>();

                DBFilter empPayrollFilter = new DBFilter();
                empPayrollFilter.add(new Match("EmpID", empInfo.EmpID));
                OR orPayrollBatch = new OR();
                foreach (EPayrollBatch payBatch in PayrollBatchList)
                {
                    orPayrollBatch.add(new Match("PayBatchID", payBatch.PayBatchID));
                }
                empPayrollFilter.add(orPayrollBatch);

                ArrayList empPayrollList = EEmpPayroll.db.select(dbConn, empPayrollFilter);

                foreach (EEmpPayroll empPayroll in empPayrollList)
                {
                    if (!PayPeriodIDList.Contains(empPayroll.PayPeriodID))
                    {
                        PayPeriodIDList.Add(empPayroll.PayPeriodID);
                    }

                    if (!m_ValueDate.Ticks.Equals(0))
                    {
                        empPayroll.EmpPayValueDate = m_ValueDate;
                    }
                    if (empPayroll.EmpPayValueDate.Ticks.Equals(0))
                    {
                        EPayrollBatch payBatch = new EPayrollBatch();
                        payBatch.PayBatchID = empPayroll.PayBatchID;
                        if (EPayrollBatch.db.select(dbConn, payBatch))
                        {
                            empPayroll.EmpPayValueDate = payBatch.PayBatchValueDate;
                        }
                    }

                    DBFilter paymentRecordFilter = new DBFilter();
                    paymentRecordFilter.add(new Match("EmpPayrollID", empPayroll.EmpPayrollID));
                    OR orPaymentMethodTerm = new OR();
                    orPaymentMethodTerm.add(new Match("PayRecMethod", "A"));
                    if (m_IsGenerateChequePayment)
                    {
                        orPaymentMethodTerm.add(new Match("PayRecMethod", "Q"));
                    }
                    paymentRecordFilter.add(orPaymentMethodTerm);

                    ArrayList paymentRecordList = EPaymentRecord.db.select(dbConn, paymentRecordFilter);
                    foreach (EPaymentRecord paymentRecord in paymentRecordList)
                    {
                        if (paymentRecord.PayRecMethod.Equals("A"))
                        {
                            EEmpBankAccount empAcc = new EEmpBankAccount();
                            empAcc.EmpBankAccountID = paymentRecord.EmpAccID;
                            if (!EEmpBankAccount.db.select(dbConn, empAcc))
                            {
                                empAcc = EEmpBankAccount.GetDefaultBankAccount(dbConn, empInfo.EmpID);
                                if (empAcc == null)
                                {
                                    EEmpPersonalInfo.db.select(dbConn, empInfo);
                                    throw new InvalidEEBankAccountException(empInfo.EmpNo, empInfo.EmpEngFullName);
                                }
                            }
                            EmpBankTransactionBreakDownKey key = new EmpBankTransactionBreakDownKey(empAcc.EmpBankAccountID, empPayroll.EmpPayValueDate);

                            GenericBankFileDetail BankFileDetail;
                            if (autoPayList.ContainsKey(key))
                            {
                                BankFileDetail = autoPayList[key];
                            }
                            else
                            {
                                BankFileDetail = CreateBankFileDetail(empAcc.EmpID);
                                BankFileDetail.EmpBankAccountHolderName = empAcc.EmpBankAccountHolderName.Trim();
                                BankFileDetail.BankCode   = empAcc.EmpBankCode;
                                BankFileDetail.BranchCode = empAcc.EmpBranchCode;
                                BankFileDetail.AccountNo  = empAcc.EmpAccountNo;
                                BankFileDetail.ValueDate  = empPayroll.EmpPayValueDate;
                                autoPayList.Add(key, BankFileDetail);
                            }
                            BankFileDetail.Amount += paymentRecord.PayRecActAmount;
                            BankFileDetail.Amount  = Math.Round(BankFileDetail.Amount, 2, MidpointRounding.AwayFromZero);
                            m_TotalAmount         += paymentRecord.PayRecActAmount;
                        }
                        else if (paymentRecord.PayRecMethod.Equals("Q") && m_IsGenerateChequePayment)
                        {
                            EmpBankTransactionBreakDownKey key = new EmpBankTransactionBreakDownKey(0, empPayroll.EmpPayValueDate);
                            GenericBankFileDetail          BankFileDetail;
                            if (chequePaymentList.ContainsKey(key))
                            {
                                BankFileDetail = chequePaymentList[key];
                            }
                            else
                            {
                                BankFileDetail                 = CreateBankFileDetail(empInfo.EmpID);
                                BankFileDetail.ValueDate       = empPayroll.EmpPayValueDate;
                                BankFileDetail.IsChequePayment = true;
                                chequePaymentList.Add(key, BankFileDetail);
                            }
                            BankFileDetail.Amount += paymentRecord.PayRecActAmount;
                            BankFileDetail.Amount  = Math.Round(BankFileDetail.Amount, 2, MidpointRounding.AwayFromZero);
                            m_TotalAmount         += paymentRecord.PayRecActAmount;
                        }
                    }
                }

                BankFileDetails.AddRange(chequePaymentList.Values);
                chequePaymentList.Clear();
            }
            BankFileDetails.AddRange(autoPayList.Values);
            autoPayList.Clear();

            List <GenericBankFileDetail> NegativeBankFileDetailList = new List <GenericBankFileDetail>();
            List <GenericBankFileDetail> zeroAmountBankFileDetails  = new List <GenericBankFileDetail>();

            foreach (GenericBankFileDetail bankFileDetail in BankFileDetails)
            {
                if (bankFileDetail != null)
                {
                    if (bankFileDetail.Amount < 0)
                    {
                        NegativeBankFileDetailList.Add(bankFileDetail);
                    }
                    else if (Math.Abs(bankFileDetail.Amount) <= 0.005)
                    {
                        zeroAmountBankFileDetails.Add(bankFileDetail);
                    }
                }
            }
            foreach (GenericBankFileDetail bankFileDetail in zeroAmountBankFileDetails)
            {
                BankFileDetails.Remove(bankFileDetail);
                ZeroBankFileDetails.Add(bankFileDetail);
            }
            foreach (int PayPeriodID in PayPeriodIDList)
            {
                EPayrollPeriod payPeriod = new EPayrollPeriod();
                payPeriod.PayPeriodID = PayPeriodID;
                if (EPayrollPeriod.db.select(dbConn, payPeriod))
                {
                    if (m_PayPeriodFr.Ticks.Equals(0) || m_PayPeriodFr > payPeriod.PayPeriodFr)
                    {
                        m_PayPeriodFr = payPeriod.PayPeriodFr;
                    }
                    if (m_PayPeriodTo.Ticks.Equals(0) || m_PayPeriodTo < payPeriod.PayPeriodTo)
                    {
                        m_PayPeriodTo = payPeriod.PayPeriodTo;
                    }
                }
            }
            if (NegativeBankFileDetailList.Count > 0)
            {
                throw new NegativeAmountException(new ArrayList(NegativeBankFileDetailList));
            }
        }
コード例 #20
0
    protected void Repeater_ItemCommand(object source, DataListCommandEventArgs e)
    {
        Button b = (Button)e.CommandSource;



        if (b.ID.Equals("Edit"))
        {
            Repeater.EditItemIndex = e.Item.ItemIndex;
            //AddPanel.Visible = false;
            view = loadData(info, db, Repeater);
            WebUtils.SetEnabledControlSection(AddPanel, false);
        }
        else if (b.ID.Equals("Cancel"))
        {
            Repeater.EditItemIndex = -1;
            //AddPanel.Visible = IsAllowEdit;
            view = loadData(info, db, Repeater);
            WebUtils.SetEnabledControlSection(AddPanel, true);
        }
        else if (b.ID.Equals("Save"))
        {
            Binding eBinding;
            eBinding = new Binding(dbConn, db);
            eBinding.add(EmpPayrollID);
            eBinding.add((HtmlInputHidden)e.Item.FindControl("ORSORecordID"));
            eBinding.add(new TextBoxBinder(db, ((WebDatePicker)e.Item.FindControl("ORSORecPeriodFr")).TextBox, "ORSORecPeriodFr"));
            eBinding.add(new TextBoxBinder(db, ((WebDatePicker)e.Item.FindControl("ORSORecPeriodTo")).TextBox, "ORSORecPeriodTo"));
            eBinding.add((TextBox)e.Item.FindControl("ORSORecActRI"));
            eBinding.add((TextBox)e.Item.FindControl("ORSORecActER"));
            eBinding.add((TextBox)e.Item.FindControl("ORSORecActEE"));
            eBinding.add(new DropDownVLBinder(db, (DropDownList)e.Item.FindControl("ORSOPlanID"), EORSOPlan.VLORSOPlan));


            eBinding.init(Request, Session);


            EORSORecord obj    = new EORSORecord();
            Hashtable   values = new Hashtable();

            PageErrors errors = PageErrors.getErrors(db, Page.Master);
            errors.clear();


            eBinding.toValues(values);
            db.validate(errors, values);

            if (!errors.isEmpty())
            {
                return;
            }

            db.parse(values, obj);

            EEmpPayroll empPayroll = new EEmpPayroll();
            empPayroll.EmpPayrollID = obj.EmpPayrollID;
            if (EEmpPayroll.db.select(dbConn, empPayroll))
            {
                EPayrollPeriod payPeriod = new EPayrollPeriod();
                payPeriod.PayPeriodID = empPayroll.PayPeriodID;

                if (EPayrollPeriod.db.select(dbConn, payPeriod))
                {
                    if (obj.ORSORecPeriodFr <= payPeriod.PayPeriodTo && obj.ORSORecPeriodTo <= payPeriod.PayPeriodTo)
                    {
                        WebUtils.StartFunction(Session, m_FunctionCode, empPayroll.EmpID);
                        db.update(dbConn, obj);
                        WebUtils.EndFunction(dbConn);
                    }
                    else
                    {
                        errors.addError(HROne.Translation.PageErrorMessage.ERROR_INVALID_PERIOD);
                        return;
                    }
                }
            }
            Repeater.EditItemIndex = -1;
            //AddPanel.Visible = IsAllowEdit;
            view = loadData(info, db, Repeater);
            WebUtils.SetEnabledControlSection(AddPanel, true);
        }
    }
コード例 #21
0
    protected void btnProcess_Click(object sender, EventArgs e)
    {
        string    strEmpIDList = string.Empty;
        ArrayList list         = new ArrayList();

        foreach (RepeaterItem i in ExistingEmployeeRepeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                BaseObject o = (BaseObject)EEmpPersonalInfo.db.createObject();
                WebFormUtils.GetKeys(EEmpPersonalInfo.db, o, cb);
                list.Add(o);
            }
        }
        foreach (RepeaterItem i in NewJoinRepeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                BaseObject o = (BaseObject)EEmpPersonalInfo.db.createObject();
                WebFormUtils.GetKeys(EEmpPersonalInfo.db, o, cb);
                list.Add(o);
            }
        }
        foreach (RepeaterItem i in FinalPaymentRepeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                BaseObject o = (BaseObject)EEmpPersonalInfo.db.createObject();
                WebFormUtils.GetKeys(EEmpPersonalInfo.db, o, cb);
                list.Add(o);
            }
        }
        if (list.Count > 0)
        {
            EPayrollPeriod payPeriod = new EPayrollPeriod();
            payPeriod.PayPeriodID           = CurID;
            payPeriod.PayPeriodStatus       = "T";
            payPeriod.PayPeriodTrialRunDate = AppUtils.ServerDateTime();
            payPeriod.PayPeriodTrialRunBy   = WebUtils.GetCurUser(Session).UserID;
            EPayrollPeriod.db.update(dbConn, payPeriod);

            Session["PayrollTrialRun_EmpList"] = list;


            //foreach (BaseObject o in list)
            //{
            //    if (strEmpIDList == string.Empty)
            //        strEmpIDList = ((EEmpPersonalInfo)o).EmpID.ToString();
            //    else
            //        strEmpIDList += "_" + ((EEmpPersonalInfo)o).EmpID.ToString();

            //}
            HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Payroll_TrialRunProcess.aspx?"
                                                                        + "PayPeriodID=" + DecryptedRequest["PayPeriodID"]
                                                                        + "&RecurringPayment=" + DecryptedRequest["RecurringPayment"]
                                                                        + "&ClaimsAndDeduction=" + DecryptedRequest["ClaimsAndDeduction"]
                                                                        + "&AdditionalRemuneration=" + DecryptedRequest["AdditionalRemuneration"]
                                                                        + "&YearEndBonus=" + DecryptedRequest["YearEndBonus"]
                                                                        // Start 0000178, Miranda, 2015-03-14
                                                                        //+ "&SkipMPFCal=" + (chkSkipMPFCal.Checked ? "1" : "0")
                                                                        + "&SkipMPFCal=" + (chkSkipMPFCal.Visible ? (chkSkipMPFCal.Checked ? "1" : "0") : "0")
                                                                        // End 0000178, Miranda, 2015-03-14
                                                                        + "&Total=" + list.Count
                                                                        //                + "&EmpID=" + strEmpIDList
                                                                        );
        }
    }
コード例 #22
0
    // Start 0000069, KuangWei, 2014-08-28
    //protected void CompanyID_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    PayGroupID.Items.Clear();
    //    initPayrollGroup();
    //    PayPeriodID.Items.Clear();
    //    PayPeriodID.Items.Add(new ListItem("Not Selected", "-1"));
    //    loadObject();
    //}
    // End 0000069, KuangWei, 2014-08-28

    protected bool loadObject()
    {
        obj            = new EPayrollGroup();
        obj.PayGroupID = CurID;
        db.select(dbConn, obj);
        //if (!db.select(dbConn, obj))
        //return false;

        Hashtable values = new Hashtable();

        db.populate(obj, values);
        binding.toControl(values);

        ListItem selectedPayPeriod = PayPeriodID.Items.FindByValue(CurPayPeriodID.ToString());

        if (selectedPayPeriod != null)
        {
            PayPeriodID.SelectedValue = selectedPayPeriod.Value;
        }
        else
        {
            CurPayPeriodID    = obj.CurrentPayPeriodID;
            selectedPayPeriod = PayPeriodID.Items.FindByValue(CurPayPeriodID.ToString());
            if (selectedPayPeriod != null)
            {
                PayPeriodID.SelectedValue = selectedPayPeriod.Value;
            }
            else
            {
                CurPayPeriodID = 0;
            }
        }

        ucPayroll_PeriodInfo.CurrentPayPeriodID = CurPayPeriodID;


        if (CurPayPeriodID > 0)
        {
            panelPayPeriod.Visible      = true;
            panelTrialRunDetail.Visible = true;
        }
        else
        {
            panelPayPeriod.Visible      = false;
            panelTrialRunDetail.Visible = false;
        }
        if (CurPayPeriodID > 0)
        {
            EPayrollPeriod payPeriod = new EPayrollPeriod();
            payPeriod.PayPeriodID = CurPayPeriodID;
            if (EPayrollPeriod.db.select(dbConn, payPeriod))
            {
                if (payPeriod.PayPeriodFr.Month.Equals(obj.PayGroupYEBStartPayrollMonth) || payPeriod.PayPeriodTo.Month.Equals(obj.PayGroupYEBStartPayrollMonth))
                {
                    cbxYearEndBonus.Visible = true;
                    cbxYearEndBonus.Checked = true;
                }
                else
                {
                    cbxYearEndBonus.Visible = false;
                    cbxYearEndBonus.Checked = false;
                }
            }
            else
            {
                cbxYearEndBonus.Visible = true;
                cbxYearEndBonus.Checked = true;
            }
        }
        return(true);
    }
コード例 #23
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, TRIALRUN_FUNCTION_CODE, WebUtils.AccessLevel.ReadWrite))
        {
            return;
        }
        if (!WebUtils.CheckAccess(Response, Session, CONFIRM_FUNCTION_CODE, WebUtils.AccessLevel.ReadWrite))
        {
            return;
        }
        if (!WebUtils.CheckAccess(Response, Session, PROCESSEND_FUNCTION_CODE, WebUtils.AccessLevel.ReadWrite))
        {
            return;
        }

        DateTime dtPayPeriodFr = new DateTime(long.Parse(DecryptedRequest["PayPeriodFr"]));
        DateTime dtPayPeriodTo = new DateTime(long.Parse(DecryptedRequest["PayPeriodTo"]));

        DateTime NextPayPeriodFr   = dtPayPeriodTo.AddDays(1);
        long     nextPayPeriodTick = 0;

        if (long.TryParse(DecryptedRequest["NextPayPeriodFr"], out nextPayPeriodTick))
        {
            NextPayPeriodFr = new DateTime(nextPayPeriodTick);
        }

        int PayBatchID = 0;

        if (!int.TryParse(DecryptedRequest["PayBatchID"], out PayBatchID))
        {
            PayBatchID = 0;
        }

        string[] payGroupStringList         = DecryptedRequest["PayGroupIDList"].Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
        int      currentSelectedPayGroupSeq = 0;

        if (!int.TryParse(DecryptedRequest["SelectedPayGroupSeq"], out currentSelectedPayGroupSeq))
        {
            currentSelectedPayGroupSeq = 0;
        }
        else
        {
            if (currentSelectedPayGroupSeq > payGroupStringList.GetUpperBound(0))
            {
                currentSelectedPayGroupSeq = 0;
                dtPayPeriodFr   = NextPayPeriodFr;
                NextPayPeriodFr = dtPayPeriodTo.AddDays(1);
                PayBatchID      = 0;
            }
        }

        bool SkipRecurringPaymentProcess       = DecryptedRequest["SkipRecurringPaymentProcess"].Equals("Yes", StringComparison.CurrentCultureIgnoreCase);
        bool SkipClaimsAndDeductionsProcess    = DecryptedRequest["SkipClaimsAndDeductionsProcess"].Equals("Yes", StringComparison.CurrentCultureIgnoreCase);
        bool SkipYearEndBonusProcess           = DecryptedRequest["SkipYearEndBonusProcess"].Equals("Yes", StringComparison.CurrentCultureIgnoreCase);
        bool SkipAdditionalRenumerationProcess = DecryptedRequest["SkipAdditionalRenumerationProcess"].Equals("Yes", StringComparison.CurrentCultureIgnoreCase);

        if (dtPayPeriodFr <= dtPayPeriodTo)
        {
            EPayrollPeriod currentPayPeriod   = null;
            int            currentPayPeriodID = 0;
            if (!int.TryParse(DecryptedRequest["PayPeriodID"], out currentPayPeriodID))
            {
                DBFilter payPeriodFilter = new DBFilter();
                payPeriodFilter.add(new Match("PayGroupID", payGroupStringList[currentSelectedPayGroupSeq]));
                payPeriodFilter.add(new Match("PayPeriodFr", "<=", dtPayPeriodFr));
                payPeriodFilter.add(new Match("PayPeriodTo", ">=", dtPayPeriodFr));
                //  Skip checking payperiodstatus since the next step will check if payroll is being processed
                //payPeriodFilter.add(new Match("PayPeriodStatus", "<>", EPayrollPeriod.PAYPERIOD_STATUS_PROCESSEND_FLAG));
                ArrayList payPeriodList = EPayrollPeriod.db.select(dbConn, payPeriodFilter);
                if (payPeriodList.Count > 0)
                {
                    currentPayPeriod   = ((EPayrollPeriod)payPeriodList[0]);
                    currentPayPeriodID = currentPayPeriod.PayPeriodID;
                    if (NextPayPeriodFr > currentPayPeriod.PayPeriodTo.AddDays(1))
                    {
                        NextPayPeriodFr = currentPayPeriod.PayPeriodTo.AddDays(1);
                    }
                }
            }
            else
            {
                currentPayPeriod = new EPayrollPeriod();
                currentPayPeriod.LoadDBObject(dbConn, currentPayPeriodID);
            }
            int intTotal;
            if (int.TryParse(DecryptedRequest["Total"], out intTotal))
            {
                intTotal = 0;
            }
            if (Session["PayrollContinuousProcess_EmpList"] == null)
            {
                DBFilter empPayrollCountFilter = new DBFilter();
                empPayrollCountFilter.add(new Match("PayPeriodID", currentPayPeriodID));

                if (EEmpPayroll.db.count(dbConn, empPayrollCountFilter) > 0)
                {
                    lblProgressMessage.Text = "Payroll has been processed manually. Please complete this payroll cycle manually.";
                    return;
                }

                EPayrollPeriod payPeriod = new EPayrollPeriod();
                payPeriod.PayPeriodID          = currentPayPeriodID;
                payPeriod.PayPeriodStatus      = "C";
                payPeriod.PayPeriodConfirmDate = AppUtils.ServerDateTime();
                payPeriod.PayPeriodConfirmBy   = WebUtils.GetCurUser(Session).UserID;
                EPayrollPeriod.db.update(dbConn, payPeriod);

                EPayrollBatch payBatch = new EPayrollBatch();
                payBatch.PayBatchConfirmDate = AppUtils.ServerDateTime();
                EPayrollBatch.db.insert(dbConn, payBatch);

                PayBatchID = payBatch.PayBatchID;


                DBFilter filter = new DBFilter();

                IN inTerm = new IN("EmpID", "Select epi.EmpID from [EmpPositionInfo] epi, [PayrollPeriod] pp ", filter);

                filter.add(new MatchField("EmpID", "epi.EmpID"));
                filter.add(new MatchField("epi.PayGroupID", "pp.PayGroupID"));
                filter.add(new MatchField("epi.EmpPosEffFr", "<=", "pp.PayPeriodTo"));
                filter.add(new Match("pp.PayPeriodID", currentPayPeriodID));
                filter.add(WebUtils.AddRankFilter(Session, "EmpID", true));

                OR orFilter = new OR();
                orFilter.add(new MatchField("epi.EmpPosEffTo", ">=", "pp.PayPeriodFr"));
                orFilter.add(new NullTerm("epi.EmpPosEffTo"));

                filter.add(orFilter);

                filter.add(new MatchField("EmpDateOfJoin", "<=", "pp.PayPeriodTo "));

                OR otherConstraint = new OR();

                OR orIncludeEmployeeTermination = new OR();

                DBFilter empTerminationFilter = new DBFilter();
                empTerminationFilter.add(new MatchField("et.EmpTermLastDate", ">=", "pp.PayPeriodFr"));
                orIncludeEmployeeTermination.add(new IN(" empid", "Select et.empid from " + EEmpTermination.db.dbclass.tableName + " et ", empTerminationFilter));

                orIncludeEmployeeTermination.add(new IN("NOT empid", "Select et.empid from " + EEmpTermination.db.dbclass.tableName + " et ", new DBFilter()));

                otherConstraint.add(orIncludeEmployeeTermination);

                //OR orIncludeBackPay = new OR();
                DBFilter empCNDFilter = new DBFilter();
                empCNDFilter.add(new MatchField("CNDEffDate", "<=", "pp.PayperiodTo"));
                empCNDFilter.add(new MatchField("CNDEffDate", ">=", "epi.EmpPosEffFr"));

                OR orCNDPos = new OR();
                orCNDPos.add(new MatchField("CNDEffDate", "<=", "epi.EmpPosEffTo"));
                orCNDPos.add(new NullTerm("epi.EmpPosEffTo"));

                empCNDFilter.add(orCNDPos);
                OR orCNDPayRecID = new OR();
                orCNDPayRecID.add(new Match("PayRecID", 0));
                orCNDPayRecID.add(new NullTerm("PayRecID"));
                empCNDFilter.add(orCNDPayRecID);
                otherConstraint.add(new IN(" empid", "Select cnd.empid from " + EClaimsAndDeductions.db.dbclass.tableName + " cnd ", empCNDFilter));
                //otherConstraint.add(orIncludeBackPay);

                filter.add(otherConstraint);

                DBFilter resultFilter = new DBFilter();
                resultFilter.add(inTerm);
                ArrayList empList = EEmpPersonalInfo.db.select(dbConn, resultFilter);
                Session["PayrollContinuousProcess_EmpList"] = empList;
                intTotal = empList.Count;
            }


            ArrayList list = (ArrayList)Session["PayrollContinuousProcess_EmpList"];
            if (list.Count > 0)
            {
                //string[] strEmpIDListArray;
                //int intProgress = 0;

                //strEmpIDListArray = strEmpIDList.Split(new char[] { '_' });

                //intProgress = 0;
                DateTime dtStartTime = AppUtils.ServerDateTime();
                int      UserID      = WebUtils.GetCurUser(Session).UserID;

                HROne.Payroll.PayrollProcess payrollProcess = new HROne.Payroll.PayrollProcess(dbConn);

                while (AppUtils.ServerDateTime().Subtract(dtStartTime).Seconds < 30 && list.Count > 0)
                {
                    EEmpPersonalInfo empInfo = (EEmpPersonalInfo)list[0];

                    //int intEmpID;
                    //if (int.TryParse(strEmpIDListArray[intProgress], out intEmpID))
                    //{
                    DBFilter filter = new DBFilter();
                    filter.add(new Match("EmpID", empInfo.EmpID));
                    filter.add(WebUtils.AddRankFilter(new Page().Session, "EmpID", true));
                    if (EEmpPersonalInfo.db.count(dbConn, filter) > 0)
                    {
                        bool ActualRecurringPaymentProcess = !SkipRecurringPaymentProcess;
                        bool ActualYearEndBonusProcess     = !SkipYearEndBonusProcess;

                        EEmpTermination empTerm = EEmpTermination.GetObjectByEmpID(dbConn, empInfo.EmpID);
                        if (empTerm != null)
                        {
                            if (empTerm.EmpTermLastDate < dtPayPeriodFr)
                            {
                                ActualRecurringPaymentProcess = false;
                                ActualYearEndBonusProcess     = false;
                            }
                        }
                        WebUtils.StartFunction(Session, CONFIRM_FUNCTION_CODE, empInfo.EmpID, false);
                        payrollProcess.PayrollConfirm(payrollProcess.PayrollTrialRun(currentPayPeriodID, empInfo.EmpID, ActualRecurringPaymentProcess, !SkipClaimsAndDeductionsProcess, !SkipAdditionalRenumerationProcess, ActualYearEndBonusProcess, false, UserID), PayBatchID, UserID);
                        WebUtils.EndFunction(dbConn);
                    }
                    //}
                    //intProgress++;
                    //if (intProgress == strEmpIDListArray.GetLength(0))
                    //    break;
                    list.Remove(empInfo);
                }
            }
            lblProgress.Text = (intTotal - list.Count).ToString() + " of " + intTotal.ToString();
            if (list.Count == 0)
            {
                Session.Remove("PayrollContinuousProcess_EmpList");

                EPayrollPeriod payPeriod = new EPayrollPeriod();
                payPeriod.PayPeriodID = currentPayPeriodID;
                EPayrollPeriod.db.select(dbConn, payPeriod);
                HROne.Payroll.PayrollProcess payrollProcess = new HROne.Payroll.PayrollProcess(dbConn);
                WebUtils.StartFunction(Session, PROCESSEND_FUNCTION_CODE, false);
                payrollProcess.PayrollProcessEnd(payPeriod.PayPeriodID, WebUtils.GetCurUser(Session).UserID);
                payrollProcess.GenerateNextPayrollPeriod(payPeriod.PayGroupID);
                WebUtils.EndFunction(dbConn);

                currentSelectedPayGroupSeq++;
                string url = Request.Url.AbsolutePath + "?PayGroupIDList=" + string.Join("|", payGroupStringList)
                             + "&PayPeriodFr=" + dtPayPeriodFr.Ticks
                             + "&PayPeriodTo=" + dtPayPeriodTo.Ticks
                             + "&NextPayPeriodFr=" + NextPayPeriodFr.Ticks
                             + "&SelectedPayGroupSeq=" + currentSelectedPayGroupSeq
                             + "&SkipRecurringPaymentProcess=" + (SkipRecurringPaymentProcess ? "Yes" : "No")
                             + "&SkipClaimsAndDeductionsProcess=" + (SkipClaimsAndDeductionsProcess ? "Yes" : "No")
                             + "&SkipYearEndBonusProcess=" + (SkipYearEndBonusProcess ? "Yes" : "No")
                             + "&SkipAdditionalRenumerationProcess=" + (SkipAdditionalRenumerationProcess ? "Yes" : "No")
                ;
                WebUtils.RegisterRedirectJavaScript(this, url, 500);
                //payPeriod = HROne.Payroll.PayrollProcess.GenerateNextPayrollPeriod(payPeriod.PayGroupID);

                //noOfCycleLeft--;

                //if (noOfCycleLeft > 0)
                //{
                //    if (payPeriod != null)
                //    {
                //        Response.Write(@"<script language='javascript'>");
                //        Response.Write(@"setTimeout('Redirect()',500);");
                //        Response.Write(@"function Redirect()");
                //        Response.Write(@"{");
                //        Response.Write(@"window.location = 'Payroll_ProcessContinuous_Process.aspx?"
                //            + "PayPeriodID=" + payPeriod.PayPeriodID
                //            + "&PayBatchID=" + 0
                //            + "&NoOfCycleLeft=" + noOfCycleLeft
                //            + "&Total=" + 0
                //            //+ "&EmpID=" + strRemainder
                //            + "';");
                //        Response.Write(@"}");
                //        Response.Write(@"</script>");
                //    }
                //}
            }
            else
            {
                string url = Request.Url.AbsolutePath + "?PayGroupIDList=" + string.Join("|", payGroupStringList)
                             + "&PayPeriodFr=" + dtPayPeriodFr.Ticks
                             + "&PayPeriodTo=" + dtPayPeriodTo.Ticks
                             + "&PayPeriodID=" + currentPayPeriodID
                             + "&PayBatchID=" + PayBatchID
                             + "&Total=" + intTotal
                             + "&NextPayPeriodFr=" + NextPayPeriodFr.Ticks
                             + "&SelectedPayGroupSeq=" + currentSelectedPayGroupSeq
                             + "&SkipRecurringPaymentProcess=" + (SkipRecurringPaymentProcess ? "Yes" : "No")
                             + "&SkipClaimsAndDeductionsProcess=" + (SkipClaimsAndDeductionsProcess ? "Yes" : "No")
                             + "&SkipYearEndBonusProcess=" + (SkipYearEndBonusProcess ? "Yes" : "No")
                             + "&SkipAdditionalRenumerationProcess=" + (SkipAdditionalRenumerationProcess ? "Yes" : "No")
                ;
                WebUtils.RegisterRedirectJavaScript(this, url, 500);
            }

            EPayrollGroup payGroup = new EPayrollGroup();
            payGroup.LoadDBObject(dbConn, currentPayPeriod.PayGroupID);
            lblProgressMessage.Text = "Payroll process is in progress (" + payGroup.PayGroupCode + ":" + currentPayPeriod.PayPeriodFr.ToString("yyyy-MM-dd") + " To " + currentPayPeriod.PayPeriodTo.ToString("yyyy-MM-dd") + ")";
        }
        else
        {
            lblProgressMessage.Text = "Payroll process is completed";
        }
        HROne.Common.WebUtility.WebControlsLocalization(this, this.Controls);
    }
コード例 #24
0
        public void TrialRun(int EmpPayrollID, EUser user)
        {
            EEmpPayroll empPayroll = new EEmpPayroll();

            empPayroll.EmpPayrollID = EmpPayrollID;
            if (EEmpPayroll.db.select(dbConn, empPayroll))
            {
                EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
                empInfo.EmpID = empPayroll.EmpID;
                if (EEmpPersonalInfo.db.select(dbConn, empInfo))
                {
                    EPayrollPeriod payPeriod = new EPayrollPeriod();
                    payPeriod.PayPeriodID = empPayroll.PayPeriodID;
                    if (EPayrollPeriod.db.select(dbConn, payPeriod))
                    {
                        DateTime startDate = payPeriod.PayPeriodFr;
                        DateTime endDate   = payPeriod.PayPeriodTo;

                        if (empInfo.EmpDateOfJoin > payPeriod.PayPeriodFr && empInfo.EmpDateOfJoin < payPeriod.PayPeriodTo)
                        {
                            startDate = empInfo.EmpDateOfJoin;
                        }

                        DBFilter empTerminationFilter = new DBFilter();
                        empTerminationFilter.add(new Match("EmpID", empPayroll.EmpID));
                        ArrayList empTerminationList = EEmpTermination.db.select(dbConn, empTerminationFilter);
                        foreach (EEmpTermination empTerm in empTerminationList)
                        {
                            if (empTerm.EmpTermLastDate > payPeriod.PayPeriodFr && empTerm.EmpTermLastDate < payPeriod.PayPeriodTo)
                            {
                                endDate = empTerm.EmpTermLastDate;
                            }
                        }

                        DBFilter empPosFilter = new DBFilter();
                        empPosFilter.add(new Match("EmpID", empPayroll.EmpID));
                        empPosFilter.add(new Match("EmpPosEffFr", "<=", payPeriod.PayPeriodTo));
                        OR orEmpPosEffToTerms = new OR();
                        orEmpPosEffToTerms.add(new Match("EmpPosEffTo", ">=", payPeriod.PayPeriodFr));
                        orEmpPosEffToTerms.add(new NullTerm("EmpPosEffTo"));
                        empPosFilter.add(orEmpPosEffToTerms);
                        empPosFilter.add(new Match("PayGroupID", payPeriod.PayGroupID));

                        ArrayList empPosList = EEmpPositionInfo.db.select(dbConn, empPosFilter);

                        DBFilter empCostCenterFilter = new DBFilter();
                        empCostCenterFilter.add(new Match("EmpID", empPayroll.EmpID));
                        empCostCenterFilter.add(new Match("EmpCostCenterEffFr", "<=", payPeriod.PayPeriodTo));
                        OR orEmpCostCenterEffToTerms = new OR();
                        orEmpCostCenterEffToTerms.add(new Match("EmpCostCenterEffTo", ">=", payPeriod.PayPeriodFr));
                        orEmpCostCenterEffToTerms.add(new NullTerm("EmpCostCenterEffTo"));
                        empCostCenterFilter.add(orEmpCostCenterEffToTerms);

                        ArrayList empCostCenterList = EEmpCostCenter.db.select(dbConn, empCostCenterFilter);



                        ArrayList costAllocationDetailList          = new ArrayList();
                        ArrayList costAllocationDetailHierarchyLIst = new ArrayList();

                        DBFilter paymentRecordFilter = new DBFilter();
                        paymentRecordFilter.add(new Match("EmpPayrollID", EmpPayrollID));

                        ArrayList paymentRecordList = EPaymentRecord.db.select(dbConn, paymentRecordFilter);

                        if (empCostCenterList.Count == 0 && paymentRecordList.Count > 0)
                        {
                            errorLogBuiler.AppendLine(
                                string.Format(
                                    HROne.Common.WebUtility.GetLocalizedStringByCode(MESSAGE_COST_CENTER_NOT_FOUND, "Cost Center for Employee ({0}) has not been set.")
                                    , new string[] { empInfo.EmpNo })
                                );
                            return;
                        }

                        foreach (EPaymentRecord paymentRecord in paymentRecordList)
                        {
                            try
                            {
                                costAllocationDetailList.AddRange(CreateCostAllocationRecordList(startDate, endDate, empPosList, empCostCenterList, paymentRecord.PaymentCodeID, paymentRecord.PayRecActAmount, paymentRecord.PayRecID, false, paymentRecord.CostCenterID));
                            }
                            catch (Exception e)
                            {
                                errorLogBuiler.AppendLine(
                                    string.Format(
                                        e.Message
                                        , new string[] { empInfo.EmpNo })
                                    );
                            }
                            //ArrayList costAllocationDetailListByPaymentRecord = new ArrayList();
                            //int daysTotal = 0;
                            //foreach (EEmpPositionInfo empPos in empPosList)
                            //{
                            //    DateTime posStartDate = startDate;
                            //    DateTime posEndDate = endDate;

                            //    if (empPos.EmpPosEffFr > posStartDate)
                            //        posStartDate = empPos.EmpPosEffFr;

                            //    if (empPos.EmpPosEffTo < posEndDate && empPos.EmpPosEffTo > posStartDate)
                            //        posEndDate = empPos.EmpPosEffTo;

                            //    DBFilter empHierarchyElementFilter = new DBFilter();
                            //    empHierarchyElementFilter.add(new Match("EmpPosID", empPos.EmpPosID));
                            //    ArrayList empHiererchyElementList = EEmpHierarchy.db.select(dbConn, empHierarchyElementFilter);

                            //    double percentagePaymentTotal = 0;

                            //    foreach (EEmpCostCenter empCostCenter in empCostCenterList)
                            //    {
                            //        DateTime costStartDate = posStartDate;
                            //        DateTime costEndDate = posEndDate;

                            //        if (empCostCenter.EmpCostCenterEffFr > costStartDate)
                            //            costStartDate = empCostCenter.EmpCostCenterEffFr;

                            //        if (empCostCenter.EmpCostCenterEffTo < costEndDate && empCostCenter.EmpCostCenterEffTo > costStartDate)
                            //            costEndDate = empCostCenter.EmpCostCenterEffTo;

                            //        if (costStartDate > costEndDate)
                            //            continue;

                            //        int numOfDays = ((TimeSpan)costEndDate.Subtract(costStartDate)).Days;
                            //        daysTotal += numOfDays;

                            //        DBFilter empCostCenterDetailFilter = new DBFilter();
                            //        empCostCenterDetailFilter.add(new Match("EmpCostCenterID", empCostCenter.EmpCostCenterID));
                            //        ArrayList empCostCenterDetailList = EEmpCostCenterDetail.db.select(dbConn, empCostCenterDetailFilter);

                            //        double percentageCostCenterTotal = 0;
                            //        foreach (EEmpCostCenterDetail empCostCenterDetail in empCostCenterDetailList)
                            //        {

                            //            ECostAllocationDetail costAllocDetail = new ECostAllocationDetail();
                            //            costAllocDetail.CostCenterID = empCostCenterDetail.CostCenterID;
                            //            costAllocDetail.CostAllocationDetailRoundCalAmount = paymentRecord.PayRecActAmount * daysTotal * empCostCenterDetail.EmpCostCenterPercentage;
                            //            costAllocDetail.PaymentCodeID = paymentRecord.PaymentCodeID;
                            //            costAllocDetail.PayRecID = paymentRecord.PayRecID;
                            //            costAllocDetail.CompanyID = empPos.CompanyID;
                            //            costAllocationDetailListByPaymentRecord.Add(costAllocDetail);

                            //            foreach (EEmpHierarchy empHierarchy in empHiererchyElementList)
                            //            {
                            //                ECostAllocationDetailHElement costAllocHierarchy = new ECostAllocationDetailHElement();
                            //                costAllocHierarchy.HElementID = empHierarchy.HElementID;
                            //                costAllocHierarchy.HLevelID = empHierarchy.HLevelID;
                            //                costAllocHierarchy.RelatedCostAllocationDetailObject = costAllocDetail;
                            //                costAllocationDetailHierarchyLIst.Add(costAllocHierarchy);
                            //            }

                            //            percentageCostCenterTotal += empCostCenterDetail.EmpCostCenterPercentage;


                            //        }

                            //        if (Math.Round(Math.Abs(percentageCostCenterTotal - 100), 2, MidpointRounding.AwayFromZero) > 0)
                            //        {
                            //            errorLogBuiler.AppendLine(
                            //                string.Format(
                            //                HROne.Common.WebUtility.GetLocalizedStringByCode(MESSAGE_NOT_100_PERCENTAGE, "Total Percentage of Employee ({0}) is not 100%.")
                            //                , new string[] { empInfo.EmpNo })
                            //            );
                            //        }
                            //    }

                            //}

                            ////SortedList sortedCostAllocationDetailbyDecimalPlaceRoundDown = new SortedList();
                            ////SortedList sortedCostAllocationDetailbyDecimalPlaceRoundUp = new SortedList();

                            //double totalCostAllocPayment = 0;
                            //foreach (ECostAllocationDetail costAllocationDetail in costAllocationDetailListByPaymentRecord)
                            //{
                            //    costAllocationDetail.CostAllocationDetailRoundCalAmount = costAllocationDetail.CostAllocationDetailRoundCalAmount / (100 * daysTotal);
                            //    costAllocationDetail.CostAllocationDetailAmount = Math.Round(costAllocationDetail.CostAllocationDetailRoundCalAmount, 2, MidpointRounding.AwayFromZero);
                            //    totalCostAllocPayment += costAllocationDetail.CostAllocationDetailAmount;

                            //    //sortedCostAllocationDetailbyDecimalPlaceRoundDown.Add(costAllocationDetail.CostAllocationDetailAmount - originalCostAllocationAmount, costAllocationDetail.CostAllocationDetailAmount);
                            //    //sortedCostAllocationDetailbyDecimalPlaceRoundUp.Add(originalCostAllocationAmount - costAllocationDetail.CostAllocationDetailAmount, costAllocationDetail.CostAllocationDetailAmount);

                            //}
                            //double diff = Math.Round(paymentRecord.PayRecActAmount - totalCostAllocPayment, 2, MidpointRounding.AwayFromZero);
                            //if (Math.Abs(diff) >= 0.01 && costAllocationDetailListByPaymentRecord.Count>0)
                            //{
                            //    if (diff > 0)
                            //    {
                            //        while (Math.Abs(diff) >= 0.01)
                            //        {
                            //            ECostAllocationDetail minCostAllocationDetail = null;
                            //            double minDiff = 1;
                            //            foreach (ECostAllocationDetail costAllocationDetail in costAllocationDetailListByPaymentRecord)
                            //            {
                            //                double costAllocDiff= costAllocationDetail.CostAllocationDetailAmount -costAllocationDetail.CostAllocationDetailRoundCalAmount;
                            //                if (costAllocDiff < minDiff)
                            //                {
                            //                    minDiff = costAllocDiff;
                            //                    minCostAllocationDetail = costAllocationDetail;
                            //                }
                            //            }
                            //            if (minCostAllocationDetail != null)
                            //            {
                            //                minCostAllocationDetail.CostAllocationDetailAmount += 0.01;
                            //                diff -= 0.01;
                            //            }
                            //        }
                            //    }
                            //    else
                            //    {
                            //        while (Math.Abs(diff) >= 0.01)
                            //        {
                            //            ECostAllocationDetail maxCostAllocationDetail = null;
                            //            double maxDiff = 1;
                            //            foreach (ECostAllocationDetail costAllocationDetail in costAllocationDetailListByPaymentRecord)
                            //            {
                            //                double costAllocDiff = costAllocationDetail.CostAllocationDetailAmount - costAllocationDetail.CostAllocationDetailRoundCalAmount;
                            //                if (costAllocDiff > maxDiff)
                            //                {
                            //                    maxDiff = costAllocDiff;
                            //                    maxCostAllocationDetail = costAllocationDetail;
                            //                }
                            //            }
                            //            if (maxCostAllocationDetail != null)
                            //            {
                            //                maxCostAllocationDetail.CostAllocationDetailAmount -= 0.01;
                            //                diff += 0.01;
                            //            }
                            //        }
                            //    }
                            //}
                            //costAllocationDetailList.AddRange(costAllocationDetailListByPaymentRecord);
                        }

                        ArrayList mpfRecordList = EMPFRecord.db.select(dbConn, paymentRecordFilter);

                        foreach (EMPFRecord mpfRecord in mpfRecordList)
                        {
                            try
                            {
                                ArrayList paymentList = PayrollProcess.GetPaymentCodeByPaymentType(dbConn, EPaymentType.SystemPaymentType.MPFEmployeeMandatoryContributionPaymentType(dbConn).PaymentTypeCode);
                                if (paymentList.Count > 0)
                                {
                                    costAllocationDetailList.AddRange(CreateCostAllocationRecordList(startDate, endDate, empPosList, empCostCenterList, ((EPaymentCode)paymentList[0]).PaymentCodeID, mpfRecord.MPFRecActMCEE, mpfRecord.MPFRecordID, true));
                                }
                                paymentList = PayrollProcess.GetPaymentCodeByPaymentType(dbConn, EPaymentType.SystemPaymentType.MPFEmployerMandatoryContributionPaymentType(dbConn).PaymentTypeCode);
                                if (paymentList.Count > 0)
                                {
                                    costAllocationDetailList.AddRange(CreateCostAllocationRecordList(startDate, endDate, empPosList, empCostCenterList, ((EPaymentCode)paymentList[0]).PaymentCodeID, mpfRecord.MPFRecActMCER, mpfRecord.MPFRecordID, true));
                                }
                                paymentList = PayrollProcess.GetPaymentCodeByPaymentType(dbConn, EPaymentType.SystemPaymentType.MPFEmployeeVoluntaryContributionPaymentType(dbConn).PaymentTypeCode);
                                if (paymentList.Count > 0)
                                {
                                    costAllocationDetailList.AddRange(CreateCostAllocationRecordList(startDate, endDate, empPosList, empCostCenterList, ((EPaymentCode)paymentList[0]).PaymentCodeID, mpfRecord.MPFRecActVCEE, mpfRecord.MPFRecordID, true));
                                }
                                paymentList = PayrollProcess.GetPaymentCodeByPaymentType(dbConn, EPaymentType.SystemPaymentType.MPFEmployerVoluntaryContributionPaymentType(dbConn).PaymentTypeCode);
                                if (paymentList.Count > 0)
                                {
                                    costAllocationDetailList.AddRange(CreateCostAllocationRecordList(startDate, endDate, empPosList, empCostCenterList, ((EPaymentCode)paymentList[0]).PaymentCodeID, mpfRecord.MPFRecActVCER, mpfRecord.MPFRecordID, true));
                                }
                            }
                            catch (Exception e)
                            {
                                errorLogBuiler.AppendLine(
                                    string.Format(
                                        e.Message
                                        , new string[] { empInfo.EmpNo })
                                    );
                            }
                        }

                        ArrayList orsoRecordList = EORSORecord.db.select(dbConn, paymentRecordFilter);

                        foreach (EORSORecord orsoRecord in orsoRecordList)
                        {
                            try
                            {
                                ArrayList paymentList = PayrollProcess.GetPaymentCodeByPaymentType(dbConn, EPaymentType.SystemPaymentType.PFundEmployeeContributionPaymentType(dbConn).PaymentTypeCode);
                                if (paymentList.Count > 0)
                                {
                                    costAllocationDetailList.AddRange(CreateCostAllocationRecordList(startDate, endDate, empPosList, empCostCenterList, ((EPaymentCode)paymentList[0]).PaymentCodeID, orsoRecord.ORSORecActEE, orsoRecord.ORSORecordID, true));
                                }
                                paymentList = PayrollProcess.GetPaymentCodeByPaymentType(dbConn, EPaymentType.SystemPaymentType.PFundEmployerContributionPaymentType(dbConn).PaymentTypeCode);
                                if (paymentList.Count > 0)
                                {
                                    costAllocationDetailList.AddRange(CreateCostAllocationRecordList(startDate, endDate, empPosList, empCostCenterList, ((EPaymentCode)paymentList[0]).PaymentCodeID, orsoRecord.ORSORecActER, orsoRecord.ORSORecordID, true));
                                }
                            }
                            catch (Exception e)
                            {
                                errorLogBuiler.AppendLine(
                                    string.Format(
                                        e.Message
                                        , new string[] { empInfo.EmpNo })
                                    );
                            }
                        }

                        ECostAllocation costAllocation = new ECostAllocation();
                        costAllocation.EmpID = empInfo.EmpID;
                        costAllocation.CostAllocationStatus       = "T";
                        costAllocation.CostAllocationTrialRunDate = AppUtils.ServerDateTime();
                        costAllocation.CostAllocationTrialRunBy   = user.UserID;
                        costAllocation.EmpPayrollID = EmpPayrollID;
                        ECostAllocation.db.insert(dbConn, costAllocation);
                        foreach (ECostAllocationDetail costAllocationDetail in costAllocationDetailList)
                        {
                            costAllocationDetail.CostAllocationID = costAllocation.CostAllocationID;
                            ECostAllocationDetail.db.insert(dbConn, costAllocationDetail);
                            foreach (ECostAllocationDetailHElement costAllocationDetailHierarchy in costAllocationDetail.HierarchyElementList)
                            {
                                costAllocationDetailHierarchy.CostAllocationDetailID = costAllocationDetail.CostAllocationDetailID;
                                ECostAllocationDetailHElement.db.insert(dbConn, costAllocationDetailHierarchy);
                            }
                        }
                    }
                }
            }
        }
コード例 #25
0
        public override CrystalDecisions.CrystalReports.Engine.ReportDocument GenerateReport()
        {
            if (EmpPayrollList != null)
            {
                DataSet.PayrollTrialRunSummaryDataSet dataSet = new DataSet.PayrollTrialRunSummaryDataSet();
                DataSet.PayrollTrialRunSummaryDataSet.TrialRunSummaryDataTable dataTable = dataSet.TrialRunSummary;

                foreach (EEmpPayroll empPayroll in EmpPayrollList)
                {
                    EEmpPayroll.db.select(dbConn, empPayroll);

                    EPayrollPeriod payPeriod = new EPayrollPeriod();
                    payPeriod.PayPeriodID = empPayroll.PayPeriodID;
                    EPayrollPeriod.db.select(dbConn, payPeriod);

                    string strPayPeriod = payPeriod.PayPeriodFr.ToString("yyyy-MM-dd") + " - " + payPeriod.PayPeriodTo.ToString("yyyy-MM-dd");

                    EPayrollGroup payGroup = new EPayrollGroup();
                    payGroup.PayGroupID = payPeriod.PayGroupID;
                    EPayrollGroup.db.select(dbConn, payGroup);

                    EPayrollBatch payBatch = new EPayrollBatch();
                    payBatch.PayBatchID = empPayroll.PayBatchID;
                    EPayrollBatch.db.select(dbConn, payBatch);

                    EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
                    empInfo.EmpID = empPayroll.EmpID;
                    EEmpPersonalInfo.db.select(dbConn, empInfo);


                    DataSet.PayrollTrialRunSummaryDataSet.TrialRunSummaryRow row = dataTable.NewTrialRunSummaryRow();
                    row.EmpPayrollID  = empPayroll.EmpPayrollID;
                    row.EmpID         = empPayroll.EmpID;
                    row.EmpNo         = empInfo.EmpNo;
                    row.EmpName       = empInfo.EmpEngFullName;
                    row.EmpAlias      = empInfo.EmpAlias;
                    row.PayGroupDesc  = payGroup.PayGroupCode + " - " + payGroup.PayGroupDesc;
                    row.PayGroupID    = empPayroll.PayPeriodID;
                    row.PayrollPeriod = strPayPeriod;
                    if (!payBatch.PayBatchValueDate.Ticks.Equals(0))
                    {
                        row.PayBatchValueDate = payBatch.PayBatchValueDate;
                    }
                    row.PayBatchRemark   = payBatch.PayBatchRemark;
                    row.BasicSalary      = 0;
                    row.LeaveAllowance   = 0;
                    row.PFundEE          = 0;
                    row.PFundER          = 0;
                    row.Overtime         = 0;
                    row.Bonus            = 0;
                    row.Commission       = 0;
                    row.Others           = 0;
                    row.NetIncome        = 0;
                    row.TotalIncome      = 0;
                    row.PayMethodAutoPay = 0;
                    row.PayMethodCash    = 0;
                    row.PayMethodCheque  = 0;
                    row.PayMethodOthers  = 0;

                    AND recurringBasicSalaryAndTerms = new AND();
                    recurringBasicSalaryAndTerms.add(new Match("EmpRPEffFr", "<=", payPeriod.PayPeriodTo));

                    DBFilter basicSalaryPaymentCodeFilter = new DBFilter();
                    basicSalaryPaymentCodeFilter.add(new Match("PaymentTypeID", EPaymentType.SystemPaymentType.BasicSalaryPaymentType(dbConn).PaymentTypeID));
                    recurringBasicSalaryAndTerms.add(new IN("PayCodeID", "Select PaymentCodeID FROM " + EPaymentCode.db.dbclass.tableName, basicSalaryPaymentCodeFilter));
                    EEmpRecurringPayment empRP = (EEmpRecurringPayment)AppUtils.GetLastObj(dbConn, EEmpRecurringPayment.db, "EmpRPEffFr", empPayroll.EmpID, recurringBasicSalaryAndTerms);
                    if (empRP != null)
                    {
                        row.RecurringBasicSalary = empRP.EmpRPAmount;
                    }

                    DBFilter paymentRecordFilter = new DBFilter();
                    paymentRecordFilter.add(new Match("EmpPayrollID", empPayroll.EmpPayrollID));
                    paymentRecordFilter.add(new Match("PayRecStatus", "A"));
                    ArrayList paymentRecords = EPaymentRecord.db.select(dbConn, paymentRecordFilter);
                    foreach (EPaymentRecord paymentRecord in paymentRecords)
                    {
                        EPaymentCode payCode = new EPaymentCode();
                        payCode.PaymentCodeID = paymentRecord.PaymentCodeID;
                        EPaymentCode.db.select(dbConn, payCode);

                        EPaymentType payType = new EPaymentType();
                        payType.PaymentTypeID = payCode.PaymentTypeID;
                        EPaymentType.db.select(dbConn, payType);

                        if (payType.PaymentTypeCode.Equals(EPaymentType.SystemPaymentType.BasicSalaryPaymentType(dbConn).PaymentTypeCode, StringComparison.CurrentCultureIgnoreCase))
                        {
                            row.BasicSalary += paymentRecord.PayRecActAmount;
                            row.TotalIncome += paymentRecord.PayRecActAmount;
                        }
                        else if (payType.PaymentTypeCode.Equals(EPaymentType.SystemPaymentType.LeaveDeductionPaymentType(dbConn).PaymentTypeCode, StringComparison.CurrentCultureIgnoreCase))
                        {
                            row.LeaveAllowance += paymentRecord.PayRecActAmount;
                            row.TotalIncome    += paymentRecord.PayRecActAmount;
                        }
                        else if (payType.PaymentTypeCode.Equals(EPaymentType.SystemPaymentType.LeaveAllowancePaymentType(dbConn).PaymentTypeCode, StringComparison.CurrentCultureIgnoreCase))
                        {
                            row.LeaveAllowance += paymentRecord.PayRecActAmount;
                            row.TotalIncome    += paymentRecord.PayRecActAmount;
                        }
                        else if (payType.PaymentTypeCode.Equals(EPaymentType.SystemPaymentType.MPFEmployeeMandatoryContributionPaymentType(dbConn).PaymentTypeCode, StringComparison.CurrentCultureIgnoreCase))
                        {
                            row.PFundEE += paymentRecord.PayRecActAmount;
                        }
                        else if (payType.PaymentTypeCode.Equals(EPaymentType.SystemPaymentType.MPFEmployeeVoluntaryContributionPaymentType(dbConn).PaymentTypeCode, StringComparison.CurrentCultureIgnoreCase))
                        {
                            row.PFundEE += paymentRecord.PayRecActAmount;
                        }
                        else if (payType.PaymentTypeCode.Equals(EPaymentType.SystemPaymentType.PFundEmployeeContributionPaymentType(dbConn).PaymentTypeCode, StringComparison.CurrentCultureIgnoreCase))
                        {
                            row.PFundEE += paymentRecord.PayRecActAmount;
                        }
                        else if (payType.PaymentTypeCode.Equals(EPaymentType.SystemPaymentType.MPFEmployerMandatoryContributionPaymentType(dbConn).PaymentTypeCode, StringComparison.CurrentCultureIgnoreCase))
                        {
                            row.PFundER += paymentRecord.PayRecActAmount;
                        }
                        else if (payType.PaymentTypeCode.Equals(EPaymentType.SystemPaymentType.MPFEmployerVoluntaryContributionPaymentType(dbConn).PaymentTypeCode, StringComparison.CurrentCultureIgnoreCase))
                        {
                            row.PFundER += paymentRecord.PayRecActAmount;
                        }
                        else if (payType.PaymentTypeCode.Equals(EPaymentType.SystemPaymentType.PFundEmployerContributionPaymentType(dbConn).PaymentTypeCode, StringComparison.CurrentCultureIgnoreCase))
                        {
                            row.PFundER += paymentRecord.PayRecActAmount;
                        }
                        else if (payType.PaymentTypeCode.Equals(EPaymentType.SystemPaymentType.OverTimePaymentType(dbConn).PaymentTypeCode, StringComparison.CurrentCultureIgnoreCase))
                        {
                            row.Overtime    += paymentRecord.PayRecActAmount;
                            row.TotalIncome += paymentRecord.PayRecActAmount;
                        }
                        else if (payType.PaymentTypeCode.Equals(EPaymentType.SystemPaymentType.BonusPaymentType(dbConn).PaymentTypeCode, StringComparison.CurrentCultureIgnoreCase))
                        {
                            row.Bonus       += paymentRecord.PayRecActAmount;
                            row.TotalIncome += paymentRecord.PayRecActAmount;
                        }
                        else if (payType.PaymentTypeCode.Equals(EPaymentType.SystemPaymentType.CommissionPaymentType(dbConn).PaymentTypeCode, StringComparison.CurrentCultureIgnoreCase))
                        {
                            row.Commission  += paymentRecord.PayRecActAmount;
                            row.TotalIncome += paymentRecord.PayRecActAmount;
                        }
                        else
                        {
                            row.Others      += paymentRecord.PayRecActAmount;
                            row.TotalIncome += paymentRecord.PayRecActAmount;
                        }
                        if (paymentRecord.PayRecMethod.Equals("A"))
                        {
                            row.PayMethodAutoPay += paymentRecord.PayRecActAmount;
                        }
                        else if (paymentRecord.PayRecMethod.Equals("C"))
                        {
                            row.PayMethodCash += paymentRecord.PayRecActAmount;
                        }
                        else if (paymentRecord.PayRecMethod.Equals("Q"))
                        {
                            row.PayMethodCheque += paymentRecord.PayRecActAmount;
                        }
                        else
                        {
                            row.PayMethodOthers += paymentRecord.PayRecActAmount;
                        }

                        row.NetIncome += paymentRecord.PayRecActAmount;
                    }
                    row.TotalWagesForMinWages = HROne.Payroll.PayrollProcess.GetTotalWagesWithoutRestDayPayment(dbConn, empInfo.EmpID, payPeriod.PayPeriodFr, payPeriod.PayPeriodTo, null);
                    row.TotalWorkingHours     = HROne.Payroll.PayrollProcess.GetTotalEmpPayrollWorkingHours(dbConn, empInfo.EmpID, payPeriod.PayPeriodID);
                    row.MinWagesRequired      = row.TotalWorkingHours * HROne.Payroll.PayrollProcess.GetMinimumWages(dbConn, empInfo.EmpID, payPeriod.PayPeriodTo);
                    DBFilter mpfRecordFilter = new DBFilter();
                    mpfRecordFilter.add(new Match("EmpPayrollID", empPayroll.EmpPayrollID));
                    ArrayList mpfRecords = EMPFRecord.db.select(dbConn, mpfRecordFilter);
                    foreach (EMPFRecord mpfRecord in mpfRecords)
                    {
                        row.PFundER += mpfRecord.MPFRecActVCER + mpfRecord.MPFRecActMCER;
                    }
                    ArrayList orsoRecords = EORSORecord.db.select(dbConn, mpfRecordFilter);
                    foreach (EORSORecord orsoRecord in orsoRecords)
                    {
                        row.PFundER += orsoRecord.ORSORecActER;
                    }

                    DBFilter positionFilter = new DBFilter();
                    positionFilter.add(new Match("EmpID", empInfo.EmpID));
                    positionFilter.add(new Match("PayGroupID", payGroup.PayGroupID));
                    positionFilter.add(new Match("EmpPosEffFr", "<=", payPeriod.PayPeriodTo));

                    OR orPosEffToTerms = new OR();
                    orPosEffToTerms.add(new Match("EmpPosEffTo", ">=", payPeriod.PayPeriodFr));
                    orPosEffToTerms.add(new NullTerm("EmpPosEffTo"));
                    positionFilter.add(orPosEffToTerms);

                    ArrayList        positionInfos = EEmpPositionInfo.db.select(dbConn, positionFilter);
                    EEmpPositionInfo empPos        = null;
                    if (positionInfos.Count > 0)
                    {
                        empPos = (EEmpPositionInfo)positionInfos[0];
                    }
                    else
                    {
                        empPos = AppUtils.GetLastPositionInfo(dbConn, payPeriod.PayPeriodTo, empInfo.EmpID);
                    }

                    if (HLevelIDDisplayList != null && empPos != null)
                    {
                        for (int count = 0; count < HLevelIDDisplayList.Count && count < 2; count++)
                        {
                            int hLevelID = Convert.ToInt32(HLevelIDDisplayList[count]);

                            EHierarchyLevel hLevel = new EHierarchyLevel();
                            hLevel.HLevelID = hLevelID;
                            if (EHierarchyLevel.db.select(dbConn, hLevel))
                            {
                                row["HLevelDesc" + (count + 1)] = hLevel.HLevelDesc;

                                DBFilter empHierarchyFilter = new DBFilter();
                                empHierarchyFilter.add(new Match("EmpPosID", empPos.EmpPosID));
                                empHierarchyFilter.add(new Match("HLevelID", hLevelID));
                                ArrayList empHierarchyList = EEmpHierarchy.db.select(dbConn, empHierarchyFilter);
                                if (empHierarchyList.Count > 0)
                                {
                                    EEmpHierarchy empHierarchy = (EEmpHierarchy)empHierarchyList[0];

                                    EHierarchyElement hElement = new EHierarchyElement();
                                    hElement.HElementID = empHierarchy.HElementID;
                                    if (EHierarchyElement.db.select(dbConn, hElement))
                                    {
                                        row["HElementCode" + (count + 1)] = hElement.HElementCode;
                                        row["HElementDesc" + (count + 1)] = hElement.HElementDesc;
                                    }
                                }
                            }
                        }
                    }

                    dataTable.Rows.Add(row);
                }
                if (reportDocument == null)
                {
                    if (reportType.Equals(ReportType.TrialRun))
                    {
                        reportDocument = new ReportTemplate.Report_Payroll_TrialRunSummary();
                    }
                    else if (reportType.Equals(ReportType.History))
                    {
                        reportDocument = new ReportTemplate.Report_Payroll_HistorySummary();
                    }
                }
                else
                {
                }

                reportDocument.SetDataSource(dataSet);

                return(reportDocument);
            }
            else
            {
                return(null);
            }
        }
コード例 #26
0
        public void LoadData(int EmpID, DateTime AsOfDate)
        {
            //  Initialize Variable
            m_EmpID    = EmpID;
            m_AsOfDate = AsOfDate;

            m_TotalDays           = 0;
            m_TotalDaysExclude    = 0;
            m_TotalWagesWithoutOT = 0;
            m_TotalOTWages        = 0;
            m_TotalWagesExclude   = 0;


            //  Get Last Payroll Period
            DBFilter lastPaylPeriodFilter = new DBFilter();

            lastPaylPeriodFilter.add(new Match("payPeriodTo", "<", AsOfDate));

            DBFilter EmpIDFilter = new DBFilter();

            EmpIDFilter.add(new Match("EmpID", "=", EmpID));

            IN lastPaylPeriodInFilter = new IN("PayPeriodID", "Select Distinct PayPeriodID from EmpPayroll", EmpIDFilter);

            lastPaylPeriodFilter.add(lastPaylPeriodInFilter);
            lastPaylPeriodFilter.add("payPeriodTo", false);
            //lastPaylPeriodFilter.loadData("select top 1 * from PayrollPeriod");
            ArrayList lastPayPeriods = EPayrollPeriod.db.select(dbConn, lastPaylPeriodFilter);

            if (lastPayPeriods.Count > 0)
            {
                //  Determine the date range
                EPayrollPeriod lastPayPeriod = (EPayrollPeriod)lastPayPeriods[0];

                LoadWageDetail(EmpID, lastPayPeriod.PayPeriodTo.AddDays(1).AddYears(-1), lastPayPeriod.PayPeriodTo);
            }
            else
            {
                DBFilter empTermFilter = new DBFilter();
                empTermFilter.add(new Match("NewEmpID", EmpID));
                ArrayList empTermList = EEmpTermination.db.select(dbConn, empTermFilter);
                foreach (EEmpTermination empTerm in empTermList)
                {
                    if (empTerm.EmpTermIsTransferCompany)
                    {
                        AverageWages averageWage = new AverageWages(dbConn, empTerm.EmpID, AsOfDate);
                        m_TotalDays            = averageWage.TotalDays;
                        m_TotalDaysExclude    += averageWage.TotalDaysExclude;
                        m_TotalWagesWithoutOT += averageWage.TotalWagesWithoutOT;
                        m_TotalOTWages        += averageWage.TotalOTWages;
                        m_TotalWagesExclude   += averageWage.TotalWagesExclude;

                        if (m_PeriodTo < averageWage.PeriodTo || m_PeriodTo.Ticks.Equals(0))
                        {
                            m_PeriodTo = averageWage.PeriodTo;
                        }
                        if (m_PeriodFrom > averageWage.PeriodFrom || m_PeriodFrom.Ticks.Equals(0))
                        {
                            m_PeriodFrom = averageWage.PeriodFrom;
                        }
                    }
                }
            }
        }
コード例 #27
0
    protected void Save_Click(object sender, EventArgs e)
    {
        EPayrollPeriod c = new EPayrollPeriod();

        Hashtable values = new Hashtable();

        binding.toValues(values);

        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();


        db.validate(errors, values);

        if (!errors.isEmpty())
        {
            return;
        }


        db.parse(values, c);

        DBFilter payPeriodFilter = new DBFilter();

        payPeriodFilter.add(new Match("PayGroupID", "=", c.PayGroupID));
        payPeriodFilter.add(new Match("PayPeriodFr", "<=", c.PayPeriodTo));
        if (c.PayPeriodIsAutoCreate)
        {
            //  If not auto created, do not allow future terms
            payPeriodFilter.add(new Match("PayPeriodTo", ">=", c.PayPeriodFr));
        }
        if (c.PayPeriodID > 0)
        {
            payPeriodFilter.add(new Match("PayPeriodID", "<>", c.PayPeriodID));
        }
        ArrayList overlapPayperiod = EPayrollPeriod.db.select(dbConn, payPeriodFilter);

        if (overlapPayperiod.Count > 0)
        {
            errors.addError("PayPeriodFr", HROne.Translation.PageErrorMessage.ERROR_INVALID_PERIOD);
        }

        if (!errors.isEmpty())
        {
            return;
        }

        WebUtils.StartFunction(Session, FUNCTION_CODE);
        if (CurID < 0)
        {
            //            Utils.MarkCreate(Session, c);
            c.PayPeriodStatus = "N";
            db.insert(dbConn, c);
            CurID = c.PayPeriodID;
            //            url = Utils.BuildURL(-1, CurID);
        }
        else
        {
            //            Utils.Mark(Session, c);
            db.update(dbConn, c);
        }
        WebUtils.EndFunction(dbConn);
        db.select(dbConn, c);

        HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Payroll_Group_View.aspx?PayGroupID=" + c.PayGroupID + "&PayPeriodID=" + CurID);
    }
コード例 #28
0
    protected void btnUndo_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(EEmpPayroll.db, Page.Master);

        errors.clear();

        ArrayList list = new ArrayList();

        foreach (RepeaterItem i in Repeater.Items)
        {
            CheckBox cb = (CheckBox)i.FindControl("ItemSelect");
            if (cb.Checked)
            {
                EEmpPayroll o = (EEmpPayroll)EEmpPayroll.db.createObject();
                WebFormUtils.GetKeys(EEmpPayroll.db, o, cb);
                list.Add(o);
            }
        }
        if (list.Count > 0)
        {
            System.Collections.Generic.List <int> payPeriodIDList = new System.Collections.Generic.List <int>();
            PayrollProcess payrollProcess = new PayrollProcess(dbConn);
            foreach (EEmpPayroll o in list)
            {
                if (EEmpPayroll.db.select(dbConn, o))
                {
                    if (!payPeriodIDList.Contains(o.PayPeriodID))
                    {
                        payPeriodIDList.Add(o.PayPeriodID);
                    }
                    WebUtils.StartFunction(Session, FUNCTION_CODE, o.EmpID, true);
                    payrollProcess.UndoPayroll(o);
                    WebUtils.EndFunction(dbConn);
                }
            }

            foreach (int CurPayPeriodID in payPeriodIDList)
            {
                DBFilter trialrunStatusEmpPayrollFilter = new DBFilter();
                trialrunStatusEmpPayrollFilter.add(new Match("EmpPayStatus", "T"));
                trialrunStatusEmpPayrollFilter.add(new Match("PayPeriodID", CurPayPeriodID));

                DBFilter confirmStatusEmpPayrollFilter = new DBFilter();
                confirmStatusEmpPayrollFilter.add(new Match("EmpPayStatus", "C"));
                confirmStatusEmpPayrollFilter.add(new Match("PayPeriodID", CurPayPeriodID));

                EPayrollPeriod payPeriod = new EPayrollPeriod();
                payPeriod.PayPeriodID = CurPayPeriodID;
                ArrayList trialrunStatusEmpPayrollList = EEmpPayroll.db.select(dbConn, trialrunStatusEmpPayrollFilter);
                ArrayList confirmStatusEmpPayrollList  = EEmpPayroll.db.select(dbConn, confirmStatusEmpPayrollFilter);
                if (trialrunStatusEmpPayrollList.Count == 0 && confirmStatusEmpPayrollList.Count == 0)
                {
                    payPeriod.PayPeriodStatus = EPayrollPeriod.PAYPERIOD_STATUS_NORMAL_FLAG;
                }
                else if (trialrunStatusEmpPayrollList.Count != 0)
                {
                    payPeriod.PayPeriodStatus = EPayrollPeriod.PAYPERIOD_STATUS_TRIALRUN_FLAG;
                }
                else if (confirmStatusEmpPayrollList.Count != 0)
                {
                    payPeriod.PayPeriodStatus = EPayrollPeriod.PAYPERIOD_STATUS_CONFIRM_FLAG;
                }

                payPeriod.PayPeriodRollbackDate = AppUtils.ServerDateTime();
                payPeriod.PayPeriodRollbackBy   = WebUtils.GetCurUser(Session).UserID;
                EPayrollPeriod.db.update(dbConn, payPeriod);
            }
            errors.addError("Stop Payment Successful");
        }
        loadData(info, EEmpPayroll.db, Repeater);
    }
コード例 #29
0
        public static string GetValueFromID(DatabaseConnection dbConn, string fieldName, string fieldValue)
        {
            try
            {
                string tmpfieldName = fieldName;
                if (tmpfieldName.Equals("PreviousEmpID", StringComparison.CurrentCultureIgnoreCase) || tmpfieldName.Equals("NewEmpID", StringComparison.CurrentCultureIgnoreCase))
                {
                    tmpfieldName = "EmpID";
                }
                if (tmpfieldName.EndsWith("PaymentCodeID", StringComparison.CurrentCultureIgnoreCase) || tmpfieldName.EndsWith("PayCodeID", StringComparison.CurrentCultureIgnoreCase))
                {
                    tmpfieldName = "PaymentCodeID";
                }
                if (tmpfieldName.Equals("DefaultMPFPlanID", StringComparison.CurrentCultureIgnoreCase))
                {
                    tmpfieldName = "MPFPlanID";
                }
                if (tmpfieldName.Equals("AttendanceFormulaPayFormID", StringComparison.CurrentCultureIgnoreCase) || tmpfieldName.Equals("ReferencePayFormID", StringComparison.CurrentCultureIgnoreCase))
                {
                    tmpfieldName = "PayFormID";
                }
                if (tmpfieldName.StartsWith("LeaveCode", StringComparison.CurrentCultureIgnoreCase) && tmpfieldName.EndsWith("Formula", StringComparison.CurrentCultureIgnoreCase))
                {
                    tmpfieldName = "PayFormID";
                }
                if (tmpfieldName.StartsWith("PayGroup", StringComparison.CurrentCultureIgnoreCase) && tmpfieldName.EndsWith("Formula", StringComparison.CurrentCultureIgnoreCase))
                {
                    tmpfieldName = "PayFormID";
                }
                if (tmpfieldName.Equals("CurrentPayPeriodID", StringComparison.CurrentCultureIgnoreCase))
                {
                    tmpfieldName = "PayPeriodID";
                }
                if (tmpfieldName.Equals("EmpPosDefaultRosterCodeID", StringComparison.CurrentCultureIgnoreCase))
                {
                    tmpfieldName = "RosterCodeID";
                }
                if (tmpfieldName.Equals("RosterClientMappingSiteCodeToHLevelID", StringComparison.CurrentCultureIgnoreCase))
                {
                    tmpfieldName = "HLevelID";
                }
                if (tmpfieldName.Equals("EmpFirstAuthorizationGp", StringComparison.CurrentCultureIgnoreCase) || tmpfieldName.Equals("EmpSecondAuthorizationGp", StringComparison.CurrentCultureIgnoreCase))
                {
                    tmpfieldName = "AuthorizationGroupID";
                }



                if (tmpfieldName.StartsWith("A", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (tmpfieldName.Equals("ALProrataRoundingRuleID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EALProrataRoundingRule obj = new EALProrataRoundingRule();
                        obj.ALProrataRoundingRuleID = int.Parse(fieldValue);
                        if (EALProrataRoundingRule.db.select(dbConn, obj))
                        {
                            return(obj.ALProrataRoundingRuleCode + " - " + obj.ALProrataRoundingRuleDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("AttendancePlanID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EAttendancePlan obj = new EAttendancePlan();
                        obj.AttendancePlanID = int.Parse(fieldValue);
                        if (EAttendancePlan.db.select(dbConn, obj))
                        {
                            return(obj.AttendancePlanCode + " - " + obj.AttendancePlanDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("AuthorizationGroupID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EAuthorizationGroup obj = new EAuthorizationGroup();
                        obj.AuthorizationGroupID = int.Parse(fieldValue);
                        if (EAuthorizationGroup.db.select(dbConn, obj))
                        {
                            return(obj.AuthorizationCode + " - " + obj.AuthorizationDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("AVCPlanID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EAVCPlan obj = new EAVCPlan();
                        obj.AVCPlanID = int.Parse(fieldValue);
                        if (EAVCPlan.db.select(dbConn, obj))
                        {
                            return(obj.AVCPlanCode + " - " + obj.AVCPlanDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                }
                else if (tmpfieldName.StartsWith("C", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (tmpfieldName.Equals("CessationReasonID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ECessationReason obj = new ECessationReason();
                        obj.CessationReasonID = int.Parse(fieldValue);
                        if (ECessationReason.db.select(dbConn, obj))
                        {
                            return(obj.CessationReasonCode + " - " + obj.CessationReasonDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("CompanyID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ECompany obj = new ECompany();
                        obj.CompanyID = int.Parse(fieldValue);
                        if (ECompany.db.select(dbConn, obj))
                        {
                            return(obj.CompanyCode + " - " + obj.CompanyName);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }


                    if (tmpfieldName.Equals("CostAllocationDetailID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ECostAllocationDetail obj = new ECostAllocationDetail();
                        obj.CostAllocationDetailID = int.Parse(fieldValue);
                        if (ECostAllocationDetail.db.select(dbConn, obj))
                        {
                            return(GetValueFromID(dbConn, "PayCodeID", obj.PaymentCodeID.ToString()) + ", " + GetValueFromID(dbConn, "CostCenterID", obj.CostCenterID.ToString()));
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("CostAllocationID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ECostAllocation obj = new ECostAllocation();
                        obj.CostAllocationID = int.Parse(fieldValue);
                        if (ECostAllocation.db.select(dbConn, obj))
                        {
                            return(GetValueFromID(dbConn, "EmpPayrollID", obj.EmpPayrollID.ToString()));
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("CostCenterID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ECostCenter obj = new ECostCenter();
                        obj.CostCenterID = int.Parse(fieldValue);
                        if (ECostCenter.db.select(dbConn, obj))
                        {
                            return(obj.CostCenterCode + " - " + obj.CostCenterDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                }
                else if (tmpfieldName.StartsWith("D", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (tmpfieldName.Equals("DocumentTypeID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EDocumentType obj = new EDocumentType();
                        obj.DocumentTypeID = int.Parse(fieldValue);
                        if (EDocumentType.db.select(dbConn, obj))
                        {
                            return(obj.DocumentTypeCode + " - " + obj.DocumentTypeDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                }
                else if (tmpfieldName.StartsWith("E", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (tmpfieldName.Equals("EmpAccID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EEmpBankAccount obj = new EEmpBankAccount();
                        obj.EmpBankAccountID = int.Parse(fieldValue);
                        if (EEmpBankAccount.db.select(dbConn, obj))
                        {
                            return(obj.EmpBankCode + "-" + obj.EmpBranchCode + "-" + obj.EmpAccountNo);
                        }
                        //return obj.EmpBankCode + "-" + obj.EmpBranchCode + "-" + string.Empty.PadRight(obj.EmpAccountNo.Length, 'X');
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("EmpCostCenterID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EEmpCostCenter obj = new EEmpCostCenter();
                        obj.EmpCostCenterID = int.Parse(fieldValue);
                        if (EEmpCostCenter.db.select(dbConn, obj))
                        {
                            return(GetValueFromID(dbConn, "EmpID", obj.EmpID.ToString()));
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("EmpExtraFieldID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EEmpExtraField obj = new EEmpExtraField();
                        obj.EmpExtraFieldID = int.Parse(fieldValue);
                        if (EEmpExtraField.db.select(dbConn, obj))
                        {
                            return(obj.EmpExtraFieldName);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("EmpID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EEmpPersonalInfo obj = new EEmpPersonalInfo();
                        obj.EmpID = int.Parse(fieldValue);
                        if (EEmpPersonalInfo.db.select(dbConn, obj))
                        {
                            return(obj.EmpNo + " - " + obj.EmpEngFullName);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("EmpPayrollID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EEmpPayroll obj = new EEmpPayroll();
                        obj.EmpPayrollID = int.Parse(fieldValue);
                        if (EEmpPayroll.db.select(dbConn, obj))
                        {
                            return(GetValueFromID(dbConn, "EmpID", obj.EmpID.ToString()) + " : " + GetValueFromID(dbConn, "PayPeriodID", obj.PayPeriodID.ToString()));
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("EmpPosID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EEmpPositionInfo obj = new EEmpPositionInfo();
                        obj.EmpPosID = int.Parse(fieldValue);
                        if (EEmpPositionInfo.db.select(dbConn, obj))
                        {
                            return(obj.EmpPosEffFr.ToString("yyyy-MM-dd") + " - " + (obj.EmpPosEffTo.Ticks.Equals(0) ? "Present" : obj.EmpPosEffTo.ToString("yyyy-MM-dd")));
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("EmploymentTypeID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EEmploymentType obj = new EEmploymentType();
                        obj.EmploymentTypeID = int.Parse(fieldValue);
                        if (EEmploymentType.db.select(dbConn, obj))
                        {
                            return(obj.EmploymentTypeCode + " - " + obj.EmploymentTypeDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                }
                else if (tmpfieldName.StartsWith("F", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (tmpfieldName.Equals("FunctionID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ESystemFunction obj = new ESystemFunction();
                        obj.FunctionID = int.Parse(fieldValue);
                        if (ESystemFunction.db.select(dbConn, obj))
                        {
                            return(obj.FunctionCode + " - " + obj.Description);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                }
                else if (tmpfieldName.StartsWith("H", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (tmpfieldName.Equals("HElementID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EHierarchyElement obj = new EHierarchyElement();
                        obj.HElementID = int.Parse(fieldValue);
                        if (EHierarchyElement.db.select(dbConn, obj))
                        {
                            return(obj.HElementCode + " - " + obj.HElementDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("HLevelID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EHierarchyLevel obj = new EHierarchyLevel();
                        obj.HLevelID = int.Parse(fieldValue);
                        if (EHierarchyLevel.db.select(dbConn, obj))
                        {
                            return(obj.HLevelCode + " - " + obj.HLevelDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                }
                else if (tmpfieldName.StartsWith("L", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (tmpfieldName.Equals("LeaveTypeID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ELeaveType obj = new ELeaveType();
                        obj.LeaveTypeID = int.Parse(fieldValue);
                        if (ELeaveType.db.select(dbConn, obj))
                        {
                            return(obj.LeaveType + " - " + obj.LeaveTypeDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("LeaveCodeID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ELeaveCode obj = new ELeaveCode();
                        obj.LeaveCodeID = int.Parse(fieldValue);
                        if (ELeaveCode.db.select(dbConn, obj))
                        {
                            return(obj.LeaveCode + " - " + obj.LeaveCodeDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("LeavePlanID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ELeavePlan obj = new ELeavePlan();
                        obj.LeavePlanID = int.Parse(fieldValue);
                        if (ELeavePlan.db.select(dbConn, obj))
                        {
                            return(obj.LeavePlanCode + " - " + obj.LeavePlanDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                }
                else if (tmpfieldName.StartsWith("M", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (tmpfieldName.Equals("MPFPlanID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EMPFPlan obj = new EMPFPlan();
                        obj.MPFPlanID = int.Parse(fieldValue);
                        if (EMPFPlan.db.select(dbConn, obj))
                        {
                            return(obj.MPFPlanCode + " - " + obj.MPFPlanDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }

                    if (tmpfieldName.Equals("MPFSchemeID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EMPFScheme obj = new EMPFScheme();
                        obj.MPFSchemeID = int.Parse(fieldValue);
                        if (EMPFScheme.db.select(dbConn, obj))
                        {
                            return(obj.MPFSchemeCode + " - " + obj.MPFSchemeDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("MPFSchemeCessationReasonID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EMPFSchemeCessationReason obj = new EMPFSchemeCessationReason();
                        obj.MPFSchemeCessationReasonID = int.Parse(fieldValue);
                        if (EMPFSchemeCessationReason.db.select(dbConn, obj))
                        {
                            return(obj.MPFSchemeCessationReasonCode + " - " + obj.MPFSchemeCessationReasonDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                }
                else if (tmpfieldName.StartsWith("O", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (tmpfieldName.Equals("ORSOPlanID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EORSOPlan obj = new EORSOPlan();
                        obj.ORSOPlanID = int.Parse(fieldValue);
                        if (EORSOPlan.db.select(dbConn, obj))
                        {
                            return(obj.ORSOPlanCode + " - " + obj.ORSOPlanDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                }
                else if (tmpfieldName.StartsWith("P", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (tmpfieldName.Equals("PayGroupID", StringComparison.CurrentCultureIgnoreCase) || tmpfieldName.Equals("PayrollGroupID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EPayrollGroup obj = new EPayrollGroup();
                        obj.PayGroupID = int.Parse(fieldValue);
                        if (EPayrollGroup.db.select(dbConn, obj))
                        {
                            return(obj.PayGroupCode + " - " + obj.PayGroupDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("PayFormID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EPayrollProrataFormula obj = new EPayrollProrataFormula();
                        obj.PayFormID = int.Parse(fieldValue);
                        if (EPayrollProrataFormula.db.select(dbConn, obj))
                        {
                            return(obj.PayFormCode + " - " + obj.PayFormDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("PaymentCodeID", StringComparison.CurrentCultureIgnoreCase) || tmpfieldName.Equals("PayCodeID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EPaymentCode obj = new EPaymentCode();
                        obj.PaymentCodeID = int.Parse(fieldValue);
                        if (EPaymentCode.db.select(dbConn, obj))
                        {
                            return(obj.PaymentCode + " - " + obj.PaymentCodeDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("PaymentTypeID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EPaymentType obj = new EPaymentType();
                        obj.PaymentTypeID = int.Parse(fieldValue);
                        if (EPaymentType.db.select(dbConn, obj))
                        {
                            return(obj.PaymentTypeCode + " - " + obj.PaymentTypeDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("PayPeriodID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EPayrollPeriod obj = new EPayrollPeriod();
                        obj.PayPeriodID = int.Parse(fieldValue);
                        if (EPayrollPeriod.db.select(dbConn, obj))
                        {
                            return(GetValueFromID(dbConn, "PayrollGroupID", obj.PayGroupID.ToString()) + ": " + obj.PayPeriodFr.ToString("yyyy-MM-dd") + " to " + obj.PayPeriodTo.ToString("yyyy-MM-dd"));
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("PermitTypeID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EPermitType obj = new EPermitType();
                        obj.PermitTypeID = int.Parse(fieldValue);
                        if (EPermitType.db.select(dbConn, obj))
                        {
                            return(obj.PermitTypeCode + " - " + obj.PermitTypeDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("PositionID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EPosition obj = new EPosition();
                        obj.PositionID = int.Parse(fieldValue);
                        if (EPosition.db.select(dbConn, obj))
                        {
                            return(obj.PositionCode + " - " + obj.PositionDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                }
                else if (tmpfieldName.StartsWith("Q", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (tmpfieldName.Equals("QualificationID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EQualification obj = new EQualification();
                        obj.QualificationID = int.Parse(fieldValue);
                        if (EQualification.db.select(dbConn, obj))
                        {
                            return(obj.QualificationCode + " - " + obj.QualificationDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                }
                else if (tmpfieldName.StartsWith("R", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (tmpfieldName.Equals("RankID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ERank obj = new ERank();
                        obj.RankID = int.Parse(fieldValue);
                        if (ERank.db.select(dbConn, obj))
                        {
                            return(obj.RankCode + " - " + obj.RankDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("ReminderTypeID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EReminderType obj = new EReminderType();
                        obj.ReminderTypeID = int.Parse(fieldValue);
                        if (EReminderType.db.select(dbConn, obj))
                        {
                            return(obj.ReminderTypeCode + " - " + obj.ReminderTypeDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("RosterClientID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ERosterClient obj = new ERosterClient();
                        obj.RosterClientID = int.Parse(fieldValue);
                        if (ERosterClient.db.select(dbConn, obj))
                        {
                            return(obj.RosterClientCode + " - " + obj.RosterClientName);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("RosterClientSiteID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ERosterClientSite obj = new ERosterClientSite();
                        obj.RosterClientSiteID = int.Parse(fieldValue);
                        if (ERosterClientSite.db.select(dbConn, obj))
                        {
                            return(obj.RosterClientSiteCode);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("RosterCodeID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ERosterCode obj = new ERosterCode();
                        obj.RosterCodeID = int.Parse(fieldValue);
                        if (ERosterCode.db.select(dbConn, obj))
                        {
                            return(obj.RosterCode + " - " + obj.RosterCodeDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                }
                else if (tmpfieldName.StartsWith("S", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (tmpfieldName.Equals("SkillID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ESkill obj = new ESkill();
                        obj.SkillID = int.Parse(fieldValue);
                        if (ESkill.db.select(dbConn, obj))
                        {
                            return(obj.SkillCode + " - " + obj.SkillDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("SkillLevelID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ESkillLevel obj = new ESkillLevel();
                        obj.SkillLevelID = int.Parse(fieldValue);
                        if (ESkillLevel.db.select(dbConn, obj))
                        {
                            return(obj.SkillLevelCode + " - " + obj.SkillLevelDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("StaffTypeID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EStaffType obj = new EStaffType();
                        obj.StaffTypeID = int.Parse(fieldValue);
                        if (EStaffType.db.select(dbConn, obj))
                        {
                            return(obj.StaffTypeCode + " - " + obj.StaffTypeDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                }
                else if (tmpfieldName.StartsWith("T", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (tmpfieldName.Equals("TaxCompID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ETaxCompany obj = new ETaxCompany();
                        obj.TaxCompID = int.Parse(fieldValue);
                        if (ETaxCompany.db.select(dbConn, obj))
                        {
                            return(obj.TaxCompEmployerName);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("TaxEmpID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ETaxEmp obj = new ETaxEmp();
                        obj.TaxEmpID = int.Parse(fieldValue);
                        if (ETaxEmp.db.select(dbConn, obj))
                        {
                            return(obj.TaxEmpSurname + ", " + obj.TaxEmpOtherName + ", " + GetValueFromID(dbConn, "TaxFormID", obj.TaxFormID.ToString()));
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("TaxFormID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ETaxForm obj = new ETaxForm();
                        obj.TaxFormID = int.Parse(fieldValue);
                        if (ETaxForm.db.select(dbConn, obj))
                        {
                            return("Tax Year :" + obj.TaxFormYear + ", Form: IR56" + obj.TaxFormType);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("TaxPayID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ETaxPayment obj = new ETaxPayment();
                        obj.TaxPayID = int.Parse(fieldValue);
                        if (ETaxPayment.db.select(dbConn, obj))
                        {
                            return(obj.TaxPayCode + " - " + obj.TaxPayDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("TrainingCourseID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ETrainingCourse obj = new ETrainingCourse();
                        obj.TrainingCourseID = int.Parse(fieldValue);
                        if (ETrainingCourse.db.select(dbConn, obj))
                        {
                            return(obj.TrainingCourseCode + " - " + obj.TrainingCourseName);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("TrainingSeminarID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ETrainingSeminar obj = new ETrainingSeminar();
                        obj.TrainingSeminarID = int.Parse(fieldValue);
                        if (ETrainingSeminar.db.select(dbConn, obj))
                        {
                            return(GetValueFromID(dbConn, "TrainingCourseID", obj.TrainingCourseID.ToString()) + ": " + obj.TrainingSeminarDateFrom.ToString("yyyy-MM-dd") + " to " + obj.TrainingSeminarDateTo.ToString("yyyy-MM-dd"));
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                }
                else if (tmpfieldName.StartsWith("U", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (tmpfieldName.Equals("UserID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EUser obj = new EUser();
                        obj.UserID = int.Parse(fieldValue);
                        if (EUser.db.select(dbConn, obj))
                        {
                            return(obj.LoginID + " - " + obj.UserName);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                    if (tmpfieldName.Equals("UserGroupID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EUserGroup obj = new EUserGroup();
                        obj.UserGroupID = int.Parse(fieldValue);
                        if (EUserGroup.db.select(dbConn, obj))
                        {
                            return(obj.UserGroupName + " - " + obj.UserGroupDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                }
                else if (tmpfieldName.StartsWith("Y", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (tmpfieldName.Equals("YebPlanID", StringComparison.CurrentCultureIgnoreCase))
                    {
                        EYEBPlan obj = new EYEBPlan();
                        obj.YEBPlanID = int.Parse(fieldValue);
                        if (EYEBPlan.db.select(dbConn, obj))
                        {
                            return(obj.YEBPlanCode + " - " + obj.YEBPlanDesc);
                        }
                        else
                        {
                            return(string.Empty);
                        }
                    }
                }

                if (tmpfieldName.EndsWith("ID") && !tmpfieldName.EndsWith("HKID") && !tmpfieldName.EndsWith("LoginID") && !tmpfieldName.EndsWith("CurrencyID") && !tmpfieldName.EndsWith("LeaveAppID") && !tmpfieldName.EndsWith("EmpPaymentID") && !tmpfieldName.EndsWith("PayBatchID") && !tmpfieldName.EndsWith("PayRecID") && !tmpfieldName.EndsWith("RosterTableID") && !tmpfieldName.EndsWith("SynID") && !tmpfieldName.EndsWith("CNDImportBatchID"))
                {
                    if (ESystemParameter.getParameter(dbConn, "DebugMode").Equals("Y"))
                    {
                        throw new Exception("ID field not define:" + fieldName);
                    }
                }
                return(string.Empty);
            }
            catch (Exception ex)
            {
                if (ESystemParameter.getParameter(dbConn, "DebugMode").Equals("Y"))
                {
                    throw ex;
                }
                else
                {
                    return(string.Empty);
                }
            }
        }
コード例 #30
0
        public override ReportDocument GenerateReport()
        {
            DataSet.Payroll_ORSOStatement dataSet = new DataSet.Payroll_ORSOStatement();
            DataSet.Payroll_ORSOStatement.ExistingMemberDataTable existingORSO;
            DataSet.Payroll_ORSOStatement.ORSOPlanDataTable       orsoPlan;

            existingORSO = dataSet.ExistingMember;

            orsoPlan = dataSet.ORSOPlan;



            if (PayPeriodFr.Ticks != 0 && PayPeriodTo.Ticks != 0 && EmpList != null)
            {
                string strPrintPeriod = PayPeriodFr.ToString("yyyy-MM-dd") + " - " + PayPeriodTo.ToString("yyyy-MM-dd");


                DBFilter payPeriodFilter = new DBFilter();
                payPeriodFilter.add(new Match("pp.PayPeriodFr", "<=", PayPeriodTo));
                payPeriodFilter.add(new Match("pp.PayPeriodTo", ">=", PayPeriodFr));

                foreach (EEmpPersonalInfo empInfo in EmpList)
                {
                    EEmpPersonalInfo.db.select(dbConn, empInfo);



                    DBFilter empPayrollFilter = new DBFilter();
                    empPayrollFilter.add(new Match("EmpID", empInfo.EmpID));
                    empPayrollFilter.add(new IN("PayPeriodID", "Select PayPeriodID from PayrollPeriod pp", payPeriodFilter));


                    DBFilter orsoRecordFilter = new DBFilter();
                    orsoRecordFilter.add(new IN("EmpPayrollID", "Select EmpPayrollID from EmpPayroll", empPayrollFilter));
                    orsoRecordFilter.add(new Match("ORSOPlanID", ORSOPlanID));
                    orsoRecordFilter.add("ORSORecPeriodFr", true);
                    orsoRecordFilter.add("ORSORecPeriodTo", true);
                    ArrayList orsoRecords = EORSORecord.db.select(dbConn, orsoRecordFilter);


                    DataSet.Payroll_ORSOStatement.ExistingMemberRow existingORSORow = null;
                    foreach (EORSORecord orsoRecord in orsoRecords)
                    {
                        EORSOPlan orsoPlanObject = new EORSOPlan();
                        orsoPlanObject.ORSOPlanID = orsoRecord.ORSOPlanID;
                        if (EORSOPlan.db.select(dbConn, orsoPlanObject))
                        {
                            if (orsoPlan.Select("ORSOPlanID=" + orsoPlanObject.ORSOPlanID).Length == 0)
                            {
                                DataSet.Payroll_ORSOStatement.ORSOPlanRow orsoPlanRow = orsoPlan.NewORSOPlanRow();
                                orsoPlanRow.ORSOPlanID          = orsoPlanObject.ORSOPlanID;
                                orsoPlanRow.ORSOPlanCode        = orsoPlanObject.ORSOPlanCode;
                                orsoPlanRow.ORSOPlanCompanyName = orsoPlanObject.ORSOPlanCompanyName;
                                orsoPlanRow.ORSOPlanPayCenter   = orsoPlanObject.ORSOPlanPayCenter;
                                orsoPlanRow.ORSOPlanSchemeNo    = orsoPlanObject.ORSOPlanSchemeNo;
                                orsoPlanRow.ORSOPlanDesc        = orsoPlanObject.ORSOPlanDesc;

                                orsoPlan.Rows.Add(orsoPlanRow);
                            }
                        }
                        EEmpPayroll empPayroll = new EEmpPayroll();
                        empPayroll.EmpPayrollID = orsoRecord.EmpPayrollID;
                        EEmpPayroll.db.select(dbConn, empPayroll);
                        EPayrollPeriod payrollPeriod = new EPayrollPeriod();
                        payrollPeriod.PayPeriodID = empPayroll.PayPeriodID;
                        EPayrollPeriod.db.select(dbConn, payrollPeriod);

                        {
                            if (existingORSORow == null)
                            {
                                existingORSORow = existingORSO.NewExistingMemberRow();
                                LoadExistingMemberRowInfo(empInfo, orsoRecord, existingORSORow);
                            }
                            else
                            {
                                if (!(existingORSORow.EmpID == empInfo.EmpID && existingORSORow.PeriodFrom.Equals(orsoRecord.ORSORecPeriodFr) && existingORSORow.PeriodTo.Equals(orsoRecord.ORSORecPeriodTo)))
                                {
                                    existingORSO.Rows.Add(existingORSORow);
                                    existingORSORow = existingORSO.NewExistingMemberRow();
                                    LoadExistingMemberRowInfo(empInfo, orsoRecord, existingORSORow);
                                }
                            }

                            existingORSORow.RelevantIncome += orsoRecord.ORSORecActRI;
                            existingORSORow.EE             += orsoRecord.ORSORecActEE;
                            existingORSORow.ER             += orsoRecord.ORSORecActER;
                        }
                    }

                    if (existingORSORow != null)
                    {
                        existingORSO.Rows.Add(existingORSORow);
                    }
                }



                if (reportDocument == null)
                {
                    reportDocument = new ReportTemplate.Report_Payroll_PFundStatement();
                }
                else
                {
                }


                reportDocument.SetDataSource(dataSet);
                reportDocument.SetParameterValue("ContributionPeriod", PayPeriodFr.ToString("yyyy-MM-dd") + " - " + PayPeriodTo.ToString("yyyy-MM-dd"));
                return(reportDocument);
            }
            else
            {
                return(null);
            }
        }