Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Tenzing
/
Tz Tools
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
f8ac0f12
authored
2011-03-17 16:14:49 +0000
by
Chris Boden
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Fixed tax bug in fix unpaid invoice tax script
1 parent
ee92c36e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
com/UserManager/views/fix_unpaid.php
com/UserManager/views/fix_unpaid.php
View file @
f8ac0f1
...
...
@@ -26,7 +26,7 @@ if (! empty($_POST['do_fix']) && $_POST['do_fix'] == 'y') {
$max
=
1000
;
for
(
$ui
=
0
;
$ui
<
$num
;
$ui
+=
$max
)
{
$users
=
$wpdb
->
get_results
(
"SELECT
ID
FROM `
{
$wpdb
->
users
}
` LIMIT
{
$ui
}
,
{
$max
}
"
);
$users
=
$wpdb
->
get_results
(
"SELECT
`ID`
FROM `
{
$wpdb
->
users
}
` LIMIT
{
$ui
}
,
{
$max
}
"
);
foreach
(
$users
as
$user
)
{
$invoices
=
get_user_meta
(
$user
->
ID
,
'invoices'
,
TRUE
);
foreach
(
$invoices
as
$invoice_id
)
{
...
...
@@ -45,16 +45,16 @@ if (! empty($_POST['do_fix']) && $_POST['do_fix'] == 'y') {
// Here's the heavy work: get the payment data and add appropriate taxes
$payment
=
get_post_meta
(
$invoice_id
,
'payment'
,
TRUE
);
$trans_amount
=
get_post_meta
(
$invoice_id
,
'trans_amount'
,
TRUE
);
$pp
=
get_user_meta
(
$user
->
ID
,
'profile_preference'
,
true
);
// Get the user's profile preference and use it to get the tax percent
if
(
!
empty
(
$user
->
profile_preference
))
{
$preference
=
strtolower
(
$
user
->
profile_preference
)
.
'_province'
;
$tax_percent
=
getTaxesByProvince
(
$user
->
$preference
)
*
.
01
;
if
(
!
empty
(
$pp
))
{
$preference
=
strtolower
(
$
pp
)
.
'_province'
;
$tax_percent
=
getTaxesByProvince
(
get_user_meta
(
$user
->
ID
,
$preference
,
true
)
)
*
.
01
;
}
else
{
$tax_percent
=
getTaxesByProvince
(
$payment
[
'bt_province'
])
*
.
01
;
}
$payment
[
'total_taxes'
]
=
$payment
[
'total_cost'
]
*
$tax_percent
;
$payment
[
'total'
]
=
number_format
(
$payment
[
'total_cost'
]
-
$payment
[
'total_discounts'
]
+
$payment
[
'total_taxes'
],
2
);
$trans_amount
=
$payment
[
'total'
];
...
...
Please
register
or
sign in
to post a comment