fix: issue in sales invoices and bills.

This commit is contained in:
Ahmed Bouhuolia
2020-10-25 19:58:32 +02:00
parent 5e615e57c3
commit ca6acf6517
8 changed files with 64 additions and 34 deletions

View File

@@ -51,7 +51,7 @@ export default class PaymentMadesSubscriber {
this.logger.info('[bill_payment] trying to increment vendor balance.', { tenantId });
await vendorRepository.changeBalance(
billPayment.vendorId,
billPayment.amount,
billPayment.amount * -1,
);
}
@@ -75,7 +75,7 @@ export default class PaymentMadesSubscriber {
await vendorRepository.changeBalance(
oldPaymentMade.vendorId,
oldPaymentMade.amount * -1,
oldPaymentMade.amount,
);
}

View File

@@ -66,7 +66,10 @@ export default class PaymentReceivesSubscriber {
const { customerRepository } = this.tenancy.repositories(tenantId);
this.logger.info('[payment_receive] trying to increment customer balance.');
await customerRepository.changeBalance(oldPaymentReceive.customerId, oldPaymentReceive.amount);
await customerRepository.changeBalance(
oldPaymentReceive.customerId,
oldPaymentReceive.amount,
);
}
/**
@@ -76,8 +79,6 @@ export default class PaymentReceivesSubscriber {
async handleCustomerBalanceDiffChange({ tenantId, paymentReceiveId, paymentReceive, oldPaymentReceive }) {
const { customerRepository } = this.tenancy.repositories(tenantId);
console.log(paymentReceive, oldPaymentReceive, 'XX');
await customerRepository.changeDiffBalance(
paymentReceive.customerId,
paymentReceive.amount * -1,