descriptor invoiceIn amount

This commit is contained in:
Carlos Jimenez Ruiz 2021-04-12 16:32:13 +02:00
parent b6f31d7d44
commit 90a7c803fd
5 changed files with 56 additions and 8 deletions

View File

@ -1,5 +1,8 @@
{
"InvoiceIn": {
"dataSource": "vn"
},
"InvoiceInDueDay": {
"dataSource": "vn"
}
}

View File

@ -0,0 +1,33 @@
{
"name": "InvoiceInDueDay",
"base": "VnModel",
"options": {
"mysql": {
"table": "invoiceInDueDay"
}
},
"properties": {
"id": {
"id": true,
"type": "number",
"description": "Identifier"
},
"invoiceInFk": {
"type": "number"
},
"dueDated": {
"type": "date"
},
"bankFk": {
"type": "number"
},
"amount": {
"type": "number"
},
"created": {
"type": "date"
}
}
}

View File

@ -44,6 +44,11 @@
}
},
"relations": {
"invoiceInDueDay": {
"type": "hasMany",
"model": "InvoiceInDueDay",
"foreignKey": "invoiceInFk"
},
"company": {
"type": "belongsTo",
"model": "Company",

View File

@ -4,13 +4,23 @@ import ModuleCard from 'salix/components/module-card';
class Controller extends ModuleCard {
reload() {
const filter = {
include: {
include: [
{
relation: 'supplier'
},
{
relation: 'invoiceInDueDay'
}
};
]};
this.$http.get(`InvoiceIns/${this.$params.id}`, {filter})
.then(res => this.invoiceIn = res.data);
.then(res => {
this.invoiceIn = res.data;
this.invoiceIn.amount = res.data.invoiceInDueDay.reduce(
(accumulator, currentValue) => {
return accumulator + (currentValue['amount'] || 0);
}, 0);
});
}
}

View File

@ -1,3 +0,0 @@
Entries list: Listado de entradas
Invoice list: Listado de facturas
InvoiceIn deleted: Factura eliminada