3605-invoiceIn_intrastat3 #921

Merged
carlosjr merged 10 commits from 3605-invoiceIn_intrastat3 into dev 2022-04-11 10:40:20 +00:00
5 changed files with 37 additions and 9 deletions
Showing only changes of commit d8a1bd1b1c - Show all commits

View File

@ -45,28 +45,26 @@
data="intrastats" data="intrastats"
ng-model="intrastat.intrastatFk" ng-model="intrastat.intrastatFk"
show-field="description" show-field="description"
rule> rule
vn-focus>
<tpl-item>{{id | zeroFill:8}}: {{description}}</tpl-item> <tpl-item>{{id | zeroFill:8}}: {{description}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
<vn-input-number <vn-input-number
label="Amount" label="Amount"
ng-model="intrastat.amount" ng-model="intrastat.amount"
step="0.01" step="0.01"
rule rule>
vicent marked this conversation as resolved Outdated

too many vn-focus, you just focus one.

too many vn-focus, you just focus one.
vn-focus>
</vn-input-number> </vn-input-number>
<vn-input-number <vn-input-number
label="Net" label="Net"
ng-model="intrastat.net" ng-model="intrastat.net"
step="0.01" step="0.01"
rule rule>
vn-focus>
</vn-input-number> </vn-input-number>
<vn-input-number <vn-input-number
label="Stems" label="Stems"
ng-model="intrastat.stems" ng-model="intrastat.stems"
rule rule>
vn-focus>
</vn-input-number> </vn-input-number>
<vn-autocomplete <vn-autocomplete
label="Country" label="Country"

View File

@ -16,9 +16,9 @@ class Controller extends Section {
this.amountTotal = 0.0; this.amountTotal = 0.0;
this.netTotal = 0.0; this.netTotal = 0.0;
this.stemsTotal = 0.0; this.stemsTotal = 0.0;
if (!this._invoceInIntrastat) return; if (!this.invoceInIntrastat) return;
this._invoceInIntrastat.forEach(intrastat => { this.invoceInIntrastat.forEach(intrastat => {
vicent marked this conversation as resolved Outdated

Do not access private properties if you have getters and setters in your toolkit.

Do not access private properties if you have getters and setters in your toolkit.
this.amountTotal += intrastat.amount; this.amountTotal += intrastat.amount;
this.netTotal += intrastat.net; this.netTotal += intrastat.net;
this.stemsTotal += intrastat.stems; this.stemsTotal += intrastat.stems;

View File

@ -31,6 +31,36 @@ describe('InvoiceIn', () => {
expect(controller.netTotal).toEqual(0); expect(controller.netTotal).toEqual(0);
expect(controller.stemsTotal).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()', () => { describe('onSubmit()', () => {