diff --git a/db/dump/structure.sql b/db/dump/structure.sql
index 7d79b45d3..8bc0aed8f 100644
--- a/db/dump/structure.sql
+++ b/db/dump/structure.sql
@@ -30193,7 +30193,7 @@ BEGIN
NEW.currencyFk != OLD.currencyFk
THEN
- CALL vn2008.recibidaIvaDivisaUpdate(NEW.id);
+ -- CALL vn2008.recibidaIvaDivisaUpdate(NEW.id);
END IF;
diff --git a/modules/entry/back/methods/entry/filter.js b/modules/entry/back/methods/entry/filter.js
index 42dbe3078..0148d866d 100644
--- a/modules/entry/back/methods/entry/filter.js
+++ b/modules/entry/back/methods/entry/filter.js
@@ -10,76 +10,81 @@ module.exports = Self => {
accepts: [
{
arg: 'filter',
- type: 'Object',
+ type: 'object',
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string',
http: {source: 'query'}
}, {
arg: 'search',
- type: 'String',
+ type: 'string',
description: 'Searchs the entry by id',
http: {source: 'query'}
}, {
arg: 'id',
- type: 'Integer',
+ type: 'integer',
description: 'The entry id',
http: {source: 'query'}
}, {
arg: 'created',
- type: 'Date',
+ type: 'date',
description: 'The created date to filter',
http: {source: 'query'}
}, {
arg: 'travelFk',
- type: 'Number',
+ type: 'number',
description: 'The travel id to filter',
http: {source: 'query'}
}, {
arg: 'companyFk',
- type: 'Number',
+ type: 'number',
description: 'The company to filter',
http: {source: 'query'}
}, {
arg: 'isBooked',
- type: 'Boolean',
+ type: 'boolean',
description: 'The isBokked filter',
http: {source: 'query'}
}, {
arg: 'isConfirmed',
- type: 'Boolean',
+ type: 'boolean',
description: 'The isConfirmed filter',
http: {source: 'query'}
}, {
arg: 'isOrdered',
- type: 'Boolean',
+ type: 'boolean',
description: 'The isOrdered filter',
http: {source: 'query'}
}, {
arg: 'ref',
- type: 'String',
+ type: 'string',
description: 'The ref filter',
http: {source: 'query'}
}, {
arg: 'supplierFk',
- type: 'Number',
+ type: 'number',
description: 'The supplier id to filter',
http: {source: 'query'}
+ }, {
+ arg: 'invoiceInFk',
+ type: 'number',
+ description: 'The invoiceIn id to filter',
+ http: {source: 'query'}
}, {
arg: 'currencyFk',
- type: 'Number',
+ type: 'number',
description: 'The currency id to filter',
http: {source: 'query'}
}, {
arg: 'from',
- type: 'Date',
+ type: 'date',
description: `The from date filter`
}, {
arg: 'to',
- type: 'Date',
+ type: 'date',
description: `The to date filter`
}
],
returns: {
- type: ['Object'],
+ type: ['object'],
root: true
},
http: {
@@ -116,6 +121,7 @@ module.exports = Self => {
case 'travelFk':
case 'currencyFk':
case 'supplierFk':
+ case 'invoiceInFk':
param = `e.${param}`;
return {[param]: value};
}
diff --git a/modules/invoiceIn/back/methods/invoice-in/filter.js b/modules/invoiceIn/back/methods/invoice-in/filter.js
index 20680f153..0b9825752 100644
--- a/modules/invoiceIn/back/methods/invoice-in/filter.js
+++ b/modules/invoiceIn/back/methods/invoice-in/filter.js
@@ -17,7 +17,7 @@ module.exports = Self => {
{
arg: 'search',
type: 'string',
- description: 'Searchs the invoiceOut by id',
+ description: 'Searchs the invoiceIn by id',
http: {source: 'query'}
},
{
@@ -25,6 +25,11 @@ module.exports = Self => {
type: 'string',
description: 'The supplier reference'
},
+ {
+ arg: 'supplierFk',
+ type: 'number',
+ description: 'The supplier id'
+ },
{
arg: 'fi',
type: 'string',
@@ -108,6 +113,7 @@ module.exports = Self => {
case 'fi':
return {[`s.${param}`]: value};
case 'supplierRef':
+ case 'supplierFk':
case 'serialNumber':
case 'serial':
case 'issued':
@@ -132,7 +138,7 @@ module.exports = Self => {
ii.isBooked,
ii.supplierRef,
ii.docFk AS dmsFk,
- s.id AS supplierFk,
+ ii.supplierFk,
s.name AS supplierName,
s.account,
SUM(iid.amount) AS amount,
diff --git a/modules/invoiceIn/back/methods/invoice-in/specs/summary.spec.js b/modules/invoiceIn/back/methods/invoice-in/specs/summary.spec.js
new file mode 100644
index 000000000..ff7a39ef5
--- /dev/null
+++ b/modules/invoiceIn/back/methods/invoice-in/specs/summary.spec.js
@@ -0,0 +1,9 @@
+const app = require('vn-loopback/server/server');
+
+describe('invoiceIn summary()', () => {
+ it('should return a summary object containing data from one invoiceIn', async() => {
+ const summary = await app.models.InvoiceIn.summary(1);
+
+ expect(summary.supplierRef).toEqual('1234');
+ });
+});
diff --git a/modules/invoiceIn/back/methods/invoice-in/summary.js b/modules/invoiceIn/back/methods/invoice-in/summary.js
new file mode 100644
index 000000000..c4101e4dc
--- /dev/null
+++ b/modules/invoiceIn/back/methods/invoice-in/summary.js
@@ -0,0 +1,48 @@
+module.exports = Self => {
+ Self.remoteMethod('summary', {
+ description: 'The invoiceIn summary',
+ accessType: 'READ',
+ accepts: [{
+ arg: 'id',
+ type: 'number',
+ required: true,
+ description: 'The invoiceIn id',
+ http: {source: 'path'}
+ }],
+ returns: {
+ type: 'object',
+ root: true
+ },
+ http: {
+ path: `/:id/summary`,
+ verb: 'GET'
+ }
+ });
+
+ Self.summary = async id => {
+ const filter = {
+ include: [
+ {
+ relation: 'company',
+ scope: {
+ fields: ['id', 'code']
+ }
+ },
+ {
+ relation: 'supplier',
+ scope: {
+ fields: ['id', 'name']
+ }
+ },
+ {
+ relation: 'sageWithholding',
+ scope: {
+ fields: ['withholding']
+ }
+ }
+ ]
+ };
+
+ return Self.app.models.InvoiceIn.findById(id, filter);
+ };
+};
diff --git a/modules/invoiceIn/back/model-config.json b/modules/invoiceIn/back/model-config.json
index 7f95924a4..88d227ba3 100644
--- a/modules/invoiceIn/back/model-config.json
+++ b/modules/invoiceIn/back/model-config.json
@@ -1,5 +1,8 @@
{
"InvoiceIn": {
"dataSource": "vn"
+ },
+ "InvoiceInDueDay": {
+ "dataSource": "vn"
}
}
diff --git a/modules/invoiceIn/back/models/invoice-in-due-day.json b/modules/invoiceIn/back/models/invoice-in-due-day.json
new file mode 100644
index 000000000..6c27dcd6c
--- /dev/null
+++ b/modules/invoiceIn/back/models/invoice-in-due-day.json
@@ -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"
+ }
+ }
+}
+
+
diff --git a/modules/invoiceIn/back/models/invoice-in.js b/modules/invoiceIn/back/models/invoice-in.js
index 278843428..7c5b16358 100644
--- a/modules/invoiceIn/back/models/invoice-in.js
+++ b/modules/invoiceIn/back/models/invoice-in.js
@@ -1,3 +1,4 @@
module.exports = Self => {
require('../methods/invoice-in/filter')(Self);
+ require('../methods/invoice-in/summary')(Self);
};
diff --git a/modules/invoiceIn/back/models/invoice-in.json b/modules/invoiceIn/back/models/invoice-in.json
index 3310c4346..ad14fb511 100644
--- a/modules/invoiceIn/back/models/invoice-in.json
+++ b/modules/invoiceIn/back/models/invoice-in.json
@@ -18,6 +18,9 @@
"serial": {
"type": "string"
},
+ "supplierRef": {
+ "type": "string"
+ },
"issued": {
"type": "date"
},
@@ -27,12 +30,18 @@
"isBooked": {
"type": "boolean"
},
+ "isVatDeductible": {
+ "type": "boolean"
+ },
"booked": {
"type": "date"
},
"operated": {
"type": "date"
},
+ "bookEntried": {
+ "type": "date"
+ },
"dmsFk": {
"type": "number",
"mysql": {
@@ -41,6 +50,16 @@
}
},
"relations": {
+ "invoiceInDueDay": {
+ "type": "hasMany",
+ "model": "InvoiceInDueDay",
+ "foreignKey": "invoiceInFk"
+ },
+ "sageWithholding": {
+ "type": "belongsTo",
+ "model": "SageWithholding",
+ "foreignKey": "withholdingSageFk"
+ },
"company": {
"type": "belongsTo",
"model": "Company",
diff --git a/modules/invoiceIn/front/basic-data/index.html b/modules/invoiceIn/front/basic-data/index.html
new file mode 100644
index 000000000..15052c5fe
--- /dev/null
+++ b/modules/invoiceIn/front/basic-data/index.html
@@ -0,0 +1,93 @@
+