We have 2 tables tbl1 and tbl2 and have 2 trigger on tbl2. tbl1 contains following fields
And tbl2 contains following fields
BEFORE Trigger on tbl2 will calculate update as follows
tbl2.loc_amt = tbl2.fcr_amt * tbl1.curr_rate
AFTER Trigger on tbl2 will calculate do as follows
tbl1.fcr_amt = sum(tbl2.fcr_amt);
tbl1.loc_amt = sum(tbl2.loc_amt);
The problem is sometimes tbl1.loc_amt will not match with tbl1.fcr_amt * curr_rate as all figures in tbl2 and tbl1 are rounded off to 2 decimal places. So we need to add the difference into any row of tbl2.loc_amt ( Prefer last record) . How to do this ? Please advise.