207e27f1d65a23f5d2150a53bf9c7ab202510fe2
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) 
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) 
Bernd Wurst Nutze zentrales JQuery

Bernd Wurst authored 10 years ago

20) require_once('inc/jquery.php');
21) 
Bernd Wurst Erste Version des SEPA-Mand...

Bernd Wurst authored 10 years ago

22) require_role(ROLE_CUSTOMER);
23) $section = 'invoice_current';
24) 
25) title('Erteilung eines Mandats zur SEPA-Basis-Lastschrift');
26) 
27) output('<p>Ich ermächtige die Firma schokokeks.org GbR, Zahlungen von meinem Konto mittels Lastschrift
28) einzuziehen. Zugleich weise ich mein Kreditinstitut an, die von der Firma schokokeks.org GbR auf mein
29) Konto gezogenen Lastschriften einzulösen.</p>
30) <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

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

32) Insbesondere fallen bei Zurückweisung einer gerechtfertigten Abbuchung i.d.R. Gebühren an.</p>');
33) 
34) $name = $_SESSION['customerinfo']['name'];
35) if ($_SESSION['customerinfo']['company']) {
36)   if ($_SESSION['customerinfo']['name']) {
37)     $name = $_SESSION['customerinfo']['company'] .' / '. $_SESSION['customerinfo']['name'];
38)   } else {
39)     $name = $_SESSION['customerinfo']['company'];
40)   }
41) }
Bernd Wurst Kleine Korrekturen Ausführu...

Bernd Wurst authored 10 years ago

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

43) 
44) 
45) 
46) $first_date = date('Y-m-d');
47) $invoices = my_invoices();
48) foreach ($invoices as $i) {
Bernd Wurst Kleine Korrekturen Ausführu...

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

50)     $first_date = $i['datum'];
51)   }
52) }
53) 
Bernd Wurst Ermögliche das Berechnen de...

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

57) $checked = False;
58) if ($first_date != date('Y-m-d')) {
59)   $checked = True;
60)   $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>';
61) }
62) $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

63) $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

64) 
65) $html .= '<h4>Ihre Bankverbindung</h4>';
66) $html .= '<table>
Bernd Wurst Funktion um Name und Adress...

Bernd Wurst authored 10 years ago

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

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

69) <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>
70) <tr><td><label for="iban">IBAN:</label></td><td><input type="text" name="iban" id="iban" size="30" /><span id="iban_feedback"></span><br />
71) <span id="ktoblz_button"><button id="showktoblz">IBAN aus Kontonummer / BLZ berechnen...</button></span>
72) </td></tr>
Bernd Wurst IBAN-Feld breiter darstellen

Bernd Wurst authored 10 years ago

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

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

98)     
99) }
100) 
101) function searchbank() 
102) {
Bernd Wurst Entferne Spaces aus der IBAN

Bernd Wurst authored 6 years ago

103)   var iban = $(\'#iban\').val().replace(/\s/g, \'\');
Bernd Wurst Vervollständige Bankname un...

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

114)   }
115) }
116) 
Bernd Wurst Funktion um Name und Adress...

Bernd Wurst authored 10 years ago

117) function copydata_worker( result ) {
118)   $("#kontoinhaber").val(result.kundenname);
119)   $("#adresse").val(result.adresse);
120) }
121) 
122) function copydata( event ) {
123)   event.preventDefault();
124)   var kunde = $.getJSON("sepamandat_copydata", copydata_worker);
125) }
126) 
Bernd Wurst Ermögliche das Berechnen de...

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

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

Bernd Wurst authored 10 years ago

153) </script>
154) ');