К сожалению руководство не расположено к вложению дополнительных средств в ТУС! Можно ли как нибудь в этой версии что нибудь придумать или если не сложно дать формулу которая отвечает за контрагент и сумовой остаток и реализацию! У меня есть запрос в SQL котроый выглядит сл. образом: Реализация по поставщикам в сумме закупочных и розничных цен.
Цитата: SELECT --s.name MAG,
postn.rnn RNN,
postn.pstn Postname,
ROUND(SUM(real.Quantity * NVL(pr.price, postn.cpr))) SummZak,
ROUND(SUM(real.realsum)) SummRoz
FROM --smstorelocations s,
(
select SP.Article Article,
inf.INN rnn,
CT.LOCATIONID loc,
replace(inf.name, '*', '') pstn,
MAX(sp.itemprice) cpr
from SMSpec SP,
SMContractPacks CP,
SVSupplyCaseCO C,
SMContractLocations CT,
SMClientInfo INF
where SP.DocType = 'CO' and
SP.DocID = C.ID and
CP.DocType = SP.DocType and
CP.DocID = SP.DocID and
CP.SpecItem = SP.SpecItem and
C.ClientIndex = inf.id and
SP.DocID = CT.ID and
-- replace(inf.name, '*', '') = 'INTER ПИВО ТОО' and
inf.name <> 'METI'
and CT.LOCATIONID IN (select l.id
from smstorelocations l,
sastoreclass sc
where l.idclass = sc.id and
l.id > 1 and l.accepted = 1 and
SUBSTR(sc.tree,1,1) in ('6','8'))
group by SP.Article,
inf.INN,
CT.LOCATIONID,
replace(inf.name, '*', '')
) postn,
(select storeloc,
article,
SUM(realqty) Quantity,
SUM(realsum) realsum
from svareal r
where createdat >= TO_DATE('06.08.2010', 'DD.MM.YYYY') and
createdat <= TO_DATE('15.08.2010', 'DD.MM.YYYY')
and storeloc in (select l.id
from smstorelocations l,
sastoreclass sc
where l.idclass = sc.id and
l.id > 1 and l.accepted = 1 and
SUBSTR(sc.tree,1,1) in ('6','8'))
GROUP BY storeloc,
article
order by storeloc,
article
) real,
(
select distinct storeloc locate,
article artic,
MAX(price) keep (dense_rank first
order by eventtime desc) price
from smpricehistory
where pricetype = 1 and
trunc(eventtime) <= TO_DATE('15.08.2010', 'DD.MM.YYYY')
and storeloc in (select l.id
from smstorelocations l,
sastoreclass sc
where l.idclass = sc.id and
l.id > 1 and l.accepted = 1 and
SUBSTR(sc.tree,1,1) in ('6','8'))
group by storeloc,
article
order by storeloc,
article
) pr
where postn.article = real.article and
postn.loc = real.storeloc AND
-- real.storeloc = s.id and
real.storeloc = pr.locate(+) and
real.article = pr.artic(+) and
real.Quantity is not Null --and
and real.storeloc in (select l.id
from smstorelocations l,
sastoreclass sc
where l.idclass = sc.id and
l.id > 1 and l.accepted = 1 and
SUBSTR(sc.tree,1,1) in ('6','8'))
group by --s.name,
postn.rnn,
postn.pstn
order by postn.pstn