2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
|
|
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`bankPolicy_notifyExpired`()
|
|
|
|
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,
|
|
|
|
CONCAT('El seguro de la poliza ',b.id,' ',b.bank,' ha finalizado.') subject,
|
|
|
|
CONCAT('El seguro de la poliza ',b.id,' ',b.bank,' ha finalizado.') body
|
|
|
|
FROM vn.bankPolicy bp
|
|
|
|
LEFT JOIN vn.supplier s
|
|
|
|
ON s.id = bp.supplierFk
|
|
|
|
LEFT JOIN vn.bank b
|
2024-02-23 06:18:32 +00:00
|
|
|
ON b.id = bp.accountingFk
|
2024-01-15 11:31:03 +00:00
|
|
|
WHERE bp.insuranceExpired = util.VN_CURDATE();
|
|
|
|
END$$
|
|
|
|
DELIMITER ;
|