aboutsummaryrefslogtreecommitdiffstats
path: root/en
diff options
context:
space:
mode:
authorfilip <filip.komar@gmail.com>2015-03-12 17:27:35 +0100
committerfilip <filip.komar@gmail.com>2015-03-12 17:27:35 +0100
commit02395dfe2b2c567f87296e0f0bef54d51f3a4bc9 (patch)
treeed03aa8dada9ece21682b6c7dca400f355e83048 /en
parent9fa962b34585726f63f1e9271dd888dbd5b17460 (diff)
downloadwww-02395dfe2b2c567f87296e0f0bef54d51f3a4bc9.tar
www-02395dfe2b2c567f87296e0f0bef54d51f3a4bc9.tar.gz
www-02395dfe2b2c567f87296e0f0bef54d51f3a4bc9.tar.bz2
www-02395dfe2b2c567f87296e0f0bef54d51f3a4bc9.tar.xz
www-02395dfe2b2c567f87296e0f0bef54d51f3a4bc9.zip
fix rounding errors + better init + var # fix
Diffstat (limited to 'en')
-rw-r--r--en/about/reports/template_lib.php22
1 files changed, 14 insertions, 8 deletions
diff --git a/en/about/reports/template_lib.php b/en/about/reports/template_lib.php
index 419ff103c..12282650c 100644
--- a/en/about/reports/template_lib.php
+++ b/en/about/reports/template_lib.php
@@ -11,9 +11,9 @@ function get_expenses($v)
$html .= sprintf('<thead><tr><th>%s</th><th>%s</th><th>%s</th><th class="money">%s</th></tr></thead><tbody>',
$line[0], $line[1],
- $line[2], $line[3],
+ $line[2], $line[3]/*,
$line[4],
- $line[5]);
+ $line[5]*/);
foreach ($v as $line) {
if (count($line) < 2)
@@ -25,6 +25,12 @@ function get_expenses($v)
_report_number_format($line[3]));
$cat = explode(':', $line[1]);
+ if(!isset($sums[$cat[0]])) {
+ $sums[$cat[0]] = 0;
+ }
+ if(!isset($sums['total'])) {
+ $sums['total'] = 0;
+ }
$sums[$cat[0]] += $line[3];
$sums['total'] += $line[3];
}
@@ -114,12 +120,12 @@ function get_revenues($v, $_months)
$line[1] > 0 ? _report_number_format($line[2] / $line[1]) : ''
);
- $sums['count'] += $line[1];
- $sums['total'] += $line[2];
- $sums['check'] += $line[3];
- $sums['xfer'] += $line[4];
- $sums['paypal'] += $line[5];
- $sums['cash'] += $line[6];
+ $sums['count'] += floatval(str_replace(',', '.', $line[1]));
+ $sums['total'] += floatval(str_replace(',', '.', $line[2]));
+ $sums['check'] += floatval(str_replace(',', '.', $line[3]));
+ $sums['xfer'] += floatval(str_replace(',', '.', $line[4]));
+ $sums['paypal'] += floatval(str_replace(',', '.', $line[5]));
+ $sums['cash'] += floatval(str_replace(',', '.', $line[6]));
}
$html .= '</tbody><tfoot>';
$html .= sprintf('<tr><th>Total</th>