From d8a1bd1b1c22b834da3d2717c5ac36f747cda737 Mon Sep 17 00:00:00 2001 From: vicent Date: Mon, 11 Apr 2022 08:23:54 +0200 Subject: [PATCH] fix: pull request changes --- .../00-aclIntrastat.sql | 0 .../00-invoiceInIntrastat.sql | 0 modules/invoiceIn/front/intrastat/index.html | 12 ++++---- modules/invoiceIn/front/intrastat/index.js | 4 +-- .../invoiceIn/front/intrastat/index.spec.js | 30 +++++++++++++++++++ 5 files changed, 37 insertions(+), 9 deletions(-) rename db/changes/{10420-valentines => 10440-fallas}/00-aclIntrastat.sql (100%) rename db/changes/{10420-valentines => 10440-fallas}/00-invoiceInIntrastat.sql (100%) 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()', () => {