X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=purchasing%2Fincludes%2Fdb%2Fpo_db.inc;h=a904c2ff4b396cf47135975c05b31b6362a7dd61;hb=b2a9c105e368f6e4fdb35477665edeff13fb574b;hp=b0709ee21f4d9af1be4a9528a1abd559ea017ee5;hpb=f11b39846d81bd043490ba9596224b859e47467c;p=fa-stable.git diff --git a/purchasing/includes/db/po_db.inc b/purchasing/includes/db/po_db.inc index b0709ee2..a904c2ff 100644 --- a/purchasing/includes/db/po_db.inc +++ b/purchasing/includes/db/po_db.inc @@ -13,9 +13,8 @@ function get_supplier_details_to_order(&$order, $supplier_id) { - $sql = "SELECT curr_code, supp_name, tax_group_id, supp.tax_included, - supp.credit_limit - Sum(IFNULL(IF(trans.type=".ST_SUPPCREDIT.", -1, 1) - * (ov_amount + ov_gst + ov_discount),0)) as cur_credit, + $sql = "SELECT curr_code, supp_name, tax_group_id, supp.tax_included, dimension_id, dimension2_id, + supp.credit_limit - Sum((ov_amount + ov_gst + ov_discount)) as cur_credit, terms.terms, terms.days_before_due, terms.day_in_following_month FROM ".TB_PREF."suppliers supp LEFT JOIN ".TB_PREF."supp_trans trans ON supp.supplier_id = trans.supplier_id @@ -36,6 +35,8 @@ function get_supplier_details_to_order(&$order, $supplier_id) $_POST['supplier_id'] = $supplier_id; $_POST['supplier_name'] = $myrow["supp_name"]; $_POST['curr_code'] = $myrow["curr_code"]; + $_POST['dimension'] = $myrow["dimension_id"]; + $_POST['dimension2'] = $myrow["dimension2_id"]; $order->set_supplier($supplier_id, $myrow["supp_name"], $myrow["curr_code"], $myrow["tax_group_id"], $myrow["tax_included"]); @@ -185,7 +186,7 @@ function read_po_header($order_no, &$order) $order->credit = get_current_supp_credit($order->supplier_id); $order->orig_order_date = sql2date($myrow["ord_date"]); - $order->Comments = nl2br($myrow["comments"]); + $order->Comments = $myrow["comments"]; $order->Location = $myrow["into_stock_location"]; $order->supp_ref = $myrow["requisition_no"]; $order->reference = $myrow["reference"]; @@ -293,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