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">
17 foreach ($sales->getOpenItems() as $row) {
18 $date = substr ($row->date,6,2) . "." . substr ($row->date,4,2) . "." . substr ($row->date,0,4);
19 printf('<input name="nr[]" type="checkbox" value="%d" price="%d"> ', $row->nr, $row->price);
20 printf('<span class="%s">%d %s %s (%.2f €)</span><br>',
21 $row->price < 0 ? 'out' : 'in',
22 $row->nr, $date, $row->description, $row->price / 100);
25 Zwischensumme <input type="text" id="subtotal" value="" size="5" style="background: #ececec;text-align:right;" readonly> €
26 <p><input type="submit" class="button" value="Bezahlen" onclick="return send_request()"> <input type="reset" class="button" value="Reset"><p>
31 <script type="text/javascript">
34 var subtotal = $('input#subtotal').val();
35 if (typeof subtotal == 'string' && !subtotal.length) subtotal = 0;
36 else subtotal = parseFloat(subtotal) * 100;
38 if ($(this).prop('checked'))
39 subtotal += parseFloat($(this).attr('price'));
41 subtotal -= parseFloat($(this).attr('price'));
44 $('input#subtotal').val('');
46 $('input#subtotal').val(subtotal / 100);
49 function send_request()
51 console.log($('form#open_items').serialize());
53 $.invoke('Sales/Subtotal', $('form#open_items').serialize(), function(data){
54 show_message('Mail sent');
55 $('form#open_items')[0].reset();
62 $('form#open_items input[type="checkbox"]').click(cb_change);
63 setTimeout(function(){$('form#open_items')[0].reset();}, 500);