Código SQL:
Ver original
CREATE TRIGGER subtotal ON detaped FOR INSERT AS UPDATE detaped SET subtotal=precioventa*cantidad GO CREATE TRIGGER tg_act_Totales ON detaped FOR INSERT AS UPDATE pedido SET montopedido=(SELECT SUM(dp.subtotal) FROM detaped dp WHERE Pedido.IdPed=dp.Idped) GO CREATE TRIGGER tr_003 ON detafact FOR INSERT AS UPDATE factura SET factura.igv = factura.subtotal * 0.18 CREATE TRIGGER tr_004 ON detafact FOR INSERT AS UPDATE factura SET factura.total = factura.subtotal + factura.igv