Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
i have to table two tables following:
target:
prod q1 q2 q3 q4
A 6 8 5 9
price:
prod start end price
A 1 5 100
A 6 10 200
A 11 20 300
A 21 30 400
expected o/p:
A 700 2000 1500 3500
concept:
1.for q1: 6 products then,1-5=100, 5*100=500 ,then remaining 1 is in range 6-10,1*200=200,
now q1=500+200=700
2.for q2: 8 products then,it continuous from q1 ie) 8 will be counted to q1(7-14) then 7-10=4*200=800 ,11-14=4*300=1200
now q2=800+1200=2000
3.for q3: 5 products then , it continuous to q1,q2 ie) q3(15-19) ,5*300=1500
4.for q4:9 products then, it continuous to q1,q2,q3 ie) q4(20-28),1*300=300 + 8*400=3200
now q4=3500..
we have to calculate all quarter as single not each quarter has range .
have to implement dynamically...
help needed ..
Thanks ,
Deepak Sibi