HRM-10/HRM.UI/ClientApp/src/app/_models/Payroll/adparameter.ts
Mohaimen Hasan 838b8d4480 first commit
2026-11-03 13:06:00 +06:00

193 lines
6.0 KiB
TypeScript

import { EnumPeriodicity, EnumAllowOrDeduct, EnumArrearType, EnumADEmpType, EnumValueType, EnumEntitleType, EnumGender, EnumAuthStatus } from "../enums";
import { BaseObject } from '../Basic/baseObject';
import { AllowanceDeduction } from '../../_models/HRBasic/allowanceDeduction';
import { SearchEmployee } from '../../_models/Employee/searchEmployee';
export class ADParameter extends BaseObject
{
constructor() {
super();
this.allowDeductName = '';
this.isForConfirmOnly=false;
this.isFractionateApplicable=false;
this.flatAmount=0;
this.percentOfBasic=0;
this.percentOfEarnedBasic=0;
this.percentOfGross=0;
this.gFFlatAmount=0;
this.gFPercentOfBasic=0;
this.gFPercentOfGross=0;
this.minAmount=0;
this.maxAmount=0;
this.isCurrentlyActive = true;
this.taxablePercentage = 100;
this.isTaxable = false;
this.isFlatAmount = false;
this.isTaxProjection = false;
this.isDependsOnAttendance = false;
this.iSDEPENDSONSPECIALHOUR = false;
this.isDependsOnOTHour=false;
this.isWithException = false;
this.entitleType = EnumEntitleType.Grade;
this.allowOrDeductType = EnumAllowOrDeduct.Allowance;
this.gender = EnumGender.Regardless;
this.periodicity = EnumPeriodicity.Monthly;
// public AllowanceDeduction AllowanceDeduction { get; set; }
this.exception= [];
this.notApplicable=[];
this.adParameterGrades = [];
this.gradeNames='';
this.adParameterEmployees = [];
this.calculatedAmount = 0;
}
allowDeductID: number;
allowDeductName: string;
payrollTypeID: number;
isForConfirmOnly: boolean;
isFractionateApplicable: boolean;
flatAmount: number;
percentOfBasic: number;
percentOfEarnedBasic: number;
percentOfGross: number;
gFFlatAmount: number;
gFPercentOfBasic: number;
gFPercentOfGross: number;
minAmount: number;
maxAmount: number;
isCurrentlyActive: boolean
taxablePercentage: number;
isTaxable: boolean
isFlatAmount: boolean;
isTaxProjection: boolean;
isDependsOnAttendance: boolean;
iSDEPENDSONSPECIALHOUR: boolean;
isDependsOnOTHour: boolean;
isWithException: boolean;
periodicity: EnumPeriodicity
entitleType: EnumEntitleType;
allowOrDeductType: EnumAllowOrDeduct;
gender: EnumGender;
// public AllowanceDeduction AllowanceDeduction { get; set; }
exception: ADParameterEmployee[] =[];
notApplicable: ADParameterEmployee[]=[];
adParameterGrades: ADParameterGrade[]=[];
gradeNames: string;
adParameterEmployees: ADParameterEmployee[]=[];
calculatedAmount: number;
approvalStatus: EnumAuthStatus;
CalculateAmount(asparam: ADParameter, employeeid: number, basicSalary: number, grossSalary: number): number {
//console.log(asparam);
var amount: number=0;
if (asparam.percentOfBasic > 0) {
amount = asparam.flatAmount + (asparam.percentOfBasic * basicSalary) / 100;
}
else if (asparam.percentOfGross > 0) {
amount = asparam.flatAmount + (asparam.percentOfGross * grossSalary) / 100;
}
else {
amount = asparam.flatAmount;
}
if (asparam.minAmount != 0 || asparam.maxAmount != 0) {
if (amount < asparam.minAmount) {
amount = asparam.minAmount;
}
if (amount > asparam.maxAmount) {
amount = asparam.maxAmount;
}
}
if (asparam.exception != undefined && asparam.exception.length > 0)
if (asparam.exception.findIndex(x => x.employeeID == employeeid) > -1)
amount = asparam.exception.find(ex => ex.employeeID == employeeid).monthlyAmount;
if (asparam.notApplicable != undefined && asparam.notApplicable.length > 0)
if (asparam.notApplicable.findIndex(x => x.employeeID == employeeid) > -1)
amount = 0;
return amount;
}
}
export class ADParameterGrade {
constructor() {
this.ADParameterID = 0;
this.gradeID = 0;
this.AllowDeductID = 0;
}
public ADParameterID: number;
public gradeID: number;
public AllowDeductID: number;
}
export class ADParameterEmployee extends BaseObject
{
constructor() {
super();
this.adParameterID = 0;
this.allowDeductID = 0;
this.periodicity = EnumPeriodicity.RegardLess;
this.employeeID = 0;
this.monthlyAmount = 0;
this.oldAmount = 0;
this.TotalAmount = 0;
this.arreartype = EnumArrearType.Regardless;
this.disburseAmount = 0;
this.tracNo = '';
this.adEmpType = EnumADEmpType.AppliedToIndividual;
this.allowDeductName = '';
this.durationStr = '-';
this.approvedby = 0;
this.approvedDate = new Date();
this.approvalStatus = EnumAuthStatus.New_Not_Yet_Approve;
this.adDescription = '';
this.remarks = '';
}
adParameterID: number;
allowDeductID: number;
allowDeductName: string;
// public AllowanceDeduction AllowDeduct { get; set; }
periodicity: EnumPeriodicity;
employeeName: string;
employeeNo: string;
employeeID: number;
formDate: Date;
tillDate?: Date;
oldFormDate?: Date;
oldTillDate?: Date;
disburseAmount: number;
monthlyAmount: number;
oldAmount: number;
TotalAmount: number;
arreartype: EnumArrearType;
adEmpType: EnumADEmpType;
valueType: EnumValueType;
tracNo: string;
remarks: string;
durationStr: string;
approvedby: number;
approvedDate: Date;
approvalStatus: EnumAuthStatus;
adDescription: string;
////for editing purpose
//moduleName: string;
//selectedMenuName: string;
//defaultItem: string;
//_allowdeductType: EnumAllowOrDeduct;
//_selectedEmployee: SearchEmployee;
//_checkedToDate: boolean;
}