CREATE DEFINER=`root`@`localhost` trigger actuailizar_totalventa_insert after
insert on detalles_venta
for each row
update ventas
set saldo_total = (select sum(total) from detalles_venta where id_venta=new.id_venta)
where id_venta = new.id_venta
CREATE DEFINER=`root`@`localhost` trigger actuailizar_existencia_producto after insert on detalles_venta
for each row
update productos set existencia=(existencia-new.cant) where id_producto = new.id_producto
CREATE DEFINER=`root`@`localhost` trigger actuailizar_totalventa_update after
update on detalles_venta
for each row
update ventas
set saldo_total = (select sum(total) from detalles_venta where id_venta=new.id_venta)
where id_venta = new.id_venta
No hay comentarios:
Publicar un comentario