diff --git a/db/changes/10440-fallas/00-aclIntrastat.sql b/db/changes/10440-fallas/00-aclIntrastat.sql
new file mode 100644
index 000000000..16410814d
--- /dev/null
+++ b/db/changes/10440-fallas/00-aclIntrastat.sql
@@ -0,0 +1,3 @@
+INSERT INTO `salix`.`ACL`
+(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
+VALUES('InvoiceInIntrastat', '*', '*', 'ALLOW', 'ROLE', 'employee');
\ No newline at end of file
diff --git a/db/changes/10440-fallas/00-invoiceInIntrastat.sql b/db/changes/10440-fallas/00-invoiceInIntrastat.sql
new file mode 100644
index 000000000..8f65fac29
--- /dev/null
+++ b/db/changes/10440-fallas/00-invoiceInIntrastat.sql
@@ -0,0 +1,2 @@
+INSERT INTO `salix`.`ACL` (`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`)
+ VALUES ('InvoiceInIntrastat','*','*','ALLOW','ROLE','employee');
\ No newline at end of file
diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql
index 5bd89ebd2..0802a980c 100644
--- a/db/dump/fixtures.sql
+++ b/db/dump/fixtures.sql
@@ -2428,6 +2428,13 @@ INSERT INTO `vn`.`invoiceInTax` (`invoiceInFk`, `taxableBase`, `expenceFk`, `for
(6, 29.95, '7001000000', NULL, 7, 20),
(7, 58.64, '6210000567', NULL, 8, 20);
+INSERT INTO `vn`.`invoiceInIntrastat` (`invoiceInFk`, `net`, `intrastatFk`, `amount`, `stems`, `countryFk`)
+ VALUES
+ (1, 30.50, 5080000, 10.00, 162, 5),
+ (1, 10, 6021010, 20.00, 205, 5),
+ (2, 13.20, 5080000, 15.00, 580, 5),
+ (2, 16.10, 6021010, 25.00, 80, 5);
+
INSERT INTO `vn`.`ticketRecalc`(`ticketFk`)
SELECT `id`
FROM `vn`.`ticket` t
diff --git a/modules/invoiceIn/back/methods/invoice-in/summary.js b/modules/invoiceIn/back/methods/invoice-in/summary.js
index acabe29d9..0e55eeaac 100644
--- a/modules/invoiceIn/back/methods/invoice-in/summary.js
+++ b/modules/invoiceIn/back/methods/invoice-in/summary.js
@@ -64,6 +64,34 @@ module.exports = Self => {
}]
}
},
+ {
+ relation: 'invoiceInIntrastat',
+ scope: {
+ fields: [
+ 'id',
+ 'invoiceInFk',
+ 'net',
+ 'intrastatFk',
+ 'amount',
+ 'stems',
+ 'countryFk',
+ 'statisticalValue'],
+ include: [{
+ relation: 'intrastat',
+ scope: {
+ fields: [
+ 'id',
+ 'description']
+ }
+ },
+ {
+ relation: 'country',
+ scope: {
+ fields: ['code']
+ }
+ }]
+ }
+ },
{
relation: 'invoiceInTax',
scope: {
diff --git a/modules/invoiceIn/back/model-config.json b/modules/invoiceIn/back/model-config.json
index f0745f53b..6765ae81c 100644
--- a/modules/invoiceIn/back/model-config.json
+++ b/modules/invoiceIn/back/model-config.json
@@ -8,6 +8,9 @@
"InvoiceInDueDay": {
"dataSource": "vn"
},
+ "InvoiceInIntrastat": {
+ "dataSource": "vn"
+ },
"InvoiceInLog": {
"dataSource": "vn"
}
diff --git a/modules/invoiceIn/back/models/invoice-in-intrastat.json b/modules/invoiceIn/back/models/invoice-in-intrastat.json
new file mode 100644
index 000000000..65ab1f36a
--- /dev/null
+++ b/modules/invoiceIn/back/models/invoice-in-intrastat.json
@@ -0,0 +1,50 @@
+{
+ "name": "InvoiceInIntrastat",
+ "base": "VnModel",
+ "options": {
+ "mysql": {
+ "table": "invoiceInIntrastat"
+ }
+ },
+ "properties": {
+ "id": {
+ "id": true,
+ "type": "number",
+ "description": "Identifier"
+ },
+ "invoiceInFk": {
+ "type": "number"
+ },
+ "net": {
+ "type": "number"
+ },
+ "intrastatFk": {
+ "type": "number"
+ },
+ "amount": {
+ "type": "number"
+ },
+ "stems": {
+ "type": "number"
+ },
+ "countryFk": {
+ "type": "number"
+ },
+ "statisticalValue": {
+ "type": "number"
+ }
+ },
+ "relations": {
+ "intrastat": {
+ "type": "belongsTo",
+ "model": "Intrastat",
+ "foreignKey": "intrastatFk"
+ },
+ "country": {
+ "type": "belongsTo",
+ "model": "Country",
+ "foreignKey": "countryFk"
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/modules/invoiceIn/back/models/invoice-in.json b/modules/invoiceIn/back/models/invoice-in.json
index feb2d9aec..c6a736b06 100644
--- a/modules/invoiceIn/back/models/invoice-in.json
+++ b/modules/invoiceIn/back/models/invoice-in.json
@@ -64,6 +64,11 @@
"model": "InvoiceInDueDay",
"foreignKey": "invoiceInFk"
},
+ "invoiceInIntrastat": {
+ "type": "hasMany",
+ "model": "InvoiceInIntrastat",
+ "foreignKey": "invoiceInFk"
+ },
"invoiceInTax": {
"type": "hasMany",
"model": "InvoiceInTax",
diff --git a/modules/invoiceIn/front/index.js b/modules/invoiceIn/front/index.js
index 18e9d73c2..7b6d6a77c 100644
--- a/modules/invoiceIn/front/index.js
+++ b/modules/invoiceIn/front/index.js
@@ -10,5 +10,6 @@ import './summary';
import './basic-data';
import './tax';
import './dueDay';
+import './intrastat';
import './create';
import './log';
diff --git a/modules/invoiceIn/front/intrastat/index.html b/modules/invoiceIn/front/intrastat/index.html
new file mode 100644
index 000000000..cb447132d
--- /dev/null
+++ b/modules/invoiceIn/front/intrastat/index.html
@@ -0,0 +1,100 @@
+