private function getIncudes($val) { global $pid; if ($val == "demographics") { ?> <hr /> <div class='text demographics' id='DEM'> <?php // printRecDataOne($patient_data_array, getRecPatientData ($pid), $N); $result1 = getPatientData($pid); $result2 = getEmployerData($pid); ?> <table> <tr><td><h6><?php echo htmlspecialchars(xl('Patient Data') . ":", ENT_QUOTES); ?> </h6></td></tr> <?php display_layout_rows('DEM', $result1, $result2); ?> </table> </div> <?php } elseif ($val == "history") { ?> <hr /> <div class='text history' id='HIS'> <?php $result1 = getHistoryData($pid); ?> <table> <tr><td><h6><?php echo htmlspecialchars(xl('History Data') . ":", ENT_QUOTES); ?> </h6></td></tr> <?php display_layout_rows('HIS', $result1); ?> </table> </div> <?php } elseif ($val == "insurance") { ?> <hr /> <div class='text insurance'>"; <h6><?php echo htmlspecialchars(xl('Insurance Data') . ":", ENT_QUOTES); ?> </h6> <br><span class=bold><?php echo htmlspecialchars(xl('Primary Insurance Data') . ":", ENT_QUOTES); ?> </span><br> <?php printRecDataOne($insurance_data_array, getRecInsuranceData($pid, "primary"), $N); ?> <span class=bold><?php echo htmlspecialchars(xl('Secondary Insurance Data') . ":", ENT_QUOTES); ?> </span><br> <?php printRecDataOne($insurance_data_array, getRecInsuranceData($pid, "secondary"), $N); ?> <span class=bold><?php echo htmlspecialchars(xl('Tertiary Insurance Data') . ":", ENT_QUOTES); ?> </span><br> <?php printRecDataOne($insurance_data_array, getRecInsuranceData($pid, "tertiary"), $N); ?> </div> <?php } elseif ($val == "billing") { ?> <hr /> <div class='text billing'> <h6><?php echo htmlspecialchars(xl('Billing Information') . ":", ENT_QUOTES); ?> </h6> <?php if (count($ar['newpatient']) > 0) { $billings = array(); ?> <table> <tr><td width='400' class='bold'><?php echo htmlspecialchars(xl('Code'), ENT_QUOTES); ?> </td><td class='bold'><?php echo htmlspecialchars(xl('Fee'), ENT_QUOTES); ?> </td></tr> <?php $total = 0.0; $copays = 0.0; foreach ($ar['newpatient'] as $be) { $ta = split(":", $be); $billing = getPatientBillingEncounter($pid, $ta[1]); $billings[] = $billing; foreach ($billing as $b) { ?> <tr> <td class=text> <?php echo htmlspecialchars($b['code_type'], ENT_QUOTES) . ":\t" . htmlspecialchars($b['code'], ENT_QUOTES) . " " . htmlspecialchars($b['modifier'], ENT_QUOTES) . " " . htmlspecialchars($b['code_text'], ENT_QUOTES) . " "; ?> </td> <td class=text> <?php echo htmlspecialchars(oeFormatMoney($b['fee']), ENT_QUOTES); ?> </td> </tr> <?php $total += $b['fee']; if ($b['code_type'] == "COPAY") { $copays += $b['fee']; } } } echo "<tr><td> </td></tr>"; echo "<tr><td class=bold>" . htmlspecialchars(xl('Sub-Total'), ENT_QUOTES) . "</td><td class=text>" . htmlspecialchars(oeFormatMoney($total + abs($copays)), ENT_QUOTES) . "</td></tr>"; echo "<tr><td class=bold>" . htmlspecialchars(xl('Paid'), ENT_QUOTES) . "</td><td class=text>" . htmlspecialchars(oeFormatMoney(abs($copays)), ENT_QUOTES) . "</td></tr>"; echo "<tr><td class=bold>" . htmlspecialchars(xl('Total'), ENT_QUOTES) . "</td><td class=text>" . htmlspecialchars(oeFormatMoney($total), ENT_QUOTES) . "</td></tr>"; echo "</table>"; echo "<pre>"; //print_r($billings); echo "</pre>"; } else { printPatientBilling($pid); } echo "</div>\n"; // end of billing DIV } elseif ($val == "immunizations") { ?> <hr /> <div class='text immunizations'> <h6><?php echo htmlspecialchars(xl('Patient Immunization') . ":", ENT_QUOTES); ?> </h6> <?php $sql = "select i1.immunization_id as immunization_id, if(i1.administered_date,concat(i1.administered_date,' - ') ,substring(i1.note,1,20) ) as immunization_data from immunizations i1 where i1.patient_id = ? order by administered_date desc"; $result = sqlStatement($sql, array($pid)); while ($row = sqlFetchArray($result)) { echo htmlspecialchars($row['immunization_data'], ENT_QUOTES); echo generate_display_field(array('data_type' => '1', 'list_id' => 'immunizations'), $row['immunization_id']); ?> <br> <?php } ?> </div> <?php } elseif ($val == "batchcom") { ?> <hr /> <div class='text transactions'> <h6><?php htmlspecialchars(xl('Patient Communication sent') . ":", ENT_QUOTES); ?> </h6> <?php $sql = "SELECT concat( 'Messsage Type: ', batchcom.msg_type, ', Message Subject: ', batchcom.msg_subject, ', Sent on:', batchcom.msg_date_sent ) AS batchcom_data, batchcom.msg_text, concat( users.fname, users.lname ) AS user_name FROM `batchcom` JOIN `users` ON users.id = batchcom.sent_by WHERE batchcom.patient_id=?"; $result = sqlStatement($sql, array($pid)); while ($row = sqlFetchArray($result)) { echo htmlspecialchars($row['batchcom_data'] . ", " . xl('By') . ": " . $row['user_name'], ENT_QUOTES); ?> <br><?php echo htmlspecialchars(xl('Text'), ENT_QUOTES); ?> :<br><?php echo htmlspecialchars($row['msg_txt'], ENT_QUOTES); ?> <br> <?php } ?> </div> <?php } elseif ($val == "notes") { ?> <hr /> <div class='text notes'> <h6><?php echo htmlspecialchars(xl('Patient Notes') . ":", ENT_QUOTES); ?> </h6> <?php printPatientNotes($pid); ?> </div> <?php } elseif ($val == "transactions") { ?> <hr /> <div class='text transactions'> <h6><?php echo htmlspecialchars(xl('Patient Transactions') . ":", ENT_QUOTES); ?> </h6> <?php printPatientTransactions($pid); ?> </div> <?php } }
// extention matches list $to_url = "<td> <a href = {$web_root}" . "/controller.php?document&retrieve&patient_id={$pid}&document_id={$doc_id}" . "/tmp{$extension}" . " onclick=top.restoreSession(); class='image_modal'>" . " <img src = {$web_root}" . "/controller.php?document&retrieve&patient_id={$pid}&document_id={$doc_id}" . " width=100 alt='{$doc_catg}:{$image_file}'> </a> </td> <td valign='center'>" . htmlspecialchars($doc_catg) . '<br /> ' . htmlspecialchars($image_file) . "</td>"; } else { $to_url = "<td> <a href='" . $web_root . "/controller.php?document&retrieve" . "&patient_id={$pid}&document_id={$doc_id}'" . " onclick='top.restoreSession()' class='css_button_small'>" . "<span>" . htmlspecialchars(xl("View"), ENT_QUOTES) . "</a> " . htmlspecialchars("{$doc_catg} - {$image_file}", ENT_QUOTES) . "</span> </td>"; } echo "<table><tr>"; echo $to_url; echo "</tr></table>"; } // Determine if the Vitals form is in use for this site. $tmp = sqlQuery("SELECT count(*) AS count FROM registry WHERE " . "directory = 'vitals' AND state = 1"); $vitals_is_registered = $tmp['count']; // Get patient/employer/insurance information. // $result = getPatientData($pid, "*, DATE_FORMAT(DOB,'%Y-%m-%d') as DOB_YMD"); $result2 = getEmployerData($pid); $result3 = getInsuranceData($pid, "primary", "copay, provider, DATE_FORMAT(`date`,'%Y-%m-%d') as effdate"); $insco_name = ""; if ($result3['provider']) { // Use provider in case there is an ins record w/ unassigned insco $insco_name = getInsuranceProvider($result3['provider']); } ?> <html> <head> <?php html_header_show(); ?> <link rel="stylesheet" href="<?php echo $css_header;
Add("employer_state", $row["semployer_state{$seq}"]); Add("employer_zip", $row["semployer_zip{$seq}"]); Add("employer_country", $row["semployer_country{$seq}"]); CloseTag("subscriber"); CloseTag("insurance"); } } // This mess gets all the info for the patient. //~Well, now it does...-Art $insrow = array(); foreach (array('primary', 'secondary', 'tertiary') as $value) { $insrow[] = sqlQuery("SELECT id FROM insurance_data WHERE " . "pid = '{$pid}' AND type = '{$value}' ORDER BY date DESC LIMIT 1"); } $query = "SELECT " . "p.*, " . "i1.policy_number AS policy1, i1.group_number AS group1, i1.provider as provider1, " . "i1.subscriber_fname AS fname1, i1.subscriber_mname AS mname1, i1.subscriber_lname AS lname1, " . "i1.subscriber_street AS sstreet1, i1.subscriber_city AS scity1, i1.subscriber_state AS sstate1, " . "i1.subscriber_postal_code AS szip1, i1.subscriber_relationship AS relationship1, " . "i1.subscriber_DOB AS sdob1, i1.subscriber_ss AS sss1, i1.subscriber_phone AS sphone1, " . "i1.subscriber_sex AS ssex1, i1.subscriber_country AS scountry1, " . "i1.subscriber_employer AS semployer1, i1.subscriber_employer_street AS semployer_street1, " . "i1.subscriber_employer_city AS semployer_city1, i1.subscriber_employer_state AS semployer_state1, " . "i1.subscriber_employer_postal_code AS semployer_zip1, " . "i1.subscriber_employer_country AS semployer_country1, i1.copay AS copay1, " . "c1.name AS name1, c1.ins_type_code AS instype1, " . "a1.line1 AS street11, a1.line2 AS street21, a1.city AS city1, a1.state AS state1, " . "a1.zip AS zip1, a1.plus_four AS zip41, a1.country AS country1, " . "i2.policy_number AS policy2, i2.group_number AS group2, i2.provider as provider2, " . "i2.subscriber_fname AS fname2, i2.subscriber_mname AS mname2, i2.subscriber_lname AS lname2, " . "i2.subscriber_postal_code AS szip2, i2.subscriber_relationship AS relationship2, " . "i2.subscriber_DOB AS sdob2, i2.subscriber_ss AS sss2, i2.subscriber_phone AS sphone2, " . "i2.subscriber_sex AS ssex2, i2.subscriber_country AS scountry2, " . "i2.subscriber_employer AS semployer2, i2.subscriber_employer_street AS semployer_street2, " . "i2.subscriber_employer_city AS semployer_city2, i2.subscriber_employer_state AS semployer_state2, " . "i2.subscriber_employer_postal_code AS semployer_zip2, " . "i2.subscriber_employer_country AS semployer_country2, i2.copay AS copay2, " . "c2.name AS name2, c2.ins_type_code AS instype2, " . "a2.line1 AS street12, a2.line2 AS street22, a2.city AS city2, a2.state AS state2, " . "a2.zip AS zip2, a2.plus_four AS zip42, a2.country AS country2, " . "i3.policy_number AS policy3, i3.group_number AS group3, i3.provider as provider3, " . "i3.subscriber_fname AS fname3, i3.subscriber_mname AS mname3, i3.subscriber_lname AS lname3, " . "i3.subscriber_postal_code AS szip3, i3.subscriber_relationship AS relationship3, " . "i3.subscriber_DOB AS sdob3, i3.subscriber_ss AS sss3, i3.subscriber_phone AS sphone3, " . "i3.subscriber_sex AS ssex3, i3.subscriber_country AS scountry3, " . "i3.subscriber_employer AS semployer3, i3.subscriber_employer_street AS semployer_street3, " . "i3.subscriber_employer_city AS semployer_city3, i3.subscriber_employer_state AS semployer_state3, " . "i3.subscriber_employer_postal_code AS semployer_zip3, " . "i3.subscriber_employer_country AS semployer_country3, i3.copay AS copay3, " . "c3.name AS name3, c3.ins_type_code AS instype3, " . "a3.line1 AS street13, a3.line2 AS street23, a3.city AS city3, a3.state AS state3, " . "a3.zip AS zip3, a3.plus_four AS zip43, a3.country AS country3 " . "FROM patient_data AS p " . "LEFT OUTER JOIN insurance_data AS i1 ON i1.id = '" . $insrow[0]['id'] . "' " . "LEFT OUTER JOIN insurance_data AS i2 ON i2.id = '" . $insrow[1]['id'] . "' " . "LEFT OUTER JOIN insurance_data AS i3 ON i3.id = '" . $insrow[2]['id'] . "' " . "LEFT OUTER JOIN insurance_companies AS c1 ON c1.id = i1.provider " . "LEFT OUTER JOIN insurance_companies AS c2 ON c2.id = i2.provider " . "LEFT OUTER JOIN insurance_companies AS c3 ON c3.id = i3.provider " . "LEFT OUTER JOIN addresses AS a1 ON a1.foreign_id = c1.id " . "LEFT OUTER JOIN addresses AS a2 ON a2.foreign_id = c2.id " . "LEFT OUTER JOIN addresses AS a3 ON a3.foreign_id = c3.id " . "WHERE p.pid = '{$pid}' LIMIT 1"; $row = sqlFetchArray(sqlStatement($query)); $rowed = getEmployerData($pid); OpenTag("patient"); // Patient Section. // Add("pid", $pid); Add("pubpid", $row['pubpid']); Add("lname", $row['lname']); Add("fname", $row['fname']); Add("mname", $row['mname']); Add("title", $row['title']); Add("ss", Digits($row['ss'])); Add("dob", LWDate($row['DOB'])); Add("sex", Sex($row['sex'])); Add("street", $row['street']); Add("city", $row['city']); Add("state", $row['state']);