mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 22:30:31 +00:00
feat: wip prepard expenses from vendors
This commit is contained in:
@@ -17,6 +17,10 @@ export class PaymentWriteGLEntriesSubscriber {
|
||||
*/
|
||||
public attach(bus) {
|
||||
bus.subscribe(events.billPayment.onCreated, this.handleWriteJournalEntries);
|
||||
bus.subscribe(
|
||||
events.billPayment.onPrepardExpensesApplied,
|
||||
this.handleWritePrepardExpenseGLEntries
|
||||
);
|
||||
bus.subscribe(
|
||||
events.billPayment.onEdited,
|
||||
this.handleRewriteJournalEntriesOncePaymentEdited
|
||||
@@ -28,7 +32,8 @@ export class PaymentWriteGLEntriesSubscriber {
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle bill payment writing journal entries once created.
|
||||
* Handles bill payment writing journal entries once created.
|
||||
* @param {IBillPaymentEventCreatedPayload} payload -
|
||||
*/
|
||||
private handleWriteJournalEntries = async ({
|
||||
tenantId,
|
||||
@@ -44,6 +49,22 @@ export class PaymentWriteGLEntriesSubscriber {
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Handles rewrite prepard expense GL entries once the bill payment applying to bills.
|
||||
* @param {IBillPaymentEventCreatedPayload} payload -
|
||||
*/
|
||||
private handleWritePrepardExpenseGLEntries = async ({
|
||||
tenantId,
|
||||
billPaymentId,
|
||||
trx,
|
||||
}: IBillPaymentEventCreatedPayload) => {
|
||||
await this.billPaymentGLEntries.rewritePaymentGLEntries(
|
||||
tenantId,
|
||||
billPaymentId,
|
||||
trx
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle bill payment re-writing journal entries once the payment transaction be edited.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user