mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-23 00:00:31 +00:00
feat: advanced payments
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import { Inject, Service } from 'typedi';
|
||||
import { AutoApplyPrepardExpenses } from '../AutoApplyPrepardExpenses';
|
||||
import events from '@/subscribers/events';
|
||||
import { IBillCreatedPayload } from '@/interfaces';
|
||||
|
||||
@Service()
|
||||
export class AutoApplyPrepardExpensesOnBillCreated {
|
||||
@Inject()
|
||||
private autoApplyPrepardExpenses: AutoApplyPrepardExpenses;
|
||||
|
||||
/**
|
||||
* Constructor method.
|
||||
*/
|
||||
public attach(bus) {
|
||||
bus.subscribe(
|
||||
events.saleInvoice.onCreated,
|
||||
this.handleAutoApplyPrepardExpensesOnBillCreated.bind(this)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the auto apply prepard expenses on bill created.
|
||||
* @param {IBillCreatedPayload} payload -
|
||||
*/
|
||||
private async handleAutoApplyPrepardExpensesOnBillCreated({
|
||||
tenantId,
|
||||
billId,
|
||||
trx,
|
||||
}: IBillCreatedPayload) {
|
||||
await this.autoApplyPrepardExpenses.autoApplyPrepardExpensesToBill(
|
||||
tenantId,
|
||||
billId,
|
||||
trx
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user