from
smdocuments docs
join smstorelocations loc on loc.id = docs.locationto
join smclientinfo on docs.clientindex = smclientinfo.id
join smspec spec on (docs.doctype = spec.doctype and docs.id = spec.docid)
join smcard card on (spec.article = card.article)
join sacardclass classif on (card.idclass = classif.id)
where docs.doctype = 'WI' and docs.docstate = 3 and
--- период ---
docs.createdat between date '2021-04-01' and date '2021-04-30'
--- группа ---
/*
and card.idclass in (
select Sacardclass.Id
from SACardClass, SACardClass R1
where SACardClass.ID = R1.ID
and R1.Tree like '28.%'
)
*/
--- фильтр по названию ---
and upper(card.name) like '%DURACELL%'
--- поставщик ---
and docs.clientindex = 28
group by loc.name, smclientinfo.name
order by loc.name
Так-то есть штатный отчет "Документооборот / реестр накладных". Но заказчик захотел узнать сумму прихода только по определенным товарам, в данном случае по бренду DURACELL.
Если придумаете, как задачу решить каким-либо штатным отчетом, напишите.