EcmProducts

Purchase Orders Report


0) { $wh_status = array(); foreach ($_GET['purchase_order_status'] as $status) { $wh_status[] = "o.status ='".$status."'"; } $wh_orders[] = "(".implode(" OR ", $wh_status).")"; } if ($_GET['user']) $wh_orders[] = "o.assigned_user_id = '".$_GET['user']."'"; if ($_GET['category']) $wh_products[] = "p.product_category_id = '".$_GET['category']."'"; if ($_GET['tracking_no']) $wh_products[] = "o.tracking_no LIKE '%".$_GET['tracking_no']."%'"; } if (($_GET['order_by']) && $_GET['order_type']) $order_by=" ORDER BY ".$_GET['order_by'].' '.$_GET['order_type']; else $order_by=" ORDER BY p.name ASC"; $query = "SELECT p.name, p.product_category_name, o.date_entered, o.document_no, o.status, po.product_quantity, o.delivery_date, o.tracking_no, u.first_name, u.last_name, po.ecmpurchaseorder_id, po.ecmproduct_id, p.code, o.parent_id, o.parent_name FROM ecmproducts_ecmpurchaseorders AS po "; $query.="INNER JOIN ecmproducts AS p ON p.id=po.ecmproduct_id "; if (isset($wh_products)) $query.=" AND ".implode(" AND ", $wh_products); $query.="INNER JOIN ecmpurchaseorders AS o ON o.id=po.ecmpurchaseorder_id AND o.deleted='0' "; if (isset($wh_orders)) $query.=" AND ".implode(" AND ", $wh_orders); $query.="INNER JOIN users As u ON o.assigned_user_id=u.id"; $query.=$order_by; $post_copy = array(); $post_copy ?>
query($query); while ($r=$GLOBALS['db']->fetchByAssoc($result)) { // foreach ($r as $k => $v) echo $k.' - '; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } ?>
".$r['code']."".$r['name']."".$r['product_category_name']."".$r['parent_name']."".substr($r['date_entered'],0,10)."".$r['document_no']."".$GLOBALS['app_list_strings']['ecmpurchaseorders_status_dom'][$r['status']]."".$r['first_name'].' '.$r['last_name']."".$r['product_quantity']."".$r['delivery_date']."".$r['tracking_no']."