Please note that correct qty should come based upon first unique GRPONO and its total qty.
As per your question that why InvNo 333 having correct qty is 5?
the answer is that:-
Please look the GRPONo 555, its bring sales data = on and after 03/02/2010.
Hence Invoice would be
200
300
400
333
And note that invoice no 200 is already we have adjusted in GRPONo 500, but we have adjusted only 10 qty against GRPONO 500, GRPOtotal qty 25.
Hence remaining 15 qty is pending for Invoice no which is has been used for Inv no 555 and its tot qty=100
So actaul sales data qty would be now:-
200 15
300 35
400 45
333
Please note that we GRPOTotQty never be less then INVQty, hence correct qty would never b negative.When we add 15+35+45=95, so remaining 5 only we need to adjust agaist GRPO 555.
so 100 - (15+35+45) = 5, so 5 we need to put for Inv 333.
So now Invno 333 correct qty should be 5 and reamining its 10 qty would be adjusted against other GRPONo for same item after this GRPO.
I think this would me now more helpful.
If u see mine sample data output at second post at sqlteam, you get an why its required.
Abhit_kumar
0 Points
53 Posts
Re: Problem in sql logic
Mar 10, 2010 05:41 AM|LINK
Hello Kpyap,
Thanks for replying me back.
Please note that correct qty should come based upon first unique GRPONO and its total qty.
As per your question that why InvNo 333 having correct qty is 5?
the answer is that:-
Please look the GRPONo 555, its bring sales data = on and after 03/02/2010.
Hence Invoice would be
200
300
400
333
And note that invoice no 200 is already we have adjusted in GRPONo 500, but we have adjusted only 10 qty against GRPONO 500, GRPOtotal qty 25.
Hence remaining 15 qty is pending for Invoice no which is has been used for Inv no 555 and its tot qty=100
So actaul sales data qty would be now:-
200 15
300 35
400 45
333
Please note that we GRPOTotQty never be less then INVQty, hence correct qty would never b negative.When we add 15+35+45=95, so remaining 5 only we need to adjust agaist GRPO 555.
so 100 - (15+35+45) = 5, so 5 we need to put for Inv 333.
So now Invno 333 correct qty should be 5 and reamining its 10 qty would be adjusted against other GRPONo for same item after this GRPO.
I think this would me now more helpful.
If u see mine sample data output at second post at sqlteam, you get an why its required.
Thanks,
Abhi