diff --git a/db/changes/10420-valentines/00-aclIntrastat.sql b/db/changes/10440-fallas/00-aclIntrastat.sql
similarity index 100%
rename from db/changes/10420-valentines/00-aclIntrastat.sql
rename to db/changes/10440-fallas/00-aclIntrastat.sql
diff --git a/db/changes/10420-valentines/00-invoiceInIntrastat.sql b/db/changes/10440-fallas/00-invoiceInIntrastat.sql
similarity index 100%
rename from db/changes/10420-valentines/00-invoiceInIntrastat.sql
rename to db/changes/10440-fallas/00-invoiceInIntrastat.sql
diff --git a/modules/invoiceIn/front/intrastat/index.html b/modules/invoiceIn/front/intrastat/index.html
index c58839e38..cb447132d 100644
--- a/modules/invoiceIn/front/intrastat/index.html
+++ b/modules/invoiceIn/front/intrastat/index.html
@@ -45,28 +45,26 @@
data="intrastats"
ng-model="intrastat.intrastatFk"
show-field="description"
- rule>
+ rule
+ vn-focus>
{{id | zeroFill:8}}: {{description}}
+ rule>
+ rule>
+ rule>
{
+ this.invoceInIntrastat.forEach(intrastat => {
this.amountTotal += intrastat.amount;
this.netTotal += intrastat.net;
this.stemsTotal += intrastat.stems;
diff --git a/modules/invoiceIn/front/intrastat/index.spec.js b/modules/invoiceIn/front/intrastat/index.spec.js
index d0db17904..d7d50ac5b 100644
--- a/modules/invoiceIn/front/intrastat/index.spec.js
+++ b/modules/invoiceIn/front/intrastat/index.spec.js
@@ -31,6 +31,36 @@ describe('InvoiceIn', () => {
expect(controller.netTotal).toEqual(0);
expect(controller.stemsTotal).toEqual(0);
});
+
+ it('should set amountTotal, netTotal and stemsTotal', () => {
+ controller.invoceInIntrastat = [
+ {
+ id: 1,
+ invoiceInFk: 1,
+ net: 30.5,
+ intrastatFk: 5080000,
+ amount: 10,
+ stems: 162,
+ countryFk: 5,
+ statisticalValue: 0
+ },
+ {
+ id: 2,
+ invoiceInFk: 1,
+ net: 10,
+ intrastatFk: 6021010,
+ amount: 20,
+ stems: 205,
+ countryFk: 5,
+ statisticalValue: 0
+ }
+ ];
+ controller.calculateTotals();
+
+ expect(controller.amountTotal).toEqual(30);
+ expect(controller.netTotal).toEqual(40.5);
+ expect(controller.stemsTotal).toEqual(367);
+ });
});
describe('onSubmit()', () => {