Dear All,
Our client requested to have a field in the Job Journal Form which sums up the Amount Column. So far I have succeeded but with a minor problem. Whenever a deletion takes place the update doesn't take place as it should. What I am doing is that through setfilters I am running through all the remaining records in the job journal line and sum up their total. Now let's say I have got 10 lines (1-10). I decide to delete line numbers 7-10. For some reason it sums up lines 1-7 even though 7 has been deleted.
The code goes like this:
TotalAmountLCY := 0;
JobJnlLine.Setrange("Journal Template Name",'Job');
JobJnlLine.Setrange("Journal Batch Name",CurrenJnlBatchName);
If JobJnlLine.Find('-') then
repeat
TotalAmountLCY := TotalAmountLCY + (JobJnlPrice."Unit Price" * Quantity);
unti JobJnlLine.Next = 0;
It seems that the code on delete is being run before the actual deletion and this explains why the last one deleted is constantly being missed out. The update with the setrange and other coding has been placed in the On delete record trigger. Can anyone give me any suggestion?
0
Comments
Consultant-Developper
http://www.CreaChain.com
Thanks