2940-invoiceInTax-section #680

Merged
joan merged 36 commits from 2940-invoiceInTax-section into dev 2021-08-13 06:11:07 +00:00
8 changed files with 35 additions and 19 deletions
Showing only changes of commit 9371c49922 - Show all commits

View File

@ -43,7 +43,14 @@ module.exports = Self => {
{
relation: 'invoiceInTax',
scope: {
fields: ['id', 'invoiceInFk', 'taxableBase', 'expenseFk', 'taxTypeSageFk', 'transactionTypeSageFk', 'foreignValue'],
fields: [
joan marked this conversation as resolved Outdated

lines longer than 80 to 120 characters require indentation.

lines longer than 80 to 120 characters require indentation.
'id',
'invoiceInFk',
'taxableBase',
'expenseFk',
'taxTypeSageFk',
'transactionTypeSageFk',
'foreignValue'],
include: [{
relation: 'transactionTypeSage',
scope: {

View File

@ -12,7 +12,7 @@
"properties": {
"id": {
"id": true,
"type": "Number",
"type": "number",
joan marked this conversation as resolved Outdated

inconsistent type definition, use lowercase.

inconsistent type definition, use lowercase.
"description": "Identifier"
},
"taxableBase": {

View File

@ -51,8 +51,8 @@
<vn-label translate>Due day</vn-label>
<vn-chip
class="transparent"
translate-attr=" $ctrl.summary.totals.totalDueDay != $ctrl.summary.totals.totalTaxableBase && $ctrl.summary.totals.totalDueDay != $ctrl.summary.totals.totalVat ? {title: 'No coinciden'} : {title: 'Vencimiento'}"
ng-class="{'alert': $ctrl.summary.totals.totalDueDay != $ctrl.summary.totals.totalTaxableBase && $ctrl.summary.totals.totalDueDay != $ctrl.summary.totals.totalVat}">{{$ctrl.summary.totals.totalDueDay | currency: 'EUR':2}}
translate-attr="$ctrl.amountsNotMatch ? {title: 'Do not match'} : {title: 'Due day'}"
joan marked this conversation as resolved Outdated

extraction to a getter would be nice, making it more readable.

Also using translate-attr with spanish tittle is inconsistent.

extraction to a getter would be nice, making it more readable. Also using translate-attr with spanish tittle is inconsistent.
>{{$ctrl.summary.totals.totalDueDay | currency: 'EUR':2}}
</vn-chip>
</vn-one>
</vn-horizontal>
@ -83,7 +83,7 @@
<vn-td shrink>{{::tax.taxableBase | currency: 'EUR':2}}</vn-td>
<vn-td>{{::tax.taxTypeSage.vat}}</vn-td>
<vn-td>{{::tax.transactionTypeSage.transaction}}</vn-td>
<vn-td number shrink>{{::0.2 | percentage}}</vn-td>
<vn-td number shrink>{{::tax.taxRate | percentage}}</vn-td>
joan marked this conversation as resolved Outdated

is 0.2 an static value?

also using :: before static values is incorrect.

is 0.2 an static value? also using :: before static values is incorrect.
<vn-td number shrink>{{::tax.foreignValue | currency: 'USD':2}}</vn-td>
</vn-tr>
</vn-tbody>

View File

@ -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', {

View File

@ -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
Undeductible VAT: Iva no deducible
Do not match: No coinciden

View File

@ -1,10 +1,8 @@
@import "./variables";
@import "./effects";
joan marked this conversation as resolved Outdated

this import doesn't seem to be needed

this import doesn't seem to be needed
vn-invoice-in-summary .summary {
max-width: $width-xl;
.taxes {
border: $border-thin-light;
text-align: right;

View File

@ -1,7 +1,14 @@
<vn-crud-model
vn-id="model"
url="InvoiceInTaxes"
fields="['id', 'invoiceInFk', 'taxableBase', 'expenseFk', 'foreignValue', 'taxTypeSageFk', 'transactionTypeSageFk']"
fields="[
joan marked this conversation as resolved Outdated

lines longer than 80 to 120 characters shoueld be indented

lines longer than 80 to 120 characters shoueld be indented
'id',
'invoiceInFk',
'taxableBase',
'expenseFk',
'foreignValue',
'taxTypeSageFk',
'transactionTypeSageFk']"
link="{invoiceInFk: $ctrl.$params.id}"
data="$ctrl.taxes"
auto-load="true">
@ -41,13 +48,11 @@
disabled="$ctrl.invoiceIn.currency.code != 'EUR'"
vn-id="taxableBase"
step="0.01"
joan marked this conversation as resolved Outdated

trailling space not needed betweent hatml tags in this case

trailling space not needed betweent hatml tags in this case
type="number"
label="Taxable base"
ng-model="invoiceInTax.taxableBase"
on-change="$ctrl.setTaxRate = $value"
on-change="$ctrl.taxRateSelection = $value"
rule>
</vn-input-number>
<vn-autocomplete vn-three
vn-id="taxTypeSage"
label="Sage tax"
@ -55,7 +60,7 @@
data="sageTaxTypes"
show-field="vat"
search-function="{or: [{id: $search}, {vat: {like: '%'+ $search +'%'}}]}"
selection="$ctrl.setTaxRate"
selection="$ctrl.taxRateSelection"
rule>
<tpl-item>{{id}}: {{vat}}</tpl-item>
</vn-autocomplete>
@ -70,7 +75,6 @@
</vn-autocomplete>
<vn-input-number vn-one
disabled="true"
type="number"
label="Rate"
step="0.01"
tabindex="-1"
@ -78,7 +82,6 @@
</vn-input-number>
<vn-input-number vn-one
disabled="$ctrl.invoiceIn.currency.code == 'EUR'"
type="number"
label="Foreign value"
ng-model="invoiceInTax.foreignValue"
rule>

View File

@ -6,12 +6,12 @@ class Controller extends Section {
super($element, $);
}
get setTaxRate() {
return this._setTaxRate;
get taxRateSelection() {
joan marked this conversation as resolved Outdated

rename to taxRateSelection

rename to 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)