Employee Wise PF Handling including Uploader

This commit is contained in:
Mohaimen Hasan 2026-11-25 14:24:56 +06:00
parent 3c3959c38b
commit 4e0b827859
19 changed files with 348 additions and 10 deletions

View File

@ -123,6 +123,7 @@ namespace HRM.BO
public bool IsShownInTaxSheet { get; set; } // R
public EnumPFMembershipType PFMemberType { get; set; }
public DateTime? PFMemberShiptDate { get; set; }
public double PFPercentage { get; set; }
public int? BranchID { get; set; }
public string AccountNo { get; set; }
public int? OutPayBranchID { get; set; }

View File

@ -168,6 +168,14 @@ namespace HRM.BO
}
}
#endregion
#region PFPercentage : double
private double? _pFPercentage;
public double? PFPercentage
{
get { return _pFPercentage; }
set { _pFPercentage = value; }
}
#endregion
#region EmployeeID : ID
private int _employeeID;
public int EmployeeID
@ -577,6 +585,7 @@ namespace HRM.BO
List<EmpLifeCycle> GetEmpID(int nEmpID, DateTime effectDate);
EmpLifeCycle GetLastPosition(int nEmpID);
void UpdateApprovalStatus(List<EmpLifeCycle> oEmpLifeCycles, int currentPayrollTypeID);
bool IsAutoPFMembership();
int Save(EmpLifeCycle item, DateTime nextPayProcessDate, int payrollTypeID);
int Save(List<EmpLifeCycle> items, DateTime nextPayProcessDate);
void Delete(EmpLifeCycle item, DateTime nextPayProcessDate);

View File

@ -26,8 +26,8 @@ namespace HRM.DA
public static void Insert(TransactionContext tc, EmpLifeCycle item)
{
tc.ExecuteNonQuery(
"INSERT INTO EmpLifeCycle(EmpLifeCycleID,EffectDate,NodeID,GrossSalary,BasicSalary,GradeID,CategoryID,CompanyID,FunctionID,DesignationID,LocationID,DepartmentID,IsConfirm,pFMemberType,IsDiscontinue,IsContinue,EmployeeID,StatusDetailID,Remarks,Description,Status,CreatedBy, CreationDate, SequenceNo,SalaryMonth,IsCurrentMonthIncluded,CostCenterID,GradeSalaryAssesmentID,EmployeeCCID,IncrementNo,PayrollTypeID,ComplainID,PunishmentID,ApprovalStatus)" +
" VALUES( %n , %D , %n , %n , %n , %n , %n , %n , %n , %n , %n , %n , %b , %n , %b , %b , %n , %n , %s , %s , %n , %n , %D , %n , %D , %b , %n , %n , %n ,%n, %n,%n,%n,%n )",
"INSERT INTO EmpLifeCycle(EmpLifeCycleID,EffectDate,NodeID,GrossSalary,BasicSalary,GradeID,CategoryID,CompanyID,FunctionID,DesignationID,LocationID,DepartmentID,IsConfirm,pFMemberType,IsDiscontinue,IsContinue,EmployeeID,StatusDetailID,Remarks,Description,Status,CreatedBy, CreationDate, SequenceNo,SalaryMonth,IsCurrentMonthIncluded,CostCenterID,GradeSalaryAssesmentID,EmployeeCCID,IncrementNo,PayrollTypeID,ComplainID,PunishmentID,ApprovalStatus,PFPercentage)" +
" VALUES( %n , %D , %n , %n , %n , %n , %n , %n , %n , %n , %n , %n , %b , %n , %b , %b , %n , %n , %s , %s , %n , %n , %D , %n , %D , %b , %n , %n , %n ,%n, %n,%n,%n,%n,%n )",
item.ID, item.EffectDate, item.NodeID, item.GrossSalary, item.BasicSalary,
item.GradeID, item.CategoryID,
item.CompanyID, item.FunctionID,
@ -37,7 +37,7 @@ namespace HRM.DA
item.Description, item.EmployeeStatus, DataReader.GetNullValue(item.CreatedBy, 0),
item.CreatedDate, item.Sequence, item.SalaryMonth, item.IsCurrentMonthIncluded,
item.CostCenterID, item.GradeSalaryAssesmentID,
item.EmployeeCCID, item.IncrementNo, DataReader.GetNullValue(item.PayrollTypeID, 0), DataReader.GetNullValue(item.ComplainID, 0), DataReader.GetNullValue(item.PunishmentID, 0), item.ApprovalStatus);
item.EmployeeCCID, item.IncrementNo, DataReader.GetNullValue(item.PayrollTypeID, 0), DataReader.GetNullValue(item.ComplainID, 0), DataReader.GetNullValue(item.PunishmentID, 0), item.ApprovalStatus, item.PFPercentage);
//1 //2 //3 //4 //5 //6 //7 //8 //9 //10 //11 //12 //13 //14 //15 //16 //17 //18 //19 //20 //21 //21 //22 //23 //24 //25
}
@ -49,7 +49,7 @@ namespace HRM.DA
{
tc.ExecuteNonQuery(@"UPDATE EmpLifeCycle set EffectDate=%D,NodeID=%n,GrossSalary=%n,BasicSalary=%n,GradeID=%n,CategoryID=%n,CompanyID=%n,FunctionID=%n,DesignationID=%n,
LocationID=%n,DepartmentID=%n,IsConfirm=%b,pFMemberType=%n,IsDiscontinue=%b,IsContinue=%b,EmployeeID=%n,StatusDetailID=%n,Remarks=%s,Description=%s,Status=%n,CreatedBy=%n, CreationDate=%D,
SequenceNo=%n,SalaryMonth=%D,IsCurrentMonthIncluded=%b,CostCenterID=%n,GradeSalaryAssesmentID=%n,EmployeeCCID=%n,IncrementNo=%n,PayrollTypeID=%n,ComplainID=%n,PunishmentID=%n,ApprovalStatus=%n
SequenceNo=%n,SalaryMonth=%D,IsCurrentMonthIncluded=%b,CostCenterID=%n,GradeSalaryAssesmentID=%n,EmployeeCCID=%n,IncrementNo=%n,PayrollTypeID=%n,ComplainID=%n,PunishmentID=%n,ApprovalStatus=%n,PFPercentage=%n
WHERE EmpLifeCycleID=%n", item.EffectDate, item.NodeID, item.GrossSalary, item.BasicSalary,
item.GradeID, item.CategoryID,
item.CompanyID, item.FunctionID,
@ -59,7 +59,7 @@ WHERE EmpLifeCycleID=%n", item.EffectDate, item.NodeID, item.GrossSalary, item.B
item.Description, item.EmployeeStatus, DataReader.GetNullValue(item.CreatedBy, 0),
item.CreatedDate, item.Sequence, item.SalaryMonth, item.IsCurrentMonthIncluded,
item.CostCenterID, item.GradeSalaryAssesmentID,
item.EmployeeCCID, item.IncrementNo, DataReader.GetNullValue(item.PayrollTypeID, 0), DataReader.GetNullValue(item.ComplainID, 0), DataReader.GetNullValue(item.PunishmentID, 0), item.ApprovalStatus, item.ID);
item.EmployeeCCID, item.IncrementNo, DataReader.GetNullValue(item.PayrollTypeID, 0), DataReader.GetNullValue(item.ComplainID, 0), DataReader.GetNullValue(item.PunishmentID, 0), item.ApprovalStatus, item.PFPercentage, item.ID);
}
public static void UpdateApprovalStatus(TransactionContext tc, EmpLifeCycle item)

View File

@ -318,6 +318,12 @@ namespace HRM.DA
}
public static void UpdatePFPercentage(TransactionContext tc, int EmployeeID, double pfPercentage)
{
tc.ExecuteNonQuery("UPDATE Employee SET PFPercentage=%n WHERE EmployeeID=%n",
pfPercentage, EmployeeID);
}
public static void UpdateEndofContact(TransactionContext tc, int EmployeeID, DateTime dt)
{
tc.ExecuteNonQuery("UPDATE Employee SET ENDOFCONTRACTDATE= %d WHERE EmployeeID=%n",

View File

@ -189,6 +189,25 @@ namespace HRM.DA
}
}
// PF Percentage column exists only when autopfmembership is on; it is needed when this row makes the employee a Live PF member
if (autopf && odataTable.Columns.Contains("PF Percentage"))
{
string sPFPercentage = dr["PF Percentage"].ToString().Trim();
double pfPercentage = 0;
if (sPFPercentage != string.Empty
&& (!double.TryParse(sPFPercentage, out pfPercentage) || pfPercentage <= 0 || pfPercentage > 100))
{
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("PF Percentage", nRow, "PF Percentage must be greater than 0 and up to 100", oemployee.EmployeeNo, oemployee.Name));
}
else if (oemployee.PFMemberType == EnumPFMembershipType.Live)
{
if (sPFPercentage == string.Empty)
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("PF Percentage", nRow, "PF Percentage can't be empty when Confirmation Date is given", oemployee.EmployeeNo, oemployee.Name));
else
oemployee.PFPercentage = pfPercentage;
}
}
//Refresh Employee Grade Salary
if (oemployee.GradeID != null)
{
@ -841,6 +860,7 @@ namespace HRM.DA
bool isbankCodeAutoGen = Convert.ToBoolean(ocManager.GetconfigBooleanValue(EnumConfigurationType.Logic, "bank", "codeautogenerate"));
bool isbranchCodeAutoGen = Convert.ToBoolean(ocManager.GetconfigBooleanValue(EnumConfigurationType.Logic, "branch", "codeautogenerate"));
bool isGrossApplicable = ocManager.GetconfigBooleanValue(EnumConfigurationType.Logic, "grade", "grossapplicable");
bool autopf = ocManager.GetconfigBooleanValue(EnumConfigurationType.Logic, "confirmation", "autopfmembership");
item.SheetName = "EmpBasicInformation";
@ -883,6 +903,9 @@ namespace HRM.DA
// item.Add("PayScaleID", "String", "Yes"); //15
item.Add("Confirmation Date", "Date", "Yes"); //17
// auto PF membership on confirmation: the employee's own PF % (Employee.PFPercentage)
if (autopf == true)
item.Add("PF Percentage", "Double", "Yes");
item.Add("Basic Salary", "Double", "No"); //16
if (isGrossApplicable == true)
item.Add("Gross Salary", "Double", "No"); //15
@ -1077,6 +1100,13 @@ namespace HRM.DA
}
}
// PF membership needs the employee's own PF % (Employee.PFPercentage): the event makes the employee a
// Live PF member either through its PF_Member component, or through Confirm when autopfmembership is on
bool autopf = ocManager.GetconfigBooleanValue(EnumConfigurationType.Logic, "confirmation", "autopfmembership");
bool hasPFMember = ostatus.EmployeeStatusComponents.Exists(x => x.ComponentType == EnumLifeCycleComponent.PF_Member);
bool hasConfirm = ostatus.EmployeeStatusComponents.Exists(x => x.ComponentType == EnumLifeCycleComponent.Confirm);
if (hasPFMember || (hasConfirm && autopf))
item.Add("PF Percentage", "Double", "No");
return item;
}

View File

@ -5221,6 +5221,9 @@ namespace HRM.DA
int locationid = new MiscellaneousService().GetNextID("location", "locationid", "");
int designationid = new MiscellaneousService().GetNextID("Designation", "DesignationID", "");
int costcenterid = new MiscellaneousService().GetNextID("crg", "crgid", "");
bool needPFPercentage = ostatus.EmployeeStatusComponents.Exists(x => x.ComponentType == EnumLifeCycleComponent.PF_Member)
|| (ostatus.EmployeeStatusComponents.Exists(x => x.ComponentType == EnumLifeCycleComponent.Confirm)
&& new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "confirmation", "autopfmembership"));
string description = "";
try
{
@ -5657,6 +5660,23 @@ namespace HRM.DA
}
}
// PF membership needs the employee's own PF % (Employee.PFPercentage): the event makes the employee a
// Live PF member either through its PF_Member component, or through Confirm when autopfmembership is on
if (needPFPercentage)
{
double pfPercentage = 0;
string sPFPercentage = dr.Table.Columns.Contains("PF Percentage") ? dr["PF Percentage"].ToString().Trim() : "";
if (sPFPercentage == "")
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("PF Percentage", nRow, "(" + dr["Employee No"].ToString() + ")" + "PF Percentage can't be Empty"));
else if (!double.TryParse(sPFPercentage, out pfPercentage) || pfPercentage <= 0 || pfPercentage > 100)
_errorOrSuccessList.Add(UploadErrorOrSuccess.Create("PF Percentage", nRow, "(" + dr["Employee No"].ToString() + ")" + "PF Percentage must be greater than 0 and up to 100"));
else
{
lifeCycle.PFPercentage = pfPercentage;
description = description + " PF Percentage " + pfPercentage.ToString() + "%";
}
}
if (lifeCycle.EffectDate.Date < DateTime.Today)
{
lifeCycle.IsProcessed = null;

View File

@ -50,6 +50,7 @@ namespace HRM.DA
oEmployee.PFMemberShiptDate = oReader.GetDateTime("pfMemberShipDt").HasValue
? oReader.GetDateTime("pfMemberShipDt").Value
: DateTime.Now;
oEmployee.PFPercentage = oReader.GetDouble("PFPercentage", true, 0);
oEmployee.BranchID = oReader.GetInt32("branchID");
oEmployee.AccountNo = oReader.GetString("accountNo");
oEmployee.OutPayBranchID = oReader.GetInt32("OUTPAYBRANCHID");
@ -3459,6 +3460,10 @@ namespace HRM.DA
oEmployee.Name = oEmployee.Name == "" ? "Employee-" + oEmployee.EmployeeNo : oEmployee.Name;
EmployeeDA.Insert(tc, oEmployee);
// employee's own PF % (from the upload's PF Percentage column), used by SalaryCalculator.PFNEW
if (oEmployee.PFMemberType == EnumPFMembershipType.Live && oEmployee.PFPercentage > 0)
HREmployeeDA.UpdatePFPercentage(tc, oEmployee.ID, oEmployee.PFPercentage);
int id = 0;
if (uploadtype == EnumRegularDataUpload.EmployeeWithBasic || !IsFinantialAprovalRequired)
@ -3534,6 +3539,8 @@ namespace HRM.DA
oEmployee.EmpLifeCycle.LocationID = oEmployee.LocationID;
oEmployee.EmpLifeCycle.CategoryID = oEmployee.CategoryID;
oEmployee.EmpLifeCycle.IsConfirm = (oEmployee.IsConfirmed == true) ? true : false;
if (oEmployee.PFMemberType == EnumPFMembershipType.Live && oEmployee.PFPercentage > 0)
oEmployee.EmpLifeCycle.PFPercentage = oEmployee.PFPercentage;
oEmployee.EmpLifeCycle.CreatedBy = oEmployee.CreatedBy;
oEmployee.EmpLifeCycle.CreatedDate = oEmployee.CreatedDate;
oEmployee.EmpLifeCycle.GradeSalaryAssesmentID = oEmployee.EmployeeGradeSalary.ID;

View File

@ -51,6 +51,8 @@ namespace HRM.DA
if (oReader.GetInt32("pFMemberType").HasValue)
oEmpLifeCycle.PFMemberType = (EnumPFMembershipType)oReader.GetInt32("pFMemberType").Value;
else oEmpLifeCycle.PFMemberType = null;
double pfPercentage = oReader.GetDouble("PFPercentage", true, 0);
oEmpLifeCycle.PFPercentage = pfPercentage > 0 ? pfPercentage : (double?)null;
oEmpLifeCycle.IsDiscontinue = oReader.GetBoolean("IsDiscontinue");
oEmpLifeCycle.IsContinue = oReader.GetBoolean("IsContinue");
oEmpLifeCycle.EmployeeID = oReader.GetInt32("EmployeeID").Value;
@ -749,6 +751,12 @@ namespace HRM.DA
}
}
// Logic XML confirmation/autopfmembership: confirming an employee also makes them a Live PF member
public bool IsAutoPFMembership()
{
return new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "confirmation", "autopfmembership");
}
public void UpdateApprovalStatus(List<EmpLifeCycle> oEmpLifeCycles, int currentPayrollTypeID)
{
TransactionContext tc = null;
@ -943,6 +951,9 @@ namespace HRM.DA
HREmployeeDA.UpdatePFInfo(tc, oEmpLifeCycle.EmployeeID,
EnumPFMembershipType.Live, oEmpLifeCycle.EffectDate);
// PF membership: the employee's own PF % (used by SalaryCalculator.PFNEW)
if (oEmpLifeCycle.PFPercentage != null)
HREmployeeDA.UpdatePFPercentage(tc, oEmpLifeCycle.EmployeeID, (double)oEmpLifeCycle.PFPercentage);
}
}
//else
@ -971,8 +982,14 @@ namespace HRM.DA
// if conponent contain pf member, update employee pfMembership property property and pfMembership date.
if (oEmpLifeCycle.PFMemberType != null)
{
HREmployeeDA.UpdatePFInfo(tc, oEmpLifeCycle.EmployeeID,
(EnumPFMembershipType)oEmpLifeCycle.PFMemberType, oEmpLifeCycle.EffectDate);
// PF membership: the employee's own PF % (used by SalaryCalculator.PFNEW)
if (oEmpLifeCycle.PFMemberType == EnumPFMembershipType.Live && oEmpLifeCycle.PFPercentage != null)
HREmployeeDA.UpdatePFPercentage(tc, oEmpLifeCycle.EmployeeID, (double)oEmpLifeCycle.PFPercentage);
}
break;
case EnumEmployeeStatus.Discontinued:
EmployeeDA.UpdateStatus(tc, oEmpLifeCycle.EmployeeID, oEmpLifeCycle.ID,

View File

@ -125,8 +125,9 @@ namespace HRM.DA
UpdateprocessStatus("Calculating Salary deduct item(unauthorized leave)....");
this.UnAuthorizeLeave();
UpdateprocessStatus("Calculating PF & CPF....");
this.PF();
//this.PF();
this.PFNEW();
// this.OverTimeArrearProcess(); needed later
//UpdateprocessStatus("Calculating Employees Income tax....");
UpdateprocessStatus("Calculating Income Tax");
@ -692,6 +693,153 @@ namespace HRM.DA
}
private void PFNEW()
{
UpdateProgressStatus(EnumProcessStatus.Start);
bool bEchoTexException = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "salary", "echotexexception");
bool earnedBasic = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "pf", "earnedbasic");
// PF % comes from each employee (Employee.PFPercentage), not from SystemInformation.
//List<PFException> oPfExceptions = PFException.Get();
foreach (SalaryMonthly salary in _salaryMonthlys)
{
UpdateProgressStatus(EnumProcessStatus.PerformStep);
SalaryMonthlyDetail pfDetail = null;
if (salary.Employee.PFMemberType != EnumPFMembershipType.Live) continue;
double pfPercent = (salary.Employee.PFPercentage / 100);
// SalaryMonthly prvSalary = _PrvMonthsalary.FirstOrDefault(x => x.EmployeeID == salary.EmployeeID);
var basicitem = _PrvMonthsalaryItems.FirstOrDefault(x => x.itemCode == EnumSalaryItemCode.Basic_Salary
&& x.empid == salary.EmployeeID);
bool RcvLastMonthSalary = false;
if (basicitem != null) RcvLastMonthSalary = true;
double arrearPF = 0;
if (earnedBasic == true)
{
if (RcvLastMonthSalary == true)
{
//SalaryMonthlyDetail prvPF = prvSalary.Details.Find(delegate (SalaryMonthlyDetail detail)
//{
// return (detail.ItemCode == EnumSalaryItemCode.PF_Contribution
// && detail.itemGroupCode == EnumSalaryGroup.Deductions);
//});
var prvPF = _PrvMonthsalaryItems.FirstOrDefault(x => x.itemCode == EnumSalaryItemCode.PF_Contribution
&& x.empid == salary.EmployeeID);
if (salary.Employee.ConfirDate != null && salary.Employee.ConfirDate <
GlobalFunctions.FirstDateOfMonth(_processMonth) && RcvLastMonthSalary == true && prvPF == null) // if pf continue with previous month salary
{
DateTime? tepConfirm = salary.Employee.ConfirDate;
while (GlobalFunctions.LastDateOfMonth((DateTime)tepConfirm) <= this.payrollType.LastPayProcessDate)
{
EmployeeGradeSalary gradeSal = new EmployeeGradeSalaryService().GetBasicOnDateBAT(salary.EmployeeID, (DateTime)tepConfirm);
if (gradeSal == null)
{
AddProcessStatus(salary.Employee, " Employee previous salary not found during PF arrear calculation");
break;
}
double fractionate = 0;
if (tepConfirm == GlobalFunctions.FirstDateOfMonth((DateTime)tepConfirm))
fractionate = 1;
if (tepConfirm == GlobalFunctions.LastDateOfMonth((DateTime)tepConfirm))
fractionate = 30 / 29;
else fractionate = GlobalFunctions.GetFractinalOfMonth((DateTime)tepConfirm);
arrearPF = arrearPF + ((gradeSal.BasicSalary * fractionate) * pfPercent);
tepConfirm = GlobalFunctions.FirstDateOfMonth(((DateTime)tepConfirm).AddMonths(1));
}
}
}
SalaryMonthlyDetail basic = salary.Details.Find(delegate (SalaryMonthlyDetail detail) { return (detail.ItemCode == EnumSalaryItemCode.Basic_Salary
&& detail.itemGroupCode == EnumSalaryGroup.Gross); });
if (basic != null)
{
pfDetail = this.AddDetail(salary, EnumSalaryGroup.Deductions,
EnumSalaryItemCode.PF_Contribution, (int)EnumSalaryItemCode.PF_Contribution, 0,
"PF", GlobalFunctions.Round(basic.CalculatedAmount * pfPercent));
}
basic = salary.Details.Find(delegate (SalaryMonthlyDetail detail) { return (detail.ItemCode == EnumSalaryItemCode.Basic_Salary
&& detail.itemGroupCode == EnumSalaryGroup.Arrear); });
if (basic != null)
{
pfDetail.CalculatedAmount = pfDetail.CalculatedAmount + GlobalFunctions.Round(basic.CalculatedAmount * pfPercent);
}
basic = salary.Details.Find(delegate (SalaryMonthlyDetail detail) { return (detail.ItemCode == EnumSalaryItemCode.Basic_Salary
&& detail.itemGroupCode == EnumSalaryGroup.UnauthLeave); });
if (basic != null)
{
pfDetail.CalculatedAmount = pfDetail.CalculatedAmount - GlobalFunctions.Round(basic.CalculatedAmount * pfPercent);
}
if (pfDetail != null)
{
if (salary.Employee.ConfirDate != null &&
GlobalFunctions.LastDateOfMonth((DateTime)salary.Employee.ConfirDate) == _processMonth)
{
if ((DateTime)salary.Employee.ConfirDate != salary.Employee.JoiningDate)
{
pfDetail.CalculatedAmount = GlobalFunctions.Round(pfDetail.CalculatedAmount *
((double)(31 - ((DateTime)salary.Employee.ConfirDate).Day) / (double)30));
}
}
pfDetail.CalculatedAmount = pfDetail.CalculatedAmount + GlobalFunctions.Round(arrearPF);
pfDetail.ChangedAmount = pfDetail.CalculatedAmount;
}
}
else
{
double months = 1;
if (bEchoTexException == false)
{
salaryHistory prvPF = null;
if (RcvLastMonthSalary == true)
{
prvPF = _PrvMonthsalaryItems.FirstOrDefault(x => x.itemCode == EnumSalaryItemCode.PF_Contribution
&& x.empid == salary.EmployeeID);
}
if (RcvLastMonthSalary == true)
{
if (prvPF == null)
months = Global.DateFunctions.DateDiff("m", (DateTime)salary.Employee.ConfirDate, _processMonth) + 1;
else
{
if (salary.ArrearGradeSalaries.Count > 0)
{
pfDetail = this.AddDetail(salary, EnumSalaryGroup.Deductions,
EnumSalaryItemCode.PF_Contribution, (int)EnumSalaryItemCode.PF_Contribution,
0, "PF", GlobalFunctions.Round(salary.GetGrossAmount(EnumSalaryItemCode.Basic_Salary, (int)EnumSalaryItemCode.Basic_Salary)
* pfPercent));
continue;
}
}
}
else if ((Global.DateFunctions.DateDiff("m", (DateTime)salary.Employee.JoiningDate, _processMonth) + 1) <= 2) // joining in last month
{
months = Global.DateFunctions.DateDiff("m", (DateTime)salary.Employee.JoiningDate, _processMonth) + 1;
}
}
pfDetail = this.AddDetail(salary, EnumSalaryGroup.Deductions,
EnumSalaryItemCode.PF_Contribution, (int)EnumSalaryItemCode.PF_Contribution,
0, "PF", GlobalFunctions.Round(salary.ThisMonthBasic * pfPercent * months));
}
}
UpdateProgressStatus(EnumProcessStatus.End);
}
private void AllowanceDeduction()
{

View File

@ -20,6 +20,7 @@ export class EmpLifeCycle extends BaseObject {
departmentID: number;
isConfirm?: boolean;
pfMemberType?: EnumPFMembershipType;
pfPercentage?: number;
employeeID: number;
statusDetailID: number;
grossSalary: number;

View File

@ -47,6 +47,7 @@ export class Employee {
isShownInTaxSheet: boolean;
pfMemberType: EnumPFMembershipType;
pfMemberShiptDate: Date;
pfPercentage: number;
branchID: number;
accountNo: string;
outPayBranchID: number;
@ -142,6 +143,7 @@ export class Employee {
this.statusName = '';
this.isShownInTaxSheet = false;
this.pfMemberType = EnumPFMembershipType.NotYetLive;
this.pfPercentage = 0;
this.branchID = null;
this.accountNo = '';
this.outPayBranchID = null;

View File

@ -33,6 +33,9 @@ export class EmpLifeCycleServices {
GetByUserID() {
return this.apiService.httpGet<EmployeeStatus[]>('/EmpLifeCycle/GetByUserID');
}
IsAutoPFMembership() {
return this.apiService.httpGet<boolean>('/EmpLifeCycle/IsAutoPFMembership');
}
getEmpLifeCyclesByDate(param: any) {
return this.apiService.httpPost<EmpLifeCycle[]>('/EmpLifeCycle/getEmpLifeCyclesByDate', param);
}

View File

@ -101,7 +101,7 @@
<!-- li items float right, so this one (last in DOM) sits LEFT of the Pending Jobs icon -->
@if (payrollTypeName) {
<li class="topbar-payroll-type-item">
<span class="topbar-payroll-type" kendoTooltip title="Current payroll type">{{payrollTypeName}}</span>
<span class="topbar-payroll-type" kendoTooltip title="Current payroll type and salary month">{{payrollTypeName}}@if (salaryMonth) {<span class="topbar-salary-month"> | {{salaryMonth | date:'MMMM-yyyy'}}</span>}</span>
</li>
}
</ul>

View File

@ -442,7 +442,7 @@
}
.topbar-payroll-type {
display: inline-block;
max-width: 260px;
max-width: 380px;
padding: 4px 12px;
border: 1px solid color-mix(in srgb, $color-white 35%, transparent);
border-radius: 999px;
@ -456,6 +456,9 @@
text-overflow: ellipsis;
cursor: default;
}
.topbar-salary-month {
font-weight: 500;
}
// Admin / super-user profile menu (Babylon li.user-profile > ul) drawn exactly like the ESS user
// menu (.ss-dd.ss-user-dd above): white card, 14px corners, soft shadow, header row with a divider,

View File

@ -59,6 +59,8 @@ export class AppTopBarComponent implements OnInit, DoCheck, OnDestroy {
// (EnumUserType.User) logins only. Re-read whenever the stored token changes
// (login, user switch, payroll-type switch, logout).
payrollTypeName: string = '';
// current salary month = the payroll type's nextPayProcessDate
salaryMonth: Date = null;
private payrollTypeToken: string | null | undefined = undefined;
private payrollTypeSub: Subscription | null = null;
@ -196,15 +198,18 @@ export class AppTopBarComponent implements OnInit, DoCheck, OnDestroy {
}
if (!user || user.UserType != EnumUserType.User || !user.PayrollTypeID) {
this.payrollTypeName = '';
this.salaryMonth = null;
return;
}
this.payrollTypeSub = this.authService.GetPayrollTypeByLoginID().subscribe({
next: (payrollType) => {
this.payrollTypeName = payrollType?.description ?? '';
this.salaryMonth = payrollType?.nextPayProcessDate ? new Date(payrollType.nextPayProcessDate) : null;
},
error: () => {
this.payrollTypeName = '';
this.salaryMonth = null;
},
});
}

View File

@ -117,6 +117,8 @@ export class DataUploadComponent implements OnInit, OnDestroy {
this.dataUploadColumnDefinition = undefined;
this.sheetName = undefined;
this.scolName = undefined;
this.htmlContent = undefined;
this.test = undefined;
this.uploadErrorOrSuccess = [];
this.uploadFileList = [];
this.dataUploadForm = new FormGroup({});
@ -174,6 +176,11 @@ export class DataUploadComponent implements OnInit, OnDestroy {
this.dataUploadColumnDefinition = undefined;
this.sheetName = undefined;
this.scolName = undefined;
// the component is reused across upload types: clear the previous page's columns and selection
this.htmlContent = undefined;
this.test = undefined;
this.itemid = undefined;
this.itemidTwo = undefined;
this.uploadErrorOrSuccess = [];
this.uploadFileList = [];
this.dataUploadForm = new FormGroup({});
@ -236,6 +243,8 @@ export class DataUploadComponent implements OnInit, OnDestroy {
name: x.description,
});
});
// events in alphabetical order
this.ItemData.sort((a, b) => (a.name || '').localeCompare(b.name || ''));
},
(x) => {
this.loadingPanel.ShowLoadingPanel = false;

View File

@ -193,11 +193,35 @@
kendoCheckBox
/>
</div>
<div class="col-12 lg:col-10" style="margin: auto">
<!-- with PF Percentage the label takes the left half, so PF Percentage sits beside it (under Effect Date) -->
<div class="col-12" [ngClass]="isPFPercentage == true ? 'lg:col-4' : 'lg:col-10'" style="margin: auto">
<label for="chkConfirmed">Is Confirmed</label>
</div>
}
@if (this.isPFPercentage == true) {
<div class="col-12 lg:col-1" style="margin: auto">
<label for="txtPFPercentage">PF Percentage</label>
</div>
<div class="col-12 lg:col-1" style="margin: auto" align="center">:</div>
<div class="col-12 lg:col-4">
<kendo-numerictextbox
id="txtPFPercentage"
[min]="0"
[max]="100"
[decimals]="2"
[format]="'n2'"
[(ngModel)]="_pfPercentage"
(valueChange)="SetFromDescription()"
style="width: 100%"
>
</kendo-numerictextbox>
</div>
@if (this.isShowConfirmed != true) {
<div class="col-12 lg:col-6"></div>
}
}
<!-- <ng-container *ngIf="this.isGrade == true && this.showCompanyProvidedCar == true">
<div class="col-12 lg:col-1" ></div>
<div class="col-12 lg:col-1" > <input type="checkbox" kendoCheckBox /></div>

View File

@ -99,6 +99,10 @@ export class LifeCycleEntryComponent implements OnInit {
public isShowConfirmed: boolean = false;
public isPFMember: boolean = false;
public isPFMemberDiscontinue: boolean = false;
public isPFPercentage: boolean = false;
public _pfPercentage: number = null;
// Logic XML confirmation/autopfmembership: confirming also makes the employee a Live PF member
public isAutoPFMembership: boolean = false;
public isCostCenter: boolean = false;
public isshoDistinueDate: boolean = false;
public isOrganogram: boolean = false;
@ -142,6 +146,10 @@ export class LifeCycleEntryComponent implements OnInit {
this.lifecycleService.GetByUserID().subscribe(
(resp: any) => {
this._employeeStatus = resp;
// events in alphabetical order
if (this._employeeStatus) {
this._employeeStatus.sort((a, b) => (a.description || '').localeCompare(b.description || ''));
}
},
(err: any) => {
console.log(err);
@ -150,6 +158,14 @@ export class LifeCycleEntryComponent implements OnInit {
}
);
this.lifecycleService.IsAutoPFMembership().subscribe(
(resp: any) => {
this.isAutoPFMembership = resp == true;
},
(err: any) => {
console.log(err);
}
);
}
@ -199,6 +215,8 @@ export class LifeCycleEntryComponent implements OnInit {
this.isShowConfirmed = false;
this.isPFMember = false;
this.isPFMemberDiscontinue = false;
this.isPFPercentage = false;
this._pfPercentage = null;
this.isCostCenter = false;
this.isPayrollType = false;
this.isComplain = false;
@ -329,6 +347,16 @@ export class LifeCycleEntryComponent implements OnInit {
}
});
// PF membership needs the employee's own PF %: the event makes the employee a Live PF member
// either through its PF_Member component, or through Confirm when autopfmembership is on
const hasPFMember = item.employeeStatusComponents.some(c => c.componentType == EnumLifeCycleComponent.PF_Member);
const hasConfirm = item.employeeStatusComponents.some(c => c.componentType == EnumLifeCycleComponent.Confirm);
if (hasPFMember || (hasConfirm && this.isAutoPFMembership == true)) {
this.isPFPercentage = true;
if (this.isEditLifeCycle) {
this._pfPercentage = this._empLifeCycle.pfPercentage;
}
}
if (!this.isEditLifeCycle) {
this._sDescription = item.description;
}
@ -662,6 +690,10 @@ export class LifeCycleEntryComponent implements OnInit {
this._sDescription += ' To ' + this._empLifeCycle.basicSalary;
}
if (this.isPFPercentage == true && this._pfPercentage != undefined && this._pfPercentage > 0) {
this._sDescription += '; PF Percentage ' + this._pfPercentage + '%';
}
this._empLifeCycle.HREmployee = new HrEmployee();
this._empLifeCycle.HREmployee.gender = this._employee.gender;
this._empLifeCycle.HREmployee.maritalStatus = this._employee.maritalStatus;
@ -857,6 +889,10 @@ export class LifeCycleEntryComponent implements OnInit {
this.notificationService.showWarning('Please check cofirmation');
bValid = false;
}
if (this.isPFPercentage == true && (this._pfPercentage == undefined || this._pfPercentage <= 0 || this._pfPercentage > 100)) {
this.notificationService.showWarning('Please enter PF Percentage (greater than 0 and up to 100).');
bValid = false;
}
return bValid;
}
@ -929,6 +965,7 @@ export class LifeCycleEntryComponent implements OnInit {
if (this.isPFMemberDiscontinue == true) {
this._empLifeCycle.pfMemberType = EnumPFMembershipType.DiscontinuedfromPayroll;
}
this._empLifeCycle.pfPercentage = this.isPFPercentage == true ? this._pfPercentage : null;
this._empLifeCycle.statusDetailID = this._selectedEventID;
const evt: EmployeeStatus = this._employeeStatus.find(x => x.id === this._selectedEventID);

View File

@ -542,6 +542,22 @@ namespace HRM.UI.Controllers
return Ok();
}
// Logic XML confirmation/autopfmembership -- the Life-Cycle entry screen shows
// PF Percentage for a confirmation event when it is on.
[HttpGet]
[Route("IsAutoPFMembership")]
public ActionResult IsAutoPFMembership()
{
try
{
return Ok(_lifeCycleService.IsAutoPFMembership());
}
catch (Exception ex)
{
return StatusCode(StatusCodes.Status500InternalServerError, ex.Message);
}
}
// Users allowed on one payroll type (UserAccessType) -- the Life-Cycle Event
// entry screen picks its approvers from this list.
[HttpGet]