It is my Computer Notes. Using Guide : object-key or object-key-key e.g. Step 1 Blog Search : [mysql-run] and then Step 2 ctrl+F [mysql-run] {bookMark me : Ctrl+D}
2015年1月12日 星期一
erp-grn
/* grn but not dn */
GRNQTYOS.view <= grnbody= GRN_LINE + DNBODY
/* erp-grn_line */
delimiter $$
drop trigger if exists GRN_LINE_UpdateActionAfterUpdate;
CREATE TRIGGER GRN_LINE_UpdateActionAfterUpdate
After Update ON GRN_LINE
FOR EACH ROW
BEGIN
declare mqty double;
select GRNQTY FROM GRNQTY WHERE PO_RECORDID=NEW.PO_RECORDID INTO mqty;
UPDATE PO SET GRNQTY=mqty WHERE RECORDID=NEW.PO_RECORDID;
select GRNQTY FROM GRNQTY WHERE PO_RECORDID=OLD.PO_RECORDID INTO mqty;
UPDATE PO SET GRNQTY=mqty WHERE RECORDID=OLD.PO_RECORDID;
END;
$$
delimiter ;
UPDATE GRN_LINE SET AMOUNT=0;
SELECT GRNQTY FROM PO;
delimiter $$
drop trigger if exists GRN_LINE_DeleteActionAfterDelete;
CREATE TRIGGER GRN_LINE_DeleteActionAfterDelete
After Delete ON GRN_LINE
FOR EACH ROW
BEGIN
declare mqty double;
select GRNQTY FROM GRNQTY WHERE PO_RECORDID=OLD.PO_RECORDID INTO mqty;
UPDATE PO SET GRNQTY=mqty WHERE RECORDID=OLD.PO_RECORDID;
END;
$$
delimiter ;
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言