Hi Everyone, I need help
I have the following records in a table and want to calculate the last column “value”
The calculation is dependent of the change of ‘issuetype’ RECEIPT.
Item issuetype date quant u_price cur_bal value
0001 RECEIPT 01-09 12 20 12 12*20=240
0001 ISSUE 04-09 -5 7 7*20=140
0001 ISSUE 07-09 -2 5 5*20=100
0001 RECEIPT 08-09 8 25 13 8*25+((13-8)*20)=300
0001 ISSUE 09-09 -3 10 300/13*10 =231
0001 ISSUE 10-09 -2 8 300/13*8 = 185
0001 RECEIPT 11-09 6 20 14 14*20 = 280
0001 ISSUE 12-09 -4 10 10*20 = 200
0001 ISSUE 14-09 -1 9 9*20 =180
For the first 3 lines:
Value = u_prize*cur_bal
Line 4:
Issuetype = RECEIPT
u_price is greater than the previous u_price then
value = quant * u_prize + ((cur_bal – quant)* previous u_price)
line 5 and 6
And for the following lines where issuetype = ISSUE
value = previous value (where issuetype = RECEIPT)/previous cur_bal
(where issuetype = RECEIPT) * cur_bal
Line 7
Issuetype ‘RECEIPT’
u_price (20) is less than the previous u_price (25)
value = u_prize*cur_bal
Line 8 and 9
And for the following lines where issuetype = ISSUE.
value = u_prize*cur_bal
Does that make sense ?
I use am using CRW 8.5 / 9.
Thanks in advance, sbf-kla