fix bugs in sales and purchases API.

This commit is contained in:
Ahmed Bouhuolia
2020-08-04 23:00:15 +02:00
parent db28cd2aef
commit ad772cf247
31 changed files with 420 additions and 819 deletions

View File

@@ -3,17 +3,17 @@ import { Customer } from '@/models';
export default class CustomerRepository {
static changeDiffBalance(customerId, oldCustomerId, amount, oldAmount) {
const diffAmount = (amount - oldAmount) * -1;
const diffAmount = amount - oldAmount;
const asyncOpers = [];
if (customerId != oldCustomerId) {
const oldCustomerOper = Customer.changeBalance(
oldCustomerId,
oldAmount
(oldAmount * -1)
);
const customerOper = Customer.changeBalance(
customerId,
(amount + diffAmount) * -1
amount,
);
asyncOpers.push(customerOper);
asyncOpers.push(oldCustomerOper);

View File

@@ -0,0 +1,7 @@
export default class SaleInvoiceRepository {
}