diff --git a/db/routines/vn/functions/sale_hasComponentLack.sql b/db/routines/vn/functions/sale_hasComponentLack.sql index 6d1b4ad01..912d5f107 100644 --- a/db/routines/vn/functions/sale_hasComponentLack.sql +++ b/db/routines/vn/functions/sale_hasComponentLack.sql @@ -1,18 +1,20 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`sale_hasComponentLack`(vSelf INT) - RETURNS tinyint(1) +CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`sale_hasComponentLack`( + vSelf INT +)RETURNS tinyint(1) READS SQL DATA BEGIN /** - * Comprueba si la línea de sale tiene todos lo componentes obligatorios + * Check if a sales line has all the required components. * + * @param vSelf Id de sale * @return BOOL */ DECLARE vHasComponentLack TINYINT(1); WITH componentRequired AS( - SELECT COUNT(*)total - FROM vn.component + SELECT COUNT(*) total + FROM vn.component WHERE isRequired )SELECT SUM(IF(c.isRequired, TRUE, FALSE)) <> cr.total INTO vHasComponentLack FROM vn.sale s diff --git a/db/routines/vn/functions/ticket_isTooLittle.sql b/db/routines/vn/functions/ticket_isTooLittle.sql index cd14d6bed..01b3d9fbb 100644 --- a/db/routines/vn/functions/ticket_isTooLittle.sql +++ b/db/routines/vn/functions/ticket_isTooLittle.sql @@ -1,11 +1,12 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticket_isTooLittle`(vSelf INT) +CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticket_isTooLittle`( + vSelf INT +) RETURNS tinyint(1) READS SQL DATA BEGIN /** - * Comprueba si el ticket es pequeño en función de los parámtros de configuración - * teniendo en cuenta el volumen y el importe + * Check if the ticket is small based on the volume and amount parameters. * * @return BOOL */ diff --git a/db/routines/vn/procedures/buy_getRoundingProblem.sql b/db/routines/vn/procedures/buy_getRoundingProblem.sql index 9a658d169..870275f70 100644 --- a/db/routines/vn/procedures/buy_getRoundingProblem.sql +++ b/db/routines/vn/procedures/buy_getRoundingProblem.sql @@ -4,9 +4,9 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_getRoundingProb ) BEGIN /** - * Actualiza los problemas de redondeo para las líneas de venta relacionadas con un buy + * Update the rounding problems for sales lines related to a buy. * - * @param vSelf Id de ticket + * @param vSelf Id ticket */ DECLARE vWarehouseFk INT; DECLARE vDated DATE; diff --git a/db/routines/vn/procedures/client_risk.sql b/db/routines/vn/procedures/client_risk.sql index 6f170222e..a655a7c97 100644 --- a/db/routines/vn/procedures/client_risk.sql +++ b/db/routines/vn/procedures/client_risk.sql @@ -3,19 +3,19 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_risk`( vSelf INT) BEGIN /** - * Actualiza el riesgo de los tickets pendientes de un cliente + * Update the risk for a client with pending tickets * - * @param vSelf Id del cliente + * @param vSelf Id cliente */ DECLARE vHasDebt BOOL; - + SELECT COUNT(*) INTO vHasDebt FROM `client` WHERE id = vSelf AND typeFk = 'normal'; - + IF vHasDebt THEN - + CREATE OR REPLACE TEMPORARY TABLE tTicketRisk (KEY (ticketFk)) ENGINE = MEMORY @@ -45,7 +45,7 @@ BEGIN AND status = 'ok' ) sub ), uninvoiced AS( - SELECT DATE(t.shipped) dated, SUM(t.totalWithVat)amount + SELECT DATE(t.shipped) dated, SUM(t.totalWithVat) amount FROM vn.ticket t JOIN dated d WHERE t.clientFk = vSelf @@ -71,11 +71,11 @@ BEGIN SELECT ti.ticketFk, r.amount FROM ticket ti JOIN risk r ON r.dated = ti.dated; - + UPDATE ticket t JOIN tTicketRisk tr ON tr.ticketFk = t.id SET t.risk = tr.amount; - + DROP TEMPORARY TABLE IF EXISTS tTicketRisk; END IF; END$$ diff --git a/db/routines/vn/procedures/client_riskAll.sql b/db/routines/vn/procedures/client_riskAll.sql index 0941d2ad5..a3c2f8a86 100644 --- a/db/routines/vn/procedures/client_riskAll.sql +++ b/db/routines/vn/procedures/client_riskAll.sql @@ -2,7 +2,7 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_riskAll`() BEGIN /** - * Actualiza el riesgo todos los clientes + * Update the risk for all clients with pending tickets * */ DECLARE vDone BOOL; @@ -10,7 +10,7 @@ BEGIN DECLARE cClients CURSOR FOR SELECT id - FROM vn.client; + FROM client; DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; @@ -20,7 +20,7 @@ BEGIN SET vDone = FALSE; FETCH cClients INTO vClientFk; IF vDone THEN LEAVE myLoop; END IF; - CALL vn.client_risk(vClientFk); + CALL client_risk(vClientFk); END LOOP; CLOSE cClients; END$$ diff --git a/db/routines/vn/procedures/sale_getComponentLackProblem.sql b/db/routines/vn/procedures/sale_getComponentLackProblem.sql index 0f8b6b690..35bf963a0 100644 --- a/db/routines/vn/procedures/sale_getComponentLackProblem.sql +++ b/db/routines/vn/procedures/sale_getComponentLackProblem.sql @@ -4,8 +4,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_getComponentLa ) BEGIN /** - * Actualiza los problemas para las líneas de ventas que tienen o dejan de tener problemas - * con los componentes, verifica que esten o no todos los componenetes obligatorios + * Update the problems for sales lines that have or no longer have problems with components, + * verify whether all mandatory components are present or not * * @param vSelf Id del sale */ @@ -13,7 +13,7 @@ BEGIN (INDEX(saleFk)) ENGINE = MEMORY SELECT vSelf saleFk, sale_hasComponentLack(vSelf) hasProblem; - + CALL sale_setProblem('hasComponentLack'); DROP TEMPORARY TABLE tmp.sale; diff --git a/db/routines/vn/procedures/sale_getComponentLackProblemAll.sql b/db/routines/vn/procedures/sale_getComponentLackProblemAll.sql index d9e8c5e07..f8b4560bc 100644 --- a/db/routines/vn/procedures/sale_getComponentLackProblemAll.sql +++ b/db/routines/vn/procedures/sale_getComponentLackProblemAll.sql @@ -2,10 +2,9 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_getComponentLackProblemAll`() BEGIN /** - * Actualiza los problemas para las líneas de ventas que tienen o dejan de tener problemas - * con los componentes, verifica que esten o no todos los componenetes obligatorios - * - * @param vSelf Id del sale + * Update the problems for all pending sales lines that have or no longer have problems + * with components, verify whether all mandatory components are present or not + * */ CREATE OR REPLACE TEMPORARY TABLE tmp.sale (INDEX(saleFk)) diff --git a/db/routines/vn/procedures/sale_getComponentLackProblemComponent.sql b/db/routines/vn/procedures/sale_getComponentLackProblemComponent.sql index e02f2a802..06958d5f8 100644 --- a/db/routines/vn/procedures/sale_getComponentLackProblemComponent.sql +++ b/db/routines/vn/procedures/sale_getComponentLackProblemComponent.sql @@ -4,8 +4,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_getComponentLa ) BEGIN /** - * Actualiza los problemas para las líneas de ventas que tienen o dejan de tener problemas - * con los componentes que derivan de cambios en la tabla vn.component + * Update the issues for sales lines that have or no longer have problems with components, verify + * whether all mandatory components are present or not resulting from changes in the table vn.component * */ CREATE OR REPLACE TEMPORARY TABLE tmp.sale @@ -17,7 +17,7 @@ BEGIN LEFT JOIN saleComponent sc ON sc.saleFk = s.id WHERE t.shipped >= util.midnight() AND sc.componentFk = vComponentFk; - + CALL sale_setProblem('hasComponentLack'); DROP TEMPORARY TABLE tmp.sale; diff --git a/db/routines/vn/procedures/sale_getRoundingProblem.sql b/db/routines/vn/procedures/sale_getRoundingProblem.sql index ab01dfdb8..01afc9d72 100644 --- a/db/routines/vn/procedures/sale_getRoundingProblem.sql +++ b/db/routines/vn/procedures/sale_getRoundingProblem.sql @@ -4,9 +4,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_getRoundingPro ) BEGIN /** - * Actualiza los problemas de redondeo para las líneas de venta - * - * @param vSelf Id de sale + * Update the rounding problem for a sales line + * @param vSelf Id sale */ DECLARE vItemFk INT; DECLARE vWarehouseFk INT; diff --git a/db/routines/vn/procedures/sale_setProblem.sql b/db/routines/vn/procedures/sale_setProblem.sql index 723d97a34..b0b1b8c6f 100644 --- a/db/routines/vn/procedures/sale_setProblem.sql +++ b/db/routines/vn/procedures/sale_setProblem.sql @@ -4,8 +4,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`sale_setProblem`( ) BEGIN /** - * Actualiza en la tabla sale la columna problema - * @table tmp.sale(saleFk, hasProblem) Identificadores de los sales a actualizar + * Update column sale.problem with a problem code + * @table tmp.sale(saleFk, hasProblem) */ UPDATE sale s JOIN tmp.sale ts ON ts.saleFk = s.id diff --git a/db/routines/vn/procedures/ticket_getFreezeProblem.sql b/db/routines/vn/procedures/ticket_getFreezeProblem.sql index c3c35b9b8..b830ac853 100644 --- a/db/routines/vn/procedures/ticket_getFreezeProblem.sql +++ b/db/routines/vn/procedures/ticket_getFreezeProblem.sql @@ -1,9 +1,8 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getFreezeProblem`() -proc: BEGIN +BEGIN /** - * Actualiza los problemas de los ticket de hoy y a fututo cuyo cliente - * se encuentra congelado o deja de estarlo + * Update the problem of tickets whose client is frozen or unfrozen * * @table tmp.ticket(ticketFk, hasProblem) */ diff --git a/db/routines/vn/procedures/ticket_getFreezeProblemAll.sql b/db/routines/vn/procedures/ticket_getFreezeProblemAll.sql index f91436964..94c8c8525 100644 --- a/db/routines/vn/procedures/ticket_getFreezeProblemAll.sql +++ b/db/routines/vn/procedures/ticket_getFreezeProblemAll.sql @@ -2,8 +2,8 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getFreezeProblemAll`() proc: BEGIN /** - * Actualiza los problemas de los ticket de hoy y a fututo cuyo cliente - * se encuentra congelado o deja de estarlo + * Update the problem of all tickets whose client is frozen or unfrozen + * */ CREATE OR REPLACE TEMPORARY TABLE tmp.ticket (INDEX(ticketFk)) @@ -11,7 +11,7 @@ proc: BEGIN SELECT t.id ticketFk, FALSE hasProblem FROM ticket t WHERE t.shipped >= util.midnight(); - + CALL ticket_getFreezeProblem(); DROP TEMPORARY TABLE tmp.ticket; diff --git a/db/routines/vn/procedures/ticket_getFreezeProblemByClient.sql b/db/routines/vn/procedures/ticket_getFreezeProblemByClient.sql index 58f574368..a5f8ce6bf 100644 --- a/db/routines/vn/procedures/ticket_getFreezeProblemByClient.sql +++ b/db/routines/vn/procedures/ticket_getFreezeProblemByClient.sql @@ -4,8 +4,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getFreezePro ) proc: BEGIN /** - * Actualiza los problemas de los ticket de hoy y a fututo cuyo cliente - * se encuentra congelado o deja de estarlo + * Update the problem of all client tickets whose client is frozen or unfrozen + * @param vClientFk Id client */ CREATE OR REPLACE TEMPORARY TABLE tmp.ticket (INDEX(ticketFk)) diff --git a/db/routines/vn/procedures/ticket_getRequestProblem.sql b/db/routines/vn/procedures/ticket_getRequestProblem.sql index 82695b8d6..9b94c72b5 100644 --- a/db/routines/vn/procedures/ticket_getRequestProblem.sql +++ b/db/routines/vn/procedures/ticket_getRequestProblem.sql @@ -2,8 +2,8 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getRequestProblem`() BEGIN /** - * Actualiza los problemas de tickets que tienen una petición de compra pendiente o - * deja de tenerla + * Update the problems of tickets that have a pending ticketRequest or no longer have it + * * @table tmp.ticket(ticketFk, hasProblem) */ UPDATE tmp.ticket t diff --git a/db/routines/vn/procedures/ticket_getRequestProblemAll.sql b/db/routines/vn/procedures/ticket_getRequestProblemAll.sql index 18a373ecd..3cd726aac 100644 --- a/db/routines/vn/procedures/ticket_getRequestProblemAll.sql +++ b/db/routines/vn/procedures/ticket_getRequestProblemAll.sql @@ -2,8 +2,7 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getRequestProblemAll`() BEGIN /** - * Actualiza los problemas de tickets pendientes de preparar que tiene una petición - * de compra pendiente o deja de tenerla + * Update the problems of all tickets that have a pending ticketRequest or no longer have it */ DECLARE vHasProblem BOOL; diff --git a/db/routines/vn/procedures/ticket_getRiskProblem.sql b/db/routines/vn/procedures/ticket_getRiskProblem.sql index 458b0aff9..cd8a5931f 100644 --- a/db/routines/vn/procedures/ticket_getRiskProblem.sql +++ b/db/routines/vn/procedures/ticket_getRiskProblem.sql @@ -4,9 +4,9 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getRiskProbl ) BEGIN /** - * Actualiza los problema de riesgo para un ticket en concreto + * Update the risk problem for a specific ticket * - * @param vSelf Id del ticket + * @param vSelf Id ticket */ DECLARE vHasRisk BOOL; DECLARE vHasHighRisk BOOL; diff --git a/db/routines/vn/procedures/ticket_getRiskProblemAll.sql b/db/routines/vn/procedures/ticket_getRiskProblemAll.sql index 1a3776c16..b9a0bc617 100644 --- a/db/routines/vn/procedures/ticket_getRiskProblemAll.sql +++ b/db/routines/vn/procedures/ticket_getRiskProblemAll.sql @@ -2,9 +2,8 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getRiskProblemAll`() BEGIN /** - * Actualiza los problema de riesgo para un ticket en concreto + * Update the risk problem for all tickets * - * @param vSelf Id del ticket */ CREATE OR REPLACE TEMPORARY TABLE tRisk (KEY (ticketFk)) diff --git a/db/routines/vn/procedures/ticket_getRoundingProblem.sql b/db/routines/vn/procedures/ticket_getRoundingProblem.sql index ca88fdf0a..230065a88 100644 --- a/db/routines/vn/procedures/ticket_getRoundingProblem.sql +++ b/db/routines/vn/procedures/ticket_getRoundingProblem.sql @@ -4,7 +4,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getRoundingP ) BEGIN /** - * Actualiza los problemas de redondeo para las líneas de venta de un ticket + * Update the rounding problem for the sales lines of a ticket * * @param vSelf Id de ticket */ diff --git a/db/routines/vn/procedures/ticket_getTaxDataCheckedProblem.sql b/db/routines/vn/procedures/ticket_getTaxDataCheckedProblem.sql index 95678e35e..56dd29048 100644 --- a/db/routines/vn/procedures/ticket_getTaxDataCheckedProblem.sql +++ b/db/routines/vn/procedures/ticket_getTaxDataCheckedProblem.sql @@ -1,12 +1,12 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getTaxDataCheckedProblem`() -proc: BEGIN +CREATE OR REPLACE DEFINER=`root`@`localhost` + PROCEDURE `vn`.`ticket_getTaxDataCheckedProblem`() +BEGIN /** - * Actualiza los problemas de los ticket de hoy y a fututo - * cuyo cliente tenga o no los datos comprobados + * Update the problem of tickets, depending on whether + * the client taxDataCheched is verified or not * */ - UPDATE tmp.ticket t JOIN ticket ti ON ti.id = t.ticketFk JOIN client c ON c.id = ti.clientFk diff --git a/db/routines/vn/procedures/ticket_getTaxDataCheckedProblemAll.sql b/db/routines/vn/procedures/ticket_getTaxDataCheckedProblemAll.sql index 64ce44fe5..d5b011ebd 100644 --- a/db/routines/vn/procedures/ticket_getTaxDataCheckedProblemAll.sql +++ b/db/routines/vn/procedures/ticket_getTaxDataCheckedProblemAll.sql @@ -1,9 +1,10 @@ DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getTaxDataCheckedProblemAll`() +CREATE OR REPLACE DEFINER=`root`@`localhost` + PROCEDURE `vn`.`ticket_getTaxDataCheckedProblemAll`() proc: BEGIN /** - * Actualiza los problemas de los tickets de hoy y a futuro - * cuyos clientes tengan o no los datos comprobados + * Update the problem of all tickets, depending on whether + * the client taxDataCheched is verified or not */ CREATE OR REPLACE TEMPORARY TABLE tmp.ticket diff --git a/db/routines/vn/procedures/ticket_getTaxDataCheckedProblemByClient.sql b/db/routines/vn/procedures/ticket_getTaxDataCheckedProblemByClient.sql index 8f9e171c5..3e641c96f 100644 --- a/db/routines/vn/procedures/ticket_getTaxDataCheckedProblemByClient.sql +++ b/db/routines/vn/procedures/ticket_getTaxDataCheckedProblemByClient.sql @@ -4,12 +4,11 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getTaxDataCh ) proc: BEGIN /** - * Actualiza los problemas de los ticket de hoy y a futuro - * cuyo cliente tenga o no los datos comprobados + * Update the problem of tickets for a specific client, depending on whether + * the client taxDataCheched is verified or not * - * @param vClientFk Id del cliente + * @param vClientFk Id cliente */ - CREATE OR REPLACE TEMPORARY TABLE tmp.ticket (INDEX(ticketFk)) ENGINE = MEMORY diff --git a/db/routines/vn/procedures/ticket_getTooLittleProblem.sql b/db/routines/vn/procedures/ticket_getTooLittleProblem.sql index b75f795e3..39f2302b4 100644 --- a/db/routines/vn/procedures/ticket_getTooLittleProblem.sql +++ b/db/routines/vn/procedures/ticket_getTooLittleProblem.sql @@ -4,7 +4,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getTooLittle ) BEGIN /** - * Actualiza los problemas cuando el ticket es demasiado pequeño o deja de serlo + * Update the problems when the ticket is too small or is no longer so * * @param vSelf Id del ticket */ diff --git a/db/routines/vn/procedures/ticket_getTooLittleProblemAll.sql b/db/routines/vn/procedures/ticket_getTooLittleProblemAll.sql index beed67810..ab14d0804 100644 --- a/db/routines/vn/procedures/ticket_getTooLittleProblemAll.sql +++ b/db/routines/vn/procedures/ticket_getTooLittleProblemAll.sql @@ -2,7 +2,7 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getTooLittleProblemAll`() BEGIN /** - * Actualiza los problemas cuando un ticket es demasiado pequeño o deja de serlo + * Update the problems for all tickets when the ticket is too small or is no longer so * */ CREATE OR REPLACE TEMPORARY TABLE tmp.ticket diff --git a/db/routines/vn/procedures/ticket_getTooLittleProblemConfig.sql b/db/routines/vn/procedures/ticket_getTooLittleProblemConfig.sql index 96883a0ae..6a9f41e24 100644 --- a/db/routines/vn/procedures/ticket_getTooLittleProblemConfig.sql +++ b/db/routines/vn/procedures/ticket_getTooLittleProblemConfig.sql @@ -2,8 +2,8 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getTooLittleProblemConfig`() BEGIN /** - * Actualiza los problemas cuando el ticket es demasiado pequeño o deja de serlo, que derivan - * del cambio en la tabla vn.volumeConfig + * Update the problems when the ticket is too small or is no longer so, + * derived from changes in the volumeConfig table * */ CREATE OR REPLACE TEMPORARY TABLE tmp.ticket diff --git a/db/routines/vn/procedures/ticket_getTooLittleProblemItemCost.sql b/db/routines/vn/procedures/ticket_getTooLittleProblemItemCost.sql index 1f75a8a45..abcbb307c 100644 --- a/db/routines/vn/procedures/ticket_getTooLittleProblemItemCost.sql +++ b/db/routines/vn/procedures/ticket_getTooLittleProblemItemCost.sql @@ -4,8 +4,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_getTooLittle ) BEGIN /** - * Actualiza los problemas cuando el ticket es demasiado pequeño o deja de serlo, que derivan - * del cambio en la tabla vn.itemCost + * Update the problems when the ticket is too small or is no longer so, + * derived from changes in the itemCost table * * @param vItemFk Id del item */ diff --git a/db/routines/vn/procedures/ticket_setProblem.sql b/db/routines/vn/procedures/ticket_setProblem.sql index 24bb97258..4566d3b79 100644 --- a/db/routines/vn/procedures/ticket_setProblem.sql +++ b/db/routines/vn/procedures/ticket_setProblem.sql @@ -4,8 +4,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_setProblem`( ) BEGIN /** - * Actualiza en la tabla ticket la columna problema - * @table tmp.ticket(ticketFk, hasProblem) Identificadores de los tickets a actualizar + * Update column ticket.problem with a problem code + * @table tmp.ticket(ticketFk, hasProblem) */ UPDATE ticket t JOIN tmp.ticket tt ON tt.ticketFk = t.id