#1023 claim.detail cantidad total parecer ser erronea

This commit is contained in:
Gerard 2019-01-22 10:31:12 +01:00
parent 457e68cd3c
commit b0a60fc94a
2 changed files with 49 additions and 34 deletions

View File

@ -82,9 +82,12 @@
</a>
</vn-vertical>
<!-- Add Lines Dialog -->
<vn-dialog vn-id="add-sales">
<vn-dialog vn-id="add-sales" class="modalForm">
<tpl-body>
<h3><span translate>Claimable sales from ticket</span> {{$ctrl.claim.ticketFk}}</h3>
<vn-horizontal pad-medium class="header">
<h5><span translate>Claimable sales from ticket</span> {{$ctrl.claim.ticketFk}}</h5>
</vn-horizontal>
<vn-horizontal pad-medium>
<vn-table>
<vn-thead>
<vn-tr>
@ -114,6 +117,7 @@
No results
</vn-empty-rows>
</vn-table>
</vn-horizontal>
</tpl-body>
</vn-dialog>
<vn-item-descriptor-popover

View File

@ -24,6 +24,17 @@ class Controller {
};
}
set salesClaimed(value) {
this._salesClaimed = value;
if (value)
this.calculateTotals();
}
get salesClaimed() {
return this._salesClaimed;
}
openAddSalesDialog() {
this.getClaimableFromTicket();
this.$.addSales.show();
@ -71,9 +82,9 @@ class Controller {
calculateTotals() {
this.paidTotal = 0.0;
this.claimedTotal = 0.0;
if (!this.salesClaimed) return;
if (!this._salesClaimed) return;
this.salesClaimed.forEach(sale => {
this._salesClaimed.forEach(sale => {
let orgSale = sale.sale;
this.paidTotal += this.getSaleTotal(orgSale);
this.claimedTotal += sale.quantity * orgSale.price - ((orgSale.discount * (sale.quantity * orgSale.price)) / 100);
@ -81,7 +92,7 @@ class Controller {
}
getSaleTotal(sale) {
return sale.quantity * sale.price - ((100 - sale.discount) / 100);
return (sale.quantity * sale.price) - ((100 - sale.discount) / 100);
}
// Item Descriptor