174c4e60d4f51f5c959e47d7bc4aaf2a9a64a22a
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) }
Bernd Wurst Kleine Korrekturen Ausführu...

Bernd Wurst authored 10 years ago

49) output('<p>Dieses Mandat gilt für Forderungen bzgl. der Kundennummer <strong>'.$_SESSION['customerinfo']['customerno'].'</strong> ('.$name.'). Sämtliche Forderungen werden mindestens 2 Tage vor Fälligkeit angekündigt. Diese Ankündigung erfolgt in der Regel im Rahmen der Zusendung einer Rechnung per E-Mail.</p>');
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

50) 
51) 
52) 
53) $first_date = date('Y-m-d');
54) $invoices = my_invoices();
55) foreach ($invoices as $i) {
Bernd Wurst Kleine Korrekturen Ausführu...

Bernd Wurst authored 10 years ago

56)   if ($i['bezahlt'] == 0 && $i['sepamandat'] == NULL && $i['datum'] < $first_date) {
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

57)     $first_date = $i['datum'];
58)   }
59) }
60) 
Bernd Wurst Ermögliche das Berechnen de...

Bernd Wurst authored 10 years ago

61) $html = '<h4>Gültigkeit des Mandats</h4>
62) <p>Ein eventuell zuvor erteiltes Mandat wird zu diesem Datum automatisch ungültig.</p>';
63) 
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

64) $checked = False;
65) if ($first_date != date('Y-m-d')) {
66)   $checked = True;
67)   $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>';
68) }
69) $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>';
Bernd Wurst Ermögliche das Berechnen de...

Bernd Wurst authored 10 years ago

70) $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()).'</p>';
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

71) 
72) $html .= '<h4>Ihre Bankverbindung</h4>';
73) $html .= '<table>
Bernd Wurst Funktion um Name und Adress...

Bernd Wurst authored 10 years ago

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

75) <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 Ermögliche das Berechnen de...

Bernd Wurst authored 10 years ago

76) <tr id="ktoblz_input" style="display: none;"><td>Kontodaten:</td><td><label for="kto">Konto:</label> <input type="text" id="kto" /> <label for="blz">BLZ:</label> <input type="text" id="blz" /><br /><button id="ktoblz">IBAN berechnen...</button></td></tr>
77) <tr><td><label for="iban">IBAN:</label></td><td><input type="text" name="iban" id="iban" size="30" /><span id="iban_feedback"></span><br />
78) <span id="ktoblz_button"><button id="showktoblz">IBAN aus Kontonummer / BLZ berechnen...</button></span>
79) </td></tr>
Bernd Wurst IBAN-Feld breiter darstellen

Bernd Wurst authored 10 years ago

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

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

Bernd Wurst authored 10 years ago

89) output('
90) <script type="text/javascript">
91) 
92) function populate_bankinfo(result) {
93)   bank = result[0];
Bernd Wurst Zeige gleich an, ob eine (d...

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

121)   }
122) }
123) 
Bernd Wurst Funktion um Name und Adress...

Bernd Wurst authored 10 years ago

124) function copydata_worker( result ) {
125)   $("#kontoinhaber").val(result.kundenname);
126)   $("#adresse").val(result.adresse);
127) }
128) 
129) function copydata( event ) {
130)   event.preventDefault();
131)   var kunde = $.getJSON("sepamandat_copydata", copydata_worker);
132) }
133) 
Bernd Wurst Ermögliche das Berechnen de...

Bernd Wurst authored 10 years ago

134) function populate_iban(result) {
135)   info = result[0];
136)   $("#iban").val(info.iban);
137)   populate_bankinfo(result)
138) }
139) 
140) function ktoblz( event ) {
141)   event.preventDefault();
142)   var kto = $("#kto").val();
143)   var blz = $("#blz").val();
144)   $.getJSON("sepamandat_banksearch?kto="+kto+"&blz="+blz, populate_iban)
145) }
146) 
147) function showktoblz( event ) {
148)   event.preventDefault();
149)   $("#ktoblz_button").hide();
150)   $("#ktoblz_input").show();
151) }
152) 
153) 
Bernd Wurst Funktion um Name und Adress...

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

156) $("#copydata").click(copydata);
Bernd Wurst Ermögliche das Berechnen de...

Bernd Wurst authored 10 years ago

157) $("#showktoblz").click(showktoblz);
158) $("#ktoblz").click(ktoblz);
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

160) </script>
161) ');