sales & grn fixers
This commit is contained in:
@@ -10,6 +10,9 @@ export interface ListCustomersParams {
|
||||
q?: string
|
||||
status?: EntityStatus
|
||||
customerType?: CustomerType
|
||||
/** The system cash customer (walk-in / one-time buyers) is left out by default — pass true only
|
||||
* where the list is used to resolve names for existing documents. */
|
||||
includeCashCustomer?: boolean
|
||||
}
|
||||
|
||||
export const customersApi = {
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// GRN configuration. Singleton - no id. A saved `defaultWarehouseId` pins every GRN to that
|
||||
// warehouse (the server forces it too); with none saved, New GRN shows a warehouse picker.
|
||||
import { apiRequestWithETag } from "@/lib/api-client"
|
||||
import { ApiResult } from "@/types/common"
|
||||
import { GrnConfig, UpdateGrnConfigRequest } from "@/types/grn"
|
||||
|
||||
export const grnConfigApi = {
|
||||
get(): Promise<ApiResult<GrnConfig>> {
|
||||
return apiRequestWithETag<GrnConfig>("/grn-config")
|
||||
},
|
||||
|
||||
update(request: UpdateGrnConfigRequest, ifMatch: string): Promise<ApiResult<GrnConfig>> {
|
||||
return apiRequestWithETag<GrnConfig>("/grn-config", { method: "PUT", body: request, ifMatch })
|
||||
},
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { apiRequest, apiRequestWithETag, buildQuery } from "@/lib/api-client"
|
||||
import { ApiResult, PagedResponse } from "@/types/common"
|
||||
import {
|
||||
CreateBulkSalesInvoicePaymentRequest,
|
||||
CreateSalesInvoicePaymentRequest,
|
||||
CreateSalesInvoiceRequest,
|
||||
CreateSalesSlipRequest,
|
||||
@@ -20,6 +21,7 @@ import {
|
||||
SalesSlipStatus,
|
||||
SalesSlipPostingCheck,
|
||||
SalesSlipSummary,
|
||||
SalesItemStock,
|
||||
SalesStockAvailability,
|
||||
SalesSuggestedPrice,
|
||||
UpdateSalesInvoiceRequest,
|
||||
@@ -58,6 +60,11 @@ export const salesApi = {
|
||||
return apiRequest<SalesStockAvailability>(`/sales-invoices/stock-availability${buildQuery({ itemId, warehouseId })}`)
|
||||
},
|
||||
|
||||
/** Issuable stock for every item at a warehouse — New Sale's "Add item" dropdown. */
|
||||
getStockSummary(warehouseId: number): Promise<SalesItemStock[]> {
|
||||
return apiRequest<SalesItemStock[]>(`/sales-invoices/stock-summary${buildQuery({ warehouseId })}`)
|
||||
},
|
||||
|
||||
getInvoice(salesInvoiceId: number): Promise<ApiResult<SalesInvoice>> {
|
||||
return apiRequestWithETag<SalesInvoice>(`/sales-invoices/${salesInvoiceId}`)
|
||||
},
|
||||
@@ -87,6 +94,11 @@ export const salesApi = {
|
||||
return apiRequest<SalesInvoicePayment>(`/sales-invoices/${salesInvoiceId}/payments`, { method: "POST", body: request })
|
||||
},
|
||||
|
||||
/** Pay several invoices of one customer in one go — one GL journal; returns a payment per invoice/account split. */
|
||||
payInvoicesBulk(request: CreateBulkSalesInvoicePaymentRequest): Promise<SalesInvoicePayment[]> {
|
||||
return apiRequest<SalesInvoicePayment[]>("/sales-invoices/payments/bulk", { method: "POST", body: request })
|
||||
},
|
||||
|
||||
/** Payment history for an invoice, newest first. */
|
||||
listInvoicePayments(salesInvoiceId: number): Promise<SalesInvoicePayment[]> {
|
||||
return apiRequest<SalesInvoicePayment[]>(`/sales-invoices/${salesInvoiceId}/payments`)
|
||||
|
||||
Reference in New Issue
Block a user