fix: pull request changes
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Vicent Llopis 2022-04-11 08:23:54 +02:00
parent 5b1d610f2f
commit d8a1bd1b1c
5 changed files with 37 additions and 9 deletions

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>
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 => {
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()', () => {