Version 1.0.1 with RIS Circuit Money Exchange !

This commit is contained in:
Paolo Arena
2022-09-14 17:37:29 +02:00
parent 845e244470
commit 3d2e12df70
7 changed files with 143 additions and 71 deletions

View File

@@ -84,7 +84,7 @@ MovementSchema.statics.executeQueryTable = function(idapp, params) {
return tools.executeQueryTable(this, 0, params);
};
MovementSchema.statics.addMov = async function(idapp, accountFromId, accountToId, amount, causal) {
MovementSchema.statics.addMov = async function(idapp, accountFromIdTable, accountToIdTable, amount, causal) {
try {
let mymov = Movement(
@@ -92,8 +92,8 @@ MovementSchema.statics.addMov = async function(idapp, accountFromId, accountToId
_id: new ObjectID().toString(),
idapp,
transactionDate: new Date(),
accountFromId: accountFromId._id,
accountToId: accountToId._id,
accountFromId: accountFromIdTable._id,
accountToId: accountToIdTable._id,
amount,
causal,
residual: 0,
@@ -104,9 +104,9 @@ MovementSchema.statics.addMov = async function(idapp, accountFromId, accountToId
const rismov = await mymov.save();
if (rismov) {
// Update saldo dell'Account
Account.addtoSaldo(accountToId, amount);
await accountToIdTable.addtoSaldo(amount);
Account.addtoSaldo(accountFromId, -amount);
await accountFromIdTable.addtoSaldo(-amount);
return rismov;
}