Files
bigcapital/packages/server/src/modules/SaleInvoices/subscribers/InvoiceCostGLEntriesSubscriber.ts
Ahmed Bouhuolia 0475ce136a 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.
2026-01-04 01:24:10 +02:00

26 lines
902 B
TypeScript

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) { }
/**
* Writes the invoices cost GL entries once the inventory cost lots be written.
* @param {IInventoryCostLotsGLEntriesWriteEvent}
*/
@OnEvent(events.inventory.onCostLotsGLEntriesWrite)
async writeInvoicesCostEntriesOnCostLotsWritten({
trx,
startingDate,
}: IInventoryCostLotsGLEntriesWriteEvent) {
await this.invoiceCostEntries.writeInventoryCostJournalEntries(
startingDate,
trx,
);
}
}