" where l.status = 1 and l.client_id = $client_id and l.invoice_id is null".
" and l.group_id = $group_id and l.org_id = $org_id".
" and l.date >= ".$mdb2->quote($start)." and l.date <= ".$mdb2->quote($end).
- " and l.billable = 1"; // l.billable * u.rate * time_to_sec(l.duration)/3600 > 0"; // See explanation below.
+ " and l.duration > 0 and l.billable = 1"; // l.billable * u.rate * time_to_sec(l.duration)/3600 > 0"; // See explanation below.
} else {
// sql part for project id.
if ($project_id) $project_part = " and l.project_id = $project_id";
" where l.status = 1 and l.client_id = $client_id $project_part and l.invoice_id is null".
" and l.group_id = $group_id and l.org_id = $org_id".
" and l.date >= ".$mdb2->quote($start)." and l.date <= ".$mdb2->quote($end).
- " and l.billable = 1"; // l.billable * upb.rate * time_to_sec(l.duration)/3600 > 0";
+ " and l.duration > 0 and l.billable = 1"; // l.billable * upb.rate * time_to_sec(l.duration)/3600 > 0";
// Users with a lot of clients and projects (Jaro) may forget to set user rates properly.
// Specifically, user rate may be set to 0 on a project, by mistake. This leads to error.no_invoiceable_items
// and increased support cost. Commenting out allows us to include 0 cost items in invoices so that
global $user;
global $i18n;
+ $currency = $user->getCurrency();
+ $decimalMark = $user->getDecimalMark();
+
$invoice = ttInvoiceHelper::getInvoice($invoice_id);
$client = ttClientHelper::getClient($invoice['client_id'], true);
$invoice_items = ttInvoiceHelper::getInvoiceItems($invoice_id);
}
$total = $subtotal + $tax;
- $subtotal = htmlspecialchars($user->currency).' '.str_replace('.', $user->decimal_mark, sprintf('%8.2f', round($subtotal, 2)));
- if ($tax) $tax = htmlspecialchars($user->currency).' '.str_replace('.', $user->decimal_mark, sprintf('%8.2f', round($tax, 2)));
- $total = htmlspecialchars($user->currency).' '.str_replace('.', $user->decimal_mark, sprintf('%8.2f', round($total, 2)));
+ $subtotal = htmlspecialchars($currency).' '.str_replace('.', $decimalMark, sprintf('%8.2f', round($subtotal, 2)));
+ if ($tax) $tax = htmlspecialchars($currency).' '.str_replace('.', $decimalMark, sprintf('%8.2f', round($tax, 2)));
+ $total = htmlspecialchars($currency).' '.str_replace('.', $decimalMark, sprintf('%8.2f', round($total, 2)));
- if ('.' != $user->decimal_mark) {
+ if ('.' != $decimalMark) {
foreach ($invoice_items as &$item) {
- $item['cost'] = str_replace('.', $user->decimal_mark, $item['cost']);
+ $item['cost'] = str_replace('.', $decimalMark, $item['cost']);
}
unset($item); // Unset the reference. If we don't, the foreach loop below modifies the array while printing.
// See http://stackoverflow.com/questions/8220399/php-foreach-pass-by-reference-last-element-duplicating-bug