--- /dev/null
+#include <infocon.style>
+
+<future>
+<page func=InfoCon title="Buchhaltung">
+
+<style type="text/css">
+span.in { color: green; }
+span.out { color: red; }
+span.in:hover, span.out:hover { background: yellow; border: 1px solid #ccc; }
+</style>
+
+<h3>Erstattungen / Offene Buchungen</h3>
+
+<form id="open_items">
+<?php
+ $sales = new Sales();
+ foreach ($sales->getOpenItems() as $row) {
+ $date = substr ($row->date,6,2) . "." . substr ($row->date,4,2) . "." . substr ($row->date,0,4);
+ printf('<input name="nr[]" type="checkbox" value="%d" price="%d"> ', $row->nr, $row->price);
+ printf('<span class="%s">%d %s %s (%.2f €)</span><br>',
+ $row->price < 0 ? 'out' : 'in',
+ $row->nr, $date, $row->description, $row->price / 100);
+ }
+?>
+Zwischensumme <input type="text" id="subtotal" value="" size="5" style="background: #ececec;text-align:right;" readonly> €
+<p><input type="submit" class="button" value="Bezahlen" onclick="return send_request()"> <input type="reset" class="button" value="Reset"><p>
+</form>
+
+</page>
+<protect>
+<script type="text/javascript">
+function cb_change()
+{
+ var subtotal = $('input#subtotal').val();
+ if (typeof subtotal == 'string' && !subtotal.length) subtotal = 0;
+ else subtotal = parseFloat(subtotal) * 100;
+
+ if ($(this).prop('checked'))
+ subtotal += parseFloat($(this).attr('price'));
+ else
+ subtotal -= parseFloat($(this).attr('price'));
+
+ if (subtotal == 0)
+ $('input#subtotal').val('');
+ else
+ $('input#subtotal').val(subtotal / 100);
+}
+
+function send_request()
+{
+ console.log($('form#open_items').serialize());
+
+ $.invoke('Sales/Subtotal', $('form#open_items').serialize(), function(data){
+ show_message('Mail sent');
+ $('form#open_items')[0].reset();
+ });
+
+ return false;
+}
+
+$(function(){
+ $('form#open_items input[type="checkbox"]').click(cb_change);
+ setTimeout(function(){$('form#open_items')[0].reset();}, 500);
+});
+</script>
+</protect>