1 dojo.require("dijit.Dialog");
2 dojo.require('dijit.form.FilteringSelect');
3 dojo.require('dijit.layout.TabContainer');
4 dojo.require('dijit.layout.ContentPane');
5 dojo.require('dojox.grid.DataGrid');
6 dojo.require('dijit.form.CurrencyTextBox');
7 dojo.require('dojo.data.ItemFileReadStore');
8 dojo.require("fieldmapper.OrgUtils");
9 dojo.require('openils.acq.Fund');
10 dojo.require('openils.acq.FundingSource');
11 dojo.require('openils.Event');
12 dojo.require('openils.User');
13 dojo.require('openils.Util');
18 function getSummaryInfo(rowIndex, item) {
20 return new String(fund.summary()[this.field]);
23 function createAllocation(fields) {
25 if(isNaN(fields.percent)) fields.percent = null;
26 if(isNaN(fields.amount)) fields.amount = null;
27 openils.acq.Fund.createAllocation(fields,
28 function(r){location.href = location.href;});
30 function getOrgInfo(rowIndex, item) {
32 var owner = this.grid.store.getValue(item, 'org');
33 return fieldmapper.aou.findOrgUnit(owner).shortname();
37 function getXferDest(rowIndex, item) {
39 var xfer_destination = this.grid.store.getValue(item, 'xfer_destination');
40 if(!(item && xfer_destination)) return '';
41 return xfer_destination;
44 function loadFundGrid() {
45 var store = new dojo.data.ItemFileReadStore({data:acqf.toStoreData([fund])});
46 fundGrid.setStore(store);
50 function loadAllocationGrid() {
51 if(fundAllocationGrid.isLoaded) return;
52 var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fund.allocations())});
53 fundAllocationGrid.setStore(store);
54 fundAllocationGrid.render();
55 fundAllocationGrid.isLoaded = true;
58 function loadDebitGrid() {
59 if(fundDebitGrid.isLoaded) return;
60 var store = new dojo.data.ItemFileReadStore({data:acqfa.toStoreData(fund.debits())});
61 fundDebitGrid.setStore(store);
62 fundDebitGrid.render();
63 fundDebitGrid.isLoaded = true;
66 function fetchFund() {
67 fieldmapper.standardRequest(
68 ['open-ils.acq', 'open-ils.acq.fund.retrieve'],
71 openils.User.authtoken, fundID,
72 {flesh_summary:1, flesh_allocations:1, flesh_debits:1, flesh_tags:1}
73 /* TODO grab allocations and debits only on as-needed basis */
75 oncomplete: function(r) {
76 fund = r.recv().content();
84 tagManager = new TagManager(dojo.byId("oils-acq-tag-manager-display"));
85 tagManager.prepareTagSelector(tagSelector);
89 openils.Util.addOnLoad(load);