feat: ability to change customer/vendor opening balance.

This commit is contained in:
a.bouhuolia
2020-12-16 11:55:52 +02:00
parent 704dfcacdf
commit 0e5e13597f
7 changed files with 191 additions and 3 deletions

View File

@@ -251,4 +251,31 @@ export default class VendorsService {
filterMeta: dynamicFilter.getResponseMeta(),
};
}
/**
* Changes the opeing balance of the given vendor.
* @param {number} tenantId
* @param {number} vendorId
* @param {number} openingBalance
* @param {Date|string} openingBalanceAt
*/
public async changeOpeningBalance(
tenantId: number,
vendorId: number,
openingBalance: number,
openingBalanceAt: Date|string,
): Promise<void> {
await this.contactService.changeOpeningBalance(
tenantId,
vendorId,
'vendor',
openingBalance,
openingBalanceAt,
);
// Triggers `onOpeingBalanceChanged` event.
await this.eventDispatcher.dispatch(events.vendors.onOpeningBalanceChanged, {
tenantId, vendorId, openingBalance, openingBalanceAt
});
}
}