DELIMITER $$;
CREATE TRIGGER on_update_gestion_commandes 
AFTER UPDATE ON gestion_commandes
    FOR EACH ROW 
        BEGIN
            IF NEW.status='Livré' THEN
                BEGIN
                UPDATE `mouvement_clients` SET `commercial_code`=NEW.commercial_code WHERE `entetcommercial_code`=NEW.num_bl;
                END;
            END IF;
        END



