From: erickson Date: Tue, 22 Apr 2008 00:58:09 +0000 (+0000) Subject: implemented fund allocations and debits tabs X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ee0ace8eac0e2193dc7c933f88c130e32b208580;p=Evergreen.git implemented fund allocations and debits tabs git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@9419 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html index f4bab2a232..1839b1c8f1 100644 --- a/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html +++ b/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html @@ -12,6 +12,9 @@ dojo.require('fieldmapper.Fieldmapper'); dojo.require('openils.User'); + var fundID = ${c.oils.acq.fund_id}; + var fund = null; + function getSummaryInfo(rowIndex) { switch(this.index) { case 4: return new String(fund.summary().combined_balance); @@ -29,21 +32,58 @@ return fieldmapper.aou.findOrgUnit(data.org).shortname(); } - var fundID = ${c.oils.acq.fund_id}; - var fund = null; + var fsCache = {}; + function getFundingSource(rowIndex) { + data = fundAllocationGrid.model.getRow(rowIndex); + if(!data) return; + var fsId = data.funding_source; + if(!fsCache[fsId]) { + fsCache[fsId] = fieldmapper.standardRequest( + ['open-ils.acq', 'open-ils.acq.funding_source.retrieve'], + [openils.User.authtoken, fsId] + ); + } + var name = fsCache[fsId].name(); + return ''+name+''; + } function loadFundGrid() { var store = new dojo.data.ItemFileReadStore({data:acqf.toStoreData([fund])}); - var model = new dojox.grid.data.DojoData(null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}}); + var model = new dojox.grid.data.DojoData( + null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}}); fundGrid.setModel(model); fundGrid.update(); } + function loadAllocationGrid() { + if(fundAllocationGrid.isLoaded) return; + var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fund.allocations())}); + var model = new dojox.grid.data.DojoData( + null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}}); + fundAllocationGrid.setModel(model); + fundAllocationGrid.update(); + fundAllocationGrid.isLoaded = true; + } + + function loadDebitGrid() { + if(fundDebitGrid.isLoaded) return; + var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fund.debits())}); + var model = new dojox.grid.data.DojoData( + null, store, {rowsPerPage: 20, clientSort: true, query:{id:'*'}}); + fundDebitGrid.setModel(model); + fundDebitGrid.update(); + fundDebitGrid.isLoaded = true; + } + function fetchFund() { fieldmapper.standardRequest( ['open-ils.acq', 'open-ils.acq.fund.retrieve'], { async: true, - params: [openils.User.authtoken, fundID, {flesh_summary:1}], + params: [ + openils.User.authtoken, fundID, + {flesh_summary:1, flesh_allocations:1, flesh_debits:1} + /* TODO grab allocations and debits only on as-needed basis */ + ], oncomplete: function(r) { fund = r.recv().content(); loadFundGrid(fund); @@ -65,7 +105,8 @@
-
+
+
+ + +
+
+
+ + +
+