1 #include <infocon.style>
4 <page func=InfoCon title="Buchhaltung">
6 <style type="text/css">
7 span.in { color: green; }
8 span.out { color: red; }
9 span.in:hover, span.out:hover { background: yellow; border: 1px solid #ccc; }
12 <h3>Erstattungen / Offene Buchungen</h3>
14 <form id="open_items">
15 Titel <input type="text" id="title" name="title" value="" size="20" title="Optionaler Titel der Liste"><br>
18 foreach ($sales->getOpenItems() as $row) {
19 $date = substr ($row->date,6,2) . "." . substr ($row->date,4,2) . "." . substr ($row->date,0,4);
20 printf('<input name="nr[]" type="checkbox" value="%d" price="%d"> ', $row->nr, $row->price);
21 printf('<span class="%s">%d %s %s (%.2f €)</span><br>',
22 $row->price < 0 ? 'out' : 'in',
23 $row->nr, $date, $row->description, $row->price / 100);
26 Zwischensumme <input type="text" id="subtotal" value="" size="5" style="background: #ececec;text-align:right;" readonly> €
27 <p><input type="submit" class="button" value="Bezahlen" onclick="return send_request()"> <input type="reset" class="button" value="Reset"><p>
32 <script type="text/javascript">
35 var subtotal = $('input#subtotal').val();
36 if (typeof subtotal == 'string' && !subtotal.length) subtotal = 0;
37 else subtotal = parseFloat(subtotal) * 100;
39 if ($(this).prop('checked'))
40 subtotal += parseFloat($(this).attr('price'));
42 subtotal -= parseFloat($(this).attr('price'));
45 $('input#subtotal').val('');
47 $('input#subtotal').val(subtotal / 100);
50 function send_request()
52 $.invoke('Sales/Subtotal', $('form#open_items').serialize(), function(data){
53 show_message('Mail sent');
54 $('form#open_items')[0].reset();
61 $('form#open_items input[type="checkbox"]').click(cb_change);
62 setTimeout(function(){$('form#open_items')[0].reset();}, 500);