/// <summary> /// GetEmployeeDataOvertime /// </summary> /// <param name="startDate">startDate</param> /// <param name="endDate">endDate</param> /// <param name="employeeId">employeeId</param> /// <param name="work_">work_</param> /// <param name="newRow">newRow</param> private void GetEmployeeDataOvertime(DateTime startDate, DateTime endDate, int employeeId, string work_, ProjectCostingSheetAddTDS.LabourHoursInformationRow newRow) { ProjectCostingSheetAddEmployeeListGateway projectCostingSheetAddEmployeeListGateway = new ProjectCostingSheetAddEmployeeListGateway(); projectCostingSheetAddEmployeeListGateway.LoadByStartDateEndDateEmployeeIdWork_(startDate, endDate, employeeId, work_); if (projectCostingSheetAddEmployeeListGateway.Table.Rows.Count <= 0) { projectCostingSheetAddEmployeeListGateway.LoadByStartDateEndDateEmployeeId(startDate, endDate, employeeId); if (projectCostingSheetAddEmployeeListGateway.Table.Rows.Count <= 0) { projectCostingSheetAddEmployeeListGateway.LoadByStartDateEmployeeIdWork_(startDate, employeeId, work_); if (projectCostingSheetAddEmployeeListGateway.Table.Rows.Count <= 0) { projectCostingSheetAddEmployeeListGateway.LoadByStartDateEmployeeId(startDate, employeeId); if (projectCostingSheetAddEmployeeListGateway.Table.Rows.Count <= 0) { projectCostingSheetAddEmployeeListGateway.LoadByEmployeeId(employeeId); } } } } DataRow employeeRow = projectCostingSheetAddEmployeeListGateway.GetRow(employeeId); newRow.LHUnitOfMeasurement = (string)employeeRow["UnitOfMeasurement"]; newRow.LHCostCad = ((decimal)employeeRow["CostCad"] * 1.5M) + (decimal)employeeRow["BenefitFactorCad"];//employeeRow["CostCad"] == PayRateCad + BurdenRateCad newRow.LHCostUsd = ((decimal)employeeRow["CostUsd"] * 1.5M) + (decimal)employeeRow["BenefitFactorUsd"];//employeeRow["CostUsd"] == PayRateUsd + BurdenRateUsd if ((decimal)employeeRow["CostCad"] > 0) { newRow.LHCostUsd = (decimal)employeeRow["CostCad"] + (decimal)employeeRow["BenefitFactorCad"];//employeeRow["CostUsd"] == PayRateUsd + BurdenRateUsd } }
/// <summary> /// GetEmployeeDataFairWageOvertime /// </summary> /// <param name="startDate">startDate</param> /// <param name="endDate">endDate</param> /// <param name="employeeId">employeeId</param> /// <param name="work_">work_</param> /// <param name="newRow">newRow</param> /// <param name="contryId">contryId</param> /// <param name="fringeRate">fringeRate</param> /// <param name="fairWageRate">fairWageRate</param> private void GetEmployeeDataFairWageOvertime(DateTime startDate, DateTime endDate, int employeeId, string work_, ProjectCostingSheetAddTDS.LabourHoursInformationRow newRow, int contryId, decimal fringeRate, decimal fairWageRate) { ProjectCostingSheetAddEmployeeListGateway projectCostingSheetAddEmployeeListGateway = new ProjectCostingSheetAddEmployeeListGateway(); projectCostingSheetAddEmployeeListGateway.LoadByStartDateEndDateEmployeeIdWork_FairWage(startDate, endDate, employeeId, work_); if (projectCostingSheetAddEmployeeListGateway.Table.Rows.Count <= 0) { projectCostingSheetAddEmployeeListGateway.LoadByStartDateEndDateEmployeeIdFairWage(startDate, endDate, employeeId); if (projectCostingSheetAddEmployeeListGateway.Table.Rows.Count <= 0) { projectCostingSheetAddEmployeeListGateway.LoadByStartDateEmployeeIdWork_FairWage(startDate, employeeId, work_); if (projectCostingSheetAddEmployeeListGateway.Table.Rows.Count <= 0) { projectCostingSheetAddEmployeeListGateway.LoadByStartDateEmployeeIdFairWage(startDate, employeeId); if (projectCostingSheetAddEmployeeListGateway.Table.Rows.Count <= 0) { projectCostingSheetAddEmployeeListGateway.LoadByEmployeeId(employeeId); } } } } DataRow employeeRow = projectCostingSheetAddEmployeeListGateway.GetRow(employeeId); newRow.LHUnitOfMeasurement = (string)employeeRow["UnitOfMeasurement"]; if (contryId == 1) { //Canada decimal regularRate = 0; if (!employeeRow.IsNull("PayRateCad")) { regularRate = (decimal)employeeRow["PayRateCad"]; } decimal rate = fairWageRate * 1.5M; decimal burdenRate = 0; if (fairWageRate < regularRate) { rate = regularRate * 1.5M; } if (!employeeRow.IsNull("BourdenFactor")) { decimal burdenFactor = (decimal)employeeRow["BourdenFactor"] / 100; burdenRate = rate * burdenFactor; } newRow.LHCostCad = rate + fringeRate + burdenRate; newRow.LHCostUsd = rate + fringeRate + burdenRate; } else { //USA decimal regularRate = 0; if (!employeeRow.IsNull("PayRateUsd")) { regularRate = (decimal)employeeRow["PayRateUsd"]; } decimal benefitFactorUsd = 0; if (!employeeRow.IsNull("HealthBenefitUsd")) { benefitFactorUsd = (decimal)employeeRow["BenefitFactorUsd"]; } decimal healtBenefitFactor = 0; if (!employeeRow.IsNull("HealthBenefitUsd")) { decimal usHealthBenefitFactor = (decimal)employeeRow["HealthBenefitUsd"] / 100; healtBenefitFactor = benefitFactorUsd + (benefitFactorUsd * usHealthBenefitFactor); } else { healtBenefitFactor = benefitFactorUsd; } decimal burdenRate = 0; decimal fringeDeficiency = fringeRate - benefitFactorUsd; decimal rate = fairWageRate * 1.5M; if (fairWageRate < regularRate) { rate = regularRate * 1.5M; } if (!employeeRow.IsNull("BourdenFactor")) { decimal burdenFactor = (decimal)employeeRow["BourdenFactor"] / 100; burdenRate = (rate + fringeDeficiency) * burdenFactor; } newRow.LHCostUsd = rate + fringeDeficiency + burdenRate + healtBenefitFactor; newRow.LHCostCad = rate + fringeDeficiency + burdenRate + healtBenefitFactor; } }