projects
/
fa-stable.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
af40aba
)
Tax included calculation problem when more than 1 tax type in a group
author
Joe Hunt
<joe.hunt.consulting@gmail.com>
Wed, 24 Feb 2010 09:34:32 +0000
(09:34 +0000)
committer
Joe Hunt
<joe.hunt.consulting@gmail.com>
Wed, 24 Feb 2010 09:34:32 +0000
(09:34 +0000)
Small layout fixes
CHANGELOG.txt
patch
|
blob
|
history
admin/backups.php
patch
|
blob
|
history
reporting/rep107.php
patch
|
blob
|
history
reporting/rep110.php
patch
|
blob
|
history
taxes/tax_calc.inc
patch
|
blob
|
history
diff --git
a/CHANGELOG.txt
b/CHANGELOG.txt
index 26b8882ab143c0714c962a4d67de13ddb2f31b1d..408d9cf82971ee51df269828169a1c2992ca4495 100644
(file)
--- a/
CHANGELOG.txt
+++ b/
CHANGELOG.txt
@@
-19,6
+19,14
@@
Legend:
! -> Note
$ -> Affected files
! -> Note
$ -> Affected files
+24-Feb-2010 Joe Hunt
+# Tax included calculation problem when more than 1 tax type in a group
+$ /taxes/tax_calc.inc
+! Small layout fixes
+$ /admin/backups.php
+ /reporting/rep107.php
+ /reporting/rep110.php
+
21-Feb-2010 Joe Hunt
# Exchange rate doesn't update table immediately when adding new rate
and no exchange rates there before.
21-Feb-2010 Joe Hunt
# Exchange rate doesn't update table immediately when adding new rate
and no exchange rates there before.
diff --git
a/admin/backups.php
b/admin/backups.php
index 4bf99a4207a82c558ee02fb332ece51e98b67b00..9f6efa55a9a41c7f51ec9d96e8743b0973184de7 100644
(file)
--- a/
admin/backups.php
+++ b/
admin/backups.php
@@
-99,7
+99,7
@@
function compress_list_row($label, $name, $value=null)
if (function_exists("gzopen"))
$ar_comps['gzip'] = "gzip";
if (function_exists("gzopen"))
$ar_comps['gzip'] = "gzip";
- echo "<tr><td>$label</td><td>";
+ echo "<tr><td
class='label'
>$label</td><td>";
echo array_selector('comp', $value, $ar_comps);
echo "</td></tr>";
}
echo array_selector('comp', $value, $ar_comps);
echo "</td></tr>";
}
diff --git
a/reporting/rep107.php
b/reporting/rep107.php
index e3bd2065207de7463d6ea976ae327143362d651c..e9df284d6d63eb519c40e410d05787ce6d925886 100644
(file)
--- a/
reporting/rep107.php
+++ b/
reporting/rep107.php
@@
-179,7
+179,7
@@
function print_invoices()
if ($tax_item['included_in_price'])
{
$rep->TextCol(3, 7, $doc_Included . " " . $tax_item['tax_type_name'] .
if ($tax_item['included_in_price'])
{
$rep->TextCol(3, 7, $doc_Included . " " . $tax_item['tax_type_name'] .
- " (" . $tax_item['rate'] . "%) " . $doc_Amount . ":" . $DisplayTax, -2);
+ " (" . $tax_item['rate'] . "%) " . $doc_Amount . ":
" . $DisplayTax, -2);
}
else
{
}
else
{
diff --git
a/reporting/rep110.php
b/reporting/rep110.php
index 3116978072c9c6c8fdb80dd29ba6ee6291423d01..9f418f7c712746a3e8b0aff0b725259638a3e5b3 100644
(file)
--- a/
reporting/rep110.php
+++ b/
reporting/rep110.php
@@
-174,7
+174,7
@@
function print_deliveries()
if ($tax_item['included_in_price'])
{
$rep->TextCol(3, 7, $doc_Included . " " . $tax_item['tax_type_name'] .
if ($tax_item['included_in_price'])
{
$rep->TextCol(3, 7, $doc_Included . " " . $tax_item['tax_type_name'] .
- " (" . $tax_item['rate'] . "%) " . $doc_Amount . ":" . $DisplayTax, -2);
+ " (" . $tax_item['rate'] . "%) " . $doc_Amount . ":
" . $DisplayTax, -2);
}
else
{
}
else
{
diff --git
a/taxes/tax_calc.inc
b/taxes/tax_calc.inc
index db98540842b321e134efa61fca56db60725c3a7c..f0be73231fcf1fb5e8d8def1ebfcb0dc545ec898 100644
(file)
--- a/
taxes/tax_calc.inc
+++ b/
taxes/tax_calc.inc
@@
-162,13
+162,10
@@
function get_tax_for_items($items, $prices, $shipping_cost, $tax_group, $tax_inc
{
$index = $item_tax['tax_type_id'];
if($tax_included==1) {// 2008-11-26 Joe Hunt Taxes are stored without roundings
{
$index = $item_tax['tax_type_id'];
if($tax_included==1) {// 2008-11-26 Joe Hunt Taxes are stored without roundings
- //$ret_tax_array[$index]['Value'] += round($prices[$i] * $item_tax['rate']
- // / ($item_tax['rate'] + 100), user_price_dec());
- $ret_tax_array[$index]['Value'] += ($prices[$i] * $item_tax['rate'] / ($item_tax['rate'] + 100));
- $ret_tax_array[$index]['Net'] += ($prices[$i] * 100 / ($item_tax['rate'] + 100));
+ $nprice = get_tax_free_price_for_item($items[$i], $prices[$i], $tax_group, $tax_included);
+ $ret_tax_array[$index]['Value'] += ($nprice * $item_tax['rate'] / 100);
+ $ret_tax_array[$index]['Net'] += $nprice;
} else {
} else {
- //$ret_tax_array[$index]['Value'] +=
- // round($prices[$i] * $item_tax['rate'] / 100, user_price_dec());
$ret_tax_array[$index]['Value'] += ($prices[$i] * $item_tax['rate'] / 100);
$ret_tax_array[$index]['Net'] += $prices[$i];
}
$ret_tax_array[$index]['Value'] += ($prices[$i] * $item_tax['rate'] / 100);
$ret_tax_array[$index]['Net'] += $prices[$i];
}
@@
-182,18
+179,26
@@
function get_tax_for_items($items, $prices, $shipping_cost, $tax_group, $tax_inc
$item_taxes = get_shipping_tax_as_array();
if ($item_taxes != null)
{
$item_taxes = get_shipping_tax_as_array();
if ($item_taxes != null)
{
+ if ($tax_included == 1)
+ {
+ $tax_rate = 0;
+ foreach ($item_taxes as $item_tax)
+ {
+ $index = $item_tax['tax_type_id'];
+ if(isset($ret_tax_array[$index])) {
+ $tax_rate += $item_tax['rate'];
+ }
+ }
+ $shipping_net = round2($shipping_cost / (1 + ($tax_rate / 100)), user_price_dec());
+ }
foreach ($item_taxes as $item_tax)
{
$index = $item_tax['tax_type_id'];
if(isset($ret_tax_array[$index])) {
if($tax_included==1) {// 2008-11-26 Joe Hunt Taxes are stored without roundings
foreach ($item_taxes as $item_tax)
{
$index = $item_tax['tax_type_id'];
if(isset($ret_tax_array[$index])) {
if($tax_included==1) {// 2008-11-26 Joe Hunt Taxes are stored without roundings
- //$ret_tax_array[$index]['Value'] += round($shipping_cost * $item_tax['rate']
- // / ($item_tax['rate'] + 100), user_price_dec());
- $ret_tax_array[$index]['Value'] += ($shipping_cost * $item_tax['rate'] / ($item_tax['rate'] + 100));
- $ret_tax_array[$index]['Net'] += ($shipping_cost * 100 / ($item_tax['rate'] + 100));
+ $ret_tax_array[$index]['Value'] += ($shipping_net * $item_tax['rate'] / 100);
+ $ret_tax_array[$index]['Net'] += $shipping_net;
} else {
} else {
- //$ret_tax_array[$index]['Value'] +=
- // round($shipping_cost * $item_tax['rate'] / 100, user_price_dec());
$ret_tax_array[$index]['Value'] += ($shipping_cost * $item_tax['rate'] / 100);
$ret_tax_array[$index]['Net'] += $shipping_cost;
}
$ret_tax_array[$index]['Value'] += ($shipping_cost * $item_tax['rate'] / 100);
$ret_tax_array[$index]['Net'] += $shipping_cost;
}