invoicein tab totalBox
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
912ea12ff7
commit
00d7ebaabc
|
@ -11,6 +11,7 @@
|
||||||
'transactionTypeSageFk']"
|
'transactionTypeSageFk']"
|
||||||
link="{invoiceInFk: $ctrl.$params.id}"
|
link="{invoiceInFk: $ctrl.$params.id}"
|
||||||
data="$ctrl.taxes"
|
data="$ctrl.taxes"
|
||||||
|
on-data-change="$ctrl.calculateTotals()"
|
||||||
auto-load="true">
|
auto-load="true">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
|
@ -25,6 +26,12 @@
|
||||||
</vn-watcher>
|
</vn-watcher>
|
||||||
<form name="form" ng-submit="$ctrl.onSubmit()">
|
<form name="form" ng-submit="$ctrl.onSubmit()">
|
||||||
<vn-card class="vn-pa-lg">
|
<vn-card class="vn-pa-lg">
|
||||||
|
<vn-horizontal>
|
||||||
|
<vn-auto class="totalBox">
|
||||||
|
<span td class="chip"><vn-label translate>Taxable base</vn-label> {{$ctrl.totalTaxableBase | currency: 'EUR':2 | dashIfEmpty}}</span>
|
||||||
|
<p><vn-label translate>Total</vn-label> {{$ctrl.totalVat | currency: 'EUR':2 | dashIfEmpty}}</p>
|
||||||
|
</vn-auto>
|
||||||
|
</vn-horizontal>
|
||||||
<vn-horizontal ng-repeat="invoiceInTax in $ctrl.taxes">
|
<vn-horizontal ng-repeat="invoiceInTax in $ctrl.taxes">
|
||||||
<vn-autocomplete vn-three vn-id="expense" vn-focus
|
<vn-autocomplete vn-three vn-id="expense" vn-focus
|
||||||
label="Expense"
|
label="Expense"
|
||||||
|
|
|
@ -6,11 +6,32 @@ class Controller extends Section {
|
||||||
const taxTypeSage = taxRateSelection && taxRateSelection.rate;
|
const taxTypeSage = taxRateSelection && taxRateSelection.rate;
|
||||||
const taxableBase = invoiceInTax && invoiceInTax.taxableBase;
|
const taxableBase = invoiceInTax && invoiceInTax.taxableBase;
|
||||||
|
|
||||||
if (taxTypeSage && taxableBase)
|
if (taxTypeSage && taxableBase) {
|
||||||
return (taxTypeSage / 100) * taxableBase;
|
invoiceInTax.rate = (taxTypeSage / 100) * taxableBase;
|
||||||
|
return invoiceInTax.rate;
|
||||||
|
}
|
||||||
|
this.calculateTotals();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
set taxes(value) {
|
||||||
|
this._taxes = value;
|
||||||
|
|
||||||
|
if (value) this.calculateTotals();
|
||||||
|
}
|
||||||
|
|
||||||
|
get taxes() {
|
||||||
|
return this._taxes;
|
||||||
|
}
|
||||||
|
|
||||||
|
calculateTotals() {
|
||||||
|
if (!this._taxes) return;
|
||||||
|
this.totalTaxableBase = 0;
|
||||||
|
this.totalVat = 0;
|
||||||
|
for (let tax of this._taxes) {
|
||||||
|
this.totalTaxableBase += tax.taxableBase;
|
||||||
|
this.totalVat += tax.rate || 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
add() {
|
add() {
|
||||||
this.$.model.insert({
|
this.$.model.insert({
|
||||||
|
|
Loading…
Reference in New Issue