// Compute $duncount as in sl_eob_search.php to determine if // this invoice is at patient responsibility. $duncount = substr_count(strtolower($irow['intnotes']), "statement sent"); if (!$duncount) { $insgot = strtolower($irow['notes']); $inseobs = strtolower($irow['shipvia']); foreach (array('ins1', 'ins2', 'ins3') as $value) { if (strpos($insgot, $value) !== false && strpos($inseobs, $value) === false) { --$duncount; } } } $inspaid = $irow['paid'] + $irow['ptpayments'] - $irow['adjustments']; $balance = $irow['amount'] - $irow['paid']; $duept = $duncount < 0 ? 0 : $balance; echoLine("form_bpay[{$enc}]", $svcdate, $irow['charges'], 0 - $irow['ptpayments'], $inspaid, $duept); } } // end not $INTEGRATED_AR // Continue with display of the data entry form. ?> <tr bgcolor="#cccccc"> <td class="dehead" id='td_total_1'></td> <td class="dehead" id='td_total_2'></td> <td class="dehead" id='td_total_3'></td> <td class="dehead" id='td_total_4'></td> <td class="dehead" id='td_total_5'></td> <td class="dehead" id='td_total_6'></td> <td class="dehead" id='td_total_7'></td> <td class="dehead" id='td_total_8'></td>
$result = sqlQuery("SELECT * FROM drug_templates WHERE " . "drug_id = ? AND selector = ?", array($newcode, $newsel)); $units = max(1, intval($result['quantity'])); $prrow = sqlQuery("SELECT prices.pr_price " . "FROM patient_data, prices WHERE " . "patient_data.pid = ? AND " . "prices.pr_id = ? AND " . "prices.pr_selector = ? AND " . "prices.pr_level = patient_data.pricelevel " . "LIMIT 1", array($pid, $newcode, $newsel)); $fee = empty($prrow) ? 0 : $prrow['pr_price']; echoProdLine(++$prod_lino, $newcode, FALSE, $units, $fee); } else { list($code, $modifier) = explode(":", $newcode); $ndc_info = ''; // If HCPCS, find last NDC string used for this code. if ($newtype == 'HCPCS' && $ndc_applies) { $tmp = sqlQuery("SELECT ndc_info FROM billing WHERE " . "code_type = ? AND code = ? AND ndc_info LIKE 'N4%' " . "ORDER BY date DESC LIMIT 1", array($newtype, $code)); if (!empty($tmp)) { $ndc_info = $tmp['ndc_info']; } } echoLine(++$bill_lino, $newtype, $code, trim($modifier), $ndc_info); } } } } $tmp = sqlQuery("SELECT provider_id, supervisor_id FROM form_encounter " . "WHERE pid = ? AND encounter = ? " . "ORDER BY id DESC LIMIT 1", array($pid, $encounter)); $encounter_provid = 0 + findProvider(); $encounter_supid = 0 + $tmp['supervisor_id']; ?> </table> </p> <br /> <?php
$dpayment_pat = $drow['payments']; //------------------------------------------------------------------------------------ //NumberOfInsurance $ResultNumberOfInsurance = sqlStatement("SELECT COUNT( DISTINCT TYPE ) NumberOfInsurance FROM insurance_data\n\t\t\twhere pid = ? and provider>0 ", array($pid)); $RowNumberOfInsurance = sqlFetchArray($ResultNumberOfInsurance); $NumberOfInsurance = $RowNumberOfInsurance['NumberOfInsurance'] * 1; //------------------------------------------------------------------------------------ $duept = 0; if ($NumberOfInsurance == 0 || $value['last_level_closed'] == 4 || $NumberOfInsurance == $value['last_level_closed']) { //Patient balance $brow = sqlQuery("SELECT SUM(fee) AS amount FROM billing WHERE " . "pid = ? and encounter = ? AND activity = 1", array($pid, $enc)); $srow = sqlQuery("SELECT SUM(fee) AS amount FROM drug_sales WHERE " . "pid = ? and encounter = ? ", array($pid, $enc)); $drow = sqlQuery("SELECT SUM(pay_amount) AS payments, " . "SUM(adj_amount) AS adjustments FROM ar_activity WHERE " . "pid = ? and encounter = ? ", array($pid, $enc)); $duept = $brow['amount'] + $srow['amount'] - $drow['payments'] - $drow['adjustments']; } echoLine("form_upay[{$enc}]", $dispdate, $value['charges'], $dpayment_pat, $dpayment + $dadjustment, $duept, $enc, $inscopay, $patcopay); } // Continue with display of the data entry form. ?> <tr bgcolor="#cccccc"> <td class="dehead" id='td_total_1'></td> <td class="dehead" id='td_total_2'></td> <td class="dehead" id='td_total_3'></td> <td class="dehead" id='td_total_4'></td> <td class="dehead" id='td_total_5'></td> <td class="dehead" id='td_total_6'></td> <td class="dehead" id='td_total_7'></td> <td class="dehead" id='td_total_8'></td> <td class="dehead" align="right"> <?php
function getBooks() { //This is the main function. $fp = fopen("books.txt","r"); rewind($fp); while(!feof($fp)) { $line = fgets($fp); $element = split("\|", $line); //This line of code ensures only loaned items are displayed. if(strcmp(trim($element[7]), "On Loan") == 0) { //These two arrays will be sorted for display. $dueItems["$element[0]"] = $element[10]; } } //Sort the associative array but keep the relative key values. asort($dueItems); //Put the key values into an array for comparison. foreach($dueItems as $key => $value) { $dueKeys[] = $key; } //Echo the items to screen in date order. rewind($fp); foreach($dueKeys as $value) { while(!feof($fp)) { $line = fgets($fp); $element = split("\|", $line); if(strcmp(trim($element[0]), trim($value)) == 0) { echoLine($element); } } rewind($fp); } }
function getBooks() { $fp = fopen("books.txt","r"); rewind($fp); $searched = $_GET['type']; $_SESSION['search'] = $_GET['search']; $borrow = $_POST['borrow']; if(isset($borrow)) { $cfp = fopen("bookcopy.txt","w"); while(!feof($fp)) { $line = fgets($fp); $element = split("\|", $line); if(strcmp($element[0], $_SESSION['book']) == 0) { $element[7] = "On Loan"; $element[9] = $_SESSION['uname']; $element[10] = date("d-m-y",mktime(0,0,0,date("m"),date("d")+14,date("y"))); echoLine($element); $write_values = implode("|",$element); fwrite($cfp, $write_values); } else { fwrite($cfp,$line); } } fclose($fp); fclose($cfp); $bookFile = "books.txt"; $copyFile = "bookcopy.txt"; $fp = fopen($bookFile, "w+"); $cfp = fopen($copyFile, "r"); $file_contents = fread($cfp, filesize($copyFile)); fwrite($fp, $file_contents); fclose($cfp); rewind($fp); fclose($fp); } else if(isset($searched)) { if($_SESSION['search'] != '') { $searchType = $_GET['type']; $titles = array("title","author","category","year","pages","notes","ISBN","status","keywords"); for($counter=0;$counter<count($titles);$counter++) { if($searchType == $titles[$counter]) { $arrayNum = $counter; } } while(!feof($fp)) { $line = fgets($fp); $element = split("\|", $line); if(stristr($element[$arrayNum],$_SESSION['search']) == TRUE) { echoLine($element); if(strcmp($element[$arrayNum],$_SESSION['search']) == 0) { if(trim($element[7]) != "On Loan") { borrow_button(); } $_SESSION['book'] = $element[$arrayNum]; } } } } } }
function getBooks() { $fp = fopen("books.txt","r"); rewind($fp); $return = $_POST['return']; if (isset($return)) { $toReturn = $_POST['toReturn']; $cfp = fopen("bookcopy.txt","w"); for($counter=0;$counter<count($toReturn);$counter++) { while(!feof($fp)) { $line = fgets($fp); $element = split("\|", $line); if(strcmp($element[0], $toReturn[$counter]) == 0) { $element[7] = "Available"; $element[9] = " "; $element[10] = " "; echoLine($element); $write_values = implode("|",$element); fwrite($cfp, $write_values); } else { fwrite($cfp,$line); } } echo "<tr><td></td><td><p>Display all of <a href='return.php'>My Books</a></p></td></td></tr>"; fclose($fp); fclose($cfp); $bookFile = "books.txt"; $copyFile = "bookcopy.txt"; $fp = fopen($bookFile, "w+"); $cfp = fopen($copyFile, "r"); $file_contents = fread($cfp, filesize($copyFile)); fwrite($fp, $file_contents); fclose($cfp); rewind($fp); fclose($fp); } } else { echo "<form action='return.php' method='post'>"; while(!feof($fp)) { $line = fgets($fp); $element = split("\|", $line); if(strcmp(trim($element[9]), $_SESSION['uname']) == 0 and trim($element[9]) != "") { echoLine($element); $counter++; } } if($counter != 0) { return_button(); } else { echo "<tr><td></td><p>You have no books. <a href='search.html'>Search</a> for books.</p></td></tr>"; } } }
echo "[YES]\\Exception IS extends from \\BaseException"; } else { echo "[NO]\\Exception IS NOT extends from \\BaseException"; } echoLine(); try { eval('notExistFunction();'); } catch (\BaseException $e) { var_dump($e); } try { eval('parseErrorLine'); } catch (\ParseException $e) { var_dump($e); } echoLine(); echo "End of Test."; function echoLine() { echo PHP_EOL . "===============" . PHP_EOL . PHP_VERSION . PHP_EOL . "===============" . PHP_EOL; } /* //(非官方编译)https://phpdev.toolsforresearch.com/php-7.0.0alpha1-Win32-VC14-x86.zip =============== 7.0.0alpha1 =============== [YES]\Exception IS extends from \BaseException =============== 7.0.0alpha1
function getStudents() { $fp = fopen("users.txt","r"); rewind($fp); $searched = $_POST['searched']; $edit = $_POST['edit']; $submit = $_POST['submit']; if(isset($submit)) { $isMatch = false; $cfp = fopen("usercopy.txt","w"); while(!feof($fp)) { $line = fgets($fp); $element = split("\|", $line); if(strcasecmp(($element[2] . " " . $element[3]), $_SESSION['search_student']) == 0) { $isMatch = true; //Assign variables to capture (trimmed) input from the form. $uname = str_replace(" ","",$_POST['uname']); $pword = str_replace(" ","",$_POST['pword']); $fname = str_replace(" ","",$_POST['fname']); $lname = str_replace(" ","",$_POST['lname']); $snumber = str_replace(" ","",$_POST['snumber']); $email = str_replace(" ","",$_POST['email']); $program = str_replace(" ","",$_POST['program']); $program_end = str_replace(" ","",$_POST['program_end']); $birth = str_replace(" ","",$_POST['birth']); $telephone = str_replace(" ","",$_POST['telephone']); $address = str_replace(" ","",$_POST['address']); $suburb = str_replace(" ","",$_POST['suburb']); $state = str_replace(" ","",$_POST['state']); $pcode = str_replace(" ","",$_POST['pcode']); $status = str_replace(" ","",$_POST['status']); $write_values = array("$uname","$pword","$fname","$lname","$snumber","$email","$program", "$program_end","$birth","$telephone","$address","$suburb","$state","$pcode","Student","$status"); echoLine($write_values); echo "<tr><td></td><td><p>Back to <a href='students.php'>Student Management</a>.</p></td>"; $write_values = implode("|",$write_values); fwrite($cfp, $write_values); fwrite($cfp,"\n"); } else { $isMatch = false; fwrite($cfp,$line); } } fclose($fp); fclose($cfp); $userFile = "users.txt"; $copyFile = "usercopy.txt"; $fp = fopen($userFile, "w+"); $cfp = fopen($copyFile, "r"); $file_contents = fread($cfp, filesize($copyFile)); fwrite($fp, $file_contents); fclose($cfp); rewind($fp); fclose($fp); } else if(isset($edit)) { $isMatch = false; while(!feof($fp) and $isMatch == false) { $line = fgets($fp); $element = split("\|", $line); //This compares the first and second name of a student with the search field. if(strcasecmp(($element[2] . " " . $element[3]), $_SESSION['search_student']) == 0) { $isMatch = true; editForm($element); } else { $isMatch = false; } } } else if(isset($searched)) { $_SESSION['search_student'] = $_POST['search_student']; $isMatch = false; while(!feof($fp) and $isMatch == false) { $line = fgets($fp); $element = split("\|", $line); if(strcasecmp(($element[2] . " " . $element[3]), $_SESSION['search_student']) == 0) { $isMatch = true; echoLine($element); edit_button(); } else { $isMatch = false; } } } else { while (!feof($fp)) { $line = fgets($fp); $element = split("\|", $line); if(strcmp(trim($element[14]), "Student") == 0) { echoLine($element); } } } }
function getBooks() { $fp = fopen("books.txt","r"); rewind($fp); $searched = $_GET['type']; $_SESSION['search'] = $_GET['search']; if(isset($searched)) { if($_SESSION['search'] != '') { $searchType = $_GET['type']; $titles = array("title","author","category","year","pages","notes","ISBN","status","keywords"); for($counter=0;$counter<count($titles);$counter++) { if($searchType == $titles[$counter]) { $arrayNum = $counter; } } while(!feof($fp)) { $line = fgets($fp); $element = split("\|", $line); if(stristr($element[$arrayNum],$_SESSION['search']) == TRUE) { echoLine($element); if(strcmp($element[$arrayNum],$_SESSION['search']) == 0) { borrow_button(); } } } } } else { showBooks($fp); } }
function getBooks() { $fp = fopen("books.txt","r"); rewind($fp); $searched = $_POST['searched']; $edit = $_POST['edit']; $submit = $_POST['submit']; $add = $_POST['add']; $addbook = $_POST['addbook']; $delete = $_POST['delete']; if(isset($delete)) { $cfp = fopen("bookcopy.txt","w"); while(!feof($fp)) { $line = fgets($fp); $element = split("\|", $line); if(strcasecmp($element[0], $_SESSION['search_book']) != 0) { fwrite($cfp,$line); } } fclose($fp); fclose($cfp); $bookFile = "books.txt"; $copyFile = "bookcopy.txt"; $fp = fopen($bookFile, "w+"); $cfp = fopen($copyFile, "r"); $file_contents = fread($cfp, filesize($copyFile)); fwrite($fp, $file_contents); rewind($fp); showBooks($fp); add_button(); fclose($fp); fclose($cfp); } else if(isset($add)) { addForm(); } else if(isset($addbook)) { $isMatch = false; $fp = fopen("books.txt","a"); fwrite($fp,"\n"); $title = trim($_POST['title']); $author = trim($_POST['author']); $category = trim($_POST['category']); $year = trim($_POST['year']); $pages = trim($_POST['pages']); $notes = trim($_POST['notes']); $cnumber = trim($_POST['cnumber']); $status = trim($_POST['status']); $keywords = trim($_POST['keywords']); $borrower = "|"; $due = "|"; $write_values = array("$title","$author","$category","$year","$pages","$notes","$cnumber","$status","$keywords", "$borrower","$due"); echoLine($write_values); //Need to echo this to so I can use the echoLine function before imploding. add_button(); echo "<tr><td></td><td><p>Display all books on <a href='books.php'>Item Management</a> page.</p></td>"; $write_values = implode("|",$write_values); fwrite($fp, $write_values); rewind($fp); fclose($fp); } else if(isset($submit)) { $cfp = fopen("bookcopy.txt","w"); while(!feof($fp)) { $line = fgets($fp); $element = split("\|", $line); if(strcasecmp($element[0], $_SESSION['search_book']) == 0) { $title = trim($_POST['title']); $author = trim($_POST['author']); $category = trim($_POST['category']); $year = trim($_POST['year']); $pages = trim($_POST['pages']); $notes = trim($_POST['notes']); $cnumber = trim($_POST['cnumber']); $status = trim($_POST['status']); $keywords = trim($_POST['keywords']); $borrower = trim($_POST['borrower']); $due = trim($_POST['due']) . " |"; $write_values = array("$title","$author","$category","$year","$pages","$notes","$cnumber","$status","$keywords","$borrower","$due"); echoLine($write_values); echo "<tr><td></td><td><p>Display all books on <a href='books.php'>Item Management</a> page.</p></td>"; $write_values = implode("|",$write_values); fwrite($cfp, $write_values); fwrite($cfp,"\n"); } else { fwrite($cfp,$line); } } fclose($fp); fclose($cfp); $bookFile = "books.txt"; $copyFile = "bookcopy.txt"; $fp = fopen($bookFile, "w+"); $cfp = fopen($copyFile, "r"); $file_contents = fread($cfp, filesize($copyFile)); fwrite($fp, $file_contents); rewind($fp); fclose($fp); fclose($cfp); } else if(isset($edit)) { $isMatch = false; while(!feof($fp) and $isMatch == false) { $line = fgets($fp); $element = split("\|", $line); if(strcasecmp(trim($element[0]), $_SESSION['search_book']) == 0) { $isMatch = true; editForm($element); } else { $isMatch = false; } } } else if(isset($searched)) { $_SESSION['search_book'] = $_POST['search_book']; $isMatch = false; while(!feof($fp) and $isMatch == false) { $line = fgets($fp); $element = split("\|", $line); if(strcasecmp($element[0], $_SESSION['search_book']) == 0) { $isMatch = true; echoLine($element); delEditButtons(); } else { $isMatch = false; } } } else { showBooks($fp); add_button(); } }
<?php function echoLine($str) { echo $str . PHP_EOL; } /** * PHP tries to convert everything to number. * 'hello' . 1 implies on 'hello1', with is treated like 0 * * 0 + 2 = 2 concat 34 ... resulting in 234 * * More info about this sourcery: * http://stackoverflow.com/a/16294882/2099835 * http://php.net/manual/pt_BR/language.operators.string.php#41950 */ echoLine('hello' . 1 + 2 . '34'); echoLine('hello' . 1 + 2 . 'hello'); echoLine('hello' . (1 + 2) . '34'); echoLine(1 + 2 . '34'); echoLine('34' . 1 + 2);