projects
/
fa-stable.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Anomaly created by Cost Update in Inventory Sales Report (rep304). Updated bugfix...
[fa-stable.git]
/
sales
/
includes
/
sales_db.inc
diff --git
a/sales/includes/sales_db.inc
b/sales/includes/sales_db.inc
index d5c0e487d2ba9a9203c9b4313bc7e92909f07bff..bdc449d83623f0d1a5973767189acbbfcacdf4d3 100644
(file)
--- 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)
{
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());
if ($avg == 0)
return 0;
return round2($avg * (1 + $add_pct / 100), user_price_dec());
@@
-200,14
+200,15
@@
function update_parent_line($doc_type, $line_id, $qty_dispatched, $auto=false)
//
function get_location(&$cart)
{
//
function get_location(&$cart)
{
- $sql = "SELECT ".TB_PREF."locations.* FROM ".TB_PREF."stock_moves,"
- .TB_PREF."locations".
+ $sql = "SELECT location.*
+ FROM ".TB_PREF."stock_moves move,"
+ .TB_PREF."locations location".
" WHERE type=".db_escape($cart->trans_type).
" AND trans_no=".key($cart->trans_no).
" AND qty!=0 ".
" WHERE type=".db_escape($cart->trans_type).
" AND trans_no=".key($cart->trans_no).
" AND qty!=0 ".
- " AND ".TB_PREF."locations.loc_code=".TB_PREF."stock_moves.loc_code";
- $result = db_query($sql, 'Retreiving inventory location');
+ " AND location.loc_code=move.loc_code";
+ $result = db_query($sql, 'Retreiving inventory location');
if (db_num_rows($result)) {
return db_fetch($result);
if (db_num_rows($result)) {
return db_fetch($result);
@@
-230,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);
} 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"]);
$cart->trans_no = get_customer_trans_version($doc_type, $trans_no);
else
$cart->trans_no = array($trans_no[0]=>$myrow["version"]);
@@
-278,7
+279,7
@@
function read_sales_trans($doc_type, $trans_no, &$cart)
@$myrow["src_id"]);
}
}
@$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
} // !newdoc
@@
-367,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
// 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);
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
return false;
$sql = "SELECT * FROM ".TB_PREF."debtor_trans