Add migration to include AccruedExpensesCode in gl_account_config table

- Introduced a new column 'AccruedExpensesCode' of type varchar(20) to the 'gl_account_config' table.
- Added SQL command to update existing records with a default value of '2300' for the 'AccruedExpensesCode' where it is currently null.
This commit is contained in:
Dhananjaya99
2026-10-18 16:21:38 +05:30
parent dcdb628647
commit a0793b35d3
31 changed files with 23185 additions and 94 deletions
@@ -13,6 +13,10 @@ export interface ListAdjustmentsParams {
branchId?: number
reasonCodeId?: number
status?: AdjustmentStatus
/** Only wastage: adjustments with a damage / theft / expiry reason code. */
wastage?: boolean
/** Only adjustments with a line for this item. */
itemId?: number
sort?: string
}
+8 -7
View File
@@ -44,6 +44,8 @@ export interface WastageRecord {
}
export interface ListWastageParams {
/** Only this item's wastage (the product page). */
itemId?: number
warehouseId?: number
branchId?: number
reasonCodeId?: number
@@ -71,20 +73,19 @@ export const wastageApi = {
* because the adjustment page is already bounded.
*/
async list(params: ListWastageParams = {}): Promise<WastageRecord[]> {
const wastageIds = new Set(await wastageReasonCodeIds())
if (wastageIds.size === 0) return []
// The API filters by a single reasonCodeId, so a specific pick can be pushed down;
// otherwise fetch the page and keep the loss-type rows.
// The server returns only wastage (damage / theft / expiry reasons), newest first, so a busy adjustment history
// can't push the wastage out of the page the way a browser-side filter over mixed adjustments could.
const res = await stockAdjustmentsApi.list({
warehouseId: params.warehouseId,
branchId: params.branchId,
reasonCodeId: params.reasonCodeId,
itemId: params.itemId,
wastage: true,
page: params.page,
pageSize: params.pageSize ?? 50,
})
// A rejected or withdrawn request never wrote anything off.
const summaries = res.items.filter((a) => wastageIds.has(a.reasonCodeId) && a.status !== "Rejected" && a.status !== "Cancelled")
const summaries = res.items.filter((a) => a.status !== "Rejected" && a.status !== "Cancelled")
const detailed = await Promise.all(
summaries.map(async (summary) => {
@@ -94,7 +95,7 @@ export const wastageApi = {
])
return adjustment.lines
.filter((line) => line.qtyDelta < 0) // wastage is always a decrease
.filter((line) => line.qtyDelta < 0 && (params.itemId === undefined || line.itemId === params.itemId)) // wastage is always a decrease
.map<WastageRecord>((line) => {
const value = ledger.items
.filter((l) => l.itemId === line.itemId && l.direction === "Out")