refs #6498 procRefactor6 #2134
No reviewers
Labels
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: verdnatura/salix#2134
Loading…
Reference in New Issue
No description provided.
Delete Branch "6499-procRefactor6"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
6499-procRefactor6to 6498-procRefactor66498-procRefactor6to 6499-procRefactor66499-procRefactor6to 6498-procRefactor6@ -0,0 +1,100 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`absoluteInventoryHistory`(
vItemFk INT, vWarehouse INT, vDate DATETIME)
Esto separalo, tipo:
@ -0,0 +8,4 @@
* hasta una fecha determinada.
*
* @param vItemFk Id de artículo
* @param vWarehouse Almacén
Cambiar nombre de variable a vWarehouseFk y comentario a
Id de almacén
@ -0,0 +12,4 @@
* @param vDate Fecha
*/
DECLARE vCalculatedInventory INT;
DECLARE vToday DATETIME;
@ -0,0 +14,4 @@
DECLARE vCalculatedInventory INT;
DECLARE vToday DATETIME;
SET vToday = util.VN_CURDATE();
Quitar linea
@ -0,0 +23,4 @@
SELECT tr.landed `date`,
b.quantity input,
NULL `output`,
(tr.isReceived != FALSE) ok,
@ -0,0 +33,4 @@
JOIN travel tr ON tr.id = e.travelFk
JOIN supplier s ON s.id = e.supplierFk
WHERE tr.landed >= '2001-01-01'
AND s.id <> 4
No poner números a pelo en el código, para ello:
@ -0,0 +61,4 @@
SELECT t.shipped `date`,
NULL input,
m.quantity `output`,
(m.isPicked <> 0 OR t.isLabeled <> 0 OR t.refFk IS NOT NULL) ok,
@ -0,0 +69,4 @@
FROM sale m
JOIN ticket t ON t.id = m.ticketFk
JOIN client c ON c.id = t.clientFk
WHERE t.shipped >= '2001-01-01'
'2001-01-01' repetido en el código, crear variable con DEFAULT '2001-01-01'
@ -0,0 +75,4 @@
) t1
ORDER BY `date`, input DESC, ok DESC;
SELECT sum(input) - sum(`output`) INTO vCalculatedInventory
sum en mayuscula
@ -0,0 +80,4 @@
WHERE `date` < vDate;
SELECT p1.*, NULL v_virtual
FROM(
Espacio entre el FROM y el (
@ -0,0 +28,4 @@
SELECT tr.landed `date`,
c.quantity input,
NULL `output`,
IF(warehouseInFk = 44, 1, warehouseInFk) warehouse,
warehouseInFk warehouse
@ -0,0 +29,4 @@
c.quantity input,
NULL `output`,
IF(warehouseInFk = 44, 1, warehouseInFk) warehouse,
(tr.isReceived <> FALSE) ok,
tr.isReceived
@ -0,0 +31,4 @@
IF(warehouseInFk = 44, 1, warehouseInFk) warehouse,
(tr.isReceived <> FALSE) ok,
e.invoiceNumber reference,
e.id id
e.id
@ -0,0 +38,4 @@
WHERE tr.landed >= vDateInventory
AND c.itemFk = vItemFk
AND NOT e.isRaid
AND c.quantity <> 0
AND c.quantity
@ -0,0 +46,4 @@
tr.warehouseOutFk warehouse,
tr.isDelivered ok,
e.invoiceNumber reference,
e.id id
Quitar alias siempre a partir del segundo select cuando se haga un UNION
@ -0,0 +53,4 @@
WHERE tr.shipped >= vDateInventory
AND c.itemFk = vItemFk
AND NOT e.isRaid
AND c.quantity <> 0
c.quantity
@ -0,0 +70,4 @@
JOIN warehouse ON warehouse.id = history.warehouse
ORDER BY `date`, input DESC, ok DESC;
DROP TEMPORARY TABLE IF EXISTS tMultipleHistory2;
Poner todo en un solo drop
@ -0,0 +156,4 @@
input, `output`, ok, reference, id
FROM tMultipleHistory8
) sub
ORDER BY `date`, BOGinput IS NULL, VNHinput IS NULL, ALGinput IS NULL, MADinput IS NULL, MCFinput IS NULL, VILinput IS NULL, BARinput IS NULL;
Añadir sangria
6498-procRefactor6to refs #6498 procRefactor6