Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Fixed inventory types in finance summary report.
Browse files Browse the repository at this point in the history
Fixes #389
  • Loading branch information
jkleinsc committed Mar 21, 2016
1 parent 6faa593 commit 1f7a1ed
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions app/inventory/reports/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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] = [];
});
Expand All @@ -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)) {
Expand All @@ -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));
Expand Down

0 comments on commit 1f7a1ed

Please sign in to comment.