falta selection
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
bed85c7ddb
commit
3c1f86f171
|
@ -9,6 +9,10 @@
|
||||||
'foreignValue',
|
'foreignValue',
|
||||||
'taxTypeSageFk',
|
'taxTypeSageFk',
|
||||||
'transactionTypeSageFk']"
|
'transactionTypeSageFk']"
|
||||||
|
include="{
|
||||||
|
relation: 'taxTypeSage',
|
||||||
|
scope: {fields: ['id', 'rate']}
|
||||||
|
}"
|
||||||
link="{invoiceInFk: $ctrl.$params.id}"
|
link="{invoiceInFk: $ctrl.$params.id}"
|
||||||
data="$ctrl.taxes"
|
data="$ctrl.taxes"
|
||||||
auto-load="true">
|
auto-load="true">
|
||||||
|
@ -61,7 +65,6 @@
|
||||||
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="taxRateSelection"
|
|
||||||
rule>
|
rule>
|
||||||
<tpl-item>{{id}}: {{vat}}</tpl-item>
|
<tpl-item>{{id}}: {{vat}}</tpl-item>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
|
@ -77,7 +80,7 @@
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
disabled="true"
|
disabled="true"
|
||||||
label="Rate"
|
label="Rate"
|
||||||
field="$ctrl.taxRate(invoiceInTax, taxRateSelection) | currency:'EUR':2">
|
field="$ctrl.taxRate(invoiceInTax) | currency:'EUR':2">
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
<vn-input-number
|
<vn-input-number
|
||||||
disabled="$ctrl.invoiceIn.currency.code == 'EUR'"
|
disabled="$ctrl.invoiceIn.currency.code == 'EUR'"
|
||||||
|
|
|
@ -3,16 +3,14 @@ import Section from 'salix/components/section';
|
||||||
import UserError from 'core/lib/user-error';
|
import UserError from 'core/lib/user-error';
|
||||||
|
|
||||||
class Controller extends Section {
|
class Controller extends Section {
|
||||||
constructor($element, $, vnWeekDays) {
|
constructor($element, $) {
|
||||||
super($element, $);
|
super($element, $);
|
||||||
this.expense = {};
|
this.expense = {};
|
||||||
}
|
}
|
||||||
taxRate(invoiceInTax, taxRateSelection) {
|
|
||||||
const taxTypeSage = taxRateSelection && taxRateSelection.rate;
|
|
||||||
const taxableBase = invoiceInTax && invoiceInTax.taxableBase;
|
|
||||||
|
|
||||||
invoiceInTax.rate = taxTypeSage && taxableBase ? (taxTypeSage / 100) * taxableBase : 0;
|
taxRate(tax) {
|
||||||
return invoiceInTax.rate;
|
if (!tax || !tax.taxTypeSage) return 0;
|
||||||
|
return (tax.taxTypeSage.rate / 100) * tax.taxableBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
get taxableBase() {
|
get taxableBase() {
|
||||||
|
@ -24,7 +22,7 @@ class Controller extends Section {
|
||||||
get totalVat() {
|
get totalVat() {
|
||||||
if (!this.taxes) return;
|
if (!this.taxes) return;
|
||||||
const tax = this.taxes.reduce(
|
const tax = this.taxes.reduce(
|
||||||
(a, tax) => a + tax.rate, 0);
|
(a, tax) => a + this.taxRate(tax), 0);
|
||||||
return this.taxableBase + tax;
|
return this.taxableBase + tax;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue