Redusing Balace

sunil

New Member
Dear All,
I hav a problem like this Say I got a order 1000 of qty for a One Item.Very first time I Invoiced from that 500 of qty Secand time I Invoiced 200 and finaly I Invoiced 100 So How can I get the redusing balance of this Item.

Eg:

Item Ordereed Qty Inv Qty Reducing Balance Qty
1 Bucket 1000 500 500
2 200 300
3 100 200

Pls Help me ASAP and I much Appriciate any body solve This Problem

Thank You.
 

Ach

Member
You did not say what fields/data structure you have available in your Invoice transaction/history file. Assuming you have Invoice Date, Qty Ordered (not sure) Qty Invoiced, here is what you could do.

Name of your Invoice line table = Inv-hist (assumed).

Def var MQty-Ordered as integer format "->>,>>9".
Def var MQty-Balance as integer format "->>,>>9".

Form
Inv-Hist.Inv-No
Inv-Hist.Item-no
MQty-Ordered
Inv-Hist.Qty-Invoiced
MQty-Balance
with ......

For each inv-hist no-lock where [blah blah blah]
break by Inv-no by Inv-Date:

If first-of(Inv-Hist.Inv-No) then do:
MQty-Ordered = Inv-Hist.Qty-Ord.
MQty-Balance = MQty-Ordered -
Inv-Hist.Qty-Invoiced.
(If there is no Qty-Ordered here then go find it in the Order Detail file and take it in the variable).


display Inv-Hist.Inv-No
Inv-Hist.Item-No
MQty-Ordered
Inv-Hist.Qty-Invoiced
MQty-Balance skip
with frame ...... .
End.

Mqty-Balance = MQty-Balance - Inv-Hist.Qty-Invoiced.
display Inv-Hist.Qty-Invoiced Mqty-Balance skip with frame ....


End.

This might cause performance issues becuase it is breaking by Inv-No which would be too much but you can replace that depending on your requirements.
 
Top