mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
add server to monorepo.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { Inject, Service } from 'typedi';
|
||||
import events from '@/subscribers/events';
|
||||
import { IInventoryCostLotsGLEntriesWriteEvent } from '@/interfaces';
|
||||
import { SaleReceiptCostGLEntries } from '../SaleReceiptCostGLEntries';
|
||||
|
||||
@Service()
|
||||
export class SaleReceiptCostGLEntriesSubscriber {
|
||||
@Inject()
|
||||
saleReceiptCostEntries: SaleReceiptCostGLEntries;
|
||||
|
||||
/**
|
||||
* Attaches events.
|
||||
*/
|
||||
public attach(bus) {
|
||||
bus.subscribe(
|
||||
events.inventory.onCostLotsGLEntriesWrite,
|
||||
this.writeJournalEntriesOnceWriteoffCreate
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the receipts cost GL entries once the inventory cost lots be written.
|
||||
* @param {IInventoryCostLotsGLEntriesWriteEvent}
|
||||
*/
|
||||
writeJournalEntriesOnceWriteoffCreate = async ({
|
||||
trx,
|
||||
startingDate,
|
||||
tenantId,
|
||||
}: IInventoryCostLotsGLEntriesWriteEvent) => {
|
||||
await this.saleReceiptCostEntries.writeInventoryCostJournalEntries(
|
||||
tenantId,
|
||||
startingDate,
|
||||
trx
|
||||
);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user