intigrate others sales , return and implement day end duntinalities
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
// Cashier day-end close-out (docs/14 Sales API). Preview shows what closing right now
|
||||
// would include (or the existing close, if already closed); close is the one-shot,
|
||||
// idempotent action that locks the day's Posted slips and posts the consolidated GL entry.
|
||||
import { apiRequest, buildQuery } from "@/lib/api-client"
|
||||
import { PagedResponse } from "@/types/common"
|
||||
import { CreateSalesDayEndRequest, SalesDayEnd, SalesDayEndPreview, SalesDayEndSummary } from "@/types/sales"
|
||||
|
||||
export interface ListSalesDayEndsParams {
|
||||
page?: number
|
||||
pageSize?: number
|
||||
cashierUserId?: number
|
||||
}
|
||||
|
||||
export const salesDayEndApi = {
|
||||
list(params: ListSalesDayEndsParams = {}): Promise<PagedResponse<SalesDayEndSummary>> {
|
||||
return apiRequest<PagedResponse<SalesDayEndSummary>>(`/sales-day-end${buildQuery(params)}`)
|
||||
},
|
||||
|
||||
get(salesDayEndId: number): Promise<SalesDayEnd> {
|
||||
return apiRequest<SalesDayEnd>(`/sales-day-end/${salesDayEndId}`)
|
||||
},
|
||||
|
||||
preview(cashierUserId: number, businessDate?: string): Promise<SalesDayEndPreview> {
|
||||
return apiRequest<SalesDayEndPreview>(`/sales-day-end/preview${buildQuery({ cashierUserId, businessDate })}`)
|
||||
},
|
||||
|
||||
/** Idempotent — closing an already-closed date replays the existing record. */
|
||||
close(request: CreateSalesDayEndRequest): Promise<SalesDayEnd> {
|
||||
return apiRequest<SalesDayEnd>("/sales-day-end", { method: "POST", body: request })
|
||||
},
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
import { apiRequest, apiRequestWithETag, buildQuery } from "@/lib/api-client"
|
||||
import { ApiResult, PagedResponse } from "@/types/common"
|
||||
import {
|
||||
CreateSalesInvoicePaymentRequest,
|
||||
CreateSalesInvoiceRequest,
|
||||
CreateSalesSlipRequest,
|
||||
SalesInvoice,
|
||||
SalesInvoiceStatus,
|
||||
SalesInvoicePayment,
|
||||
SalesInvoicePostingCheck,
|
||||
SalesInvoiceSummary,
|
||||
SalesListFilterParams,
|
||||
@@ -65,6 +67,16 @@ export const salesApi = {
|
||||
return apiRequest<SalesInvoice>(`/sales-invoices/${salesInvoiceId}/cancel`, { method: "POST" })
|
||||
},
|
||||
|
||||
/** Pay the customer's balance against a posted invoice, in full or in installments. Posts a real GL journal entry. */
|
||||
payInvoice(salesInvoiceId: number, request: CreateSalesInvoicePaymentRequest): Promise<SalesInvoicePayment> {
|
||||
return apiRequest<SalesInvoicePayment>(`/sales-invoices/${salesInvoiceId}/payments`, { method: "POST", body: request })
|
||||
},
|
||||
|
||||
/** Payment history for an invoice, newest first. */
|
||||
listInvoicePayments(salesInvoiceId: number): Promise<SalesInvoicePayment[]> {
|
||||
return apiRequest<SalesInvoicePayment[]>(`/sales-invoices/${salesInvoiceId}/payments`)
|
||||
},
|
||||
|
||||
listSlips(params: ListSalesSlipsParams = {}): Promise<PagedResponse<SalesSlipSummary>> {
|
||||
return apiRequest<PagedResponse<SalesSlipSummary>>(`/sales-slips${buildQuery(params)}`)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user