[open-ils-commits] r16056 - in trunk/Open-ILS: examples web/js/ui/default/acq/financial web/templates/default/acq/financial (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Mar 30 11:50:44 EDT 2010


Author: erickson
Date: 2010-03-30 11:50:41 -0400 (Tue, 30 Mar 2010)
New Revision: 16056

Modified:
   trunk/Open-ILS/examples/fm_IDL.xml
   trunk/Open-ILS/web/js/ui/default/acq/financial/view_fund.js
   trunk/Open-ILS/web/templates/default/acq/financial/view_fund.tt2
Log:
moved to auto-grid for allocations and debits for paging support, etc.  hiding percent-based allocation option for now since they are not supported by the back-end

Modified: trunk/Open-ILS/examples/fm_IDL.xml
===================================================================
--- trunk/Open-ILS/examples/fm_IDL.xml	2010-03-30 14:51:10 UTC (rev 16055)
+++ trunk/Open-ILS/examples/fm_IDL.xml	2010-03-30 15:50:41 UTC (rev 16056)
@@ -4955,7 +4955,7 @@
 			<field reporter:label="Origin Amount" name="origin_amount" reporter:datatype="money" />
 			<field reporter:label="Origin Currency" name="origin_currency_type" reporter:datatype="link" />
 			<field reporter:label="Amount" name="amount" reporter:datatype="money" />
-			<field reporter:label="Encumbrance" name="encumbrance" reporter:datatype="text" />
+			<field reporter:label="Encumbrance" name="encumbrance" reporter:datatype="bool" />
 			<field reporter:label="Debit Type" name="debit_type" reporter:datatype="text" />
 			<field reporter:label="Create Time" name="create_time" reporter:datatype="timestamp" />
 		</fields>

Modified: trunk/Open-ILS/web/js/ui/default/acq/financial/view_fund.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/acq/financial/view_fund.js	2010-03-30 14:51:10 UTC (rev 16055)
+++ trunk/Open-ILS/web/js/ui/default/acq/financial/view_fund.js	2010-03-30 15:50:41 UTC (rev 16056)
@@ -13,6 +13,7 @@
 dojo.require('openils.User');
 dojo.require('openils.Util');
 dojo.require("openils.widget.AutoFieldWidget");
+dojo.require("openils.widget.AutoGrid");
 
 var fund = null;
 var tagManager;
@@ -25,7 +26,6 @@
 
 function createAllocation(fields) {
     fields.fund = fundID;
-    if(isNaN(fields.percent)) fields.percent = null;
     if(isNaN(fields.amount)) fields.amount = null;
     openils.acq.Fund.createAllocation(fields, 
         function(r){location.href = location.href;});
@@ -52,17 +52,13 @@
 
 function loadAllocationGrid() {
     if(fundAllocationGrid.isLoaded) return;
-    var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fund.allocations())});
-    fundAllocationGrid.setStore(store);
-    fundAllocationGrid.render();
+    fundAllocationGrid.loadAll({order_by : {acqfa :  'create_time DESC'}});
     fundAllocationGrid.isLoaded = true;
 }
 
 function loadDebitGrid() {
     if(fundDebitGrid.isLoaded) return;
-    var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fund.debits())});
-    fundDebitGrid.setStore(store);
-    fundDebitGrid.render();
+    fundDebitGrid.loadAll({order_by : {acqfdeb :  'create_time DESC'}});
     fundDebitGrid.isLoaded = true;
 }
 
@@ -72,8 +68,7 @@
         {   async: true,
             params: [
                 openils.User.authtoken, fundID, 
-                {flesh_summary:1, flesh_allocations:1, flesh_debits:1, flesh_tags:1} 
-                /* TODO grab allocations and debits only on as-needed basis */
+                {flesh_summary:1, flesh_tags:1} 
             ],
             oncomplete: function(r) {
                 fund = r.recv().content();

Modified: trunk/Open-ILS/web/templates/default/acq/financial/view_fund.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/acq/financial/view_fund.tt2	2010-03-30 14:51:10 UTC (rev 16055)
+++ trunk/Open-ILS/web/templates/default/acq/financial/view_fund.tt2	2010-03-30 15:50:41 UTC (rev 16056)
@@ -2,10 +2,10 @@
 <script>
     var fundID = [% ctx.page_args.0 %]
     function getFundingSource(rowIndex, item) {
-    if(!item) return ''; 
-    var fs_id = this.grid.store.getValue(item, 'funding_source');
-    var fs = openils.acq.FundingSource.retrieve(fs_id);
-    return '<a href="[% ctx.base_path %]/acq/funding_source/view/'+fs.id()+'">'+fs.name()+'</a>';
+        if(!item) return ''; 
+        var fs_id = this.grid.store.getValue(item, 'funding_source');
+        var fs = openils.acq.FundingSource.retrieve(fs_id);
+        return '<a href="[% ctx.base_path %]/acq/funding_source/view/'+fs.id()+'">'+fs.name()+'</a>';
     }
 </script>
 
@@ -24,11 +24,12 @@
         <div dojoType="dijit.TooltipDialog" execute="createAllocation(arguments[0]);">
             <script type='dojo/connect' event='onOpen'>
                 openils.acq.FundingSource.createStore(
-                function(store) {
-                    fundingSourceSelector.store = 
-                    new dojo.data.ItemFileReadStore({data:store});
-                    fundingSourceSelector.setValue(store.items[0].code);
-                    }, 'MANAGE_FUNDING_SOURCE'
+                    function(store) {
+                        fundingSourceSelector.store = 
+                            new dojo.data.ItemFileReadStore({data:store});
+                            fundingSourceSelector.setValue(store.items[0].code);
+                    }, 
+                    'MANAGE_FUNDING_SOURCE'
                 );
             </script>
             <table class='dijitTooltipTable'>
@@ -47,6 +48,8 @@
                         <input dojoType="dijit.form.CurrencyTextBox" name="amount" currency='USD'> </input>
                     </td>
                 </tr>
+
+                <!-- Percent-based allocations are not supported.  Will implement or remove later.
                 <tr>
                     <td><label for="amount">Percent: </label></td>
                     <td>
@@ -58,6 +61,8 @@
                         </input>
                     </td>
                 </tr>
+                -->
+
                 <tr>
                     <td><label for="note">Note: </label></td>
                     <td>
@@ -155,6 +160,8 @@
 
 <div dojoType="dijit.layout.ContentPane" layoutAlign="top">
     <div dojoType="dijit.layout.TabContainer">
+
+        <!-- Fund Summary -->
         <div dojoType="dijit.layout.ContentPane" 
              class='oils-acq-detail-content-pane' title="Summary" selected='true'>
             
@@ -164,7 +171,7 @@
                         <thead> 
                             <tr> 
                                 <th field="id">ID</th> 
-                                <th field="name" width='auto'>Name</th> 
+                                <th field="name">Name</th> 
                                 <th field="code">Code</th> 
                                 <th field="currency_type">Currency Type</th> 
                                 <th field="org" get='getOrgInfo'>Owner</th> 
@@ -177,59 +184,54 @@
                             </tr> 
                         </thead> 
                     </table>     
-               
-            <!--
-            {name: 'Balance (Total - (Spent + Encumbrances))")}', get:getSummaryInfo},
-            {name: 'Amount Allocated to this Fund")}', get:getSummaryInfo},
-            {name: 'Spent Balance (Total - Spent)")}', get:getSummaryInfo},
-            {name: 'Total Debits (Spent + Encumbered)")}', get:getSummaryInfo},
-            -->
+                </div>
+            </div>
+        </div>
 
-        </div>
-    </div>
-</div>
+        <!-- Fund Allocations -->
         <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="Allocations">
             <script type='dojo/connect' event='onShow'>loadAllocationGrid();</script>
             
             <div dojoType="dijit.layout.ContentPane" layoutAlign="top"> 
-                <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'> 
-                    <table jsId="fundAllocationGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'> 
-                        <thead> 
-                            <tr> 
-                                <th field="id">ID</th> 
-                                <th field="funding_source" get='getFundingSource'>Funding Source</th> 
-                                <th field="amount">Amount</th> 
-                                <th field="percent">Percent</th> 
-                                <th field="allocator">Allocated By</th> 
-                                <th field="note" width='auto'>Note</th> 
-                            </tr> 
-                        </thead> 
-                    </table>     
+                <div dojoType="dijit.layout.ContentPane" layoutAlign="client"> 
+
+                    <table 
+                        jsId="fundAllocationGrid" 
+                        autoHeight='true'
+                        dojoType="openils.widget.AutoGrid"
+                        fieldOrder="['funding_source', 'amount', 'create_time', 'allocator', 'note']"
+                        suppressFields="['id', 'fund']"
+                        defaultCellWidth='"auto"'
+                        fmClass="acqfa"
+                        query="{id: '*'}"
+                        showPaginator='true'>
+                    </table>
                 </div> 
             </div> 
+        </div>
 
-        </div>
+        <!--- Fund Debits -->
         <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="Debits">
             <script type='dojo/connect' event='onShow'>loadDebitGrid();</script>
             
-            <div dojoType="dijit.layout.ContentPane" layoutAlign="top"> 
-                <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'> 
-                    <table jsId="fundDebitGrid" dojoType="dojox.grid.DataGrid" query="{id: '*'}" rowSelector='20px'> 
-                        <thead> 
-                            <tr> 
-                                <th field="id">ID</th> 
-                                <th field="origin_amount">Origin Amount</th> 
-                                <th field="origin_currency_type">Origin Currency Type</th> 
-                                <th field="amount">Amount</th> 
-                                <th field="encumbrance">Encumbrance</th> 
-                                <th field="debit_type">Debit Type</th>
-                                <th field="xfer_destination" get='getXferDestination'>Transfer Destination</th> 
-                            </tr> 
-                        </thead> 
-                    </table>     
+            <div dojoType="dijit.layout.ContentPane" layoutAlign="top" style='height:600px;'> 
+                <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
+
+                    <table 
+                        jsId="fundDebitGrid" 
+                        autoHeight='true'
+                        dojoType="openils.widget.AutoGrid"
+                        fieldOrder="['amount', 'encumbrance', 'debit_type', 'origin_amount', 'origin_currency_type']"
+                        suppressFields="['id', 'fund']"
+                        defaultCellWidth='"auto"'
+                        fmClass="acqfdeb"
+                        query="{id: '*'}"
+                        showPaginator='true'>
+                    </table>
                 </div> 
             </div> 
         </div>
+
         <div dojoType="dijit.layout.ContentPane" class="oils-acq-detail-content-pane" title="Tags">
             <script type="dojo/connect" event="onShow">
                 tagManager.displayFund(fund);



More information about the open-ils-commits mailing list