diff --git a/modules/invoiceIn/back/methods/invoice-in/summary.js b/modules/invoiceIn/back/methods/invoice-in/summary.js index b2db8264b..15637d42f 100644 --- a/modules/invoiceIn/back/methods/invoice-in/summary.js +++ b/modules/invoiceIn/back/methods/invoice-in/summary.js @@ -43,7 +43,14 @@ module.exports = Self => { { relation: 'invoiceInTax', scope: { - fields: ['id', 'invoiceInFk', 'taxableBase', 'expenseFk', 'taxTypeSageFk', 'transactionTypeSageFk', 'foreignValue'], + fields: [ + 'id', + 'invoiceInFk', + 'taxableBase', + 'expenseFk', + 'taxTypeSageFk', + 'transactionTypeSageFk', + 'foreignValue'], include: [{ relation: 'transactionTypeSage', scope: { diff --git a/modules/invoiceIn/back/models/invoice-in-tax.json b/modules/invoiceIn/back/models/invoice-in-tax.json index b20285b77..19ab8be37 100644 --- a/modules/invoiceIn/back/models/invoice-in-tax.json +++ b/modules/invoiceIn/back/models/invoice-in-tax.json @@ -12,7 +12,7 @@ "properties": { "id": { "id": true, - "type": "Number", + "type": "number", "description": "Identifier" }, "taxableBase": { diff --git a/modules/invoiceIn/front/summary/index.html b/modules/invoiceIn/front/summary/index.html index e66fd111c..90c0b475b 100644 --- a/modules/invoiceIn/front/summary/index.html +++ b/modules/invoiceIn/front/summary/index.html @@ -51,8 +51,8 @@ Due day {{$ctrl.summary.totals.totalDueDay | currency: 'EUR':2}} + translate-attr="$ctrl.amountsNotMatch ? {title: 'Do not match'} : {title: 'Due day'}" + >{{$ctrl.summary.totals.totalDueDay | currency: 'EUR':2}} @@ -83,7 +83,7 @@ {{::tax.taxableBase | currency: 'EUR':2}} {{::tax.taxTypeSage.vat}} {{::tax.transactionTypeSage.transaction}} - {{::0.2 | percentage}} + {{::tax.taxRate | percentage}} {{::tax.foreignValue | currency: 'USD':2}} diff --git a/modules/invoiceIn/front/summary/index.js b/modules/invoiceIn/front/summary/index.js index 54b5bcd00..ad88da278 100644 --- a/modules/invoiceIn/front/summary/index.js +++ b/modules/invoiceIn/front/summary/index.js @@ -17,6 +17,13 @@ class Controller extends Summary { return this.$http.get(`InvoiceIns/${this.invoiceIn.id}/summary`) .then(res => this.summary = res.data); } + + // ng-class="{'alert': $ctrl.amountsNotMatch()}" + amountsNotMatch() { + const total = this.summary.totals; + console.log(total.totalDueDay != total.totalTaxableBase && total.totalDueDay != total.totalVat); + return total.totalDueDay != total.totalTaxableBase && total.totalDueDay != total.totalVat; + } } ngModule.vnComponent('vnInvoiceInSummary', { diff --git a/modules/invoiceIn/front/summary/locale/es.yml b/modules/invoiceIn/front/summary/locale/es.yml index 6f7cefddb..fbfa5f140 100644 --- a/modules/invoiceIn/front/summary/locale/es.yml +++ b/modules/invoiceIn/front/summary/locale/es.yml @@ -7,4 +7,5 @@ Booked date: Fecha contable Accounted date: Fecha contable Doc number: Numero documento Sage withholding: RetenciĆ³n sage -Undeductible VAT: Iva no deducible \ No newline at end of file +Undeductible VAT: Iva no deducible +Do not match: No coinciden \ No newline at end of file diff --git a/modules/invoiceIn/front/summary/style.scss b/modules/invoiceIn/front/summary/style.scss index ed36d96ec..d1d191831 100644 --- a/modules/invoiceIn/front/summary/style.scss +++ b/modules/invoiceIn/front/summary/style.scss @@ -1,10 +1,8 @@ @import "./variables"; -@import "./effects"; vn-invoice-in-summary .summary { max-width: $width-xl; - .taxes { border: $border-thin-light; text-align: right; diff --git a/modules/invoiceIn/front/tax/index.html b/modules/invoiceIn/front/tax/index.html index cec875def..1834708cc 100644 --- a/modules/invoiceIn/front/tax/index.html +++ b/modules/invoiceIn/front/tax/index.html @@ -1,7 +1,14 @@ @@ -41,13 +48,11 @@ disabled="$ctrl.invoiceIn.currency.code != 'EUR'" vn-id="taxableBase" step="0.01" - type="number" label="Taxable base" ng-model="invoiceInTax.taxableBase" - on-change="$ctrl.setTaxRate = $value" + on-change="$ctrl.taxRateSelection = $value" rule> - {{id}}: {{vat}} @@ -70,7 +75,6 @@ diff --git a/modules/invoiceIn/front/tax/index.js b/modules/invoiceIn/front/tax/index.js index 26557c365..219b97be5 100644 --- a/modules/invoiceIn/front/tax/index.js +++ b/modules/invoiceIn/front/tax/index.js @@ -6,12 +6,12 @@ class Controller extends Section { super($element, $); } - get setTaxRate() { - return this._setTaxRate; + get taxRateSelection() { + return this._taxRateSelection; } - set setTaxRate(selection) { - this._setTaxRate = selection; + set taxRateSelection(selection) { + this._taxRateSelection = selection; const taxTypeSage = this.$.taxTypeSage.selection; const taxableBase = this.$.taxableBase.value; if (taxTypeSage && taxableBase)