From 9ce6d646ff718cd62f6434c9a4c94e450436612a Mon Sep 17 00:00:00 2001 From: Thomas Backlund Date: Sun, 12 Oct 2014 12:27:45 +0300 Subject: Revert "Updated Estonian translation" This reverts commit a0b2d09125d7911656fe4cb286f20643c4432281. --- en/about/reports/template_lib.php | 169 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 en/about/reports/template_lib.php (limited to 'en/about/reports/template_lib.php') diff --git a/en/about/reports/template_lib.php b/en/about/reports/template_lib.php new file mode 100644 index 000000000..419ff103c --- /dev/null +++ b/en/about/reports/template_lib.php @@ -0,0 +1,169 @@ +'; + $html .= ''; + + $line = array_shift($v); + $sums = array(); + + $html .= sprintf('', + $line[0], $line[1], + $line[2], $line[3], + $line[4], + $line[5]); + + foreach ($v as $line) { + if (count($line) < 2) + continue; + + $html .= sprintf('', + date('Y-M-d', strtotime($line[0])), $line[1], + $line[2], + _report_number_format($line[3])); + + $cat = explode(':', $line[1]); + $sums[$cat[0]] += $line[3]; + $sums['total'] += $line[3]; + } + + $html .= ' + + + + +
%s%s%s%s
%s%s%s%s
Total:' . _report_number_format($sums['total']) . '
'; + + unset($sums['total']); + arsort($sums); + foreach ($sums as $k => $v) + $sums[$k] = "['{$k}', $v]"; + + $values = implode(', ', $sums); + $html .= << + google.setOnLoadCallback(drawChartExpenses); + function drawChartExpenses() { + var data = new google.visualization.DataTable(); + data.addColumn('string', 'Source'); + data.addColumn('number', 'Amount'); + data.addRows([{$values}]); + var options = {'title':'Expenses by category', + 'width':400, + 'height':300}; + + var chart = new google.visualization.PieChart(document.getElementById('expenses-cats-pie')); + chart.draw(data, options); + } + +H; + + return array('html' => $html); +} + +/** + * @param string $v + * + * @return array('html' => string, 'data' => mixed) +*/ +function get_revenues($v, $_months) +{ + $html = '
'; + $html .= ''; + + $line = array_shift($v); + $html .= sprintf(' + + ', + $line[0], $line[1], $line[2], + $line[3], + $line[4], + $line[5], $line[6]); + + $html .= ''; + + $sums = array( + 'count' => 0, + 'total' => 0, + 'check' => 0, + 'xfer' => 0, + 'paypal' => 0, + 'cash' => 0 + ); + + foreach ($v as $line) { + if (count($line) < 2) + continue; + + $html .= sprintf(' + + + + + + ', + $_months[$line[0]], + $line[1], + _report_number_format($line[2]), + _report_number_format($line[3]), + _report_number_format($line[4]), + _report_number_format($line[5]), + _report_number_format($line[6]), + $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]; + } + $html .= ''; + $html .= sprintf(' + + + + + + + ', + $sums['count'], + _report_number_format($sums['total']), + _report_number_format($sums['check']), + _report_number_format($sums['xfer']), + _report_number_format($sums['paypal']), + _report_number_format($sums['cash']), + $sums['count'] > 0 ? _report_number_format($sums['total'] / $sums['count']) : '' + ); + $total_revenues = $sums['total']; + $html .= '
%s%s%s%s%s%s%saverage
%s%s%s%s%s%s%s%s
Total%s%s%s%s%s%s%s
'; + + $html .= << + google.setOnLoadCallback(drawChart); + function drawChart() { + var data = new google.visualization.DataTable(); + data.addColumn('string', 'Source'); + data.addColumn('number', 'Amount'); + data.addRows([ + ['Paypal', {$sums['paypal']}], + ['Bank transfer', {$sums['xfer']}], + ['Check', {$sums['check']}], + ['Cash', {$sums['cash']}], + ]); + + var options = {'title':'Donations by source', + 'width':400, + 'height':300}; + + var chart = new google.visualization.PieChart(document.getElementById('income-pie')); + chart.draw(data, options); + } + +S; + + return array('html' => $html, 'data' => array('total' => $total_revenues)); +} \ No newline at end of file -- cgit v1.2.1