TYPE=TRIGGERS
triggers='CREATE DEFINER=`root`@`localhost` TRIGGER `ScrBayarJualAdd` AFTER INSERT ON `tr_scrbayarjual` FOR EACH ROW BEGIN\ndeclare vTransJual varchar (2);\nDECLARE vNoJual varchar (11);\nDECLARE vNilai double; \nDECLARE vTglBatal datetime;\nDeclare vKodeCust varchar(10);\ndeclare vNoBayar varchar(11);\ndeclare vExrate integer;\nselect Tglbatal,KodeCust into vTglbatal,vKodeCust from tr_BayarJual_M where NoBayarJ=new.NoBayarJ;\n  Update tr_jual_m set sisa =  ifnull(sisa,0) - new.nilai * new.exrate \n  where TransJual = New.TransJual and NoJual=New.NoJual;\n  Update tm_customer set piutang =  ifnull(piutang,0) - new.nilai * new.exrate \n  where KodeCust = vKodeCust;\nend' 'CREATE DEFINER=`root`@`localhost` TRIGGER `ScrBayarJualUpdate` AFTER UPDATE ON `tr_scrbayarjual` FOR EACH ROW BEGIN\ndeclare vTransJual varchar (2);\nDECLARE vNoJual varchar (11);\nDECLARE vNilai double; \nDECLARE vTglBatal datetime;\nDeclare vKodeCust varchar(10);\ndeclare vNoBayar varchar(11);\ndeclare vExrate integer;\nselect Tglbatal,KodeCust into vTglbatal,vKodeCust from tr_BayarJual_M where NoBayarJ=new.NoBayarJ;\n  Update tr_jual_m set sisa =  ifnull(sisa,0) - new.nilai * new.exrate \n  where TransJual = New.TransJual and NoJual=New.NoJual;\n  Update tr_jual_m set sisa =  ifnull(sisa,0) + old.nilai * old.exrate \n  where TransJual = old.TransJual and NoJual = old.NoJual;\n  Update tm_customer set piutang =  ifnull(piutang,0) - new.nilai * new.exrate \n  where KodeCust = vKodeCust;\n  Update tm_customer set piutang =  ifnull(piutang,0) + old.nilai * old.exrate \n  where KodeCust = vKodeCust;\nend' 'CREATE DEFINER=`root`@`localhost` TRIGGER `ScrBayarJualDelete` AFTER DELETE ON `tr_scrbayarjual` FOR EACH ROW BEGIN\ndeclare vTransJual varchar (2);\nDECLARE vNoJual varchar (11);\nDECLARE vNilai double; \nDECLARE vTglBatal datetime;\nDeclare vKodeCust varchar(10);\ndeclare vNoBayar varchar(11);\ndeclare vExrate integer;\nselect Tglbatal,KodeCust into vTglbatal,vKodeCust from tr_BayarJual_M where NoBayarJ=Old.NoBayarJ;\n  Update tr_jual_m set sisa =  ifnull(sisa,0) + old.nilai * old.exrate \n  where TransJual = old.TransJual and NoJual = old.NoJual;\n  Update tm_customer set piutang =  ifnull(piutang,0) + old.nilai * old.exrate \n  where KodeCust = vKodeCust;\nend'
sql_modes=524288 524288 524288
definers='root@localhost' 'root@localhost' 'root@localhost'
