deanwarner
MIS
Hello
I am trying to programme so that I get a reducing balance against records with the same partno.
Example
Part Number Movement Prevpro Reducing Balance
= Prevpro - Movement
Part A 50 1000 950 (1000-50)
Part A 500 1000 450 (950-500)
Part A -550 1000 1000 (450--550)
Part B 300 2000 1700 (2000-300)
Part C 700 0 -700 (0-700)
I have been trying to crack this using this code and are getting nowhere.
I am sure this is a really common requirement but I can't get the thing right in my head.
If anyone can show me the light I thank you.
use c:\ammdata\mschco1i in 0 shared order tag partno
newpart = mschco1i.partno
chg = mschco1i.produced
scan
if newpart = partno
replace mschco1i.prodbal with mschco1i.produced-chg
else
newpart = partno
replace mschco1i.prodbal with mschco1i.produced-chg
endif
endscan
close databases
I am trying to programme so that I get a reducing balance against records with the same partno.
Example
Part Number Movement Prevpro Reducing Balance
= Prevpro - Movement
Part A 50 1000 950 (1000-50)
Part A 500 1000 450 (950-500)
Part A -550 1000 1000 (450--550)
Part B 300 2000 1700 (2000-300)
Part C 700 0 -700 (0-700)
I have been trying to crack this using this code and are getting nowhere.
I am sure this is a really common requirement but I can't get the thing right in my head.
If anyone can show me the light I thank you.
use c:\ammdata\mschco1i in 0 shared order tag partno
newpart = mschco1i.partno
chg = mschco1i.produced
scan
if newpart = partno
replace mschco1i.prodbal with mschco1i.produced-chg
else
newpart = partno
replace mschco1i.prodbal with mschco1i.produced-chg
endif
endscan
close databases