X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fincludes%2Fsales_db.inc;h=4f98c78fc6ab5df0774ae38db8edd43026f9c213;hb=b41f81ed2c825462ec293ff11521320606bdeb8e;hp=75fca059a1d98575c5077451b45ecbb0819e112c;hpb=921b0e7df6265ed280080b7810105fa4d93d9aa6;p=fa-stable.git diff --git a/sales/includes/sales_db.inc b/sales/includes/sales_db.inc index 75fca059..4f98c78f 100644 --- a/sales/includes/sales_db.inc +++ b/sales/includes/sales_db.inc @@ -6,6 +6,8 @@ include_once($path_to_root . "/sales/includes/db/sales_order_db.inc"); include_once($path_to_root . "/sales/includes/db/sales_credit_db.inc"); include_once($path_to_root . "/sales/includes/db/sales_invoice_db.inc"); include_once($path_to_root . "/sales/includes/db/sales_delivery_db.inc"); +include_once($path_to_root . "/sales/includes/db/sales_types_db.inc"); +include_once($path_to_root . "/sales/includes/db/sales_points_db.inc"); include_once($path_to_root . "/sales/includes/db/custalloc_db.inc"); include_once($path_to_root . "/sales/includes/db/cust_trans_db.inc"); include_once($path_to_root . "/sales/includes/db/cust_trans_details_db.inc"); @@ -46,10 +48,16 @@ function add_gl_trans_customer($type, $type_no, $date_, $account, $dimension, $d //---------------------------------------------------------------------------------------- -function get_price ($stock_id, $currency, $sales_type_id, $factor, $date=null) +function get_price ($stock_id, $currency, $sales_type_id, $factor=null, $date=null) { if ($date == null) $date = Today(); + + if ($factor === null) + { + $myrow = get_sales_type($sales_type_id); + $factor = $myrow['factor']; + } $sql = "SELECT ".TB_PREF."prices.price FROM ".TB_PREF."prices @@ -118,7 +126,7 @@ function set_document_parent($cart) if (count($cart->src_docs) == 1) { // if this child document has only one parent - update child link - $del_no = key($cart->src_docs); + $del_no = reset(array_keys($cart->src_docs)); $sql = 'UPDATE '.TB_PREF.'debtor_trans SET trans_link = ' . $del_no . ' WHERE type='.$cart->trans_type.' AND trans_no='. $inv_no ; @@ -162,7 +170,7 @@ function update_parent_line($doc_type, $line_id, $qty_dispatched) { $doc_type = get_parent_type($doc_type); - //echo "update line: $line_id, $doc_type, $qty_dispatch"; +// echo "update line: $line_id, $doc_type, $qty_dispatched"; if ($doc_type==0) return false; else {