Ammends
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
e5b1f47478
commit
cbaba8a075
|
@ -36,22 +36,19 @@
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
<vn-input-number vn-one
|
<vn-input-number vn-one
|
||||||
disabled="$ctrl.invoiceIn.currency.code != 'EUR'"
|
disabled="$ctrl.invoiceIn.currency.code != 'EUR'"
|
||||||
vn-id="taxableBase"
|
|
||||||
step="0.01"
|
step="0.01"
|
||||||
label="Taxable base"
|
label="Taxable base"
|
||||||
ng-model="invoiceInTax.taxableBase"
|
ng-model="invoiceInTax.taxableBase"
|
||||||
on-change="$ctrl.taxRateSelection = $value"
|
|
||||||
rule>
|
rule>
|
||||||
</vn-input-number>
|
</vn-input-number>
|
||||||
<vn-autocomplete vn-three
|
<vn-autocomplete vn-three
|
||||||
vn-id="taxTypeSage"
|
|
||||||
label="Sage tax"
|
label="Sage tax"
|
||||||
ng-model="invoiceInTax.taxTypeSageFk"
|
ng-model="invoiceInTax.taxTypeSageFk"
|
||||||
url="SageTaxTypes"
|
url="SageTaxTypes"
|
||||||
show-field="vat"
|
show-field="vat"
|
||||||
fields="['id', 'vat', 'rate']"
|
fields="['id', 'vat', 'rate']"
|
||||||
search-function="{or: [{id: $search}, {vat: {like: '%'+ $search +'%'}}]}"
|
search-function="{or: [{id: $search}, {vat: {like: '%'+ $search +'%'}}]}"
|
||||||
selection="$ctrl.taxRateSelection"
|
selection="taxRateSelection"
|
||||||
rule>
|
rule>
|
||||||
<tpl-item>{{id}}: {{vat}}</tpl-item>
|
<tpl-item>{{id}}: {{vat}}</tpl-item>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
|
@ -64,14 +61,12 @@
|
||||||
rule>
|
rule>
|
||||||
<tpl-item>{{id}}: {{transaction}}</tpl-item>
|
<tpl-item>{{id}}: {{transaction}}</tpl-item>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
<vn-input-number vn-one
|
<vn-textfield
|
||||||
disabled="true"
|
disabled="true"
|
||||||
label="Rate"
|
label="Rate"
|
||||||
step="0.01"
|
field="$ctrl.taxRate(invoiceInTax, taxRateSelection) | currency:'EUR':2">
|
||||||
tabindex="-1"
|
</vn-textfield>
|
||||||
ng-model="$ctrl.taxRate">
|
<vn-input-number
|
||||||
</vn-input-number>
|
|
||||||
<vn-input-number vn-one
|
|
||||||
disabled="$ctrl.invoiceIn.currency.code == 'EUR'"
|
disabled="$ctrl.invoiceIn.currency.code == 'EUR'"
|
||||||
label="Foreign value"
|
label="Foreign value"
|
||||||
ng-model="invoiceInTax.foreignValue"
|
ng-model="invoiceInTax.foreignValue"
|
||||||
|
|
|
@ -2,20 +2,14 @@ import ngModule from '../module';
|
||||||
import Section from 'salix/components/section';
|
import Section from 'salix/components/section';
|
||||||
|
|
||||||
class Controller extends Section {
|
class Controller extends Section {
|
||||||
constructor($element, $) {
|
taxRate(invoiceInTax, taxRateSelection) {
|
||||||
super($element, $);
|
const taxTypeSage = taxRateSelection && taxRateSelection.rate;
|
||||||
}
|
const taxableBase = invoiceInTax && invoiceInTax.taxableBase;
|
||||||
|
|
||||||
get taxRateSelection() {
|
|
||||||
return this._taxRateSelection;
|
|
||||||
}
|
|
||||||
|
|
||||||
set taxRateSelection(selection) {
|
|
||||||
this._taxRateSelection = selection;
|
|
||||||
const taxTypeSage = this.$.taxTypeSage.selection;
|
|
||||||
const taxableBase = this.$.taxableBase.value;
|
|
||||||
if (taxTypeSage && taxableBase)
|
if (taxTypeSage && taxableBase)
|
||||||
this.taxRate = (taxTypeSage.rate / 100) * taxableBase;
|
return (taxTypeSage / 100) * taxableBase;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
add() {
|
add() {
|
||||||
|
|
Loading…
Reference in New Issue