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

Commit

Permalink
Removed adjust purchases option and added Return To Vendor
Browse files Browse the repository at this point in the history
Resolves #85, #84
  • Loading branch information
jkleinsc committed Apr 7, 2015
1 parent 628a7ea commit af6986a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 26 deletions.
7 changes: 3 additions & 4 deletions app/inventory/adjust/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@ import AbstractEditController from 'hospitalrun/controllers/abstract-edit-contro
import Ember from "ember";
export default AbstractEditController.extend({
needs: 'inventory',

adjustmentItemSet: function() {
this.set('adjustPurchases', true);
}.observes('adjustmentItem'),

adjustmentTypes: [{
name: 'Add',
type: 'Adjustment (Add)'
}, {
name: 'Remove',
type: 'Adjustment (Remove)'
}, {
name: 'Return To Vendor',
type: 'Return To Vendor'
}, {
name: 'Write Off',
type: 'Write Off'
Expand Down
2 changes: 0 additions & 2 deletions app/inventory/adjust/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@
<div class="row">
{{date-picker property="dateCompleted" label="Adjustment Date" class="col-sm-4"}}
</div>
{{em-checkbox label="Adjust Purchases" property="adjustPurchases"}}

{{/em-form}}
33 changes: 13 additions & 20 deletions app/inventory/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,11 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi

actions: {
adjustItems: function(inventoryLocation) {
var adjustPurchases = inventoryLocation.get('adjustPurchases'),
adjustmentQuantity = parseInt(inventoryLocation.get('adjustmentQuantity')),
var adjustmentQuantity = parseInt(inventoryLocation.get('adjustmentQuantity')),
inventoryItem = this.get('model'),
transactionType = inventoryLocation.get('transactionType'),
request = this.get('store').createRecord('inv-request', {
adjustPurchases: adjustPurchases,
adjustPurchases: true,
dateCompleted: inventoryLocation.get('dateCompleted'),
inventoryItem: inventoryItem,
quantity: adjustmentQuantity,
Expand All @@ -104,21 +103,16 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi
deliveryAisle: inventoryLocation.get('aisleLocation'),
deliveryLocation: inventoryLocation.get('location')
});
request.set('inventoryLocations',[inventoryLocation]);
if (adjustPurchases) {
var increment = false;
if (transactionType === 'Adjustment (Add)') {
increment = true;
}
request.set('markAsConsumed',true);
//Make sure inventory item is resolved first.
request.get('inventoryItem').then(function() {
this.send('fulfillRequest', request, true, increment, true);
}.bind(this));
} else {
this.adjustLocation(inventoryItem, inventoryLocation);
this._saveRequest(request);
}
request.set('inventoryLocations',[inventoryLocation]);
var increment = false;
if (transactionType === 'Adjustment (Add)') {
increment = true;
}
request.set('markAsConsumed',true);
//Make sure inventory item is resolved first.
request.get('inventoryItem').then(function() {
this.send('fulfillRequest', request, true, increment, true);
}.bind(this));
},

deletePurchase: function(purchase, deleteFromLocation, expire) {
Expand All @@ -141,8 +135,7 @@ export default AbstractEditController.extend(InventoryLocations, InventoryTypeLi
},

showAdjustment: function(inventoryLocation) {
inventoryLocation.setProperties({
adjustPurchases: true,
inventoryLocation.setProperties({
dateCompleted: new Date(),
adjustmentItem: this.get('model'),
adjustmentQuantity: '',
Expand Down

0 comments on commit af6986a

Please sign in to comment.