X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fincludes%2Fsales_db.inc;h=bdc449d83623f0d1a5973767189acbbfcacdf4d3;hb=c82cbc67f22454e4afd30e53c40043b54a732be3;hp=949ee79e2f404b5d47b2c19348704eefc174a9d6;hpb=772bf0b1831da4239fd643c3608a57f9e59d345c;p=fa-stable.git diff --git a/sales/includes/sales_db.inc b/sales/includes/sales_db.inc index 949ee79e..bdc449d8 100644 --- a/sales/includes/sales_db.inc +++ b/sales/includes/sales_db.inc @@ -47,7 +47,7 @@ function add_gl_trans_customer($type, $type_no, $date_, $account, $dimension, $d function get_calculated_price($stock_id, $add_pct) { - $avg = get_standard_cost($stock_id); + $avg = get_unit_cost($stock_id); if ($avg == 0) return 0; return round2($avg * (1 + $add_pct / 100), user_price_dec()); @@ -231,7 +231,7 @@ function read_sales_trans($doc_type, $trans_no, &$cart) } else { // read header data from first document $myrow = get_customer_trans($trans_no[0],$doc_type); - if (count($trans_no)>1) + if (count_array($trans_no)>1) $cart->trans_no = get_customer_trans_version($doc_type, $trans_no); else $cart->trans_no = array($trans_no[0]=>$myrow["version"]); @@ -279,7 +279,7 @@ function read_sales_trans($doc_type, $trans_no, &$cart) @$myrow["src_id"]); } } - $cart->prepayments = get_payments_for($trans_no, $doc_type); + $cart->prepayments = get_payments_for($trans_no, $doc_type, $myrow["debtor_no"]); } // !newdoc @@ -368,10 +368,10 @@ function get_sales_child_documents($trans_type, $trans_no) // FIXME - credit notes retrieved here should be those linked to invoices containing // at least one line from related invoice - if (!count($trans_no)) + if (!count_array($trans_no)) return false; $childs = get_sales_child_numbers($trans_type, $trans_no, false); - if (!count($childs)) + if (!count_array($childs)) return false; $sql = "SELECT * FROM ".TB_PREF."debtor_trans