SELECT
The idea is to have an overall total of sales order values without exporting to Excel:
t0.cardcode,
t0.cardname,
t2.slpname as 'Sales Person',
t0.docnum as 'Sales Order',
t0.docduedate as 'Delivery Date',
t0.comments as 'Remarks',
(t0.doctotal-t0.vatsum) as 'Sales Value',
t0.totalexpns
FROM
ordr t0
inner join ocrd t1 on t0.cardcode = t1.cardcode
inner join oslp t2 on t1.slpcode = t2.slpcode
WHERE
t0.docduedate between [%1] and [%2] and
t0.docstatus = 'O'
ORDER BY
t0.cardcode
Thanks,
Robin