Hanno
codingstyle fixes
Hanno commited 2a39554 at 2019-02-28 18:01:50
<?php
require_role(ROLE_SYSADMIN);
$title = 'Report';
$year = date("Y")-1;
$typeresult = db_query("SELECT id, description, investment FROM buchhaltung.types");
$dataresult = db_query("SELECT id, date, description, invoice_id, direction, type, amount, tax_rate, gross FROM buchhaltung.transactions WHERE date BETWEEN :from and :to ORDER BY date", array(":from" => $year."-01-01", ":to" => $year."-12-31"));
$types = array();
$data_by_type = array();
$sum_by_type = array();
$investment_types = array();
while ($t = $typeresult->fetch()) {
$types[$t['id']] = $t['description'];
$data_by_type[$t['id']] = array();
$sum_by_type[$t['id']] = 0.0;
if ($t['investment'] == 1) {
$investment_types[$t['id']] = $t;
}
}
while ($line = $dataresult->fetch()) {
$data_by_type[$line['type']][] = $line;
}
output("Journal für $year (01.01.$year-31.12.$year, gruppiert nach Buchungskonten)");
DEBUG($types);
DEBUG($investment_types);
$net_by_type = array(0 => array(-1 => array(), 0 => array(), 19 => array()));
$umsatzsteuer = 0.0;
$vorsteuer = 0.0;
foreach ($types as $id => $t) {
if (count($data_by_type[$id]) == 0) {
continue;
}
output("<h3>$t</h3>");
output('<table style="font-size: 10pt;">');
$umsatz19proz = 0.0;
$umsatz0proz = 0.0;
$umsatzandereproz = 0.0;
$netsum = 0.0;
$ustsum = 0.0;
foreach ($data_by_type[$id] as $line) {
$net = $line['amount'];
if ($line['gross'] == 1 && $line['tax_rate'] > 0) {
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX