[open-ils-commits] r8735 - in branches/acq-experiment/Open-ILS: src/perlmods/OpenILS/Application/Acq web/oilsweb/oilsweb/controllers/acq web/oilsweb/oilsweb/templates/oils/default/acq/financial

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Feb 12 18:53:38 EST 2008


Author: erickson
Date: 2008-02-12 18:24:17 -0500 (Tue, 12 Feb 2008)
New Revision: 8735

Modified:
   branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py
   branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html
Log:
added some fund and funding_source fleshing flags.  showing basic allocation summary info on the fund page

Modified: branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm
===================================================================
--- branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm	2008-02-12 18:04:08 UTC (rev 8734)
+++ branches/acq-experiment/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm	2008-02-12 23:24:17 UTC (rev 8735)
@@ -83,9 +83,11 @@
     my($self, $conn, $auth, $funding_source_id, $options) = @_;
     my $e = new_editor(authtoken=>$auth);
     return $e->event unless $e->checkauth;
+
     my $flesh = {flesh => 1, flesh_fields => {acqfs => []}};
     push(@{$flesh->{flesh_fields}->{acqfs}}, 'credits') if $$options{flesh_credits};
     push(@{$flesh->{flesh_fields}->{acqfs}}, 'allocations') if $$options{flesh_allocations};
+
     my $funding_source = $e->retrieve_acq_funding_source([$funding_source_id, $flesh]) or return $e->event;
     return $e->event unless $e->allowed(
         ['ADMIN_FUNDING_SOURCE','MANAGE_FUNDING_SOURCE'], $funding_source->owner, $funding_source); 
@@ -244,9 +246,10 @@
     my $e = new_editor(authtoken=>$auth);
     return $e->event unless $e->checkauth;
 
-    my $flesh = {flesh => 1, flesh_fields => {acqf => []}};
+    my $flesh = {flesh => 2, flesh_fields => {acqf => []}};
     push(@{$flesh->{flesh_fields}->{acqf}}, 'debits') if $$options{flesh_debits};
     push(@{$flesh->{flesh_fields}->{acqf}}, 'allocations') if $$options{flesh_allocations};
+    push(@{$flesh->{flesh_fields}->{acqfa}}, 'funding_source') if $$options{flesh_allocation_sources};
 
     my $fund = $e->retrieve_acq_fund([$fund_id, $flesh]) or return $e->event;
     return $e->event unless $e->allowed(['ADMIN_FUND','MANAGE_FUND'], $fund->org, $fund);

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py	2008-02-12 18:04:08 UTC (rev 8734)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py	2008-02-12 23:24:17 UTC (rev 8735)
@@ -26,8 +26,12 @@
         fund_id = kwargs['id']
         ses = ClientSession(oils.const.OILS_APP_ACQ)
 
-        # grab the fund object
-        fund = self._retrieve_fund(r, ses, fund_id)
+        fund = ses.request('open-ils.acq.fund.retrieve', 
+            r.ctx.core.authtoken, fund_id, 
+            {"flesh_summary":1, 'flesh_allocations':1, 'flesh_allocation_sources':1}).recv().content()
+        Event.parse_and_raise(fund)
+        fund.org(OrgUtil.get_org_unit(fund.org())) # flesh the org
+
         r.ctx.acq.fund = fund
         return r.render('acq/financial/view_fund.html')
 

Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html	2008-02-12 18:04:08 UTC (rev 8734)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/templates/oils/default/acq/financial/view_fund.html	2008-02-12 23:24:17 UTC (rev 8735)
@@ -4,10 +4,12 @@
 <%def name="page_title()">${_('View Fund')}</%def>
 <%def name="block_content()">
 
+<% fund = c.oils.acq.fund %>
+
 <div id='oils-acq-list-header' class='container'>
-    <div id='oils-acq-list-header-label'>${c.oils.acq.fund.name()}</div>
+    <div id='oils-acq-list-header-label'>${fund.name()}</div>
     <div id='oils-acq-list-header-create'>
-        <a href='${c.oils.acq.prefix}/fund/allocate?${c.oils.acq.fund_id_.cgi_name}=${c.oils.acq.fund.id()}'>${_('Allocate Money')}</a>
+        <a href='${c.oils.acq.prefix}/fund/allocate?${c.oils.acq.fund_id_.cgi_name}=${fund.id()}'>${_('Allocate Money')}</a>
     </div>
 </div>
 
@@ -15,40 +17,64 @@
     <tbody>
         <tr>
             <td class='oils-admin-label'>${_('Owner')}</td>
-            <td>${c.oils.acq.fund.org().name()}</td> 
+            <td>${fund.org().name()}</td> 
         </tr>
         <tr>
             <td class='oils-admin-label'>${_('Currency')}</td>
-            <td>${c.oils.acq.fund.currency_type()}</td> 
+            <td>${fund.currency_type()}</td> 
         </tr>
         <tr>
             <td class='oils-admin-label'>${_('Year')}</td>
-            <td>${c.oils.acq.fund.year()}</td> 
+            <td>${fund.year()}</td> 
         </tr>
         <tr>
             <td class='oils-admin-label'>${_('Amount Allocated to this Fund')}</td>
-            <td>${c.oils.acq.fund.summary()['allocation_total']}</td> 
+            <td>${fund.summary()['allocation_total']}</td> 
         </tr>
         <tr>
             <td class='oils-admin-label'>${_('Balance (Total - (Spent + Encumberances))')}</td>
-            <td>${c.oils.acq.fund.summary()['combined_balance']}</td> 
+            <td>${fund.summary()['combined_balance']}</td> 
         </tr>
         <tr>
             <td class='oils-admin-label'>${_('Spent Balance (Total - Spent)')}</td>
-            <td>${c.oils.acq.fund.summary()['spent_balance']}</td> 
+            <td>${fund.summary()['spent_balance']}</td> 
        </tr>
        <tr>
             <td class='oils-admin-label'>${_('Total Debits (Spent + Encumbered)')}</td>
-            <td>${c.oils.acq.fund.summary()['debit_total']}</td> 
+            <td>${fund.summary()['debit_total']}</td> 
         </tr>
         <tr>
             <td class='oils-admin-label'>${_('Total Spent')}</td>
-            <td>${c.oils.acq.fund.summary()['spent_total']}</td> 
+            <td>${fund.summary()['spent_total']}</td> 
         </tr>
         <tr>
             <td class='oils-admin-label'>${_('Total Encumbered')}</td>
-            <td>${c.oils.acq.fund.summary()['encumberance_total']}</td> 
+            <td>${fund.summary()['encumberance_total']}</td> 
         </tr>
     </tbody>
 </table>
+
+<h3>${_('Fund Allocations')}</h3>
+<table class='oils-admin-table'>
+    <thead>
+        <tr>
+            <td>${_('Funding Source')}</td>
+            <td>${_('Amount/Percent')}</td>
+        </tr>
+    </thead>
+    <tbody>
+        % for alloc in fund.allocations():
+        <tr>
+            <td>${alloc.funding_source().name()}</td> 
+            % if alloc.amount() != 0 and alloc.amount() is not None:
+                <td>${alloc.amount()}</td> 
+            % else:
+                <% percent = _('%(p)s%%') % {'p':alloc.percent()} %>
+                <td>${percent}</td> 
+            % endif
+        </tr>
+        % endfor
+    </tbody>
+</table>
+
 </%def>



More information about the open-ils-commits mailing list