EchoTex_Payroll/HRM.UI/ClientApp/src/app/_services/payroll/salary.service.ts
2025-01-09 12:03:52 +06:00

245 lines
13 KiB
TypeScript

import { Injectable } from '@angular/core';
import {ApiService} from '../../app.api.service';
import {SalaryMonthly} from '../../_models/Payroll/salaryMonthly';
import {EnumIncomeTaxDataFrom, EnumSalaryGroup, EnumSalaryItemCode} from '../../_models/enums';
import {SalaryEmpCostCenter} from '../../_models/Payroll/salaryEmpCostCenter';
import {SalaryMonthlyDetail} from '../../_models/Payroll/salaryMonthlyDetail';
import {SalaryProcess, SalaryProcessStatus} from '../../_models/Payroll/salaryProcess';
import { SearchEmployee } from '../../_models/Employee/searchEmployee';
import { PayrollComponentList } from '../../_models/Attendance/PayrollComponentList';
import { Observable } from 'rxjs';
import { HttpEvent } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class SalaryService {
constructor(public apiService: ApiService) {
}
// salary Monthly
getSalaryMonthlyById(id: number) {
return this.apiService.httpGet<SalaryMonthly>(this.apiService.base_url + '/getSalaryMonthlyById' + '/' + id);
}
getLastPaidSalaryMonth(empId: number) {
return this.apiService.httpGet<SalaryMonthly>(this.apiService.base_url + '/getLastPaidSalaryMonth' + '/' + empId);
}
updateSalaryMonthly(params: any) {
return this.apiService.httpPost( '/salary/updateSalaryMonthly', params);
}
updateDetail(params: any) {
return this.apiService.httpPost<SalaryMonthly>(this.apiService.base_url + '/updateDetail', params);
}
saveSalaryMonthly(params: any) {
return this.apiService.httpPost<number>('/salary/saveSalaryMonthly', params);
}
deleteSalaryMonthly(id: number) {
return this.apiService.httpPost<SalaryMonthly>(this.apiService.base_url + '/deleteSalaryMonthly', id);
}
// payrollType ID
getSumOnRange(employeeId: number, fromDate: Date, toDate: Date, groupCode: EnumSalaryGroup, itemCode: EnumSalaryItemCode,
itemId: number) {
return this.apiService.httpGet(this.apiService.base_url + '/getSumOnRange' + '/' + employeeId + '/' + fromDate +
'/' + toDate + '/' + groupCode + '/' + itemCode + '/' + itemId);
}
// payrollType ID
getSumOnRangeOnRound(employeeId: number, fromDate: Date, toDate: Date, groupCode: EnumSalaryGroup, itemCode: EnumSalaryItemCode,
itemId: number) {
return this.apiService.httpGet(this.apiService.base_url + '/getSumOnRangeOnRound' + '/' + employeeId + '/' + fromDate +
'/' + toDate + '/' + groupCode + '/' + itemCode + '/' + itemId);
}
getSalaryMonthlyByEmpId(empId: number, dateTime: Date) {
return this.apiService.httpGet<SalaryMonthly>( '/salary/getSalaryMonthlyByEmpId' + '/' + empId + '/' + dateTime);
}
// payrollType ID
getSalaryMonthlyList(salaryMonth: Date) {
return this.apiService.httpGet<SalaryMonthly[]>(this.apiService.base_url + '/getSalaryMonthlyList' + '/' + salaryMonth);
}
// payrollType ID
getForJV(salaryMonth: Date) {
return this.apiService.httpGet<SalaryMonthly[]>(this.apiService.base_url + '/getForJV' + '/' + salaryMonth);
}
// payrollType ID
getSalaryMonthlyListByEmpId(empId: string, salaryMonth: Date) {
return this.apiService.httpGet<SalaryMonthly[]>( '/salary/getSalaryMonthlyList' + '/' + empId + '/' + salaryMonth);
}
// payrollType ID
getForWTP(empId: string, salaryMonth: Date) {
return this.apiService.httpGet<SalaryMonthly[]>(this.apiService.base_url + '/getForWTP' + '/' + empId + '/' + salaryMonth);
}
getForCC(salaryMonthId: number) {
return this.apiService.httpGet<SalaryEmpCostCenter[]>(this.apiService.base_url + '/getForCC' + '/' + salaryMonthId);
}
getCostCenterList(salaryMonth: Date) {
return this.apiService.httpGet<SalaryEmpCostCenter[]>(this.apiService.base_url + '/getCostCenterList' + '/' + salaryMonth);
}
getUnAuthorizeAmountOnDateRange(employeeId: number, fromDate: Date, toDate: Date, groupCode: EnumSalaryGroup) {
return this.apiService.httpGet(this.apiService.base_url + '/getSumOnRangeOnRound' + '/' + employeeId + '/' + fromDate +
'/' + toDate + '/' + groupCode);
}
isSalaryProcessed(employeeId: number, salaryMonth: Date) {
return this.apiService.httpGet(this.apiService.base_url + '/isSalaryProcessed' + '/' + employeeId + '/' + salaryMonth);
}
// payroll type lagbe
isSalaryProcessedWeb(salaryMonth: Date) {
return this.apiService.httpGet(this.apiService.base_url + '/isSalaryProcessedWeb' + '/' + salaryMonth);
}
// payroll type lagbe
isPermanentEmp(employeeId: number, salaryMonth: Date) {
return this.apiService.httpGet(this.apiService.base_url + '/isPermanentEmp' + '/' + employeeId + '/' + salaryMonth);
}
isSalaryProcessedAndFinalized(employeeId: number, salaryMonth: Date, isProcessed: boolean, isFinalized: boolean) {
return this.apiService.httpGet(this.apiService.base_url + '/isSalaryProcessedAndFinalized' + '/' + employeeId + '/' + salaryMonth +
'/' + isProcessed + '/' + isFinalized);
}
getUnAuthorizeDays(employeeId: number, salaryMonth: Date) {
return this.apiService.httpGet(this.apiService.base_url + '/getUnAuthorizeDays' + '/' + employeeId + '/' + salaryMonth);
}
getSalaryDetailList(salaryMonthlyId: number) {
return this.apiService.httpGet<SalaryMonthlyDetail[]>(this.apiService.base_url + '/getSalaryDetailList' + '/' + salaryMonthlyId)
}
getSalaryDetailListBySalaryMonthlyIds(salaryMonthlyIds: string) {
return this.apiService.httpGet<SalaryMonthlyDetail[]>(this.apiService.base_url + '/getSalaryDetailListBySalaryMonthlyIds' + '/' + salaryMonthlyIds);
}
getTotalEmp(salaryProcessId: number) {
return this.apiService.httpGet(this.apiService.base_url + '/getTotalEmp' + '/' + salaryProcessId);
}
// payroll type Id
getAmountOnDateDiff(employeeId: number, fromDate: Date, toDate: Date, groupCode: EnumSalaryGroup, itemCode: EnumSalaryItemCode,
itemId: number) {
return this.apiService.httpGet(this.apiService.base_url + '/getAmountOnDateDiff' + '/' + employeeId + '/' + fromDate
+ '/' + toDate + '/' + groupCode + '/' + itemCode + '/' + itemId);
}
getThisMonthBasicOnDateDiff(employeeId: number, fromDate: Date, toDate: Date, groupCode: EnumSalaryGroup, itemCode: EnumSalaryItemCode,
itemId: number) {
return this.apiService.httpGet(this.apiService.base_url + '/getThisMonthBasicOnDateDiff' + '/' + employeeId + '/' + fromDate
+ '/' + toDate + '/' + groupCode + '/' + itemCode + '/' + itemId);
}
getAmountOnDateDiffForOverTime(employeeId: number, fromDate: Date, toDate: Date, groupCode: EnumSalaryGroup, itemCode: EnumSalaryItemCode,
itemId: number) {
return this.apiService.httpGet(this.apiService.base_url + '/getAmountOnDateDiffForOverTime' + '/' + employeeId + '/' + fromDate
+ '/' + toDate + '/' + groupCode + '/' + itemCode + '/' + itemId);
}
getAmountOnDateDiffForAll(employeeId: number, fromDate: Date, toDate: Date) {
return this.apiService.httpGet(this.apiService.base_url + '/getAmountOnDateDiffForOverTime' + '/' + employeeId + '/' + fromDate
+ '/' + toDate);
}
getPrvTaxAmount(dataForm: EnumIncomeTaxDataFrom, employeeId: number, fromDate: Date, toDate: Date) {
return this.apiService.httpGet(this.apiService.base_url + '/getPrvTaxAmount' + '/' + employeeId + '/' + fromDate
+ '/' + toDate);
}
getByDateRange(startDate: Date, endDate: Date) {
return this.apiService.httpGet<SalaryMonthly[]>(this.apiService.base_url + '/getByDateRange' + '/' + startDate + '/' + endDate);
}
getByDateRangeByEmpId(empId: number, startDate: Date, endDate: Date) {
return this.apiService.httpGet<SalaryMonthly[]>(this.apiService.base_url + '/getByDateRange' + '/' + empId + '/' + startDate + '/' + endDate);
}
getHead(index: number, salaryMonth: Date) {
return this.apiService.httpGet<SalaryMonthlyDetail[]>(this.apiService.base_url + '/getHead' + '/' + index + '/' + salaryMonth);
}
getSalaryMonthlyByDateRange(empId: string, fromDate: Date, toDate: Date) {
return this.apiService.httpGet<SalaryMonthly[]>(this.apiService.base_url + '/getSalaryMonthlyByDateRange' + '/' +
empId + '/' + fromDate + '/' + toDate);
}
getByProcessID(processId: number) {
return this.apiService.httpGet<[SalaryMonthly]>(this.apiService.base_url + '/getByProcessID' + '/' + processId);
}
isSalaryProcessedAndFinalizedByDateRange(dateTime: Date, isProcessed: boolean, isFinalized: boolean) {
return this.apiService.httpGet(this.apiService.base_url + '/isSalaryProcessedAndFinalizedByDateRange' +
'/' + dateTime + '/' + isProcessed + '/' + isFinalized);
}
// SalaryProcess
getSalaryProcessById(id: number) {
return this.apiService.httpGet<SalaryProcess>(this.apiService.base_url + '/getSalaryProcessById' + '/' + id);
}
getSalaryProcessWithPayrollType() {
return this.apiService.httpGet<SalaryProcess[]>(this.apiService.base_url + '/getSalaryProcessWithPayrollType');
}
getAllSalaryProcess() {
return this.apiService.httpGet<SalaryProcess[]>(this.apiService.base_url + '/getAllSalaryProcess');
}
// payrollType lagbe
getSalaryProcessBySMonth(month: Date) {
return this.apiService.httpGet<SalaryProcess[]>(this.apiService.base_url + '/getAllSalaryProcess');
}
saveSalaryProcess(params: any) {
return this.apiService.httpPost(this.apiService.base_url + '/saveSalaryProcess', params);
}
deleteSalaryProcessById(id: number) {
return this.apiService.httpPost(this.apiService.base_url + '/deleteSalaryProcessById', id);
}
undoSalaryProcessById(item: SalaryProcess) {
return this.apiService.httpPost('/salary/undoSalaryProcessById', item);
}
undoMonthlySalaryProcessById(id: string) {
return this.apiService.httpPost(this.apiService.base_url + '/undoMonthlySalaryProcessById', id);
}
undoMonthlySalaryProcessByEmpId(emp: SearchEmployee[]) {
return this.apiService.httpPost('/salary/undoMonthlySalaryProcessByEmpId', emp);
}
updateSalaryProcess(params: any) {
return this.apiService.httpPost(this.apiService.base_url + '/updateSalaryProcess', params);
}
GetUnApprovedSalaries() {
return this.apiService.httpGet<SalaryProcess[]>('/salary/GetUnApprovedSalaries');
}
GetWithheldData(param: any) {
return this.apiService.httpPost<any>('/salary/GetWithheldData/', param);
}
Updatepayment(param: any) {
return this.apiService.httpPost<any>('/salary/Updatepayment/', param);
}
salaryValidation(params: any) {
return this.apiService.httpPost<SalaryProcessStatus[]>('/salary/salaryValidation', params);
}
salaryProcess(params: any) {
return this.apiService.httpPost<SalaryProcessStatus[]>('/salary/SalaryProcess', params);
}
salaryProcessApprove(params: any) {
return this.apiService.httpPost(this.apiService.base_url + '/salaryProcessApprove', params);
}
getSalaryProcessByMonthAndPayrollTypeId(month: Date) {
return this.apiService.httpGet<SalaryProcess[]>(this.apiService.base_url + '/getSalaryProcessByMonthAndPayrollTypeId' + '/'
+ month);
}
salaryProcessMonthEnd(param: any) {
return this.apiService.httpPost('/salary/salaryProcessMonthEnd', param);
}
getAllSalaryProcessByNextPayProcessDate(nextPayProcessDate: Date) {
return this.apiService.httpGet<SalaryProcess[]>(this.apiService.base_url + '/getAllSalaryProcessByNextPayProcessDate'
+ '/' + nextPayProcessDate);
}
ConstantItemsForSalary() {
return this.apiService.httpGet<PayrollComponentList[]>('/salary/ConstantItemsForSalary');
}
GetNetAmountofCurrentMonth() {
return this.apiService.httpGet<any>('/salary/GetNetAmountofCurrentMonth');
}
ApproveSalary(param: any) {
return this.apiService.httpPost<any>('/salary/ApproveSalary', param);
}
sendEmailForMultiple(param: any) {
return this.apiService.httpPost<any>('/salary/SendEmailForMultiple', param);
}
sendPayslipForMultiple(param: any) {
return this.apiService.httpPost<any>('/salary/sendPayslipForMultiple', param);
}
getBasicSalaryOfEmployee(id: number) {
return this.apiService.httpGet<string>('/salary/getBasicSalaryOfEmployee' + '/' + id);
}
DownloadPayslipForMultiple(param: any): Observable<HttpEvent<any>> {
return this.apiService.httpPost<any>('/salary/DownloadPayslipForMultiple', param);
}
IsSalaryProcessed(salaryMonth: Date) {
return this.apiService.httpGet<boolean>('/salary' + '/IsSalaryprocessedMonthly' + '/' + salaryMonth.toDateString());
}
}