diff --git a/HRM.UI/ClientApp/src/app/payroll/career-and-profile/life-cycle-entry/life-cycle-entry.component.ts b/HRM.UI/ClientApp/src/app/payroll/career-and-profile/life-cycle-entry/life-cycle-entry.component.ts index 09e14af..7ff1ea1 100644 --- a/HRM.UI/ClientApp/src/app/payroll/career-and-profile/life-cycle-entry/life-cycle-entry.component.ts +++ b/HRM.UI/ClientApp/src/app/payroll/career-and-profile/life-cycle-entry/life-cycle-entry.component.ts @@ -31,6 +31,7 @@ import { GrievanceManagementService } from '../../../_services/grievance-managem import { ActivatedRoute, Router } from '@angular/router'; import { WorkflowService } from '../../../_services/workflow/workflow.service'; import { AuthService } from '../../../_services/auth/auth.service'; +import { SystemConfigurationService } from '../../../_services/common/systemconfiguration.service'; @Component({ @@ -99,7 +100,10 @@ export class LifeCycleEntryComponent implements OnInit { public _selectedogranogram: OrganogramBasic; public _CurrentEmpgranogram: OrganogramBasic; public gradeSalaries: any; - + _MgtGradeCodes: string; + _MgtGradeCode: string[]; + _nonmanagementbasicdivisor: number; + _nonmanagementexcludedamount: number; constructor(public employeeService: EmployeeServices, public apiservice: ApiService, public basicDataService: BasicService, public lifecycleService: EmpLifeCycleServices, public notificationService: HRMNotificationService, @@ -108,7 +112,7 @@ export class LifeCycleEntryComponent implements OnInit { public loadingPanelService: loadingPanelService, public router: Router, public workflowService: WorkflowService, public authservice: AuthService, - public acrouter: ActivatedRoute,) { + public acrouter: ActivatedRoute, public systemConfigService: SystemConfigurationService) { if (this.router.url === '/payroll/career-and-profile/life-cycle-entry') this.apiservice.selectedMenuName = 'Employee Life Cycle'; @@ -150,6 +154,55 @@ export class LifeCycleEntryComponent implements OnInit { this.salaryMonth = new Date(this.payrollType.nextPayProcessDate); } ); + this.systemConfigService.GetLogicValue('grade', 'managementgradecodes').subscribe( + (resp) => { + + debugger; + if (resp != null && resp != '') + this._MgtGradeCodes = resp.toLowerCase(); + }, + (err) => { + this.notificationService.showError(err.err); + + this.loadingPanelService.ShowLoadingPanel = false; + }, + () => { + this._MgtGradeCode = this._MgtGradeCodes.split(','); + this.loadingPanelService.ShowLoadingPanel = false; + } + ); + this.systemConfigService.GetLogicValue('grade', 'nonmanagementbasicdivisor').subscribe( + (resp) => { + + debugger; + if (resp != null && resp != '') + this._nonmanagementbasicdivisor = Number(resp); + }, + (err) => { + this.notificationService.showError(err.err); + + this.loadingPanelService.ShowLoadingPanel = false; + }, + () => { + this.loadingPanelService.ShowLoadingPanel = false; + } + ); + this.systemConfigService.GetLogicValue('grade', 'nonmanagementexcludedamount').subscribe( + (resp) => { + + debugger; + if (resp != null && resp != '') + this._nonmanagementexcludedamount = Number(resp); + }, + (err) => { + this.notificationService.showError(err.err); + + this.loadingPanelService.ShowLoadingPanel = false; + }, + () => { + this.loadingPanelService.ShowLoadingPanel = false; + } + ); } private refreshGradeSalaries() { @@ -621,16 +674,23 @@ export class LifeCycleEntryComponent implements OnInit { if (entryType == "GrossSalary") { if (this._currentGrade != undefined && this.isGrade == false) { - if (this._currentGrade.basicPercentOfGross > 0) - this._empLifeCycle.basicSalary = this._empLifeCycle.grossSalary * - this._currentGrade.basicPercentOfGross / 100; + if (this._MgtGradeCode.includes(this._currentGrade.code.toUpperCase())) { + this._empLifeCycle.basicSalary = this._empLifeCycle.grossSalary * this._currentGrade.basicPercentOfGross / 100; + } + else if (this._currentGrade.basicPercentOfGross > 0) + this._empLifeCycle.basicSalary = Math.ceil(((this._empLifeCycle.grossSalary - this._nonmanagementexcludedamount) / this._nonmanagementbasicdivisor) * 100) / 100; + } else if (this.isGrade == true && this._empLifeCycle.gradeID != undefined) { if (this._empLifeCycle.gradeID != undefined) { var og = this._gradeList.find(x => x.id == this._empLifeCycle.gradeID); - if (og.basicPercentOfGross > 0) + if (this._MgtGradeCode.includes(og.code.toUpperCase())) { this._empLifeCycle.basicSalary = this._empLifeCycle.grossSalary * - og.basicPercentOfGross / 100; + og.basicPercentOfGross / 100; + } + else if (og.basicPercentOfGross > 0) + this._empLifeCycle.basicSalary = Math.ceil(((this._empLifeCycle.grossSalary - this._nonmanagementexcludedamount) / this._nonmanagementbasicdivisor) * 100) / 100; + } } }