moved to auto-grid for allocations and debits for paging support, etc. hiding percen...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 30 Mar 2010 15:50:41 +0000 (15:50 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 30 Mar 2010 15:50:41 +0000 (15:50 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16056 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/fm_IDL.xml
Open-ILS/web/js/ui/default/acq/financial/view_fund.js
Open-ILS/web/templates/default/acq/financial/view_fund.tt2

index 77e4fb1..3e813f5 100644 (file)
@@ -4955,7 +4955,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <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>
index aedddf1..0813a59 100644 (file)
@@ -13,6 +13,7 @@ dojo.require('openils.Event');
 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 getSummaryInfo(rowIndex, item) {
 
 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 loadFundGrid() {
 
 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 @@ function fetchFund() {
         {   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();
index 4d183d1..836ca72 100644 (file)
@@ -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>
 
         <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>
 
 <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'>
             
                         <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> 
                             </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>
+
+        <!-- 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>
+
+        <!--- 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);