padding-bottom: 5px;
border-bottom: 2px solid #888;
}
+ #acq-invoice-num-summary-table td[id] {
+ font-weight:bold;
+ }
</style>
<table id='acq-invoice-num-summary-table'>
<tr><td>[% l("Lineitems: " ) %]</td><td id='acq-invoice-summary-count'>0</td></tr>
<td id='acq-invoice-summary-cost'>0.00</td>
</tr>
</table>
+ <br/>
<div>
<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
<th colspan='2'>Title Details</th>
<th class='acq-invoice-center-col'># Invoiced / # Paid</th>
<th class='acq-invoice-center-col'>Billed</th>
+ <th class='acq-invoice-paid-per-copy-col'>Per Copy</th>
<th class='acq-invoice-paid-col'>Paid</th>
<th class='acq-invoice-center-col hide-complete'>Detach</th>
</tr>
<span name='inv_item_count'></span> / <span name='phys_item_count'></span>
</td>
<td class='acq-invoice-billed-col'><div name='cost_billed'></div></td>
+ <td><div name='amount_paid_per_copy'>0.00</div></td>
<td class='acq-invoice-paid-col'><div name='amount_paid'></div></td>
<td class='acq-invoice-center-col hide-complete'><a href='javascript:void(0);' name='detach'>Detach</a></td>
</tr>
<th class='acq-invoice-center-col'>Fund</th>
<th>Title/Description</th>
<th class='acq-invoice-center-col'>Billed</th>
+ <th/>
<th class='acq-invoice-paid-col'>Paid</th>
<th class='acq-invoice-center-col hide-complete'>Delete</th>
</tr>
<td class='acq-invoice-center-col'><div name='fund'></div></td>
<td><div name='title'></div></td>
<td class='acq-invoice-center-col acq-invoice-billed-col'><div name='cost_billed'></div></td>
+ <td/>
<td class='acq-invoice-paid-col'><div name='amount_paid'></div></td>
<td class='acq-invoice-center-col hide-complete'><a href='javascript:void(0);' name='delete'>Delete</a></td>
</tr>
<tr>
<th colspan='3'/>
<th class='acq-invoice-center-col acq-invoice-billed-col'>Total</th>
+ <th/>
<th class='acq-invoice-paid-col'>Total</th>
<th class='acq-invoice-center-col acq-invoice-balance-col'>Balance</th>
</tr>
openils.Util.hide(dojo.byId('acq-invoice-summary-small'));
}
- // show summary info by default
- dojo.byId('acq-invoice-summary-toggle-on').onclick();
-
-
if(cgi.param('create')) {
renderInvoice();
+ // show summary info by default for new invoices
+ dojo.byId('acq-invoice-summary-toggle-on').onclick();
+
} else {
+ dojo.byId('acq-invoice-summary-toggle-off').onclick();
fieldmapper.standardRequest(
['open-ils.acq', 'open-ils.acq.invoice.retrieve.authoritative'],
{
dojo.byId('acq-invoice-summary-cost').innerHTML = total.toFixed(2);
}
+var invoicEntryWidgets = {};
function addInvoiceEntry(entry) {
console.log('Adding new entry for lineitem ' + entry.lineitem());
parentNode : nodeByName(field, row)
}),
function(w) {
+
if(field == 'phys_item_count') {
dojo.connect(w, 'onChange',
function() {
}
}
)
- }
- }
+ } // if
+
+ if(field == 'inv_item_count' || field == 'cost_billed') {
+ setPerCopyPrice(row, entry);
+ // update the per-copy count as invoice count and cost billed change
+ dojo.connect(w, 'onChange', function() { setPerCopyPrice(row, entry) } );
+ }
+
+ } // func
);
}
);
updateTotalCost();
}
+function setPerCopyPrice(row, entry) {
+ var inv_w = widgetRegistry.acqie[entry.id()].inv_item_count;
+ var bill_w = widgetRegistry.acqie[entry.id()].cost_billed;
+
+ if (inv_w && bill_w) {
+ var invoiced = Number(inv_w.getFormattedValue());
+ var billed = Number(bill_w.getFormattedValue());
+ console.log(invoiced + ' : ' + billed);
+ if (invoiced > 0) {
+ nodeByName('amount_paid_per_copy', row).innerHTML = (billed / invoiced).toFixed(2);
+ } else {
+ nodeByName('amount_paid_per_copy', row).innerHTML = '0.00';
+ }
+ }
+}
+
function liMarcAttr(lineitem, name) {
var attr = lineitem.attributes().filter(
function(attr) {