[open-ils-commits] r16172 - in trunk/Open-ILS/web: css/skin/default 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
Thu Apr 8 12:45:46 EDT 2010


Author: erickson
Date: 2010-04-08 12:45:42 -0400 (Thu, 08 Apr 2010)
New Revision: 16172

Modified:
   trunk/Open-ILS/web/css/skin/default/acq.css
   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:
show more lineitem data in the invoice title list
plugged in invoice process call.
equalized some fleshing on the po fetch side

Modified: trunk/Open-ILS/web/css/skin/default/acq.css
===================================================================
--- trunk/Open-ILS/web/css/skin/default/acq.css	2010-04-08 16:45:41 UTC (rev 16171)
+++ trunk/Open-ILS/web/css/skin/default/acq.css	2010-04-08 16:45:42 UTC (rev 16172)
@@ -218,3 +218,6 @@
 .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; }

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-08 16:45:41 UTC (rev 16171)
+++ trunk/Open-ILS/web/js/dojo/openils/acq/nls/acq.js	2010-04-08 16:45:42 UTC (rev 16172)
@@ -59,5 +59,6 @@
     'INVOICE_ITEM_DETAILS' : "${0} <br/> ${1} <br/> ${2}. <br/> Estimated Price: $${3}. <br/> Lineitem ID: ${4} <br/> PO: ${5} <br/> 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' : "<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>",
     '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-08 16:45:41 UTC (rev 16171)
+++ trunk/Open-ILS/web/js/ui/default/acq/invoice/view.js	2010-04-08 16:45:42 UTC (rev 16172)
@@ -104,6 +104,8 @@
                 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 @@
         {   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 @@
     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 @@
                     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 @@
         updateTotalCost();
     }
 
-
     entryTbody.appendChild(row);
     updateTotalCost();
 }
@@ -453,8 +477,27 @@
     );
 }
 
+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);
 
 

Modified: trunk/Open-ILS/web/templates/default/acq/invoice/view.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/invoice/view.tt2	2010-04-08 16:45:41 UTC (rev 16171)
+++ trunk/Open-ILS/web/templates/default/acq/invoice/view.tt2	2010-04-08 16:45:42 UTC (rev 16172)
@@ -26,23 +26,16 @@
             </tbody>
             <!-- acq.invoice_entry -->
             <thead>
-                <td>ISBN/UPC/ISSN</td>
-                <td>Title</td>
-                <td>Author</td>
+                <td colspan='3'>Title Details</td>
                 <td># Items Invoiced / # Received</td>
                 <td>Amount Billed</td>
                 <td>Detach</td>
             </thead>
             <tbody id='acq-invoice-entry-tbody'>
-                <tr id='acq-invoice-entry-template'>
-                    <td><div name='idents'/></td>
-                    <td>
-                        <span name='title'></span> 
-                        <span name='purchase_order_span' class='hidden'>
-                            (PO: <a href='javascript:void(0);' name='purchase_order'></a>)
-                        </span>
+                <tr id='acq-invoice-entry-template' class='acq-invoice-row'>
+                    <td colspan='3'>
+                        <div name='title_details'></div>
                     </td>
-                    <td><div name='author'/></td>
                     <td nowrap='nowrap'>
                         <span name='inv_item_count'></span>&nbsp;/&nbsp;<span name='phys_item_count'></span>
                     </td>
@@ -67,7 +60,7 @@
                 <td>Delete</td>
             </thead>
             <tbody id='acq-invoice-item-tbody'>
-                <tr id='acq-invoice-item-template'>
+                <tr id='acq-invoice-item-template' class='acq-invoice-row acq-invoice-item-row'>
                     <td><div name='inv_item_type'/></td>
                     <td><div name='title'/></td>
                     <td><div name='author'/></td>



More information about the open-ils-commits mailing list