2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-08-20 08:06:10 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`bankPolicy_notifyExpired`()
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Manda correo cuando caduca un seguro
|
|
|
|
* de los leasing
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
INSERT INTO mail (receiver,replyTo,subject,body)
|
|
|
|
SELECT 'administracion@verdnatura.es' receiver,
|
|
|
|
'noreply@verdnatura.es' replyTo,
|
2024-03-14 07:36:19 +00:00
|
|
|
CONCAT('El seguro de la poliza ',a.id,' ',a.bank,' ha finalizado.') subject,
|
|
|
|
CONCAT('El seguro de la poliza ',a.id,' ',a.bank,' ha finalizado.') body
|
|
|
|
FROM bankPolicy bp
|
|
|
|
LEFT JOIN supplier s ON s.id = bp.supplierFk
|
|
|
|
LEFT JOIN accounting a ON a.id = bp.accountingFk
|
2024-01-15 11:31:03 +00:00
|
|
|
WHERE bp.insuranceExpired = util.VN_CURDATE();
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|