Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev This commit looks good Details

This commit is contained in:
Gerard 2019-03-25 15:49:10 +01:00
commit 2c7b9968eb
9 changed files with 152 additions and 97 deletions

View File

@ -384,23 +384,30 @@ INSERT INTO `vn`.`bankEntity`(`id`, `countryFk`, `name`, `bic`)
( 791 , 'FTH', NULL, 30, NULL, 3, '2015-11-30'), ( 791 , 'FTH', NULL, 30, NULL, 3, '2015-11-30'),
( 1381, 'ORN', NULL, 30, NULL, 7, NULL); ( 1381, 'ORN', NULL, 30, NULL, 7, NULL);
INSERT INTO `vn`.`invoiceOut`(`id`,`ref`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `pdf`) INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `pdf`)
VALUES VALUES
( 1, '1', 'T', 500 , DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 101, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1), ( 1, 'T', 500 , DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 101, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
( 2, '1', 'V', 350.50 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 102, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1), ( 2, 'T', 350.50 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 102, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
( 3, '1', 'E', 90.30 , CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1), ( 3, 'T', 90.30 , CURDATE(), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
( 4, '1', 'E', 290.30 , DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1), ( 4, 'T', 290.30 , DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1),
( 5, '1', 'R', 190.30 , DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1); ( 5, 'A', 190.30 , DATE_ADD(CURDATE(), INTERVAL +2 MONTH), 103, CURDATE(), 442, CURDATE(), CURDATE(), 1, 1);
UPDATE `vn`.`invoiceOut` SET ref = 'T1111111' WHERE id = 1;
UPDATE `vn`.`invoiceOut` SET ref = 'T2222222' WHERE id = 2;
UPDATE `vn`.`invoiceOut` SET ref = 'T3333333' WHERE id = 3;
UPDATE `vn`.`invoiceOut` SET ref = 'T4444444' WHERE id = 4;
UPDATE `vn`.`invoiceOut` SET ref = 'A1111111' WHERE id = 5;
INSERT INTO `vn`.`ticket`(`id`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `created`) INSERT INTO `vn`.`ticket`(`id`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `created`)
VALUES VALUES
(1 , 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY) , DATE_ADD(CURDATE(), INTERVAL -15 DAY) , 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY) ), (1 , 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -15 DAY) , DATE_ADD(CURDATE(), INTERVAL -15 DAY) , 101, 'address 21', 121, 'T1111111', 0, DATE_ADD(CURDATE(), INTERVAL -15 DAY) ),
(2 , 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY) , DATE_ADD(CURDATE(), INTERVAL -10 DAY) , 101, 'address 21', 121, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -10 DAY) ), (2 , 1, 1, 1, DATE_ADD(CURDATE(), INTERVAL -10 DAY) , DATE_ADD(CURDATE(), INTERVAL -10 DAY) , 101, 'address 21', 121, 'T2222222', 0, DATE_ADD(CURDATE(), INTERVAL -10 DAY) ),
(3 , 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -5 DAY) , DATE_ADD(CURDATE(), INTERVAL -5 DAY) , 102, 'address 22', 122, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -5 DAY) ), (3 , 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -5 DAY) , DATE_ADD(CURDATE(), INTERVAL -5 DAY) , 102, 'address 22', 122, 'T2222222', 0, DATE_ADD(CURDATE(), INTERVAL -5 DAY) ),
(4 , 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -4 DAY) , DATE_ADD(CURDATE(), INTERVAL -4 DAY) , 102, 'address 22', 122, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -4 DAY) ), (4 , 2, 2, 2, DATE_ADD(CURDATE(), INTERVAL -4 DAY) , DATE_ADD(CURDATE(), INTERVAL -4 DAY) , 102, 'address 22', 122, 'T3333333', 0, DATE_ADD(CURDATE(), INTERVAL -4 DAY) ),
(5 , 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) , 103, 'address 23', 123, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -3 DAY) ), (5 , 3, 3, 3, DATE_ADD(CURDATE(), INTERVAL -3 DAY) , DATE_ADD(CURDATE(), INTERVAL -3 DAY) , 103, 'address 23', 123, 'T3333333', 0, DATE_ADD(CURDATE(), INTERVAL -3 DAY) ),
(6 , 3, 3, 4, DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) , 103, 'address 23', 123, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -2 DAY) ), (6 , 3, 3, 4, DATE_ADD(CURDATE(), INTERVAL -2 DAY) , DATE_ADD(CURDATE(), INTERVAL -2 DAY) , 103, 'address 23', 123, 'T4444444', 0, DATE_ADD(CURDATE(), INTERVAL -2 DAY) ),
(7 , 4, 4, 4, DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) , 104, 'address 24', 124, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -1 DAY) ), (7 , 4, 4, 4, DATE_ADD(CURDATE(), INTERVAL -1 DAY) , DATE_ADD(CURDATE(), INTERVAL -1 DAY) , 104, 'address 24', 124, 'T4444444', 0, DATE_ADD(CURDATE(), INTERVAL -1 DAY) ),
(8 , 1, 1, 4, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 104, 'address 24', 124, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH) ), (8 , 1, 1, 4, DATE_ADD(CURDATE(), INTERVAL +1 MONTH), DATE_ADD(CURDATE(), INTERVAL +1 MONTH), 104, 'address 24', 124, NULL, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH) ),
(9 , 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 105, 'address 25', 125, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH) ), (9 , 5, 5, 4, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), DATE_ADD(CURDATE(), INTERVAL -2 MONTH), 105, 'address 25', 125, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH) ),
(10, 6, 5, 5, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 105, 'address 25', 125, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -3 MONTH) ), (10, 6, 5, 5, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), DATE_ADD(CURDATE(), INTERVAL -3 MONTH), 105, 'address 25', 125, NULL, 0, DATE_ADD(CURDATE(), INTERVAL -3 MONTH) ),
@ -601,12 +608,18 @@ INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `pric
(10, 2, 16, 'Object2 Gem2 3', 10, 1.07, 0, 0, 0, CURDATE()), (10, 2, 16, 'Object2 Gem2 3', 10, 1.07, 0, 0, 0, CURDATE()),
(11, 1, 16, 'Object1 Gem1 5', 2, 9.10, 0, 0, 0, CURDATE()), (11, 1, 16, 'Object1 Gem1 5', 2, 9.10, 0, 0, 0, CURDATE()),
(12, 4, 16, 'Object4 Armor2 2', 20, 3.06, 0, 0, 0, CURDATE()), (12, 4, 16, 'Object4 Armor2 2', 20, 3.06, 0, 0, 0, CURDATE()),
(13, 2, 8, 'Object2 Gem2 3', 15, 1.30, 0, 0, 0, CURDATE()), (13, 2, 8, 'Object2 Gem2 3', 15, 1.30, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
(14, 1, 8, 'Object1 Gem1 5', 10, 2.30, 0, 0, 0, CURDATE()), (14, 1, 8, 'Object1 Gem1 5', 10, 2.30, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 MONTH)),
(15, 1, 19, 'Object1 Gem1 5', 10, 1.50, 0, 0, 0, CURDATE()), (15, 1, 19, 'Object1 Gem1 5', 10, 1.50, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY)),
(16, 2, 20, 'Object2 Gem2 3', 15, 1.30, 0, 0, 0, CURDATE()), (16, 2, 20, 'Object2 Gem2 3', 15, 1.30, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY)),
(17, 2, 22, 'Object2 Gem2 3', 30, 2.30, 0, 0, 0, CURDATE()), (17, 2, 22, 'Object2 Gem2 3', 30, 2.30, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY)),
(18, 4, 22, 'Object4 Armor2 2', 20, 3.00, 0, 0, 0, CURDATE()); (18, 4, 22, 'Object4 Armor2 2', 20, 3.00, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL +1 DAY)),
(19, 1, 4, 'Object1 Gem1 5', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -4 DAY)),
(20, 1, 5, 'Object1 Gem1 5', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -3 DAY)),
(21, 1, 6, 'Object1 Gem1 5', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -2 DAY)),
(22, 1, 7, 'Object1 Gem1 5', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -1 DAY)),
(23, 1, 9, 'Object1 Gem1 5', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
(24, 1, 10, 'Object1 Gem1 5', 1, 9.10, 0, 0, 0, DATE_ADD(CURDATE(), INTERVAL -3 MONTH));
INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`) INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`)
VALUES VALUES
@ -703,7 +716,37 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
(18, 28, 20.72), (18, 28, 20.72),
(18, 29, -19.72), (18, 29, -19.72),
(18, 37, 2), (18, 37, 2),
(18, 39, 0.01); (18, 39, 0.01),
(19, 15, 0.58),
(19, 23, 6.5),
(19, 28, 20.72),
(19, 29, -18.72),
(19, 39, 0.02),
(20, 15, 0.58),
(20, 23, 6.5),
(20, 28, 20.72),
(20, 29, -18.72),
(20, 39, 0.02),
(21, 15, 0.58),
(21, 23, 6.5),
(21, 28, 20.72),
(21, 29, -18.72),
(21, 39, 0.02),
(22, 15, 0.58),
(22, 23, 6.5),
(22, 28, 20.72),
(22, 29, -18.72),
(22, 39, 0.02),
(23, 15, 0.58),
(23, 23, 6.5),
(23, 28, 20.72),
(23, 29, -18.72),
(23, 39, 0.02),
(24, 15, 0.58),
(24, 23, 6.5),
(24, 28, 20.72),
(24, 29, -18.72),
(24, 39, 0.02);
INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `actionFk`, `id`, `stateFk`) INSERT INTO `vn`.`saleTracking`(`saleFk`, `isChecked`, `created`, `originalQuantity`, `workerFk`, `actionFk`, `id`, `stateFk`)
VALUES VALUES

View File

@ -2,5 +2,3 @@ import './module';
import './routes'; import './routes';
import './components'; import './components';
import './styles'; import './styles';
// XXX: Pull request: Test 2

View File

@ -7,6 +7,6 @@ describe('Client get', () => {
expect(result.id).toEqual(101); expect(result.id).toEqual(101);
expect(result.name).toEqual('Bruce Wayne'); expect(result.name).toEqual('Bruce Wayne');
expect(result.debt).toEqual(598.45); expect(result.debt).toEqual(329.26);
}); });
}); });

View File

@ -17,7 +17,7 @@ describe('client summary()', () => {
it('should return a summary object containing debt', async() => { it('should return a summary object containing debt', async() => {
let result = await app.models.Client.summary(101); let result = await app.models.Client.summary(101);
expect(result.debt.debt).toEqual(598.45); expect(result.debt.debt).toEqual(329.26);
}); });
it('should return a summary object containing averageInvoiced', async() => { it('should return a summary object containing averageInvoiced', async() => {

View File

@ -1,11 +1,11 @@
const app = require('vn-loopback/server/server'); const app = require('vn-loopback/server/server');
describe('item getShipped()', () => { describe('item getShipped()', () => {
it('should return 3 entries, the first one with the property balance -100', async() => { it('should return 3 entries and with a given balance for the first one', async() => {
let params = {where: {itemFk: 1, warehouseFk: 2}}; let params = {where: {itemFk: 1, warehouseFk: 2}};
let result = await app.models.Item.getDiary(params); let result = await app.models.Item.getDiary(params);
expect(result.length).toBe(3); expect(result.length).toBe(4);
expect(result[0].balance).toBe(-100); expect(result[0].balance).toBe(-100);
}); });
}); });

View File

@ -71,6 +71,10 @@ module.exports = Self => {
arg: 'orderFk', arg: 'orderFk',
type: 'Number', type: 'Number',
description: `The order id filter` description: `The order id filter`
}, {
arg: 'refFk',
type: 'string',
description: `The invoice reference filter`
}, { }, {
arg: 'alertLevel', arg: 'alertLevel',
type: 'Number', type: 'Number',
@ -138,6 +142,8 @@ module.exports = Self => {
return {'t.shipped': {lte: value}}; return {'t.shipped': {lte: value}};
case 'nickname': case 'nickname':
return {'t.nickname': {like: `%${value}%`}}; return {'t.nickname': {like: `%${value}%`}};
case 'refFk':
return {'t.refFk': value};
case 'salesPersonFk': case 'salesPersonFk':
return {'c.salesPersonFk': value}; return {'c.salesPersonFk': value};
case 'provinceFk': case 'provinceFk':

View File

@ -42,6 +42,7 @@
<vn-th field="state" >State</vn-th> <vn-th field="state" >State</vn-th>
<vn-th field="agencyMode">Agency</vn-th> <vn-th field="agencyMode">Agency</vn-th>
<vn-th field="warehouse">Warehouse</vn-th> <vn-th field="warehouse">Warehouse</vn-th>
<vn-th field="invoice">Invoice</vn-th>
<vn-th number>Total</vn-th> <vn-th number>Total</vn-th>
<vn-th></vn-th> <vn-th></vn-th>
</vn-tr> </vn-tr>
@ -105,6 +106,7 @@
</vn-td> </vn-td>
<vn-td>{{::ticket.agencyMode}}</vn-td> <vn-td>{{::ticket.agencyMode}}</vn-td>
<vn-td>{{::ticket.warehouse}}</vn-td> <vn-td>{{::ticket.warehouse}}</vn-td>
<vn-td>{{::ticket.refFk | dashIfEmpty}}</vn-td>
<vn-td number>{{::ticket.total | currency: 'EUR': 2}}</vn-td> <vn-td number>{{::ticket.total | currency: 'EUR': 2}}</vn-td>
<vn-td actions> <vn-td actions>
<vn-icon-button <vn-icon-button

View File

@ -14,18 +14,28 @@
label="Nickname" label="Nickname"
model="filter.nickname"> model="filter.nickname">
</vn-textfield> </vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield <vn-textfield
vn-one vn-one
label="Ticket id" label="Ticket id"
model="filter.id"> model="filter.id">
</vn-textfield> </vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-textfield <vn-textfield
vn-one vn-one
label="Client id" label="Client id"
model="filter.clientFk"> model="filter.clientFk">
</vn-textfield> </vn-textfield>
<vn-autocomplete
vn-one
field="filter.salesPersonFk"
url="/client/api/Clients/activeWorkersWithRole"
search-function="{firstName: $search}"
value-field="id"
where="{role: 'employee'}"
label="Sales person">
<tpl-item>{{firstName}} {{name}}</tpl-item>
</vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal> <vn-horizontal>
<vn-date-picker <vn-date-picker
@ -56,14 +66,38 @@
<vn-horizontal> <vn-horizontal>
<vn-autocomplete <vn-autocomplete
vn-one vn-one
field="filter.salesPersonFk" label="State"
url="/client/api/Clients/activeWorkersWithRole" field="filter.stateFk"
search-function="{firstName: $search}" url="/api/States">
value-field="id"
where="{role: 'employee'}"
label="Sales person">
<tpl-item>{{firstName}} {{name}}</tpl-item>
</vn-autocomplete> </vn-autocomplete>
<vn-autocomplete
vn-one
label="Grouped States"
value-field="alertLevel"
show-field="code"
field="filter.alertLevel"
url="/api/AlertLevels">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-textfield
vn-one
label="Order id"
model="filter.orderFk">
</vn-textfield>
<vn-textfield
vn-one
label="Invoice"
model="filter.refFk">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-check
vn-one
label="My team"
field="filter.myTeam"
triple-state="true">
</vn-check>
<vn-autocomplete <vn-autocomplete
vn-one vn-one
label="Province" label="Province"
@ -71,35 +105,6 @@
url="/api/Provinces"> url="/api/Provinces">
</vn-autocomplete> </vn-autocomplete>
</vn-horizontal> </vn-horizontal>
<vn-horizontal>
<vn-autocomplete
vn-one
label="State"
field="filter.stateFk"
url="/api/States">
</vn-autocomplete>
<vn-textfield
vn-one
label="Order id"
model="filter.orderFk">
</vn-textfield>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete
vn-one
label="State"
value-field="alertLevel"
show-field="code"
field="filter.alertLevel"
url="/api/AlertLevels">
</vn-autocomplete>
<vn-check
vn-one
label="My team"
field="filter.myTeam"
triple-state="true">
</vn-check>
</vn-horizontal>
<vn-horizontal margin-large-top> <vn-horizontal margin-large-top>
<vn-submit label="Search"></vn-submit> <vn-submit label="Search"></vn-submit>
</vn-horizontal> </vn-horizontal>

View File

@ -9,3 +9,4 @@ Sales person: Comercial
Province: Provincia Province: Provincia
My team: Mi equipo My team: Mi equipo
Order id: Id pedido Order id: Id pedido
Grouped States: Estado agrupado