diff --git a/db/routines/vn/procedures/client_mailSales.sql b/db/routines/vn/procedures/client_mailSales.sql deleted file mode 100644 index 7178d981f..000000000 --- a/db/routines/vn/procedures/client_mailSales.sql +++ /dev/null @@ -1,101 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_mailSales`( - vSelf INT, - vDated DATE -) -proc: BEGIN -/** - * Envia un correo electrónico con un resumen de los pedidos - * preparados para un cliente. - * - * @param vSelf Id del cliente - * @param vDated Fecha de preparación - */ - DECLARE vTicketFk INT; - DECLARE vAlias VARCHAR(50); - DECLARE vStreet VARCHAR(255); - DECLARE vCity VARCHAR(25); - DECLARE vAmount DOUBLE; - DECLARE vMailTo VARCHAR(250); - DECLARE vString TEXT; - DECLARE vDone BOOL DEFAULT FALSE; - DECLARE vTickets CURSOR FOR - SELECT t.id, - t.nickname, - CAST(sub.amount AS DECIMAL(10,2)) amount, - a.street, - a.city - FROM ticket t - JOIN `address` a ON t.addressFk = a.id - JOIN ( - SELECT s.ticketFk, - SUM( - s.quantity * s.price * (100 - s.discount) / 100 - ) amount - FROM sale s - JOIN ticket t ON t.id = s.ticketFk - WHERE t.shipped >= util.VN_CURDATE() - INTERVAL 6 MONTH - GROUP BY s.ticketFk - ) sub ON sub.ticketFk = t.id - WHERE t.shipped BETWEEN vDated AND util.dayEnd(vDated) - AND t.clientFk = vSelf; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - SET vDated = IFNULL(vDated, util.yesterday()); - - SET vString = CONCAT('

', - '

Relación de envíos.

', - '

Dia: ', vDated, '

'); - - OPEN vTickets; - l: LOOP - SET vDone = FALSE; - FETCH vTickets INTO vTicketFk, vAlias, vAmount, vStreet, vCity; - - IF vDone THEN - LEAVE l; - END IF; - - SET vString = CONCAT(vString, '

', - ' - - - - - - -
- Ticket ', vTicketFk,' ', vAmount, ' €
', - ' ', vAlias, '
', - ' ', vStreet, '(', vCity, ')'); - END LOOP; - - IF vTicketFk IS NULL THEN - LEAVE proc; - END IF; - - SET vString = CONCAT( - vString, - '', - '', - '
', - '

Puede acceder al detalle de los albaranes haciendo click sobre el número de Ticket', - '

Muchas gracias por su confianza

', - '

'); - - SELECT email INTO vMailTo - FROM client - WHERE id = vSelf - AND email <> ''; - - -- Envío del email - IF vMailTo IS NOT NULL THEN - CALL mail_insert( - vMailTo, - NULL, - 'Resumen de pedidos preparados', - vString - ); - END IF; -END$$ -DELIMITER ; diff --git a/db/routines/vn/procedures/client_mailSalesLauncher.sql b/db/routines/vn/procedures/client_mailSalesLauncher.sql deleted file mode 100644 index 89337b5c8..000000000 --- a/db/routines/vn/procedures/client_mailSalesLauncher.sql +++ /dev/null @@ -1,30 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`client_mailSalesLauncher`() -BEGIN -/** - * Lanza el envío de correos electrónicos con el resumen de pedidos - * preparados para todos los clientes con el campo eypbc a TRUE. - * - * @param vSelf Id del cliente - * @param vDated Fecha de preparación - */ - DECLARE vDone BOOL DEFAULT FALSE; - DECLARE vClientFk INT; - DECLARE vClients CURSOR FOR - SELECT id - FROM client - WHERE eypbc; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE; - - OPEN vClients; - l: LOOP - SET vDone = FALSE; - FETCH vClients INTO vClientFk; - - IF vDone THEN - LEAVE l; - END IF; - CALL client_mailSales(vClientFk, util.yesterday()); - END LOOP; -END$$ -DELIMITER ; diff --git a/db/versions/10918-wheatRose/00-firstScript.sql b/db/versions/10918-wheatRose/00-firstScript.sql index c915e909a..5d0fb1c32 100644 --- a/db/versions/10918-wheatRose/00-firstScript.sql +++ b/db/versions/10918-wheatRose/00-firstScript.sql @@ -1,4 +1,2 @@ -UPDATE IGNORE bs.nightTask - SET `procedure` = 'client_mailSalesLauncher', - `schema` = 'vn' +DELETE FROM bs.nightTask WHERE `procedure` = 'emailYesterdayPurchasesLauncher';