smusba
21st March 2011, 11:05
Dear
I want to write a script in such a way that in the input form field date there are 2 fields (date.f and date.t).
I want to get the updated cost price as on each date if the cost price is updated on that date.
For example,
If the cost price is not updated on the input dates it should display last updated cost price.
This is my script.
functions:
function read.main.table()
{
select tdsfl101.*
from tdsfl101
where tdsfl101.swar between :swar.f and :swar.t
and tdsfl101.sitm inrange :item.f and :item.t
and tdsfl101.date inrange :date.f and :date.t
order by tdsfl101._index1
selectdo
dsca = ""
select tiitm001.dsca:dsca
from tiitm001
where tiitm001._index1 = {:tdsfl101.sitm}
|and tiitm001.cuni = :tdsfl101.stun.f
selectdo
|determine.item.cost.price.data()
determine.item.cost.price.data2()
endselect
select tiitm001.*
from tiitm001
where tiitm001._index1 = {:tdsfl101.mitm}
|and tiitm001.cuni = :tdsfl101.stun.f
selectdo
|determine.item.cost.price.data()
determine.item.cost.price.data3()
endselect
rprt_send()
endselect
}
|*********************** determine item cost price data2 ************************
function determine.item.cost.price.data2()
{
select tiitm001.*
from tiitm001
where tiitm001._index1 ={:tdsfl101.sitm}
order by tiitm001._index1
selectdo
mat.1 = 0
select ticpr300.*
from ticpr300
where ticpr300._index1 = {:tdsfl101.sitm}
and ticpr300.indt < :date.t
|and ticpr300.indt >:date.f
order by ticpr300.item desc, ticpr300.cntr desc,
ticpr300.indt desc, ticpr300.cpcp desc
as set with 1 rows
selectdo
select ticpr300.*, ticpr010.*
from ticpr300, ticpr010
where ticpr300._index1 = {:tdsfl101.sitm, "", :date.t}
and ticpr300.cpcp = ticpr010.cpcp
|and ticpr300.indt < :date.t
order by ticpr300._index1
selectdo
if ticpr010.cref = ltoe(2) then
mat.1 = mat.1 + ticpr300.amnt
endif
endselect
endselect
endselect
}
|*********************** determine item cost price data3 ************************
function determine.item.cost.price.data3()
{
select tiitm001.*
from tiitm001
where tiitm001._index1 ={:tdsfl101.mitm}
order by tiitm001._index1
selectdo
mat.2 = 0
select ticpr300.*
from ticpr300
where ticpr300._index1 = {:tdsfl101.mitm}
and ticpr300.indt < :date.t
|and ticpr300.indt >:date.f
order by ticpr300.item desc, ticpr300.cntr desc,
ticpr300.indt desc, ticpr300.cpcp desc
as set with 1 rows
selectdo
select ticpr300.*, ticpr010.*
from ticpr300, ticpr010
where ticpr300._index1 = {:tdsfl101.mitm, "", :date.t}
and ticpr300.cpcp = ticpr010.cpcp
|and ticpr300.indt < :date.t
order by ticpr300._index1
as set with 1 rows
selectdo
if ticpr010.cref = ltoe(2) then
mat.2 = mat.2 + ticpr300.amnt
endif
endselect
endselect
endselect
}
Regards,
Suhaib
I want to write a script in such a way that in the input form field date there are 2 fields (date.f and date.t).
I want to get the updated cost price as on each date if the cost price is updated on that date.
For example,
If the cost price is not updated on the input dates it should display last updated cost price.
This is my script.
functions:
function read.main.table()
{
select tdsfl101.*
from tdsfl101
where tdsfl101.swar between :swar.f and :swar.t
and tdsfl101.sitm inrange :item.f and :item.t
and tdsfl101.date inrange :date.f and :date.t
order by tdsfl101._index1
selectdo
dsca = ""
select tiitm001.dsca:dsca
from tiitm001
where tiitm001._index1 = {:tdsfl101.sitm}
|and tiitm001.cuni = :tdsfl101.stun.f
selectdo
|determine.item.cost.price.data()
determine.item.cost.price.data2()
endselect
select tiitm001.*
from tiitm001
where tiitm001._index1 = {:tdsfl101.mitm}
|and tiitm001.cuni = :tdsfl101.stun.f
selectdo
|determine.item.cost.price.data()
determine.item.cost.price.data3()
endselect
rprt_send()
endselect
}
|*********************** determine item cost price data2 ************************
function determine.item.cost.price.data2()
{
select tiitm001.*
from tiitm001
where tiitm001._index1 ={:tdsfl101.sitm}
order by tiitm001._index1
selectdo
mat.1 = 0
select ticpr300.*
from ticpr300
where ticpr300._index1 = {:tdsfl101.sitm}
and ticpr300.indt < :date.t
|and ticpr300.indt >:date.f
order by ticpr300.item desc, ticpr300.cntr desc,
ticpr300.indt desc, ticpr300.cpcp desc
as set with 1 rows
selectdo
select ticpr300.*, ticpr010.*
from ticpr300, ticpr010
where ticpr300._index1 = {:tdsfl101.sitm, "", :date.t}
and ticpr300.cpcp = ticpr010.cpcp
|and ticpr300.indt < :date.t
order by ticpr300._index1
selectdo
if ticpr010.cref = ltoe(2) then
mat.1 = mat.1 + ticpr300.amnt
endif
endselect
endselect
endselect
}
|*********************** determine item cost price data3 ************************
function determine.item.cost.price.data3()
{
select tiitm001.*
from tiitm001
where tiitm001._index1 ={:tdsfl101.mitm}
order by tiitm001._index1
selectdo
mat.2 = 0
select ticpr300.*
from ticpr300
where ticpr300._index1 = {:tdsfl101.mitm}
and ticpr300.indt < :date.t
|and ticpr300.indt >:date.f
order by ticpr300.item desc, ticpr300.cntr desc,
ticpr300.indt desc, ticpr300.cpcp desc
as set with 1 rows
selectdo
select ticpr300.*, ticpr010.*
from ticpr300, ticpr010
where ticpr300._index1 = {:tdsfl101.mitm, "", :date.t}
and ticpr300.cpcp = ticpr010.cpcp
|and ticpr300.indt < :date.t
order by ticpr300._index1
as set with 1 rows
selectdo
if ticpr010.cref = ltoe(2) then
mat.2 = mat.2 + ticpr300.amnt
endif
endselect
endselect
endselect
}
Regards,
Suhaib