01d168580c1be287606910d743dc2935b31fa8aa
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) 
Bernd Wurst Copyright year update

Bernd Wurst authored 6 years ago

5) Written 2008-2018 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) 
9) To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

12) http://creativecommons.org/publicdomain/zero/1.0/
13) 
14) 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.
15) */
16) 
17) require_once('invoice.php');
18) 
19) require_role(ROLE_CUSTOMER);
20) $section = 'invoice_current';
21) 
22) title('Daten Ihres Lastschrift-Mandats');
23) 
24) $ref = $_REQUEST['ref'];
25) $mandate = get_sepamandate();
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

Bernd Wurst authored 10 years ago

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

Hanno authored 5 years ago

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

Bernd Wurst authored 10 years ago

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

Hanno authored 5 years ago

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

Bernd Wurst authored 10 years ago

35) }
36) 
37) if ($m['medium'] == 'legacy') {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

38)     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

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

Hanno authored 5 years ago

40)     $medium = 'über unser Webinterface';
41)     switch ($m['medium']) {
42)     case 'email':
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

43)       $medium = 'per E-Mail';
44)       break;
45)     case 'fax':
46)       $medium = 'per Fax';
47)       break;
48)     case 'post':
49)       $medium = 'per Post';
50)       break;
51)   }
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

52)     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

53) }
54) output('<h3>Stammdaten</h3>
55) <dl>
56) <dt>Mandatsreferenz</dt><dd>'.$m['mandatsreferenz'].'</dd>
Bernd Wurst Speichere Gläubiger-ID mit...

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

58) </dl>');
59) 
60) output('<h3>Gültigkeit</h3>');
61) 
62) $gueltigkeit = 'ab '.$m['gueltig_ab'];
Bernd Wurst Kleine Korrekturen Ausführu...

Bernd Wurst authored 10 years ago

63) if ($m['gueltig_ab'] < date('Y-m-d')) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

66) if ($m['gueltig_bis']) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

Bernd Wurst authored 10 years ago

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

Hanno authored 5 years ago

69) if ($m['gueltig_ab'] <= date('Y-m-d') && ($m['gueltig_bis'] == null || $m['gueltig_bis'] >= date('Y-m-d'))) {
70)     output('<p>Das Mandat ist momentan gültig ('.$gueltigkeit.').</p>');
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

71) } elseif ($m['gueltig_ab'] > date('Y-m-d')) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

Bernd Wurst authored 10 years ago

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

Hanno authored 5 years ago

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

Bernd Wurst authored 10 years ago

75) }
76) 
Bernd Wurst Vorgemerkte Lastschriften a...

Bernd Wurst authored 10 years ago

77) $lastschriften = get_lastschriften($m['mandatsreferenz']);
78) 
79) if (! $lastschriften) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

80)     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

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

Hanno authored 5 years ago

82)     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

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

Hanno authored 5 years ago

84)     foreach ($lastschriften as $l) {
85)         $status = '';
86)         if ($l['status'] == 'pending') {
87)             $status = '<span style="color: red; font-weight: bold;">Vorgemerkt:</span> ';
88)         }
89)         if ($l['status'] == 'rejected') {
90)             $status = '<span style="color: red; font-weight: bold;">Zurückgewiesen:</span> ';
91)         }
92)         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

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

Hanno authored 5 years ago

94)     output('</ul>');