fix: bugs bashing

- Added English translations for customer types in `customer.json`.
- Updated `Model.ts` to improve deletion logic by filtering dependent relations.
- Introduced `BillPaymentBillSyncSubscriber` to handle bill payment events.
- Enhanced `CreateBillPaymentService` and `EditBillPaymentService` to fetch entries after insertion/updating.
- Updated `SaleInvoiceCostGLEntries` to include item entry details in GL entries.
- Refactored various components in the webapp for consistency in naming conventions.
This commit is contained in:
Ahmed Bouhuolia
2026-01-04 01:24:10 +02:00
parent 987ad992a4
commit 0475ce136a
14 changed files with 167 additions and 32 deletions

View File

@@ -38,7 +38,8 @@ export class SaleInvoiceCostGLEntries {
.modify('filterDateRange', startingDate)
.orderBy('date', 'ASC')
.withGraphFetched('invoice')
.withGraphFetched('item');
.withGraphFetched('item')
.withGraphFetched('itemEntry');
const ledger = this.getInventoryCostLotsLedger(inventoryCostLotTrans);
@@ -79,6 +80,9 @@ export class SaleInvoiceCostGLEntries {
transactionType: inventoryCostLot.transactionType,
transactionId: inventoryCostLot.transactionId,
transactionNumber: inventoryCostLot.invoice.invoiceNo,
referenceNumber: inventoryCostLot.invoice.referenceNo,
date: inventoryCostLot.date,
indexGroup: 20,
costable: true,
@@ -105,6 +109,9 @@ export class SaleInvoiceCostGLEntries {
const costAccountId =
inventoryCostLot.costAccountId || inventoryCostLot.item.costAccountId;
// Get description from item entry if available
const description = inventoryCostLot.itemEntry?.description || null;
// XXX Debit - Cost account.
const costEntry = {
...commonEntry,
@@ -112,6 +119,7 @@ export class SaleInvoiceCostGLEntries {
accountId: costAccountId,
accountNormal: AccountNormal.DEBIT,
itemId: inventoryCostLot.itemId,
note: description,
index: getIndexIncrement(),
};
// XXX Credit - Inventory account.
@@ -121,6 +129,7 @@ export class SaleInvoiceCostGLEntries {
accountId: inventoryCostLot.item.inventoryAccountId,
accountNormal: AccountNormal.DEBIT,
itemId: inventoryCostLot.itemId,
note: description,
index: getIndexIncrement(),
};
return [costEntry, inventoryEntry];

View File

@@ -1,15 +1,18 @@
import { Injectable } from '@nestjs/common';
import { OnEvent } from '@nestjs/event-emitter';
import { events } from '@/common/events/events';
import { IInventoryCostLotsGLEntriesWriteEvent } from '@/modules/InventoryCost/types/InventoryCost.types';
import { SaleInvoiceCostGLEntries } from '../SaleInvoiceCostGLEntries';
@Injectable()
export class InvoiceCostGLEntriesSubscriber {
constructor(private readonly invoiceCostEntries: SaleInvoiceCostGLEntries) {}
constructor(private readonly invoiceCostEntries: SaleInvoiceCostGLEntries) { }
/**
* Writes the invoices cost GL entries once the inventory cost lots be written.
* @param {IInventoryCostLotsGLEntriesWriteEvent}
*/
@OnEvent(events.inventory.onCostLotsGLEntriesWrite)
async writeInvoicesCostEntriesOnCostLotsWritten({
trx,
startingDate,