Merge branch 'dev' into 7296-expeditionTruck
gitea/salix/pipeline/pr-dev This commit looks good
Details
gitea/salix/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
5e3fa1be8b
|
@ -2562,7 +2562,7 @@ REPLACE INTO `vn`.`invoiceIn`(`id`, `serialNumber`,`serial`, `supplierFk`, `issu
|
||||||
(9, 1009, 'R', 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1242, 0, 442, 1),
|
(9, 1009, 'R', 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1242, 0, 442, 1),
|
||||||
(10, 1010, 'R', 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1243, 0, 442, 1);
|
(10, 1010, 'R', 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1243, 0, 442, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`invoiceInConfig` (`id`, `retentionRate`, `retentionName`, `sageWithholdingFk`, `daysAgo`)
|
INSERT INTO `vn`.`invoiceInConfig` (`id`, `retentionRate`, `retentionName`, `sageFarmerWithholdingFk`, `daysAgo`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, -2, '2% retention', 2, 45);
|
(1, -2, '2% retention', 2, 45);
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ BEGIN
|
||||||
* @vItemFk item a buscar
|
* @vItemFk item a buscar
|
||||||
* @vWarehouseFk almacen donde buscar
|
* @vWarehouseFk almacen donde buscar
|
||||||
* @vDate Si la fecha es null, muestra el histórico desde el inventario.
|
* @vDate Si la fecha es null, muestra el histórico desde el inventario.
|
||||||
* Si la fecha no es null, muestra histórico desde la fecha pasada.
|
* Si la fecha no es null, muestra histórico desde la fecha de vDate.
|
||||||
*/
|
*/
|
||||||
DECLARE vDateInventory DATETIME;
|
DECLARE vDateInventory DATETIME;
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ BEGIN
|
||||||
);
|
);
|
||||||
|
|
||||||
INSERT INTO tItemDiary
|
INSERT INTO tItemDiary
|
||||||
|
WITH entriesIn AS (
|
||||||
SELECT tr.landed shipped,
|
SELECT tr.landed shipped,
|
||||||
b.quantity `in`,
|
b.quantity `in`,
|
||||||
NULL `out`,
|
NULL `out`,
|
||||||
|
@ -57,89 +58,125 @@ BEGIN
|
||||||
NULL clientType,
|
NULL clientType,
|
||||||
NULL claimFk,
|
NULL claimFk,
|
||||||
ec.inventorySupplierFk
|
ec.inventorySupplierFk
|
||||||
FROM buy b
|
FROM vn.buy b
|
||||||
JOIN entry e ON e.id = b.entryFk
|
JOIN vn.entry e ON e.id = b.entryFk
|
||||||
JOIN travel tr ON tr.id = e.travelFk
|
JOIN vn.travel tr ON tr.id = e.travelFk
|
||||||
JOIN supplier s ON s.id = e.supplierFk
|
JOIN vn.supplier s ON s.id = e.supplierFk
|
||||||
JOIN state st ON st.`code` = IF( tr.landed < util.VN_CURDATE()
|
JOIN vn.state st ON st.`code` = IF( tr.landed < util.VN_CURDATE()
|
||||||
OR (util.VN_CURDATE() AND tr.isReceived),
|
OR (util.VN_CURDATE() AND tr.isReceived),
|
||||||
'DELIVERED',
|
'DELIVERED',
|
||||||
'FREE')
|
'FREE')
|
||||||
JOIN entryConfig ec
|
JOIN vn.entryConfig ec
|
||||||
WHERE tr.landed >= vDateInventory
|
WHERE tr.landed >= vDateInventory
|
||||||
AND vWarehouseFk = tr.warehouseInFk
|
AND vWarehouseFk = tr.warehouseInFk
|
||||||
AND (s.id <> ec.inventorySupplierFk OR vDate IS NULL)
|
AND (s.id <> ec.inventorySupplierFk OR vDate IS NULL)
|
||||||
AND b.itemFk = vItemFk
|
AND b.itemFk = vItemFk
|
||||||
AND e.isExcludedFromAvailable = FALSE
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND e.isRaid = FALSE
|
AND NOT e.isRaid
|
||||||
UNION ALL
|
), entriesOut AS (
|
||||||
SELECT tr.shipped,
|
SELECT tr.shipped,
|
||||||
NULL,
|
NULL,
|
||||||
b.quantity,
|
b.quantity,
|
||||||
st.alertLevel,
|
st.alertLevel,
|
||||||
st.name,
|
st.name stateName,
|
||||||
s.name ,
|
s.name ,
|
||||||
e.invoiceNumber,
|
e.invoiceNumber,
|
||||||
e.id,
|
e.id entryFk,
|
||||||
s.id,
|
s.id supplierFk,
|
||||||
IF(st.`code` = 'DELIVERED' , TRUE, FALSE),
|
IF(st.`code` = 'DELIVERED' , TRUE, FALSE),
|
||||||
FALSE,
|
FALSE isTicket,
|
||||||
b.id,
|
b.id,
|
||||||
NULL,
|
NULL `order`,
|
||||||
NULL,
|
NULL clientType,
|
||||||
NULL,
|
NULL claimFk,
|
||||||
ec.inventorySupplierFk
|
ec.inventorySupplierFk
|
||||||
FROM buy b
|
FROM vn.buy b
|
||||||
JOIN entry e ON e.id = b.entryFk
|
JOIN vn.entry e ON e.id = b.entryFk
|
||||||
JOIN travel tr ON tr.id = e.travelFk
|
JOIN vn.travel tr ON tr.id = e.travelFk
|
||||||
JOIN warehouse w ON w.id = tr.warehouseOutFk
|
JOIN vn.warehouse w ON w.id = tr.warehouseOutFk
|
||||||
JOIN supplier s ON s.id = e.supplierFk
|
JOIN vn.supplier s ON s.id = e.supplierFk
|
||||||
JOIN state st ON st.`code` = IF(tr.shipped < util.VN_CURDATE()
|
JOIN vn.state st ON st.`code` = IF(tr.shipped < util.VN_CURDATE()
|
||||||
OR (tr.shipped = util.VN_CURDATE() AND tr.isReceived),
|
OR (tr.shipped = util.VN_CURDATE() AND tr.isReceived),
|
||||||
'DELIVERED',
|
'DELIVERED',
|
||||||
'FREE')
|
'FREE')
|
||||||
JOIN entryConfig ec
|
JOIN vn.entryConfig ec
|
||||||
WHERE tr.shipped >= vDateInventory
|
WHERE tr.shipped >= vDateInventory
|
||||||
AND vWarehouseFk = tr.warehouseOutFk
|
AND vWarehouseFk = tr.warehouseOutFk
|
||||||
AND (s.id <> ec.inventorySupplierFk OR vDate IS NULL)
|
AND (s.id <> ec.inventorySupplierFk OR vDate IS NULL)
|
||||||
AND b.itemFk = vItemFk
|
AND b.itemFk = vItemFk
|
||||||
AND e.isExcludedFromAvailable = FALSE
|
AND NOT e.isExcludedFromAvailable
|
||||||
AND w.isFeedStock = FALSE
|
AND NOT w.isFeedStock
|
||||||
AND e.isRaid = FALSE
|
AND NOT e.isRaid
|
||||||
UNION ALL
|
), sales AS (
|
||||||
SELECT DATE(t.shipped),
|
SELECT DATE(t.shipped) shipped,
|
||||||
NULL,
|
|
||||||
s.quantity,
|
s.quantity,
|
||||||
st2.alertLevel,
|
st2.alertLevel,
|
||||||
st2.name,
|
st2.name,
|
||||||
t.nickname,
|
t.nickname,
|
||||||
t.refFk,
|
t.refFk,
|
||||||
t.id,
|
t.id ticketFk,
|
||||||
t.clientFk,
|
t.clientFk,
|
||||||
stk.id,
|
s.id saleFk,
|
||||||
TRUE,
|
|
||||||
s.id,
|
|
||||||
st.`order`,
|
st.`order`,
|
||||||
c.typeFk,
|
c.typeFk,
|
||||||
cb.claimFk,
|
cb.claimFk
|
||||||
NULL
|
FROM vn.sale s
|
||||||
FROM sale s
|
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
LEFT JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
||||||
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
LEFT JOIN vn.state st ON st.`code` = ts.`code`
|
||||||
LEFT JOIN state st ON st.`code` = ts.`code`
|
JOIN vn.client c ON c.id = t.clientFk
|
||||||
JOIN client c ON c.id = t.clientFk
|
JOIN vn.state st2 ON st2.`code` = IF(t.shipped < util.VN_CURDATE(),
|
||||||
JOIN state st2 ON st2.`code` = IF(t.shipped < util.VN_CURDATE(),
|
|
||||||
'DELIVERED',
|
'DELIVERED',
|
||||||
IF (t.shipped > util.dayEnd(util.VN_CURDATE()),
|
IF (t.shipped > util.dayEnd(util.VN_CURDATE()),
|
||||||
'FREE',
|
'FREE',
|
||||||
IFNULL(ts.code, 'FREE')))
|
IFNULL(ts.code, 'FREE')))
|
||||||
LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED'
|
LEFT JOIN vn.claimBeginning cb ON s.id = cb.saleFk
|
||||||
LEFT JOIN saleTracking stk ON stk.saleFk = s.id
|
|
||||||
AND stk.stateFk = stPrep.id
|
|
||||||
LEFT JOIN claimBeginning cb ON s.id = cb.saleFk
|
|
||||||
WHERE t.shipped >= vDateInventory
|
WHERE t.shipped >= vDateInventory
|
||||||
AND s.itemFk = vItemFk
|
AND s.itemFk = vItemFk
|
||||||
AND vWarehouseFk = t.warehouseFk
|
AND vWarehouseFk = t.warehouseFk
|
||||||
|
),sale AS (
|
||||||
|
SELECT s.shipped,
|
||||||
|
NULL `in`,
|
||||||
|
s.quantity,
|
||||||
|
s.alertLevel,
|
||||||
|
s.name,
|
||||||
|
s.nickname,
|
||||||
|
s.refFk,
|
||||||
|
s.ticketFk,
|
||||||
|
s.clientFk,
|
||||||
|
IF(stk.saleFk, TRUE, NULL),
|
||||||
|
TRUE,
|
||||||
|
s.saleFk,
|
||||||
|
s.`order`,
|
||||||
|
s.typeFk,
|
||||||
|
s.claimFk,
|
||||||
|
NULL
|
||||||
|
FROM sales s
|
||||||
|
LEFT JOIN vn.state stPrep ON stPrep.`code` = 'PREPARED'
|
||||||
|
LEFT JOIN vn.saleTracking stk ON stk.saleFk = s.saleFk
|
||||||
|
AND stk.stateFk = stPrep.id
|
||||||
|
GROUP BY s.saleFk
|
||||||
|
) SELECT shipped,
|
||||||
|
`in`,
|
||||||
|
`out`,
|
||||||
|
alertLevel,
|
||||||
|
stateName,
|
||||||
|
`name`,
|
||||||
|
reference,
|
||||||
|
origin,
|
||||||
|
clientFk,
|
||||||
|
isPicked,
|
||||||
|
isTicket,
|
||||||
|
lineFk,
|
||||||
|
`order`,
|
||||||
|
clientType,
|
||||||
|
claimFk,
|
||||||
|
inventorySupplierFk
|
||||||
|
FROM entriesIn
|
||||||
|
UNION ALL
|
||||||
|
SELECT * FROM entriesOut
|
||||||
|
UNION ALL
|
||||||
|
SELECT * FROM sale
|
||||||
ORDER BY shipped,
|
ORDER BY shipped,
|
||||||
(inventorySupplierFk = clientFk) DESC,
|
(inventorySupplierFk = clientFk) DESC,
|
||||||
alertLevel DESC,
|
alertLevel DESC,
|
||||||
|
|
|
@ -6,7 +6,6 @@ AS SELECT `s`.`id` AS `Id_Proveedor`,
|
||||||
`s`.`account` AS `cuenta`,
|
`s`.`account` AS `cuenta`,
|
||||||
`s`.`countryFk` AS `pais_id`,
|
`s`.`countryFk` AS `pais_id`,
|
||||||
`s`.`nif` AS `NIF`,
|
`s`.`nif` AS `NIF`,
|
||||||
`s`.`isFarmer` AS `Agricola`,
|
|
||||||
`s`.`phone` AS `Telefono`,
|
`s`.`phone` AS `Telefono`,
|
||||||
`s`.`retAccount` AS `cuentaret`,
|
`s`.`retAccount` AS `cuentaret`,
|
||||||
`s`.`commission` AS `ComisionProveedor`,
|
`s`.`commission` AS `ComisionProveedor`,
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
-- Place your SQL code here
|
|
||||||
ALTER TABLE vn.productionConfig ADD defaultSectorFk INT UNSIGNED DEFAULT 37 NOT NULL COMMENT 'Default sector';
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
ALTER TABLE vn.invoiceInConfig CHANGE sageWithholdingFk sageFarmerWithholdingFk smallint(6) NOT NULL;
|
||||||
|
ALTER TABLE vn.supplier CHANGE isFarmer isFarmer__ tinyint(1) DEFAULT 0 NOT NULL COMMENT 'refs #7345 @deprecated 2024-05-10 - Utilizar withholdingSageFk';
|
||||||
|
ALTER TABLE vn.supplier MODIFY COLUMN isFarmer__ tinyint(1) DEFAULT 0 NOT NULL COMMENT 'refs #7345 @deprecated 2024-05-10 - Utilizar withholdingSageFk';
|
|
@ -0,0 +1,3 @@
|
||||||
|
ALTER TABLE vn.item
|
||||||
|
MODIFY nonRecycledPlastic DECIMAL(10,2) DEFAULT NULL NULL,
|
||||||
|
MODIFY recycledPlastic DECIMAL(10,2) DEFAULT NULL NULL;
|
|
@ -26,7 +26,7 @@
|
||||||
"sageWithholding": {
|
"sageWithholding": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "SageWithholding",
|
"model": "SageWithholding",
|
||||||
"foreignKey": "sageWithholdingFk"
|
"foreignKey": "sageFarmerWithholdingFk"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"acls": [{
|
"acls": [{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
url="InvoiceInConfigs"
|
url="InvoiceInConfigs"
|
||||||
data="$ctrl.config"
|
data="$ctrl.config"
|
||||||
filter="{fields: ['sageWithholdingFk']}"
|
filter="{fields: ['sageFarmerWithholdingFk']}"
|
||||||
id-value="1"
|
id-value="1"
|
||||||
auto-load="true">
|
auto-load="true">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
|
|
|
@ -112,7 +112,7 @@ class Controller extends Descriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
isAgricultural() {
|
isAgricultural() {
|
||||||
return this.invoiceIn.supplier.sageWithholdingFk == this.config[0].sageWithholdingFk;
|
return this.invoiceIn.supplier.sageWithholdingFk == this.config[0].sageFarmerWithholdingFk;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue