TYPE=TRIGGERS
triggers='CREATE DEFINER=`root`@`localhost` TRIGGER `DetHasilProduksiAdd` AFTER INSERT ON `tr_hasilproduksi_d` FOR EACH ROW BEGIN\n  DECLARE vtemp double;\nif (select jenisbrg from tm_barang where kodebrg=new.KodeBrg)="Inventory" then\n  select stockakhir-new.jml into vtemp from tm_stockbrg where kodebrg=new.kodebrg and kodeGd= new.KodeGD;\n  Update tm_stockbrg set Stockakhir =  stockakhir-(new.jml*ifnull(new.konv,1))\n  where kodebrg=new.kodebrg and kodeGd= new.KodeGD;\nend if;\nend' 'CREATE DEFINER=`root`@`localhost` TRIGGER `DetHasilProduksiUpdate` AFTER UPDATE ON `tr_hasilproduksi_d` FOR EACH ROW BEGIN\n \nif (select jenisbrg from tm_barang where kodebrg=Old.KodeBrg)="Inventory" then\n   Update tm_stockbrg set Stockakhir =  stockakhir+(Old.jml*ifnull(Old.konv,1))\n   where kodebrg=Old.kodebrg and kodeGd= Old.KodeGD;\n \n   Update tm_stockbrg set Stockakhir =  stockakhir-(new.jml*ifnull(new.konv,1))\n   where kodebrg=new.kodebrg and kodeGd= new.KodeGD;\nend if;\nend' 'CREATE DEFINER=`root`@`localhost` TRIGGER `DetHasilProduksiDelete` AFTER DELETE ON `tr_hasilproduksi_d` FOR EACH ROW BEGIN\n \nif (select jenisbrg from tm_barang where kodebrg=Old.KodeBrg)="Inventory" then\n   Update tm_stockbrg set Stockakhir =  stockakhir+(Old.jml*ifnull(Old.konv,1))\n   where kodebrg=Old.kodebrg and kodeGd= Old.KodeGD;\nend if;\nend'
sql_modes=524288 524288 524288
definers='root@localhost' 'root@localhost' 'root@localhost'
