rsammy Posted October 16, 2007 Share Posted October 16, 2007 i am working on an application where a batch of records is approved to generate a final billing report. user clicks on the Generate Final Report on the page. However, before generating the report, user needs to check and see if the patient # field has any non-numeric characters. If yes, it needs to pop a warning message telling the user that there are some temporary patients(patients with non-numeric patient numbers) in this list. Click OK to continue or Cancel to go back to change these patient #s to permanent patient #s(numeric). i am sure the code i have written is not right. can someone help me out with this? here is wat i've come up with... <form name="form1" method="post" action="billingPostCard.php?type=posttcard"> <div align="center"> <p> <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_first_name" value="<? print ("$pat_first_name"); ?>"> <input type="hidden" name="pat_last_name" value="<? print ("$pat_last_name"); ?>"> <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="enter_date" value="<? print ("$enter_date"); ?>"> <input type="hidden" name="visit_timestamp_received" value="<? print ("$visit_timestamp_received"); ?>"> <input type="hidden" name="visit_palm_db_id" value="<? print ("$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="billingrecordtype" type="hidden" id="billingrecordtype" value="<? print ("$billingrecordtype"); ?> "> <input type="hidden" name="username" value="<? print ("$USER_NAME"); ?>"> <input class="sbttn" type="submit" align="center" name="action" value="Generate Final Report"> <? if (!is_numeric($pat_num)) { //post to billingPostCard.php echo("<SCRIPT LANGUAGE=Javascript>"); 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. ');"); echo(" if (!answer) history.go(-1);"); echo("else document.forms['billingPostCard'].submit();"); echo("</SCRIPT>"); } } ?> </p> </div> </form> basically this check needs to be done on button click or when Generate Final Report button is clicked. If user says OK go ahead to the next page(billingPostCard.php) or if Cancel is clicked, stay in the same page. (the code example shows me sending it to the previous page - which is not wat i want). i have this code at the bottom of the page where buttons are declared. any help will be greatly appreciated. thanx Quote Link to comment https://forums.phpfreaks.com/topic/73511-help-with-code-for-button-on-click/ Share on other sites More sharing options...
BlueSkyIS Posted October 16, 2007 Share Posted October 16, 2007 as far as I can tell you just need Javascript. one of 2 ways: onclick method for a button or link or onsubmit method on the form, returning true or false depening on the user's selection. something like this: <SCRIPT LANGUAGE='JAVASCRIPT'> function validateForm() { var result = true; if (!IsNumeric(document.forms[0].someval)) { result = 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. '); } return result; } function IsNumeric(strString) // check for valid numeric strings { var strValidChars = "0123456789.-"; var strChar; var blnResult = true; if (strString.length == 0) return false; // test strString consists of valid characters listed above for (i = 0; i < strString.length && blnResult == true; i++) { strChar = strString.charAt(i); if (strValidChars.indexOf(strChar) == -1) { blnResult = false; } } return blnResult; } </SCRIPT> <FORM ACTION='whatever.php' onSubmit='return validateForm();'> <INPUT NAME='someval' VALUE='<?=$somephpvalue;?>'> </FORM> Quote Link to comment https://forums.phpfreaks.com/topic/73511-help-with-code-for-button-on-click/#findComment-370859 Share on other sites More sharing options...
rsammy Posted October 17, 2007 Author Share Posted October 17, 2007 thanx for replying BlueSkyIS ... i tried this out. im sure im messing it somewhere. could you take a look at my code and tell me where and what to do --- the button text is at the bottom. here is my code... <?PHP //File for database information //require_once ("phpInclude/config.php"); require_once ("../config.php"); //File to verify authenticated user include ("phpInclude/cookie.php"); //$dcn_approved_for_billing = $_GET["approval"]; //$dcn_tran_id = $_GET["tran_id"]; $dcn_approved_for_billing = $_POST["approval"]; $dcn_tran_id = $_POST["tran_id"]; $billingrecordtype=$_POST["billingrecordtype"]; $dcn_billing_status= $_POST["dcn_billing_status"]; //$querydcn = "UPDATE dcn SET dcn_approved_for_billing='$dcn_approved_for_billing', dcn_billing_status='$dcn_billing_status' WHERE dcn_tran_ID='$dcn_tran_id' "; $querydcn = "UPDATE dcn SET dcn_approved_for_billing='$dcn_approved_for_billing', dcn_billing_status='$dcn_billing_status', dcn_posted_for_billing='$dcn_posted_for_billing' WHERE dcn_tran_ID='$dcn_tran_id' "; //echo "$query"; mysql_query($querydcn); if ($select1=$_POST["select1"]) { //echo "$select1"; $search1=$_POST["search1"]; $search2=$_POST["search2"]; $search3=''; $search4=''; $search5=''; //$billingrecordtype=$_POST["billingrecordtype"]; //print("BILLIN REC TYPE IN POST BLOCK IS ...: " . $billingrecordtype); $select=$_POST["select"]; $select2=$_POST["select2"]; $select2=stripslashes($select2); $select4=$_POST["select4"]; $select5=$_POST["select5"]; $select5=stripslashes($select5); $physician=$_POST["physician"]; $select3=$_POST["select3"]; $m1=$_POST["m1"]; $d1=$_POST["d1"]; $y1=$_POST["y1"]; $m2=$_POST["m2"]; $d2=$_POST["d2"]; $y2=$_POST["y2"]; //$client_id=$_POST["client_id"]; $prv_rowNum=$_POST["rowNum"]; print("PHY IS ...: ".$physician); } elseif ($select1=$_GET["select1"]) { //if (is_null($rowNum)){$rowNum='0';} //echo "$rowNum"; $rowNum=$_GET["rowNum"]; $search1=$_GET["search1"]; $search2=$_GET["search2"]; $search3=''; $search4=''; $search5=''; $billingrecordtype=$_GET["billingrecordtype"]; $select=$_GET["select"]; $select2=$_GET["select2"]; $select2=stripslashes($select2); $select4=$_GET["select4"]; $select5=$_GET["select5"]; $select5=stripslashes($select5); $select3=$_GET["select3"]; $select6=$_GET["select6"]; $billingrecordtype=$_GET["billingrecordtype"]; $physician=$_GET["physician"]; $m1=$_GET["m1"]; $d1=$_GET["d1"]; $y1=$_GET["y1"]; $m2=$_GET["m2"]; $d2=$_GET["d2"]; $y2=$_GET["y2"]; print("PHY IS ...: ".$physician); } if (isset($USER_NAME)) { list($user_fname, $user_lname) = explode (' ', $USER_NAME); if ($USER_NAME == ' Office Manager') { $query= "SELECT grp_name FROM group_details"; } else { $query= "SELECT grp_name FROM group_details, user_mgr WHERE user_mgr.user_fname='$user_fname' AND user_mgr.user_lname='$user_lname' AND user_mgr.user_grp_id=group_details.grp_id"; } $result=mysql_query($query); $row = mysql_fetch_array($result); $group_name = $row["grp_name"]; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <link rel='stylesheet' type='text/css' href='css/styleSheet.css'> <SCRIPT language="JavaScript" src="js/tree.js"> </SCRIPT> <SCRIPT language="JavaScript"> <?PHP //Navigation File require_once ("../nav.php"); ?> </SCRIPT> <SCRIPT language="JavaScript"> function trim(inputString) { var retValue = inputString; var ch = retValue.substring(0, 1); while (ch == " ") { // Check for spaces at the beginning of the string retValue = retValue.substring(1, retValue.length); ch = retValue.substring(0, 1); } ch = retValue.substring(retValue.length-1, retValue.length); while (ch == " ") { // Check for spaces at the end of the string retValue = retValue.substring(0, retValue.length-1); ch = retValue.substring(retValue.length-1, retValue.length); } while (retValue.indexOf(" ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length); // Again, there are two spaces in each of the strings } return retValue; // Return the trimmed string back to the user } // Ends the "trim" function function validate() { var err_msg = new Array(); var i=0; var j=0; var bigstring = "Please correct the following errors:\n"; var loginID = ""; var pass = ""; var count = 0; var aMatch = false; var aBlank = false; if (trim(y1).length < 1) { if ((m1.length < 1) || (d1.length < 1)) { err_msg[i] = "Invalid Date."; i++; } } if (trim(y2).length < 1) { if ((m2.length <0) || (d2.length <1)) { err_msg[i] = "Invalid Date."; i++; } } if (i>0) { for (j=0; j<err_msg.length; j++) { count = j + 1; bigstring = bigstring + "\n" + count +". " + err_msg[j]; } alert (bigstring); return false; } else { return true; } } /* function validateGenerateButton() { alert("here"); var result = true; //if (!IsNumeric(document.forms[0].pat_ssn)) if (!IsNumeric(document.form[1].pat_ssn)) { alert("in if loop"); result = 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("here after if"); return result; } function IsNumeric(pat_ssn) // check for valid numeric strings { var strValidChars = "0123456789-"; var strChar; var blnResult = true; if (pat_ssn.length == 0) return false; // test strString consists of valid characters listed above for (i = 0; i < pat_ssn.length && blnResult == true; i++) { strChar = pat_ssn.charAt(i); if (strValidChars.indexOf(strChar) == -1) { blnResult = false; } } return blnResult; } */ </SCRIPT> <? if if (strlen($pat_ssn)!=9) { //post to conflictssn.php echo("<SCRIPT LANGUAGE=Javascript>"); echo("function validateGenerateButton(){"); echo("alert("here");"); echo("var result = 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. ');}"); echo(" if (!result) history.go(-1);"); echo("else document.forms['form1'].submit();"); alert("here after if"); //echo("var answer = confirm('You are attempting to assign a Patient # that is already assigned to an existing patient in the InstiComm system. Entered Patient # already exists! The new patient you just entered is:\\n\\n Name: " .$PatientFirstName . " " .$PatientMiddleInitial . " " .$PatientLastName." \\n Patient #: " .$SavedSSN . " \\n Date of Birth: " .$PatientDOB . " \\n Enter Date: " .$PatientRegDate . "\\n\\nYou can choose to: \\n\\n a) Return to the previous screen and make a correction to the entered Patient # or, \\n b)Merge information of the two patients and losing all Patient Registration information pertaining to the patient displayed above, retaining \\n any ICN\'s/Encounters.\\n\\nThe resulting patient \'status\' will be \'Active\' if one of the merged patients is in the \'Active\' or \'Follow\' state. It will result in \'Not Active\' if both of the merged patients are \'Not Active\' or \'Do Not Follow\'. \\n\\nTHIS PATIENT WILL NO LONGER EXIST IN THE InstiComm SYSTEM.\\n\\nInformation pertaining to patient listed below will overwrite all information except the earliest Enter Date, pertaining to patient displayed at the top of this message. The patient already in the InstiComm system with entered patient # is:\\n\\n Name: " .$dbfname . " " . $dbmidinit . " " . $dblname ."\\n Patient #: " .$dbssn . "\\n Date of Birth: " .$dbdob . " \\n Enter Date: " .$dbregdate . "\\n\\n Click on OK to replace patient information(above) with new patient information(below) or, \\n CANCEL to go back and change the Patient # whose information you wish to update!\\n\\n*** CLICKING ON OK WILL DELETE ALL EXISTING PATIENT REGISTRATION INFORMATION BELONGING TO PATIENT DISPLAYED\\n AT THE TOP BUT RETAIN ALL PATIENT ICNs/ENCOUNTERS. THE RESULTING PATIENT \'STATUS\' WILL BE ACTIVE IF ONE OF\\n THE MERGED PATIENTS IS IN THE \'Active\' OR \'Follow\' STATE. IT WILL RESULT IN \'Not Active\' IF BOTH OF THE MERGED\\n PATIENTS ARE \'NOT ACTIVE\' OR \'Do Not Follow\' *** ');"); //echo(" if (!answer) history.go(-1);"); //echo("else document.forms['UpdatedPatInfo'].submit();"); echo("</SCRIPT>"); } else ?> </head> <BODY onload="window.scroll(0,yoffset)"> <table width="900" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="4" bgcolor="#FFFFFF"> <div align="left"><font color="#FFFFFF"></font></div> <div align="right"><font color="#FFFFFF"><img src="images/title_barom.jpg" width="900" height="69"></font></div></td> </tr> <tr> <td align="left" valign="top" width="276" height="571"> <table width="276" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top"><div align="center"><img src="../images/clear.gif" height="15" width="1"><font color="#006699"><img src="images/clear.gif" height="15" width="1"><b><?PHP print($group_name); ?><br> User: </b><?PHP print($USER_NAME); ?> </font></div></td> </tr> <tr> <td align="left" valign="top"> <SCRIPT language="JavaScript"> tree.loadState() tree.display() </SCRIPT> </td> </tr> </table> <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">***********************<br> ABC Software<br> Version <? print("$version"); ?><br> *********************** <? if ($demo_disclaimer_option =='ON') { print("<br>"); print("<b>$demo_disclaimer1</b>"); print("<br>"); print("$demo_disclaimer2"); } ?> </p> <p align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><? print("<b>$copyright1</b>"); ?></p> </td> <td colspan="3" align="left" valign="top" width="624" height="571"> <br> <br> <table width="614" border="1" cellspacing="0" cellpadding="0" align="center" bordercolor="#006699"> <tr> <td bgcolor="#006699"> <b><font color="#FFFFFF">BILLING BATCH REPORT: GET LIST</font></b> </td> </tr> <tr> <td height="472"> <table width="592" border="0" cellspacing="0" cellpadding="0"> <tr> <td colspan="3"><img src="../images/clear.gif" width="1" height="15"></td> </tr> <tr> <td width="15"> </td> <td rowspan="3" align="left" valign="top" width="563"> <form action="billingMgtList.php" method="post" name="form1" id="form1" onSubmit="return validate()"> <table width="564" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="297"> <div align="right"><font class="inputLbl"> <input type="hidden" name="select1" value="<? print ("ICN"); ?>"> </font></div></td> <td colspan="2"> </td> </tr> <tr> <td width="297"> <div align="right"> <div align="right"><font class="inputLbl"> Patient Last Name: </font></div> </div></td> <td width="267" colspan="2"> <input class="txtboxLarge" type="text" name="search1" value="<? if (isset($search1)){ print ("$search1"); }?>" > </td> <td width="297"> <div align="right"><font class="inputLbl">Primary Sort: </font></div></td> <td width="133"><font class ="SELECT"> <select name="select2"> <? if (isset ($select2)){ print ("<option value ='$select2' selected>"); if ($select2== visit_date){print "Visit Date";} elseif ($select2==pat_name){print "Patient Name"; } print ("</option>"); if ($select2!='visit_date'){ print ("<option value='visit_date' >Visit Date</option>");} if ($select2 !='pat_name'){ //print ("<option value='pat_last_name'>Patient Name</option>"); } print ("<option value='pat_name'>Patient Name</option>"); } } else{ ?> <option value="visit_date" selected>Patient Name</option> <option value="pat_name">Visit Date</option> </select> <? } ?> </font></td> <td width="134"></font></td> </tr> <tr> <td width="297"> <div align="right"> <div align="right"><font class="inputLbl">Patient First Name: </font></div> </div></td> <td width="267" colspan="2"> <input class="txtboxLarge" type="text" name="search2" value="<? if (isset($search2)){ print ("$search2"); }?>" > </td> </tr> <tr> <td width="297"> <div align="right"><font class="inputLbl">Attending Provider: </font></div></td> <td width="267" colspan="2"> <?PHP $query="select phy_id, phy_fname, phy_lname from phy_det where phy_disabled = 'Enable' order by phy_lname, phy_fname"; $result = mysql_query ($query); if ($result) { print ("<select name='physician'>\n"); print ("<option value=\"\"></option>\n"); while($row = mysql_fetch_array($result)) { if($pat_phy_id == $row["phy_id"]) { print ('<option selected value="'.$row["phy_id"].'">'.$row["phy_lname"].', '.$row["phy_fname"].'</option>'); } else { print ('<option value="'.$row["phy_id"].'">'.$row["phy_lname"].', '.$row["phy_fname"].'</option>'); } } print ("</select>"); } ?> <font class="redTxt">*</font> </td> </tr> <tr> <td width="297"> <div align="right"> <div align="right"><font class="inputLbl">From Date: </font></div> </div></td> <td width="267" colspan="2"> <input class="txtboxsm" type="text" name="m2" maxlength="2" value="<? if (isset($m2)){ print ("$m2"); }?>" > / <input class="txtboxsm" type="text" name="d2" maxlength="2" value="<? if (isset($d2)){ print ("$d2"); }?>" > / <input class="txtboxsm" type="text" name="y2" maxlength="4" value="<? if (isset($y2)){ print ("$y2"); }?>" > </td> <td width="297"> <div align="right"><font class="inputLbl">Secondary Sort: </font></div></td> <td width="133"><font class ="SELECT"> <select name="select5"> <? if (isset ($select5)){ print ("<option value ='$select5' selected>"); if ($select5== visit_date){print "Visit Date";} elseif ($select5==pat_name){print "Patient Name"; } print ("</option>"); if ($select5!='visit_date'){ print ("<option value='visit_date' >Visit Date</option>");} if ($select5 !='pat_name'){ //print ("<option value='pat_last_name'>Patient Name</option>"); } print ("<option value='pat_name'>Patient Name</option>"); } } else{ ?> <option value="visit_date" selected>Visit Date</option> <option value="pat_name">Patient Name</option> </select> <? } ?> </font></td> <td width="134"></font></td> </tr> <tr> <td width="297"> <div align="right"> <div align="right"><font class="inputLbl">To Date: </font></div> </div></td> <td width="267" colspan="2"> <input class="txtboxsm" type="text" name="m1" maxlength="2" value="<? if (isset($m1)){ print ("$m1"); }?>" > / <input class="txtboxsm" type="text" name="d1" maxlength="2" value="<? if (isset($d1)){ print ("$d1"); }?>" > / <input class="txtboxsm" type="text" name="y1" maxlength="4" value="<? if (isset($y1)){ print ("$y1"); }?>" > <script language="JavaScript"></script> </td> </tr> <tr> <td width="297"> <div align="right"><font class="inputLbl">Billing Status: </font></div></td> <td width="267" colspan="2" align="left" valign="top"><select name="billingrecordtype" id="billingrecordtype"> <?PHP if($billingrecordtype == "Not Billable") { ?> <option value="Not Billable" selected>Not Billable</option> <option value="Billable">Billable</option> <? } else { ?> <!--**********'Active' option is the default option for this field on page load**********--> <option value="Billable" selected>Billable</option> <option value="Not Billable">Not Billable</option> <? } ?> </td> </tr> <tr> <td width="283"> <div align="right"><font class="inputLbl"> <input type="hidden" name="client_id" value="<? print ("1"); ?>"> </font></div></td> <td colspan="2"> </td> </tr> <tr> <td width="297"> <div align="right"></div></td> <td width="267" colspan="2"> <input class="sbttn" type="submit" name="Submit" value="Search"> </td> </tr> </table> </form> <table width="614" border="0" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#006699"> <div align="left"><b><font color="#FFFFFF"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Name </font></font></b></div></td> <td bgcolor="#006699"> <div align="center"><b><font color="#FFFFFF"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Visit Date </font></font></b></div></td> <td bgcolor="#006699"> <div align="center"><b><font color="#FFFFFF"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Procedure </font></font></b></div></td> <td bgcolor="#006699"> <div align="center"><b><font color="#FFFFFF"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Diagnosis </font></font></b></div></td> <td bgcolor="#006699"> <div align="center"><b><font color="#FFFFFF"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">APrv </font></b></div></td> <td bgcolor="#006699"> <div align="center"><b><font color="#FFFFFF"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Location </font></font></b></div></td> <td bgcolor="#006699"> <div align="center"><b><font color="#FFFFFF"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Patient # </font></font></b></div></td> <div align="center"><b><font color="#FFFFFF"></font></b></div></td> </tr> <?PHP if ($select1) { if (empty($m1)&& empty($d1) && empty ($y1)) { $query3="select Date_Format(curdate(), '%Y/%m/%d/') as dates"; $resultz=mysql_db_query("$database[dbname]", $query3); $rz=mysql_fetch_array($resultz); $dates=$rz["dates"]; } else { //$dates=trim("$y1")."/".trim("$m1")."/".trim("$d1+1"); $dates=trim("$y1")."/".trim("$m1")."/".trim("$d1"); //**********new line added to implement date format in mm/dd/yyyy when displayed on screen for date created field********** $dateto=trim("$m1")."/".trim("$d1")."/".trim("$y1"); } if (empty($m2)&& empty($d2) && empty ($y2)) { $datez=""; $datefrom=""; } else { $datez=trim("$y2")."/".trim("$m2")."/".trim("$d2"); $datefrom=trim("$m2")."/".trim("$d2")."/".trim("$y2"); } $search1=trim("$search1"); $search2=trim("$search2"); $search3=trim("$search3"); $search4=trim("$search4"); $select1=trim("$select1"); $select2=trim("$select2"); $select5=trim("$select5"); if(($select2 == 'visit_date') AND ($select== 'DESC')) { $select3= "visit_date DESC, visit_time"; } elseif(($select2 == 'visit_date') AND ($select== 'ASC')) { $select3= "visit_date ASC, visit_time"; } elseif(($select2 == 'pat_name') AND ($select== 'ASC')) { $select3= "pat_last_name ASC, " . "pat_first_name"; } elseif(($select2 == 'pat_name') AND ($select== 'DESC')) { $select3= "pat_last_name DESC, " . "pat_first_name"; } if(($select5 == 'visit_date') AND ($select4== 'DESC')) { $select6= "visit_date DESC, visit_time"; } elseif(($select5 == 'visit_date') AND ($select4== 'ASC')) { $select6= "visit_date ASC, visit_time"; } elseif(($select5 == 'pat_name') AND ($select4== 'ASC')) { $select6= "pat_last_name ASC, " . "pat_first_name"; } elseif(($select5 == 'pat_name') AND ($select4== 'DESC')) { $select6= "pat_last_name DESC, " . "pat_first_name"; } $query2="SELECT visit_mgr.visit_id, visit_mgr.visit_pat_id, visit_mgr.visit_phy_id, visit_mgr.visit_status, Date_Format(visit_mgr.visit_date, '%m/%d/%Y') as date, phy_det.phy_fname, phy_det.phy_minit, phy_det.phy_lname, pat_dgraphics.pat_ID, pat_dgraphics.pat_first_name, pat_dgraphics.pat_mid_init, pat_dgraphics.pat_last_name, Date_Format(pat_dgraphics.pat_dob, '%m/%d/%Y') as pat_birthday, pat_dgraphics.pat_ssn, pat_dgraphics.pat_sex, pat_dgraphics.pat_ID, visit_mgr.client_id, dcn.dcn_approved_for_billing, dcn.dcn_posted_for_billing, dcn.dcn_billing_status FROM visit_mgr, phy_det, pat_dgraphics, dcn WHERE visit_mgr.visit_type like '%$select1%' AND phy_det.phy_id=visit_mgr.visit_phy_id AND visit_mgr.visit_pat_id=pat_dgraphics.pat_ssn AND phy_det.phy_fname like '%$search3%' AND phy_det.phy_lname like '%$search4%' AND pat_dgraphics.pat_first_name like '%$search1%' AND pat_dgraphics.pat_last_name like '%$search2%' AND pat_dgraphics.pat_ssn like '%$search5%' AND visit_mgr.visit_date <= '$dates' AND visit_mgr.visit_date >= '$datez' AND dcn.dcn_tran_ID=visit_mgr.visit_palm_db_id AND dcn.dcn_posted_for_billing='No' AND dcn.dcn_billing_status='$billingrecordtype' ORDER BY $select3 $select6"; print($query2); $result2=mysql_db_query("$database[dbname]", $query2); $num_rows2=mysql_num_rows($result2); $num_results2=mysql_num_rows($result2); $i=1; if(!isset($rowNum)) { $rowNum = 0; } $rowNumHold = $rowNum; //echo "$rowNum"; $count = 1; $limit_results = 25; if ($num_rows2 > 0) { $billing_batch_flag='No'; 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); 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=\"center\">"); print ("<a href=\"Recorddetails_billing.php?select=$select&select1=$select1&select2=$select2&select3=$select3&m1=$m1&d1=$d1&y1=$y1&m2=$m2&d2=$d2&y2=$y2&visit_id=$row2->visit_id&visit_type=ICN&client_id=$row2->client_id&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_ssn=$row2->pat_ssn&pat_sex=$row2->pat_sex&billingrecordtype=$billingrecordtype&rowNum=$rowNum\">$row2->date</a>"); print("</div></td>"); print("<td height=\"14\"> <div align=\"center\">"); $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=\"center\">"); $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. "); print($row2->phy_fname[0]); print($row2->phy_minit); print($row2->phy_lname[0]); print("</div></td>"); $prefprov_phyid=$row2->prefphyid; print("<td height=\"14\"> <div align=\"center\">"); $locquery="SELECT admit_loc from admission where pat_id='$row2->pat_ID'"; $locresult=mysql_query($locquery); $locrow = mysql_fetch_array($locresult); $loc = $locrow["admit_loc"]; print($loc); print("</div></td>"); print("<td height=\"14\"> <div align=\"center\">"); print($row2->pat_ssn); print("</div></td>"); $client_id=($row2->client_id); 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> "); for($z=0;$z<$pages;$z++) { print("<a href=\"billingMgtList.php?rowNum="); print ($limit_results*$z); print("&select1="); print($select1); print("&select="); print($select); print("&select2="); print($select2); print("&select3="); print($select3); print("&search3="); print($search3); print("&select4="); print($select4); print("&select5="); print($select5); print("&select6="); print($select6); print("&search1="); print($search1); print("&search2="); print($search2); print("&search4="); print($search4); print("&search5="); print($search5); print("&billingrecordtype="); print($billingrecordtype); print("&m1="); print($m1); print("&m2="); print($m2); print("&y1="); print($y1); print("&y2="); print($y2); print("&d1="); print($d1); print("&d2="); print($d2); print("\">"); if(($z + 1) == (($rowNumHold/$limit_results) + 1)) { print("["); print($z + 1); print("]"); } else { print($z + 1); } print("</a> "); } print(" ($num_rows2 records found)"); print("</div></td>"); print("</tr>"); } else { ?> <tr> <td height="14" bgcolor="#CCCCCC"> </td> <td height="14" bgcolor="#CCCCCC">No Records ...</td> <td height="14" bgcolor="#CCCCCC"> </td> <td height="14" bgcolor="#CCCCCC"> </td> <td height="14" bgcolor="#CCCCCC"> </td> </tr> <?PHP } } ?> </table></td> <tr> <td width="15" height="431"><img src="../images/clear.gif" width="15" height="8"></td> <td width="15" height="431"> </td> </tr> <tr> <td colspan="3" height="2"> </td> </tr> </table></td> <table width="564" border="0" cellspacing="0" cellpadding="0"> <br> <tr> <td width="15"> </td> <td width="14"> </td> </tr> <tr> <td width="252"> <div align="left"> </div></td> <td colspan="1"> <!--<form name="form1" method="post" action="billingPostCard.php?type=posttcard">--> <form name="form1" method="post" action="billingPostCard.php?type=posttcard" onSubmit="return validateGenerateButton()"> <div align="center"> <p> <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_first_name" value="<? print ("$pat_first_name"); ?>"> <input type="hidden" name="pat_last_name" value="<? print ("$pat_last_name"); ?>"> <input type="hidden" name="pat_phy_id" value="<? print ("$pat_phy_id"); ?>"> <input type="hidden" name="pat_ssn" value="<? print("$pat_ssn"); ?>"> <input type="hidden" name="enter_date" value="<? print ("$enter_date"); ?>"> <input type="hidden" name="visit_timestamp_received" value="<? print ("$visit_timestamp_received"); ?>"> <input type="hidden" name="visit_palm_db_id" value="<? print ("$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="select2" type="hidden" id="select2" value="<? print("$select2"); ?>"> <input name="select" type="hidden" id="select" value="<? print("$select"); ?>"> <input name="select1" type="hidden" id="select1" value="<? print("$select1"); ?>"> <input name="select4" type="hidden" id="select4" value="<? print("$select4"); ?>"> <input name="select5" type="hidden" id="select5" value="<? print("$select5"); ?>"> <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 name="billingrecordtype" type="hidden" id="billingrecordtype" value="<? print ("$billingrecordtype"); ?> "> <input type="hidden" name="username" value="<? print ("$USER_NAME"); ?>"> <input class="sbttn" type="submit" align="center" name="action" value="Generate Final Report"> <? /* if (!is_numeric($pat_ssn)) { //post to billingPostCard.php echo("<SCRIPT LANGUAGE=Javascript>"); 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. ');"); echo(" if (!answer) history.go(-1);"); echo("else document.forms['billingPostCard'].submit();"); echo("</SCRIPT>"); } */ ?> </p> </div> </form> </td> <td width="222"> <div align="left"> </div></td> <td colspan="3"> <!--<td colspan="3" width="624"><div align="center">--> <form action="billingPrintlists.php?type=billinglist" method="post" name="form1" id="form"> <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="select2" type="hidden" id="select2" value="<? print("$select2"); ?>"> <input name="select" type="hidden" id="select" value="<? print("$select"); ?>"> <input name="select1" type="hidden" id="select1" value="<? print("$select1"); ?>"> <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 name="billingrecordtype" type="hidden" id="billingrecordtype" value="<? print("$billingrecordtype"); ?> "> <input name="billing_batch_flag" type="hidden" id="billing_batch_flag" value="<? print("$billing_batch_flag"); ?> "> <input name="client_id" type="hidden" id="client_id" value="<? print ("$client_id"); ?>"> <input class="sbttn" type="submit" name="Submit2" value="Print-Friendly"> </form> </td> </tr> </table> </tr> </table><p> </p></td> </tr> </table> </body> </html> <?PHP mysql_close(); ?> thanx Quote Link to comment https://forums.phpfreaks.com/topic/73511-help-with-code-for-button-on-click/#findComment-371671 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.