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"
ng-model="intrastat.intrastatFk"
show-field="description"
rule>
rule
vn-focus>
<tpl-item>{{id | zeroFill:8}}: {{description}}</tpl-item>
</vn-autocomplete>
<vn-input-number
label="Amount"
ng-model="intrastat.amount"
step="0.01"
rule
vn-focus>
rule>
</vn-input-number>
<vn-input-number
label="Net"
ng-model="intrastat.net"
step="0.01"
rule
vn-focus>
rule>
</vn-input-number>
<vn-input-number
label="Stems"
ng-model="intrastat.stems"
rule
vn-focus>
rule>
</vn-input-number>
<vn-autocomplete
label="Country"

View File

@ -16,9 +16,9 @@ class Controller extends Section {
this.amountTotal = 0.0;
this.netTotal = 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.netTotal += intrastat.net;
this.stemsTotal += intrastat.stems;

View File

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