'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 & 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'
}
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;
function loadFundGrid(year) {
+ openils.Util.hide('acq-fund-list-rollover-summary');
lfGrid.resetStore();
year = year || new Date().getFullYear().toString();
lfGrid.dataLoader = function() { loadFundGrid(year); };
}
function performRollover(args) {
+
+ lfGrid.resetStore();
progressDialog.show(true, "Processing...");
var method = 'open-ils.acq.fiscal_rollover';
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],
{
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();
}
}
</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"