mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 05:22:02 +00:00
feat(FE): Add finance report API and customer payment types
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { BaseApiService } from '@/services/api/base';
|
||||
import { BaseApiResponse } from '@/types/api/api-general';
|
||||
import { CustomerPaymentReport } from '@/types/api/report/customer-payment';
|
||||
|
||||
export class FinanceApiService extends BaseApiService<
|
||||
CustomerPaymentReport,
|
||||
unknown,
|
||||
unknown
|
||||
> {
|
||||
constructor(basePath: string) {
|
||||
super(basePath);
|
||||
}
|
||||
|
||||
async getCustomerPaymentReport(
|
||||
customer_id?: string,
|
||||
sales?: string,
|
||||
date_type?: 'do_date' | 'payment_date',
|
||||
start_date?: string,
|
||||
end_date?: string,
|
||||
page?: number,
|
||||
limit?: number
|
||||
): Promise<BaseApiResponse<CustomerPaymentReport> | undefined> {
|
||||
return await this.customRequest<BaseApiResponse<CustomerPaymentReport>>(
|
||||
`customer-payment`,
|
||||
{
|
||||
method: 'GET',
|
||||
params: {
|
||||
customer_id: customer_id,
|
||||
sales: sales,
|
||||
date_type: date_type,
|
||||
start_date: start_date,
|
||||
end_date: end_date,
|
||||
page: page,
|
||||
limit: limit,
|
||||
},
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export const FinanceApi = new FinanceApiService('reports');
|
||||
|
||||
// export const FinanceApi = new FinanceApiService(
|
||||
// 'http://localhost:4010/api/reports/finance'
|
||||
// );
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
import { BaseMetadata } from '@/types/api/api-general';
|
||||
import { BaseCustomer } from '@/types/api/master-data/customer';
|
||||
import { BaseProduct } from '@/types/api/master-data/product';
|
||||
|
||||
export type CustomerPaymentRow = {
|
||||
no: number;
|
||||
do_date: string;
|
||||
payment_date: string;
|
||||
realization_date: string;
|
||||
aging: number;
|
||||
reference: string;
|
||||
vehicle_plate: string;
|
||||
qty: number;
|
||||
weight: number;
|
||||
average_weight: number;
|
||||
price: number;
|
||||
credit_note: number;
|
||||
final_price: number;
|
||||
ppn: number;
|
||||
total: number;
|
||||
payment: number;
|
||||
accounts_receivable: number;
|
||||
notes: string;
|
||||
pickup_info: string;
|
||||
sales_marketing: string;
|
||||
product?: BaseProduct;
|
||||
};
|
||||
|
||||
export type CustomerPaymentSummary = {
|
||||
total_qty: number;
|
||||
total_weight: number;
|
||||
total_initial_amount: number;
|
||||
total_credit_note: number;
|
||||
total_final_amount: number;
|
||||
total_ppn: number;
|
||||
total_grand_amount: number;
|
||||
total_payment: number;
|
||||
total_accounts_receivable: number;
|
||||
};
|
||||
|
||||
export type CustomerPaymentReport = BaseMetadata & {
|
||||
customer: BaseCustomer;
|
||||
customer_npwp: string;
|
||||
customer_address: string;
|
||||
rows: CustomerPaymentRow[];
|
||||
summary: CustomerPaymentSummary;
|
||||
};
|
||||
Reference in New Issue
Block a user