* @copyright Copyright (c) 2018 Brady Miller * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3 */ require_once("../../globals.php"); require_once("$srcdir/forms.inc"); require_once("$srcdir/transactions.inc"); require_once("$srcdir/lists.inc"); require_once("$srcdir/patient.inc"); require_once("$srcdir/options.inc.php"); use OpenEMR\Common\Csrf\CsrfUtils; use OpenEMR\Common\Logging\EventAuditLogger; use OpenEMR\Core\Header; // The number of authorizations to display in the quick view: // MAR 20041008 the full authorizations screen sucks... no links to the patient charts // increase to a high number to make the mini frame more useful. $N = 50; $atemp = sqlQuery("SELECT see_auth FROM users WHERE username = ?", array($_SESSION['authUser'])); $see_auth = $atemp['see_auth']; $imauthorized = $_SESSION['userauthorized'] || $see_auth > 2; // This authorizes everything for the specified patient. if (isset($_GET["mode"]) && $_GET["mode"] == "authorize" && $imauthorized) { if (!CsrfUtils::verifyCsrfToken($_GET["csrf_token_form"])) { CsrfUtils::csrfNotVerified(); } $retVal = getProviderId($_SESSION['authUser']); EventAuditLogger::instance()->newEvent("authorize", $_SESSION["authUser"], $_SESSION["authProvider"], 1, $_GET["pid"]); sqlStatement("update billing set authorized=1 where pid=?", array($_GET["pid"])); sqlStatement("update forms set authorized=1 where pid=?", array($_GET["pid"])); sqlStatement("update pnotes set authorized=1 where pid=?", array($_GET["pid"])); sqlStatement("update transactions set authorized=1 where pid=?", array($_GET["pid"])); } ?>
1) { // provider // billing // forms // pnotes // transactions //fetch billing information: if ( $res = sqlStatement("select *, concat(u.fname,' ', u.lname) as user " . "from billing LEFT JOIN users as u on billing.user = u.id where " . "billing.authorized = 0 and billing.activity = 1 and " . "groupname = ?", array($groupname)) ) { for ($iter = 0; $row = sqlFetchArray($res); $iter++) { $result1[$iter] = $row; } if ($result1) { foreach ($result1 as $iter) { $authorize[$iter["pid"]]["billing"] .= "" . text($iter["code_text"] . " " . date("n/j/Y", strtotime($iter["date"]))) . "
\n"; } } } //fetch transaction information: if ( $res = sqlStatement("select * from transactions where " . "authorized = 0 and groupname = ?", array($groupname)) ) { for ($iter = 0; $row = sqlFetchArray($res); $iter++) { $result2[$iter] = $row; } if ($result2) { foreach ($result2 as $iter) { $authorize[$iter["pid"]]["transaction"] .= "" . text($iter["title"] . ": " . (strterm($iter["body"], 25)) . " " . date("n/j/Y", strtotime($iter["date"]))) . "
\n"; } } } if (empty($GLOBALS['ignore_pnotes_authorization'])) { //fetch pnotes information: if ( $res = sqlStatement("select * from pnotes where authorized = 0 and " . "groupname = ?", array($groupname)) ) { for ($iter = 0; $row = sqlFetchArray($res); $iter++) { $result3[$iter] = $row; } if ($result3) { foreach ($result3 as $iter) { $authorize[$iter["pid"]]["pnotes"] .= "" . text((strterm($iter["body"], 25)) . " " . date("n/j/Y", strtotime($iter["date"]))) . "
\n"; } } } } //fetch forms information: if ( $res = sqlStatement("select * from forms where authorized = 0 and " . "groupname = ?", array($groupname)) ) { for ($iter = 0; $row = sqlFetchArray($res); $iter++) { $result4[$iter] = $row; } if ($result4) { foreach ($result4 as $iter) { $authorize[$iter["pid"]]["forms"] .= "" . text($iter["form_name"] . " " . date("n/j/Y", strtotime($iter["date"]))) . "
\n"; } } } ?> \n"; break; } echo "\n"; /**** //Michael A Rowley MD 20041012. // added below 4 lines to add provider to authorizations for ez reference. $providerID = sqlFetchArray(sqlStatement( "select providerID from patient_data where pid=?", array($ppid) )); $userID=$providerID["providerID"]; $providerName = sqlFetchArray(sqlStatement( "select lname from users where id=?", array($userID) )); ****/ // Don't use sqlQuery because there might be no match. $providerName = sqlFetchArray(sqlStatement( "select lname from users where id = ?", array($name['providerID']) )); echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; $count++; } } ?>
$patient) { $name = getPatientData($ppid); // If I want to see mine only and this patient is not mine, skip it. if ($see_auth == 2 && $_SESSION['authUserID'] != $name['id']) { continue; } if ($count >= $N) { print "
" . xlt('Some authorizations were not displayed. Click here to view all') . "
"; // Clicking the patient name will load both frames for that patient, // as demographics.php takes care of loading the bottom frame. echo ""; echo "" . text($name["fname"]) . " " . text($name["lname"]) . "
" . "" . xlt('Authorize') . "
" . xlt('Provider') . ":
" . text($providerName["lname"]) . "
" . xlt('Billing') . ":
" . $patient["billing"] . "
" . xlt('Transactions') . ":
" . $patient["transaction"] . "
" . xlt('Patient Notes') . ":
" . $patient["pnotes"] . "
" . xlt('Encounter Forms') . ":
" . $patient["forms"] . "