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 <input type="text" id="subtotal_tr" value="" size="5" style="background: #ececec;text-align:right;" readonly> €
28 <p><input type="submit" class="button" value="Bezahlen" onclick="return send_request()"> <input type="reset" class="button" value="Reset"><p>
33 <script type="text/javascript">
36 var subtotal = $('input#subtotal').val();
37 if (typeof subtotal == 'string' && !subtotal.length) subtotal = 0;
38 else subtotal = parseInt((parseFloat(subtotal) * 100).toString());
40 if ($(this).prop('checked'))
41 subtotal += parseInt($(this).attr('price'));
43 subtotal -= parseInt($(this).attr('price'));
46 $('input#subtotal').val('');
47 $('input#subtotal_tr').val('');
49 $('input#subtotal').val(subtotal / 100);
50 $('input#subtotal_tr').val((subtotal * -1 / 100).toString().replace('.', ','));
54 function send_request()
56 $.invoke('Sales/Subtotal', $('form#open_items').serialize(), function(data){
57 show_message('Mail sent');
58 $('form#open_items')[0].reset();
65 $('form#open_items input[type="checkbox"]').click(cb_change);
66 setTimeout(function(){$('form#open_items')[0].reset();}, 500);