49 lines
1.2 KiB
TypeScript
49 lines
1.2 KiB
TypeScript
|
|
import api, { unwrap } from './request';
|
||
|
|
|
||
|
|
export interface AccountingJournalResp extends Record<string, unknown> {
|
||
|
|
entryId: number;
|
||
|
|
journalNo?: string;
|
||
|
|
agentId?: number;
|
||
|
|
agentName?: string;
|
||
|
|
contractNo?: string;
|
||
|
|
settleMonth?: string;
|
||
|
|
accountCode: string;
|
||
|
|
accountName?: string;
|
||
|
|
debitAmount: number;
|
||
|
|
creditAmount: number;
|
||
|
|
description?: string;
|
||
|
|
status?: string;
|
||
|
|
statusName?: string;
|
||
|
|
closedAt?: string;
|
||
|
|
createdAt?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface AccountingGenerateReq {
|
||
|
|
settleMonth: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface AccountingCloseReq {
|
||
|
|
journalNo: string;
|
||
|
|
entryIds: number[];
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface AccountingSearchParam {
|
||
|
|
settleMonth?: string;
|
||
|
|
journalNo?: string;
|
||
|
|
agentName?: string;
|
||
|
|
status?: string;
|
||
|
|
pageNum?: number;
|
||
|
|
pageSize?: number;
|
||
|
|
}
|
||
|
|
|
||
|
|
export const accountingApi = {
|
||
|
|
list: (params?: AccountingSearchParam) =>
|
||
|
|
unwrap<{ list: AccountingJournalResp[]; total: number }>(
|
||
|
|
api.get('/api/accounting-entries', { params })
|
||
|
|
),
|
||
|
|
generate: (req: AccountingGenerateReq) =>
|
||
|
|
unwrap<void>(api.post('/api/accounting-entries/generate', req)),
|
||
|
|
close: (req: AccountingCloseReq) =>
|
||
|
|
unwrap<void>(api.put('/api/accounting-entries/close', req)),
|
||
|
|
};
|