Ammends
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Joan Sanchez 2021-08-09 14:06:23 +02:00
parent e5b1f47478
commit cbaba8a075
2 changed files with 11 additions and 22 deletions

View File

@ -36,22 +36,19 @@
</vn-autocomplete>
<vn-input-number vn-one
disabled="$ctrl.invoiceIn.currency.code != 'EUR'"
vn-id="taxableBase"
step="0.01"
label="Taxable base"
ng-model="invoiceInTax.taxableBase"
on-change="$ctrl.taxRateSelection = $value"
rule>
</vn-input-number>
<vn-autocomplete vn-three
vn-id="taxTypeSage"
label="Sage tax"
ng-model="invoiceInTax.taxTypeSageFk"
url="SageTaxTypes"
show-field="vat"
fields="['id', 'vat', 'rate']"
search-function="{or: [{id: $search}, {vat: {like: '%'+ $search +'%'}}]}"
selection="$ctrl.taxRateSelection"
selection="taxRateSelection"
rule>
<tpl-item>{{id}}: {{vat}}</tpl-item>
</vn-autocomplete>
@ -64,14 +61,12 @@
rule>
<tpl-item>{{id}}: {{transaction}}</tpl-item>
</vn-autocomplete>
<vn-input-number vn-one
<vn-textfield
disabled="true"
label="Rate"
step="0.01"
tabindex="-1"
ng-model="$ctrl.taxRate">
</vn-input-number>
<vn-input-number vn-one
field="$ctrl.taxRate(invoiceInTax, taxRateSelection) | currency:'EUR':2">
</vn-textfield>
<vn-input-number
disabled="$ctrl.invoiceIn.currency.code == 'EUR'"
label="Foreign value"
ng-model="invoiceInTax.foreignValue"

View File

@ -2,20 +2,14 @@ import ngModule from '../module';
import Section from 'salix/components/section';
class Controller extends Section {
constructor($element, $) {
super($element, $);
}
taxRate(invoiceInTax, taxRateSelection) {
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)
this.taxRate = (taxTypeSage.rate / 100) * taxableBase;
return (taxTypeSage / 100) * taxableBase;
return 0;
}
add() {