HRM-10/HRM.UI/ClientApp/src/app/_services/payroll/lfa.service.ts
Mohaimen Hasan 88235461bf LFA
2026-11-26 10:48:45 +06:00

47 lines
1.9 KiB
TypeScript

import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { ApiService } from '../../app.api.service';
import {
LFAPaymentHistory, LFAPaymentInfo, LFAPaymentProcessResult, LFAPaymentReadResult, LFAPaymentRequest
} from '../../_models/Payroll/lfaPayment';
@Injectable({
providedIn: 'root'
})
export class LFAService {
constructor(public apiService: ApiService) {
}
/** The current salary month and the next batch number. */
getPaymentInfo(): Observable<LFAPaymentInfo> {
return this.apiService.httpGet<LFAPaymentInfo>('/lfa/getPaymentInfo');
}
downloadTemplate(): Observable<Blob> {
return this.apiService.httpGetBlob('/dataUpload/lfa-payment-upload-template');
}
/** Reads a filled template on the server and returns the calculated employees. Nothing is saved. */
readUpload(file: File, paymentDate: string): Observable<LFAPaymentReadResult> {
const formData = new FormData();
formData.append('excelfile', file, file.name);
formData.append('paymentDate', paymentDate);
return this.apiService.httpPostBlob('/dataUpload/lfa-payment-upload-read', formData);
}
calculatePayment(request: LFAPaymentRequest): Observable<LFAPaymentReadResult> {
return this.apiService.httpPost<LFAPaymentReadResult>('/lfa/calculatePayment', request);
}
/** Saves the rows as a new batch, all or nothing. The server calculates every row again. */
processPayment(request: LFAPaymentRequest): Observable<LFAPaymentProcessResult> {
return this.apiService.httpPost<LFAPaymentProcessResult>('/lfa/processPayment', request);
}
/** Dates as yyyy-MM-dd. */
getPaymentHistory(fromDate: string, toDate: string): Observable<LFAPaymentHistory[]> {
return this.apiService.httpGet<LFAPaymentHistory[]>('/lfa/getPaymentHistory/' + fromDate + '/' + toDate);
}
}