Merge branch 'dev' into 3513-export_database
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
dc0a498b4d
|
@ -0,0 +1,38 @@
|
||||||
|
USE vn;
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE OR REPLACE
|
||||||
|
ALGORITHM = UNDEFINED VIEW `vn`.`saleVolume` AS
|
||||||
|
select
|
||||||
|
`s`.`ticketFk` AS `ticketFk`,
|
||||||
|
`s`.`id` AS `saleFk`,
|
||||||
|
round(`ic`.`cm3delivery` * `s`.`quantity` / 1000, 0) AS `litros`,
|
||||||
|
`t`.`routeFk` AS `routeFk`,
|
||||||
|
`t`.`shipped` AS `shipped`,
|
||||||
|
`t`.`landed` AS `landed`,
|
||||||
|
`s`.`quantity` * `ic`.`cm3delivery` / 1000000 AS `volume`,
|
||||||
|
`s`.`quantity` * `ic`.`grams` / 1000 AS `physicalWeight`,
|
||||||
|
`s`.`quantity` * `ic`.`cm3delivery` * greatest(`i`.`density`, 167) / 1000000 AS `weight`,
|
||||||
|
`s`.`quantity` * `ic`.`cm3delivery` / 1000000 AS `physicalVolume`,
|
||||||
|
`s`.`quantity` * `ic`.`cm3delivery` * ifnull(`t`.`zonePrice`, `z`.`price`) / (`vc`.`standardFlowerBox` * 1000) AS `freight`,
|
||||||
|
`t`.`zoneFk` AS `zoneFk`,
|
||||||
|
`t`.`clientFk` AS `clientFk`,
|
||||||
|
`s`.`isPicked` AS `isPicked`,
|
||||||
|
`s`.`quantity` * `s`.`price` * (100 - `s`.`discount`) / 100 AS `eurosValue`,
|
||||||
|
`i`.`itemPackingTypeFk` AS `itemPackingTypeFk`
|
||||||
|
from
|
||||||
|
(((((`sale` `s`
|
||||||
|
join `item` `i` on
|
||||||
|
(`i`.`id` = `s`.`itemFk`))
|
||||||
|
join `ticket` `t` on
|
||||||
|
(`t`.`id` = `s`.`ticketFk`))
|
||||||
|
join `zone` `z` on
|
||||||
|
(`z`.`id` = `t`.`zoneFk`))
|
||||||
|
join `volumeConfig` `vc`)
|
||||||
|
join `itemCost` `ic` on
|
||||||
|
(`ic`.`itemFk` = `s`.`itemFk`
|
||||||
|
and `ic`.`warehouseFk` = `t`.`warehouseFk`))
|
||||||
|
where
|
||||||
|
`s`.`quantity` > 0;
|
||||||
|
$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,25 @@
|
||||||
|
ALTER TABLE `postgresql`.`business` ADD payedHolidays INT NULL;
|
||||||
|
ALTER TABLE `postgresql`.`business` CHANGE payedHolidays payedHolidays INT NULL AFTER reasonEndFk;
|
||||||
|
|
||||||
|
CREATE OR REPLACE
|
||||||
|
ALGORITHM = UNDEFINED VIEW `vn`.`workerLabour` AS
|
||||||
|
select
|
||||||
|
`b`.`business_id` AS `businessFk`,
|
||||||
|
`p`.`id_trabajador` AS `workerFk`,
|
||||||
|
`bl`.`workcenter_id` AS `workCenterFk`,
|
||||||
|
`b`.`date_start` AS `started`,
|
||||||
|
`b`.`date_end` AS `ended`,
|
||||||
|
`d`.`id` AS `departmentFk`,
|
||||||
|
`b`.`payedHolidays` AS `payedHolidays`
|
||||||
|
from
|
||||||
|
((((`postgresql`.`person` `p`
|
||||||
|
join `postgresql`.`profile` `pr` on
|
||||||
|
((`pr`.`person_id` = `p`.`person_id`)))
|
||||||
|
join `postgresql`.`business` `b` on
|
||||||
|
((`b`.`client_id` = `pr`.`profile_id`)))
|
||||||
|
join `postgresql`.`business_labour` `bl` on
|
||||||
|
((`b`.`business_id` = `bl`.`business_id`)))
|
||||||
|
join `vn`.`department` `d` on
|
||||||
|
((`d`.`id` = `bl`.`department_id`)))
|
||||||
|
order by
|
||||||
|
`b`.`date_start` desc
|
|
@ -799,25 +799,25 @@ INSERT INTO `vn`.`itemFamily`(`code`, `description`)
|
||||||
('VT', 'Sales');
|
('VT', 'Sales');
|
||||||
|
|
||||||
INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenceFk`,
|
INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenceFk`,
|
||||||
`comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`)
|
`comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'VT', 0, NULL),
|
(1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'VT', 0, NULL, 'V'),
|
||||||
(2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL),
|
(2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL, 'H'),
|
||||||
(3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL),
|
(3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL, NULL),
|
||||||
(4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL),
|
(4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL, NULL),
|
||||||
(5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL),
|
(5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL, NULL),
|
||||||
(6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL),
|
(6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL, NULL),
|
||||||
(7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL),
|
(7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL, NULL),
|
||||||
(8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL),
|
(8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL, NULL),
|
||||||
(9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL),
|
(9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL, NULL),
|
||||||
(10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL),
|
(10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL, NULL),
|
||||||
(11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL),
|
(11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL, NULL),
|
||||||
(12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL),
|
(12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL, NULL),
|
||||||
(13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 0, 2, 'VT', 1, NULL),
|
(13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 0, 2, 'VT', 1, NULL, NULL),
|
||||||
(14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL),
|
(14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL, NULL),
|
||||||
(15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL),
|
(15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL),
|
||||||
(16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL),
|
(16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL),
|
||||||
(71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL);
|
(71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL, NULL);
|
||||||
|
|
||||||
-- Update the taxClass after insert of the items
|
-- Update the taxClass after insert of the items
|
||||||
UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2
|
UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2
|
||||||
|
|
|
@ -91,32 +91,26 @@
|
||||||
}
|
}
|
||||||
.icon-calc_volum .path1:before {
|
.icon-calc_volum .path1:before {
|
||||||
content: "\e915";
|
content: "\e915";
|
||||||
color: rgb(0, 0, 0);
|
|
||||||
}
|
}
|
||||||
.icon-calc_volum .path2:before {
|
.icon-calc_volum .path2:before {
|
||||||
content: "\e916";
|
content: "\e916";
|
||||||
margin-left: -1em;
|
margin-left: -1em;
|
||||||
color: rgb(0, 0, 0);
|
|
||||||
}
|
}
|
||||||
.icon-calc_volum .path3:before {
|
.icon-calc_volum .path3:before {
|
||||||
content: "\e917";
|
content: "\e917";
|
||||||
margin-left: -1em;
|
margin-left: -1em;
|
||||||
color: rgb(0, 0, 0);
|
|
||||||
}
|
}
|
||||||
.icon-calc_volum .path4:before {
|
.icon-calc_volum .path4:before {
|
||||||
content: "\e918";
|
content: "\e918";
|
||||||
margin-left: -1em;
|
margin-left: -1em;
|
||||||
color: rgb(0, 0, 0);
|
|
||||||
}
|
}
|
||||||
.icon-calc_volum .path5:before {
|
.icon-calc_volum .path5:before {
|
||||||
content: "\e919";
|
content: "\e919";
|
||||||
margin-left: -1em;
|
margin-left: -1em;
|
||||||
color: rgb(0, 0, 0);
|
|
||||||
}
|
}
|
||||||
.icon-calc_volum .path6:before {
|
.icon-calc_volum .path6:before {
|
||||||
content: "\e91a";
|
content: "\e91a";
|
||||||
margin-left: -1em;
|
margin-left: -1em;
|
||||||
color: rgb(255, 255, 255);
|
|
||||||
}
|
}
|
||||||
.icon-deliveryprices:before {
|
.icon-deliveryprices:before {
|
||||||
content: "\e91c";
|
content: "\e91c";
|
||||||
|
@ -144,7 +138,6 @@
|
||||||
}
|
}
|
||||||
.icon-invoice:before {
|
.icon-invoice:before {
|
||||||
content: "\e924";
|
content: "\e924";
|
||||||
color: #5f5f5f;
|
|
||||||
}
|
}
|
||||||
.icon-supplier:before {
|
.icon-supplier:before {
|
||||||
content: "\e925";
|
content: "\e925";
|
||||||
|
@ -160,7 +153,6 @@
|
||||||
}
|
}
|
||||||
.icon-shipment-01:before {
|
.icon-shipment-01:before {
|
||||||
content: "\e929";
|
content: "\e929";
|
||||||
color: #000;
|
|
||||||
}
|
}
|
||||||
.icon-inventory:before {
|
.icon-inventory:before {
|
||||||
content: "\e92b";
|
content: "\e92b";
|
||||||
|
@ -398,7 +390,6 @@
|
||||||
}
|
}
|
||||||
.icon-bucket:before {
|
.icon-bucket:before {
|
||||||
content: "\e97a";
|
content: "\e97a";
|
||||||
color: #000;
|
|
||||||
}
|
}
|
||||||
.icon-mandatory:before {
|
.icon-mandatory:before {
|
||||||
content: "\e97b";
|
content: "\e97b";
|
||||||
|
@ -411,7 +402,6 @@
|
||||||
}
|
}
|
||||||
.icon-invoices:before {
|
.icon-invoices:before {
|
||||||
content: "\e97f";
|
content: "\e97f";
|
||||||
color: #000;
|
|
||||||
}
|
}
|
||||||
.icon-grid:before {
|
.icon-grid:before {
|
||||||
content: "\e980";
|
content: "\e980";
|
||||||
|
|
|
@ -179,7 +179,7 @@
|
||||||
ng-click="$ctrl.selectItem(item.id)">
|
ng-click="$ctrl.selectItem(item.id)">
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<span
|
<span
|
||||||
ng-click="itemDescriptor.show($event, item.id)"
|
vn-click-stop="itemDescriptor.show($event, item.id)"
|
||||||
class="link">
|
class="link">
|
||||||
{{::item.id}}
|
{{::item.id}}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -296,7 +296,7 @@
|
||||||
ng-click="$ctrl.selectItem(item.id)">
|
ng-click="$ctrl.selectItem(item.id)">
|
||||||
<vn-td shrink>
|
<vn-td shrink>
|
||||||
<span
|
<span
|
||||||
ng-click="itemDescriptor.show($event, item.id)"
|
vn-click-stop="itemDescriptor.show($event, item.id)"
|
||||||
class="link">
|
class="link">
|
||||||
{{::item.id}}
|
{{::item.id}}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -9,10 +9,14 @@ module.exports = Self => {
|
||||||
description: 'ticket id',
|
description: 'ticket id',
|
||||||
http: {source: 'path'}
|
http: {source: 'path'}
|
||||||
}],
|
}],
|
||||||
returns: {
|
returns: [{
|
||||||
type: ['Object'],
|
arg: 'saleVolume',
|
||||||
root: true
|
type: ['object']
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
arg: 'packingTypeVolume',
|
||||||
|
type: ['object']
|
||||||
|
}],
|
||||||
http: {
|
http: {
|
||||||
path: `/:id/getVolume`,
|
path: `/:id/getVolume`,
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
|
@ -25,7 +29,21 @@ module.exports = Self => {
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
return Self.rawSql(`SELECT * FROM vn.saleVolume
|
const saleVolume = await Self.rawSql(`
|
||||||
|
SELECT saleFk, volume
|
||||||
|
FROM vn.saleVolume
|
||||||
WHERE ticketFk = ?`, [ticketFk], myOptions);
|
WHERE ticketFk = ?`, [ticketFk], myOptions);
|
||||||
|
|
||||||
|
const packingTypeVolume = await Self.rawSql(`
|
||||||
|
SELECT s.itemPackingTypeFk code,
|
||||||
|
i.description,
|
||||||
|
SUM(s.volume) volume
|
||||||
|
FROM vn.saleVolume s
|
||||||
|
LEFT JOIN vn.itemPackingType i
|
||||||
|
ON i.code = s.itemPackingTypeFk
|
||||||
|
WHERE s.ticketFk = ?
|
||||||
|
GROUP BY s.itemPackingTypeFk`, [ticketFk], myOptions);
|
||||||
|
|
||||||
|
return [saleVolume, packingTypeVolume];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -8,9 +8,15 @@ describe('ticket getVolume()', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const ticketId = 1;
|
const ticketId = 1;
|
||||||
const result = await models.Ticket.getVolume(ticketId, options);
|
const expectedSaleVolume = 1.09;
|
||||||
|
const expectedPackingTypeVolume = 0.028;
|
||||||
|
|
||||||
expect(result[0].volume).toEqual(1.09);
|
const result = await models.Ticket.getVolume(ticketId, options);
|
||||||
|
const [saleVolume] = result[0];
|
||||||
|
const [packingTypeVolume] = result[1];
|
||||||
|
|
||||||
|
expect(saleVolume.volume).toEqual(expectedSaleVolume);
|
||||||
|
expect(packingTypeVolume.volume).toEqual(expectedPackingTypeVolume);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -37,6 +37,7 @@ Observation type: Tipo de observación
|
||||||
Original: Original
|
Original: Original
|
||||||
Package size: Bultos
|
Package size: Bultos
|
||||||
Package type: Tipo de porte
|
Package type: Tipo de porte
|
||||||
|
Packing type: Encajado
|
||||||
Phone: Teléfono
|
Phone: Teléfono
|
||||||
PPU: Ud.
|
PPU: Ud.
|
||||||
Price: Precio
|
Price: Precio
|
||||||
|
|
|
@ -6,20 +6,15 @@
|
||||||
data="$ctrl.sales"
|
data="$ctrl.sales"
|
||||||
limit="20">
|
limit="20">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
<vn-crud-model auto-load="true"
|
|
||||||
url="tickets/{{$ctrl.$params.id}}/getVolume"
|
|
||||||
data="$ctrl.volumes">
|
|
||||||
</vn-crud-model>
|
|
||||||
<mg-ajax path="tickets/{{$ctrl.$params.id}}/getTotalVolume" options="mgEdit"></mg-ajax>
|
|
||||||
<vn-vertical>
|
<vn-vertical>
|
||||||
<vn-card class="vn-pa-lg">
|
<vn-card class="vn-pa-lg">
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<div class="totalBox">
|
<div class="totalBox" ng-repeat="packingType in $ctrl.packingTypeVolume">
|
||||||
<vn-label-value label="Total"
|
<vn-label-value label="Tipo"
|
||||||
value="{{::edit.model.totalVolume}}">
|
value="{{::packingType.description}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Cajas"
|
<vn-label-value label="Volumen"
|
||||||
value="{{::edit.model.totalBoxes}}">
|
value="{{::packingType.volume}}">
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
</div>
|
</div>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
|
@ -29,6 +24,7 @@
|
||||||
<vn-tr>
|
<vn-tr>
|
||||||
<vn-th field="itemFk" number>Item</vn-th>
|
<vn-th field="itemFk" number>Item</vn-th>
|
||||||
<vn-th field="concept" default-order="ASC">Description</vn-th>
|
<vn-th field="concept" default-order="ASC">Description</vn-th>
|
||||||
|
<vn-th field="itemPackingTypeFk" number>Packing type</vn-th>
|
||||||
<vn-th field="quantity" number>Quantity</vn-th>
|
<vn-th field="quantity" number>Quantity</vn-th>
|
||||||
<vn-th number>m³ per quantity</vn-th>
|
<vn-th number>m³ per quantity</vn-th>
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
|
@ -55,6 +51,7 @@
|
||||||
tabindex="-1">
|
tabindex="-1">
|
||||||
</vn-fetched-tags>
|
</vn-fetched-tags>
|
||||||
</vn-td>
|
</vn-td>
|
||||||
|
<vn-td number>{{::sale.item.itemPackingTypeFk}}</vn-td>
|
||||||
<vn-td number>{{::sale.quantity}}</vn-td>
|
<vn-td number>{{::sale.quantity}}</vn-td>
|
||||||
<vn-td number>{{::sale.saleVolume.volume | number:3}}</vn-td>
|
<vn-td number>{{::sale.saleVolume.volume | number:3}}</vn-td>
|
||||||
</vn-tr>
|
</vn-tr>
|
||||||
|
|
|
@ -23,24 +23,19 @@ class Controller extends Section {
|
||||||
if (value) this.applyVolumes();
|
if (value) this.applyVolumes();
|
||||||
}
|
}
|
||||||
|
|
||||||
get volumes() {
|
|
||||||
return this._volumes;
|
|
||||||
}
|
|
||||||
|
|
||||||
set volumes(value) {
|
|
||||||
this._volumes = value;
|
|
||||||
|
|
||||||
if (value) this.applyVolumes();
|
|
||||||
}
|
|
||||||
|
|
||||||
applyVolumes() {
|
applyVolumes() {
|
||||||
if (!this.sales || !this.volumes) return;
|
const ticket = this.sales[0].ticketFk;
|
||||||
|
this.$http.get(`Tickets/${ticket}/getVolume`).then(res => {
|
||||||
|
const saleVolume = res.data.saleVolume;
|
||||||
|
|
||||||
this.sales.forEach(sale => {
|
const volumes = new Map();
|
||||||
this.volumes.forEach(volume => {
|
for (const volume of saleVolume)
|
||||||
if (sale.id === volume.saleFk)
|
volumes.set(volume.saleFk, volume);
|
||||||
sale.saleVolume = volume;
|
|
||||||
});
|
for (const sale of this.sales)
|
||||||
|
sale.saleVolume = volumes.get(sale.id);
|
||||||
|
|
||||||
|
this.packingTypeVolume = res.data.packingTypeVolume;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,17 +33,20 @@ describe('ticket', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('volumes() setter', () => {
|
|
||||||
it('should set volumes property on controller an then call applyVolumes() method', () => {
|
|
||||||
jest.spyOn(controller, 'applyVolumes');
|
|
||||||
|
|
||||||
controller.volumes = [{id: 1}];
|
|
||||||
|
|
||||||
expect(controller.applyVolumes).toHaveBeenCalledWith();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('applyVolumes()', () => {
|
describe('applyVolumes()', () => {
|
||||||
|
const ticket = 1;
|
||||||
|
const response =
|
||||||
|
{
|
||||||
|
saleVolume: [
|
||||||
|
{saleFk: 1, volume: 0.012},
|
||||||
|
{saleFk: 2, volume: 0.015}
|
||||||
|
],
|
||||||
|
packingTypeVolume: [
|
||||||
|
{code: 'V', volume: 1},
|
||||||
|
{code: 'H', volume: 2}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
it(`should not apply volumes to the sales if sales property is not defined on controller`, () => {
|
it(`should not apply volumes to the sales if sales property is not defined on controller`, () => {
|
||||||
controller.sales = [{id: 1, name: 'Sale one'}, {id: 2, name: 'Sale two'}];
|
controller.sales = [{id: 1, name: 'Sale one'}, {id: 2, name: 'Sale two'}];
|
||||||
|
|
||||||
|
@ -58,29 +61,32 @@ describe('ticket', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should apply volumes to the sales if sales and volumes properties are defined on controller`, () => {
|
it(`should apply volumes to the sales if sales and volumes properties are defined on controller`, () => {
|
||||||
controller.sales = [{id: 1, name: 'Sale one'}, {id: 2, name: 'Sale two'}];
|
const expectedResultOne = response.saleVolume[0].volume;
|
||||||
controller.volumes = [{saleFk: 1, volume: 0.012}, {saleFk: 2, volume: 0.015}];
|
const expectedResultTwo = response.saleVolume[1].volume;
|
||||||
|
$httpBackend.expectGET(`Tickets/${ticket}/getVolume`).respond(response);
|
||||||
expect(controller.sales[0].saleVolume.volume).toEqual(0.012);
|
controller.sales = [
|
||||||
expect(controller.sales[1].saleVolume.volume).toEqual(0.015);
|
{id: 1, name: 'Sale one', ticketFk: ticket},
|
||||||
});
|
{id: 2, name: 'Sale two'}
|
||||||
});
|
];
|
||||||
|
|
||||||
/*
|
|
||||||
it('should join the sale volumes to its respective sale', () => {
|
|
||||||
controller.ticket = {id: 1};
|
|
||||||
let response = {volumes: [
|
|
||||||
{saleFk: 1, m3: 0.008},
|
|
||||||
{saleFk: 2, m3: 0.003}
|
|
||||||
]};
|
|
||||||
|
|
||||||
$httpBackend.expectGET(`tickets/1/getVolume`).respond(response);
|
|
||||||
controller.onDataChange();
|
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect($scope.model.data[0].volume.m3).toBe(0.008);
|
expect(controller.sales[0].saleVolume.volume).toEqual(expectedResultOne);
|
||||||
expect($scope.model.data[1].volume.m3).toBe(0.003);
|
expect(controller.sales[1].saleVolume.volume).toEqual(expectedResultTwo);
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should apply packing volumes to the sales if sales and volumes properties are defined on controller`, () => {
|
||||||
|
const expectedResultOne = response.packingTypeVolume[0].code;
|
||||||
|
const expectedResultTwo = response.packingTypeVolume[1].code;
|
||||||
|
$httpBackend.expectGET(`Tickets/${ticket}/getVolume`).respond(response);
|
||||||
|
controller.sales = [
|
||||||
|
{id: 1, name: 'Sale one', ticketFk: ticket},
|
||||||
|
{id: 2, name: 'Sale two'}
|
||||||
|
];
|
||||||
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
expect(controller.packingTypeVolume[0].code).toEqual(expectedResultOne);
|
||||||
|
expect(controller.packingTypeVolume[1].code).toEqual(expectedResultTwo);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -112,6 +112,13 @@ module.exports = Self => {
|
||||||
|
|
||||||
const contracts = await models.WorkerLabour.find(filter, myOptions);
|
const contracts = await models.WorkerLabour.find(filter, myOptions);
|
||||||
|
|
||||||
|
let [firstContract] = contracts;
|
||||||
|
let payedHolidays;
|
||||||
|
|
||||||
|
if (firstContract.payedHolidays)
|
||||||
|
payedHolidays = firstContract.payedHolidays;
|
||||||
|
else payedHolidays = 0;
|
||||||
|
|
||||||
let totalHolidays = 0;
|
let totalHolidays = 0;
|
||||||
let holidaysEnjoyed = 0;
|
let holidaysEnjoyed = 0;
|
||||||
|
|
||||||
|
@ -166,8 +173,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
return isLeapYear(year) ? 366 : 365;
|
return isLeapYear(year) ? 366 : 365;
|
||||||
}
|
}
|
||||||
|
return {totalHolidays, holidaysEnjoyed, payedHolidays};
|
||||||
return {totalHolidays, holidaysEnjoyed};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function isLeapYear(year) {
|
function isLeapYear(year) {
|
||||||
|
|
|
@ -9,16 +9,19 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"businessFk": {
|
"businessFk": {
|
||||||
"id": true,
|
"id": true,
|
||||||
"type": "Number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
"workerFk": {
|
"workerFk": {
|
||||||
"type": "Number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
"started": {
|
"started": {
|
||||||
"type": "date"
|
"type": "date"
|
||||||
},
|
},
|
||||||
"ended": {
|
"ended": {
|
||||||
"type": "date"
|
"type": "date"
|
||||||
|
},
|
||||||
|
"payedHolidays": {
|
||||||
|
"type": "number"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
{{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed}}
|
{{'Used' | translate}} {{$ctrl.contractHolidays.holidaysEnjoyed}}
|
||||||
{{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}}
|
{{'of' | translate}} {{$ctrl.contractHolidays.totalHolidays || 0}} {{'days' | translate}}
|
||||||
</div>
|
</div>
|
||||||
|
<div>
|
||||||
|
{{'Paid holidays' | translate}} {{$ctrl.contractHolidays.payedHolidays}} {{'days' | translate}}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="totalBox" style="text-align: center;">
|
<div class="totalBox" style="text-align: center;">
|
||||||
|
|
|
@ -71,6 +71,10 @@ class Controller extends Section {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get payedHolidays() {
|
||||||
|
return this._businessId;
|
||||||
|
}
|
||||||
|
|
||||||
buildYearFilter() {
|
buildYearFilter() {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
now.setFullYear(now.getFullYear() + 1);
|
now.setFullYear(now.getFullYear() + 1);
|
||||||
|
|
|
@ -9,3 +9,4 @@ Choose an absence type from the right menu: Elige un tipo de ausencia desde el m
|
||||||
To start adding absences, click an absence type from the right menu and then on the day you want to add an absence: Para empezar a añadir ausencias, haz clic en un tipo de ausencia desde el menu de la derecha y después en el día que quieres añadir la ausencia
|
To start adding absences, click an absence type from the right menu and then on the day you want to add an absence: Para empezar a añadir ausencias, haz clic en un tipo de ausencia desde el menu de la derecha y después en el día que quieres añadir la ausencia
|
||||||
You can just add absences within the current year: Solo puedes añadir ausencias dentro del año actual
|
You can just add absences within the current year: Solo puedes añadir ausencias dentro del año actual
|
||||||
Current day: Día actual
|
Current day: Día actual
|
||||||
|
Paid holidays: Vacaciones pagadas
|
File diff suppressed because it is too large
Load Diff
|
@ -9,7 +9,7 @@
|
||||||
"url": "https://gitea.verdnatura.es/verdnatura/salix"
|
"url": "https://gitea.verdnatura.es/verdnatura/salix"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=14"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bmp-js": "^0.1.0",
|
"bmp-js": "^0.1.0",
|
||||||
|
|
Loading…
Reference in New Issue