" + prompttitle + " |
" + prompttitle + " |
" + prompttitle + " |
" + prompttitle + " |
| " + prompttitle + " |
" + prompttitle + " |
" + prompttitle + " |
" + prompttitle + " |
" + prompttitle + " |
" + prompttitle + " |
" + prompttitle + " |
" + prompttitle + " |
" + prompttitle + " |
" + prompttitle + " |
" + prompttitle + " |
" + prompttitle + " |
" + prompttitle + " |
" + prompttitle + " |
" + prompttitle + " |
" + prompttitle + " |
" + prompttitle + " |
" + prompttitle + " |
" + prompttitle + " |

" + prompttitle + " |

" + prompttitle + " |

" + prompttitle + " |

" + prompttitle + " |

" + prompttitle + " |
" + prompttitle + " |
','');
h= h.replace('
','');
sp.innerHTML= h;
}
} else {
if (h.indexOf('arrow_up_force_match.png')!=-1) {
//h= h.replace('arrow_up_force_match.png','arrow_down_force_match.png');
if (sp.querySelector('#arrow')) {
sp.querySelector('#arrow').src='images/arrow_down_force_match.png'
}
if (column!='vendor') {
order='-1';
} else {
order='1';
}
} else if (h.indexOf('arrow_down_force_match.png')!=-1){
//h= h.replace('arrow_down_force_match.png','arrow_up_force_match.png');
if (sp.querySelector('#arrow')) {
sp.querySelector('#arrow').src='images/arrow_up_force_match.png'
}
if (column!='vendor') {
order='1';
} else {
order='-1';
}
} else {
if (order=='' && column!='vendor') {
h= h+'
';
order='-1';
} else {
if (column!='vendor') {
h= h+'
';
} else {
h= h+'
';
}
order='1';
}
e.innerHTML= h;
}
}
}
}
});
//editfrm = getIframeByName('receipt_frame');
var iframe= document.getElementById('contentIframe');
editfrm= iframe.contentWindow.getIframeByName('receipt_frame');
if (editfrm) {
//window.top.document.getElementById('transactiontable').classList.add('pre-animation');
editfrm.forceMatch_sortBy(id, column, order, homecurrency);
}
}
function submit_promptForceMatchID(ccid,rid,overwrite) {
var iframe= document.getElementById('contentIframe');
editfrm= iframe.contentWindow.getIframeByName('receipt_frame');
if (editfrm) {
editfrm.submit_promptForceMatchID(ccid,rid,overwrite);
}
}
function submit_promptOverwriteLocalAmount(receipt_id, cc_id, report_id, amount_receipt_id, source_window) {
//showLoadingAnimation();
// This callback can be defined in the nested content iframe (Edit
// Expenses) or in the portal wrapper. Resolve the wrapper document from
// either context before locating the visible expense iframe.
var portalDocument = document;
if (window.top && window.top.document &&
window.top.document.getElementById('contentIframe')) {
portalDocument = window.top.document;
} else if (!portalDocument.getElementById('contentIframe') && window.parent &&
window.parent.document && window.parent.document.getElementById('contentIframe')) {
portalDocument = window.parent.document;
}
$.ajax({
url : '/user/overwrite_localamount.php',
type : 'POST',
data : {
'receipt_id' : receipt_id,
'cc_id' : cc_id
},
dataType:'text',
success : function(data) {
data = data.replace(/^\s+|\s+$/g, '');
console.log('data: '+data);
var iframe = portalDocument.getElementById('contentIframe');
var editfrm = null;
var frameWin = null;
var frameDoc = null;
if (source_window && source_window.document) {
frameWin = source_window;
frameDoc = source_window.document;
} else if (iframe) {
// Resolve nested frames through the iframe elements themselves.
// This works whether the callback originated in the wrapper or in
// the Edit Expenses iframe and avoids legacy frame-name helpers.
var wrapperDoc = iframe.contentDocument;
var receiptFrameElement = wrapperDoc ?
wrapperDoc.getElementById('receipt_frame') : null;
var editexpensesElement = wrapperDoc ?
wrapperDoc.getElementById('editexpenses') : null;
if (receiptFrameElement) {
frameWin = receiptFrameElement.contentWindow;
frameDoc = receiptFrameElement.contentDocument;
} else if (editexpensesElement) {
frameWin = editexpensesElement.contentWindow;
frameDoc = editexpensesElement.contentDocument;
} else {
frameWin = iframe.contentWindow;
frameDoc = wrapperDoc;
}
}
if (data != '' && frameDoc) {
var amount_field = null;
var amount_ids = [];
var amount_receipt_key = amount_receipt_id || receipt_id;
if (report_id) {
amount_ids.push('amount_' + report_id + amount_receipt_key);
amount_ids.push('amount_' + report_id + '_' + amount_receipt_key);
}
amount_ids.push('amount_' + amount_receipt_key);
for (var amount_index = 0; amount_index < amount_ids.length; amount_index++) {
amount_field = frameDoc.getElementById(amount_ids[amount_index]);
if (amount_field) break;
}
// Some legacy portal pages expose the named frame through
// window.frames but not through getElementById. Resolve it once
// more before giving up, so the visible Edit Expenses field is
// always the target.
if (!amount_field && iframe && iframe.contentWindow) {
var direct_editexpenses =
iframe.contentWindow.frames['editexpenses'];
if (direct_editexpenses) {
frameWin = direct_editexpenses;
frameDoc = direct_editexpenses.document;
for (var direct_index = 0; direct_index < amount_ids.length; direct_index++) {
amount_field = frameDoc.getElementById(amount_ids[direct_index]);
if (amount_field) break;
}
}
}
if (amount_field) {
var previous_amount = amount_field.value;
if (frameWin && typeof frameWin.setCurrentID === 'function') frameWin.setCurrentID(receipt_id);
amount_field.value = data;
if (amount_field.dataset) {
amount_field.dataset.formatted_value = data;
amount_field.dataset.raw_value = data;
if (!amount_field.dataset.base_value) amount_field.dataset.base_value = previous_amount;
}
// The legacy save callback can reformat the field asynchronously;
// keep the just-confirmed card amount visible while it completes.
var restore_overwrite_amount = function() {
var live_amount_field = null;
if (frameDoc) {
for (var restore_index = 0;
restore_index < amount_ids.length; restore_index++) {
live_amount_field = frameDoc.getElementById(
amount_ids[restore_index]);
if (live_amount_field) break;
}
}
if (live_amount_field) amount_field = live_amount_field;
if (!amount_field) return;
amount_field.value = data;
if (amount_field.dataset) {
amount_field.dataset.formatted_value = data;
amount_field.dataset.raw_value = data;
amount_field.dataset.base_value = data;
}
};
window.setTimeout(restore_overwrite_amount, 250);
window.setTimeout(restore_overwrite_amount, 1000);
window.setTimeout(restore_overwrite_amount, 1800);
if (frameWin && typeof frameWin.setCurrentID === 'function') frameWin.setCurrentID(undefined);
}
var overwrite_arrow = frameDoc.getElementById('overwrite_amt_'+receipt_id+'_'+cc_id);
if (overwrite_arrow) overwrite_arrow.style.display='none';
var card_amount_field = frameDoc.getElementById('amount_'+receipt_id+'_'+cc_id);
if (card_amount_field) card_amount_field.style.top='0px';
} else {
promptStandardOK('Overwrite Expense Amount',
'The expense amount could not be overwritten. Please reload the page and try again.');
}
//hideLoadingAnimation();
},
error : function(request,error)
{
console.log('error: '+error);
//hideLoadingAnimation();
}
});
removePromptStandardYesNo();
}
function submit_promptSubmitApprove(code){
//console.log('approve submit');
parent.removePromptStandardYesNo();
// [MJ] - 23/08/28 - remove high prompt as well if policies are displayed
parent.removePromptStandardYesNoHigh();
parent.removePromptStandardYesNoVeryHigh();
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
}
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
console.log(xmlhttp);
prompttitle = 'Submitted for Approval';
message = 'The report has been submitted for approval.![]() |