$row->nr, $date, $row->description, $row->price / 100);
}
?>
-Zwischensumme <input type="text" id="subtotal" value="" size="5" style="background: #ececec;text-align:right;" readonly> €
+Zwischensumme <input type="text" id="subtotal" value="" data-value="" size="5" style="background: #ececec;text-align:right;" readonly> €
<input type="text" id="subtotal_tr" value="" size="5" style="background: #ececec;text-align:right;" readonly> €
<p><input type="submit" class="button" value="Erstatten" onclick="return send_request()"> <input type="reset" class="button" value="Reset"><p>
</form>
<script type="text/javascript">
function cb_change()
{
- var subtotal = $('input#subtotal').val();
+ var subtotal = $('input#subtotal').attr('data-value');
if (typeof subtotal == 'string' && !subtotal.length) subtotal = 0;
- else subtotal = parseInt((parseFloat(subtotal) * 100).toString());
+ else subtotal = parseInt(subtotal, 10);
if ($(this).prop('checked'))
subtotal += parseInt($(this).attr('price'));
else
subtotal -= parseInt($(this).attr('price'));
+ $('input#subtotal').attr('data-value', subtotal);
if (subtotal == 0) {
$('input#subtotal').val('');
$('input#subtotal_tr').val('');
} else {
- $('input#subtotal').val(subtotal / 100);
- $('input#subtotal_tr').val((subtotal * -1 / 100).toString().replace('.', ','));
+ $('input#subtotal').val((subtotal / 100).toFixed(2));
+ $('input#subtotal_tr').val((subtotal * -1 / 100).toFixed(2).replace('.', ','));
}
}