luckaku
5th June 2008, 06:17
Dear expert,

I want to develop stock aging report base on tdinv700.

For example,
inquiry date: 2008-5-31
inventory transactions as below,
item*******in-out date******Qty
001*******10-11-2004******15
001*******30-7-2005*******-5
001*******3-2-2006********-2
001*******4-7-2006********-10
001*******12-6-2007********6
stock aging report as below,
Item*****Document Date****0-1 year****1-2 year*****2-3year*****3year<
001******12-6-2007*********6
001******30-7-2005******************************5
001******10-11-2004****************************************3

Could you give me any suggestion about how to write the script?
It's too complex for me.

mark_h
5th June 2008, 15:27
Based off your post - I really do not understand what you need. From what I can tell you are going to read each record of tdinv700 put the data in the appropriate date range and then send it to the report. That is simple. All you need to do is determine the date ranges. What are they going to be? So will the 0-1 range be todays date - 1 year or will it be the current year(1/1/2008 to 12/31/2008). So determine how you are going to get the dates. Then for each tdinv700 record compare it against the date range, put it in a report variable then send it to the report.

if tdinv700.trdt>= date1.f or tdinv700.trdt<=date1.t then |Date range 1
rpt1.qty = tdinv700.quan
endif
rprt_send()

Of course you would have to do it for each date range. I am not seeing anything complicated with what you posted.

luckaku
10th June 2008, 09:20
Dear Mark,

Thanks for your suggestion. I got the stock aging report now, please see the attached file. But the requestor need receipt date in the report.

mark_h
10th June 2008, 14:06
Define receipt date? Because I can see where you could have multiple receipts during the time frames on the report. I can see where a purchase qty of 70 during 2006 could be 7 receipts or 70 receipts depending on the order line quantity. That does not make a whole lot of sense with this report.

luckaku
17th June 2008, 03:42
Dear Mark,

I want to develop another report to only include the receipt date(tdinv700.trdt) and receipt quanity(tdinv700.quan) for current stock(tiitm001.stoc). How do I write the SQL statement?

select tiitm001.*,tdinv700.*
from tiitm001,tdinv700
where tiitm001._index1 inrange{:item.f}and {:item.t}
and {tdinv700.kost,tdinv700.koor} = {4,2}
and tdinv700.item refers to tiitm001
order by tiitm001.item
selectdo
rprt_send()
endselect

I think I need to add some variants to define the desirable receipt records. Can you help me again?