#include "common.inc"
<script type="text/javascript">
-function check(form, value)
+function check(id, value)
{
- var form = document.forms[form];
+ var form = document.forms[id];
for (i=0; i< form.elements.length; i++) {
if (form.elements[i].name.substr(0,4) == 'oid_')
form.elements[i].checked = value;
}
+
+ if (value == false) {
+ var sum = document.getElementById('sum_'+id.toString());
+ sum.innerHTML = '0';
+ }
}
function plant(form)
document.write(" / ");
document.write('<a href="javascript:check('+form+',false)">Uncheck all</a>');
document.write(" ");
+ document.write('<span id="sum_'+form+'" class="sum">0</span>');
+ document.write(" ");
document.write('</div>');
}
+
+var sum = array();
+function add_sum(form, checkbox)
+{
+ var sum = document.getElementById('sum_'+form.toString());
+ var newval;
+
+ var ta = checkbox.parentNode.nextSibling.innerHTML.split(':');
+ var time = parseInt(ta[0]) * 60 + parseInt(ta[1]);
+
+ if (checkbox.checked)
+ newval = parseInt(sum.innerHTML) + time;
+ else
+ newval = parseInt(sum.innerHTML) - time;
+ sum.innerHTML = newval.toString();
+}
</script>
<style type="text/css">
margin-top: -13px;
font-size: 12px;
}
+span.sum {
+ display: inline;
+ border: 1px solid #9b9b9b;
+ background: #d9e2ea;
+ width: 20px;
+}
</style>
<?
$table_head = '<h3 class="bar">Kunde: %s</h3><script type="text/javascript">plant(%d);</script>
<form action="status.php" method="POST">
- <table class="smallfont border" width="100%%" cellpadding=0 cellspacing=1>
+ <table class="smallfont border" width="100%%" cellpadding=0 cellspacing=0>
<tr class="head">
<th width=15%%>Datum</th>
<th width=5%%>Dauer</th>
if (strlen($customer)) {
printf($table_sum, $color, min2hour($sum));
printf($table_foot, $fieldnr);
+ $form++;
}
- printf($table_head, ucfirst($row['customer']), $form++);
+ printf($table_head, ucfirst($row['customer']), $form);
$customer = $row['customer'];
$fieldnr = 0;
$sum = 0;
$sum += $row['time'];
$d = explode(' ', $row['start']);
- $check = '<input type="checkbox" name="oid_'.$fieldnr++.'" value="'.$row['oid'].'">';
+ $check = sprintf('<input type="checkbox" class="checkbox" name="oid_'.$fieldnr++.'" value="'.$row['oid'].'" onclick="add_sum(%d,this)">',$form);
printf($table_row, $color, $check.$d[0], min2hour($row['time']), $row['kurz'], $row['task']);
$color = !$color;
}