#6346 Added script for wagon section #2968
|
@ -1521,23 +1521,23 @@ INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed
|
|||
INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`)
|
||||
VALUES (2, 4, 1);
|
||||
|
||||
INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWasteQuantity`, `saleInternalWaste`, `saleExternalWaste`)
|
||||
INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWasteQuantity`, `saleExternalWaste`, `saleFaultWaste`, `saleContainerWaste`, `saleBreakWaste`, `saleOtherWaste`)
|
||||
VALUES
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 1, 1, '1062', '51', '56.20', '56.20'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '35074', '687', '53.12', '89.69'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '1777', '13', '12.02', '53.12'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '3182', '59', '51', '56.20'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '1747', '13', '53.12', '53.12'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '7182', '59', '51', '53.12'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '1777', '13', '89.69', '89.69'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 8, 1, '4181', '59', '53.12', '53.12'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 9, 1, '7268', '59', '12.02', '56.20'),
|
||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '-74', '0', '51', '89.69'),
|
||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '-7', '0', '12.02', '53.12'),
|
||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '1100', '0', '51', '56.20'),
|
||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '848', '-187', '12.02', '89.69'),
|
||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '186', '0', '51', '53.12'),
|
||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '277', '0', '53.12', '56.20');
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 1, 1, '1062', '51', '56.20', '56.20', '56.20', '56.20', '56.20'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '35074', '687', '53.12', '89.69', '56.20', '56.20', '56.20'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '1777', '13', '12.02', '53.12', '56.20', '56.20', '56.20'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '3182', '59', '51', '56.20', '56.20', '56.20', '56.20'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '1747', '13', '53.12', '53.12', '56.20', '56.20', '56.20'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '7182', '59', '51', '53.12', '56.20', '56.20', '56.20'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '1777', '13', '89.69', '89.69', '56.20', '56.20', '56.20'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 8, 1, '4181', '59', '53.12', '53.12', '56.20', '56.20', '56.20'),
|
||||
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 9, 1, '7268', '59', '12.02', '56.20', '56.20', '56.20', '56.20'),
|
||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 2, 1, '-74', '0', '51', '89.69', '56.20', '56.20', '56.20'),
|
||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 3, 1, '-7', '0', '12.02', '53.12', '56.20', '56.20', '56.20'),
|
||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 4, 1, '1100', '0', '51', '56.20', '56.20', '56.20', '56.20'),
|
||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 5, 1, '848', '-187', '12.02', '89.69', '56.20', '56.20', '56.20'),
|
||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 6, 1, '186', '0', '51', '53.12', '56.20', '56.20', '56.20'),
|
||||
('103', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 7, 1, '277', '0', '53.12', '56.20', '56.20', '56.20', '56.20');
|
||||
|
||||
INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packagingFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`, `printedStickers`,`isChecked`,`isIgnored`,`weight`, `created`)
|
||||
VALUES
|
||||
|
|
|
@ -14,16 +14,32 @@ BEGIN
|
|||
s.itemFk,
|
||||
SUM((b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity),
|
||||
SUM(IF(aw.`type`, s.quantity, 0)),
|
||||
SUM(
|
||||
IF(
|
||||
aw.`type` = 'internal',
|
||||
SUM(IF(
|
||||
aw.`type` = 'external',
|
||||
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
|
||||
0
|
||||
)
|
||||
),
|
||||
SUM(
|
||||
IF(
|
||||
aw.`type` = 'external',
|
||||
SUM(IF(
|
||||
aw.`type` = 'fault',
|
||||
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
|
||||
0
|
||||
)
|
||||
),
|
||||
SUM(IF(
|
||||
aw.`type` = 'container',
|
||||
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
|
||||
0
|
||||
)
|
||||
),
|
||||
SUM(IF(
|
||||
aw.`type` = 'break',
|
||||
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
|
||||
0
|
||||
)
|
||||
),
|
||||
SUM(IF(
|
||||
aw.`type` = 'other',
|
||||
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
|
||||
0
|
||||
)
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
-- Place your SQL code here
|
||||
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
|
||||
VALUES ('WorkerTimeControlMail', 'count', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||
('Worker', '__get__mail', 'READ', 'ALLOW', 'ROLE', 'hr');
|
|
@ -0,0 +1,13 @@
|
|||
ALTER TABLE `vn`.`payrollWorkCenter` DROP PRIMARY KEY;
|
||||
ALTER TABLE `vn`.`payrollWorkCenter` DROP COLUMN `empresa_id__`;
|
||||
ALTER TABLE `vn`.`payrollWorkCenter` DROP COLUMN `Centro__`;
|
||||
ALTER TABLE `vn`.`payrollWorkCenter` DROP COLUMN `nss_cotizacion__`;
|
||||
ALTER TABLE `vn`.`payrollWorkCenter` DROP COLUMN `domicilio__`;
|
||||
ALTER TABLE `vn`.`payrollWorkCenter` DROP COLUMN `poblacion__`;
|
||||
ALTER TABLE `vn`.`payrollWorkCenter` DROP COLUMN `cp__`;
|
||||
ALTER TABLE `vn`.`payrollWorker` DROP COLUMN `nss__`;
|
||||
ALTER TABLE `vn`.`payrollWorker` DROP COLUMN `codpuesto__`;
|
||||
ALTER TABLE `vn`.`payrollWorker` DROP COLUMN `codcontrato__`;
|
||||
ALTER TABLE `vn`.`payrollWorker` DROP COLUMN `FAntiguedad__`;
|
||||
ALTER TABLE `vn`.`payrollWorker` DROP COLUMN `codcategoria__`;
|
||||
ALTER TABLE `vn`.`payrollWorker` DROP COLUMN `ContratoTemporal__`;
|
|
@ -0,0 +1,19 @@
|
|||
ALTER TABLE vn.addressWaste
|
||||
MODIFY COLUMN `type` enum('external', 'fault', 'container', 'break', 'other')
|
||||
CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL;
|
||||
|
||||
UPDATE vn.addressWaste
|
||||
SET `type`='container'
|
||||
WHERE addressFk=77;
|
||||
|
||||
UPDATE vn.addressWaste
|
||||
SET `type`='fault'
|
||||
WHERE addressFk=317;
|
||||
|
||||
UPDATE vn.addressWaste
|
||||
SET `type`='break'
|
||||
WHERE addressFk=57702;
|
||||
|
||||
UPDATE vn.addressWaste
|
||||
SET `type`='other'
|
||||
WHERE addressFk=43432;
|
|
@ -0,0 +1,6 @@
|
|||
ALTER TABLE bs.waste
|
||||
DROP COLUMN saleInternalWaste,
|
||||
ADD saleFaultWaste decimal(10,2) DEFAULT NULL NULL,
|
||||
ADD saleContainerWaste decimal(10,2) DEFAULT NULL NULL,
|
||||
ADD saleBreakWaste decimal(10,2) DEFAULT NULL NULL,
|
||||
ADD saleOtherWaste decimal(10,2) DEFAULT NULL NULL;
|
|
@ -52,7 +52,13 @@ module.exports = Self => {
|
|||
it.name family,
|
||||
w.itemFk,
|
||||
SUM(w.saleTotal) total,
|
||||
SUM(w.saleInternalWaste + w.saleExternalWaste) dwindle
|
||||
SUM(
|
||||
w.saleExternalWaste +
|
||||
w.saleFaultWaste +
|
||||
w.saleContainerWaste +
|
||||
w.saleBreakWaste +
|
||||
w.saleOtherWaste
|
||||
) dwindle
|
||||
FROM bs.waste w
|
||||
JOIN account.user u ON u.id = w.buyerFk
|
||||
JOIN vn.itemType it ON it.id = w.itemTypeFk
|
||||
|
|
|
@ -28,7 +28,13 @@ module.exports = Self => {
|
|||
it.name family,
|
||||
w.itemFk,
|
||||
SUM(w.saleTotal) total,
|
||||
SUM(w.saleInternalWaste + w.saleExternalWaste) dwindle
|
||||
SUM(
|
||||
w.saleExternalWaste +
|
||||
w.saleFaultWaste +
|
||||
w.saleContainerWaste +
|
||||
w.saleBreakWaste +
|
||||
w.saleOtherWaste
|
||||
) dwindle
|
||||
FROM bs.waste w
|
||||
JOIN account.user u ON u.id = w.buyerFk
|
||||
JOIN vn.itemType it ON it.id = w.itemTypeFk
|
||||
|
@ -44,7 +50,13 @@ module.exports = Self => {
|
|||
FROM (
|
||||
SELECT u.name buyer,
|
||||
SUM(w.saleTotal) total,
|
||||
SUM(w.saleInternalWaste + w.saleExternalWaste) dwindle
|
||||
SUM(
|
||||
w.saleExternalWaste +
|
||||
w.saleFaultWaste +
|
||||
w.saleContainerWaste +
|
||||
w.saleBreakWaste +
|
||||
w.saleOtherWaste
|
||||
) dwindle
|
||||
FROM bs.waste w
|
||||
JOIN account.user u ON u.id = w.buyerFk
|
||||
WHERE w.year = YEAR(TIMESTAMPADD(WEEK, -1, ?))
|
||||
|
|
|
@ -32,13 +32,5 @@
|
|||
"sendedCounter": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "employee",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -130,6 +130,11 @@
|
|||
"type": "hasMany",
|
||||
"model": "TrainingCourse",
|
||||
"foreignKey": "workerFk"
|
||||
},
|
||||
"mail": {
|
||||
"type": "hasMany",
|
||||
"model": "WorkerTimeControlMail",
|
||||
"foreignKey": "workerFk"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
|
@ -139,6 +144,13 @@
|
|||
"permission": "ALLOW",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$owner"
|
||||
},
|
||||
{
|
||||
"property": "__get__mail",
|
||||
"accessType": "READ",
|
||||
"permission": "ALLOW",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$owner"
|
||||
}
|
||||
],
|
||||
"scopes": {
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
SELECT *, 100 * dwindle / total `percentage`
|
||||
FROM (
|
||||
SELECT u.name buyer,
|
||||
SUM(saleTotal) total,
|
||||
SUM(w.saleInternalWaste + w.saleExternalWaste) dwindle
|
||||
SUM(w.saleTotal) total,
|
||||
SUM(
|
||||
w.saleExternalWaste +
|
||||
w.saleFaultWaste +
|
||||
w.saleContainerWaste +
|
||||
w.saleBreakWaste +
|
||||
w.saleOtherWaste
|
||||
) dwindle
|
||||
FROM bs.waste w
|
||||
JOIN account.user u ON u.id = w.buyerFk
|
||||
JOIN vn.itemType it ON it.id = w.itemTypeFk
|
||||
|
|
Loading…
Reference in New Issue