Compare commits

...

5 Commits

Author SHA1 Message Date
Javi Gallego 1963cc2265 log en tablas invoiceIn
gitea/salix/pipeline/head There was a failure building this commit Details
2023-01-25 07:49:51 +01:00
Javi Gallego 3c1f86f171 falta selection
gitea/salix/pipeline/head There was a failure building this commit Details
2022-11-14 17:58:44 +01:00
Javi Gallego bed85c7ddb refs #3074 taxableBase
gitea/salix/pipeline/head This commit looks good Details
2022-11-14 17:27:58 +01:00
Javi Gallego 998f00da49 Merge branch 'dev' into 3074-invoiceIn-Tax-crear-total
gitea/salix/pipeline/head This commit looks good Details
2022-11-14 09:30:13 +01:00
Javi Gallego 00d7ebaabc invoicein tab totalBox
gitea/salix/pipeline/head This commit looks good Details
2022-02-15 08:45:06 +01:00
4 changed files with 47 additions and 17 deletions

View File

@ -1,6 +1,10 @@
{
"name": "InvoiceInDueDay",
"base": "VnModel",
"base": "Loggable",
"log": {
"model": "InvoiceInLog",
"relation": "invoiceIn"
},
"options": {
"mysql": {
"table": "invoiceInDueDay"
@ -12,9 +16,6 @@
"type": "number",
"description": "Identifier"
},
"invoiceInFk": {
"type": "number"
},
"dueDated": {
"type": "date"
},
@ -32,6 +33,11 @@
}
},
"relations": {
"invoiceIn": {
"type": "belongsTo",
"model": "InvoiceIn",
"foreignKey": "invoiceInFk"
},
"bank": {
"type": "belongsTo",
"model": "Bank",

View File

@ -1,6 +1,10 @@
{
"name": "InvoiceInIntrastat",
"base": "VnModel",
"base": "Loggable",
"log": {
"model": "InvoiceInLog",
"relation": "invoiceIn"
},
"options": {
"mysql": {
"table": "invoiceInIntrastat"
@ -12,9 +16,6 @@
"type": "number",
"description": "Identifier"
},
"invoiceInFk": {
"type": "number"
},
"net": {
"type": "number"
},
@ -35,6 +36,11 @@
}
},
"relations": {
"invoiceIn": {
"type": "belongsTo",
"model": "InvoiceIn",
"foreignKey": "invoiceInFk"
},
"intrastat": {
"type": "belongsTo",
"model": "Intrastat",

View File

@ -9,6 +9,10 @@
'foreignValue',
'taxTypeSageFk',
'transactionTypeSageFk']"
include="{
relation: 'taxTypeSage',
scope: {fields: ['id', 'rate']}
}"
link="{invoiceInFk: $ctrl.$params.id}"
data="$ctrl.taxes"
auto-load="true">
@ -25,6 +29,12 @@
</vn-watcher>
<form name="form" ng-submit="$ctrl.onSubmit()">
<vn-card class="vn-pa-lg">
<vn-horizontal>
<vn-auto class="totalBox">
<span td class="chip"><vn-label translate>Taxable base</vn-label> {{$ctrl.taxableBase | 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-autocomplete vn-three vn-id="expense" vn-focus
label="Expense"
@ -55,7 +65,6 @@
show-field="vat"
fields="['id', 'vat', 'rate']"
search-function="{or: [{id: $search}, {vat: {like: '%'+ $search +'%'}}]}"
selection="taxRateSelection"
rule>
<tpl-item>{{id}}: {{vat}}</tpl-item>
</vn-autocomplete>
@ -71,7 +80,7 @@
<vn-textfield
disabled="true"
label="Rate"
field="$ctrl.taxRate(invoiceInTax, taxRateSelection) | currency:'EUR':2">
field="$ctrl.taxRate(invoiceInTax) | currency:'EUR':2">
</vn-textfield>
<vn-input-number
disabled="$ctrl.invoiceIn.currency.code == 'EUR'"

View File

@ -3,18 +3,27 @@ import Section from 'salix/components/section';
import UserError from 'core/lib/user-error';
class Controller extends Section {
constructor($element, $, vnWeekDays) {
constructor($element, $) {
super($element, $);
this.expense = {};
}
taxRate(invoiceInTax, taxRateSelection) {
const taxTypeSage = taxRateSelection && taxRateSelection.rate;
const taxableBase = invoiceInTax && invoiceInTax.taxableBase;
if (taxTypeSage && taxableBase)
return (taxTypeSage / 100) * taxableBase;
taxRate(tax) {
if (!tax || !tax.taxTypeSage) return 0;
return (tax.taxTypeSage.rate / 100) * tax.taxableBase;
}
return 0;
get taxableBase() {
if (!this.taxes) return;
return this.taxes.reduce(
(a, tax) => a + (tax.taxableBase || 0), 0);
}
get totalVat() {
if (!this.taxes) return;
const tax = this.taxes.reduce(
(a, tax) => a + this.taxRate(tax), 0);
return this.taxableBase + tax;
}
add() {