smusba
25th May 2009, 08:47
Dear,
I have written a script for price change for an item.
For ex: The fish cost $10 from 5/1/2009-5/5/2009
The cost varies to $9 from 5/6/2009-5/12/2009.
I want to get my previous Price history in my report . My script is.
field.dwar.f:
when.field.changes:
dwar.t = dwar.f
field.indt.f:
when.field.changes:
indt.t = indt.f
|****************************** function section ******************************
functions:
function read.main.table()
{
amntc = 0.0
amntp = 0.0
price = 0.0
select tdsfl015.*
from tdsfl015
where tdsfl015.shop between :dwar.f and :dwar.t
and tdsfl015.indt between :indt.f and :indt.t
selectdo
|amntp = find.prev()
price = find.prev.spric()
rprt_send()
endselect
}
function double find.prev.spric()
{
extern domain tcorno cou
extern domain tcpric pric
pric = 0.0
cou = 0.0
indtc = 0.0
select tdsls032.*
from tdsls032
where tdsls032.item = :tdsfl015.fish
and tdsls032.stdt < :indt.f
order by tdsls032.stdt desc
selectdo
if cou = 1 then
else
indtc = tdsls032.stdt
pric= tdsls032.pric
cou = cou + 1
endif
endselect
|message("Cost%d",amntp)
return(pric)
}
I have written a script for price change for an item.
For ex: The fish cost $10 from 5/1/2009-5/5/2009
The cost varies to $9 from 5/6/2009-5/12/2009.
I want to get my previous Price history in my report . My script is.
field.dwar.f:
when.field.changes:
dwar.t = dwar.f
field.indt.f:
when.field.changes:
indt.t = indt.f
|****************************** function section ******************************
functions:
function read.main.table()
{
amntc = 0.0
amntp = 0.0
price = 0.0
select tdsfl015.*
from tdsfl015
where tdsfl015.shop between :dwar.f and :dwar.t
and tdsfl015.indt between :indt.f and :indt.t
selectdo
|amntp = find.prev()
price = find.prev.spric()
rprt_send()
endselect
}
function double find.prev.spric()
{
extern domain tcorno cou
extern domain tcpric pric
pric = 0.0
cou = 0.0
indtc = 0.0
select tdsls032.*
from tdsls032
where tdsls032.item = :tdsfl015.fish
and tdsls032.stdt < :indt.f
order by tdsls032.stdt desc
selectdo
if cou = 1 then
else
indtc = tdsls032.stdt
pric= tdsls032.pric
cou = cou + 1
endif
endselect
|message("Cost%d",amntp)
return(pric)
}