projects
/
fa-stable.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Mark Inactive Customers and Suppliers in Reports (when no Filter).
[fa-stable.git]
/
includes
/
ui
/
items_cart.inc
diff --git
a/includes/ui/items_cart.inc
b/includes/ui/items_cart.inc
index 7a19d23508e508c4d4e857b9d948461312848ab9..f5b1940d317dc9842ad8e36337c4bf3b63a27b5e 100644
(file)
--- a/
includes/ui/items_cart.inc
+++ b/
includes/ui/items_cart.inc
@@
-40,7
+40,7
@@
class items_cart
var $fixed_asset;
var $fixed_asset;
- function
items_car
t($type, $trans_no=0)
+ function
__construc
t($type, $trans_no=0)
{
$this->trans_type = $type;
$this->order_id = $trans_no;
{
$this->trans_type = $type;
$this->order_id = $trans_no;
@@
-101,7
+101,7
@@
class items_cart
$low_stock = array();
$low_stock = array();
- if (!$SysPrefs->allow_negative_stock()
|| is_fixed_asset($line_item->mb_flag)
)
+ if (!$SysPrefs->allow_negative_stock())
{
foreach ($this->line_items as $line_no => $line_item)
if (has_stock_holding($line_item->mb_flag) || is_fixed_asset($line_item->mb_flag))
{
foreach ($this->line_items as $line_no => $line_item)
if (has_stock_holding($line_item->mb_flag) || is_fixed_asset($line_item->mb_flag))
@@
-144,8
+144,8
@@
class items_cart
$this->gl_items[$index]->code_id = $code_id;
$this->gl_items[$index]->person_id = $person_id;
$this->gl_items[$index]->code_id = $code_id;
$this->gl_items[$index]->person_id = $person_id;
-
$gl_type = is_subledger_account($code_id, $person
_id);
-
if (
$gl_type)
+
$gl_type = is_subledger_account($code
_id);
+
if ($person_id != null &&
$gl_type)
{
$this->gl_items[$index]->person_type_id = $gl_type > 0 ? PT_CUSTOMER : PT_SUPPLIER;
$data = get_subaccount_data($code_id, $person_id);
{
$this->gl_items[$index]->person_type_id = $gl_type > 0 ? PT_CUSTOMER : PT_SUPPLIER;
$data = get_subaccount_data($code_id, $person_id);
@@
-224,7
+224,7
@@
class items_cart
{
foreach ($this->gl_items as $gl_item)
{
{
foreach ($this->gl_items as $gl_item)
{
- if (
$gl_item->person_id
)
+ if (
is_subledger_account($gl_item->code_id)
)
return true;
}
return false;
return true;
}
return false;
@@
-263,7
+263,7
@@
class items_cart
foreach($this->gl_items as $gl)
{
foreach($this->gl_items as $gl)
{
-
if ($person_type = is_subledger_account($gl->code_id, $gl->person
_id))
+
if ($person_type = is_subledger_account($gl->code
_id))
{
$tax_info['person_type'] = $person_type < 0 ? PT_SUPPLIER : PT_CUSTOMER;
$tax_info['person_id'] = $gl->person_id;
{
$tax_info['person_type'] = $person_type < 0 ? PT_SUPPLIER : PT_CUSTOMER;
$tax_info['person_id'] = $gl->person_id;
@@
-280,7
+280,7
@@
class items_cart
} elseif ($tax_id = is_tax_account($gl->code_id))
{
$tax_type = get_tax_type($tax_id);
} elseif ($tax_id = is_tax_account($gl->code_id))
{
$tax_type = get_tax_type($tax_id);
- if ($gl->code_id == $tax_type['purchasing_gl_code']) {
+ if ($gl->code_id == $tax_type['purchasing_gl_code']
&& $gl->amount > 0
) {
if (!isset($tax_info['tax_in'][$tax_id]))
$tax_info['tax_in'][$tax_id] = 0;
$tax_info['tax_in'][$tax_id] += $gl->amount;
if (!isset($tax_info['tax_in'][$tax_id]))
$tax_info['tax_in'][$tax_id] = 0;
$tax_info['tax_in'][$tax_id] += $gl->amount;
@@
-299,7
+299,7
@@
class items_cart
// we can have both input and output tax postings in some cases like intra-EU trade.
// so just calculate net_amount from the higher in/out tax
$tax_info['net_amount'][$tax_id]
// we can have both input and output tax postings in some cases like intra-EU trade.
// so just calculate net_amount from the higher in/out tax
$tax_info['net_amount'][$tax_id]
- = $sign*round2(max(abs(@$tax_info['tax_in'][$tax_id]), abs(@$tax_info['tax_out'][$tax_id]))/$tax_type['rate']*100,
2
)/$factor;
+ = $sign*round2(max(abs(@$tax_info['tax_in'][$tax_id]), abs(@$tax_info['tax_out'][$tax_id]))/$tax_type['rate']*100,
user_price_dec()
)/$factor;
}
} else
}
} else
@@
-309,7
+309,7
@@
class items_cart
if (!isset($tax_info['tax_reg']) && isset($tax_info['person_type']))
$tax_info['tax_reg'] = $tax_info['person_type']==PT_CUSTOMER ? TR_OUTPUT : TR_INPUT;
if (!isset($tax_info['tax_reg']) && isset($tax_info['person_type']))
$tax_info['tax_reg'] = $tax_info['person_type']==PT_CUSTOMER ? TR_OUTPUT : TR_INPUT;
- if (count
(@$tax_info['net_amount']))
// guess exempt sales/purchase if any tax has been found
+ if (count
_array(@$tax_info['net_amount']))
// guess exempt sales/purchase if any tax has been found
{
$ex_net = abs($net_sum) - @array_sum($tax_info['net_amount']);
if ($ex_net != 0)
{
$ex_net = abs($net_sum) - @array_sum($tax_info['net_amount']);
if ($ex_net != 0)
@@
-465,7
+465,7
@@
class line_item
var $price;
var $standard_cost;
var $price;
var $standard_cost;
- function
line_item
($stock_id, $qty, $standard_cost=null, $description=null)
+ function
__construct
($stock_id, $qty, $standard_cost=null, $description=null)
{
$item_row = get_item($stock_id);
{
$item_row = get_item($stock_id);
@@
-509,7
+509,7
@@
class gl_item
var $branch_id;
var $date;
var $branch_id;
var $date;
- function
gl_item
($code_id=null, $dimension_id=0, $dimension2_id=0, $amount=0, $memo='',
+ function
__construct
($code_id=null, $dimension_id=0, $dimension2_id=0, $amount=0, $memo='',
$act_descr=null, $person_id=null, $date=null)
{
//echo "adding $index, $code_id, $dimension_id, $amount, $reference<br>";
$act_descr=null, $person_id=null, $date=null)
{
//echo "adding $index, $code_id, $dimension_id, $amount, $reference<br>";
@@
-521,8
+521,8
@@
class gl_item
$this->code_id = $code_id;
$this->person_id = $person_id;
$this->code_id = $code_id;
$this->person_id = $person_id;
-
$gl_type = is_subledger_account($code_id, $person
_id);
-
if (
$gl_type)
+
$gl_type = is_subledger_account($code
_id);
+
if ($person_id != null &&
$gl_type)
{
$this->person_type_id = $gl_type > 0 ? PT_CUSTOMER : PT_SUPPLIER;
$data = get_subaccount_data($code_id, $person_id);
{
$this->person_type_id = $gl_type > 0 ? PT_CUSTOMER : PT_SUPPLIER;
$data = get_subaccount_data($code_id, $person_id);
@@
-531,7
+531,7
@@
class gl_item
}
$this->dimension_id = $dimension_id;
$this->dimension2_id = $dimension2_id;
}
$this->dimension_id = $dimension_id;
$this->dimension2_id = $dimension2_id;
- $this->amount = round
($amount, 2
);
+ $this->amount = round
2($amount, user_price_dec()
);
$this->reference = $memo;
$this->date = $date;
}
$this->reference = $memo;
$this->date = $date;
}