urex wrote on Wednesday, July 11, 2012:
i added a field facililities in billing manager(billing_report.php) bt the ajax function not working ,please tell me the reasons why the ajax function is not wiking
report.inc.php
<?php
// ±--------------------------------------------------+
// Copyright (C) 2011 Z&H Consultancy Services Private Limited <sam@zhservices.com>
//
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// A copy of the GNU General Public License is included along with this program:
// openemr/interface/login/GnuGPL.html
// For more information write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// Author: Eldho Chacko <eldho@zhservices.com>
// Paul Simon K <paul@zhservices.com>
//
// ±---------------------------------------------------+
?>
<!- Common php functions are stored in this page. ->
<?php
function stripslashes_deep($value)
{
$value = is_array($value) ? array_map(‘stripslashes_deep’, $value) : strip_escape_custom($value);
return $value;
}
function PrepareSearchItem($SearchItem)
{//Parses the search value part of the criteria and prepares for sql.
$SplitArray=split(’ like ‘,$SearchItem);
if(isset($SplitArray))
{
$SplitArray = substr($SplitArray, 0, -1);
$SplitArray = substr($SplitArray, 1);
$SearchItem=$SplitArray.’ like ‘."’".add_escape_custom($SplitArray)."’";
}
else
{
$SplitArray=split(’ = ‘,$SearchItem);
if(isset($SplitArray))
{
$SplitArray = substr($SplitArray, 0, -1);
$SplitArray = substr($SplitArray, 1);
$SearchItem=$SplitArray.’ = ‘."’".add_escape_custom($SplitArray)."’";
}
}
return($SearchItem);
}
function BuildArrayForReport($Query)
{//Parses the database value and prepares for display.
$array_data=array();
$res = sqlStatement($Query);
while($row=sqlFetchArray($res))
{
$array_data[$row]=htmlspecialchars($row,ENT_QUOTES);
}
return $array_data;
}
function InsuranceCompanyDisplay()
{//The criteria “Insurance Company” is coded here.The ajax one
global $ThisPageSearchCriteriaDisplay,$ThisPageSearchCriteriaKey,$ThisPageSearchCriteriaIndex,$web_root;
?>
<table width=“140” border=“0” cellspacing=“0” cellpadding=“0”>
<tr>
<td width=“140” colspan=“2”>
<iframe id=“frame_to_hide” style=“position:absolute;display:none; width:240px; height:100px” frameborder=0
scrolling=no marginwidth=0 src="" marginheight=0>hello</iframe>
<input type=“hidden” id=“hidden_ajax_close_value” value="<?php echo formData(‘type_code’) ?>" /><input name=‘type_code’ id=‘type_code’ class=“text "
style=” width:140px;" title="<?php echo htmlspecialchars(xl(“Type Id or Name.3 characters minimum (including spaces).”), ENT_QUOTES) ?>"
onfocus=“hide_frame_to_hide();appendOptionTextCriteria(’<?php echo $ThisPageSearchCriteriaDisplay ?>’,
‘<?php echo $ThisPageSearchCriteriaKey ?>’,
document.getElementById(‘type_code’).value,document.getElementById(‘div_insurance_or_patient’).innerHTML,
’ = ',
‘text’)” onblur=“show_frame_to_hide()” onKeyDown=“PreventIt(event)” value="<?php echo formData(‘type_code’) ?>" autocomplete=“off” /><br>
<!-onKeyUp=“ajaxFunction(event,‘non’,‘search_payments.php’);”->
<div id=‘ajax_div_insurance_section’>
<div id=‘ajax_div_insurance_error’> </div>
<div id=“ajax_div_insurance” style=“display:none;”></div>
</div>
</div> </td>
</tr>
<tr height=“5”><td colspan=“2”></td></tr>
<tr>
<td><div name=“div_insurance_or_patient” id=“div_insurance_or_patient” class=“text” style=“border:1px solid black; padding-left:5px; width:50px; height:17px;”><?php echo formData(‘hidden_type_code’) ?></div><input type=“hidden” name=“description” id=“description” /></td>
<td><a href="#" onClick=“CleanUpAjax(’<?php echo $ThisPageSearchCriteriaDisplay ?>’,
‘<?php echo $ThisPageSearchCriteriaKey ?>’,’ = ')”><img src="<?php echo $web_root ?>/interface/pic/Clear.gif" border=“0” /></a></td>
</tr>
</table>
<input type=“hidden” name=“hidden_type_code” id=“hidden_type_code” value="<?php echo formData(‘hidden_type_code’) ?>"/>
<?php
}
function FacilityDisplay()
{//The criteria “Facility Company” is coded here.The ajax one
global $ThisPageSearchCriteriaDisplay,$ThisPageSearchCriteriaKey,$ThisPageSearchCriteriaIndex,$web_root;
?>
<table width=“140” border=“0” cellspacing=“0” cellpadding=“0”>
<tr>
<td width=“140” colspan=“2”>
<iframe id=“frame_to_hide” style=“position:absolute;display:none; width:240px; height:100px” frameborder=0
scrolling=no marginwidth=0 src="" marginheight=0>hello</iframe>
<input type=“hidden” id=“hidden_ajax_close_value” value="<?php echo formData(‘facility_code’) ?>" /><input name=‘facility_code’ id=‘facility_code’ class=“text "
style=” width:140px;" title="<?php echo htmlspecialchars(xl(“Typ Name.3 characters minimum (including spaces).”), ENT_QUOTES) ?>"
onfocus=“hide_frame_to_hide();appendOptionTextCriteria(’<?php echo $ThisPageSearchCriteriaDisplay ?>’,
‘<?php echo $ThisPageSearchCriteriaKey ?>’,
document.getElementById(‘facility_code’).value,document.getElementById(‘div_insurance_or_patient’).innerHTML,
’ = ',
‘text’)” onblur=“show_frame_to_hide()” onKeyDown=“PreventIt(event)” value="<?php echo formData(‘facility_code’) ?>" autocomplete=“off” /><br>
<!-onKeyUp=“ajaxFunction(event,‘non’,‘search_payments.php’);”->
<div id=‘ajax_div_facility_section’>
<div id=‘ajax_div_facility_error’> </div>
<div id=“ajax_div_facility style=“display:none;”></div>
</div>
</div> </td>
</tr>
<tr height=“5”><td colspan=“2”></td></tr>
<tr>
<td><div name=“div_insurance_or_patient” id=“div_insurance_or_patient” class=“text” style=“border:1px solid black; padding-left:5px; width:50px; height:17px;”><?php echo formData(‘hidden_type_code’) ?></div><input type=“hidden” name=“description” id=“description” /></td>
<td><a href=”#" onClick=“CleanUpAjax(’<?php echo $ThisPageSearchCriteriaDisplay ?>’,
‘<?php echo $ThisPageSearchCriteriaKey ?>’,’ = ')”><img src="<?php echo $web_root ?>/interface/pic/Clear.gif" border=“0” /></a></td>
</tr>
</table>
<input type=“hidden” name=“hidden_type_code” id=“hidden_type_code” value="<?php echo formData(‘hidden_type_code’) ?>"/>
<?php
}
?>
payment_ajax_jav.inc.php
<?php
// ±--------------------------------------------------+
// Copyright (C) 2010 Z&H Consultancy Services Private Limited <sam@zhservices.com>
//
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// A copy of the GNU General Public License is included along with this program:
// openemr/interface/login/GnuGPL.html
// For more information write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// Author: Eldho Chacko <eldho@zhservices.com>
// Paul Simon K <paul@zhservices.com>
//
// ±---------------------------------------------------+
//===============================================================================
//This section handles ajax functions for insurance,patient and for encounters.
//===============================================================================
?>
<script type=“text/javascript”>
$(document).ready(function(){
$("#type_code").keyup(function(e){
if (e.which == 9 || e.which == 13)
{//tab key,enter key.Prevent ajax activity.
return false;
}
else
{//Both insurance or patient can come.The drop down value in ‘type_name’ decides which one to process.
ajaxFunction(‘non’,‘Simple’,document.getElementById(‘type_code’));
return;
}
});
$("#facility_code").keyup(function(e){
if (e.which == 9 || e.which == 13)
{//tab key,enter key.Prevent ajax activity.
return false;
}
else
{//Both insurance or patient can come.The drop down value in ‘type_name’ decides which one to process.
ajaxFunction(‘facility’,‘Simple’,document.getElementById(‘facility_code’));
return;
}
});
$("#patient_code").keyup(function(e){
if (e.which == 9 || e.which == 13)
{//tab key,enter key.Prevent ajax activity.
return false;
}
else
{
ajaxFunction(‘patient’,‘Submit’,document.getElementById(‘patient_code’));
return;
}
});
$("#form_pt_name").keyup(function(e){
if (e.which == 9 || e.which == 13)
{//tab key,enter key.Prevent ajax activity.
return false;
}
else
{
ajaxFunction(‘patient’,‘Simple’,document.getElementById(‘form_pt_name’));
return;
}
});
$("#encounter_no").keyup(function(e){
if (e.which == 9 || e.which == 13)
{//tab key,enter key.Prevent ajax activity.
return false;
}
else
{
ajaxFunction(‘encounter’);
return;
}
});
function ajaxFunction(Source,SubmitOrSimple,SourceObject) {
if(Source==‘encounter’)
{
document.getElementById(‘ajax_mode’).value=‘encounter’;
}
else if(Source==‘patient’)
{
if(SourceObject.value.length<3)
return false;
document.getElementById(‘ajax_mode’).value=‘set_patient’;
}
//For the below two cases, same text box is used for both insurance and patient.
else if(document.getElementById(‘type_name’) && document.getElementById(‘type_name’).options.value==‘patient’)
{//Patient
if(document.getElementById(‘type_code’).value.length<3)
return false;
document.getElementById(‘ajax_mode’).value=‘set_patient’;
}
else
{//Insurance
if(document.getElementById(‘type_code’).value.length<3)
return false;
document.getElementById(‘ajax_mode’).value=‘set’;
}
if(Source==‘facility’)
{
if(SourceObject.value.length<3)
return false;
document.getElementById(‘ajax_mode’).value=‘set_facility’;
}
//Send ajax request
$.ajax({
type: “POST”,
url: “…/…/library/ajax/payment_ajax.php”,
dataType: “html”,
data: {
ajax_mode: document.getElementById(‘ajax_mode’).value,
patient_code: Source==‘patient’ ? SourceObject.value : ‘’,
insurance_text_ajax: document.getElementById(‘type_code’) ? document.getElementById(‘type_code’).value : ‘’,
facility: Source==‘facility’ ? SourceObject.value : ‘’,
encounter_patient_code:Source==‘encounter’ ? document.getElementById(‘hidden_patient_code’).value : ‘’,
submit_or_simple_type:SubmitOrSimple
},
//async: false,
success: function(thedata){
if(Source==‘encounter’)
{
;
}
else
{
ThedataArray=thedata.split(’~`~`’);
thedata=ThedataArray;
if(Source==‘patient’)
{
if(ThedataArray!=SourceObject.value.length)
{
return;//To deal with speedy typing.
}
}
else
{
if(ThedataArray!=document.getElementById(‘type_code’).value.length)
{
return;//To deal with speedy typing.
}
}
}
document.getElementById(‘ajax_mode’).value=’’;
if(Source==‘encounter’)
{
if(document.getElementById(‘SelFacility’))
{
document.getElementById(‘SelFacility’).style.display=‘none’;//In Internet explorer this drop down comes over the ajax listing.
}
$("#ajax_div_encounter_error").empty();
$("#ajax_div_encounter").empty();
$("#ajax_div_encounter").html(thedata);
$("#ajax_div_encounter").show();
}
else if(Source==‘patient’)
{
if(document.getElementById(‘SelFacility’))
{
document.getElementById(‘SelFacility’).style.display=‘none’;//In Internet explorer this drop down comes over the ajax listing.
}
$("#ajax_div_patient_error").empty();
$("#ajax_div_patient").empty();
$("#ajax_div_insurance_error").empty();
$("#ajax_div_insurance").empty();
$("#ajax_div_patient").html(thedata);
$("#ajax_div_patient").show();
}
else
{//Patient or Insurance
$("#ajax_div_patient_error").empty();
$("#ajax_div_patient").empty();
$("#ajax_div_insurance_error").empty();
$("#ajax_div_insurance").empty();
$("#ajax_div_insurance").html(thedata);
$("#ajax_div_insurance").show();
}
if(document.getElementById(‘anchor_insurance_code_1’))
document.getElementById(‘anchor_insurance_code_1’).focus();
if(document.getElementById(‘tr_insurance_1’))
document.getElementById(‘tr_insurance_1’).bgColor=’#f2f2f2’//selected color
},
error:function(){
}
});
return;
}
});
//==============================================================================================================================================
//Following functions are needed for other tasks related to ajax.
//Html retured from the ajax above, contains list of either insurance,patient or encounter.
//On click or ‘enter key’ press over any one item the listing vanishes and the clicked one gets listed in the parent page’s text box.
//List of functions starts
//===========================================================
function PutTheValuesClick(Code,Name)
{//Used while ->CLICK<- over list in the insurance/patient portion.
document.getElementById(‘type_code’).value=Name;
document.getElementById(‘hidden_ajax_close_value’).value=Name;
document.getElementById(‘description’).value=Name;
document.getElementById(‘hidden_type_code’).value=Code;
document.getElementById(‘div_insurance_or_patient’).innerHTML=Code;
document.getElementById(‘ajax_div_insurance’).style.display=‘none’;
$("#ajax_div_patient_error").empty();
$("#ajax_div_patient").empty();
$("#ajax_div_insurance_error").empty();
$("#ajax_div_insurance").empty();
document.getElementById(‘type_code’).focus();
}
function PutTheValuesClickDistribute(Code,Name)
{//Used while ->CLICK<- over list in the patient portion before the start of distribution of amount.
if(document.getElementById(‘SelFacility’))
{
document.getElementById(‘SelFacility’).style.display=’’;//In Internet explorer this drop down comes over the ajax listing.
}
document.getElementById(‘patient_code’).value=Name;
document.getElementById(‘hidden_ajax_patient_close_value’).value=Name;
document.getElementById(‘hidden_patient_code’).value=Code;
document.getElementById(‘patient_name’).innerHTML=Code;
document.getElementById(‘ajax_div_patient’).style.display=‘none’;
document.getElementById(‘patient_name’).focus();
document.getElementById(‘mode’).value=‘search’;
top.restoreSession();
document.forms.submit();
}
function PutTheValuesClickPatient(Code,Name)//Non submission patient ajax.
{
document.getElementById(‘form_pt_name’).value=Name;
document.getElementById(‘hidden_ajax_patient_close_value’).value=Name;
document.getElementById(‘hidden_patient_code’).value=Code;
document.getElementById(‘ajax_div_patient’).style.display=‘none’;
document.getElementById(‘form_pt_code’).innerHTML=Code;
document.getElementById(‘form_pt_name’).focus();
}
function PutTheValuesClickEncounter(Code,Name)
{//Used while ->CLICK<- over list in the encounter portion.
if(document.getElementById(‘SelFacility’))
{
document.getElementById(‘SelFacility’).style.display=’’;//In Internet explorer this drop down comes over the ajax listing.
}
document.getElementById(‘encounter_no’).value=Code;
document.getElementById(‘hidden_ajax_encounter_close_value’).value=Code;
document.getElementById(‘hidden_encounter_no’).value=Code;
document.getElementById(‘encounter_date’).innerHTML=Name;
document.getElementById(‘ajax_div_encounter’).style.display=‘none’;
document.getElementById(‘encounter_date’).focus();
document.getElementById(‘mode’).value=‘search_encounter’;
top.restoreSession();
document.forms.submit();
}
function PlaceValues(evt,Code,Name)
{//Used while ->KEY PRESS<- over list in the insurance/patient portion.
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode == 13)//enter key
{//Vanish the list and populate the parent text box
PutTheValuesClick(Code,Name);
PreventIt(evt) //For browser chorome.It gets submitted,to prevent it the PreventIt(evt) is written
}
else if(!((charCode == 38) || (charCode == 40)))
{//if non arrow keys, focus on the parent text box(ie he again types and wants ajax to activate)
document.getElementById(‘type_code’).focus();
}
}
function PlaceValuesDistribute(evt,Code,Name)
{//Used while ->KEY PRESS<- over list in the patient portion before the start of distribution of amount.
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode == 13)//enter key
{//Vanish the list and populate the parent text box
PutTheValuesClickDistribute(Code,Name);
PreventIt(evt) //For browser chorome.It gets submitted,to prevent it the PreventIt(evt) is written
}
else if(!((charCode == 38) || (charCode == 40)))
{//if non arrow keys, focus on the parent text box(ie he again types and wants ajax to activate)
document.getElementById(‘patient_code’).focus();
}
}
function PlaceValuesPatient(evt,Code,Name)
{
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode == 13)//enter key
{//Vanish the list and populate the parent text box
PutTheValuesClickPatient(Code,Name);
PreventIt(evt) //For browser chorome.It gets submitted,to prevent it the PreventIt(evt) is written
}
else if(!((charCode == 38) || (charCode == 40)))
{//if non arrow keys, focus on the parent text box(ie he again types and wants ajax to activate)
document.getElementById(‘form_pt_name’).focus();
}
}
function PlaceValuesEncounter(evt,Code,Name)
{//Used while ->KEY PRESS<- over list in the encounter portion.
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode == 13)//enter key
{//Vanish the list and populate the parent text box
PutTheValuesClickEncounter(Code,Name);
PreventIt(evt) //For browser chorome.It gets submitted,to prevent it the PreventIt(evt) is written
}
else if(!((charCode == 38) || (charCode == 40)))
{//if non arrow keys, focus on the parent text box(ie he again types and wants ajax to activate)
document.getElementById(‘encounter_no’).focus();
}
}
function ProcessKeyForColoring(evt,Location)
{//Shows the navigation in the listing by change of colors and focus.Happens when down or up arrow is pressed.
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode == 38)//Up key press
{
Location-;
if(document.getElementById(‘tr_insurance_’ + (Location)))
{
//restore color in below row
if((Location+1)%2==1)
{
document.getElementById(‘tr_insurance_’ + (Location+1)).bgColor=’#ddddff’;
}
else
{
document.getElementById(‘tr_insurance_’ + (Location+1)).bgColor=’#ffdddd’;
}
document.getElementById(‘tr_insurance_’ + (Location)).bgColor=’#f2f2f2’;
document.getElementById(‘anchor_insurance_code_’ + (Location)).focus();
}
}
else if (charCode == 40)//Down key press
{
Location++;
if(document.getElementById(‘tr_insurance_’ + (Location)))
{
//restore color in above row
if((Location-1)%2==1)
{
document.getElementById(‘tr_insurance_’ + (Location-1)).bgColor=’#ddddff’;
}
else
{
document.getElementById(‘tr_insurance_’ + (Location-1)).bgColor=’#ffdddd’;
}
document.getElementById(‘tr_insurance_’ + (Location)).bgColor=’#f2f2f2’;
document.getElementById(‘anchor_insurance_code_’ + (Location)).focus();
}
}
}
function HideTheAjaxDivs()
{//Starts working when clicking on the body.Hides the ajax and restores the codes back, as he may have changed it in the text box.
if(document.getElementById(‘ajax_div_insurance’))
{
if(document.getElementById(‘ajax_div_insurance’).style.display!=‘none’)
{
document.getElementById(‘type_code’).value=document.getElementById(‘hidden_ajax_close_value’).value;
$("#ajax_div_patient_error").empty();
$("#ajax_div_patient").empty();
$("#ajax_div_insurance_error").empty();
$("#ajax_div_insurance").empty();
$("#ajax_div_insurance").hide();
}
}
if(document.getElementById(‘ajax_div_patient’))
{
if(document.getElementById(‘ajax_div_patient’).style.display!=‘none’)
{
if(document.getElementById(‘SelFacility’))
{
document.getElementById(‘SelFacility’).style.display=’’;//In Internet explorer this drop down comes over the ajax listing.
}
if(document.getElementById(‘patient_code’))
document.getElementById(‘patient_code’).value=document.getElementById(‘hidden_ajax_patient_close_value’).value;
else if(document.getElementById(‘form_pt_name’))
document.getElementById(‘form_pt_name’).value=document.getElementById(‘hidden_ajax_patient_close_value’).value;
$("#ajax_div_patient_error").empty();
$("#ajax_div_patient").empty();
$("#ajax_div_insurance_error").empty();
$("#ajax_div_insurance").empty();
$("#ajax_div_patient").hide();
}
}
if(document.getElementById(‘ajax_div_encounter’))
{
if(document.getElementById(‘ajax_div_encounter’).style.display!=‘none’)
{
if(document.getElementById(‘SelFacility’))
{
document.getElementById(‘SelFacility’).style.display=’’;//In Internet explorer this drop down comes over the ajax listing.
}
document.getElementById(‘encounter_no’).value=document.getElementById(‘hidden_ajax_encounter_close_value’).value;
$("#ajax_div_encounter_error").empty();
$("#ajax_div_encounter").empty();
$("#ajax_div_encounter").hide();
}
}
}
//===========================================================
//List of functions ends
//==============================================================================================================================================
</script>
payement_ajax.php
<?php
// ±--------------------------------------------------+
// Copyright (C) 2010 Z&H Consultancy Services Private Limited <sam@zhservices.com>
//
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// A copy of the GNU General Public License is included along with this program:
// openemr/interface/login/GnuGPL.html
// For more information write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// Author: Eldho Chacko <eldho@zhservices.com>
// Paul Simon K <paul@zhservices.com>
//
// ±---------------------------------------------------+
//===============================================================================
//This section handles ajax for insurance,patient and for encounters.
//===============================================================================
require_once("…/…/interface/globals.php");
require_once("$srcdir/sql.inc");
require_once("$srcdir/formatting.inc.php");
//=================================
if (isset($_REQUEST))
{
AjaxDropDownCode();
}
//=================================
function AjaxDropDownCode()
{
if ($_REQUEST == “set”)//insurance
{
$CountIndex=1;
$StringForAjax="<div id=‘AjaxContainerInsurance’><table width=‘552’ cellspacing=‘0’ cellpadding=‘0’>
<tr class=‘text’ bgcolor=’#116699’>
<td width=‘50’>".htmlspecialchars( xl(‘Code’), ENT_QUOTES)."</td>
<td width=‘300’>".htmlspecialchars( xl(‘Name’), ENT_QUOTES)."</td>
<td width=‘200’>".htmlspecialchars( xl(‘Address’), ENT_QUOTES)."</td>
</tr>".
//ProcessKeyForColoring(event,$CountIndex)==>Shows the navigation in the listing by change of colors and focus.Happens when down or up arrow is pressed.
//PlaceValues(event,’ ’,’’)==>Used while ->KEY PRESS<- over list.List vanishes and the clicked one gets listed in the parent page’s text box.
//PutTheValuesClick(’ ’,’’)==>Used while ->CLICK<- over list.List vanishes and the clicked one gets listed in the parent page’s text box.
“<tr class=‘text’ height=‘20’ bgcolor=’$bgcolor’ id=“tr_insurance_$CountIndex”
onkeydown=“ProcessKeyForColoring(event,$CountIndex);PlaceValues(event,’ ’,’’)” onclick=“PutTheValuesClick(’ ’,’’)”>
<td colspan=‘3’ align=‘center’><a id=‘anchor_insurance_code_$CountIndex’ href=’#’></a></td>
</tr>”;
$insurance_text_ajax=formData(‘insurance_text_ajax’,’’,true);
$res = sqlStatement(“SELECT insurance_companies.id,name,city,state,country FROM insurance_companies
left join addresses on insurance_companies.id=addresses.foreign_id where name like ‘$insurance_text_ajax%’ or insurance_companies.id like ‘$insurance_text_ajax%’ ORDER BY name”);
while ($row = sqlFetchArray($res))
{
if($CountIndex%2==1)
{
$bgcolor=’#ddddff’;
}
else
{
$bgcolor=’#ffdddd’;
}
$CountIndex++;
$Id=$row;
$Name=$row;
$City=$row;
$State=$row;
$Country=$row;
$Address=$City.’, ‘.$State.’, ‘.$Country;
$StringForAjax.="<tr class=‘text’ bgcolor=’$bgcolor’ id=“tr_insurance_$CountIndex”
onkeydown=‘ProcessKeyForColoring(event,$CountIndex);PlaceValues(event,"".htmlspecialchars($Id,ENT_QUOTES)."","".htmlspecialchars($Name,ENT_QUOTES)."")’
onclick=‘PutTheValuesClick("".htmlspecialchars($Id,ENT_QUOTES)."","".htmlspecialchars($Name,ENT_QUOTES)."")’>
<td><a id=‘anchor_insurance_code_$CountIndex’ href=’#’>".htmlspecialchars($Id)."</a></td>
<td><a href=’#’>".htmlspecialchars($Name)."</a></td>
<td><a href=’#’>".htmlspecialchars($Address)."</a></td>
</tr>";
}
$StringForAjax.="</table></div>";
echo strlen($_REQUEST).’~`~`’.$StringForAjax;
die;
}
if ($_REQUEST == “set_facility”)//facility
{
$CountIndex=1;
$StringForAjax="<div id=‘AjaxContainerInsurance’><table width=‘552’ cellspacing=‘0’ cellpadding=‘0’>
<tr class=‘text’ bgcolor=’#116699’>
<td width=‘50’>".htmlspecialchars( xl(‘Code’), ENT_QUOTES)."</td>
<td width=‘300’>".htmlspecialchars( xl(‘Name’), ENT_QUOTES)."</td>
<td width=‘200’>".htmlspecialchars( xl(‘Address’), ENT_QUOTES)."</td>
</tr>".
//ProcessKeyForColoring(event,$CountIndex)==>Shows the navigation in the listing by change of colors and focus.Happens when down or up arrow is pressed.
//PlaceValues(event,’ ’,’’)==>Used while ->KEY PRESS<- over list.List vanishes and the clicked one gets listed in the parent page’s text box.
//PutTheValuesClick(’ ’,’’)==>Used while ->CLICK<- over list.List vanishes and the clicked one gets listed in the parent page’s text box.
“<tr class=‘text’ height=‘20’ bgcolor=’$bgcolor’ id=“tr_insurance_$CountIndex”
onkeydown=“ProcessKeyForColoring(event,$CountIndex);PlaceValues(event,’ ’,’’)” onclick=“PutTheValuesClick(’ ’,’’)”>
<td colspan=‘3’ align=‘center’><a id=‘anchor_insurance_code_$CountIndex’ href=’#’></a></td>
</tr>”;
$facility=formData(‘facility’,’’,true);
$res = sqlStatement(“select * from facility order by name where name like ‘$facility%’”);
$fres = sqlFetchArray(’$res’);
{
if($CountIndex%2==1)
{
$bgcolor=’#ddddff’;
}
else
{
$bgcolor=’#ffdddd’;
}
$CountIndex++;
$Id=$row;
$Name=$row;
$City=$row;
$State=$row;
$Country=$row;
$Address=$City.’, ‘.$State.’, ‘.$Country;
$StringForAjax.="<tr class=‘text’ bgcolor=’$bgcolor’ id=“tr_insurance_$CountIndex”
onkeydown=‘ProcessKeyForColoring(event,$CountIndex);PlaceValues(event,"".htmlspecialchars($Id,ENT_QUOTES)."","".htmlspecialchars($Name,ENT_QUOTES)."")’
onclick=‘PutTheValuesClick("".htmlspecialchars($Id,ENT_QUOTES)."","".htmlspecialchars($Name,ENT_QUOTES)."")’>
<td><a id=‘anchor_insurance_code_$CountIndex’ href=’#’>".htmlspecialchars($Id)."</a></td>
<td><a href=’#’>".htmlspecialchars($Name)."</a></td>
<td><a href=’#’>".htmlspecialchars($Address)."</a></td>
</tr>";
}
$StringForAjax.="</table></div>";
echo strlen($_REQUEST).’~`~`’.$StringForAjax;
die;
}
//===============================================================================
if ($_REQUEST == “set_patient”)//patient.
{//From 2 areas this ajax is called.So 2 pairs of functions are used.
//PlaceValues==>Used while ->KEY PRESS<- over list.List vanishes and the clicked one gets listed in the parent page’s text box.
//PutTheValuesClick==>Used while ->CLICK<- over list.List vanishes and the clicked one gets listed in the parent page’s text box.
//PlaceValuesDistribute==>Used while ->KEY PRESS<- over list.List vanishes and the clicked one gets listed in the parent page’s text box.
//PutTheValuesClickDistribute==>Used while ->CLICK<- over list.List vanishes and the clicked one gets listed in the parent page’s text box.
if(isset($_REQUEST) && $_REQUEST!=’’)
{
$patient_code=formData(‘patient_code’,’’,true);
if(isset($_REQUEST) && $_REQUEST==‘Simple’)
{
$StringToAppend=“PutTheValuesClickPatient”;
$StringToAppend2=“PlaceValuesPatient”;
}
else
{
$StringToAppend=“PutTheValuesClickDistribute”;
$StringToAppend2=“PlaceValuesDistribute”;
}
$patient_code_complete=$_REQUEST;//we need the spaces here
}
elseif(isset($_REQUEST) && $_REQUEST!=’’)
{
$patient_code=formData(‘insurance_text_ajax’,’’,true);
$StringToAppend=“PutTheValuesClick”;
$StringToAppend2=“PlaceValues”;
$patient_code_complete=$_REQUEST;//we need the spaces here
}
$CountIndex=1;
$StringForAjax="<div id=‘AjaxContainerPatient’><table width=‘452’ border=‘1’ cellspacing=‘0’ cellpadding=‘0’>
<tr class=‘text’ bgcolor=’#dddddd’>
<td width=‘50’>".htmlspecialchars( xl(‘Code’), ENT_QUOTES)."</td>
<td width=‘100’>".htmlspecialchars( xl(‘Last Name’), ENT_QUOTES)."</td>
<td width=‘100’>".htmlspecialchars( xl(‘First Name’), ENT_QUOTES)."</td>
<td width=‘100’>".htmlspecialchars( xl(‘Middle Name’), ENT_QUOTES)."</td>
<td width=‘100’>".htmlspecialchars( xl(‘Date of Birth’), ENT_QUOTES)."</td>
</tr>".
//ProcessKeyForColoring(event,$CountIndex)==>Shows the navigation in the listing by change of colors and focus.Happens when down or up arrow is pressed.
“<tr class=‘text’ height=‘20’ bgcolor=’$bgcolor’ id=“tr_insurance_$CountIndex”
onkeydown=“ProcessKeyForColoring(event,$CountIndex);$StringToAppend2(event,’ ’,’’)” onclick=”$StringToAppend(’ ’,’’)">
<td colspan=‘5’ align=‘center’><a id=‘anchor_insurance_code_$CountIndex’ href=’#’></a></td>
</tr>
“;
$res = sqlStatement(“SELECT pid as id,fname,lname,mname,DOB FROM patient_data
where fname like ‘$patient_code%’ or lname like ‘$patient_code%’ or mname like ‘$patient_code%’ or
CONCAT(lname,’ ‘,fname,’ ',mname) like ‘$patient_code%’ or pid like ‘$patient_code%’ ORDER BY lname”);
while ($row = sqlFetchArray($res))
{
if($CountIndex%2==1)
{
$bgcolor=’#ddddff’;
}
else
{
$bgcolor=’#ffdddd’;
}
$CountIndex++;
$Id=$row;
$fname=$row;
$lname=$row;
$mname=$row;
$Name=$lname.’ ‘.$fname.’ '.$mname;
$DOB=oeFormatShortDate($row);
$StringForAjax.=”<tr class=‘text’ bgcolor=’$bgcolor’ id=“tr_insurance_$CountIndex”
onkeydown=‘ProcessKeyForColoring(event,$CountIndex);$StringToAppend2(event,"".htmlspecialchars($Id,ENT_QUOTES)."","".htmlspecialchars($Name,ENT_QUOTES)."")’ onclick="$StringToAppend(’".addslashes($Id)."’,’".htmlspecialchars(addslashes($Name),ENT_QUOTES)."’)">
<td><a id=‘anchor_insurance_code_$CountIndex’ href=’#’ >".htmlspecialchars($Id)."</a></td>
<td><a href=’#’>".htmlspecialchars($lname)."</a></td>
<td><a href=’#’>".htmlspecialchars($fname)."</a></td>
<td><a href=’#’>".htmlspecialchars($mname)."</a></td>
<td><a href=’#’>".htmlspecialchars($DOB)."</a></td>
</tr>";
}
$StringForAjax.="</table></div>";
echo strlen($patient_code_complete).’~`~`’.$StringForAjax;
die;
}
//===============================================================================
if ($_REQUEST == “encounter”)//encounter
{
//PlaceValuesEncounter==>Used while ->KEY PRESS<- over list.List vanishes and the clicked one gets listed in the parent page’s text box.
//PutTheValuesClickEncounter==>Used while ->CLICK<- over list.List vanishes and the clicked one gets listed in the parent page’s text box.
if(isset($_REQUEST))
{
$patient_code=formData(‘encounter_patient_code’,’’,true);
$StringToAppend=“PutTheValuesClickEncounter”;
$StringToAppend2=“PlaceValuesEncounter”;
}
$CountIndex=1;
$StringForAjax="<div id=‘AjaxContainerEncounter’><table width=‘202’ border=‘1’ cellspacing=‘0’ cellpadding=‘0’>
<tr class=‘text’ bgcolor=’#dddddd’>
<td width=‘100’>".htmlspecialchars( xl(‘Encounter’), ENT_QUOTES)."</td>
<td width=‘100’>".htmlspecialchars( xl(‘Date’), ENT_QUOTES)."</td>
</tr>".
//ProcessKeyForColoring(event,$CountIndex)==>Shows the navigation in the listing by change of colors and focus.Happens when down or up arrow is pressed.
“<tr class=‘text’ height=‘20’ bgcolor=’$bgcolor’ id=“tr_insurance_$CountIndex”
onkeydown=“ProcessKeyForColoring(event,$CountIndex);$StringToAppend2(event,’ ’,’’)” onclick=”$StringToAppend(’ ’,’’)">
<td colspan=‘2’ align=‘center’><a id=‘anchor_insurance_code_$CountIndex’ href=’#’></a></td>
</tr>
“;
$res = sqlStatement(“SELECT date,encounter FROM form_encounter
where pid =’$patient_code’ ORDER BY encounter”);
while ($row = sqlFetchArray($res))
{
if($CountIndex%2==1)
{
$bgcolor=’#ddddff’;
}
else
{
$bgcolor=’#ffdddd’;
}
$CountIndex++;
$Date=$row;
$Date=split(’ ',$Date);
$Date=oeFormatShortDate($Date);
$Encounter=$row;
$StringForAjax.=”<tr class=‘text’ bgcolor=’$bgcolor’ id=“tr_insurance_$CountIndex”
onkeydown=“ProcessKeyForColoring(event,$CountIndex);$StringToAppend2(event,’”.htmlspecialchars($Encounter,ENT_QUOTES)."’,’".htmlspecialchars($Date,ENT_QUOTES)."’)" onclick="$StringToAppend(’".htmlspecialchars($Encounter,ENT_QUOTES)."’,’".htmlspecialchars($Date,ENT_QUOTES)."’)">
<td><a id=‘anchor_insurance_code_$CountIndex’ href=’#’ >".htmlspecialchars($Encounter)."</a></td>
<td><a href=’#’>".htmlspecialchars($Date)."</a></td>
</tr>";
}
$StringForAjax.="</table></div>";
echo $StringForAjax;
die;
}
}
?>
pls tell me the reasons specify the lines