[open-ils-commits] r16192 - in trunk/Open-ILS/web: js/dojo/openils/acq/nls js/ui/default/acq/invoice templates/default/acq/invoice (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Apr 9 09:00:15 EDT 2010
Author: erickson
Date: 2010-04-09 09:00:13 -0400 (Fri, 09 Apr 2010)
New Revision: 16192
Modified:
trunk/Open-ILS/web/js/dojo/openils/acq/nls/acq.js
trunk/Open-ILS/web/js/ui/default/acq/invoice/view.js
trunk/Open-ILS/web/templates/default/acq/invoice/view.tt2
Log:
plugged in amount paid columns and new total column for amount paid
added some confirm dialogs
Modified: trunk/Open-ILS/web/js/dojo/openils/acq/nls/acq.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/acq/nls/acq.js 2010-04-09 13:00:12 UTC (rev 16191)
+++ trunk/Open-ILS/web/js/dojo/openils/acq/nls/acq.js 2010-04-09 13:00:13 UTC (rev 16192)
@@ -60,5 +60,6 @@
'INVOICE_CONFIRM_ITEM_DELETE' : "Remove this $${0} '${1}' charge from the invoice?",
'INVOICE_CONFIRM_ENTRY_DETACH' : "Remove $${0} charge for item '${1}, ${2} [${3}] from the invoice?",
'INVOICE_TITLE_DETAILS' : "<div class='acq-inoice-item-info'>${0}, by ${1} (${2})</div><div class='acq-inoice-item-extra-info'><a style='padding-right: 10px;' href='${9}/acq/po/view/${10}'>PO: ${11}</a>${3} Ordered, ${4} Received, ${7} Invoiced</div><div class='acq-inoice-item-extra-info'> Estimated Cost Per Item $${5} / Total Estimated Cost $${6}</div>",
+ 'INVOICE_CONFIRM_PRORATE' : "Prorate charges?\n\nAny subsequent changes to the invoice that would affect prorated amounts should be resolved manually.",
'UNNAMED': "Unnamed"
}
Modified: trunk/Open-ILS/web/js/ui/default/acq/invoice/view.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/invoice/view.js 2010-04-09 13:00:12 UTC (rev 16191)
+++ trunk/Open-ILS/web/js/ui/default/acq/invoice/view.js 2010-04-09 13:00:13 UTC (rev 16192)
@@ -25,7 +25,8 @@
var itemTbody;
var itemTemplate;
var entryTemplate;
-var totalAmountBox;
+var totalInvoicedBox;
+var totalPaidBox;
var invoicePane;
var itemTypes;
var virtualId = -1;
@@ -164,8 +165,8 @@
function updateTotalCost() {
var total = 0;
- if(!totalAmountBox) {
- totalAmountBox = new dijit.form.CurrencyTextBox(
+ if(!totalInvoicedBox) {
+ totalInvoicedBox = new dijit.form.CurrencyTextBox(
{style : 'width: 5em'}, dojo.byId('acq-invoice-total-invoiced'));
}
for(var id in widgetRegistry.acqii)
@@ -174,7 +175,20 @@
for(var id in widgetRegistry.acqie)
if(!widgetRegistry.acqie[id]._object.isdeleted())
total += widgetRegistry.acqie[id].cost_billed.getFormattedValue();
- totalAmountBox.attr('value', total);
+ totalInvoicedBox.attr('value', total);
+
+ total = 0;
+ if(!totalPaidBox) {
+ totalPaidBox = new dijit.form.CurrencyTextBox(
+ {style : 'width: 5em'}, dojo.byId('acq-invoice-total-paid'));
+ }
+ for(var id in widgetRegistry.acqii)
+ if(!widgetRegistry.acqii[id]._object.isdeleted())
+ total += widgetRegistry.acqii[id].amount_paid.getFormattedValue();
+ for(var id in widgetRegistry.acqie)
+ if(!widgetRegistry.acqie[id]._object.isdeleted())
+ total += widgetRegistry.acqie[id].amount_paid.getFormattedValue();
+ totalPaidBox.attr('value', total);
}
@@ -207,7 +221,7 @@
var itemType = itemTypes.filter(function(t) { return (t.code() == item.inv_item_type()) })[0];
dojo.forEach(
- ['title', 'author', 'cost_billed'],
+ ['title', 'author', 'cost_billed', 'amount_paid'],
function(field) {
registerWidget(
item,
@@ -216,7 +230,7 @@
fmClass : 'acqii',
fmObject : item,
fmField : field,
- dijitArgs : (field == 'cost_billed') ? {required : true, style : 'width: 5em'} : null,
+ dijitArgs : (field == 'cost_billed' || field == 'amount_paid') ? {required : true, style : 'width: 5em'} : null,
parentNode : nodeByName(field, row)
})
)
@@ -225,8 +239,6 @@
/* ----------- fund -------------- */
- var itemType = itemTypes.filter(function(t) { return (t.code() == item.inv_item_type()) })[0];
-
var fundArgs = {
fmClass : 'acqii',
fmObject : item,
@@ -237,11 +249,11 @@
}
if(item.fund_debit()) {
- fundArgs.readOnly = true;
+ fundArgs.searchFilter = {'-or' : [{active : 't'}, {id : item.fund()}]};
} else {
fundArgs.searchFilter = {active : 't'}
if(itemType && openils.Util.isTrue(itemType.prorate()))
- fundArgs.disabled = true;
+ fundArgs.dijitArgs = {disabled : true};
}
var fundWidget = new openils.widget.AutoFieldWidget(fundArgs);
@@ -350,7 +362,7 @@
dojo.forEach(
- ['inv_item_count', 'phys_item_count', 'cost_billed'],
+ ['inv_item_count', 'phys_item_count', 'cost_billed', 'amount_paid'],
function(field) {
var dijitArgs = {required : true, constraints : {min: 0}, style : 'width:5em'};
if(entry.isnew() && field == 'phys_item_count') dijitArgs.value = numReceived;
@@ -402,7 +414,7 @@
return (attr) ? attr.attr_value() : '';
}
-function saveChanges() {
+function saveChanges(doProrate) {
progressDialog.show(true);
@@ -470,6 +482,8 @@
progressDialog.hide();
var invoice = openils.Util.readResponse(r);
if(invoice) {
+ if(doProrate)
+ return prorateInvoice();
location.href = oilsBasePath + '/acq/invoice/view/' + invoice.id();
}
}
@@ -477,11 +491,12 @@
);
}
-function processInvoice() {
+function prorateInvoice() {
+ if(!confirm(localeStrings.INVOICE_CONFIRM_PRORATE)) return;
progressDialog.show(true);
fieldmapper.standardRequest(
- ['open-ils.acq', 'open-ils.acq.invoice.process'],
+ ['open-ils.acq', 'open-ils.acq.invoice.apply_prorate'],
{
params : [openils.User.authtoken, invoice.id()],
oncomplete : function(r) {
Modified: trunk/Open-ILS/web/templates/default/acq/invoice/view.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/invoice/view.tt2 2010-04-09 13:00:12 UTC (rev 16191)
+++ trunk/Open-ILS/web/templates/default/acq/invoice/view.tt2 2010-04-09 13:00:13 UTC (rev 16192)
@@ -27,19 +27,22 @@
<!-- acq.invoice_entry -->
<thead>
<td colspan='3'>Title Details</td>
- <td># Items Invoiced / # Received</td>
+ <td># Invoiced / # Received</td>
<td>Amount Billed</td>
+ <td>Amount Paid</td>
<td>Detach</td>
</thead>
<tbody id='acq-invoice-entry-tbody'>
<tr id='acq-invoice-entry-template' class='acq-invoice-row'>
<td colspan='3'>
<div name='title_details'></div>
+ <div name='note'></div>
</td>
<td nowrap='nowrap'>
<span name='inv_item_count'></span> / <span name='phys_item_count'></span>
</td>
<td><div name='cost_billed'/></td>
+ <td><div name='amount_paid'/></td>
<td><a href='javascript:void(0);' name='detach'>Detach</a></td>
</tr>
</tbody>
@@ -57,6 +60,7 @@
<td>Author (optional)</td>
<td>Fund</td>
<td>Amount Billed</td>
+ <td>Amount Paid</td>
<td>Delete</td>
</thead>
<tbody id='acq-invoice-item-tbody'>
@@ -66,13 +70,14 @@
<td><div name='author'/></td>
<td><div name='fund'/></td>
<td><div name='cost_billed'/></td>
+ <td><div name='amount_paid'/></td>
<td><a href='javascript:void(0);' name='delete'>Delete</a></td>
</tr>
</tbody>
<tbody>
<tr>
<td colspan='0'>
- <a href='javascript:void(0);' id='acq-invoice-new-item'>Add Invoice Item...</a>
+ <a href='javascript:void(0);' id='acq-invoice-new-item'>Add Charge...</a>
</td>
</tr>
</tbody>
@@ -86,16 +91,18 @@
<thead>
<tr>
<td colspan='4'/>
- <td>Total Amount</td>
+ <td>Total Invoiced</td>
+ <td>Total Paid</td>
</tr>
</thead>
<tbody>
<tr>
<td colspan='4' style='text-align:right;'>
- <button dojoType='dijit.form.Button' onclick='saveChanges();'>Save & Continue</button>
- <button dojoType='dijit.form.Button' onclick='processInvoice();'>Process Invoice</button>
+ <button dojoType='dijit.form.Button' onclick='saveChanges();'>Save Changes</button>
+ <button dojoType='dijit.form.Button' onclick='saveChanges(true);'>Save & Prorate Charges</button>
</td>
<td><div id='acq-invoice-total-invoiced'/></td>
+ <td><div id='acq-invoice-total-paid'/></td>
</tr>
</tbody>
</table>
More information about the open-ils-commits
mailing list