show fiscal rollover summary; insert newly created funds into the fund grid for displ...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 26 Mar 2010 21:09:09 +0000 (21:09 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 26 Mar 2010 21:09:09 +0000 (21:09 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16018 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/openils/acq/nls/acq.js
Open-ILS/web/js/ui/default/acq/financial/list_funds.js
Open-ILS/web/templates/default/acq/financial/list_funds.tt2

index 3d6bac2..739b6c1 100644 (file)
@@ -43,5 +43,8 @@
     'FUND_NOT_YET_LOADED': "Fund not yet loaded. Try coming back to this display later.",
     'CONFIRM_DELETE_MAPPING': "Are you sure you want to remove this tag from this fund?",
     'COULD_NOT_CREATE_MAPPING': "Error tagging fund.",
-    'COULD_NOT_DELETE_MAPPING': "Error removing tag from fund."
+    'COULD_NOT_DELETE_MAPPING': "Error removing tag from fund.",
+    'FUND_LIST_ROLLOVER_SUMMARY' : 'Fund Propagation &amp; Rollover Summary for Fiscal Year ${0}',
+    'FUND_LIST_ROLLOVER_SUMMARY_FUNDS' : '<b>${1}</b> funds propagated for fiscal year ${0} for the selected locations',
+    'FUND_LIST_ROLLOVER_SUMMARY_ROLLOVER_AMOUNT' : '<b>$${1}</b> unspent money rolled over to fiscal year ${0} for the selected locations'
 }
index c078bcb..73ee432 100644 (file)
@@ -14,6 +14,8 @@ dojo.require('openils.User');
 dojo.require('openils.acq.Fund');
 dojo.require('openils.widget.AutoGrid');
 dojo.require('openils.widget.ProgressDialog');
+dojo.requireLocalization('openils.acq', 'acq');
+var localeStrings = dojo.i18n.getLocalization('openils.acq', 'acq');
 
 var contextOrg;
 
@@ -49,6 +51,7 @@ function initPage() {
 
 function loadFundGrid(year) {
 
+    openils.Util.hide('acq-fund-list-rollover-summary');
     lfGrid.resetStore();
     year = year || new Date().getFullYear().toString();
     lfGrid.dataLoader = function() { loadFundGrid(year); };
@@ -116,6 +119,8 @@ function loadYearSelector() {
 }
 
 function performRollover(args) {
+
+    lfGrid.resetStore();
     progressDialog.show(true, "Processing...");
 
     var method = 'open-ils.acq.fiscal_rollover';
@@ -129,7 +134,9 @@ function performRollover(args) {
     if(args.dry_run[0] == 'on')
         method += '.dry_run';
 
-    var responses = [];
+    var count = 0;
+    var amount_rolled = 0;
+    var year = fundFilterYearSelect.attr('value'); // TODO alternate selector?
     fieldmapper.standardRequest(
         ['open-ils.acq', method],
         {
@@ -137,18 +144,46 @@ function performRollover(args) {
 
             params : [
                 openils.User.authtoken, 
-                fundFilterYearSelect.attr('value'),
+                year,
                 contextOrg,
                 false, // TODO: checkbox in dialog
             ],
 
             onresponse : function(r) {
                 var resp = openils.Util.readResponse(r);
-                responses.push(resp);
+                count += 1;
+                amount_rolled += resp.rollover_amount;
+                lfGrid.store.newItem(fieldmapper.acqf.toStoreItem(resp.fund));
             }, 
 
             oncomplete : function() {
-                alert(responses.length);
+                
+                var nextYear = Number(year) + 1;
+
+                dojo.byId('acq-fund-list-rollover-summary-header').innerHTML = 
+                    dojo.string.substitute(
+                        localeStrings.FUND_LIST_ROLLOVER_SUMMARY,
+                        [nextYear]
+                    );
+
+                dojo.byId('acq-fund-list-rollover-summary-funds').innerHTML = 
+                    dojo.string.substitute(
+                        localeStrings.FUND_LIST_ROLLOVER_SUMMARY_FUNDS,
+                        [nextYear, count]
+                    );
+
+                dojo.byId('acq-fund-list-rollover-summary-rollover-amount').innerHTML = 
+                    dojo.string.substitute(
+                        localeStrings.FUND_LIST_ROLLOVER_SUMMARY_ROLLOVER_AMOUNT,
+                        [nextYear, amount_rolled]
+                    );
+
+                if(!args.dry_run) {
+                    openils.Util.hide('acq-fund-list-rollover-summary-dry-run');
+                }
+                openils.Util.show('acq-fund-list-rollover-summary');
+
+
                 progressDialog.hide();
             }
         }
index c8cdbd5..536d77e 100644 (file)
 </div>
 
 <div dojoType="dijit.layout.ContentPane" layoutAlign="client">
+    <div style='width:98%; margin-top:20px;'>
+        <div id='acq-fund-list-rollover-summary' class='hidden' style='width:50%; margin-left:auto; margin-right:auto;text-align:center;border:1px solid #888;'>
+            <div id='acq-fund-list-rollover-summary-header'> </div>
+            <ul>
+                <li id='acq-fund-list-rollover-summary-dry-run'>These changes have <span class='oils-notify-text'>not</span> been committed yet.</li>
+                <li id='acq-fund-list-rollover-summary-funds'></li>
+                <li id='acq-fund-list-rollover-summary-rollover-amount'></li>
+            </ul>
+        </div>
+    </div>
+</div>
+
+<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
     <table  jsId="lfGrid"
             autoHeight='true'
             dojoType="openils.widget.AutoGrid"