array_push($sqlBindArray, $form_provider); } if ($exclude_policy != "") { $arrayExplode = explode(",", $exclude_policy); array_walk($arrayExplode, 'arrFormated'); $exclude_policy = implode(",", $arrayExplode); $where .= " AND i.policy_number not in (" . stripslashes($exclude_policy) . ")"; } $where .= " AND (i.policy_number is not null and i.policy_number != '')"; $query = sprintf("\t\tSELECT DATE_FORMAT(e.pc_eventDate, '%%Y%%m%%d') as pc_eventDate,\n\t\t\t\t\t\t\t\t e.pc_facility,\n\t\t\t\t\t\t\t\t p.lname,\n\t\t\t\t\t\t\t\t p.fname,\n\t\t\t\t\t\t\t\t p.mname, \n\t\t\t\t\t\t\t\t DATE_FORMAT(p.dob, '%%Y%%m%%d') as dob,\n\t\t\t\t\t\t\t\t p.ss,\n\t\t\t\t\t\t\t\t p.sex,\n\t\t\t\t\t\t\t\t p.pid,\n\t\t\t\t\t\t\t\t p.pubpid,\n\t\t\t\t\t\t\t\t i.policy_number,\n\t\t\t\t\t\t\t\t i.provider as payer_id,\n\t\t\t\t\t\t\t\t i.subscriber_relationship,\n\t\t\t\t\t\t\t\t i.subscriber_lname,\n\t\t\t\t\t\t\t\t i.subscriber_fname,\n\t\t\t\t\t\t\t\t i.subscriber_mname,\n\t\t\t\t\t\t\t\t DATE_FORMAT(i.subscriber_dob, '%%m/%%d/%%Y') as subscriber_dob,\n\t\t\t\t\t\t\t\t i.subscriber_ss,\n\t\t\t\t\t\t\t\t i.subscriber_sex,\n\t\t\t\t\t\t\t\t DATE_FORMAT(i.date,'%%Y%%m%%d') as date,\n\t\t\t\t\t\t\t\t d.lname as provider_lname,\n\t\t\t\t\t\t\t\t d.fname as provider_fname,\n\t\t\t\t\t\t\t\t d.npi as provider_npi,\n\t\t\t\t\t\t\t\t d.upin as provider_pin,\n\t\t\t\t\t\t\t\t f.federal_ein,\n\t\t\t\t\t\t\t\t f.facility_npi,\n\t\t\t\t\t\t\t\t f.name as facility_name,\n\t\t\t\t\t\t\t\t c.name as payer_name\n\t\t\t\t\t\t\tFROM openemr_postcalendar_events AS e\n\t\t\t\t\t\t\tLEFT JOIN users AS d on (e.pc_aid is not null and e.pc_aid = d.id)\n\t\t\t\t\t\t\tLEFT JOIN facility AS f on (f.id = e.pc_facility)\n\t\t\t\t\t\t\tLEFT JOIN patient_data AS p ON p.pid = e.pc_pid\n\t\t\t\t\t\t\tLEFT JOIN insurance_data AS i ON (i.id =(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tSELECT id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM insurance_data AS i\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE pid = p.pid AND type = 'primary'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY date DESC\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tLEFT JOIN insurance_companies as c ON (c.id = i.provider)\n\t\t\t\t\t\t\tWHERE %s ", $where); // Run the query $res = sqlStatement($query, $sqlBindArray); // Get the facilities information $facilities = getUserFacilities($_SESSION['authId']); // Get the Providers information $providers = getUsernames(); //Get the x12 partners information $clearinghouses = getX12Partner(); if (isset($_POST['form_savefile']) && !empty($_POST['form_savefile']) && $res) { header('Content-Type: text/plain'); header(sprintf('Content-Disposition: attachment; filename="elig-270..%s.%s.txt"', $from_date, $to_date)); print_elig($res, $X12info, $segTer, $compEleSep); exit; } ?> <html> <head> <?php
function addUser($clientID, $username) { global $users; // let all clients know about this user joining (not including the user joining) foreach ($users as $clientID2 => $username2) { wsSend($clientID2, 'ONJOIN ' . $username); } // send list of usernames to the user joining $usernames = getUsernames(); wsSend($clientID, 'USERS ' . implode(' ', $usernames)); // store the user's client ID and username $users[$clientID] = $username; }