e21f00ce44d9b7ff1e1df44d162ceefe2ff2b64b
bernd Kunden können Ihre Rechnung...

bernd authored 16 years ago

1) <?php
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 1 year ago

5) Written by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 1 year ago

9) This code is published under a 0BSD license.
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

10) 
11) Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
12) */
bernd Kunden können Ihre Rechnung...

bernd authored 16 years ago

13) 
14) require_once('session/start.php');
Bernd Wurst Neues Layout der Rechnungs-...

Bernd Wurst authored 9 years ago

15) require_once('inc/icons.php');
bernd Kunden können Ihre Rechnung...

bernd authored 16 years ago

16) 
17) require_once('invoice.php');
18) 
19) require_role(ROLE_CUSTOMER);
20) 
bernd Benutze überall title() sta...

bernd authored 13 years ago

21) title('Rechnungen');
bernd Kunden können Ihre Rechnung...

bernd authored 16 years ago

22) 
Bernd Wurst Zeige zunächst nur unbezahl...

Bernd Wurst authored 11 years ago

23) $show_paid = (isset($_GET['paid']) && $_GET['paid'] == '1');
24) 
bernd Kunden können Ihre Rechnung...

bernd authored 16 years ago

25) $invoices = my_invoices();
26) 
Bernd Wurst Neues Layout der Rechnungs-...

Bernd Wurst authored 9 years ago

27) $first = true;
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 2 years ago

28) $invoices_to_show = [];
Bernd Wurst Zeige zunächst nur unbezahl...

Bernd Wurst authored 11 years ago

29) foreach ($invoices as $i) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

30)     if ($first || $show_paid || $i['bezahlt'] == 0) {
31)         $first = false;
32)         array_push($invoices_to_show, $i);
33)     }
Bernd Wurst Zeige zunächst nur unbezahl...

Bernd Wurst authored 11 years ago

34) }
35) 
36) if (count($invoices_to_show) == 0) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

37)     $error = 'Keine aktuelle Rechnung gefunden.';
38)     if (count($invoices) == 0) {
39)         $error = 'Bisher keine Rechnungen vorhanden.';
40)     }
41)     if ($show_paid) {
42)     }
43) 
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

44)     output('<p><em>' . $error . '</em></p>');
Bernd Wurst Zeige zunächst nur unbezahl...

Bernd Wurst authored 11 years ago

45) } else {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

46)     if ($show_paid) {
47)         output('<p>Hier können Sie Ihre bisherigen Rechnungen einsehen und herunterladen.</p>');
Bernd Wurst Vorgemerkte Lastschriften a...

Bernd Wurst authored 10 years ago

48)     } else {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

49)         output('<p>Hier sehen Sie Ihre neueste Rechnung. Ältere, bereits bezahlte Rechnungen können sie über den untenstehenden Link einblenden.</p>');
50)     }
51)     output('<table class="nogrid"><tr><th>Nr.</th><th>Datum</th><th>Gesamtbetrag</th><th>bezahlt?</th><th>Herunterladen</th></tr>');
52) 
53)     $odd = true;
54)     foreach ($invoices_to_show as $invoice) {
55)         $bezahlt = 'Nein';
56)         $class = 'unpaid';
57)         if ($invoice['bezahlt'] == 1) {
58)             $bezahlt = 'Ja';
59)             $class = 'paid';
60)         } else {
61)             $l = get_lastschrift($invoice['id']);
62)             if ($l) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

63)                 $bezahlt = 'Wird abgebucht<br/>am ' . $l['buchungsdatum'];
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

64)                 $class = 'paid';
65)                 if ($l['status'] == 'rejected') {
Hanno Böck Remove some unneeded whites...

Hanno Böck authored 5 months ago

66)                     $bezahlt = 'Abbuchung zurückgewiesen';
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

67)                     $class = 'unpaid';
68)                 }
69)             }
Bernd Wurst Zeige Rechnungen zu rückgeb...

Bernd Wurst authored 9 years ago

70)         }
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

71)         $odd = !$odd;
72)         $class .= ($odd ? " odd" : " even");
Hanno Böck more HTML fixes

Hanno Böck authored 3 months ago

73)         output("<tr class=\"{$class}\"><td class=\"number\">" . internal_link("html", $invoice['id'], "id={$invoice['id']}") . "</td><td>{$invoice['datum']}</td><td class=\"number\">{$invoice['betrag']} €</td><td>{$bezahlt}</td><td>" . internal_link("pdf", "<img src=\"{$prefix}images/pdf.png\" width=\"22\" height=\"22\" alt=\"PDF\">", "id={$invoice['id']}") . "</td></tr>\n");
Bernd Wurst Offene Rechnungen fablich h...

Bernd Wurst authored 11 years ago

74)     }
Bernd Wurst Zeige zunächst nur unbezahl...

Bernd Wurst authored 11 years ago

75) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

76)     output('</table>');
bernd Kunden können Ihre Rechnung...

bernd authored 16 years ago

77) }
78) 
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 6 months ago

79) if (!$show_paid) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

80)     $number = count($invoices) - count($invoices_to_show);
81)     if ($number > 0) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

82)         output('<p>' . internal_link('', other_icon('control_fastforward.png') . " Zeige $number ältere Rechnungen", 'paid=1') . '</p>');
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

83)     }
Bernd Wurst Zeige zunächst nur unbezahl...

Bernd Wurst authored 11 years ago

84) }
bernd Rechnungen unterhalb von "Ü...

bernd authored 14 years ago

85) 
bernd Kunden können Ihre Rechnung...

bernd authored 16 years ago

86) 
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

87) output('<h3>Bezahlung per Lastschrift</h3>');
88) 
89) output('<p>Gerne buchen wir Ihre Beiträge von Ihrem Konto ab. Bei Lastschriftzahlung werden Sie durch Zustellung einer Rechnung informiert, die Abbuchung erfolgt dann eine Woche später.</p>');
90) 
91) $mandate = get_sepamandate();
92) if ($mandate) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

93)     output('<p>Folgende Mandate sind bisher erteilt worden (momentan gültiges Mandat ist Fett dargestellt):</p>
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

94) <table>
Hanno Böck more HTML fixes

Hanno Böck authored 3 months ago

95) <tr><th>Mandatsreferenz</th><th>IBAN</th><th>Gültigkeit</th></tr>
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

96) ');
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

97)     foreach ($mandate as $m) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

98)         $gueltig = 'ab ' . $m['gueltig_ab'];
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

99)         if ($m['gueltig_ab'] < date('Y-m-d')) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

100)             $gueltig = 'seit ' . $m['gueltig_ab'];
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

101)         }
102)         if ($m['gueltig_bis']) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

103)             $gueltig = $m['gueltig_ab'] . ' - ' . $m['gueltig_bis'];
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

104)         }
105)         $aktiv = false;
106)         if ($m['gueltig_ab'] <= date('Y-m-d') && ($m['gueltig_bis'] == null || $m['gueltig_bis'] >= date('Y-m-d'))) {
107)             $aktiv = true;
108)         }
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

109)         output('<tr><td' . ($aktiv ? ' style="font-weight: bold;"' : '') . '>' . internal_link('sepamandat_detail', $m['mandatsreferenz'], 'ref=' . $m['mandatsreferenz']) . '</td><td>' . $m['iban'] . '</td><td>' . $gueltig . '</td></tr>');
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

110)     }
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

111)     output('</table>');
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

112) }
113) 
114) 
Bernd Wurst Typo / Schönheitskorrektur

Bernd Wurst authored 10 years ago

115) if ($mandate) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

116)     addnew('sepamandat', 'Hat sich Ihre Bankverbindung geändert? Erteilen Sie uns ein neues Lastschrift-Mandat');
Bernd Wurst Typo / Schönheitskorrektur

Bernd Wurst authored 10 years ago

117) } else {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

118)     addnew('sepamandat', 'Erteilen Sie uns ein Lastschrift-Mandat');
Bernd Wurst Typo / Schönheitskorrektur

Bernd Wurst authored 10 years ago

119) }
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

120) 
121) output('<p>Sie können Ihr Mandat jederzeit widerrufen. Senden Sie uns dazu bitte eine entsprechende E-Mail.</p>');
122) 
123) 
bernd Kunden können Ihre Rechnung...

bernd authored 16 years ago

124) 
Bernd Wurst changed caption of invoice...

Bernd Wurst authored 4 years ago

125) output("<h3>Rechnungs-Vorschau</h3>");
Bernd Wurst Neues Layout der Rechnungs-...

Bernd Wurst authored 9 years ago

126) output('<p>Hier sehen Sie einen Überblick über Posten die in den nächsten 3 Monaten fällig werden.</p>');
127) 
128) 
129) output('<p style="margin: 1em; padding: 1em; border: 2px solid red; background: white;"><strong>Hinweis:</strong> Die hier aufgeführten Posten dienen nur Ihrer Information und erheben keinen Anspruch auf Vollständigkeit. Aus technischen Gründen sind manche Posten hier nicht aufgeführt, die dennoch berechnet werden. Zudem können, bedingt durch Rundungsfehler, die Beträge auf dieser Seite falsch dargestellt sein. Wiederkehrende Beträge werden grundsätzlich nur für den nächsten Abrechnungszeitraum angezeigt.</p>');
130) 
131) $items = upcoming_items();
132) $summe = 0;
133) 
134) $flip = true;
135) $today = date('Y-m-d');
136) $max_date = date('Y-m-d', strtotime('+3 months'));
137) output('<table><tr><th>Anzahl</th><th>Beschreibung</th><th>Zeitraum</th><th>Einzelpreis</th><th>Gesamtbetrag</th></tr>');
138) 
139) $counter = 0;
140) 
141) $more = false;
142) $odd = false;
143) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

144) foreach ($items as $item) {
145)     if ($item['startdatum'] > $max_date) {
146)         $more = true;
147)         break;
148)     }
149)     if ($flip && $item['startdatum'] > $today) {
150)         if ($counter == 0) {
151)             output("<tr class=\"even\"><td colspan=\"5\"><em>Aktuell keine fälligen Posten</em></td></tr>");
152)         }
153)         $flip = false;
154)         $odd = false;
155)         output("<tr class=\"even\"><td colspan=\"4\" style=\"text-align: right; font-weight: bold; border: none;\">Summe bisher fällige Posten:</td>");
156)         output("<td class=\"number\" style=\"font-weight: bold;\">{$summe} €</td></tr>\n");
157)         output("<tr><td colspan=\"5\" style=\"border: none;\"> </td></tr>\n");
158)     }
159)     $counter++;
160)     $desc = $item['startdatum'];
161)     if ($item['enddatum'] != null) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

162)         $desc = $item['startdatum'] . ' - ' . $item['enddatum'];
Bernd Wurst Neues Layout der Rechnungs-...

Bernd Wurst authored 9 years ago

163)     }
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

164)     $epreis = $item['betrag'];
165)     if ($item['brutto'] == 0) {
166)         $epreis = $epreis * (1 + ($item['mwst'] / 100));
167)     }
168)     $gesamt = round($epreis * $item['anzahl'], 2);
169)     $epreis = round($epreis, 2);
170)     $summe += $gesamt;
171)     $einheit = ($item['einheit'] ? $item['einheit'] : '');
172)     $class = ($odd ? "odd" : "even");
173)     $odd = !$odd;
174)     output("<tr class=\"$class\"><td class=\"number\">{$item['anzahl']} {$einheit}</td>");
175)     output("<td>{$item['beschreibung']}</td><td>{$desc}</td>");
176)     output("<td class=\"number\">{$epreis} €</td><td class=\"number\">{$gesamt} €</td></tr>\n");
Bernd Wurst Neues Layout der Rechnungs-...

Bernd Wurst authored 9 years ago

177) }
178) 
179) if ($counter) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

180)     output("<tr class=\"even\"><td colspan=\"4\" style=\"text-align: right; font-weight: bold; border: none;\">Summe aller Posten:</td>");
181)     output("<td style=\"font-weight: bold;\" class=\"number\">{$summe} €</td></tr>\n");
182)     output('</table>');
Bernd Wurst Neues Layout der Rechnungs-...

Bernd Wurst authored 9 years ago

183) } else {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

184)     output("<tr class=\"even\"><td colspan=\"5\"><em>Es sind keine Posten hinterlegt, die in den nächsten 3 Monaten fällig werden.</em></td></tr></table>");
Bernd Wurst Neues Layout der Rechnungs-...

Bernd Wurst authored 9 years ago

185) }
186) 
187) if ($more) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

188)     output('<p>' . internal_link('upcoming', other_icon('control_fastforward.png') . ' Alle zukünftigen Rechnungsposten anzeigen') . '</p>');