porder.ord_date,
supplier.curr_code,
Sum(line.unit_price*line.quantity_ordered) AS OrderValue,
+ Sum(line.delivery_date < '". date2sql(Today()) ."'
+ AND (line.quantity_ordered > line.quantity_received)) As OverDue,
porder.into_stock_location,
chk.isopen
FROM ".TB_PREF."purch_orders as porder