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, '
',
- '
-
',
- ' ', vAlias, '
-
-
- Ticket ', vTicketFk,'
-
-
- ', vAmount, ' €
-
',
- ' ', 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
',
- '