From: erickson Date: Tue, 12 Feb 2008 23:24:17 +0000 (+0000) Subject: added some fund and funding_source fleshing flags. showing basic allocation summary... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9ae9693a2957d3876bcbc510338c9189c44e5350;p=Evergreen.git added some fund and funding_source fleshing flags. showing basic allocation summary info on the fund page git-svn-id: svn://svn.open-ils.org/ILS/branches/acq-experiment@8735 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm index 0a66d94fe7..780ef44bbd 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Financials.pm @@ -83,9 +83,11 @@ sub retrieve_funding_source { 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 @@ sub retrieve_fund { 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); diff --git a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py index f007d3eb55..2620a187db 100644 --- a/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py +++ b/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py @@ -26,8 +26,12 @@ class FundController(BaseController): 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') 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 96d2085c7e..745b437d20 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 @@ -4,10 +4,12 @@ <%def name="page_title()">${_('View Fund')} <%def name="block_content()"> +<% fund = c.oils.acq.fund %> +
-
${c.oils.acq.fund.name()}
+
${fund.name()}
@@ -15,40 +17,64 @@ ${_('Owner')} - ${c.oils.acq.fund.org().name()} + ${fund.org().name()} ${_('Currency')} - ${c.oils.acq.fund.currency_type()} + ${fund.currency_type()} ${_('Year')} - ${c.oils.acq.fund.year()} + ${fund.year()} ${_('Amount Allocated to this Fund')} - ${c.oils.acq.fund.summary()['allocation_total']} + ${fund.summary()['allocation_total']} ${_('Balance (Total - (Spent + Encumberances))')} - ${c.oils.acq.fund.summary()['combined_balance']} + ${fund.summary()['combined_balance']} ${_('Spent Balance (Total - Spent)')} - ${c.oils.acq.fund.summary()['spent_balance']} + ${fund.summary()['spent_balance']} ${_('Total Debits (Spent + Encumbered)')} - ${c.oils.acq.fund.summary()['debit_total']} + ${fund.summary()['debit_total']} ${_('Total Spent')} - ${c.oils.acq.fund.summary()['spent_total']} + ${fund.summary()['spent_total']} ${_('Total Encumbered')} - ${c.oils.acq.fund.summary()['encumberance_total']} + ${fund.summary()['encumberance_total']} + +

${_('Fund Allocations')}

+ + + + + + + + + % for alloc in fund.allocations(): + + + % if alloc.amount() != 0 and alloc.amount() is not None: + + % else: + <% percent = _('%(p)s%%') % {'p':alloc.percent()} %> + + % endif + + % endfor + +
${_('Funding Source')}${_('Amount/Percent')}
${alloc.funding_source().name()}${alloc.amount()}${percent}
+