diff --git a/lib/batch/index.js b/lib/batch/index.js index bfa0eca..268174d 100644 --- a/lib/batch/index.js +++ b/lib/batch/index.js @@ -85,7 +85,9 @@ Batch.prototype.addEntry = function(entry) { // Add the new entry to the entries array this._entries.push(entry); +}; +Batch.prototype.updateBatchValues = function() { // Update the batch values like total debit and credit $ amounts var entryHash = 0; var totalDebit = 0; diff --git a/lib/file/index.js b/lib/file/index.js index bb74223..e507e81 100644 --- a/lib/file/index.js +++ b/lib/file/index.js @@ -105,7 +105,8 @@ File.prototype.generateBatches = function(done1) { var totalDebit = 0; var totalCredit = 0; - async.each(this._batches, function(batch, done2) { + async.each(this._batches, function(batch, done2) { + batch.updateBatchValues(); totalDebit += batch.control.totalDebit.value; totalCredit += batch.control.totalCredit.value;