354c05a4ddd678c49bcbba458bffa7d13482139a
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

1) <?php
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 Erste Version des SEPA-Mand...

Bernd Wurst authored 10 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 Erste Version des SEPA-Mand...

Bernd Wurst authored 10 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) */
13) 
14) require_once('invoice.php');
15) 
16) require_role(ROLE_CUSTOMER);
17) $section = 'invoice_current';
18) 
19) title('Daten Ihres Lastschrift-Mandats');
20) 
21) $ref = $_REQUEST['ref'];
22) $mandate = get_sepamandate();
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

23) $m = null;
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

24) 
25) foreach ($mandate as $man) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

26)     if ($man['mandatsreferenz'] == $ref) {
27)         $m = $man;
28)     }
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

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

Hanno Böck authored 6 months ago

30) if (!$m) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

31)     system_failure('Konnte das Mandat nicht finden.');
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

32) }
33) 
34) if ($m['medium'] == 'legacy') {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

35)     output('<p>Sie hatten uns vor längerer Zeit eine Einzugsermächtigung ausgesprochen. Wir haben diese selbstständig in das nachstehende SEPA-Mandat überführt.</p>');
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

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

Hanno authored 5 years ago

37)     $medium = 'über unser Webinterface';
38)     switch ($m['medium']) {
Hanno Böck more strict codingstyle wit...

Hanno Böck authored 1 year ago

39)         case 'email':
40)             $medium = 'per E-Mail';
41)             break;
42)         case 'fax':
43)             $medium = 'per Fax';
44)             break;
45)         case 'post':
46)             $medium = 'per Post';
47)             break;
48)     }
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

49)     output('<p>Wir haben das nachstehende Mandat am ' . $m['erteilt'] . ' ' . $medium . ' entgegen genommen.</p>');
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

50) }
51) output('<h3>Stammdaten</h3>
52) <dl>
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

53) <dt>Mandatsreferenz</dt><dd>' . $m['mandatsreferenz'] . '</dd>
54) <dt>Unsere Gläubiger-ID<dt><dd>' . $m['glaeubiger_id'] . '</dd>
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

55) </dl>');
56) 
57) output('<h3>Gültigkeit</h3>');
58) 
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

59) $gueltigkeit = 'ab ' . $m['gueltig_ab'];
Bernd Wurst Kleine Korrekturen Ausführu...

Bernd Wurst authored 10 years ago

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

Hanno Böck authored 6 months ago

61)     $gueltigkeit = 'seit ' . $m['gueltig_ab'];
Bernd Wurst Kleine Korrekturen Ausführu...

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

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

Hanno Böck authored 6 months ago

64)     $gueltigkeit = 'von ' . $m['gueltig_ab'] . ' bis ' . $m['gueltig_bis'];
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

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

Hanno authored 5 years ago

66) if ($m['gueltig_ab'] <= date('Y-m-d') && ($m['gueltig_bis'] == null || $m['gueltig_bis'] >= date('Y-m-d'))) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

67)     output('<p>Das Mandat ist momentan gültig (' . $gueltigkeit . ').</p>');
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

68) } elseif ($m['gueltig_ab'] > date('Y-m-d')) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

69)     output('<p>Das Mandat ist noch nicht gültig (' . $gueltigkeit . ').</p>');
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

70) } else {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

71)     output('<p>Das Mandat ist erloschen (' . $gueltigkeit . ').</p>');
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

72) }
73) 
Bernd Wurst Vorgemerkte Lastschriften a...

Bernd Wurst authored 10 years ago

74) $lastschriften = get_lastschriften($m['mandatsreferenz']);
75) 
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 6 months ago

76) if (!$lastschriften) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

77)     output('<p>Es wurden bisher keine Abbuchungen mit Bezug auf dieses Mandat durchgeführt.</p>');
Bernd Wurst Vorgemerkte Lastschriften a...

Bernd Wurst authored 10 years ago

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

Hanno authored 5 years ago

79)     output('<p>Dieses Mandat wurde bisher für folgende Abbuchungen in Anspruch genommen:</p>
Bernd Wurst Vorgemerkte Lastschriften a...

Bernd Wurst authored 10 years ago

80) <ul>');
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

81)     foreach ($lastschriften as $l) {
82)         $status = '';
83)         if ($l['status'] == 'pending') {
84)             $status = '<span style="color: red; font-weight: bold;">Vorgemerkt:</span> ';
85)         }
86)         if ($l['status'] == 'rejected') {
87)             $status = '<span style="color: red; font-weight: bold;">Zurückgewiesen:</span> ';
88)         }
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

89)         output('<li>' . $status . 'Rechnung #' . $l['rechnungsnummer'] . ' vom ' . $l['rechnungsdatum'] . ' über <strong>' . str_replace('.', ',', sprintf('%.2f', $l['betrag'])) . ' €</strong>, Buchungsdatum ' . $l['buchungsdatum'] . '</li>');
Bernd Wurst Zeige Rechnungen zu rückgeb...

Bernd Wurst authored 9 years ago

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

Hanno authored 5 years ago

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

Bernd Wurst authored 10 years ago

92) }
93) 
94) 
95) output('<h3>Kontodaten</h3>
96) <dl>
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

97) <dt>Kontoinhaber</dt><dd>' . $m['kontoinhaber'] . '</dd>
98) <dt>Adresse des Kontoinhabers</dt><dd>' . nl2br($m['adresse']) . '</dd>
99) <dt>IBAN</dt><dd>' . $m['iban'] . '</dd>
100) <dt>Name der Bank</dt><dd>' . $m['bankname'] . '</dd>
101) <dt>BIC</dt><dd>' . $m['bic'] . '</dd>
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

102) </dl>');
103) 
104)