From 1f7a1edf6f0e409dd0a1cdedc9db5d38007600a0 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Mon, 21 Mar 2016 15:18:35 -0400 Subject: [PATCH] Fixed inventory types in finance summary report. Fixes #389 --- app/inventory/reports/controller.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/inventory/reports/controller.js b/app/inventory/reports/controller.js index f156656c03..cae1abc7c8 100644 --- a/app/inventory/reports/controller.js +++ b/app/inventory/reports/controller.js @@ -639,10 +639,10 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number */ this._findInventoryItemsByRequest(reportTimes, {}).then(function(inventoryMap) { this._findInventoryItemsByPurchase(reportTimes, inventoryMap).then(function(inventoryMap) { - var purchaseSummary = [], - consumed = [], - gikConsumed = [], - adjustments = []; + var purchaseSummary = {}, + consumed = {}, + gikConsumed = {}, + adjustments = {}; this.adjustmentTypes.forEach(function(adjustmentType) { adjustments[adjustmentType.type] = []; }); @@ -655,7 +655,7 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number if (!Ember.isEmpty(item.purchaseObjects)) { item.purchaseObjects.forEach(function(purchase) { - purchaseSummary[item.type] = this._getValidNumber(purchaseSummary[item.type]) + this._getValidNumber(purchase.purchaseCost); + purchaseSummary[item.inventoryType] = this._getValidNumber(purchaseSummary[item.inventoryType]) + this._getValidNumber(purchase.purchaseCost); }.bind(this)); } if (!Ember.isEmpty(item.requestObjects)) { @@ -664,12 +664,12 @@ export default AbstractReportController.extend(LocationName, ModalHelper, Number if (request.adjustPurchases) { if (request.transactionType === 'Fulfillment') { if (request.giftInKind) { - gikConsumed[item.type] = this._getValidNumber(gikConsumed[item.type]) + (this._getValidNumber(request.quantity * request.costPerUnit)); + gikConsumed[item.inventoryType] = this._getValidNumber(gikConsumed[item.inventoryType]) + (this._getValidNumber(request.quantity * request.costPerUnit)); } else { - consumed[item.type] = this._getValidNumber(consumed[item.type]) + (this._getValidNumber(request.quantity * request.costPerUnit)); + consumed[item.inventoryType] = this._getValidNumber(consumed[item.inventoryType]) + (this._getValidNumber(request.quantity * request.costPerUnit)); } } else { - adjustments[request.transactionType][item.type] = this._getValidNumber(adjustments[request.transactionType][item.type]) + (this._getValidNumber(request.quantity * request.costPerUnit)); + adjustments[request.transactionType][item.inventoryType] = this._getValidNumber(adjustments[request.transactionType][item.inventoryType]) + (this._getValidNumber(request.quantity * request.costPerUnit)); } } }.bind(this));