show more lineitem data in the invoice title list
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 8 Apr 2010 16:45:42 +0000 (16:45 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 8 Apr 2010 16:45:42 +0000 (16:45 +0000)
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

Open-ILS/web/css/skin/default/acq.css
Open-ILS/web/js/dojo/openils/acq/nls/acq.js
Open-ILS/web/js/ui/default/acq/invoice/view.js
Open-ILS/web/templates/default/acq/invoice/view.tt2

index ea0dea1..aa942c8 100644 (file)
@@ -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; }
index e6a6e17..b4759e0 100644 (file)
@@ -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"
 }
index d39cf37..f44b962 100644 (file)
@@ -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);
index af8c2b9..7112b15 100644 (file)
             </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>