From 22137a1dac94cdd3d7dccfb164ace723f65c17b8 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 30 Mar 2010 16:41:18 +0000 Subject: [PATCH] moved to auto-grid for view funding-source UI (for paging, etc.). added pcrud entries for funding_source credits git-svn-id: svn://svn.open-ils.org/ILS/trunk@16060 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/fm_IDL.xml | 18 +++- .../acq/financial/view_funding_source.js | 34 ++++--- .../acq/financial/view_funding_source.tt2 | 91 ++++++++++--------- 3 files changed, 85 insertions(+), 58 deletions(-) diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 3e813f5c63..30f5ddef34 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -4918,7 +4918,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - + @@ -4930,6 +4930,22 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + + + + + + + + + + + + + + + + diff --git a/Open-ILS/web/js/ui/default/acq/financial/view_funding_source.js b/Open-ILS/web/js/ui/default/acq/financial/view_funding_source.js index ca220ff766..e847dec381 100644 --- a/Open-ILS/web/js/ui/default/acq/financial/view_funding_source.js +++ b/Open-ILS/web/js/ui/default/acq/financial/view_funding_source.js @@ -11,6 +11,7 @@ dojo.require('openils.acq.FundingSource'); dojo.require('openils.acq.Fund'); dojo.require('openils.Event'); dojo.require('openils.Util'); +dojo.require('openils.widget.AutoGrid'); var ses = new OpenSRF.ClientSession('open-ils.acq'); var fundingSource = null; @@ -22,6 +23,12 @@ function resetPage() { loadFS(); } +function getFund(rowIndex, item) { + return ''; + //return ''+fund.code()+''; +} + + /** creates a new funding_source_credit from the dialog ----- */ function applyFSCredit(fields) { fields.funding_source = fundingSourceID; @@ -30,7 +37,6 @@ function applyFSCredit(fields) { function applyFSAllocation(fields) { fields.funding_source = fundingSourceID; - if(isNaN(fields.percent)) fields.percent = null; if(isNaN(fields.amount)) fields.amount = null; openils.acq.Fund.createAllocation(fields, resetPage); } @@ -68,11 +74,23 @@ function getSummaryInfo(rowIndex) { return new String(fundingSource.summary()[this.field]); } +function getFund(rowIndex, item) { + if(item) { + var fId = this.grid.store.getValue(item, 'fund'); + return openils.acq.Fund.retrieve(fId); + } +} + +function formatFund(fund) { + if(fund) { + return ''+fund.code()+''; + } +} + /** builds the credits grid ----- */ function loadFSGrid() { if(!fundingSource) return; var store = new dojo.data.ItemFileReadStore({data:acqfs.toStoreData([fundingSource])}); - fundingSourceGrid.setStore(store); fundingSourceGrid.render(); } @@ -81,21 +99,13 @@ function loadFSGrid() { /** builds the credits grid ----- */ function loadCreditGrid() { if(fsCreditGrid.isLoaded) return; - - var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fundingSource.credits())}); - - fsCreditGrid.setStore(store); - fsCreditGrid.render(); + fsCreditGrid.loadAll({order_by : {acqfscred : 'effective_date DESC'}}); fsCreditGrid.isLoaded = true; } -/** builds the allocations grid ----- */ function loadAllocationGrid() { if(fsAllocationGrid.isLoaded) return; - var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fundingSource.allocations())}); - - fsAllocationGrid.setStore(store); - fsAllocationGrid.render(); + fsAllocationGrid.loadAll({order_by : {acqfa : 'create_time DESC'}}); fsAllocationGrid.isLoaded = true; } diff --git a/Open-ILS/web/templates/default/acq/financial/view_funding_source.tt2 b/Open-ILS/web/templates/default/acq/financial/view_funding_source.tt2 index 27518142e8..51f64d0ee5 100644 --- a/Open-ILS/web/templates/default/acq/financial/view_funding_source.tt2 +++ b/Open-ILS/web/templates/default/acq/financial/view_funding_source.tt2 @@ -1,14 +1,5 @@ [% WRAPPER 'default/base.tt2' %] - + @@ -27,18 +18,13 @@ - - + - @@ -73,10 +59,10 @@ - - + + @@ -106,6 +93,7 @@
+
@@ -127,43 +115,56 @@
+
- + +
-
- - - - - - - - -
IDAmountNote
+
+ + +
- +
+ +
- + +
-
- - - - - - - - - - - -
IDFundAmountPercentAllocated ByNote
+
+ + + + + + + +
+
+
-- 2.43.2