</div>
<div id='acq-invoice-summary-small'>
<h3 id='acq-invoice-summary-name'></h3>
- <div>[% l("Lineitems: " ) %]<span id='acq-invoice-summary-count'>0</span></div><br/>
+ <div>[% l("Lineitems: " ) %]<span id='acq-invoice-summary-count'>0</span></div>
+ <div>[% l("Expected Cost: " ) %]<span id='acq-invoice-summary-cost'>0</span></div><br/>
<button id='acq-invoice-summary-toggle-on'>[% l('Show Details') %]</button>
</div>
<br/>
link.onclick = function() { location.href = oilsBasePath + '/acq/invoice/receive/' + invoiceId; };
}
+function updateExpectedCost(li, entry) {
+
+ var prevCost = Number(li._expected_cost || 0);
+
+ if (entry.isnew()) {
+ // total estimated minus any elsewhere invoiced
+ li._expected_cost =
+ Number(li.order_summary().estimated_amount() || 0) -
+ Number(li.order_summary().paid_amount() || 0);
+
+ } else {
+
+ li._expected_cost = Number(entry.cost_billed() || 0);
+ }
+
+ var total = Number(dojo.byId('acq-invoice-summary-cost').innerHTML || 0);
+ total += li._expected_cost;
+ dojo.byId('acq-invoice-summary-cost').innerHTML = total.toFixed(2);
+}
+
function addInvoiceEntry(entry) {
openils.Util.removeCSSClass(dojo.byId('acq-invoice-entry-header'), 'hidden');
nodeByName('title_details', row).innerHTML = html;
updateReceiveLink(li);
+ updateExpectedCost(li, entry);
dojo.forEach(
['inv_item_count', 'phys_item_count', 'cost_billed', 'amount_paid'],