nawelk
19th October 2005, 14:38
Hi Friends,
I'm developing a report to get a breakdown of cost of sales using tdsls051 and ticpr300 tables.
I can't get details of more than one cost component per item .
this is the code which i wrote.
I would greatly appreciate if one of you experts can advice me on how to correct this.
function get.cost.values()
{
select max(ticpr300.indt):max.date
from ticpr300
where ticpr300._index1 inrange {:item.f} and {:item.t}
and ticpr300.item = :tdsls051.item
and ticpr300.cntr = :tdsls051.cntr
and ticpr300.indt between :trdt.f and :trdt.t
selectdo
read.cost.price()
endselect
}
function read.cost.price()
{
comp = " "
amnt = 0.00
select ticpr300.cpcp, ticpr300.amnt
from ticpr300
where ticpr300._index1 inrange {:item.f} and {:item.t}
and ticpr300.item = :tdsls051.item
and ticpr300.cntr = :tdsls051.cntr
and ticpr300.indt = :max.date
as set with 1 rows
selectdo
comp = ticpr300.cpcp
amnt = ticpr300.amnt
selectempty
comp = " "
amnt = 0.00
endselect
}
Thanks in advance
I'm developing a report to get a breakdown of cost of sales using tdsls051 and ticpr300 tables.
I can't get details of more than one cost component per item .
this is the code which i wrote.
I would greatly appreciate if one of you experts can advice me on how to correct this.
function get.cost.values()
{
select max(ticpr300.indt):max.date
from ticpr300
where ticpr300._index1 inrange {:item.f} and {:item.t}
and ticpr300.item = :tdsls051.item
and ticpr300.cntr = :tdsls051.cntr
and ticpr300.indt between :trdt.f and :trdt.t
selectdo
read.cost.price()
endselect
}
function read.cost.price()
{
comp = " "
amnt = 0.00
select ticpr300.cpcp, ticpr300.amnt
from ticpr300
where ticpr300._index1 inrange {:item.f} and {:item.t}
and ticpr300.item = :tdsls051.item
and ticpr300.cntr = :tdsls051.cntr
and ticpr300.indt = :max.date
as set with 1 rows
selectdo
comp = ticpr300.cpcp
amnt = ticpr300.amnt
selectempty
comp = " "
amnt = 0.00
endselect
}
Thanks in advance