Bernd Wurst commited on 2014-01-11 17:43:19
Zeige 3 geänderte Dateien mit 48 Einfügungen und 4 Löschungen.
... | ... |
@@ -58,20 +58,25 @@ foreach ($invoices as $i) { |
58 | 58 |
} |
59 | 59 |
} |
60 | 60 |
|
61 |
-$html = '<h4>Gültigkeit des Mandats</h4>'; |
|
61 |
+$html = '<h4>Gültigkeit des Mandats</h4> |
|
62 |
+<p>Ein eventuell zuvor erteiltes Mandat wird zu diesem Datum automatisch ungültig.</p>'; |
|
63 |
+ |
|
62 | 64 |
$checked = False; |
63 | 65 |
if ($first_date != date('Y-m-d')) { |
64 | 66 |
$checked = True; |
65 | 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>'; |
66 | 68 |
} |
67 | 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>'; |
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>'; |
|
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>'; |
|
69 | 71 |
|
70 | 72 |
$html .= '<h4>Ihre Bankverbindung</h4>'; |
71 | 73 |
$html .= '<table> |
72 | 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> |
73 | 75 |
<tr><td><label for="adresse">Adresse des Kontoinhabers:</label></td><td><textarea cols="50" lines="2" name="adresse" id="adresse"></textarea></td></tr> |
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> |
|
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> |
|
75 | 80 |
<tr><td><label for="bankname">Name der Bank:</label></td><td><input type="text" name="bankname" id="bankname" size="30" /></td></tr> |
76 | 81 |
<tr><td><label for="bic">BIC:</label></td><td><input type="text" name="bic" id="bic" /></td></tr> |
77 | 82 |
</table>'; |
... | ... |
@@ -126,9 +131,31 @@ function copydata( event ) { |
126 | 131 |
var kunde = $.getJSON("sepamandat_copydata", copydata_worker); |
127 | 132 |
} |
128 | 133 |
|
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 |
+ |
|
129 | 154 |
|
130 | 155 |
$(\'#iban\').on("change keyup paste", searchbank ); |
131 | 156 |
$("#copydata").click(copydata); |
157 |
+$("#showktoblz").click(showktoblz); |
|
158 |
+$("#ktoblz").click(ktoblz); |
|
132 | 159 |
|
133 | 160 |
</script> |
134 | 161 |
'); |
... | ... |
@@ -20,7 +20,16 @@ require_once('inc/debug.php'); |
20 | 20 |
require_once('invoice.php'); |
21 | 21 |
|
22 | 22 |
|
23 |
+$iban = NULL; |
|
24 |
+if (isset($_GET['iban'])) { |
|
23 | 25 |
$iban = $_GET['iban']; |
26 |
+} elseif (isset($_GET['kto']) && isset($_GET['blz'])) { |
|
27 |
+ $iban = find_iban($_GET['blz'], $_GET['kto']); |
|
28 |
+} |
|
29 |
+if ($iban == NULL) { |
|
30 |
+ echo "Fehler!"; |
|
31 |
+ die(); |
|
32 |
+} |
|
24 | 33 |
|
25 | 34 |
$iban_ok = (verify_iban($iban) ? '1' : '0'); |
26 | 35 |
|
... | ... |
@@ -28,7 +37,7 @@ $bank = get_bank_info($iban); |
28 | 37 |
|
29 | 38 |
header("Content-Type: text/javascript"); |
30 | 39 |
echo "[\n"; |
31 |
-echo ' { "iban_ok": "'.$iban_ok.'", "bic": "'.$bank['bic'].'", "bankname" : "'.$bank['name'].'" } '; |
|
40 |
+echo ' { "iban_ok": "'.$iban_ok.'", "iban": "'.$iban.'", "bic": "'.$bank['bic'].'", "bankname" : "'.$bank['name'].'" } '; |
|
32 | 41 |
echo ' |
33 | 42 |
]'; |
34 | 43 |
die(); |
35 | 44 |