Browse code

Umsatzsteuer besser aufschluesseln

Bernd Wurst authored on29/04/2019 09:57:28
Showing1 changed files
... ...
@@ -37,6 +37,7 @@ DEBUG($types);
37 37
 DEBUG($investment_types);
38 38
 $net_by_type = array(0 => array(-1 => array(), 0 => array(), 19 => array()));
39 39
 $umsatzsteuer = 0.0;
40
+$ustbetraege = array();
40 41
 $vorsteuer = 0.0;
41 42
 foreach ($types as $id => $t) {
42 43
     if (count($data_by_type[$id]) == 0) {
... ...
@@ -68,6 +69,10 @@ foreach ($types as $id => $t) {
68 69
         $netsum += $net;
69 70
         $ustsum += $ust;
70 71
         if ($id == 0) {
72
+            if (!isset($ustbetraege[$line['tax_rate']])) {
73
+                $ustbetraege[$line['tax_rate']] = 0;
74
+            }
75
+            $ustbetraege[$line['tax_rate']] += $ust;
71 76
             $umsatzsteuer += $ust;
72 77
         } else {
73 78
             $vorsteuer += $ust;
... ...
@@ -76,7 +81,7 @@ foreach ($types as $id => $t) {
76 81
         $net = str_replace('.', ',', sprintf('%.2f €', $net));
77 82
         $ust = str_replace('.', ',', sprintf('%.2f €', $ust));
78 83
         $gross = str_replace('.', ',', sprintf('%.2f €', $gross));
79
-        output("<tr><td>".$line['date']."</td><td>".$line['description']."</td><td style=\"text-align: right;\">".$net."</td><td style=\"text-align: right;\">".$ust."</td><td style=\"text-align: right;\">".$gross."</td></tr>\n");
84
+        output("<tr><td>".$line['date']."</td><td>".$line['description']."</td><td style=\"text-align: right;\">".$net."</td><td style=\"text-align: right;\">".$line['tax_rate']."%</td><td style=\"text-align: right;\">".$ust."</td><td style=\"text-align: right;\">".$gross."</td></tr>\n");
80 85
     }
81 86
     if ($id == 0) {
82 87
         $net_by_type[0][-1] = $umsatzandereproz;
... ...
@@ -87,7 +92,7 @@ foreach ($types as $id => $t) {
87 92
     }
88 93
     $netsum = str_replace('.', ',', sprintf('%.2f €', $netsum));
89 94
     $ustsum = str_replace('.', ',', sprintf('%.2f €', $ustsum));
90
-    output("<tr><td colspan=\"2\" style=\"font-weight: bold;text-align: right;\">Summe $t:</td><td style=\"font-weight: bold;text-align: right;\">$netsum</td><td style=\"font-weight: bold;text-align: right;\">$ustsum</td><td></td></tr>\n");
95
+    output("<tr><td colspan=\"2\" style=\"font-weight: bold;text-align: right;\">Summe $t:</td><td style=\"font-weight: bold;text-align: right;\">$netsum</td><td></td><td style=\"font-weight: bold;text-align: right;\">$ustsum</td><td></td></tr>\n");
91 96
     output('</table>');
92 97
 }
93 98
 
... ...
@@ -97,12 +102,20 @@ output('<table>');
97 102
 $einnahmensumme = 0.0;
98 103
 output("<tr><td>Einnahmen 19% USt netto</td><td style=\"text-align: right;\">".number_format($net_by_type[0][19], 2, ',', '.')." €</td></tr>");
99 104
 $einnahmensumme += $net_by_type[0][19];
105
+output("<tr><td>Einnahme Umsatzsteuer 19%</td><td style=\"text-align: right;\">".number_format($ustbetraege[19], 2, ',', '.')." €</td></tr>");
106
+$einnahmensumme += $ustbetraege[19];
100 107
 output("<tr><td>Einnahmen innergem. Lieferung (steuerfrei §4/1b UStG)</td><td style=\"text-align: right;\">".number_format($net_by_type[0][0], 2, ',', '.')." €</td></tr>");
101 108
 $einnahmensumme += $net_by_type[0][0];
102 109
 output("<tr><td>Einnahmen EU-Ausland (VATMOSS)</td><td style=\"text-align: right;\">".number_format($net_by_type[0][-1], 2, ',', '.')." €</td></tr>");
103 110
 $einnahmensumme += $net_by_type[0][-1];
104
-output("<tr><td>Einnahme Umsatzsteuer</td><td style=\"text-align: right;\">".number_format($umsatzsteuer, 2, ',', '.')." €</td></tr>");
105
-$einnahmensumme += $umsatzsteuer;
111
+$einzelust = '';
112
+foreach ($ustbetraege as $satz => $ust) {
113
+    if ($satz == 0 || $satz == 19) {
114
+        continue;
115
+    }
116
+    output("<tr><td>- Umsatzsteuer $satz%</td><td style=\"text-align: right;\">".number_format($ust, 2, ',', '.')." €</td></tr>");
117
+    $einnahmensumme += $ust;
118
+}
106 119
 
107 120
 output("<tr><td><b>Summe Einnahmen:</b></td><td style=\"text-align: right;\"><b>".number_format($einnahmensumme, 2, ',', '.')." €</td></tr>");
108 121
 output("<tr><td colspan=\"2\"></td></tr>");