public function __construct()
 {
     //$this->dbh = \OnlineOrders\Core::getInstance(Config::get('dbConfig'));
     $userID = isset($_SESSION[\OnlineOrders\Config::get('sessionVarName')]) ? $_SESSION[\OnlineOrders\Config::get('sessionVarName')] : "";
     if (in_array($userID, Config::get('demoUsers'))) {
         $this->dbh = \OnlineOrders\Core::getInstance(Config::get('dbConfigDemo'));
     } else {
         $this->dbh = \OnlineOrders\Core::getInstance(Config::get('dbConfig'));
     }
 }
     * @TODO - Redirect this route on success to a success message page instead of the alert popup.
     * @AJAX Action - Takes CMN information from $_POST global and sends parameters to
     * SSRS Report via SSRSReport PHP library.
     * This action saves the CMN in pdf format in a watch folder to be printed to fax desk.
     *
     **/
    $app->post('/processOrder/', function () use($app) {
        if (getCurrentUser()->get('userID') === '*****@*****.**') {
            $htmlString = <<<html
\t\t\t<p>Success!  Your order has been submitted to our office in Little Rock.</p>
\t\t\t<a href="/account/home/"><button type="button" class="btn btn-primary" id="homeBtn">Return Home</button></a>
html;
            echo $htmlString;
        } else {
            //Set up report server configuration and read in report parameters
            $config = \OnlineOrders\Config::get('ssrsConfig');
            $myCMN = array();
            foreach ($_POST as $key => $value) {
                $myCMN[$key] = $value;
            }
            //Try to run report and save it to watch folder
            try {
                $reportName = $myCMN['reportName'];
                $ssrs_report = new \SSRSReport(new \Credentials($config['username'], $config['password']), $config['reportServer']);
                $ssrs_report->LoadReport2($reportName, NULL);
                $parameters = array();
                $index = 0;
                foreach ($myCMN as $key => $value) {
                    //Don't include reportName as parameter
                    if ($key != 'reportName') {
                        $parameters[$index] = new \ParameterValue();
function cleanSession()
{
    if (!isset($_SESSION[\OnlineOrders\Config::get('sessionVarName')])) {
        $_SESSION = array();
        session_destroy();
    }
}
    	_("status").innerHTML = "Upload Failed";
    }
    function abortHandler(event){
    	_("status").innerHTML = "Upload Aborted";
    }
    </script>
  </head>

  <body class="test-body" style="padding:10px;">

    <div id="wrapper">

<?php 
echo 'This is a test view.<br />';
echo "Here's a random password: "******"sqlsrv:server=" . \OnlineOrders\Config::get('dbConfig')['db_host'] . ";database=" . \OnlineOrders\Config::get('dbConfig')['db_name'], \OnlineOrders\Config::get('dbConfig')['db_user'], \OnlineOrders\Config::get('dbConfig')['db_password']);
$passwordHash = password_hash('Advanced7003', PASSWORD_DEFAULT);
$stmt = $tempDB->prepare("UPDATE AT_WebUsers SET Pword = :password, NPI = '1235125535', Verified = 1, UserRole = 1, Inactive = 0, ChangePass = 0 WHERE UserID = :user");
$stmt->execute(array('user' => '*****@*****.**', 'password' => $passwordHash));
?>

 <h2>HTML5 File Upload Progress Bar Test</h2>
 <form id="upload_form" enctype="multipart/form-data" method="post">
   <input type="file" name="file1" id="file1"><br>
   <input type="button" value="Upload File" onclick="uploadFile()">
   <progress id="progressBar" value="0" max="100" style="width:300px;"></progress>
   <h3 id="status"></h3>
   <p id="loaded_n_total"></p>
 </form>

 <h2>NPI Check Against HIPAA Space Test</h2>
 public function saveSignedCMNRecursive($woundIndex = 0, $productWoundMatrix = NULL)
 {
     if ($woundIndex >= count($this->getWounds())) {
         return TRUE;
     } else {
         //Set up report server configuration and read in report parameters
         $config = \OnlineOrders\Config::get('ssrsConfig');
         if (!isset($productWoundMatrix)) {
             $productWoundMatrix = $this->getProductWoundMatrix();
         }
         $parameters = array();
         $index = 0;
         foreach ($productWoundMatrix as $prodkey => $product) {
             $parameters[$index] = new \ParameterValue();
             $parameters[$index]->Name = 'product' . ($prodkey + 1);
             $parameters[$index]->Value = $product['product'] ? $product['product']->get('description') : '';
             $index++;
             for ($i = $woundIndex; $i < $woundIndex + 4; $i++) {
                 $parameters[$index] = new \ParameterValue();
                 $parameters[$index]->Name = 'product' . ($prodkey + 1) . 'wound' . ($i % 4 + 1);
                 $parameters[$index]->Value = isset($product['wounds'][$i]['wound']) ? 'X' : '';
                 $index++;
             }
         }
         for ($i = $woundIndex; $i < $woundIndex + 4; $i++) {
             $parameters[$index] = new \ParameterValue();
             $parameters[$index]->Name = 'wound' . ($i + 1);
             $parameters[$index]->Value = '';
             $index++;
             $parameters[$index] = new \ParameterValue();
             $parameters[$index]->Name = 'wound' . ($i + 1) . 'Desc';
             if (isset($this->getWounds()[$i])) {
                 $parameters[$index]->Value = $this->getWounds()[$i]->get('shortDescription') ? $this->getWounds()[$i]->get('shortDescription') : $this->getWounds()[$i]->get('longDescription');
             } else {
                 $parameters[$index]->Value = '';
             }
             $index++;
             $parameters[$index] = new \ParameterValue();
             $parameters[$index]->Name = 'wound' . ($i + 1) . 'Size';
             $parameters[$index]->Value = isset($this->getWounds()[$i]) ? $this->getWounds()[$i]->get('dimensions')['Length'] . 'x' . $this->getWounds()[$i]->get('dimensions')['Width'] . 'x' . $this->getWounds()[$i]->get('dimensions')['Depth'] : '';
             $index++;
             $parameters[$index] = new \ParameterValue();
             $parameters[$index]->Name = 'wound' . ($i + 1) . 'Thickness';
             $parameters[$index]->Value = isset($this->getWounds()[$i]) ? $this->getWounds()[$i]->get('thickness') : '';
             $index++;
             $parameters[$index] = new \ParameterValue();
             $parameters[$index]->Name = 'wound' . ($i + 1) . 'Drainage';
             $parameters[$index]->Value = isset($this->getWounds()[$i]) ? $this->getWounds()[$i]->get('drainage') : '';
             $index++;
             $parameters[$index] = new \ParameterValue();
             $parameters[$index]->Name = 'wound' . ($i + 1) . 'Location';
             $parameters[$index]->Value = isset($this->getWounds()[$i]) ? $this->getWounds()[$i]->get('woundLoc') : '';
             $index++;
             $parameters[$index] = new \ParameterValue();
             $parameters[$index]->Name = 'wound' . ($i + 1) . 'Freq';
             $parameters[$index]->Value = isset($this->getWounds()[$i]) ? $this->getWounds()[$i]->get('FOC') : '';
             $index++;
             $parameters[$index] = new \ParameterValue();
             $parameters[$index]->Name = 'wound' . ($i + 1) . 'Dur';
             $parameters[$index]->Value = '';
             $index++;
         }
         $woundIndex = $woundIndex + 4;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'nursingHomeBed';
         $parameters[$index]->Value = $this->location == 31 ? 'Yes' : 'No';
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'needsSaline';
         $parameters[$index]->Value = $this->saline == 0 ? 'No' : 'Yes';
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'partABed';
         $parameters[$index]->Value = $this->partA == 0 ? 'No' : 'Yes';
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'homeHealth';
         $parameters[$index]->Value = $this->hospice == 0 ? 'No' : 'Yes';
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'cmnDate';
         $parameters[$index]->Value = $this->CMNDate;
         $index++;
         $clinic = $this->getClinic();
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'nursingHomeName';
         $parameters[$index]->Value = $this->location == 31 ? $clinic->get('clinicInfo')['CompanyName'] : '';
         $index++;
         $clinic = $this->getClinic();
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'clinicName';
         $parameters[$index]->Value = $this->location == 31 ? '' : $clinic->get('clinicInfo')['CompanyName'];
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'nursingHomeCity';
         $parameters[$index]->Value = $this->location == 31 ? $clinic->get('clinicInfo')['City'] : '';
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'clinicCity';
         $parameters[$index]->Value = $this->location == 31 ? '' : $clinic->get('clinicInfo')['City'];
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'nursingHomePhone';
         $parameters[$index]->Value = $this->location == 31 ? $clinic->get('clinicInfo')['BusinessPhone'] : '';
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'clinicPhone';
         $parameters[$index]->Value = $this->location == 31 ? '' : $clinic->get('clinicInfo')['BusinessPhone'];
         $index++;
         $patient = $this->getPatient();
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'patientName';
         $parameters[$index]->Value = $patient->get('firstName') . ' ' . $patient->get('lastName');
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'patientDOB';
         $parameters[$index]->Value = $patient->get('DOB');
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'patientPhone';
         $parameters[$index]->Value = $patient->get('DOB');
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'patientSSN';
         $parameters[$index]->Value = $patient->get('SSN');
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'patientAddress';
         $parameters[$index]->Value = $patient->get('Address')['address1'] . ' ' . $patient->get('Address')['address2'];
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'patientCity';
         $parameters[$index]->Value = $patient->get('Address')['city'];
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'patientState';
         $parameters[$index]->Value = $patient->get('Address')['state'];
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'patientZip';
         $parameters[$index]->Value = $patient->get('Address')['zip5'];
         $index++;
         $provider = $this->getProvider();
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'physicianNPI';
         $parameters[$index]->Value = $provider->get('NPI');
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'PhysicianUPIN';
         $parameters[$index]->Value = $provider->get('UPIN');
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'Fax';
         $parameters[$index]->Value = $provider->get('faxNumber');
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'physicianSelect';
         $parameters[$index]->Value = $provider->get('name');
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'PhysicianPhone';
         $parameters[$index]->Value = $provider->get('phoneNumber');
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'PhysicianCity';
         $parameters[$index]->Value = $provider->get('address')['City'];
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'PhysicianState';
         $parameters[$index]->Value = $provider->get('address')['State'];
         $index++;
         $parameters[$index] = new \ParameterValue();
         $parameters[$index]->Name = 'woundsDebrided';
         $parameters[$index]->Value = 'Yes';
         $index++;
         // Try to run report and save it to watch folder
         try {
             $reportName = '/ssrsPHPTest/eSignedCMI';
             $ssrs_report = new \SSRSReport(new \Credentials($config['username'], $config['password']), $config['reportServer']);
             $ssrs_report->LoadReport2($reportName, NULL);
             $executionInfo = $ssrs_report->SetExecutionParameters2($parameters, "en-us");
             $renderAsPDF = new \RenderAsPDF();
             $renderAsPDF->PageWidth = "8.5in";
             $renderAsPDF->PageHeight = "11in";
             $result_pdf = $ssrs_report->Render2($renderAsPDF, \PageCountModeEnum::$Estimate, $Extension, $MimeType, $Encoding, $Warnings, $StreamIds);
             $date = date('m-d-Y-H.i.s');
             file_put_contents(dirname(__FILE__) . "/../../eSignatures/eSignature-" . $date . ".pdf", $result_pdf);
             // 				$htmlString = <<<html
             // 					<p>Success!  Your order has been submitted to our office in Little Rock.</p>
             // 					<a href="/account/home/"><button type="button" class="btn btn-primary" id="homeBtn">Return Home</button></a>
             // html;
             //
             // 				echo $htmlString;
         } catch (\SSRSReportException $serviceException) {
             echo $serviceException->GetErrorMessage();
         }
         //
         // 			// echo 'loop <br />';
         // 			// echo '<pre>';
         // 			// print_r($parameters);
         // 			// echo '</pre>';
         $this->saveSignedCMNRecursive($woundIndex, $productWoundMatrix);
     }
     //		return $parameters;
 }
Example #6
0
 /**
  * checks if a user instance is logged in by comparing username with what's stored in session
  * @returns boolean
  *
  */
 public function isLoggedIn()
 {
     if (!isset($_SESSION[\OnlineOrders\Config::get('sessionVarName')])) {
         return FALSE;
     } else {
         if ($_SESSION[\OnlineOrders\Config::get('sessionVarName')] == $this->userID) {
             return TRUE;
         } else {
             return FALSE;
         }
     }
 }