Jump to content

Recommended Posts

i have a page where i build a report(a batch report that consists of n number of items). one of the columns of this report is patient # column. this patient # can either be 9 characters long(all numerics, usually) or 18 characters long(starts with P or Q followed by 17 numerics).

 

the page has a button - Generate Final Report. When this button is clicked, if the system sees any patient # with a P or Q, it should throw up a message alerting the user on this. Clicking OK on the alert box will generate the report. Cancel brings user back to the current page.

 

here is the code that somehow does not do what it is supposed to do. I am check the length of the field(patient # field) but I am sure thats not how it is done. can someone help me out after checking the code out???

 

this is the button text:

  <td width="252"> <div align="left"> </div></td>

  <td colspan="1">

<?					 
	 if (strlen($row2->pat_num == 9))
	 {

?>
<form name="billingPostCard" method="post" action="billingPostCard.php?type=posttcard" >
<?
	 }
	 else
	 {
?>
<form name="billingPostCard" method="post" action="billingPostCard.php?type=posttcard" onClick="return validateGenerateReport()">
<?
	 }
?>

  <div align="center">

	<p>
	  <input name="posted" type="hidden" value="Yes">
	  <input type="hidden" name="visit_time" value="<? print ("$visit_time"); ?>">
	  <input type="hidden" name="visit_loc" value="<? print ("$visit_loc"); ?>">
	  <input type="hidden" name="pat_phy_id" value="<? print ("$pat_phy_id"); ?>">
	  <input type="hidden" name="pat_num" value="<? print("$pat_num"); ?>">
	  <input type="hidden" name="visit_palm_db_id" value="<? print ("$row2->visit_palm_db_id");  ?>">
	  <input name="y2" type="hidden" id="y2" value="<? print("$y2"); ?>">
	  <input name="d2" type="hidden" id="d2" value="<? print ("$d2"); ?>">
	  <input name="m2" type="hidden" id="m2" value="<? print ("$m2"); ?>">
	  <input name="y1" type="hidden" id="y1" value="<? print("$y1"); ?>">
	  <input name="d1" type="hidden" id="d1" value="<? print("$d1"); ?>">
	  <input name="m1" type="hidden" id="m1" value="<? print ("$m1"); ?>">
	  <input name="select" type="hidden" id="select" value="<? print("$select"); ?>">
	  <input name="select1" type="hidden" id="select1" value="<? print("$select1"); ?>">
	  <input name="select2" type="hidden" id="select2" value="<? print("$select2"); ?>">
	  <input name="select3" type="hidden" id="select3" value="<? print("$select3"); ?>">
	  <input name="select4" type="hidden" id="select4" value="<? print("$select4"); ?>">
	  <input name="select5" type="hidden" id="select5" value="<? print("$select5"); ?>">
	  <input name="select6" type="hidden" id="select6" value="<? print("$select6"); ?>">
	  <input name="search5" type="hidden" id="search5" value="<? print("$search5"); ?>">
	  <input name="search4" type="hidden" id="search4" value="<? print("$search4"); ?>">
	  <input name="search3" type="hidden" id="search3" value="<? print("$search3"); ?>">
	  <input name="search2" type="hidden" id="search2" value="<? print("$search2"); ?>">
	  <input name="search1" type="hidden" id="search1" value="<? print("$search1"); ?>">
	  <input type="hidden" name="physician" value="<? print ("$physician"); ?>">
	  <input name="billingrecordtype" type="hidden" id="billingrecordtype" value="<? print ("$billingrecordtype"); ?>">
	  <input type="hidden" name="loc" value="<? print ("$loc"); ?>">
	  <input type="hidden" name="diag" value="<? print ("$diag"); ?>">
	  <input type="hidden" name="proc" value="<? print ("$proc"); ?>">
	  <input type="hidden" name="visitdate" value="<? print ("$row2->date"); ?>">
	  <input type="hidden" name="prefprov_phyid" value="<? print ("$prefprov_phyid"); ?>">
	  <input type="hidden" name="username" value="<? print ("$USER_NAME");  ?>">
	  <?
		//**********Following variable is used to check if Search button has been clicked already! if button is clicked, this variable
		//contains the value YES else it has a NO. if this variable is a NO, hide the printfriendly button on this page and show it only
		//when it is YES********** - 02/21/2007
		if (($searchon == "Yes") AND ($billingrecordtype=="Billable") OR (isset($rowNum)))
		{
	  ?>
	  <input class="sbttn" type="submit" align="center" name="action" tabindex ="16" value="Generate Final Report">
	  <?
	  }
	  ?>
	</p>
  </div>
</form>
  </td>

 

this is the function validateGenerateReport():

function validateGenerateReport()
{

	var answer= confirm("Warning: Please note that you are generating a Final billing Report that contains temporary Pt. #'s.\r\n\nIf you wish to proceed, click 'OK' below.\r\nIf you wish to go back to Registered Patients and convert to permanent Pt. #'s, click the 'Cancel' button below.");
	//echo("var answer = confirm('Please note that you are generating a Final billing Report that contains temporary Pt. #\'s. If you wish to proceed, click \'OK\' below. If you wish to go back to Registered Patients and convert to permanent Pt. #\'s, click the \'Back\' button below. ');");
	//alert(answer);
	if (answer) return(true);
	else return (false);

}

 

patient numbers starting with a P or Q (and usually >9 in length) are called temporary patient numbers and those with exactly 9 characters(usually numeric) are called permanent patient numbers.

 

and this is the code to display the values in the report:

 

for($q=0;$q<$limit_results && $rowNum < $num_rows2;$q++)
{

if(mysql_data_seek($result2, $rowNum++))
{

	if ($i++%2)
	{

		print ("<tr  bgcolor=\"#cccccc\">");

	}
	else
	{

		print ("<tr>");

	}

	$row2 = mysql_fetch_object($result2);
	$dcn_posted_for_billing=$row2->dcn_posted_for_billing;

	print("<td height=\"14\"> <div align=\"left\">");

	print($row2->pat_last_name);

	print(", ");

	if($row2->pat_mid_init!="")
	{
		print ($row2->pat_first_name);
		print(" ");
		print ($row2->pat_mid_init);
		print(".");
	}
	else
	{
		print($row2->pat_first_name);
	}

	print("</div></td>");

	print("<td height=\"14\"> <div align=\"left\">");

	//print($row2->date);
	print ("<a href=\"Recorddetails_billing.php?select=$select&select1=$select1&select2=$select2&select3=$select3&select4=$select4&select5=$select5&select6=$select6&search1=$search1&search2=$search2&search3=$search3&search4=$search4&search5=$search5&m1=$m1&d1=$d1&y1=$y1&m2=$m2&d2=$d2&y2=$y2&visit_id=$row2->visit_id&visit_type=ICN&visit_status=$row2->visit_status&visit_loc=$row2->visit_loc&pat_first_name=$row2->pat_first_name&pat_mid_init=$row2->pat_mid_init&pat_last_name=$row2->pat_last_name&phy_fname=$row2->phy_fname&phy_lname=$row2->phy_lname&pat_dob=$row2->pat_birthday&pat_num=$row2->pat_num&pat_sex=$row2->pat_sex&billingrecordtype=$billingrecordtype&dcn_posted_for_billing=$dcn_posted_for_billing&visit_palm_db_id=$visit_palm_db_id&rowNum=$rowNum\">$row2->date</a>");

	print("</div></td>");

	// 12.3 GD Align Left
	print("<td height=\"14\"> <div align=\"left\">");
	//print("<td height=\"14\"> <div align=\"center\">");

	// 12.3 GD find the procedure matching pat id and visit id
	$procquery="SELECT proc_proc FROM proc WHERE proc_patid='$row2->pat_ID' AND proc_visit_id='$row2->visit_id'";
	//$procquery="SELECT proc_proc from proc where proc_patid='$row2->pat_ID'";

	$procresult=mysql_query($procquery);
	$procrow = mysql_fetch_array($procresult);
	$proc = $procrow["proc_proc"];

	print($proc);

	print("</div></td>");

	print("<td height=\"14\"> <div align=\"left\">");

	// 12.3 GD find the diagnosis matching pat id and visit id
	$diagquery="SELECT diag_diag FROM diag WHERE diag_patid='$row2->pat_ID' AND diag_visit_id='$row2->visit_id'";
	$diagresult=mysql_query($diagquery);
	$diagrow = mysql_fetch_array($diagresult);
	//$diagquery="SELECT diag_diag from diag where diag_patid='$row2->pat_ID'";
	//$procresult=mysql_query($diagquery);
	//$diagrow = mysql_fetch_array($procresult);

	$diag = $diagrow["diag_diag"];

	print($diag);

	print("</div></td>");


	print("<td height=\"14\"> <div align=\"center\">");

	//print("Prov. ");

	//**********Changes made to the following code on 11/15/2006 to display the attending provider first initial, mid initial and last initial rather than the full first and last names. Also included code for displaying preferred providers similarly - RM **********
	print($row2->phy_fname[0]);

	print($row2->phy_minit);

	print($row2->phy_lname[0]);

	print("</div></td>");

	//**********Save prefphyid from above query into a variable**********
	$prefprov_phyid=$row2->prefphyid;

	print("<td height=\"14\"> <div align=\"center\">");

	//**********Following code displays only the first 8 characters of the location field(even if it is  >**********
	if (strlen($row2->visit_loc)>
	{
		$shortloc = $row2->visit_loc;
		//$shortloclimit=8;
		echo substr($shortloc,0,;
	}
	else
	{
		print($row2->visit_loc);
	}

	print("</div></td>");

	//$dcn_posted_for_billing=$row->dcn_posted_for_billing;
	//print("DCNPOSBILL IS ...: ".$dcn_posted_for_billing);


	print("<td height=\"14\"> <div align=\"center\">");

	//**********Following code displays only the first and last 8 characters of the ssn field(even if it is >9)**********

	if (strlen($row2->pat_num)>9)
	{
		$shortstr = $row2->pat_num;
		echo substr($shortstr,0,1).substr($shortstr,strlen($shortstr)-;

	}
	else
	{
		print($row2->pat_num);
	}

	//print($row2->pat_num);

	print("</div></td>");


	print("</tr>");

}

}

print ("<tr>");

print("<td colspan=\"6\" height=\"14\"> <div align=\"center\">");

$pages = intval($num_rows2/$limit_results);

if($num_rows2%$limit_results)
{

$pages++;

}

print("<b>Page</b> ");

 

i need to check the patient # column for any temporary patient #s(starting with P or Q and >9 characters long) and alert the user if such a patient # exists in the batch.

 

Any help will be greatly appreciated

Link to comment
https://forums.phpfreaks.com/topic/90742-help-with-string-manipulations/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.