X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=purchasing%2Fincludes%2Fdb%2Fpo_db.inc;h=859deaa78cc877e551e1df868b0f992726d7443b;hb=36e8f1c2c571d4d606839f94ce1e6a88384cb44e;hp=d401f5e67ca612344195b5bea292938eb908f4d9;hpb=3cf9ab70d79ebd01b13b6cc0c9366ccb5b8c496a;p=fa-stable.git diff --git a/purchasing/includes/db/po_db.inc b/purchasing/includes/db/po_db.inc index d401f5e6..859deaa7 100644 --- a/purchasing/includes/db/po_db.inc +++ b/purchasing/includes/db/po_db.inc @@ -29,14 +29,17 @@ function add_po(&$po_obj) begin_transaction(); /*Insert to purchase order header record */ - $sql = "INSERT INTO ".TB_PREF."purch_orders (supplier_id, Comments, ord_date, reference, requisition_no, into_stock_location, delivery_address) VALUES("; + $sql = "INSERT INTO ".TB_PREF."purch_orders (supplier_id, Comments, ord_date, reference, + requisition_no, into_stock_location, delivery_address, total, tax_included) VALUES("; $sql .= db_escape($po_obj->supplier_id) . "," . db_escape($po_obj->Comments) . ",'" . date2sql($po_obj->orig_order_date) . "', " . db_escape($po_obj->reference) . ", " . db_escape($po_obj->supp_ref) . ", " . db_escape($po_obj->Location) . ", " . - db_escape($po_obj->delivery_address) . ")"; + db_escape($po_obj->delivery_address) . ", " . + db_escape($po_obj->get_trans_total()). ", " . + db_escape($po_obj->tax_included) . ")"; db_query($sql, "The purchase order header record could not be inserted"); @@ -77,7 +80,9 @@ function update_po(&$po_obj) requisition_no= ". db_escape( $po_obj->supp_ref). ", into_stock_location=" . db_escape($po_obj->Location). ", ord_date='" . date2sql($po_obj->orig_order_date) . "', - delivery_address=" . db_escape($po_obj->delivery_address); + delivery_address=" . db_escape($po_obj->delivery_address).", + total=". db_escape($po_obj->get_trans_total()).", + tax_included=". db_escape($po_obj->tax_included); $sql .= " WHERE order_no = " . $po_obj->order_no; db_query($sql, "The purchase order could not be updated"); @@ -113,7 +118,7 @@ function update_po(&$po_obj) function read_po_header($order_no, &$order) { - $sql = "SELECT ".TB_PREF."purch_orders.*, ".TB_PREF."suppliers.supp_name, + $sql = "SELECT ".TB_PREF."purch_orders.*, ".TB_PREF."suppliers.supp_name, ".TB_PREF."suppliers.tax_group_id, ".TB_PREF."suppliers.curr_code, ".TB_PREF."locations.location_name FROM ".TB_PREF."purch_orders, ".TB_PREF."suppliers, ".TB_PREF."locations WHERE ".TB_PREF."purch_orders.supplier_id = ".TB_PREF."suppliers.supplier_id @@ -128,9 +133,11 @@ function read_po_header($order_no, &$order) $myrow = db_fetch($result); $order->order_no = $order_no; - $order->supplier_id = $myrow["supplier_id"]; - $order->supplier_name = $myrow["supp_name"]; - $order->curr_code = $myrow["curr_code"]; + + $order->set_supplier($myrow["supplier_id"], $myrow["supp_name"], $myrow["curr_code"], + $myrow['tax_group_id'], $myrow["tax_included"]); + + $order->credit = get_current_supp_credit($order->supplier_id); $order->orig_order_date = sql2date($myrow["ord_date"]); $order->Comments = $myrow["comments"];