refs #6493 refactorizar-procedimientos-vn2008-parte_2 #2235

Merged
jbreso merged 39 commits from 6493-refactorizar-procedimientos-vn2008-parte_2 into dev 2024-04-24 05:18:59 +00:00
Member
No description provided.
jbreso added 13 commits 2024-04-02 08:57:41 +00:00
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-dev This commit looks good Details
dc1ef34aba
feat: refs #6493 refactorizar procedimientos vn2008 parte2
gitea/salix/pipeline/pr-dev Something is wrong with the build of this commit Details
923d6a610a
Merge branch 'dev' into 6493-refactorizar-procedimientos-vn2008-parte2
gitea/salix/pipeline/pr-dev This commit looks good Details
e047d445d3
feat: refs#6493 modificado entry_getTransfer
gitea/salix/pipeline/pr-dev This commit looks good Details
c889353459
feat: refs#6493 modificar procedimiento balance_create
gitea/salix/pipeline/pr-dev This commit looks good Details
f2a1d401ca
refs#6493 update
gitea/salix/pipeline/pr-dev This commit looks good Details
f4b50dec3e
feat: refs#6493 modificar procedimiento balance_create
jbreso requested review from carlosap 2024-04-02 09:57:32 +00:00
carlosap requested changes 2024-04-05 09:46:56 +00:00
Dismissed
@ -0,0 +21,4 @@
END IF;
CALL item_getStock (vWarehouseLanding, vDated, NULL);
Member

Salto de línea innecesario

Salto de línea innecesario
jbreso marked this conversation as resolved
@ -0,0 +62,4 @@
CREATE OR REPLACE TEMPORARY TABLE tItemRangeLive
(PRIMARY KEY (itemFk))
ENGINE = MEMORY
SELECT ir.itemFk, TIMESTAMP(TIMESTAMPADD(DAY, it.life, ir.dated), '23:59:59') dated
Member

TIMESTAMPADD substituir por INTERVAL

TIMESTAMPADD substituir por INTERVAL
jbreso marked this conversation as resolved
@ -0,0 +73,4 @@
(INDEX (itemFk,warehouseFk))
ENGINE = MEMORY
SELECT i.itemFk, vWarehouseLanding warehouseFk, i.shipped dated, i.quantity
FROM vn.itemTicketOut i
Member

eliminar esquema vn, no es necesario

eliminar esquema vn, no es necesario
jbreso marked this conversation as resolved
@ -0,0 +74,4 @@
ENGINE = MEMORY
SELECT i.itemFk, vWarehouseLanding warehouseFk, i.shipped dated, i.quantity
FROM vn.itemTicketOut i
JOIN tItemRangeLive ir ON ir.itemFK = i.item_id
Member

porque se ha cambiado a item_id?

porque se ha cambiado a item_id?
jbreso marked this conversation as resolved
@ -0,0 +92,4 @@
AND (ir.dated IS NULL OR t.landed <= ir.dated)
UNION ALL
SELECT i.itemFk, vWarehouseLanding, i.shipped, i.quantity
FROM vn.itemEntryOut i
Member

eliminar esquema innecesario

eliminar esquema innecesario
jbreso marked this conversation as resolved
@ -0,0 +58,4 @@
WHERE id = vCompany;
CREATE OR REPLACE TEMPORARY TABLE tCompanyReceiving
SELECT id companyId
Member

companyFk

companyFk
jbreso marked this conversation as resolved
@ -0,0 +71,4 @@
DELETE ci.*
FROM tCompanyIssuing ci
JOIN company e on e.id = ci.companyId
Member

companyFk

companyFk
jbreso marked this conversation as resolved
@ -0,0 +86,4 @@
SUM(taxableBase) amount
FROM invoiceIn r
JOIN invoiceInTax ri on ri.invoiceInFk = r.id
JOIN tCompanyReceiving cr on cr.companyId = r.companyFk
Member

companyFk

companyFk
jbreso marked this conversation as resolved
@ -0,0 +88,4 @@
JOIN invoiceInTax ri on ri.invoiceInFk = r.id
JOIN tCompanyReceiving cr on cr.companyId = r.companyFk
JOIN tCompanyIssuing ci ON ci.companyId = r.supplierFk
WHERE IFNULL(r.bookEntried,IFNULL(r.booked, r.issued)) >= vStartingDate
Member

utilizar en este casi COALESCE

utilizar en este casi COALESCE
jbreso marked this conversation as resolved
@ -0,0 +90,4 @@
JOIN tCompanyIssuing ci ON ci.companyId = r.supplierFk
WHERE IFNULL(r.bookEntried,IFNULL(r.booked, r.issued)) >= vStartingDate
AND r.isBooked
GROUP BY expenseFk, year, month, ci.companyId, cr.companyId;
Member

companyFk

companyFk
jbreso marked this conversation as resolved
@ -0,0 +106,4 @@
expenseFk,
SUM(amount)
FROM expenseManual em
JOIN tCompanyReceiving er on em.companyFk = em.companyFk
Member

ON en mayúsculas
el JOIN está mal em.companyFk = em.companyFk enlazará todos los registros

ON en mayúsculas el JOIN está mal em.companyFk = em.companyFk enlazará todos los registros
jbreso marked this conversation as resolved
@ -0,0 +205,4 @@
b.', vOneYearAgo, ' = oneYearAgo,
b.', vTwoYearsAgo, ' = twoYearsAgo');
SELECT *, CONCAT('',ifnull(expenseFk,'')) newgasto
Member

funciones en mayúsculas

funciones en mayúsculas
jbreso marked this conversation as resolved
jbreso added 1 commit 2024-04-05 10:55:23 +00:00
jbreso added 2 commits 2024-04-05 10:56:02 +00:00
jbreso requested review from carlosap 2024-04-05 10:58:10 +00:00
carlosap requested changes 2024-04-05 12:38:24 +00:00
Dismissed
@ -0,0 +61,4 @@
CREATE OR REPLACE TEMPORARY TABLE tItemRangeLive
(PRIMARY KEY (itemFk))
ENGINE = MEMORY
SELECT ir.itemFk, TIMESTAMP(ir.dated + INTERVAL it.life DAY, '23:59:59') dated
Member

No utilizar hacer uso de TIMESTAMP(ir.dated + INTERVAL it.life DAY, '23:59:59') , tenemos una función que hace eso util.dayEnd

No utilizar hacer uso de TIMESTAMP(ir.dated + INTERVAL it.life DAY, '23:59:59') , tenemos una función que hace eso util.dayEnd
jbreso marked this conversation as resolved
@ -0,0 +53,4 @@
CREATE OR REPLACE TEMPORARY TABLE tmp.balance
SELECT * FROM tmp.nest;
SELECT companyGroupFk INTO vConsolidatedGroup
Member

tabulación

tabulación
jbreso marked this conversation as resolved
carlosap requested review from guillermo 2024-04-05 12:38:36 +00:00
jbreso added 1 commit 2024-04-08 05:08:55 +00:00
jbreso added 2 commits 2024-04-08 05:42:13 +00:00
guillermo requested changes 2024-04-08 06:22:00 +00:00
Dismissed
@ -0,0 +5,4 @@
vWarehouseShipment INT)
proc: BEGIN
/**
* Calcular la disponibilidad dependiendo del almacen de origen y destino según la fecha
Member

Sobrepasa los carácteres máximos x linea, a parte que al final va un punto

Sobrepasa los carácteres máximos x linea, a parte que al final va un punto
jbreso marked this conversation as resolved
@ -0,0 +7,4 @@
/**
* Calcular la disponibilidad dependiendo del almacen de origen y destino según la fecha
*
* @param vWarehouseLanding almacén de llegada.
Member

Falta poner un espacio entre vWarehouse y Landing.

Además de que cuando se ponen los params, ninguna descripción del param debe de tener punto (viendo otros procs se puede comprobar)

Falta poner un espacio entre vWarehouse y Landing. Además de que cuando se ponen los params, ninguna descripción del param debe de tener punto (viendo otros procs se puede comprobar)
Author
Member

vWarehouseLanding no se porque quieres el espacio la variable se llama asi, si pongo el espacio en esa también tendía que ponerlo en vWarehouseShipment?

vWarehouseLanding no se porque quieres el espacio la variable se llama asi, si pongo el espacio en esa también tendía que ponerlo en vWarehouseShipment?
Member

Vale no sorry, queria decir que la primera letra del comentario de la variable debe de estár en mayuscula, así en todos los del PR

Vale no sorry, queria decir que la primera letra del comentario de la variable debe de estár en mayuscula, así en todos los del PR
jbreso marked this conversation as resolved
@ -0,0 +8,4 @@
* Calcular la disponibilidad dependiendo del almacen de origen y destino según la fecha
*
* @param vWarehouseLanding almacén de llegada.
* @param vDated la fecha para la cual se está calculando la disponibilidad de articulos.
Member

Aquí hay doble espacio, y sobrepasa los carácteres máximos, acortar

Aquí hay doble espacio, y sobrepasa los carácteres máximos, acortar
jbreso marked this conversation as resolved
@ -0,0 +44,4 @@
AND NOT e.isRaid
GROUP BY c.itemFk;
-- Tabla con el ultimo dia de last_buy para cada producto que hace un replace de la anterior
Member

Sobrepasa los carácteres máximos x linea

Sobrepasa los carácteres máximos x linea
jbreso marked this conversation as resolved
@ -0,0 +56,4 @@
LEFT JOIN tItemRange i ON t.itemFk = i.itemFk
WHERE t.warehouseFk = vWarehouseShipment
AND NOT e.isRaid
ON DUPLICATE KEY UPDATE tItemRange.dated = GREATEST(tItemRange.dated, tr.landed);
Member

Sobrepasa los carácteres máximos x linea

Sobrepasa los carácteres máximos x linea
jbreso marked this conversation as resolved
@ -0,0 +71,4 @@
CREATE OR REPLACE TEMPORARY TABLE tmp.itemCalc
(INDEX (itemFk,warehouseFk))
ENGINE = MEMORY
SELECT i.itemFk, vWarehouseLanding warehouseFk, i.shipped dated, i.quantity
Member

Sobrepasa los carácteres máximos x linea, tabular

Sobrepasa los carácteres máximos x linea, tabular
jbreso marked this conversation as resolved
@ -0,0 +7,4 @@
IN vInterGroupSalesIncluded BOOLEAN)
BEGIN
/**
* Crea un balance financiero para una empresa durante un período de tiempo determinado
Member

Sobrepasa los carácteres máximos x linea, a parte que al final va un punto

Sobrepasa los carácteres máximos x linea, a parte que al final va un punto
jbreso marked this conversation as resolved
@ -0,0 +13,4 @@
* @param vEndingMonth Mes de finalización del período
* @param vCompany Identificador de la empresa
* @param vIsConsolidated Indica si se trata de un balance consolidado
* @param vInterGroupSalesIncluded Indica si se incluyen las ventas dentro del grupo
Member

Sobrepasa los caracteres máximos, acortar

Sobrepasa los caracteres máximos, acortar
jbreso marked this conversation as resolved
@ -0,0 +30,4 @@
SET vTable = util.quoteIdentifier('balanceNestTree');
SET vYear = util.quoteIdentifier(vCurYear);
SET vOneYearAgo = util.quoteIdentifier(vCurYear-1);
SET vTwoYearsAgo = util.quoteIdentifier(vCurYear-2);
Member

En el string donde hay una consulta SQL, linea 38, no poner la coma al principio, sino al final:

SELECT node.id,
CONCAT( REPEA...

A parte de quitar los AS (Menos el del CAST que es necesario).

Cast va en mayuscula.

Cambiar CONCAT( REPE... por CONCAT(REPE...

En el string donde hay una consulta SQL, linea 38, no poner la coma al principio, sino al final: SELECT node.id, CONCAT( REPEA... A parte de quitar los AS (Menos el del CAST que es necesario). Cast va en mayuscula. Cambiar `CONCAT( REPE...` por `CONCAT(REPE...`
jbreso marked this conversation as resolved
@ -0,0 +76,4 @@
END IF;
-- Se calculan las facturas que intervienen, para luego poder servir el desglose desde aqui
Member

Sobrepasa los caracteres máximos x linea

Sobrepasa los caracteres máximos x linea
jbreso marked this conversation as resolved
@ -0,0 +95,4 @@
INSERT INTO tmp.balanceDetail(
receivingId,
issuingId,
year,
Member

Year y month son palabras reservadas, poner entre `

Revisa todo el PR aplicandolo

Year y month son palabras reservadas, poner entre ` Revisa todo el PR aplicandolo
jbreso marked this conversation as resolved
@ -0,0 +131,4 @@
FROM expense
GROUP BY id) g ON g.id = bnt.expenseFk COLLATE utf8_general_ci
SET b.expenseFk = g.id COLLATE utf8_general_ci
, b.expenseName = g.id COLLATE utf8_general_ci ;
Member

No poner la , al principio, sino al final en la linea anterior

No poner la , al principio, sino al final en la linea anterior
jbreso marked this conversation as resolved
@ -0,0 +208,4 @@
SELECT *, CONCAT('',IFNULL(expenseFk,'')) newgasto
FROM tmp.balance;
DROP TEMPORARY TABLE IF EXISTS tCompanyReceiving;
Member

Utilizar un solo DROP para dropear las 2 tablas.

Utilizar un solo DROP para dropear las 2 tablas.
jbreso marked this conversation as resolved
@ -0,0 +2,4 @@
CREATE OR REPLACE PROCEDURE `vn`.`buy_recalcPricesByEntry`() BEGIN END;
CREATE OR REPLACE PROCEDURE `vn`.`buy_recalcPricesByBuy`() BEGIN END;
GRANT EXECUTE ON PROCEDURE vn.balance_create TO `financialBoss`;
Member

Unificar GRANT EXECUTE ON PROCEDURE vn.balance_create TO financialBoss, hrBoss;

Así con los demás grants, solo tiene que haber un GRANT EXECUTE para cada proc

Unificar GRANT EXECUTE ON PROCEDURE vn.balance_create TO `financialBoss`, `hrBoss`; Así con los demás grants, solo tiene que haber un GRANT EXECUTE para cada proc
jbreso marked this conversation as resolved
guillermo changed title from #6493 refactorizar-procedimientos-vn2008-parte_2 to refs #6493 refactorizar-procedimientos-vn2008-parte_2 2024-04-08 06:22:34 +00:00
jbreso added 1 commit 2024-04-08 07:54:04 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
92cd61460e
feat: refs#6493 Cambios solicitados procedimientos
jbreso requested review from guillermo 2024-04-08 07:55:30 +00:00
guillermo requested changes 2024-04-08 08:38:01 +00:00
Dismissed
@ -0,0 +8,4 @@
* Calcular la disponibilidad dependiendo del almacen
* de origen y destino según la fecha.
*
* @param vWarehouseLanding almacén de llegada
Member

lA primera letra del comentario de la variable debe de estar en mayúscula, así en todos los del PR

lA primera letra del comentario de la variable debe de estar en mayúscula, así en todos los del PR
jbreso marked this conversation as resolved
jbreso added 1 commit 2024-04-08 10:43:41 +00:00
jbreso added 2 commits 2024-04-08 10:54:30 +00:00
jbreso requested review from guillermo 2024-04-08 10:57:49 +00:00
guillermo requested changes 2024-04-08 11:02:25 +00:00
Dismissed
@ -0,0 +75,4 @@
(INDEX (itemFk,warehouseFk))
ENGINE = MEMORY
SELECT i.itemFk,
vWarehouseLanding warehouseFk,
Member

Tab

Tab
jbreso marked this conversation as resolved
@ -0,0 +85,4 @@
AND i.warehouseFk = vWarehouseLanding
UNION ALL
SELECT b.itemFk,
vWarehouseLanding,
Member

Tab

Tab
jbreso marked this conversation as resolved
@ -0,0 +89,4 @@
t.landed,
b.quantity
FROM buy b
JOIN entry e ON b.entryFk = e.id
Member

Tab

Tab
jbreso marked this conversation as resolved
@ -0,0 +130,4 @@
-- Añadimos los gastos, para facilitar el formulario
UPDATE tmp.balance b
JOIN balanceNestTree bnt on bnt.id = b.id
JOIN (SELECT id, name
Member

JOIN (
(TAB) SELECT id, name
....
GROUP BY id
) g ON g.id = bnt.expenseFk COLLATE utf8_general_ci

JOIN ( (TAB) SELECT id, name .... GROUP BY id ) g ON g.id = bnt.expenseFk COLLATE utf8_general_ci
jbreso marked this conversation as resolved
@ -0,0 +164,4 @@
c.Gasto
FROM bs.ventas_contables c
JOIN tCompanyReceiving cr ON cr.companyFk = c.empresa_id
WHERE month BETWEEN ? AND ?
Member

Sobra un espacio

Sobra un espacio
jbreso marked this conversation as resolved
@ -0,0 +203,4 @@
SUM(b2.', vTwoYearsAgo,') twoYearsAgo
FROM tmp.nest b1
JOIN tmp.balance_aux b2 on b2.lft BETWEEN b1.lft and b1.rgt
GROUP BY b1.id)sub ON sub.id = b.id
Member

(Tab) GROUP BY b1.id)
sub ON sub.id = b.id

(Tab) GROUP BY b1.id) sub ON sub.id = b.id
jbreso marked this conversation as resolved
jbreso added 1 commit 2024-04-08 11:26:16 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
1534402640
feat: refs#6493 Cambios solicitados procedimientos
guillermo approved these changes 2024-04-08 11:30:02 +00:00
Dismissed
jbreso added 1 commit 2024-04-08 11:30:07 +00:00
jbreso requested review from carlosap 2024-04-08 11:30:30 +00:00
jbreso added 1 commit 2024-04-10 06:58:08 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
2d4524a34c
feat: refs#6493 Cambios solicitados procedimientos
jbreso requested review from guillermo 2024-04-10 07:04:04 +00:00
guillermo approved these changes 2024-04-10 08:52:04 +00:00
Dismissed
carlosap requested changes 2024-04-11 11:38:00 +00:00
Dismissed
@ -0,0 +69,4 @@
SELECT id companyFk
FROM supplier p;
IF vInterGroupSalesIncluded = FALSE THEN
Member

NOT

NOT
jbreso marked this conversation as resolved
@ -0,0 +71,4 @@
IF vInterGroupSalesIncluded = FALSE THEN
DELETE ci.*
Member

'*' no es necesario

'*' no es necesario
jbreso marked this conversation as resolved
@ -0,0 +131,4 @@
UPDATE tmp.balance b
JOIN balanceNestTree bnt on bnt.id = b.id
JOIN (
SELECT id, name
Member

El id de la tabla expense es PK no tiene sentido hacer subconsulta con el GROUP BY

El id de la tabla expense es PK no tiene sentido hacer subconsulta con el GROUP BY
jbreso marked this conversation as resolved
@ -0,0 +188,4 @@
DELETE
FROM tmp.balance
WHERE lft BETWEEN @grupoLft AND @grupoRgt;
Member

nombre de las variable en inglés si no se retornan

nombre de las variable en inglés si no se retornan
jbreso marked this conversation as resolved
jbreso added 1 commit 2024-04-11 11:43:09 +00:00
jbreso added 1 commit 2024-04-17 05:30:42 +00:00
jbreso added 2 commits 2024-04-17 05:32:41 +00:00
jbreso added 1 commit 2024-04-17 05:37:14 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
3950d60387
feat: refs#6493 Cambios solicitados procedimientos
jbreso requested review from carlosap 2024-04-17 05:39:11 +00:00
jbreso added 1 commit 2024-04-23 06:02:43 +00:00
jbreso requested review from guillermo 2024-04-23 06:04:47 +00:00
guillermo approved these changes 2024-04-23 06:09:20 +00:00
Dismissed
carlosap requested changes 2024-04-23 10:00:37 +00:00
Dismissed
@ -0,0 +25,4 @@
-- Calcula algunos parámetros necesarios.
SET vDatedFrom = TIMESTAMP(vDated, '00:00:00');
SET vDatedTo = TIMESTAMP(TIMESTAMPADD(DAY, 4, vDated), '23:59:59');
Member

no utilizamos TIMESTAMPADD, modificar por INTERVAL

no utilizamos TIMESTAMPADD, modificar por INTERVAL
jbreso marked this conversation as resolved
jbreso added 1 commit 2024-04-23 10:16:30 +00:00
jbreso added 1 commit 2024-04-23 12:04:21 +00:00
jbreso added 2 commits 2024-04-23 12:05:16 +00:00
carlosap approved these changes 2024-04-23 12:45:56 +00:00
Dismissed
jbreso requested review from guillermo 2024-04-23 12:46:06 +00:00
jbreso requested review from carlosap 2024-04-23 12:46:07 +00:00
jbreso added 1 commit 2024-04-23 12:54:20 +00:00
gitea/salix/pipeline/pr-dev This commit looks good Details
5efb6acafe
feat: refs#6493 Cambios solicitados procedimientos
jbreso added 1 commit 2024-04-23 12:55:06 +00:00
guillermo approved these changes 2024-04-23 12:57:44 +00:00
carlosap approved these changes 2024-04-23 13:05:50 +00:00
jbreso added 1 commit 2024-04-24 05:03:21 +00:00
jbreso merged commit 8439125655 into dev 2024-04-24 05:18:59 +00:00
jbreso deleted branch 6493-refactorizar-procedimientos-vn2008-parte_2 2024-04-24 05:18:59 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: verdnatura/salix#2235
No description provided.