diff --git a/app/invoices/edit/controller.js b/app/invoices/edit/controller.js index d2ca2ec60b..6aab101596 100644 --- a/app/invoices/edit/controller.js +++ b/app/invoices/edit/controller.js @@ -353,9 +353,9 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub }.bind(this)); labs.forEach(function(lab) { - if (!Ember.isEmpty(imaging.get('labType'))) { + if (!Ember.isEmpty(lab.get('labType'))) { this._addSupplyCharge(Ember.Object.create({ - pricingItem: imaging.get('labType'), + pricingItem: lab.get('labType'), quantity: 1 }), 'Lab'); } diff --git a/app/invoices/edit/template.hbs b/app/invoices/edit/template.hbs index 70208343b4..8825374534 100644 --- a/app/invoices/edit/template.hbs +++ b/app/invoices/edit/template.hbs @@ -52,13 +52,13 @@
- - - - - - - + + + + + + + {{#each model.lineItemsByCategory as |categoryGroup|}} @@ -69,13 +69,11 @@ {{#each categoryGroup.items as |item|}} {{#if item.showDetails}} - - - - + + + + - {{#each item.details as |detail|}} -
DescriptionActual ChargesDiscountPhilHealthHMO/COMExcess{{t 'labels.action'}}DescriptionActual ChargesDiscountPhilHealthHMO/COMExcess{{t 'labels.action'}}
-
{{input class="form-control" value=item.name }}
-
{{number-format item.total}} @@ -106,12 +104,12 @@
{{t 'labels.name'}}{{t 'labels.quantity'}}PriceExpense To{{t 'labels.name'}}{{t 'labels.quantity'}}PriceExpense To Total + {{#if canAddCharge}}
-
-
- {{input class="form-control" value=detail.name }} -
-
+
+ {{input class="form-control" value=detail.name }}
diff --git a/app/mixins/medication-details.js b/app/mixins/medication-details.js index d82d176315..44fffe50e4 100644 --- a/app/mixins/medication-details.js +++ b/app/mixins/medication-details.js @@ -7,9 +7,14 @@ export default Ember.Mixin.create({ if (!Ember.isEmpty(medicationTitle)) { return medicationTitle; } else { - this.get(inventoryAttribute).then((inventoryItem) => { - this.set('medicationTitle', inventoryItem.get('name')); - }); + var inventoryObject = this.get(inventoryAttribute); + if (inventoryObject.then) { + this.get(inventoryAttribute).then((inventoryItem) => { + this.set('medicationTitle', inventoryItem.get('name')); + }); + } else { + this.set('medicationTitle', inventoryObject.get('name')); + } } }, @@ -34,12 +39,20 @@ export default Ember.Mixin.create({ price: priceOfMedication }); } else { - this.get(inventoryAttribute).then((inventoryItem) => { + var objectInventoryItem = this.get(inventoryAttribute); + if (objectInventoryItem.then) { + this.get(inventoryAttribute).then((inventoryItem) => { + resolve({ + name: inventoryItem.get('name'), + price: inventoryItem.get('price') + }); + }); + } else { resolve({ - name: inventoryItem.get('name'), - price: inventoryItem.get('price') + name: objectInventoryItem.get('name'), + price: objectInventoryItem.get('price') }); - }); + } } }); }, diff --git a/app/models/invoice.js b/app/models/invoice.js index 43dd97ecd3..324cf79e51 100644 --- a/app/models/invoice.js +++ b/app/models/invoice.js @@ -95,8 +95,7 @@ export default AbstractModel.extend(DateFormat, NumberFormat, { categoryList.total = this._calculateTotal(categoryList.items, 'total'); }.bind(this)); return byCategory; - }.property('lineItems.[].amountOwed'), - + }.property('lineItems.@each.amountOwed'), patientIdChanged: function() { if (!Ember.isEmpty(this.get('patient'))) { var patientDisplayName = this.get('patient.displayName'), @@ -118,7 +117,7 @@ export default AbstractModel.extend(DateFormat, NumberFormat, { if (remainingBalance <= 0) { this.set('status', 'Paid'); } - }.observes('payments.[]', 'payments.[].amount'), + }.observes('payments.[]', 'payments.@each.amount'), validations: { patientTypeAhead: PatientValidation.patientTypeAhead, diff --git a/app/models/proc-charge.js b/app/models/proc-charge.js index f8e16242ff..58c7e7b790 100644 --- a/app/models/proc-charge.js +++ b/app/models/proc-charge.js @@ -17,22 +17,18 @@ export default AbstractModel.extend(MedicationDetails, { dateCharged: DS.attr('date'), medicationCharge: function() { - let medicationTitle = this.get('medicationTitle'); - if (!Ember.isEmpty(medicationTitle)) { - return true; - } - var pricingItem = this.get('pricingItem'), - newMedicationCharge = this.get('newMedicationCharge'); - return (Ember.isEmpty(pricingItem) || newMedicationCharge); - }.property('medicationTitle', 'pricingItem', 'newMedicationCharge'), + let medication = this.get('medication'); + let newMedicationCharge = this.get('newMedicationCharge'); + return (!Ember.isEmpty(medication) || !Ember.isEmpty(newMedicationCharge)); + }.property('medication', 'newMedicationCharge'), medicationName: function() { - return this.getMedicationName('medication'); - }.property('medicationTitle', 'medication'), + return this.get('medication.name'); + }.property('medication'), medicationPrice: function() { - return this.getMedicationPrice('medication'); - }.property('priceOfMedication', 'medication'), + return this.get('medication.price'); + }.property('medication'), validations: { itemName: {