[open-ils-commits] r16193 - in trunk/Open-ILS/web: css/skin/default 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:48:50 EDT 2010
Author: erickson
Date: 2010-04-09 09:48:48 -0400 (Fri, 09 Apr 2010)
New Revision: 16193
Modified:
trunk/Open-ILS/web/css/skin/default/acq.css
trunk/Open-ILS/web/js/ui/default/acq/invoice/view.js
trunk/Open-ILS/web/templates/default/acq/invoice/view.tt2
Log:
when amount paid exceeds amount billed, disable save/prorate buttons and style the amount paid box. if either paid/billed are < 0, style their respective boxes
Modified: trunk/Open-ILS/web/css/skin/default/acq.css
===================================================================
--- trunk/Open-ILS/web/css/skin/default/acq.css 2010-04-09 13:00:13 UTC (rev 16192)
+++ trunk/Open-ILS/web/css/skin/default/acq.css 2010-04-09 13:48:48 UTC (rev 16193)
@@ -221,3 +221,5 @@
.acq-inoice-item-extra-info { padding-left: 10px; }
.acq-inoice-item-info { font-weight: bold; }
.acq-invoice-row td { border-bottom: 1px solid #e0e0e0; }
+.acq-invoice-invalid-amount input { color: red; font-weight: bold; }
+
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:13 UTC (rev 16192)
+++ trunk/Open-ILS/web/js/ui/default/acq/invoice/view.js 2010-04-09 13:48:48 UTC (rev 16193)
@@ -164,31 +164,56 @@
}
function updateTotalCost() {
- var total = 0;
+
+ var totalCost = 0;
if(!totalInvoicedBox) {
totalInvoicedBox = new dijit.form.CurrencyTextBox(
{style : 'width: 5em'}, dojo.byId('acq-invoice-total-invoiced'));
}
for(var id in widgetRegistry.acqii)
if(!widgetRegistry.acqii[id]._object.isdeleted())
- total += widgetRegistry.acqii[id].cost_billed.getFormattedValue();
+ totalCost += widgetRegistry.acqii[id].cost_billed.getFormattedValue();
for(var id in widgetRegistry.acqie)
if(!widgetRegistry.acqie[id]._object.isdeleted())
- total += widgetRegistry.acqie[id].cost_billed.getFormattedValue();
- totalInvoicedBox.attr('value', total);
+ totalCost += widgetRegistry.acqie[id].cost_billed.getFormattedValue();
+ totalInvoicedBox.attr('value', totalCost);
- total = 0;
+ totalPaid = 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();
+ totalPaid += 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);
+ totalPaid += widgetRegistry.acqie[id].amount_paid.getFormattedValue();
+ totalPaidBox.attr('value', totalPaid);
+
+ var buttonsDisabled = false;
+ if(totalPaid > totalCost || totalPaid < 0) {
+ openils.Util.addCSSClass(totalPaidBox.domNode, 'acq-invoice-invalid-amount');
+ invoiceSaveButton.attr('disabled', true);
+ invoiceProrateButton.attr('disabled', true);
+ buttonsDisabled = true;
+ } else {
+ openils.Util.removeCSSClass(totalPaidBox.domNode, 'acq-invoice-invalid-amount');
+ invoiceSaveButton.attr('disabled', false);
+ invoiceProrateButton.attr('disabled', false);
+ }
+
+ if(totalCost < 0) {
+ openils.Util.addCSSClass(totalInvoicedBox.domNode, 'acq-invoice-invalid-amount');
+ invoiceSaveButton.attr('disabled', true);
+ invoiceProrateButton.attr('disabled', true);
+ } else {
+ openils.Util.removeCSSClass(totalInvoicedBox.domNode, 'acq-invoice-invalid-amount');
+ if(!buttonsDisabled) {
+ invoiceSaveButton.attr('disabled', false);
+ invoiceProrateButton.attr('disabled', false);
+ }
+ }
}
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:13 UTC (rev 16192)
+++ trunk/Open-ILS/web/templates/default/acq/invoice/view.tt2 2010-04-09 13:48:48 UTC (rev 16193)
@@ -98,8 +98,10 @@
<tbody>
<tr>
<td colspan='4' style='text-align:right;'>
- <button dojoType='dijit.form.Button' onclick='saveChanges();'>Save Changes</button>
- <button dojoType='dijit.form.Button' onclick='saveChanges(true);'>Save & Prorate Charges</button>
+ <button jsId='invoiceSaveButton'
+ dojoType='dijit.form.Button' onclick='saveChanges();'>Save Changes</button>
+ <button jsId='invoiceProrateButton'
+ 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>
More information about the open-ils-commits
mailing list