7ae33deebfbf80fde9235c3cea37c80930fe1f77
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) }
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 Fix coding style with php-c...

Hanno authored 5 years 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>
53) <dt>Mandatsreferenz</dt><dd>'.$m['mandatsreferenz'].'</dd>
Bernd Wurst Speichere Gläubiger-ID mit...

Bernd Wurst authored 10 years ago

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) 
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 Fix coding style with php-c...

Hanno authored 5 years 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 Fix coding style with php-c...

Hanno authored 5 years 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'))) {
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 Fix coding style with php-c...

Hanno authored 5 years 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 Fix coding style with php-c...

Hanno authored 5 years 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) 
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)         }
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>');