Version 1.0.1 with RIS Circuit Money Exchange !
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user