d7a9e6b18cd9f6fe4eba6a7dfc50f6700ade7017
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) 
5) Written 2008-2013 by schokokeks.org Hosting, namely
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) 
Bernd Wurst Zeige gleich an, ob eine (d...

Bernd Wurst authored 10 years ago

17) require_once('inc/icons.php');
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

18) require_once('invoice.php');
19) 
20) require_role(ROLE_CUSTOMER);
21) $section = 'invoice_current';
22) 
Bernd Wurst Vervollständige Bankname un...

Bernd Wurst authored 10 years ago

23) $path = config('jquery_ui_path');
24) 
25) html_header('
26) <link rel="stylesheet" href="'.$path.'/themes/base/jquery-ui.css" />
27) <script type="text/javascript" src="'.$path.'/jquery-1.9.0.js" ></script>
28) <script type="text/javascript" src="'.$path.'/ui/jquery-ui.js" ></script>
29) 
30) ');
31) 
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

32) title('Erteilung eines Mandats zur SEPA-Basis-Lastschrift');
33) 
34) output('<p>Ich ermächtige die Firma schokokeks.org GbR, Zahlungen von meinem Konto mittels Lastschrift
35) einzuziehen. Zugleich weise ich mein Kreditinstitut an, die von der Firma schokokeks.org GbR auf mein
36) Konto gezogenen Lastschriften einzulösen.</p>
37) <p>Hinweis: Ich kann innerhalb von acht Wochen, beginnend mit dem Belastungsdatum, die Erstattung des
Bernd Wurst Typo / Schönheitskorrektur

Bernd Wurst authored 10 years ago

38) belasteten Betrages verlangen. Es gelten dabei die mit meinem Kreditinstitut vereinbarten Bedingungen.
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

39) Insbesondere fallen bei Zurückweisung einer gerechtfertigten Abbuchung i.d.R. Gebühren an.</p>');
40) 
41) $name = $_SESSION['customerinfo']['name'];
42) if ($_SESSION['customerinfo']['company']) {
43)   if ($_SESSION['customerinfo']['name']) {
44)     $name = $_SESSION['customerinfo']['company'] .' / '. $_SESSION['customerinfo']['name'];
45)   } else {
46)     $name = $_SESSION['customerinfo']['company'];
47)   }
48) }
49) output('<p>Dieses Mandat gilt für Forderungen bzgl. der Kundennummer <strong>'.$_SESSION['customerinfo']['customerno'].'</strong> ('.$name.'). Sämtliche Forderungen werden mindestens 6 Bankarbeitstage vor Fälligkeit angekündigt. Diese Ankündigung erfolgt in der Regel durch Zusendung einer Rechnung per E-Mail.</p>');
50) 
51) 
52) 
53) $first_date = date('Y-m-d');
54) $invoices = my_invoices();
55) foreach ($invoices as $i) {
56)   if ($i['bezahlt'] == 0 && $i['datum'] < $first_date) {
57)     $first_date = $i['datum'];
58)   }
59) }
60) 
61) $html = '<h4>Gültigkeit des Mandats</h4>';
62) $checked = False;
63) if ($first_date != date('Y-m-d')) {
64)   $checked = True;
65)   $html .= '<p><input type="radio" id="gueltig_ab_'.$first_date.'" name="gueltig_ab" value="'.$first_date.'" checked="checked" /><label for="gueltig_ab_'.$first_date.'">Dieses Mandat gilt <strong>ab '.$first_date.'</strong> (Alle bisher offenen Forderungen werden ebenfalls abgebucht)</label></p>';
66) }
67) $html .= '<p><input type="radio" id="gueltig_ab_heute" name="gueltig_ab" value="'.date('Y-m-d').'" '.($checked ? '' : 'checked="checked"').' /><label for="gueltig_ab_heute">Dieses Mandat gilt <strong>ab heute</strong> ('.date('Y-m-d').')</label></p>';
68) $html .= '<p><input type="radio" id="gueltig_ab_datum" name="gueltig_ab" value="datum" /><label for="gueltig_ab_datum">Dieses Mandat gilt <strong>erst ab</strong></label> '.html_datepicker("gueltig_ab_datum", time()).' (Ein eventuell zuvor erteiltes Mandat wird zu diesem Datum automatisch ungültig.)</p>';
69) 
70) $html .= '<h4>Ihre Bankverbindung</h4>';
71) $html .= '<table>
Bernd Wurst Funktion um Name und Adress...

Bernd Wurst authored 10 years ago

72) <tr><td><label for="kontoinhaber">Name des Kontoinhabers:</label></td><td><input type="text" name="kontoinhaber" id="kontoinhaber" /> <button id="copydata">Von Kundendaten kopieren</button></td></tr>
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

73) <tr><td><label for="adresse">Adresse des Kontoinhabers:</label></td><td><textarea cols="50" lines="2" name="adresse" id="adresse"></textarea></td></tr>
Bernd Wurst IBAN-Feld breiter darstellen

Bernd Wurst authored 10 years ago

74) <tr><td><label for="iban">IBAN:</label></td><td><input type="text" name="iban" id="iban" size="30" /><span id="iban_feedback"></span></td></tr>
75) <tr><td><label for="bankname">Name der Bank:</label></td><td><input type="text" name="bankname" id="bankname" size="30" /></td></tr>
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

76) <tr><td><label for="bic">BIC:</label></td><td><input type="text" name="bic" id="bic" /></td></tr>
77) </table>';
78) 
79) $html .= '<p><input type="submit" value="Mandat erteilen" /></p>';
80) 
81) 
82) output(html_form('sepamandat_neu', 'save', 'action=new', $html));
83) 
Bernd Wurst Vervollständige Bankname un...

Bernd Wurst authored 10 years ago

84) output('
85) <script type="text/javascript">
86) 
87) function populate_bankinfo(result) {
88)   bank = result[0];
Bernd Wurst Zeige gleich an, ob eine (d...

Bernd Wurst authored 10 years ago

89)   if (bank.iban_ok == 1) {
90)     $("#iban_feedback").html(\''.icon_ok().'\');
91)     if ($(\'#bankname\').val() == "") 
92)       $(\'#bankname\').val(bank.bankname);
93)     if ($(\'#bic\').val() == "")  
94)       $(\'#bic\').val(bank.bic);
95)   } else {
96)     $("#iban_feedback").html(\''.icon_error('IBAN scheint nicht gültig zu sein').'\');
97)     $(\'#bankname\').val("");
98)     $(\'#bic\').val("");
99)   }
Bernd Wurst Vervollständige Bankname un...

Bernd Wurst authored 10 years ago

100)     
101) }
102) 
103) function searchbank() 
104) {
105)   var iban = $(\'#iban\').val();
106)   if (iban.substr(0,2) == "DE" && iban.length == 22) {
107)     $("#bankname").prop("disabled", true);
108)     $("#bic").prop("disabled", true);
109)     $.getJSON("sepamandat_banksearch?iban="+iban, populate_bankinfo)
110)       .always( function() {
111)         $("#bankname").prop("disabled", false);
112)         $("#bic").prop("disabled", false);
113)       });
Bernd Wurst Zeige gleich an, ob eine (d...

Bernd Wurst authored 10 years ago

114)   } else {
115)     $("#iban_feedback").html("");
Bernd Wurst Vervollständige Bankname un...

Bernd Wurst authored 10 years ago

116)   }
117) }
118) 
Bernd Wurst Funktion um Name und Adress...

Bernd Wurst authored 10 years ago

119) function copydata_worker( result ) {
120)   $("#kontoinhaber").val(result.kundenname);
121)   $("#adresse").val(result.adresse);
122) }
123) 
124) function copydata( event ) {
125)   event.preventDefault();
126)   var kunde = $.getJSON("sepamandat_copydata", copydata_worker);
127) }
128) 
129) 
Bernd Wurst Vervollständige Bankname un...

Bernd Wurst authored 10 years ago

130) $(\'#iban\').on("change keyup paste", searchbank );
Bernd Wurst Funktion um Name und Adress...

Bernd Wurst authored 10 years ago

131) $("#copydata").click(copydata);
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

132) 
Bernd Wurst Vervollständige Bankname un...

Bernd Wurst authored 10 years ago

133) </script>
134) ');