From: erickson Date: Fri, 9 Apr 2010 13:00:13 +0000 (+0000) Subject: plugged in amount paid columns and new total column for amount paid X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=87e96eaf4beb0e2795ea7aec64fd4dbeec42eeec;p=evergreen%2Fmasslnc.git plugged in amount paid columns and new total column for amount paid added some confirm dialogs git-svn-id: svn://svn.open-ils.org/ILS/trunk@16192 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/js/dojo/openils/acq/nls/acq.js b/Open-ILS/web/js/dojo/openils/acq/nls/acq.js index b4759e0866..69111224af 100644 --- a/Open-ILS/web/js/dojo/openils/acq/nls/acq.js +++ b/Open-ILS/web/js/dojo/openils/acq/nls/acq.js @@ -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' : "
${0}, by ${1} (${2})
PO: ${11}${3} Ordered, ${4} Received, ${7} Invoiced
Estimated Cost Per Item $${5} / Total Estimated Cost $${6}
", + 'INVOICE_CONFIRM_PRORATE' : "Prorate charges?\n\nAny subsequent changes to the invoice that would affect prorated amounts should be resolved manually.", 'UNNAMED': "Unnamed" } diff --git a/Open-ILS/web/js/ui/default/acq/invoice/view.js b/Open-ILS/web/js/ui/default/acq/invoice/view.js index f44b962ac4..cf1d1b31f6 100644 --- a/Open-ILS/web/js/ui/default/acq/invoice/view.js +++ b/Open-ILS/web/js/ui/default/acq/invoice/view.js @@ -25,7 +25,8 @@ var invoice; var itemTbody; var itemTemplate; var entryTemplate; -var totalAmountBox; +var totalInvoicedBox; +var totalPaidBox; var invoicePane; var itemTypes; var virtualId = -1; @@ -164,8 +165,8 @@ function doAttachPo() { 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 @@ function updateTotalCost() { 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 @@ function addInvoiceItem(item) { 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 @@ function addInvoiceItem(item) { 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 @@ function addInvoiceItem(item) { /* ----------- 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 @@ function addInvoiceItem(item) { } 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 @@ function addInvoiceEntry(entry) { 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 @@ function liMarcAttr(lineitem, name) { return (attr) ? attr.attr_value() : ''; } -function saveChanges() { +function saveChanges(doProrate) { progressDialog.show(true); @@ -470,6 +482,8 @@ function saveChanges() { 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 saveChanges() { ); } -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) { diff --git a/Open-ILS/web/templates/default/acq/invoice/view.tt2 b/Open-ILS/web/templates/default/acq/invoice/view.tt2 index 7112b15647..3368e6be72 100644 --- a/Open-ILS/web/templates/default/acq/invoice/view.tt2 +++ b/Open-ILS/web/templates/default/acq/invoice/view.tt2 @@ -27,19 +27,22 @@ Title Details - # Items Invoiced / # Received + # Invoiced / # Received Amount Billed + Amount Paid Detach
+
 / 
+
Detach @@ -57,6 +60,7 @@ Author (optional) Fund Amount Billed + Amount Paid Delete @@ -66,13 +70,14 @@
+
Delete - Add Invoice Item... + Add Charge... @@ -86,16 +91,18 @@ - Total Amount + Total Invoiced + Total Paid - - + +
+