Paged transaction inquiries optimized for maximum links in Sales and Purchasing.
[fa-stable.git] / purchasing / includes / db / po_db.inc
index 0afbe1626292c98bac2236a586afdabf2948e650..a904c2ff4b396cf47135975c05b31b6362a7dd61 100644 (file)
@@ -294,6 +294,8 @@ function get_sql_for_po_search_completed($from, $to, $supplier_id=ALL_TEXT, $loc
                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