select
supermag.smdocuments.createdat as dated,
supermag.smdocuments.totalsum as summ,
supermag.smstorelocations.name as mh,
supermag.smclientinfo.name as k_ag,
supermag.smwaybillsin.id as id,
supermag.smwaybillsin.debt as debt,
supermag.smdocuments.createdat+supermag.smwaybillsin.paymentdelay as DateO
from
supermag.ssdoctypes,supermag.smdocuments,supermag.smwaybillsin,
supermag.smclientinfo,supermag.smstorelocations,supermag.saoperation
where
(supermag.smdocuments.createdat =:DateD and supermag.smdocuments.doctype='WI' and
supermag.saoperation.accountflag=0 and supermag.saoperation.incometype=1 and
supermag.saoperation.expensetype=0 and supermag.smdocuments.docstate>=3 and
debt>0)
and
((supermag.smdocuments.doctype=supermag.ssdoctypes.doctype)and
(supermag.smwaybillsin.id=supermag.smdocuments.id and supermag.smwaybillsin.doctype=supermag.smdocuments.doctype)
and (supermag.smdocuments.clientindex=supermag.smclientinfo.id)and
(supermag.smdocuments.locationto=supermag.smstorelocations.id)and
(supermag.ssdoctypes.opcode=supermag.saoperation.id))
DateD - Name параметра, Type- Date, Value - DateEdit1.Date