price_format('total_allocated', total, user.pdec, 1, 1);
}
+function update_totals() {
+ var amount = 0;
+ var discount = 0;
+
+ for (var i=0; i<docs.length; i++) {
+ amount += get_amount('amount'+docs[i])
+ if (document.getElementsByName('early_disc'+docs[i])[0].checked
+ && (get_amount('un_allocated'+docs[i]) == get_amount('amount'+docs[i])))
+ discount += get_amount('early_disc'+docs[i]);
+ }
+ price_format('amount', amount-discount, user.pdec);
+ price_format('discount', discount, user.pdec);
+
+}
+
function allocate_all(doc) {
var amount = get_amount('amount'+doc);
var unallocated = get_amount('un_allocated'+doc);
e.onfocus = function() {
focus_alloc(this);
};
+ },
+ '.check':function(e) {
+ e.onclick = function() {
+ update_totals();
+ }
}
}