From: erickson Date: Thu, 8 Apr 2010 16:45:42 +0000 (+0000) Subject: show more lineitem data in the invoice title list X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=77d99717afdec0cf54690e7ea3af1de691bee127;p=evergreen%2Fmasslnc.git show more lineitem data in the invoice title list plugged in invoice process call. equalized some fleshing on the po fetch side git-svn-id: svn://svn.open-ils.org/ILS/trunk@16172 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/css/skin/default/acq.css b/Open-ILS/web/css/skin/default/acq.css index ea0dea1aa0..aa942c8598 100644 --- a/Open-ILS/web/css/skin/default/acq.css +++ b/Open-ILS/web/css/skin/default/acq.css @@ -218,3 +218,6 @@ option[disabled="disabled"] { font-style: italic; } .acq-unified-terms-match { width: 15%; } .acq-unified-terms-remove { width: 5%; text-align: right; } .acq-unified-remover { color: #c00; } +.acq-inoice-item-extra-info { padding-left: 10px; } +.acq-inoice-item-info { font-weight: bold; } +.acq-invoice-row td { border-bottom: 1px solid #e0e0e0; } 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 e6a6e17edd..b4759e0866 100644 --- a/Open-ILS/web/js/dojo/openils/acq/nls/acq.js +++ b/Open-ILS/web/js/dojo/openils/acq/nls/acq.js @@ -59,5 +59,6 @@ 'INVOICE_ITEM_DETAILS' : "${0}
${1}
${2}.
Estimated Price: $${3}.
Lineitem ID: ${4}
PO: ${5}
Order Date: ${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}
", '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 d39cf37cdc..f44b962ac4 100644 --- a/Open-ILS/web/js/ui/default/acq/invoice/view.js +++ b/Open-ILS/web/js/ui/default/acq/invoice/view.js @@ -104,6 +104,8 @@ function doAttachLi() { clear_marc : true, flesh_attrs : true, flesh_po : true, + flesh_li_details : true, + flesh_fund_debit : true }], oncomplete: function(r) { lineitem = openils.Util.readResponse(r); @@ -131,7 +133,9 @@ function doAttachPo() { { async: true, params: [openils.User.authtoken, attachPo, { flesh_lineitems : true, - clear_marc : true + clear_marc : true, + flesh_lineitem_details : true, + flesh_fund_debit : true }], oncomplete: function(r) { var po = openils.Util.readResponse(r); @@ -313,22 +317,43 @@ function addInvoiceEntry(entry) { if(liMarcAttr(lineitem, 'upc')) idents.push(liMarcAttr(lineitem, 'upc')); if(liMarcAttr(lineitem, 'issn')) idents.push(liMarcAttr(lineitem, 'issn')); - nodeByName('title', row).innerHTML = liMarcAttr(lineitem, 'title'); - nodeByName('author', row).innerHTML = liMarcAttr(lineitem, 'author'); - nodeByName('idents', row).innerHTML = idents.join(','); + var lids = lineitem.lineitem_details(); + var numOrdered = lids.length; + var numReceived = lids.filter(function(lid) { return (lid.recv_time() != null) }).length; + var numInvoiced = lids.filter(function(lid) { return !openils.Util.isTrue(lid.fund_debit().encumbrance()) }).length; + var poName = ''; + var poId = ''; var po = entry.purchase_order(); if(po) { - openils.Util.show(nodeByName('purchase_order_span', row), 'inline'); - nodeByName('purchase_order', row).innerHTML = po.name(); - nodeByName('purchase_order', row).onclick = function() { - location.href = oilsBasePath + '/acq/po/view/ ' + po.id(); - } + poName = po.name(); + poId = po.id(); } + nodeByName('title_details', row).innerHTML = + dojo.string.substitute( + localeStrings.INVOICE_TITLE_DETAILS, [ + liMarcAttr(lineitem, 'title'), + liMarcAttr(lineitem, 'author'), + idents.join(','), + numOrdered, + numReceived, + Number(lineitem.estimated_unit_price()).toFixed(2), + (Number(lineitem.estimated_unit_price()) * numOrdered).toFixed(2), + numInvoiced, + lineitem.id(), + oilsBasePath, + poId, + poName + ] + ); + + dojo.forEach( ['inv_item_count', 'phys_item_count', 'cost_billed'], function(field) { + var dijitArgs = {required : true, constraints : {min: 0}, style : 'width:5em'}; + if(entry.isnew() && field == 'phys_item_count') dijitArgs.value = numReceived; registerWidget( entry, field, @@ -336,7 +361,7 @@ function addInvoiceEntry(entry) { fmObject : entry, fmClass : 'acqie', fmField : field, - dijitArgs : {required : true, constraints : {min: 0}, style : 'width:5em'}, + dijitArgs : dijitArgs, parentNode : nodeByName(field, row) }) ); @@ -361,7 +386,6 @@ function addInvoiceEntry(entry) { updateTotalCost(); } - entryTbody.appendChild(row); updateTotalCost(); } @@ -453,6 +477,25 @@ function saveChanges() { ); } +function processInvoice() { + progressDialog.show(true); + + fieldmapper.standardRequest( + ['open-ils.acq', 'open-ils.acq.invoice.process'], + { + params : [openils.User.authtoken, invoice.id()], + oncomplete : function(r) { + progressDialog.hide(); + var invoice = openils.Util.readResponse(r); + if(invoice) { + location.href = oilsBasePath + '/acq/invoice/view/' + invoice.id(); + } + } + } + ); + +} + openils.Util.addOnLoad(init); diff --git a/Open-ILS/web/templates/default/acq/invoice/view.tt2 b/Open-ILS/web/templates/default/acq/invoice/view.tt2 index af8c2b92c7..7112b15647 100644 --- a/Open-ILS/web/templates/default/acq/invoice/view.tt2 +++ b/Open-ILS/web/templates/default/acq/invoice/view.tt2 @@ -26,23 +26,16 @@ - ISBN/UPC/ISSN - Title - Author + Title Details # Items Invoiced / # Received Amount Billed Detach - -
- - - + + +
-
 /  @@ -67,7 +60,7 @@ Delete - +