]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/web/templates/default/acq/financial/view_fund.tt2
Merging acq-experiment to trunk, since rel_1_4 has been branched.
[working/Evergreen.git] / Open-ILS / web / templates / default / acq / financial / view_fund.tt2
1 [% WRAPPER 'default/base.tt2' %]
2 <script>
3     var fundID = [% ctx.page_args.0 %]
4     function getFundingSource(rowIndex) {
5         data = fundAllocationGrid.model.getRow(rowIndex);
6         if(data) {
7             var fs = openils.acq.FundingSource.retrieve(data.funding_source);
8             return '<a href="[% ctx.base_uri %]/acq/funding_source/view/'+fs.id()+'">'+fs.name()+'</a>';
9         }
10     }
11 </script>
12
13 <!-- load the page-specific JS -->
14 <script src='[% ctx.media_prefix %]/js/ui/default/acq/financial/view_fund.js'> </script>
15
16 <div id='oils-acq-list-header' class='container'>
17     <div id='oils-acq-list-header-label'>Fund Details</div>
18 </div>
19
20 <div class='oils-acq-actions-div' style='margin:8px;'> <!-- XXX CSS -->
21     <!-- Dropdown menu for creating a new funding source credit -->
22     <div dojoType="dijit.form.DropDownButton">
23         <span>Create Allocation</span>
24         <div dojoType="dijit.TooltipDialog" execute="createAllocation(arguments[0]);">
25             <script type='dojo/connect' event='onOpen'>
26                 openils.acq.FundingSource.createStore(
27                     function(store) {
28                         fundingSourceSelector.store = 
29                             new dojo.data.ItemFileReadStore({data:store});
30                         fundingSourceSelector.setValue(store.items[0].code);
31                     }, 'MANAGE_FUNDING_SOURCE'
32                 );
33             </script>
34             <table class='dijitTooltipTable'>
35                 <tr>
36                     <td><label for="amount">Funding Source: </label></td>
37                     <td>
38                         <input jsId='fundingSourceSelector' name="funding_source" 
39                             dojoType="dijit.form.FilteringSelect" searchAttr='code' labelAttr='code'>
40                         </input>
41                     </td>
42                 </tr>
43                 <tr>
44                     <td><label for="amount">Amount: </label></td>
45                     <td>
46                         <!-- XXX get currency from funding source ... -->
47                         <input dojoType="dijit.form.CurrencyTextBox" name="amount" currency='USD'> </input>
48                     </td>
49                 </tr>
50                 <tr>
51                     <td><label for="amount">Percent: </label></td>
52                     <td>
53                         <input 
54                             dojoType="dijit.form.NumberTextBox" 
55                             constraints="{min:0,max:100}" 
56                             promptMessage="Please enter an amount between 0 and 100"
57                             name="percent"> 
58                         </input>
59                     </td>
60                 </tr>
61                 <tr>
62                     <td><label for="note">Note: </label></td>
63                     <td>
64                         <input dojoType="dijit.form.TextBox" name="note"> </input>
65                     </td>
66                 </tr>
67                 <tr>
68                     <td colspan='2' align='center'>
69                         <button dojoType=dijit.form.Button type="submit">Apply</button>
70                     </td>
71                 </tr>
72             </table>
73         </div>
74     </div> 
75 </div>
76
77
78 <div dojoType="dijit.layout.ContentPane" layoutAlign="top">
79     <div dojoType="dijit.layout.TabContainer">
80         <div dojoType="dijit.layout.ContentPane" 
81                 class='oils-acq-detail-content-pane' title="Summary" selected='true'>
82             <script>
83                 /** Define the columns for the fund grid ----- */
84                 var fundGridLayout = [{
85                     cells : [[
86                         {name: 'ID', field: 'id'},
87                         {name: 'Name', field: "name", width:'auto'}, 
88                         {name: 'Code', field: "code"},
89                         {name: 'Currency Type', field: "currency_type"},
90                         {name: 'Owner', get:getOrgInfo}, 
91                         /*
92                         {name: 'Balance (Total - (Spent + Encumbrances))")}', get:getSummaryInfo},
93                         {name: 'Amount Allocated to this Fund")}', get:getSummaryInfo},
94                         {name: 'Spent Balance (Total - Spent)")}', get:getSummaryInfo},
95                         {name: 'Total Debits (Spent + Encumbered)")}', get:getSummaryInfo},
96                         */
97                         {name: 'Balance', get:getSummaryInfo, field:'combined_balance'},
98                         {name: 'Total Allocated', get:getSummaryInfo, field:'allocation_total'},
99                         {name: 'Spent Balance', get:getSummaryInfo, field:'spent_balance'},
100                         {name: 'Total Debits', get:getSummaryInfo, field:'debit_total'},
101                         {name: 'Total Spent', get:getSummaryInfo, field:'spent_total'},
102                         {name: 'Total Encumbered', get:getSummaryInfo, field:'encumbrance_total'}
103                     ]]
104                 }];
105             </script>
106             <div jsId='fundGrid' dojoType="dojox.Grid" structure='fundGridLayout'> </div>
107         </div>
108         <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="Allocations">
109             <script type='dojo/connect' event='onShow'>loadAllocationGrid();</script>
110             <script>
111                 /** Define the columns for the funding source allocations grid ----- */
112                 var fundAllocationGridLayout = [{
113                     cells : [[
114                         {name: 'ID', field: 'id'},
115                         {name: 'Funding Source', field: "fund", get:getFundingSource}, 
116                         {name: 'Amount', field: "amount"}, 
117                         {name: 'Percent', field: "percent"}, 
118                         {name: 'Allocated By', field: "allocator"}, 
119                         {name: 'Note', field: "note", width:'auto'}, 
120                     ]]
121                 }];
122             </script>
123             <div jsId='fundAllocationGrid' dojoType="dojox.Grid" structure='fundAllocationGridLayout'> </div>
124         </div>
125         <div dojoType="dijit.layout.ContentPane" class='oils-acq-detail-content-pane' title="Debits">
126             <script type='dojo/connect' event='onShow'>loadDebitGrid();</script>
127             <script>
128                 /** Define the columns for the funding source credits grid ----- */
129                 var fundDebitGridLayout = [{
130                     cells : [[
131                         {name: 'ID', field: 'id'},
132                         {name: 'Origin Amount', field: "origin_amount"}, 
133                         {name: 'Origin Currency Type', field: "origin_currency_type"}, 
134                         {name: 'Amount', field: "amount"}, 
135                         {name: 'Encumbrance', field: "encumbrance"}, 
136                         {name: 'Debit Type', field: "debit_type"}, 
137                         {name: 'Transfer Destination', field: "xfer_destination", get:getXferDest}, 
138                     ]]
139                 }];
140             </script>
141             <div jsId='fundDebitGrid' dojoType="dojox.Grid" structure='fundDebitGridLayout'> </div>
142         </div>
143     </div>
144 </div>
145 [% END %]