517159f09fb7e48e91c49cbc51f97085f2991446
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 Lizenzinfos in eigenes Modu...

Bernd Wurst authored 10 years ago

5) Written 2008-2014 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) 
11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
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();
26) $m = NULL;
27) 
28) foreach ($mandate as $man) {
29)   if ($man['mandatsreferenz'] == $ref) {
30)     $m = $man;
31)   }
32) }
33) if (! $m) {
34)   system_failure('Konnte das Mandat nicht finden.');
35) }
36) 
37) if ($m['medium'] == 'legacy') {
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>');
39) } else {
40)   $medium = 'über unser Webinterface';
41)   switch ($m['medium']) {
42)     case 'email': 
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)   }
52)   output('<p>Wir haben das nachstehende Mandat am '.$m['erteilt'].' '.$medium.' entgegen genommen.</p>');
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')) {
64)   $gueltigkeit = 'seit '.$m['gueltig_ab'];
65) }
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

66) if ($m['gueltig_bis']) {
67)   $gueltigkeit = 'von '.$m['gueltig_ab'].' bis '.$m['gueltig_bis'];
68) }
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>');
71) } elseif ($m['gueltig_ab'] > date('Y-m-d')) {
72)   output('<p>Das Mandat ist noch nicht gültig ('.$gueltigkeit.').</p>');
73) } else {
74)   output('<p>Das Mandat ist erloschen ('.$gueltigkeit.').</p>');
75) }
76) 
Bernd Wurst Vorgemerkte Lastschriften a...

Bernd Wurst authored 10 years ago

77) $lastschriften = get_lastschriften($m['mandatsreferenz']);
78) 
79) if (! $lastschriften) {
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 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 {
82)   output('<p>Dieses Mandat wurde bisher für folgende Abbuchungen in Anspruch genommen:</p>
83) <ul>');
84)   foreach ($lastschriften as $l) {
85)     $status = '';
Bernd Wurst Zeige Rechnungen zu rückgeb...

Bernd Wurst authored 9 years ago

86)     if ($l['status'] == 'pending') {
Bernd Wurst Vorgemerkte Lastschriften a...

Bernd Wurst authored 10 years ago

87)       $status = '<span style="color: red; font-weight: bold;">Vorgemerkt:</span> ';
88)     }
Bernd Wurst Zeige Rechnungen zu rückgeb...

Bernd Wurst authored 9 years ago

89)     if ($l['status'] == 'rejected') {
90)       $status = '<span style="color: red; font-weight: bold;">Zurückgewiesen:</span> ';
91)     }
Bernd Wurst Vorgemerkte Lastschriften a...

Bernd Wurst authored 10 years ago

92)     output('<li>'.$status.'Rechnung #'.$l['rechnungsnummer'].' vom '.$l['rechnungsdatum'].' über <strong>'.str_replace('.', ',', sprintf('%.2f', $l['betrag'])).' €</strong>, Buchungsdatum '.$l['buchungsdatum'].'</li>');
93)   }
94)   output('</ul>');