<?php
ob_start();
include '../head.php';
include '../header.php';

if (isset($_POST['savepatientdetials'])) {
   $pId = $_GET['id'];
   $fileId = $_GET['fileId'];
  
   
   // $pspId = $_POST['pspId'];
   // $medicationId = $_POST['medicationId'];
   $patientFName = $_POST['patientFName'];
   $patientLName = $_POST['patientLName'];
   $patientName = $patientFName . " " . $patientLName;
   $dob = $_POST['dob'];
   $gender = $_POST['gender'];
   $phone = $_POST['phone'];
   $email = $_POST['email'];
   $address1 = $_POST['address1'];
   $address2 = $_POST['address2'];
   $city = $_POST['city'];
   $province = $_POST['province'];
   $postalCode = $_POST['postalCode'];
   $createdBy = $_SESSION['empId'];
   $notes = $_POST['notes'];
   $krollId = $_POST['krollId'];
   // $patientId = $patientFName[0] . $patientLName[0] . date('YmdHis');
   // Handle file uploads
    //wc part5
    $patientDrugName=$_POST['patientDrugName'];
    $stmt = $pdo->prepare("SELECT id as drugId,pspId FROM tbldrugs WHERE drugName = ? and isDeleted='N'");
   $stmt->execute([$patientDrugName]); 
   $drugDetails = $stmt->fetch();
   $pspId=0;
   $drugId='';
   if(isset($drugDetails['pspId'])){
       $pspId=$drugDetails['pspId'];
   }
   if(isset($drugDetails['drugId'])){
       $medicationId=$drugDetails['drugId'];
   }
    $dosage=$_POST['dose'];
    $routeOfAdmin=$_POST['roa'];
    $prescriberName=$_POST['prescriberName'];
    $prescriberSpecialty=$_POST['prescriberSpecialty'];
    $team=$_POST['team'];
    $staff=$_POST['staff'];
    $presciberOffice=$_POST['Dpgsd'];
    $sampleDoseReceived=$_POST['smpDate'];
    //wc part5
   $uploadedFiles = [];
   if (!file_exists('uploads/' . $province . $krollId)) {
      mkdir('uploads/' . $province . $krollId, 0777, true);
   }
   $uploadDir = 'uploads/' . $province . $krollId . '/';
   try {
      $pdo->beginTransaction();
      // Insert patient data
      $stmt = $pdo->prepare("UPDATE tblpatient set krollId=?,patientName=?,dob=?,firstName=?,lastName=?,gender=?,phone=?,email=?,address1=?,address2=?,city=?,province=?,
          postalCode=?,notes=?,modifiedBy=? where id=?");
      $result = $stmt->execute([$krollId, $patientName, $dob, $patientFName, $patientLName, $gender, $phone, $email, $address1, $address2, $city, $province, $postalCode, $notes, $createdBy, $pId]);

      // Insert patient details
      $stmt1 = $pdo->prepare("Update tblpatientdetails set pspId=?,medicationId=? where fileId=? and pId=?");
      $result = $stmt1->execute([$pspId, $medicationId, $fileId, $pId]);

      $query5_update = "UPDATE tblwcpart5 
                  SET patientDrugName = ?, dosage = ?, routeOfAdmin = ?, prescriberName = ?, prescriberSpecialty = ?, team = ?, staff = ?, presciberOffice = ?, sampleDoseReceived = ? 
                  WHERE fileId = ? AND pId = ?";
      $stmt5_update = $pdo->prepare($query5_update);
      $stmt5_update->execute([$patientDrugName, $dosage, $routeOfAdmin, $prescriberName, $prescriberSpecialty, $team, $staff, $presciberOffice, $sampleDoseReceived, $fileId, $pId]);

      //custom code
      foreach ($_FILES['files']['tmp_name'] as $key => $tmp_name) {
         $originalFileName = $_FILES['files']['name'][$key];
         $file_tmp = $_FILES['files']['tmp_name'][$key];
         if (isset($_POST['fileTitle'][$key])) {
            $title = $_POST['fileTitle'][$key];
            $title = preg_replace('/[^A-Za-z0-9 ]/', '', $title);

            // Create a new filename by appending the original file extension to the title
            $fileExtension = pathinfo($originalFileName, PATHINFO_EXTENSION);
            $file_name = $title . '.' . $fileExtension;

            $file_destination = $uploadDir . $file_name;
            if (move_uploaded_file($file_tmp, $file_destination)) {
               $uploadedFiles[] = $file_name;
               // Insert into tblpatientdocs
               $stmt2 = $pdo->prepare("INSERT INTO tblpatientdocs(pId,fileId, title, filename, module) VALUES (?,?,?,?,?)");
               $result2 = $stmt2->execute([$pId, $fileId, $title, $file_name, 'patient']);
            } else {
               // Handle upload error
            }
         }
      }
      if ($pdo->commit()) {
         if ($_POST['savepatientdetials'] === 'SAVE & NEXT') {
            echo "<script>toastr.success('Patient Updated Successfully');setTimeout(function() {window.location.href = 'edit_patient.php?id=" . $pId . "&token=2&fileId=" . $fileId . "';
            }, 2000);</script>";
         }else{
            echo "<script>toastr.success('Patient Updated Successfully');</script>";
         }
      } else {
         echo "<script>toastr.error('Failed to update patient details');</script>";
      }

   } catch (\PDOException $e) {
      $pdo->rollBack();
      echo "Transaction failed: " . $e->getMessage();
   }
}

if(isset($_POST['saveIndicationDetails'])){
   $pId = $_GET['id'];
   $fileId = $_GET['fileId'];
   //$indicationName = isset($_POST['indicationName']) ? $_POST['indicationName'] : '';
   $ipmctst = isset($_POST['ipmctst']) ? $_POST['ipmctst'] : '';
   $isHighDoseICS = isset($_POST['isHighDoseICS']) ? $_POST['isHighDoseICS'] : '';
   $isexacerbations1 = isset($_POST['isexacerbations1']) ? $_POST['isexacerbations1'] : '';
   $isexacerbations2 = isset($_POST['isexacerbations2']) ? $_POST['isexacerbations2'] : '';
   $eosCount = isset($_POST['eosCount']) ? $_POST['eosCount'] : '';
   $fenoLevel = isset($_POST['fenoLevel']) ? $_POST['fenoLevel'] : '';
   $scWeeks = isset($_POST['scWeeks']) ? $_POST['scWeeks'] : '';
   $scDosing = isset($_POST['scDosing']) ? $_POST['scDosing'] : '';
   $scWeeks2 = isset($_POST['scWeeks2']) ? $_POST['scWeeks2'] : '';
   $scDosing2 = isset($_POST['scDosing2']) ? $_POST['scDosing2'] : '';
   $totalIgE = isset($_POST['totalIgE']) ? $_POST['totalIgE'] : '';
   $otherAsthmaScore = isset($_POST['otherAsthmaScore']) ? $_POST['otherAsthmaScore'] : '';
   $nos = isset($_POST['nos']) ? $_POST['nos'] : '';
   $lastSurgeryDate = isset($_POST['lastSurgeryDate']) ? $_POST['lastSurgeryDate'] : '';
   $isSurgeryRequired = isset($_POST['isSurgeryRequired']) ? $_POST['isSurgeryRequired'] : '';
   $rationale = isset($_POST['rationale']) ? $_POST['rationale'] : '';
   $isSystemic = isset($_POST['isSystemic']) ? $_POST['isSystemic'] : '';
   $otherCrsScore = isset($_POST['otherCrsScore']) ? $_POST['otherCrsScore'] : '';


   $indicationTreatment=isset($_POST['indicationTreatment']) ? $_POST['indicationTreatment'] : [];
   $indicationDose=isset($_POST['indicationDose']) ? $_POST['indicationDose'] : [];
   $indicationDate=isset($_POST['indicationDate']) ? $_POST['indicationDate'] : [];
   $indicationDateTo=isset($_POST['indicationDateTo']) ? $_POST['indicationDateTo'] : [];

   $treatment =  implode(',', $indicationTreatment);
   $dose = implode(',', $indicationDose);
   $dateFrom = implode(',', $indicationDate);
   $dateTo = implode(',', $indicationDateTo);

   $cd = isset($_POST['coexistingDiseases']) ? $_POST['coexistingDiseases'] : [];
   $coexistingDiseases = implode(',', $cd);

   $ts = isset($_POST['testScore']) ? $_POST['testScore'] : [];
   $testScore = implode(',', $ts);

   $isTC = isset($_POST['isTC']) ? $_POST['isTC'] : '';
   $tcvalue = isset($_POST['tcvalue']) ? $_POST['tcvalue'] : '';
   //$isTCI = isset($_POST['isTCI']) ? $_POST['isTCI'] : '';
   $isTacrolimus = isset($_POST['isTacrolimus']) ? $_POST['isTacrolimus'] : '';
   $tracolimusWeeks = isset($_POST['tracolimusWeeks']) ? $_POST['tracolimusWeeks'] : '';
   $tracolimusDosing = isset($_POST['tracolimusDosing']) ? $_POST['tracolimusDosing'] : '';
   $isPime = isset($_POST['isPime']) ? $_POST['isPime'] : '';
   $pimeWeeks = isset($_POST['pimeWeeks']) ? $_POST['pimeWeeks'] : '';
   $pimeDosing = isset($_POST['pimeDosing']) ? $_POST['pimeDosing'] : '';
   $isSystemic3 = isset($_POST['isSystemic3']) ? $_POST['isSystemic3'] : '';
   $systemicWeeks3 = isset($_POST['systemicWeeks3']) ? $_POST['systemicWeeks3'] : '';
   $systemicDosing3 = isset($_POST['systemicDosing3']) ? $_POST['systemicDosing3'] : '';
   $isImmuno = isset($_POST['isImmuno']) ? $_POST['isImmuno'] : '';
   $isMethotrexate = isset($_POST['isMethotrexate']) ? $_POST['isMethotrexate'] : '';
   $methotrexateWeeks = isset($_POST['methotrexateWeeks']) ? $_POST['methotrexateWeeks'] : '';
   $methotrexateDosing = isset($_POST['methotrexateDosing']) ? $_POST['methotrexateDosing'] : '';
   $isCyclosporine = isset($_POST['isCyclosporine']) ? $_POST['isCyclosporine'] : '';
   $cyclosporineWeeks = isset($_POST['cyclosporineWeeks']) ? $_POST['cyclosporineWeeks'] : '';
   $cyclosporineDosing = isset($_POST['cyclosporineDosing']) ? $_POST['cyclosporineDosing'] : '';
   $isOther = isset($_POST['isOther']) ? $_POST['isOther'] : '';
   $otherName = isset($_POST['otherName']) ? $_POST['otherName'] : '';
   $otherWeeks = isset($_POST['otherWeeks']) ? $_POST['otherWeeks'] : '';
   $otherDosing = isset($_POST['otherDosing']) ? $_POST['otherDosing'] : '';
   $isPhoto = isset($_POST['isPhoto']) ? $_POST['isPhoto'] : '';
   $photoWeeks = isset($_POST['photoWeeks']) ? $_POST['photoWeeks'] : '';
   $notAccessibleReason = isset($_POST['notAccessibleReason']) ? $_POST['notAccessibleReason'] : '';
   $isNoAccessToInfo = isset($_POST['isNoAccessToInfo']) ? $_POST['isNoAccessToInfo'] : '';
   $isHighDosePPI = isset($_POST['isHighDosePPI']) ? $_POST['isHighDosePPI'] : '';
   $isTopicalCorticosteroids = isset($_POST['isTopicalCorticosteroids']) ? $_POST['isTopicalCorticosteroids'] : '';
   $additionalRelevantMedication = isset($_POST['additionalRelevantMedication']) ? $_POST['additionalRelevantMedication'] : '';
   $createdBy = $_SESSION['empId'];

   $query77 = "INSERT INTO `tblindication`(`pId`, `fileId`, `ipmctst`, `isHighDoseICS`, `isexacerbations1`, `isexacerbations2`,
      `eosCount`, `fenoLevel`, `scWeeks`, `scDosing`, `scWeeks2`, `scDosing2`, `totalIgE`, `otherAsthmaScore`, `nos`, 
      `lastSurgeryDate`, `isSurgeryRequired`, `rationale`, `isSystemic`, `otherCrsScore`, `treatment`, `dose`, `dateFrom`, `dateTo`,
      `coexistingDiseases`, `testScore`, `isTC`, `tcvalue`, `isTacrolimus`, `tracolimusWeeks`, `tracolimusDosing`,
         `isPime`, `pimeWeeks`, `pimeDosing`, `isSystemic3`, `systemicWeeks3`, `systemicDosing3`, `isImmuno`, `isMethotrexate`, 
         `methotrexateWeeks`, `methotrexateDosing`, `isCyclosporine`, `cyclosporineWeeks`, `cyclosporineDosing`, `isOther`, `otherName`, 
         `otherWeeks`, `otherDosing`, `isPhoto`, `photoWeeks`, `notAccessibleReason`, `isNoAccessToInfo`, `isHighDosePPI`,
         `isTopicalCorticosteroids`, `additionalRelevantMedication`, `createdBy`) VALUES (?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
                ?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
      $stmt77 = $pdo->prepare($query77);
      if (
         $stmt77->execute([
            $pId,
            $fileId,$ipmctst, $isHighDoseICS, $isexacerbations1, $isexacerbations2,
            $eosCount, $fenoLevel, $scWeeks, $scDosing, $scWeeks2, $scDosing2, $totalIgE, $otherAsthmaScore, $nos, 
            $lastSurgeryDate, $isSurgeryRequired, $rationale, $isSystemic, $otherCrsScore, $treatment, $dose, $dateFrom, $dateTo,
            $coexistingDiseases, $testScore, $isTC, $tcvalue, $isTacrolimus, $tracolimusWeeks, $tracolimusDosing,
            $isPime, $pimeWeeks, $pimeDosing, $isSystemic3, $systemicWeeks3, $systemicDosing3, $isImmuno, $isMethotrexate, 
            $methotrexateWeeks, $methotrexateDosing, $isCyclosporine, $cyclosporineWeeks, $cyclosporineDosing, $isOther, $otherName, 
            $otherWeeks, $otherDosing, $isPhoto, $photoWeeks, $notAccessibleReason, $isNoAccessToInfo, $isHighDosePPI,
            $isTopicalCorticosteroids, $additionalRelevantMedication, $createdBy
         ])
      ) {
         echo "<script>
               toastr.success('Indication Updated Successfully');
               setTimeout(function() {
                   window.location.href = 'edit_patient.php?id=" . $pId . "&token=3&fileId=" . $fileId . "';
               }, 2000);
             </script>";
      } else {
         echo "<script>
               toastr.error('Failed to update Indication details');
               setTimeout(function() {
                   window.location.href = 'edit_patient.php?id=" . $pId . "&token=3&fileId=" . $fileId . "';
               }, 2000);
               </script>";
      }
 
}


if (isset($_POST['reimbursementUpdate'])) {
   $empId = $_SESSION["empId"];
   //reimbursement start
   $pId = $_GET['id'];
   $fileId = $_GET['fileId'];
   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   $notesForNav = $_POST['notesForNav'];
   $reimbursementStatus = $_POST['reimbursementStatus'];
   $rsn = $_POST['rsn'];
   $rsfud = $_POST['rsfud'];
   $rcd = $_POST['rcd'];
   $ipal = $_POST['ipal'];
   $Carrier = $_POST['Carrier'];
   $groupCN = $_POST['groupCN'];
   $certificateNumber = $_POST['certificateNumber'];
   $cardholder = $_POST['cardholder'];
   $cardholderName1 = $_POST['cardholderName1'];
   $cardholderName2 = $_POST['cardholderName2'];
   $cardholderDOB = $_POST['cardholderDOB'];
   $coveragePercentage = $_POST['coveragePercentage'];
   $coinsurancePayment = str_replace(',', '', $_POST['coinsurancePayment']);
   $deductible = $_POST['deductible'];
   $annualMax = $_POST['annualMax'];
   $lifetimeMax = $_POST['lifetimeMax'];
   $copayMax = $_POST['copayMax'];
   $sarequired = $_POST['sarequired'];
   $dAppealSub = $_POST['dAppealSub'];
   $saEapSub = $_POST['saEapSub'];
   $saEapOutcome = $_POST['saEapOutcome'];
   $saEapExpiry = $_POST['saEapExpiry'];
   $saEapExpF = $_POST['saEapExpF'];
   $luExpiry = $_POST['luExpiry'];
   $luCode = $_POST['luCode'];
   $dphsp = isset($_POST['dphsp']) ? $_POST['dphsp'] : '';
   $ipal_secondary = $_POST['ipal_secondary'];
   $Carrier_secondary = $_POST['Carrier_secondary'];
   $groupCN_secondary = $_POST['groupCN_secondary'];
   $certificateNumber_secondary = $_POST['certificateNumber_secondary'];
   $cardholder_secondary = $_POST['cardholder_secondary'];
   $cardholderSecondaryName1 = $_POST['cardholderSecondaryName1'];
   $cardholderSecondaryName2 = $_POST['cardholderSecondaryName2'];
   $cardholderSecondaryDOB = $_POST['cardholderSecondaryDOB'];
   $coveragePercentage_secondary = $_POST['coveragePercentage_secondary'];
   $deductible_secondary = $_POST['deductible_secondary'];
   $annualMax_secondary = $_POST['annualMax_secondary'];
   $lifetimeMax_secondary = $_POST['lifetimeMax_secondary'];
   $copayMax_secondary = $_POST['copayMax_secondary'];
   $sarequired_secondary = $_POST['sarequired_secondary'];
   $dAppealSub_secondary = $_POST['dAppealSub_secondary'];
   $saEapSub_secondary = $_POST['saEapSub_secondary'];
   $saEapOutcome_secondary = $_POST['saEapOutcome_secondary'];
   $saEapExpiry_secondary = $_POST['saEapExpiry_secondary'];
   $saEapExpF_secondary = $_POST['saEapExpF_secondary'];
   $luExpiry_secondary = $_POST['luExpiry_secondary'];
   $luCode_secondary = $_POST['luCode_secondary'];
   $dphsp_tertiary = $_POST['dphsp_tertiary'];
   $ipal_tertiary = $_POST['ipal_tertiary'];
   $Carrier_tertiary = $_POST['Carrier_tertiary'];
   $groupCN_tertiary = $_POST['groupCN_tertiary'];
   $certificateNumber_tertiary = $_POST['certificateNumber_tertiary'];
   $cardholder_tertiary = $_POST['cardholder_tertiary'];
   $cardholderTertiaryName1 = $_POST['cardholderTertiaryName1'];
   $cardholderTertiaryName2 = $_POST['cardholderTertiaryName2'];
   $cardholderTertiaryDOB = $_POST['cardholderTertiaryDOB'];
   $coveragePercentage_tertiary = $_POST['coveragePercentage_tertiary'];
   $deductible_tertiary = $_POST['deductible_tertiary'];
   $annualMax_tertiary = $_POST['annualMax_tertiary'];
   $lifetimeMax_tertiary = $_POST['lifetimeMax_tertiary'];
   $copayMax_tertiary = $_POST['copayMax_tertiary'];
   $sarequired_tertiary = isset($_POST['sarequired_tertiary']) ? $_POST['sarequired_tertiary'] : '';
   $dAppealSub_tertiary = $_POST['dAppealSub_tertiary'];
   $saEapSub_tertiary = $_POST['saEapSub_tertiary'];
   $saEapOutcome_tertiary = $_POST['saEapOutcome_tertiary'];
   $saEapExpiry_tertiary = $_POST['saEapExpiry_tertiary'];
   $saEapExpF_tertiary = $_POST['saEapExpF_tertiary'];
   $luExpiry_tertiary = $_POST['luExpiry_tertiary'];
   $luCode_tertiary = $_POST['luCode_tertiary'];
   $dphsp_quaternary = $_POST['dphsp_quaternary'];
   $ipal_quaternary = $_POST['ipal_quaternary'];
   $Carrier_quaternary = $_POST['Carrier_quaternary'];
   $groupCN_quaternary = $_POST['groupCN_quaternary'];
   $certificateNumber_quaternary = $_POST['certificateNumber_quaternary'];
   $cardholder_quaternary = $_POST['cardholder_quaternary'];
   $cardholderQuaternaryName1 = $_POST['cardholderQuaternaryName1'];
   $cardholderQuaternaryName2 = $_POST['cardholderQuaternaryName2'];
   $cardholderQuaternaryDOB = $_POST['cardholderQuaternaryDOB'];
   $coveragePercentage_quaternary = $_POST['coveragePercentage_quaternary'];
   $deductible_quaternary = $_POST['deductible_quaternary'];
   $annualMax_quaternary = $_POST['annualMax_quaternary'];
   $lifetimeMax_quaternary = $_POST['lifetimeMax_quaternary'];
   $copayMax_quaternary = $_POST['copayMax_quaternary'];
   $sarequired_quaternary = $_POST['sarequired_quaternary'];
   $dAppealSub_quaternary = $_POST['dAppealSub_quaternary'];
   $saEapSub_quaternary = $_POST['saEapSub_quaternary'];
   $saEapOutcome_quaternary = $_POST['saEapOutcome_quaternary'];
   $saEapExpiry_quaternary = $_POST['saEapExpiry_quaternary'];
   $saEapExpF_quaternary = $_POST['saEapExpF_quaternary'];
   $luExpiry_quaternary = $_POST['luExpiry_quaternary'];
   $luCode_quaternary = $_POST['luCode_quaternary'];
   $dphmpf = $_POST['dphmpf'];
   $dphapc = isset($_POST['dphapc']) ? $_POST['dphapc'] : '';
   $pcct = $_POST['pcct'];
   $pcd = $_POST['pcd'];
   $financialAssistance = $_POST['financialAssistance'];
   $copayCard = $_POST['copayCard'];
   $piRxCRM = $_POST['piRxCRM'];
   $consent = $_POST['consent'];
   $consentRelease = $_POST['consentRelease'];
   $consentVFirst = $_POST['consentVFirst'];
   $consentVLast = $_POST['consentVLast'];
   $injTraLoc = $_POST['injTraLoc'];
   $vinjTraSites = $_POST['vinjTraSites'];
   $clinicInjTrainingSites = $_POST['clinicInjTrainingSites'];
   $islc = isset($_POST['islc']) ? $_POST['islc'] : '';
   $clinicInfSite = $_POST['clinicInfSite'];
   $infOther = $_POST['infOther'];
   $firstAppDate = $_POST['firstAppDate'];
   $appointTimeHH = $_POST['appointTimeHH'];
   $appointTimeMM = $_POST['appointTimeMM'];
   $appointTime = $_POST['appointTime'];
   $trtStrtDate = $_POST['trtStrtDate'];
   $infFess = $_POST['infFess'];
   $cashpp = $_POST['cashpp'];
   $coverageType = $_POST['coverageType'];
   $trtStatus = $_POST['trtStatus'];
   $pspPatientId = $_POST['pspPatientId'];
   $rcby = $_POST['rcby'];
   $physicianId = isset($_POST['physicianId']) ? $_POST['physicianId'] : '';
   //////////////////////////////////////////////////////////////////////////////
   $saMdSentDate = isset($_POST['saMdSentDate']) ? $_POST['saMdSentDate'] : '';
   $saMdReceivedDate = isset($_POST['saMdReceivedDate']) ? $_POST['saMdReceivedDate'] : '';
   $saPatientSentDate = isset($_POST['saPatientSentDate']) ? $_POST['saPatientSentDate'] : '';
   $saPatientReceivedDate = isset($_POST['saPatientReceivedDate']) ? $_POST['saPatientReceivedDate'] : '';
   /////////////////////////////////////////////
   $saMdSentDate2 = isset($_POST['saMdSentDate2']) ? $_POST['saMdSentDate2'] : '';
   $saMdReceivedDate2 = isset($_POST['saMdReceivedDate2']) ? $_POST['saMdReceivedDate2'] : '';
   $saPatientSentDate2 = isset($_POST['saPatientSentDate2']) ? $_POST['saPatientSentDate2'] : '';
   $saPatientReceivedDate2 = isset($_POST['saPatientReceivedDate2']) ? $_POST['saPatientReceivedDate2'] : '';
   /////////////////////////////////////////////////
   $saMdSentDate3 = isset($_POST['saMdSentDate3']) ? $_POST['saMdSentDate3'] : '';
   $saMdReceivedDate3 = isset($_POST['saMdReceivedDate3']) ? $_POST['saMdReceivedDate3'] : '';
   $saPatientSentDate3 = isset($_POST['saPatientSentDate3']) ? $_POST['saPatientSentDate3'] : '';
   $saPatientReceivedDate3 = isset($_POST['saPatientReceivedDate3']) ? $_POST['saPatientReceivedDate3'] : '';
   ////////////////////////////////////////////////////
   $saMdSentDate4 = isset($_POST['saMdSentDate4']) ? $_POST['saMdSentDate4'] : '';
   $saMdReceivedDate4 = isset($_POST['saMdReceivedDate4']) ? $_POST['saMdReceivedDate4'] : '';
   $saPatientSentDate4 = isset($_POST['saPatientSentDate4']) ? $_POST['saPatientSentDate4'] : '';
   $saPatientReceivedDate4 = isset($_POST['saPatientReceivedDate4']) ? $_POST['saPatientReceivedDate4'] : '';
   $drugStatus = isset($_POST['drugStatus']) ? $_POST['drugStatus'] : '';
   $patientType = isset($_POST['patientType']) ? $_POST['patientType'] : '';
   /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
   //new fields
   $pharmacyType = isset($_POST['pharmacyType']) ? $_POST['pharmacyType'] : '';
   $pharmacyName = isset($_POST['pharmacyName']) ? $_POST['pharmacyName'] : '';
   $pharmacyPhone = isset($_POST['pharmacyPhone']) ? $_POST['pharmacyPhone'] : '';
   $pharmacyFax = isset($_POST['pharmacyFax']) ? $_POST['pharmacyFax'] : '';

   $treatmentFacilityName = isset($_POST['treatmentFacilityName']) ? $_POST['treatmentFacilityName'] : '';
   $treatmentFacilityType = isset($_POST['treatmentFacilityType']) ? $_POST['treatmentFacilityType'] : '';
   $treatmentFacilityProvince = isset($_POST['treatmentFacilityProvince']) ? $_POST['treatmentFacilityProvince'] : '';
   $treatmentFacilityPostalCode = isset($_POST['treatmentFacilityPostalCode']) ? $_POST['treatmentFacilityPostalCode'] : '';

   $patientStatus = isset($_POST['pstatus']) ? $_POST['pstatus'] : '';
   $patientSubStatus = isset($_POST['substatus']) ? $_POST['substatus'] : '';
   //
   $query = "SELECT * FROM tblreimbursement WHERE pId = ? and fileId=?";
   $stmt = $pdo->prepare($query);
   $stmt->execute([$pId,$fileId]);
   $row = $stmt->fetch();
   //
   if($row['patientType']!=$patientType){
         updateActivity('Patient Status Updated',$_SESSION['empId'],$pId,$fileId,$patientType,$pdo);
   }

   if ($row) {
      $queryUpdate = "UPDATE tblreimbursement
         SET notesForNav = ?, reimbursementStatus = ?, rsn = ?, rsfud = ?, rcd = ?, ipal = ?, Carrier = ?, 
         groupCN = ?, certificateNumber = ?, cardholder = ?, cardholderName1 = ?, cardholderName2 = ?, 
        cardholderDOB = ?, coveragePercentage = ?, coinsurancePayment = ?, deductible = ?, annualMax = ?, 
        lifetimeMax = ?, copayMax = ?, sarequired = ?, dAppealSub = ?, saEapSub = ?, saEapOutcome = ?, 
        saEapExpiry = ?, saEapExpF = ?, luExpiry = ?, luCode = ?, dphsp = ?, ipal_secondary = ?, 
        Carrier_secondary = ?, groupCN_secondary = ?, certificateNumber_secondary = ?, cardholder_secondary = ?, 
        cardholderSecondaryName1 = ?, cardholderSecondaryName2 = ?, cardholderSecondaryDOB = ?, 
        coveragePercentage_secondary = ?, deductible_secondary = ?, annualMax_secondary = ?, 
        lifetimeMax_secondary = ?, copayMax_secondary = ?, sarequired_secondary = ?, dAppealSub_secondary = ?, 
        saEapSub_secondary = ?, saEapOutcome_secondary = ?, saEapExpiry_secondary = ?, saEapExpF_secondary = ?, 
        luExpiry_secondary = ?, luCode_secondary = ?, dphsp_tertiary = ?, ipal_tertiary = ?, Carrier_tertiary = ?, 
        groupCN_tertiary = ?, certificateNumber_tertiary = ?, cardholder_tertiary = ?, cardholderTertiaryName1 = ?, 
        cardholderTertiaryName2 = ?, cardholderTertiaryDOB = ?, coveragePercentage_tertiary = ?, 
        deductible_tertiary = ?, annualMax_tertiary = ?, lifetimeMax_tertiary = ?, copayMax_tertiary = ?, 
        sarequired_tertiary = ?, dAppealSub_tertiary = ?, saEapSub_tertiary = ?, saEapOutcome_tertiary = ?, 
        saEapExpiry_tertiary = ?, saEapExpF_tertiary = ?, luExpiry_tertiary = ?, luCode_tertiary = ?, 
        dphsp_quaternary = ?, ipal_quaternary = ?, Carrier_quaternary = ?, groupCN_quaternary = ?, 
        certificateNumber_quaternary = ?, cardholder_quaternary = ?, cardholderQuaternaryName1 = ?, 
        cardholderQuaternaryName2 = ?, cardholderQuaternaryDOB = ?, coveragePercentage_quaternary = ?, 
        deductible_quaternary = ?, annualMax_quaternary = ?, lifetimeMax_quaternary = ?, copayMax_quaternary = ?, 
        sarequired_quaternary = ?, dAppealSub_quaternary = ?, saEapSub_quaternary = ?, saEapOutcome_quaternary = ?, 
        saEapExpiry_quaternary = ?, saEapExpF_quaternary = ?, luExpiry_quaternary = ?, luCode_quaternary = ?, 
        dphmpf = ?, dphapc = ?, pcct = ?, pcd = ?, financialAssistance = ?, copayCard = ?, piRxCRM = ?, 
        consent = ?, consentRelease = ?, consentVFirst = ?, consentVLast = ?, injTraLoc = ?, vinjTraSites = ?, 
        clinicInjTrainingSites = ?, islc = ?, clinicInfSite = ?, infOther = ?, firstAppDate = ?, appointTimeHH = ?, 
        appointTimeMM = ?, appointTime = ?, trtStrtDate = ?, infFess = ?, cashpp = ?, coverageType = ?, 
        trtStatus = ?, pspPatientId = ?, createdBy = ?,rcby=?,
        saMdSentDate=?,saMdReceivedDate=?,saPatientSentDate=?,saPatientReceivedDate=?,
        saMdSentDate2=?,saMdReceivedDate2=?,saPatientSentDate2=?,saPatientReceivedDate2=?,
        saMdSentDate3=?,saMdReceivedDate3=?,saPatientSentDate3=?,saPatientReceivedDate3=?,
        saMdSentDate4=?,saMdReceivedDate4=?,saPatientSentDate4=?,saPatientReceivedDate4=?,drugStatus=?,physicianId=?,
        pharmacyType=?,pharmacyName=?,pharmacyPhone=?,pharmacyFax=?,	treatmentFacilityName=?,treatmentFacilityType=?,treatmentFacilityProvince=?,treatmentFacilityPostalCode=?,patientStatus=?,patientSubStatus=?,patientType=?
        WHERE pId = ? and fileId = ?";

      $stmt = $pdo->prepare($queryUpdate);
      if (
         $stmt->execute([
            $notesForNav,
            $reimbursementStatus,
            $rsn,
            $rsfud,
            $rcd,
            $ipal,
            $Carrier,
            $groupCN,
            $certificateNumber,
            $cardholder,
            $cardholderName1,
            $cardholderName2,
            $cardholderDOB,
            $coveragePercentage,
            $coinsurancePayment,
            $deductible,
            $annualMax,
            $lifetimeMax,
            $copayMax,
            $sarequired,
            $dAppealSub,
            $saEapSub,
            $saEapOutcome,
            $saEapExpiry,
            $saEapExpF,
            $luExpiry,
            $luCode,
            $dphsp,
            $ipal_secondary,
            $Carrier_secondary,
            $groupCN_secondary,
            $certificateNumber_secondary,
            $cardholder_secondary,
            $cardholderSecondaryName1,
            $cardholderSecondaryName2,
            $cardholderSecondaryDOB,
            $coveragePercentage_secondary,
            $deductible_secondary,
            $annualMax_secondary,
            $lifetimeMax_secondary,
            $copayMax_secondary,
            $sarequired_secondary,
            $dAppealSub_secondary,
            $saEapSub_secondary,
            $saEapOutcome_secondary,
            $saEapExpiry_secondary,
            $saEapExpF_secondary,
            $luExpiry_secondary,
            $luCode_secondary,
            $dphsp_tertiary,
            $ipal_tertiary,
            $Carrier_tertiary,
            $groupCN_tertiary,
            $certificateNumber_tertiary,
            $cardholder_tertiary,
            $cardholderTertiaryName1,
            $cardholderTertiaryName2,
            $cardholderTertiaryDOB,
            $coveragePercentage_tertiary,
            $deductible_tertiary,
            $annualMax_tertiary,
            $lifetimeMax_tertiary,
            $copayMax_tertiary,
            $sarequired_tertiary,
            $dAppealSub_tertiary,
            $saEapSub_tertiary,
            $saEapOutcome_tertiary,
            $saEapExpiry_tertiary,
            $saEapExpF_tertiary,
            $luExpiry_tertiary,
            $luCode_tertiary,
            $dphsp_quaternary,
            $ipal_quaternary,
            $Carrier_quaternary,
            $groupCN_quaternary,
            $certificateNumber_quaternary,
            $cardholder_quaternary,
            $cardholderQuaternaryName1,
            $cardholderQuaternaryName2,
            $cardholderQuaternaryDOB,
            $coveragePercentage_quaternary,
            $deductible_quaternary,
            $annualMax_quaternary,
            $lifetimeMax_quaternary,
            $copayMax_quaternary,
            $sarequired_quaternary,
            $dAppealSub_quaternary,
            $saEapSub_quaternary,
            $saEapOutcome_quaternary,
            $saEapExpiry_quaternary,
            $saEapExpF_quaternary,
            $luExpiry_quaternary,
            $luCode_quaternary,
            $dphmpf,
            $dphapc,
            $pcct,
            $pcd,
            $financialAssistance,
            $copayCard,
            $piRxCRM,
            $consent,
            $consentRelease,
            $consentVFirst,
            $consentVLast,
            $injTraLoc,
            $vinjTraSites,
            $clinicInjTrainingSites,
            $islc,
            $clinicInfSite,
            $infOther,
            $firstAppDate,
            $appointTimeHH,
            $appointTimeMM,
            $appointTime,
            $trtStrtDate,
            $infFess,
            $cashpp,
            $coverageType,
            $trtStatus,
            $pspPatientId,
            $empId,
            $rcby,
            $saMdSentDate,
            $saMdReceivedDate,
            $saPatientSentDate,
            $saPatientReceivedDate,
            $saMdSentDate2,
            $saMdReceivedDate2,
            $saPatientSentDate2,
            $saPatientReceivedDate2,
            $saMdSentDate3,
            $saMdReceivedDate3,
            $saPatientSentDate3,
            $saPatientReceivedDate3,
            $saMdSentDate4,
            $saMdReceivedDate4,
            $saPatientSentDate4,
            $saPatientReceivedDate4,
            $drugStatus,
            $physicianId,
            $pharmacyType,
            $pharmacyName,
            $pharmacyPhone,
            $pharmacyFax,
            $treatmentFacilityName,
            $treatmentFacilityType,
            $treatmentFacilityProvince,
            $treatmentFacilityPostalCode,
            $patientStatus,
            $patientSubStatus,
            $patientType,
            $pId,
            $fileId // pId as the last parameter for the WHERE clause
         ])
      ) {
            if ($_POST['reimbursementUpdate'] === 'SAVE & NEXT') {
               echo "<script>
               toastr.success('Patient Updated Successfully');
               setTimeout(function() {
                   window.location.href = 'edit_patient.php?id=" . $pId . "&token=4&fileId=" . $fileId . "';
               }, 2000);
             </script>";
            }else{
               echo "<script>
               toastr.success('Patient Updated Successfully');
               setTimeout(function() {
                   window.location.href = 'edit_patient.php?id=" . $pId . "&token=3&fileId=" . $fileId . "';
               }, 2000);
             </script>";
            }

       

      } else {
         echo "<script>toastr.error('Failed to update patient details');</script>";
      }
   } else {
      $query7 = "INSERT INTO tblreimbursement (pId,fileId,
         notesForNav, reimbursementStatus,
         rsn, rsfud, rcd, ipal, Carrier, groupCN, certificateNumber, cardholder, cardholderName1, cardholderName2,
         cardholderDOB, coveragePercentage, coinsurancePayment, deductible, annualMax, lifetimeMax, copayMax, sarequired,
         dAppealSub, saEapSub, saEapOutcome, saEapExpiry, saEapExpF, luExpiry, luCode, dphsp, ipal_secondary,
         Carrier_secondary, groupCN_secondary, certificateNumber_secondary, cardholder_secondary, cardholderSecondaryName1,
         cardholderSecondaryName2, cardholderSecondaryDOB, coveragePercentage_secondary, deductible_secondary, annualMax_secondary,
         lifetimeMax_secondary, copayMax_secondary, sarequired_secondary, dAppealSub_secondary, saEapSub_secondary,
         saEapOutcome_secondary, saEapExpiry_secondary, saEapExpF_secondary, luExpiry_secondary, luCode_secondary, dphsp_tertiary,
         ipal_tertiary, Carrier_tertiary, groupCN_tertiary, certificateNumber_tertiary, cardholder_tertiary, cardholderTertiaryName1,
         cardholderTertiaryName2, cardholderTertiaryDOB, coveragePercentage_tertiary, deductible_tertiary, annualMax_tertiary,
         lifetimeMax_tertiary, copayMax_tertiary, sarequired_tertiary, dAppealSub_tertiary, saEapSub_tertiary, saEapOutcome_tertiary,
         saEapExpiry_tertiary, saEapExpF_tertiary, luExpiry_tertiary, luCode_tertiary, dphsp_quaternary, ipal_quaternary,
         Carrier_quaternary, groupCN_quaternary, certificateNumber_quaternary, cardholder_quaternary, cardholderQuaternaryName1,
         cardholderQuaternaryName2, cardholderQuaternaryDOB, coveragePercentage_quaternary, deductible_quaternary, annualMax_quaternary,
         lifetimeMax_quaternary, copayMax_quaternary, sarequired_quaternary, dAppealSub_quaternary, saEapSub_quaternary,
         saEapOutcome_quaternary, saEapExpiry_quaternary, saEapExpF_quaternary, luExpiry_quaternary, luCode_quaternary, dphmpf,
         dphapc, pcct, pcd, financialAssistance, copayCard, piRxCRM, consent, consentRelease, consentVFirst, consentVLast,
         injTraLoc, vinjTraSites, clinicInjTrainingSites, islc, clinicInfSite, infOther, firstAppDate, appointTimeHH,
         appointTimeMM, appointTime, trtStrtDate, infFess, cashpp, coverageType, trtStatus, pspPatientId,createdBy,rcby,
         saMdSentDate,saMdReceivedDate,saPatientSentDate,saPatientReceivedDate,saMdSentDate2,saMdReceivedDate2,saPatientSentDate2,saPatientReceivedDate2,
        saMdSentDate3,saMdReceivedDate3,saPatientSentDate3,saPatientReceivedDate3,saMdSentDate4,saMdReceivedDate4,saPatientSentDate4,saPatientReceivedDate4,drugStatus,physicianId,pharmacyType,pharmacyName,pharmacyPhone,pharmacyFax,treatmentFacilityName,treatmentFacilityType,treatmentFacilityProvince,treatmentFacilityPostalCode,patientStatus,patientSubStatus,patientType)
         VALUES (?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
               ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 
               ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
               ?, ?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
      $stmt = $pdo->prepare($query7);

      if (
         $stmt->execute([
            $pId,
            $fileId,
            $notesForNav,
            $reimbursementStatus,
            $rsn,
            $rsfud,
            $rcd,
            $ipal,
            $Carrier,
            $groupCN,
            $certificateNumber,
            $cardholder,
            $cardholderName1,
            $cardholderName2,
            $cardholderDOB,
            $coveragePercentage,
            $coinsurancePayment,
            $deductible,
            $annualMax,
            $lifetimeMax,
            $copayMax,
            $sarequired,
            $dAppealSub,
            $saEapSub,
            $saEapOutcome,
            $saEapExpiry,
            $saEapExpF,
            $luExpiry,
            $luCode,
            $dphsp,
            $ipal_secondary,
            $Carrier_secondary,
            $groupCN_secondary,
            $certificateNumber_secondary,
            $cardholder_secondary,
            $cardholderSecondaryName1,
            $cardholderSecondaryName2,
            $cardholderSecondaryDOB,
            $coveragePercentage_secondary,
            $deductible_secondary,
            $annualMax_secondary,
            $lifetimeMax_secondary,
            $copayMax_secondary,
            $sarequired_secondary,
            $dAppealSub_secondary,
            $saEapSub_secondary,
            $saEapOutcome_secondary,
            $saEapExpiry_secondary,
            $saEapExpF_secondary,
            $luExpiry_secondary,
            $luCode_secondary,
            $dphsp_tertiary,
            $ipal_tertiary,
            $Carrier_tertiary,
            $groupCN_tertiary,
            $certificateNumber_tertiary,
            $cardholder_tertiary,
            $cardholderTertiaryName1,
            $cardholderTertiaryName2,
            $cardholderTertiaryDOB,
            $coveragePercentage_tertiary,
            $deductible_tertiary,
            $annualMax_tertiary,
            $lifetimeMax_tertiary,
            $copayMax_tertiary,
            $sarequired_tertiary,
            $dAppealSub_tertiary,
            $saEapSub_tertiary,
            $saEapOutcome_tertiary,
            $saEapExpiry_tertiary,
            $saEapExpF_tertiary,
            $luExpiry_tertiary,
            $luCode_tertiary,
            $dphsp_quaternary,
            $ipal_quaternary,
            $Carrier_quaternary,
            $groupCN_quaternary,
            $certificateNumber_quaternary,
            $cardholder_quaternary,
            $cardholderQuaternaryName1,
            $cardholderQuaternaryName2,
            $cardholderQuaternaryDOB,
            $coveragePercentage_quaternary,
            $deductible_quaternary,
            $annualMax_quaternary,
            $lifetimeMax_quaternary,
            $copayMax_quaternary,
            $sarequired_quaternary,
            $dAppealSub_quaternary,
            $saEapSub_quaternary,
            $saEapOutcome_quaternary,
            $saEapExpiry_quaternary,
            $saEapExpF_quaternary,
            $luExpiry_quaternary,
            $luCode_quaternary,
            $dphmpf,
            $dphapc,
            $pcct,
            $pcd,
            $financialAssistance,
            $copayCard,
            $piRxCRM,
            $consent,
            $consentRelease,
            $consentVFirst,
            $consentVLast,
            $injTraLoc,
            $vinjTraSites,
            $clinicInjTrainingSites,
            $islc,
            $clinicInfSite,
            $infOther,
            $firstAppDate,
            $appointTimeHH,
            $appointTimeMM,
            $appointTime,
            $trtStrtDate,
            $infFess,
            $cashpp,
            $coverageType,
            $trtStatus,
            $pspPatientId,
            $empId,
            $rcby,
            $saMdSentDate,
            $saMdReceivedDate,
            $saPatientSentDate,
            $saPatientReceivedDate,
            $saMdSentDate2,
            $saMdReceivedDate2,
            $saPatientSentDate2,
            $saPatientReceivedDate2,
            $saMdSentDate3,
            $saMdReceivedDate3,
            $saPatientSentDate3,
            $saPatientReceivedDate3,
            $saMdSentDate4,
            $saMdReceivedDate4,
            $saPatientSentDate4,
            $saPatientReceivedDate4,
            $drugStatus,
            $physicianId,
            $pharmacyType,
            $pharmacyName,
            $pharmacyPhone,
            $pharmacyFax,
            $treatmentFacilityName,
            $treatmentFacilityType,
            $treatmentFacilityProvince,
            $treatmentFacilityPostalCode,
            $patientStatus,
            $patientSubStatus,
            $patientType
         ])
      ) {
         echo "<script>
               toastr.success('Patient Updated Successfully');
               setTimeout(function() {
                   window.location.href = 'edit_patient.php?id=" . $pId . "&token=3&fileId=" . $fileId . "';
               }, 2000);
             </script>";
      } else {
         echo "<script>
               toastr.error('Failed to update patient details');
               setTimeout(function() {
                   window.location.href = 'edit_patient.php?id=" . $pId . "&token=3&fileId=" . $fileId . "';
               }, 2000);
               </script>";
      }

   }

   $id = isset($_GET['id']) ? intval($_GET['id']) : 0; // Convert to integer to ensure it's numeric

   //header("location:edit_patient.php?id=" . $id.'&token=3');
   //reimbursememt end
}
if (isset($_POST['updateWelcomeCall'])) {
   $pId = $_GET['id']; // Assuming pId is coming from somewhere
   $fileId = $_GET['fileId'];
   $empId = $_SESSION["empId"];
   // Collect form data
   $wcStatus = $_POST['wcStatus'];
   $wcStatusDueDate = $_POST['wcsdd'];
   $wcFirstAttempt = $_POST['firstAttemptDatetime'];
   $wcSecondAttempt = $_POST['secondAttemptDatetime'];
   $wcThirdAttempt = $_POST['thirdAttemptDatetime'];
   $wcCompletionDate = $_POST['welcomeCallCompletionDate'];
   $wcNotes = $_POST['wcn'];
   $wcCompletedBy = $_POST['wccb'];

   //////wc part 2
   $phcn = $_POST['phcn'];
   $noscf = $_POST['noscf'];
   $noscl = $_POST['noscl'];
   $scpn = $_POST['scpn'];
   $sce = $_POST['sce'];
   $rtp = $_POST['rtp'];
   $preferences = $_POST['preferences'];

   //////wc part 3
   $ma = $_POST['ma'];
   $la = $_POST['la'];
   $medicalConditions = isset($_POST['mc']) ? $_POST['mc'] : [];
   $medicalConditionsString = implode(',', $medicalConditions);
   $mcco = $_POST['mcco'];
   $currentMed = $_POST['currentMed'];
   $lifestyle = isset($_POST['lifestyle']) ? $_POST['lifestyle'] : [];
   $lifestyleString = implode(',', $lifestyle);
   $lc = $_POST['lc'];

   //////wc part 4
   $pmpw = isset($_POST['pmpw']) ? $_POST['pmpw'] : [];
   $pmpw = implode(',', $pmpw);
   $pmdosage = isset($_POST['pmdosage']) ? $_POST['pmdosage'] : [];
   $pmdosage = implode(',', $pmdosage);
   $wpsf = isset($_POST['wpsf']) ? $_POST['wpsf'] : [];
   $wpsf = implode(',', $wpsf);
   $pmsd = isset($_POST['pmsd']) ? $_POST['pmsd'] : [];
   $pmsd = implode(',', $pmsd);
   $pmed = isset($_POST['pmed']) ? $_POST['pmed'] : [];
   $pmed = implode(',', $pmed);
   $csephp = isset($_POST['csephp']) ? $_POST['csephp'] : [];
   $csephp = implode(',', $csephp);

   //////wc part 5
   $patientDrugName = $_POST['patientDrugName'];
   $dosage = $_POST['dose'];
   $routeOfAdmin = $_POST['roa'];
   $patientWeight = $_POST['pwkl'];
   

   $indicationString = isset($_POST['indication']) ? $_POST['indication'] : [];
   $indication = implode(',', $indicationString);

   $adMedication = isset($_POST['adMedication']) ? $_POST['adMedication'] : '';
   $asthmaMedication = isset($_POST['asthmaMedication']) ? $_POST['asthmaMedication'] : '';
   $CRSwNPMedication = isset($_POST['CRSwNPMedication']) ? $_POST['CRSwNPMedication'] : '';


   $offLabelUse = $_POST['oluse'];
   $prescriberName = $_POST['prescriberName'];
   $prescriberSpecialty = $_POST['prescriberSpecialty'];
   $team = $_POST['team'];
   $staff = $_POST['staff'];
   $presciberOffice = isset($_POST['Dpgsd']) ? $_POST['Dpgsd'] : '';
   $sampleDoseReceived = $_POST['smpDate'];
   $counselingStatus = $_POST['counselingStatus'];
   $csfud = $_POST['csfud'];
   $ccd = $_POST['ccd'];
   $ccby = $_POST['ccby'];
   $counselingNotes = $_POST['counselingNotes'];
   $screeningImmunization = $_POST['screeningImmunization'];

   //////wc part 6
   $sis = $_POST['sis'];
   $svr = isset($_POST['svr']) ? $_POST['svr'] : [];
   $svr = implode(',', $svr);
   $tbskinscreening = isset($_POST['tbskinscreening']) ? $_POST['tbskinscreening'] : '';
   $cxss = isset($_POST['CXSS']) ? $_POST['CXSS'] : '';
   $osi = $_POST['osi'];
   $sisfupd = $_POST['sisfupd'];
   $screeningDocs = '';
   $sicd = $_POST['sicd'];
   $mccb = $_POST['mccb'];

   /////////////////////////


   try {
      // Check if data already exists for the patient
      $query = "SELECT * FROM tblwcpart1 WHERE pId = ? and fileId = ?";
      $stmt = $pdo->prepare($query);
      $stmt->execute([$pId, $fileId]);
      $row = $stmt->fetch();
      if($row['wcStatus']!=$wcStatus){
         updateActivity('Welcome Call Status Updated',$_SESSION['empId'],$pId,$fileId,$wcStatus,$pdo);
      }
      
      $queryz = "SELECT province,krollId FROM tblpatient WHERE id = ?";
      $stmtz = $pdo->prepare($queryz);
      $stmtz->execute([$pId]);
      $rowz = $stmtz->fetch();
      $patientdirectory = $rowz['province'] . $rowz['krollId'];

      if (!file_exists('uploads/' . $patientdirectory . '/MedicationDocuments')) {
         mkdir('uploads/' . $patientdirectory . '/MedicationDocuments', 0777, true);
      }
      if (!file_exists('uploads/' . $patientdirectory . '/ScreeningImmunizationDocuments')) {
         mkdir('uploads/' . $patientdirectory . '/ScreeningImmunizationDocuments', 0777, true);
      }

      if (isset($_FILES['screeningDocs'])) {
         $file_list = $_FILES['screeningDocs'];
         if (isset($file_list['name']) && is_array($file_list['name'])) {
            $screeningDocs = implode(', ', $file_list['name']);
         }
         // Loop through each file
         foreach ($file_list['name'] as $key => $file_name) {
            $file_tmp = $file_list['tmp_name'][$key];
            $file_size = $file_list['size'][$key];
            $file_error = $file_list['error'][$key];

            // Check for errors
            if ($file_error === UPLOAD_ERR_OK) {
               $upload_dir = 'uploads/' . $patientdirectory . '/ScreeningImmunizationDocuments' . '/';
               // Move the file to the specified directory
               if (move_uploaded_file($file_tmp, $upload_dir . $file_name)) {
                  $stmt2 = $pdo->prepare("INSERT INTO tblpatientdocs(pId,fileId, filename, module) VALUES (?,?,?,?)");
                  $result2 = $stmt2->execute([$pId, $fileId, $file_name, 'ScreeningImmunizationDocuments']);
                  // echo "File $file_name uploaded successfully.<br>";
               } else {
                  //  echo "Error uploading $file_name.<br>";
               }
            } else {
               echo "Error uploading $file_name: ";
               if ($file_error == UPLOAD_ERR_INI_SIZE || $file_error == UPLOAD_ERR_FORM_SIZE) {
                  // echo "The uploaded file exceeds the upload_max_filesize directive in php.ini.<br>";
               } elseif ($file_error == UPLOAD_ERR_PARTIAL) {
                  // echo "The uploaded file was only partially uploaded.<br>";
               } elseif ($file_error == UPLOAD_ERR_NO_FILE) {
                  //  echo "No file was uploaded.<br>";
               } elseif (in_array($file_error, [UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_EXTENSION])) {
                  //  echo "Server error: Failed to write file to disk.<br>";
               } else {
                  // echo "Unknown error occurred.<br>";
               }
            }
         }
      }

      if (isset($_FILES['pmmd'])) {
         $file_list = $_FILES['pmmd'];
         if (isset($file_list['name']) && is_array($file_list['name'])) {
            $filenames = implode(', ', $file_list['name']);
         }
         // Loop through each file
         foreach ($file_list['name'] as $key => $file_name) {
            $file_tmp = $file_list['tmp_name'][$key];
            $file_size = $file_list['size'][$key];
            $file_error = $file_list['error'][$key];

            // Check for errors
            if ($file_error === UPLOAD_ERR_OK) {
               // You can perform additional checks here if needed, such as file size, file type, etc.

               // Specify the directory where you want to save uploaded files
               $upload_dir = 'uploads/' . $patientdirectory . '/MedicationDocuments' . '/';

               // Move the file to the specified directory
               if (move_uploaded_file($file_tmp, $upload_dir . $file_name)) {
                  //  echo "File $file_name uploaded successfully.<br>";
                  $stmt2 = $pdo->prepare("INSERT INTO tblpatientdocs(pId,fileId, filename, module) VALUES (?,?,?,?)");
                  $result2 = $stmt2->execute([$pId, $file_name, 'MedicationDocuments']);

               } else {
                  //  echo "Error uploading $file_name.<br>";
               }
            } else {
               // echo "Error uploading $file_name: ";
               if ($file_error == UPLOAD_ERR_INI_SIZE || $file_error == UPLOAD_ERR_FORM_SIZE) {
                  //  echo "The uploaded file exceeds the upload_max_filesize directive in php.ini.<br>";
               } elseif ($file_error == UPLOAD_ERR_PARTIAL) {
                  //  echo "The uploaded file was only partially uploaded.<br>";
               } elseif ($file_error == UPLOAD_ERR_NO_FILE) {
                  //  echo "No file was uploaded.<br>";
               } elseif (in_array($file_error, [UPLOAD_ERR_NO_TMP_DIR, UPLOAD_ERR_CANT_WRITE, UPLOAD_ERR_EXTENSION])) {
                  //  echo "Server error: Failed to write file to disk.<br>";
               } else {
                  //  echo "Unknown error occurred.<br>";
               }
            }
         }
      }
      if ($row) {
         // Update existing record
         $query = "UPDATE tblwcpart1 SET 
                  wcStatus = ?,
                  wcStatusDueDate = ?,
                  wcFirstAttempt = ?,
                  wcSecondAttempt = ?,
                  wcThirdAttempt = ?,
                  wcCompletionDate = ?,
                  wcNotes = ?,
                  wcCompletedBy = ?,
                  modifiedAt = NOW(),
                  modifiedBy = ?
                  WHERE pId = ? and fileId = ?";
         $stmt = $pdo->prepare($query);
         $stmt->execute([$wcStatus, $wcStatusDueDate, $wcFirstAttempt, $wcSecondAttempt, $wcThirdAttempt, $wcCompletionDate, $wcNotes, $wcCompletedBy, $empId, $pId, $fileId]);

         $queryx = "UPDATE tblwcpart2 SET 
                  provincialHCN = ?,
                  sFirstName = ?,
                  sLastName = ?,
                  sPhone = ?,
                  sEmail = ?,
                  sRelationship = ?,
                  prefrences = ?
                  WHERE pId = ? and fileId = ?";
         $stmtx = $pdo->prepare($queryx);
         $stmtx->execute([$phcn, $noscf, $noscl, $scpn, $sce, $rtp, $preferences, $pId, $fileId]);

         $queryy = "UPDATE tblwcpart3 SET 
                        medicationAllergies = ?,
                        latexAllergies = ?,
                        medicalConditions = ?,
                        medicalConditionsComments = ?,
                        currentMedications = ?,
                        patientMedicationDocs = ?,
                        lifestyle = ?,
                        lifestyleComments = ?
                        WHERE pId = ?  and fileId = ?";
         $stmty = $pdo->prepare($queryy);
         $stmty->execute([$ma, $la, $medicalConditionsString, $mcco, $currentMed, $filenames, $lifestyleString, $lc, $pId, $fileId]);


         $queryq = "UPDATE tblwcpart4 SET 
                     pmName = ?,
                     pmDosage = ?,
                     pmSwitchReason = ?,
                     pmStartDate = ?,
                     pmEndDate = ?,
                     confirmStartEndDate = ?
                     WHERE pId = ?  and fileId = ?";
         $stmtq = $pdo->prepare($queryq);
         $stmtq->execute([$pmpw, $pmdosage, $wpsf, $pmsd, $pmed, $csephp, $pId, $fileId]);

         $query5 = "UPDATE tblwcpart5 SET 
                     patientDrugName = ?,
                     dosage = ?,
                     routeOfAdmin = ?,
                     patientWeight = ?,
                     indication = ?,
                     offLabelUse = ?,
                     prescriberName = ?,
                     prescriberSpecialty = ?,
                     team = ?,
                     staff = ?,
                     presciberOffice = ?,
                     sampleDoseReceived=?,adMedication=?,asthmaMedication=?,CRSwNPMedication=?
                     WHERE pId = ?  and fileId = ?";
         $stmt5 = $pdo->prepare($query5);
         $stmt5->execute([$patientDrugName, $dosage, $routeOfAdmin, $patientWeight, $indication, $offLabelUse, $prescriberName, $prescriberSpecialty, $team, $staff, $presciberOffice, $sampleDoseReceived,$adMedication,$asthmaMedication,$CRSwNPMedication, $pId, $fileId]);

         $query6 = "UPDATE tblwcpart6 SET 
                     sis = ?,
                     svr = ?,
                     tbskinscreening = ?,
                     cxss = ?,
                     osi = ?,
                     sisfupd = ?,
                     screeningDocs = ?,
                     sicd = ?,
                     mccb = ?,
                     counselingStatus =?, csfud =?, ccd =?, ccby=?, counselingNotes=?, screeningImmunization=?
                     WHERE pId = ?  and fileId = ?";
         $stmt6 = $pdo->prepare($query6);
         $stmt6->execute([$sis, $svr, $tbskinscreening, $cxss, $osi, $sisfupd, $screeningDocs, $sicd, $mccb, $counselingStatus, $csfud, $ccd, $ccby, $counselingNotes, $screeningImmunization, $pId, $fileId]);
      } else {
         // Insert new record
         $query = "INSERT INTO tblwcpart1 (pId,fileId, wcStatus, wcStatusDueDate, wcFirstAttempt, wcSecondAttempt, wcThirdAttempt, wcCompletionDate, wcNotes, wcCompletedBy, modifiedAt, modifiedBy, createdBy, createdAt) 
                        VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), 'YourModifiedByField', 'YourCreatedByField', NOW())";
         $stmt = $pdo->prepare($query);
         $stmt->execute([$pId, $fileId, $wcStatus, $wcStatusDueDate, $wcFirstAttempt, $wcSecondAttempt, $wcThirdAttempt, $wcCompletionDate, $wcNotes, $wcCompletedBy]);

         $queryx = "INSERT INTO tblwcpart2 (pId,fileId, provincialHCN, sFirstName, sLastName, sPhone, sEmail, sRelationship, prefrences) 
               VALUES (?,?, ?, ?, ?, ?, ?, ?, ?)";
         $stmtx = $pdo->prepare($queryx);
         $stmtx->execute([$pId, $fileId, $phcn, $noscf, $noscl, $scpn, $sce, $rtp, $preferences]);

         $queryy = "INSERT INTO tblwcpart3 (pId,fileId,medicationAllergies,latexAllergies,medicalConditions,medicalConditionsComments,currentMedications,patientMedicationDocs,lifestyle,
                        lifestyleComments) VALUES(?,?,?,?,?,?,?,?,?,?)";
         $stmty = $pdo->prepare($queryy);
         $stmty->execute([$pId, $fileId, $ma, $la, $medicalConditionsString, $mcco, $currentMed, $filenames, $lifestyleString, $lc]);

         $queryq_insert = "INSERT INTO tblwcpart4 (pmName,pmDosage,pmSwitchReason,pmStartDate,pmEndDate,confirmStartEndDate,pId,fileId) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
         $stmtq_insert = $pdo->prepare($queryq_insert);
         $stmtq_insert->execute([$pmpw, $pmdosage, $wpsf, $pmsd, $pmed, $csephp, $pId, $fileId]);

         $query5 = "UPDATE tblwcpart5 SET 
                     patientDrugName = ?,
                     dosage = ?,
                     routeOfAdmin = ?,
                     patientWeight = ?,
                     indication = ?,
                     offLabelUse = ?,
                     prescriberName = ?,
                     prescriberSpecialty = ?,
                     team = ?,
                     staff = ?,
                     presciberOffice = ?,
                     sampleDoseReceived=?,adMedication=?,asthmaMedication=?,CRSwNPMedication=?
                     WHERE pId = ? and fileId = ?";
         $stmt5 = $pdo->prepare($query5);
         $stmt5->execute([$patientDrugName, $dosage, $routeOfAdmin, $patientWeight, $indication, $offLabelUse, $prescriberName, $prescriberSpecialty, $team, $staff, $presciberOffice, $sampleDoseReceived, $adMedication,$asthmaMedication,$CRSwNPMedication,$pId, $fileId]);


         // $query5_insert = "INSERT INTO tblwcpart5 (patientDrugName,dosage,routeOfAdmin,patientWeight,indication,offLabelUse,prescriberName,prescriberSpecialty,team,staff,presciberOffice,sampleDoseReceived,pId) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
         // $stmt5_insert = $pdo->prepare($query5_insert);
         // $stmt5_insert->execute([$patientDrugName, $dosage, $routeOfAdmin, $patientWeight, $indication,$offLabelUse, $prescriberName, $prescriberSpecialty, $team, $staff,$presciberOffice, $sampleDoseReceived, $pId]);

         $query6_insert = "INSERT INTO tblwcpart6 (fileId,sis,svr,tbskinscreening,cxss,osi,sisfupd,screeningDocs,sicd,mccb,pId,counselingStatus, csfud, ccd, ccby, counselingNotes, screeningImmunization) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?,?,?,?)";
         $stmt6_insert = $pdo->prepare($query6_insert);
         $stmt6_insert->execute([
            $fileId,
            $sis,
            $svr,
            $tbskinscreening,
            $cxss,
            $osi,
            $sisfupd,
            $screeningDocs,
            $sicd,
            $mccb,
            $pId,
            $counselingStatus,
            $csfud,
            $ccd,
            $ccby,
            $counselingNotes,
            $screeningImmunization
         ]);
      }
      $id = isset($_GET['id']) ? intval($_GET['id']) : 0; // Convert to integer to ensure it's numeric

      if ($_POST['updateWelcomeCall'] === 'SAVE & NEXT') {
         echo "<script>
         toastr.success('Patient Updated Successfully');
         setTimeout(function() {
             window.location.href = 'edit_patient.php?id=" . $pId . "&token=3&fileId=" . $fileId . "';
         }, 2000);
       </script>";
      }else{
         echo "<script>
         toastr.success('Patient Updated Successfully');
         setTimeout(function() {
             window.location.href = 'edit_patient.php?id=" . $pId . "&token=2&fileId=" . $fileId . "';
         }, 2000);
       </script>";
      }
      //header("location:edit_patient.php?id=" . $id.'&token=2');
      // Redirect or do something else after processing
   } catch (PDOException $e) {
      echo "<script>toastr.error('Failed to update patient details');</script>";
      echo "Error: " . $e->getMessage();
   }
}

$stmt3 = $pdo->prepare("SELECT * FROM tblpsp WHERE isDeleted='N' ORDER BY pspName ASC");
$stmt3->execute();
$psps = $stmt3->fetchAll();

$stmt6 = $pdo->prepare("SELECT * FROM tblpatient WHERE isDeleted='N' ORDER BY patientName ASC");
$stmt6->execute();
$addedpatient = $stmt6->fetchAll();

$stmt7 = $pdo->prepare("SELECT * FROM tbldrugs WHERE isDeleted='N' ORDER BY drugName ASC");
$stmt7->execute();
$medications = $stmt7->fetchAll();

$stmt8 = $pdo->prepare("SELECT * FROM tblphysicians WHERE isDeleted='N' ORDER BY firstName ASC");
$stmt8->execute();
$physicians = $stmt8->fetchAll();

$stmt8 = $pdo->prepare("SELECT * FROM tblprovince WHERE countryId='1' ORDER BY provinceName ASC");
$stmt8->execute();
$provinces = $stmt8->fetchAll();


$stmt80 = $pdo->prepare("SELECT * FROM tblpatientstatus WHERE isDeleted='N' ORDER BY StatusName ASC");
$stmt80->execute();
$pstatus = $stmt80->fetchAll();


if (isset($_GET['id'])) {
   $stmt1 = $pdo->prepare("SELECT tblpatient.*, tblpatientdetails.*, tblwcpart1.*, tblwcpart2.*, tblwcpart3.*, tblwcpart4.*, tblwcpart5.*, tblwcpart6.* FROM tblpatient 
                                inner join tblpatientdetails on tblpatient.id=tblpatientdetails.pId 
                                LEFT JOIN tblwcpart1 ON tblpatientdetails.pId = tblwcpart1.pId and tblpatientdetails.fileId=tblwcpart1.fileId
                                LEFT JOIN tblwcpart2 ON tblpatientdetails.pId = tblwcpart2.pId and tblpatientdetails.fileId=tblwcpart2.fileId
                                LEFT JOIN tblwcpart3 ON tblpatientdetails.pId = tblwcpart3.pId and tblpatientdetails.fileId=tblwcpart3.fileId 
                                LEFT JOIN tblwcpart4 ON tblpatientdetails.pId = tblwcpart4.pId and tblpatientdetails.fileId=tblwcpart4.fileId  
                                LEFT JOIN tblwcpart5 ON tblpatientdetails.pId = tblwcpart5.pId and tblpatientdetails.fileId=tblwcpart5.fileId      
                                LEFT JOIN tblwcpart6 ON tblpatientdetails.pId = tblwcpart6.pId and tblpatientdetails.fileId=tblwcpart6.fileId      
                                WHERE tblpatient.isDeleted='N' AND tblpatient.id=? AND tblpatientdetails.fileId = ?");
   $stmt1->execute([$_GET['id'], $_GET['fileId']]);
   $patientDetails = $stmt1->fetch();

   $stmt7 = $pdo->prepare("SELECT * FROM tblpatientdocs WHERE isDeleted='N'  AND pId=? AND fileId=? AND module='patient' ORDER BY id ASC");
   $stmt7->execute([$_GET['id'], $_GET['fileId']]);
   $generaldocs = $stmt7->fetchAll();

   $stmt7 = $pdo->prepare("SELECT * FROM tblpatientdocs WHERE isDeleted='N'  AND pId=? AND fileId=? AND module='MedicationDocuments' ORDER BY id ASC");
   $stmt7->execute([$_GET['id'], $_GET['fileId']]);
   $medicaldocs = $stmt7->fetchAll();

   $stmt7 = $pdo->prepare("SELECT * FROM tblpatientdocs WHERE isDeleted='N'  AND pId=? AND fileId=? AND module='ScreeningImmunizationDocuments' ORDER BY id ASC");
   $stmt7->execute([$_GET['id'], $_GET['fileId']]);
   $screeningdocs = $stmt7->fetchAll();

   $stmt1 = $pdo->prepare("SELECT * from tblreimbursement      
                                 WHERE pId=? and fileId=?");
   $stmt1->execute([$_GET['id'], $_GET['fileId']]);
   $repatientDetails = $stmt1->fetch();
   if(isset($repatientDetails['physicianId'])) {
   $stmtz1 = $pdo->prepare("SELECT * from tblphysicians WHERE id=?");
   $stmtz1->execute([$repatientDetails['physicianId']]);
   $physicianDetails = $stmtz1->fetch();
   }
   if(isset($repatientDetails['patientType'])) {
      $stmtz1z = $pdo->prepare("SELECT * from tblstatuslogs WHERE pId=? and fileId=? and operationName='Patient Status Updated'");
      $stmtz1z->execute([$repatientDetails['pId'],$repatientDetails['fileId']]);
      $typeStatus = $stmtz1z->fetchAll();
   }
   if(isset($patientDetails['wcStatus'])) {
      $stmtz1z = $pdo->prepare("SELECT * from tblstatuslogs WHERE pId=? and fileId=? and operationName='Welcome Call Status Updated'");
      $stmtz1z->execute([$patientDetails['pId'],$patientDetails['fileId']]);
      $welcometypeStatus = $stmtz1z->fetchAll();
   }   

   $stmt1 = $pdo->prepare("SELECT empId,userName from tbluser WHERE isDeleted='N'");
   $stmt1->execute();
   $employees = $stmt1->fetchAll();


   $stmt1z = $pdo->prepare("SELECT * from tblindication WHERE pId=? and fileId=? and isDeleted='N' ORDER BY id DESC");
   $stmt1z->execute([$_GET['id'],$_GET['fileId']]);
   $indicationDetails = $stmt1z->fetch();

} else {
   header("location:index.php");
}
?>
<style>
   /* New UI Styles */
   .form-container {
      max-width: 1400px;
      margin: 0 auto;
      padding: 32px 30px;
   }
   
   .page-header {
      margin-bottom: 32px;
   }
   
   .page-title {
      font-size: 28px;
      font-weight: 700;
      color: #1a202c;
      margin-bottom: 8px;
   }
   
   .page-subtitle {
      font-size: 15px;
      color: #718096;
   }
   
   .form-card {
      background: white;
      border-radius: 16px;
      padding: 32px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
      margin-bottom: 24px;
   }
   
   .form-section-title {
      font-size: 18px;
      font-weight: 700;
      color: #1a202c;
      margin-bottom: 20px;
      padding-bottom: 12px;
      border-bottom: 2px solid #e2e8f0;
      display: flex;
      align-items: center;
      gap: 10px;
   }
   
   .form-section-title i {
      color: #1a70b8;
   }
   
   /* Keep existing styles */
   ul.inbuiltwc fieldset span {
      display: -webkit-box;
   }

   ul.inbuiltwc fieldset span input {
      margin: 0px 10px;
   }

   .editWc span.nextline,
   .reviewform span.nextline {
      display: block !important;
   }

   .editWc span.nextline label,
   .reviewform span.nextline label {
      margin-left: 10px;
   }

   .row.mg10 {
      margin: 10px 0px;
   }

   .editWc .ftitle h3,
   .editWc h3.ftitle {
      font-size: 18px !important;
      padding: 5px 0px;
      font-weight: 600;
   }

   .editWc label.description,
   .editWc label {
      font-weight: 500 !important;
      font-size: 14px;
   }

   .editWc select.form-control,
   .editWc input.form-control,
   .editWc .select2-results__options li,
   .editWc .select2-search__field {
      font-size: 14px !important;
   }

   .editWc fieldset span {
      vertical-align: middle !important;
      display: inline-flex !important;
   }

   li.line {
      border: 1px solid #cccccc;
   }

   section.content.w70 {
      width: 80%;
      margin-left: 15%;
   }

   aside {
      width: 15%;
   }

   .myeditpatient span.req {
      line-height: 0px !important;
      padding: 0px !important;
      display: inline-flex !important;
      margin-left: 5px;
   }
  

.patientType i.fa.fa-info-circle {
    padding: 0;
    vertical-align: middle;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-left: 5px;
}
ul#select2-patientType-results li:after {
    content: "\f05a";
    font-family: var(--fa-style-family, "Font Awesome 6 Free");
    font-weight: var(--fa-style, 900);
    float: right;
}
ul#select2-patientType-results li:first-child:after {
    content: "";
    font-family: var(--fa-style-family, "Font Awesome 6 Free");
    font-weight: var(--fa-style, 900);
    float: right;
}
.popupActivityStatus,.popupWelcomeCallActivityStatus {
    position: fixed;
    z-index: 99999999 !important;
    justify-content: center;
    align-items: center;
    vertical-align: middle;
    text-align: center;
    left: 40%;
    top: 30%;
    background: white;
    padding: 20px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.9);
}
i#patientTypeClose,i#welcomeTypeClose {
    float: right;
    top: 10px;
    position: absolute;
    right: 10px;
    background: black;
    color: white;
    border-radius: 50%;
    width: 20px;
    line-height: 20px;
    height: 20px;
    cursor: pointer;
}
.popupActivityStatus h3,.popupWelcomeCallActivityStatus h3{
    font-size:22px;
    margin:10px 0px;
    font-weight:600;
}
a#getWelcomeActivityInfo,a#getActivityInfo {
    margin-bottom: 0 !important;
    padding-bottom: 0px !important;
    line-height: 20px !important;
    margin-left: 10px;
    color: #0d6efd;
    cursor: pointer !important;
}

span.select2-dropdown.select2-dropdown--above {
    top: 40vh !important;
    left: 5vh !important;
}
span.select2-dropdown.select2-dropdown--below {
    top: 10vh !important;
    left: 5vh !important;
}
.wiFull{
   width: 100% !important;
}
.wimax{
   width: max-content !important;
    text-wrap: nowrap;
}
.fixselectmultiple span.select2.select2-container.select2-container--default {
    padding: 0px !important;
    margin: 0px !important;
    height: 45px !important;
}
.fixselectmultiple span.select2-selection.select2-selection--multiple {
    display: inline-flex;
    padding:0px !important;
    width: 100%;
    text-align: left;
    justify-content: left;
}
.fixselectmultiple .select2-selection--multiple span{
   padding:0px 5px !important;
}
.fixselectmultiple button.select2-selection__choice__remove {
    padding: 0px !important;
}

</style>
<?php if($_GET['token']=="2"){ ?>
<style>
   .navigation .card-header h3.card-title {
      color: #0d6efd !important;
   }
   .navigation .btn.btn-default {
      background: #0d6efd;
   }
   .navigation input.btn.btn-success.save {
      background: #0d6efd;
      border-color: #0d6efd;
   }
   .navigation ul.inbuiltwc li.text-center.ftitle {
      background: #8fbcff !important;
   }
   .navigation ul.inbuiltwc [type=checkbox]:checked, .navigation .custom-radio[type="radio"]:checked::before {
      accent-color: #0d6efd;
      background-color: #0d6efd;
      background-color: #0d6efd;
   }
   .steps ul li:hover span, .steps ul li.active span {
    background: #0d6efd;
    color: #fff;
   }
   .steps ul li:hover, .steps ul li.active {
    color: #0d6efd;
   }
   .steps ul li:hover::after, .steps ul li.active::after {
      background: #0d6efd;
   }
   .steps ul li {
    color: #0d6efd;
   }
   .steps ul li span {
    background: #8fbcff;
    color: #0d6efd;
   }
   .navigation .profilePicture {
    background-color: #0d6efd;
   }
   body.navigation aside a{
    color: #0d6efd !important;
   }
   aside li svg path {
    fill: #0d6efd !important;
    stroke:#0d6efd !important;
   }
</style>
<?php } ?>

<!-- form start -->

<div class="popupActivityStatus hidden">
   <h3>Patient Type Change (Activity Status)</h3>
   <i id="patientTypeClose" class="fa fa-close"></i>
   <table class="table table-bordered">
      <thead>
         <tr>
            <th>Updated By</th>
            <th>Status</th>
            <th>Updated At</th>
         </tr>
      </thead>
      <tbody>
      <?php foreach($typeStatus as $types){ ?>
      <tr>
         <td><?=getuserName($pdo,$types['empId']);?></td>
         <td><?=getPatientType($types['statusValue']);?></td>
         <td><?=$types['createdAt'];?></td>
      </tr>
      <?php } ?>
      </tbody>
      </table>
</div>
<div class="popupWelcomeCallActivityStatus hidden">
   <h3>Welcome Call Status Change (Activity Status)</h3>
   <i id="welcomeTypeClose" class="fa fa-close"></i>
   <table class="table table-bordered">
      <thead>
         <tr>
            <th>Updated By</th>
            <th>Status</th>
            <th>Updated At</th>
         </tr>
      </thead>
      <tbody>
      <?php foreach($welcometypeStatus as $types){ ?>
      <tr>
         <td><?=getuserName($pdo,$types['empId']);?></td>
         <td><?=getWelcomeCallStatus($types['statusValue']);?></td>
         <td><?=$types['createdAt'];?></td>
      </tr>
      <?php } ?>
      </tbody>
      </table>


</div>

<!-- Main Content -->
<div class="main-content">
   <div class="form-container">
      <div class="page-header">
         <div>
            <h1 class="page-title">Edit Patient Details</h1>
            <p class="page-subtitle">Update patient enrollment information</p>
         </div>
         <div style="display: flex; gap: 12px;">
            <a href="patient_form_download.php?id=<?= $_GET['id']; ?>&fileId=<?= $_GET['fileId']; ?>"
               target="_blank" class="btn btn-secondary">
               <i class="fas fa-download"></i> Download
            </a>
            <?php
            $url = "index.php";
            if (isset($_GET['token'])) {
               $url = "../";
            }
            ?>
            <a href="<?= $url; ?>" class="btn btn-secondary">
               <i class="fas fa-arrow-left"></i> Back
            </a>
         </div>
      </div>

      <div class="form-card">
         <div class="form-wizard">
                        <div class="steps" id="shift">
                           <ul>
                              <li>
                                 <span>1</span>
                                 Patient Info
                              </li>
                              <li>
                                 <span>2</span>
                                 Welcome Call
                              </li>
                              <li>
                                 <span>3</span>
                                 Reimbursement
                              </li>
                              <li>
                                 <span>4</span>
                                 Review
                              </li>
                           </ul>
                        </div>

                        <div class="editmycontainer myContainer">

                           <div class="form-container animated">
                           <div class="formnote2 text-left"><span class="colorred">*</span> Mandatory Fields</div>
                              <h3 class="text-center ftitle">Create Account</h3>
                              <form method="POST" class="araddpatient editWc " enctype="multipart/form-data">
                                 <div class="row">

                                    <div class="col-sm-6">
                                       <div class="form-group">
                                          <label for="drugName">First Name</label>
                                          <input type="text" class="form-control" id='patientFName' required
                                             name="patientFName" value="<?php if (isset($patientDetails['firstName'])) {
                                                echo $patientDetails['firstName'];
                                             } ?>" placeholder="Enter Patient First Name">
                                       </div>
                                    </div>
                                    <div class="col-sm-6">
                                       <div class="form-group">
                                          <label for="drugName">Last Name</label>
                                          <input type="text" class="form-control" id='patientLName' value="<?php if (isset($patientDetails['lastName'])) {
                                             echo $patientDetails['lastName'];
                                          } ?>" name="patientLName" placeholder="Enter Patient Last Name">
                                       </div>
                                    </div>
                                    <div class="col-sm-6">
                                       <div class="form-group">
                                          <label for="drugName">DOB</label>
                                          <input type="date" class="form-control" id='dob' required value="<?php if (isset($patientDetails['dob'])) {
                                             echo $patientDetails['dob'];
                                          } ?>" name="dob" placeholder="Enter Patient DOB">
                                       </div>
                                    </div>
                                    <div class="col-sm-6">
                                       <div class="form-group">
                                          <label for="gender">Gender</label>
                                          <select class="form-control" id="gender" name="gender" required>
                                             <option value="">Select Gender</option>
                                             <option value="F" <?php if (isset($patientDetails['gender'])) {
                                                echo ($patientDetails['gender'] == 'F') ? 'selected' : '';
                                             } ?>>Female</option>
                                             <option value="M" <?php if (isset($patientDetails['gender'])) {
                                                echo ($patientDetails['gender'] == 'M') ? 'selected' : '';
                                             } ?>>Male</option>
                                             <option value="O" <?php if (isset($patientDetails['gender'])) {
                                                echo ($patientDetails['gender'] == 'O') ? 'selected' : '';
                                             } ?>>Other</option>
                                          </select>
                                       </div>
                                    </div>
                                    <div class="col-sm-6">
                                       <div class="form-group">
                                          <label>Mobile Number</label>
                                          <div class="input-group">
                                             <div class="input-group-prepend">
                                                <span class="input-group-text"><i class="fas fa-phone"></i></span>
                                             </div>
                                             <input type="text" class="form-control" value="<?php if (isset($patientDetails['phone'])) {
                                                echo $patientDetails['phone'];
                                             } ?>" name="phone" id="phone"
                                                data-inputmask="&quot;mask&quot;: &quot;(999) 999-9999&quot;"
                                                data-mask="" inputmode="text">
                                             <div class="invalid-feedback">Please enter phone number</div>
                                          </div>
                                          <!-- /.input group -->
                                       </div>
                                    </div>
                                    <div class="col-sm-6">
                                       <div class="form-group">
                                          <label for="drugName">Email</label>
                                          <input type="email" class="form-control" id='email' value="<?php if (isset($patientDetails['email'])) {
                                             echo $patientDetails['email'];
                                          } ?>" required name="email" placeholder="Enter Patient Email">
                                       </div>
                                    </div>
                                    <div class="clearfix"></div>
                                    <div class="col-sm-6">
                                       <div class="form-group">
                                          <label for="drugName">Address 1</label>
                                          <input type="text" class="form-control" id='address1' value="<?php if (isset($patientDetails['address1'])) {
                                             echo $patientDetails['address1'];
                                          } ?>" required name="address1" placeholder="Enter Address">
                                       </div>
                                    </div>
                                    <div class="col-sm-6">
                                       <div class="form-group">
                                          <label for="drugName">Address 2</label>
                                          <input type="text" class="form-control" id='address2' value="<?php if (isset($patientDetails['address2'])) {
                                             echo $patientDetails['address2'];
                                          } ?>" name="address2" placeholder="Enter Address">
                                       </div>
                                    </div>
                                    <div class="col-sm-6">
                                       <div class="form-group">
                                          <label for="drugName">City</label>
                                          <input type="text" class="form-control" id='city' value="<?php if (isset($patientDetails['city'])) {
                                             echo $patientDetails['city'];
                                          } ?>" required name="city" placeholder="Enter City">
                                       </div>
                                    </div>
                                    <div class="col-sm-6 fixselect">
                                       <div class="form-group">
                                          <label for="drugName">Province</label>
                                          <input type="text" class="form-control" id='province' value="<?php if (isset($patientDetails['province'])) {
                                             echo $patientDetails['province'];
                                          } ?>" required name="province" placeholder="Enter Province">
                                       </div>
                                    </div>
                                    <div class="col-sm-6">
                                       <div class="form-group">
                                          <label for="drugName">Postal Code</label>
                                          <input type="text" class="form-control" id='postalCode' value="<?php if (isset($patientDetails['postalCode'])) {
                                             echo $patientDetails['postalCode'];
                                          } ?>" required name="postalCode" placeholder="Enter Postal Code">
                                       </div>
                                    </div>
                                    <div class="col-sm-6">
                                       <div class="form-group">
                                          <label for="krollId">Kroll ID <span class="req">*</span></label>
                                          <input type="text" class="form-control" id='krollId' required name="krollId"
                                             value="<?php if (isset($patientDetails['krollId'])) {
                                                echo $patientDetails['krollId'];
                                             } ?>" placeholder="Enter Kroll Id">
                                       </div>
                                    </div>
                                    <div class="clearfix"></div>
                                    <!-- <div class="col-sm-6 fixselect">
                                       <div class="form-group">
                                          <label for="medicationId">Medication</label>
                                          <select class="form-control select2bs4" name='medicationId' required
                                             id="medicationId">
                                             <option>Select Medication</option>
                                             <?php foreach ($medications as $medication) { ?>
                                                <option value="<?php echo $medication['id']; ?>" <?php if (isset($patientDetails['medicationId'])) {
                                                      echo ($medication['id'] == $patientDetails['medicationId']) ? 'selected' : '';
                                                   } ?>><?php echo $medication['drugName']; ?></option>
                                             <?php } ?>
                                          </select>
                                       </div>
                                    </div> -->
                                    <!-- <div class="col-sm-6">
                                       <div class="form-group">
                                          <label for="paymentId">PSP</label>
                                          <select class="form-control" name='pspId' required id="pspId">
                                             <option>Select PSP</option>
                                             <?php foreach ($psps as $psp) { ?>
                                                <option value="<?php echo $psp['id']; ?>" <?php if (isset($patientDetails['pspId'])) {
                                                      echo ($psp['id'] == $patientDetails['pspId']) ? 'selected' : '';
                                                   } ?>>
                                                   <?php echo $psp['pspName']; ?>
                                                </option>
                                             <?php } ?>
                                          </select>
                                          <div id='pspDiv'></div>
                                       </div>
                                    </div> -->
                                 </div>
                                 <div class="row" id="fileInputs">
                                    <?php foreach ($generaldocs as $ge) { ?>
                                       <div class="col-md-5">
                                          <div class="form-group fileRow">
                                             <label for="paymentId">File Name (Title)</label>
                                             <select disabled name="fileTitle[]" class="form-control">
                                                <option disabled>Select File Name</option>
                                                <option value="SA & PA" <?= ($ge['title'] == "SA & PA") ? 'selected' : ''; ?>>
                                                   SA & PA [special authorization & prior authorization (signed by MD or
                                                   not)]</option>
                                                <option value="LU code" <?= ($ge['title'] == "LU code") ? 'selected' : ''; ?>>
                                                   LU code</option>
                                                <option value="Medical clearance" <?= ($ge['title'] == "Medical clearance") ? 'selected' : ''; ?>>Medical clearance</option>
                                                <option value="TB test results" <?= ($ge['title'] == "TB test results") ? 'selected' : ''; ?>>TB test results</option>
                                                <option value="Lab requisitions" <?= ($ge['title'] == "Lab requisitions") ? 'selected' : ''; ?>>Lab requisitions</option>
                                                <option
                                                   value="EAP requests, approvals, denials, & requests for additional information"
                                                   <?= ($ge['title'] == "EAP requests, approvals, denials, & requests for additional information") ? 'selected' : ''; ?>>EAP requests, approvals,
                                                   denials, & requests for additional information</option>
                                                <option value="Consult/clinical notes" <?= ($ge['title'] == "Consult/clinical notes") ? 'selected' : ''; ?>>Consult/clinical notes</option>
                                                <option value="PSP packages" <?= ($ge['title'] == "PSP packages") ? 'selected' : ''; ?>>PSP packages</option>
                                                <option value="PSP requesting copy of current rx" <?= ($ge['title'] == "PSP requesting copy of current rx") ? 'selected' : ''; ?>>PSP requesting
                                                   copy of current rx</option>
                                                <option value="Compass packages" <?= ($ge['title'] == "Compass packages") ? 'selected' : ''; ?>>Compass packages</option>
                                                <option value="MD note" <?= ($ge['title'] == "MD note") ? 'selected' : ''; ?>>
                                                   MD note</option>
                                                <option value="PSP note" <?= ($ge['title'] == "PSP note") ? 'selected' : ''; ?>>PSP note</option>
                                                <option value="TDM requisition" <?= ($ge['title'] == "TDM requisition") ? 'selected' : ''; ?>>TDM requisition</option>
                                             </select>
                                          </div>
                                       </div>
                                       <div class="col-md-4">
                                          <div class="fileRow form-group">
                                             <label for="paymentId">File Attachment</label>
                                             <input type="text" disabled name="files[]" readonly
                                                value="<?= $ge['filename']; ?>" class="form-control fileInput">
                                          </div>
                                       </div>
                                       <div class="right flex">
                                          <a class="btn btn-success"
                                             href="uploads/<?= $patientDetails['province']; ?><?= $patientDetails['krollId']; ?>/<?= $ge['filename']; ?>"
                                             download><i title="Download Attachment" class="fa fa-download"></i></a>
                                          <a class="btn btn-info text-white"
                                             href="uploads/<?= $patientDetails['province']; ?><?= $patientDetails['krollId']; ?>/<?= $ge['filename']; ?>"
                                             target="_blank"><i title="View Attachment" class="fa fa-eye"></i></a>
                                          <button type="button" data-id="<?= $ge['id']; ?>"
                                             class="btn btn-danger deleteDocument" id="delete"><i title="Delete Attachment"
                                                class="fa fa-trash"></i></button>
                                       </div>
                                    <?php } ?>
                                    <div class="col-md-5">
                                       <div class="form-group fileRow">
                                          <label for="paymentId">New File Name (Title)</label>
                                          <select name="fileTitle[]" class="form-control">
                                             <option disabled selected>Select File Name</option>
                                             <option>SA & PA [special authorization & prior authorization (signed by MD
                                                or not)]</option>
                                             <option>LU code</option>
                                             <option>Medical clearance</option>
                                             <option>TB test results</option>
                                             <option>Lab requisitions</option>
                                             <option>EAP requests, approvals, denials, & requests for additional
                                                information</option>
                                             <option>Consult/clinical notes</option>
                                             <option>PSP packages</option>
                                             <option>PSP requesting copy of current rx</option>
                                             <option>Compass packages</option>
                                             <option>MD note</option>
                                             <option>PSP note</option>
                                             <option>TDM requisition</option>
                                          </select>
                                       </div>
                                    </div>
                                    <div class="col-md-4">
                                       <div class="fileRow form-group">
                                          <label for="paymentId">New File Attachment</label>
                                          <input type="file" name="files[]" class="form-control fileInput">
                                       </div>
                                    </div>
                                    <div class="right flex">
                                       <button type="button" class="btn btn-default" id="addRowBtn"><i
                                             title="Add New Attachment" class="fa fa-plus"></i></button>
                                    </div>
                                 </div>
                                 <div class="form-group col-md-12">
                                    <label for="switch">Notes</label>
                                    <textarea class="form-control" name="notes" id="notes" rows="2"><?php if (isset($patientDetails['notes'])) {
                                       echo $patientDetails['notes'];
                                    } ?></textarea>
                                 </div>
                                 <ul class="inbuiltwc row">
                                 <li class="text-center ftitle accordion">
                                       <h3>Prescription Drug Information</h3>
                                    </li>


                                    <li class="col-md-4">
                                       <label class="description" for="patientDrugName">Drug Name: </label>
                                       <div>
                                          <select  class="form-control form-control" id="patientDrugName"
                                             name="patientDrugName">
                                             <option value="">Select Drug</option>
                                             <?php foreach ($medications as $medication) { ?>
                                                <option value="<?php echo $medication['drugName']; ?>" <?php echo ($medication['drugName'] == $patientDetails['patientDrugName']) ? 'selected' : ''; ?>><?php echo $medication['drugName']; ?></option>
                                             <?php } ?>
                                          </select>
                                       </div>
                                    </li>

                                    <li class="col-md-4">
                                       <label class="description" for="dose">Dose: </label>
                                       <div>
                                          <input id="dose"  name="dose" class="form-control" type="text"
                                             value="<?php echo $patientDetails['dosage']; ?>" autocomplete="off">
                                       </div>
                                    </li>
                                    <li class="clearfix"></li>
                                    <li class="col-md-4">
                                       <label class="description" for="roa">Route of Administration: </label>
                                       <div>
                                          <select  class="form-control" id="roa" name="roa">
                                             <option value=""></option>
                                             <option value="Subcutaneous" <?php echo ("Subcutaneous" == $patientDetails['routeOfAdmin']) ? 'selected' : ''; ?>>
                                                Subcutaneous</option>
                                             <option value="Intramuscular" <?php echo ("Intramuscular" == $patientDetails['routeOfAdmin']) ? 'selected' : ''; ?>>Intramuscular</option>
                                             <option value="Intravenous" <?php echo ("Intravenous" == $patientDetails['routeOfAdmin']) ? 'selected' : ''; ?>>
                                                Intravenous</option>
                                             <option value="Oral" <?php echo ("Oral" == $patientDetails['routeOfAdmin']) ? 'selected' : ''; ?>>Oral</option>
                                          </select>
                                       </div>
                                    </li>


                                    <li class="clearfix"></li>

                                    <li class="col-md-6">
                                       <label class="description" for="prescriberName">Prescriber's Name : </label>
                                       <div>
                                          <input  id="prescriberName" name="prescriberName" class="form-control"
                                             type="text" value="<?php echo $patientDetails['prescriberName']; ?>"
                                             autocomplete="off">
                                       </div>
                                    </li>

                                    <li class="col-md-6">
                                       <label class="description" for="prescriberSpecialty">Prescriber's Specialty:
                                       </label>
                                       <div>
                                          <input  id="prescriberSpecialty" name="prescriberSpecialty"
                                             class="form-control" type="text"
                                             value="<?php echo $patientDetails['prescriberSpecialty']; ?>"
                                             autocomplete="off">
                                       </div>
                                    </li>

                                    <li class="col-md-6">
                                       <label class="description" for="team">Team: </label>
                                       <div>
                                          <input  id="team" name="team" class="form-control" type="text"
                                             value="<?php echo $patientDetails['team']; ?>" autocomplete="off">
                                       </div>
                                    </li>

                                    <li class="col-md-6">
                                       <label class="description" for="staff">Staff: </label>
                                       <div>
                                          <input  id="staff" name="staff" class="form-control" type="text"
                                             value="<?php echo $patientDetails['staff']; ?>" autocomplete="off">
                                       </div>
                                    </li>

                                    <li>
                                       <span class="description">Did Patient get Sample Dose from Prescribers office?
                                       </span>
                                       <div>
                                          <fieldset>

                                             <span class="flex">
                                                <input  type="radio" id="yesDpgsd" <?php echo ("Y" == $patientDetails['presciberOffice']) ? 'checked' : ''; ?>
                                                   name="Dpgsd" value="Y" class="custom-radio">
                                                <label for="yesDpgsd" class="radio-label">Yes</label>
                                             </span>

                                             <span class="flex">
                                                <input  type="radio" id="noDpgsd" <?php echo ("N" == $patientDetails['presciberOffice']) ? 'checked' : ''; ?>
                                                   name="Dpgsd" value="N" class="custom-radio">
                                                <label for="noDpgsd" class="radio-label">No</label>
                                             </span>
                                          </fieldset>
                                       </div>
                                    </li>

                                    <li class="sampleDosePrescriber col-md-4">
                                       <fieldset>
                                          <label class="smpDate">Date Patient Received Sample Dose: </label>
                                          <div>
                                             <input  type="date" class="form-control" id="smpDate"
                                                value="<?php echo $patientDetails['sampleDoseReceived']; ?>"
                                                name="smpDate">
                                          </div>
                                       </fieldset>
                                    </li>

                                 </ul>
                                 <div class="form-group text-right mar-b-0">
                                    <input type="button" value="NEXT" class="btn btn-primary next">
                                    <input type="submit" value="SAVE & NEXT" name="savepatientdetials" class="btn btn-primary">
                                    <button type="submit" value="SAVE" name="savepatientdetials"
                                       class="btn btn-success save"> Save </button>
                                 </div>
                              </form>
                           </div>


                           <div class="form-container animated">
                              <!--<h2 class="text-center form-title">Welcome Call</h2> -->
                              <!-- FORM SECTION -->
                              <div class="row">
                              <div class="formnote2 text-left"><span class="colorred">*</span> Mandatory Fields</div>
                                 <form method="POST" class="araddpatient editWc " enctype="multipart/form-data">
                                    <!--NEW WELCOME CALL -->
                                    <ul class="inbuiltwc row">
                                       <li class="text-center ftitle accordion">
                                          <h3>Pre-Treatment Phase</h3>
                                       </li>
                                       <li>
                                          <p> Welcome Call, Counseling....</p>
                                       </li>
                                       <li class="col-md-4">
                                          <label class="description" for="entryDate">Entry Date: </label>
                                          <div>
                                             <input type="date" class="form-control" id="entryDate" name="entryDate"
                                                value="<?= date('Y-m-d', strtotime($patientDetails['createdDate'])); ?>"
                                                readonly>
                                          </div>
                                       </li>

                                       <li class="clearfix"></li>

                                       <li class="col-md-4">
                                          <label class="description" for="pfn">Patient First Name: </label>
                                          <div>
                                             <input id="pfn" name="pfn" readonly="readonly" class="form-control"
                                                type="text" value="<?= $patientDetails['firstName']; ?>"
                                                autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-4">
                                          <label class="description" for="pmn">Patient Middle Name: </label>
                                          <div>
                                             <input id="pmn" name="pmn" readonly="readonly" class="form-control"
                                                type="text" value="<?= $patientDetails['middleName']; ?>"
                                                autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-4">
                                          <label class="description" for="pln">Patient Last Name: </label>
                                          <div>
                                             <input id="pln" name="pln" readonly="readonly" class="form-control"
                                                type="text" value="<?= $patientDetails['lastName']; ?>"
                                                autocomplete="off">
                                          </div>
                                       </li>


                                       <li class="col-md-4">
                                          <label class="description" for="kpi">Kroll Patient ID: </label>
                                          <div>
                                             <input id="kpi" name="kpi" readonly="readonly" class="form-control"
                                                type="text" value="<?= $patientDetails['krollId']; ?>"
                                                autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-4">
                                          <label class="description" for="pdob">Patient DOB: </label>
                                          <div>
                                             <input type="date" class="form-control" id="pdob" name="pdob"
                                                value="<?= $patientDetails['dob']; ?>" readonly>
                                          </div>
                                       </li>

                                       <li class="col-md-4">
                                          <label class="description" for="yob">Year of Birth </label>
                                          <div>
                                             <input id="yob" name="yob" class="form-control" type="text"
                                                value="<?= date('Y', strtotime($patientDetails['dob'])); ?>" readonly
                                                autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="clearfix"></li>

                                       <li class="col-md-4">
                                          <label class="description" for="pgender">Gender: </label>
                                          <div>
                                             <select class="form-control" readonly id="pgender" name="pgender">
                                                <option value="">Select Gender</option>
                                                <option value="F" <?php echo ($patientDetails['gender'] == 'F') ? 'selected' : 'disabled'; ?>>Female</option>
                                                <option value="M" <?php echo ($patientDetails['gender'] == 'M') ? 'selected' : 'disabled'; ?>>Male</option>
                                                <option value="O" <?php echo ($patientDetails['gender'] == 'O') ? 'selected' : 'disabled'; ?>>Other</option>
                                             </select>
                                          </div>
                                       </li>
                                       <!-- WC PART 1 -->
                                       <?php
                                       $firstAttemptContact = 'hidden';
                                       $secondAttemptContact = 'hidden';
                                       $thirdAttemptContact = 'hidden';
                                       $welcomeCallCompletionDate = 'hidden';
                                       $welcomeCallCompleteBy = 'hidden';
                                       if ($patientDetails['wcStatus'] == 2) {
                                          $firstAttemptContact = '';
                                       }
                                       if ($patientDetails['wcStatus'] == 3) {
                                          $firstAttemptContact = '';
                                          $secondAttemptContact = '';
                                       }
                                       if ($patientDetails['wcStatus'] == 4 || $patientDetails['wcStatus'] == 6) {
                                          $firstAttemptContact = '';
                                          $secondAttemptContact = '';
                                          $thirdAttemptContact = '';
                                       }
                                       if ($patientDetails['wcStatus'] == 5) {
                                          $welcomeCallCompletionDate = '';
                                          $welcomeCallCompleteBy = '';
                                       }
                                       ?>
                                       <li class="text-center ftitle accordion">
                                          <h3>
                                             Welcome Call
                                          </h3>
                                       </li>

                                       <li class="col-md-4">
                                          <label class="description" for="wcStatus">Welcome Call Status:  <a id="getWelcomeActivityInfo">(Activity Status)</a></label>
                                          <div>
                                             <select class="form-control" id="wcStatus" name="wcStatus">
                                                <option value="1" <?= ($patientDetails['wcStatus'] == 1) ? 'selected' : '' ?>>New - Patient Not Yet Contacted</option>
                                                <option value="2" <?= ($patientDetails['wcStatus'] == 2) ? 'selected' : '' ?>>Pending - 1st Patient Contact Attempted</option>
                                                <option value="3" <?= ($patientDetails['wcStatus'] == 3) ? 'selected' : '' ?>>Pending - 2nd Patient Contact Attempted</option>
                                                <option value="4" <?= ($patientDetails['wcStatus'] == 4) ? 'selected' : '' ?>>Pending - 3rd Patient Contact Attempted</option>
                                                <option value="5" <?= ($patientDetails['wcStatus'] == 5) ? 'selected' : '' ?>>Complete - Contact Complete</option>
                                                <option value="6" <?= ($patientDetails['wcStatus'] == 6) ? 'selected' : '' ?>>Incomplete - Enrollment Discontinued - Patient Cannot be reached
                                                </option>
                                                <option value="7" <?= ($patientDetails['wcStatus'] == 7) ? 'selected' : '' ?>>Clarification: Waiting for information from prescriber</option>
                                                <option value="8" <?= ($patientDetails['wcStatus'] == 8) ? 'selected' : '' ?>>PPN: No welcome call required</option>
                                                <option value="9" <?= ($patientDetails['wcStatus'] == 9) ? 'selected' : '' ?>>Other pharmacy: No welcome call required</option>
                                                <option value="10" <?= ($patientDetails['wcStatus'] == 10) ? 'selected' : '' ?>>Patient not getting medication - closed</option>
                                                <option value="11" <?= ($patientDetails['wcStatus'] == 11) ? 'selected' : '' ?>>Entered in error - disregard</option>
                                                <option value="12" <?= ($patientDetails['wcStatus'] == 12) ? 'selected' : '' ?>>Pending patient update - patient contacted waiting for info
                                                </option>
                                             </select>
                                            
                                          </div>
                                       </li>

                                       <li class="col-md-4">
                                          <label class="description" for="wcsdd">Welcome Call Status Due Date: </label>
                                          <div>
                                             <input type="date" class="form-control" id="wcsdd" name="wcsdd"
                                                value="<?= $patientDetails['wcStatusDueDate']; ?>"
                                                placeholder="Enter Welcome Call Status Due Date">
                                          </div>
                                       </li>
                                       <li class="clearfix">
                                       <li class="firstAttemptContact <?= $firstAttemptContact; ?> col-md-4">
                                          <fieldset>
                                             <label class="description" for="firstAttemptDatetime">1st Contact Attempt
                                                Date and Time: </label>
                                             <div>
                                                <input type="datetime-local" class="form-control"
                                                   id="firstAttemptDatetime"
                                                   value="<?= $patientDetails['wcFirstAttempt']; ?>"
                                                   name="firstAttemptDatetime">
                                             </div>
                                          </fieldset>
                                       </li>
                                       <li class="secondAttemptContact <?= $secondAttemptContact; ?> col-md-4">
                                          <fieldset>
                                             <label class="description" for="secondAttemptDatetime">2nd Contact Attempt
                                                Date and Time: </label>
                                             <div>
                                                <input type="datetime-local" class="form-control"
                                                   id="secondAttemptDatetime"
                                                   value="<?= $patientDetails['wcSecondAttempt']; ?>"
                                                   name="secondAttemptDatetime">
                                             </div>
                                          </fieldset>
                                       </li>
                                       <li class="thirdAttemptContact <?= $thirdAttemptContact; ?> col-md-4">
                                          <fieldset>
                                             <label class="description" for="thirdAttemptDatetime">3rd Contact Attempt
                                                Date and Time: </label>
                                             <div>
                                                <input type="datetime-local" class="form-control"
                                                   id="thirdAttemptDatetime"
                                                   value="<?= $patientDetails['wcThirdAttempt']; ?>"
                                                   name="thirdAttemptDatetime">
                                             </div>
                                          </fieldset>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li
                                          class="welcomeCallCompletionDate <?= $welcomeCallCompletionDate; ?> col-md-4">
                                          <fieldset>
                                             <label class="description" for="welcomeCallCompletionDate">Welcome Call
                                                Completion Date: </label>
                                             <div>
                                                <input type="date" class="form-control" id="welcomeCallCompletionDate"
                                                   value="<?= $patientDetails['wcCompletionDate']; ?>"
                                                   name="welcomeCallCompletionDate" min="<?php echo date('Y-m-d'); ?>">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li>
                                          <label class="description" for="wcn">Welcome Call Notes: </label>
                                          <div>
                                             <textarea id="wcn" name="wcn" class="form-control" rows="8"
                                                cols="90"><?= $patientDetails['wcNotes']; ?></textarea>
                                          </div>
                                       </li>

                                       <li class="col-md-4 welcomeCallCompleteBy <?= $welcomeCallCompleteBy; ?>">
                                          <label class="description" for="wccb">Welcome Call Completed By: </label>
                                          <div class="fixselect">
                                             <select class="form-control select2bs4" id="wccb" name="wccb">
                                                <option value="" <?= ($patientDetails['wcCompletedBy'] == "") ? 'selected' : '' ?>></option>
                                                <?php foreach ($employees as $emp) { ?>

                                                   <option value="<?= $emp['empId']; ?>"
                                                      <?= ($patientDetails['wcCompletedBy'] == $emp['empId']) ? 'selected' : '' ?>><?= $emp['userName']; ?></option>

                                                <?php } ?>
                                             </select>
                                          </div>
                                       </li>
                                       <!-- WC END PART 1 -->
                                       <!-- WC PART 2 -->
                                       <li class="text-center ftitle accordion">
                                          <h3>
                                             Patient Demographic Information:
                                          </h3>
                                       </li>

                                       <li>
                                          <label class="description" for="phcn">Provincial Health Card Number: </label>
                                          <div>
                                             <input id="phcn" name="phcn" class="form-control" type="text"
                                                value="<?= $patientDetails['provincialHCN']; ?>" autocomplete="off">
                                          </div>
                                       </li>


                                       <li>
                                          <label class="description" for="psa">Patient Street Address: </label>
                                          <div>
                                             <input id="psa" name="psa" class="form-control" type="text"
                                                value="<?= $patientDetails['address1']; ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li>
                                          <label class="description" for="al2">Address Line 2: </label>
                                          <div>
                                             <input id="al2" name="al2" class="form-control" type="text"
                                                value="<?= $patientDetails['address2']; ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-6">
                                          <label class="description" for="pcity">City: </label>
                                          <div>
                                             <input id="pcity" name="pcity" class="form-control" type="text"
                                                value="<?= $patientDetails['city']; ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-6">
                                          <label class="description" for="pprovince">Province: </label>
                                          <div>
                                             <input id="pprovince" name="pprovince" class="form-control" type="text"
                                                value="<?= $patientDetails['province']; ?>" autocomplete="off">
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-6">
                                          <label class="description" for="ppostal">Postal: </label>
                                          <div>
                                             <input id="ppostal" name="ppostal" class="form-control" type="text"
                                                value="<?= $patientDetails['postalCode']; ?>" autocomplete="off">
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-6">
                                          <fieldset>
                                             <div class="form-group">
                                                <label for="pphone">Patient Phone Number:</label>
                                                <div class="input-group">
                                                   <div class="input-group-prepend">
                                                      <span class="input-group-text"><i class="fas fa-phone"></i></span>
                                                   </div>
                                                   <input type="text" class="form-control" value="<?php if (isset($patientDetails['phone'])) {
                                                      echo $patientDetails['phone'];
                                                   } ?>" name="pphone" id="phone"
                                                      data-inputmask="&quot;mask&quot;: &quot;(999) 999-9999&quot;"
                                                      data-mask="" value="<?= $patientDetails['phone']; ?>"
                                                      inputmode="text">
                                                   <div class="invalid-feedback">Please enter phone number</div>
                                                </div>
                                                <!-- /.input group -->
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="clearfix"></li>
                                       <li class="col-md-6">
                                          <label class="description" for="element_7">Patient Email: </label>
                                          <div>
                                             <input id="element_7" name="element_7" class="form-control large"
                                                type="text" maxlength="255" value="<?= $patientDetails['email']; ?>"
                                                autocomplete="off">
                                          </div>
                                       </li>

                                       <?php
                                       $secondary = 'hidden';
                                       $ck = '';
                                       if ($patientDetails['sFirstName'] && $patientDetails['sRelationship']) {
                                          $secondary = '';
                                          $ck = 'checked';
                                       }

                                       ?>

                                       <li class="">
                                          <div>
                                             <fieldset>
                                                <span><input id="asc" name="asc" <?= $ck; ?> class="form-checkbox"
                                                      type="checkbox" value="1" autocomplete="off">
                                                   <label class="choice" for="asc">Add Secondary Contact</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>

                                       <li class="<?= $secondary; ?> secondaryContact">
                                          <fieldset class="row">
                                             <label class="description">Name of Secondary Contact: </label>
                                             <div class="col-md-4">
                                                <input id="noscf" name="noscf" type="text" class="form-control"
                                                   maxlength="255" size="8"
                                                   value="<?= $patientDetails['sFirstName']; ?>" autocomplete="off">
                                                <label for="noscf">First</label>
                                             </div>

                                             <div class="col-md-4">
                                                <input id="noscl" name="noscl" type="text" class="form-control"
                                                   maxlength="255" size="14"
                                                   value="<?= $patientDetails['sLastName']; ?>" autocomplete="off">
                                                <label for="noscl">Last</label>
                                             </div>
                                             </span>
                                          </fieldset>
                                       </li>

                                       <li class="<?= $secondary; ?> secondaryContact col-md-4">
                                          <fieldset>

                                             <label class="description" for="scpn">Secondary Contact Phone Number:
                                             </label>
                                             <div class="input-group">
                                                <div class="input-group-prepend">
                                                   <span class="input-group-text"><i class="fas fa-phone"></i></span>
                                                </div>
                                                <input type="text" class="form-control" name="scpn" id="scpn"
                                                   value="<?= $patientDetails['sPhone']; ?>"
                                                   data-inputmask="&quot;mask&quot;: &quot;(999) 999-9999&quot;"
                                                   data-mask="" inputmode="text">
                                                <div class="invalid-feedback">Please enter phone number</div>
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="<?= $secondary; ?> secondaryContact col-md-4">
                                          <label class="description" for="sce">Secondary Contact Email: </label>
                                          <div>
                                             <input id="sce" name="sce" class="form-control" type="text" maxlength="255"
                                                value="<?= $patientDetails['sEmail']; ?>" autocomplete="off">
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="<?= $secondary; ?> secondaryContact col-md-4">
                                          <label class="description" for="rtp">Relationship to Patient: </label>
                                          <div>
                                             <input id="rtp" name="rtp" placeholderforcheck="" class="form-control"
                                                type="text" value="<?= $patientDetails['sRelationship']; ?>"
                                                autocomplete="off">
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-4">
                                          <label class="description" for="preferences">Preferences: </label>
                                          <div>
                                             <input id="preferences" name="preferences" class="form-control" type="text"
                                                value="<?= $patientDetails['prefrences']; ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="text-center ftitle accordion">
                                          <h3>Medication &amp; Medical History Information</h3>
                                       </li>

                                       <li>
                                          <label class="description" for="ma">Medication Allergies: </label>
                                          <div>
                                             <textarea id="ma" name="ma" placeholderforcheck="" class="form-control"
                                                rows="8"
                                                cols="90"><?= $patientDetails['medicationAllergies']; ?></textarea>
                                          </div>
                                       </li>

                                       <li class="col-md-4">
                                          <label class="description" for="la">Latex Allergies: </label>
                                          <div>
                                             <select class="form-control" id="la" name="la">
                                                <option value="" selected="selected"></option>
                                                <option value="Y" <?php echo ("Y" == $patientDetails['latexAllergies']) ? 'selected' : ''; ?>>Yes</option>
                                                <option value="N" <?php echo ("N" == $patientDetails['latexAllergies']) ? 'selected' : ''; ?>>No</option>
                                             </select>
                                             <!-- <textarea id="la" name="la" class="form-control" rows="8" cols="90"><?= $patientDetails['latexAllergies']; ?></textarea> -->
                                          </div>
                                       </li>

                                       <li class="col-md-12">
                                          <label class="description">Medical Conditions </label>
                                          <div>
                                             <fieldset class="row">
                                                <div class="col-md-3">
                                                   <span class="webkitbox"><input id="bloodClots" name="mc[]" <?php if (in_array("Blood Clots", explode(",", $patientDetails['medicalConditions']))) {
                                                      echo "checked";
                                                   } ?>
                                                         class="form-checkbox" type="checkbox" value="Blood Clots"
                                                         autocomplete="off">
                                                      <label for="bloodClots">Blood Clots</label>
                                                   </span>
                                                   <span class="webkitbox"><input id="breastfeeding" name="mc[]" <?php if (in_array("Breast Feeding", explode(",", $patientDetails['medicalConditions']))) {
                                                      echo "checked";
                                                   } ?>
                                                         class="form-checkbox" type="checkbox" value="Breast Feeding"
                                                         autocomplete="off">
                                                      <label class="choice" for="breastfeeding">Breast Feeding</label>
                                                   </span>
                                                   <span class="webkitbox"><input id="cancer" name="mc[]" <?php if (in_array("Cancer", explode(",", $patientDetails['medicalConditions']))) {
                                                      echo "checked";
                                                   } ?>
                                                         class="form-checkbox" type="checkbox" value="Cancer"
                                                         autocomplete="off">
                                                      <label class="choice" for="cancer">Cancer</label>
                                                   </span>
                                                   <span class="webkitbox"><input id="diabetes" name="mc[]" <?php if (in_array("Diabetes", explode(",", $patientDetails['medicalConditions']))) {
                                                      echo "checked";
                                                   } ?>
                                                         class="form-checkbox" type="checkbox" value="Diabetes"
                                                         autocomplete="off">
                                                      <label class="choice" for="diabetes">Diabetes</label>
                                                   </span>

                                                </div>
                                                <div class="col-md-3">
                                                   <span class="webkitbox"><input id="heartAttack" name="mc[]" <?php if (in_array("Heart attack", explode(",", $patientDetails['medicalConditions']))) {
                                                      echo "checked";
                                                   } ?>
                                                         class="form-checkbox" type="checkbox" value="Heart attack"
                                                         autocomplete="off">
                                                      <label class="choice" for="heartAttack">Heart Attack</label>
                                                   </span>
                                                   <span class="webkitbox"><input id="heartDisease" name="mc[]" <?php if (in_array("Heart disease", explode(",", $patientDetails['medicalConditions']))) {
                                                      echo "checked";
                                                   } ?>
                                                         class="form-checkbox" type="checkbox" value="Heart disease"
                                                         autocomplete="off">
                                                      <label class="choice" for="heartDisease">Heart Disease</label>
                                                   </span>
                                                   <span class="webkitbox"><input id="historyOfShingles" name="mc[]"
                                                         <?php if (in_array("History of Shingles", explode(",", $patientDetails['medicalConditions']))) {
                                                            echo "checked";
                                                         } ?>
                                                         class="form-checkbox" type="checkbox"
                                                         value="History of Shingles" autocomplete="off">
                                                      <label class="choice" for="historyOfShingles">History of
                                                         Shingles</label>
                                                   </span>
                                                   <span class="webkitbox"><input id="hyperlipidemia" name="mc[]" <?php if (in_array("Hyperlipidemia", explode(",", $patientDetails['medicalConditions']))) {
                                                      echo "checked";
                                                   } ?>
                                                         class="form-checkbox" type="checkbox" value="Hyperlipidemia"
                                                         autocomplete="off">
                                                      <label class="choice" for="hyperlipidemia">Hyperlipidemia</label>
                                                   </span>
                                                </div>

                                                <div class="col-md-3">
                                                   <span class="webkitbox"><input id="immuocompromised" name="mc[]"
                                                         <?php if (in_array("Immuocompromised", explode(",", $patientDetails['medicalConditions']))) {
                                                            echo "checked";
                                                         } ?>
                                                         class="form-checkbox" type="checkbox" value="Immuocompromised"
                                                         autocomplete="off">
                                                      <label class="choice"
                                                         for="immuocompromised">Immuocompromised</label>
                                                   </span>
                                                   <span class="webkitbox"><input id="kidneyDisease" name="mc[]" <?php if (in_array("Kidney Disease", explode(",", $patientDetails['medicalConditions']))) {
                                                      echo "checked";
                                                   } ?>
                                                         class="form-checkbox" type="checkbox" value="Kidney Disease"
                                                         autocomplete="off">
                                                      <label class="choice" for="kidneyDisease">Kidney Disease</label>
                                                   </span>
                                                   <span class="webkitbox"><input id="lactoseIntolerance" name="mc[]"
                                                         <?php if (in_array("Lactose Intolerance", explode(",", $patientDetails['medicalConditions']))) {
                                                            echo "checked";
                                                         } ?>
                                                         class="form-checkbox" type="checkbox"
                                                         value="Lactose Intolerance" autocomplete="off">
                                                      <label class="choice" for="lactoseIntolerance">Lactose
                                                         Intolerance</label>
                                                   </span>
                                                   <span class="webkitbox"><input id="liverDisease" name="mc[]" <?php if (in_array("Liver Disease", explode(",", $patientDetails['medicalConditions']))) {
                                                      echo "checked";
                                                   } ?>
                                                         class="form-checkbox" type="checkbox" value="Liver Disease"
                                                         autocomplete="off">
                                                      <label class="choice" for="liverDisease">Liver Disease</label>
                                                   </span>
                                                </div>
                                                <div class="col-md-3">
                                                   <span class="webkitbox"><input id="stroke" name="mc[]" <?php if (in_array("Stroke", explode(",", $patientDetails['medicalConditions']))) {
                                                      echo "checked";
                                                   } ?>
                                                         class="form-checkbox" type="checkbox" value="Stroke"
                                                         autocomplete="off">
                                                      <label class="choice" for="stroke">Stroke</label>
                                                   </span>
                                                   <span class="webkitbox"><input id="tb" name="mc[]" <?php if (in_array("TB", explode(",", $patientDetails['medicalConditions']))) {
                                                      echo "checked";
                                                   } ?>
                                                         class="form-checkbox" type="checkbox" value="TB"
                                                         autocomplete="off">
                                                      <label class="choice" for="tb">TB</label>
                                                   </span>
                                                </div>
                                             </fieldset>
                                          </div>
                                       </li>
                                       <li>
                                          <label class="description" for="mcco">Medical Conditions Comments/Other:
                                          </label>
                                          <div>
                                             <textarea id="mcco" name="mcco" placeholderforcheck="" class="form-control"
                                                rows="8"
                                                cols="90"><?= $patientDetails['medicalConditionsComments']; ?></textarea>
                                          </div>
                                       </li>

                                       <li>
                                          <label class="description" for="currentMed">Current Medications (OTC,
                                             Prescribed, Herbal): </label>
                                          <div>
                                             <textarea id="currentMed" name="currentMed" class="form-control" rows="8"
                                                cols="90"><?= $patientDetails['currentMedications']; ?></textarea>
                                          </div>
                                       </li>

                                       <li>
                                          <label for="pmmd" class="description">Patient Medical/Medication Documents:
                                          </label>

                                          <?php if (count($medicaldocs) > 0) {
                                             foreach ($medicaldocs as $md) { ?>
                                                <div class="row mg10">
                                                   <div class="col-md-6">
                                                      <input type="text" disabled name="pmmd[]" multiple
                                                         class="form-control fileInput" value="<?= $md['filename']; ?>"
                                                         title="<?= $md['filename']; ?>" id="pmmd">
                                                   </div>
                                                   <div class="col-md-6">
                                                      <a class="btn btn-success"
                                                         href="uploads/<?= $patientDetails['province']; ?><?= $patientDetails['krollId']; ?>/<?= $md['module']; ?>/<?= $md['filename']; ?>"
                                                         download><i title="Download Attachment"
                                                            class="fa fa-download"></i></a>
                                                      <a class="btn btn-info text-white"
                                                         href="uploads/<?= $patientDetails['province']; ?><?= $patientDetails['krollId']; ?>/<?= $md['module']; ?>/<?= $md['filename']; ?>"
                                                         target="_blank"><i title="View Attachment" class="fa fa-eye"></i></a>
                                                      <button type="button" data-id="<?= $md['id']; ?>"
                                                         class="btn btn-danger deleteDocument" id="delete"><i
                                                            title="Delete Attachment" class="fa fa-trash"></i></button>
                                                   </div>
                                                </div>
                                             <?php }
                                          } ?>
                                          <div class="row" id="fileInputs1">
                                             <div class="col-md-6">
                                                <input type="file" name="pmmd[]" multiple class="form-control fileInput"
                                                   id="pmmd">
                                             </div>
                                             <!--<div id="pmmdfileList"></div>-->
                                             <div class="col-md-6 ">
                                                <button type="button" class="btn btn-default" id="addRowBtn1"><i
                                                      title="Add New Attachment" class="fa fa-plus"></i></button>
                                             </div>
                                          </div>
                                       </li>

                                       <li class="checkboxes col-md-12">
                                          <label class="description">Lifestyle </label>
                                          <div>
                                             <fieldset class="row">
                                                <span class="col-md-3 webkitbox"><input id="smoking" name="lifestyle[]"
                                                      <?php if (in_array("Smoking/Vaping", explode(",", $patientDetails['lifestyle']))) {
                                                         echo "checked";
                                                      } ?>
                                                      class="form-checkbox" type="checkbox" value="Smoking/Vaping"
                                                      autocomplete="off">
                                                   <label class="choice" for="smoking">Smoking/Vaping</label>
                                                </span>
                                                <span class="col-md-3 webkitbox"><input id="feeding" name="lifestyle[]"
                                                      <?php if (in_array("Breast Feeding", explode(",", $patientDetails['lifestyle']))) {
                                                         echo "checked";
                                                      } ?>
                                                      class="form-checkbox" type="checkbox" value="Breast Feeding"
                                                      autocomplete="off">
                                                   <label class="choice" for="feeding">Breast Feeding</label>
                                                </span>
                                                <span class="col-md-3 webkitbox"><input id="pregnant" name="lifestyle[]"
                                                      <?php if (in_array("Pregnant", explode(",", $patientDetails['lifestyle']))) {
                                                         echo "checked";
                                                      } ?>
                                                      class="form-checkbox" type="checkbox" value="Pregnant"
                                                      autocomplete="off">
                                                   <label class="choice" for="pregnant">Pregnant</label>
                                                </span>
                                                <span class="col-md-3 webkitbox"><input id="alcohol" name="lifestyle[]"
                                                      <?php if (in_array("Alcohol Use", explode(",", $patientDetails['lifestyle']))) {
                                                         echo "checked";
                                                      } ?>
                                                      class="form-checkbox" type="checkbox" value="Alcohol Use"
                                                      autocomplete="off">
                                                   <label class="choice" for="alcohol">Alcohol Use</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>

                                       <li>
                                          <label class="description" for="lc">Lifestyle Comments </label>
                                          <div>
                                             <textarea id="lc" name="lc" placeholderforcheck="" class="form-control"
                                                rows="8"
                                                cols="90"><?= $patientDetails['lifestyleComments']; ?></textarea>
                                          </div>
                                       </li>

                                       <li class="text-center ftitle accordion">
                                          <h3>Pre-Biologic Medications</h3>
                                       </li>

                                       <li>
                                          <p>List all previous Medication(s) the patient has taken for their condition.
                                          </p>
                                       </li>
                                       <?php
                                       $previosMedications = explode(',', $patientDetails['pmName']);
                                       $pmDosage = explode(',', $patientDetails['pmDosage']);
                                       $pmSwitchReason = explode(',', $patientDetails['pmSwitchReason']);
                                       $pmStartDate = explode(',', $patientDetails['pmStartDate']);
                                       $pmEndDate = explode(',', $patientDetails['pmEndDate']);
                                       $confirmStartEndDate = explode(',', $patientDetails['confirmStartEndDate']);


                                       $previousMedCount = count($previosMedications);
                                       $j = 1;
                                       for ($i = 0; $i < $previousMedCount; $i++) {
                                          ?>

                                          <li class="prmedication" data-id="">
                                             <label class="description" for="pmpw<?= $j; ?>">Previous Medication
                                                #<?= $j; ?>
                                                Patient was on for their Condition: </label>
                                             <div>
                                                <input id="pmpw<?= $j; ?>" name="pmpw[]" placeholder="Name of Drug"
                                                   class="form-control" type="text" value="<?= $previosMedications[$i]; ?>"
                                                   autocomplete="off">
                                             </div>
                                          </li>

                                          <li class="prmedication">
                                             <label class="description" for="pmdosage<?= $j; ?>">Previous Medication #1
                                                Dosage: </label>
                                             <div>
                                                <input id="pmdosage<?= $j; ?>" name="pmdosage[]" class="form-control"
                                                   type="text" value="<?= $pmDosage[$i]; ?>" autocomplete="off">
                                             </div>
                                          </li>

                                          <li class="prmedication">
                                             <label class="description" for="wpsf<?= $j; ?>">Why did Patient switch from
                                                previous Medication #1? </label>
                                             <div>
                                                <input id="wpsf<?= $j; ?>" name="wpsf[]" placeholderforcheck=""
                                                   class="form-control" type="text" value="<?= $pmSwitchReason[$i]; ?>"
                                                   autocomplete="off">
                                             </div>
                                          </li>
                                          <?php
                                          $doesNotKnow = '';
                                          $dndClass = '';
                                          if ($pmStartDate[$i] == "") {
                                             $doesNotKnow = 'checked';
                                             $dndClass = 'hidden';
                                          }

                                          ?>
                                          <li class="checkboxes prmedication">

                                             <div>
                                                <fieldset>
                                                   <span><input id="pdkse<?= $j; ?>" name="pdkse[]" <?= $doesNotKnow; ?>
                                                         class="form-checkbox pdkse" type="checkbox" value="1"
                                                         autocomplete="off">
                                                      <label class="choice" for="pdkse<?= $j; ?>">Patient does not know
                                                         Start/End Date</label>
                                                   </span>
                                                </fieldset>
                                             </div>
                                          </li>


                                          <li class="pdkse<?= $j; ?> col-md-4 prmedication <?= $dndClass; ?>">
                                             <fieldset>
                                                <label class="description" for="pmsd<?= $j; ?>">Previous Medication #1
                                                   Start
                                                   Date: </label>
                                                <div>
                                                   <input type="date" class="form-control" id="pmsd<?= $j; ?>"
                                                      value="<?= $pmStartDate[$i]; ?>" name="pmsd[]">
                                                </div>
                                             </fieldset>
                                          </li>

                                          <li class="pdkse<?= $j; ?> col-md-4 prmedication <?= $dndClass; ?>">
                                             <fieldset>
                                                <label class="pmed<?= $j; ?>">Previous Medication #1 End Date: </label>
                                                <div>
                                                   <input type="date" class="form-control" id="pmed<?= $j; ?>"
                                                      name="pmed[]" value="<?= $pmEndDate[$i]; ?>"
                                                      placeholder="Previous Medication #1 End Date">
                                                </div>
                                             </fieldset>
                                          </li>


                                          <li class="checkboxes prmedication">
                                             <div>
                                                <fieldset>
                                                   <span><input id="csephp<?= $j; ?>" name="csephp[]" <?php if ($confirmStartEndDate[$i] == "1") {
                                                        echo 'checked';
                                                     } ?>
                                                         class="form-checkbox" type="checkbox" value="1"
                                                         autocomplete="off">
                                                      <label class="choice" for="csephp<?= $j; ?>">Confirm Start/End Date
                                                         with Patient's Home Pharmacy</label>
                                                   </span>
                                                </fieldset>
                                             </div>
                                          </li>

                                          <li class="checkboxes prmedication">
                                             <div>
                                                <fieldset>
                                                   <span><input id="adpm<?= $j; ?>" name="adpm<?= $j; ?>"
                                                         data-id="<?= $j; ?>" class="form-checkbox addpreviousMedication"
                                                         type="checkbox" value="<?= $j; ?>" autocomplete="off">
                                                      <label class="choice" for="adpm<?= $j; ?>">Add Additional Previous
                                                         Medication #<?= $j + 1; ?></label>
                                                   </span>
                                                </fieldset>
                                             </div>
                                          </li>
                                          <li>
                                             <hr>
                                             </hr>
                                          </li>
                                          <li class="hidden lastprmedication<?= $j; ?>">
                                          </li>
                                          <?php $j++;
                                       } ?>


                                       <li class="text-center ftitle accordion">
                                          <h3>Prescription Drug Information</h3>
                                       </li>


                                       <li class="col-md-4">
                                          <label class="description" for="patientDrugName">Drug Name: </label>
                                          <div>
                                             <select class="form-control form-control" id="patientDrugName"
                                                name="patientDrugName">
                                                <option value="">Select Drug</option>
                                                <?php foreach ($medications as $medication) { ?>
                                                   <option value="<?php echo $medication['drugName']; ?>" <?php echo ($medication['drugName'] == $patientDetails['patientDrugName']) ? 'selected' : ''; ?>><?php echo $medication['drugName']; ?></option>
                                                <?php } ?>
                                             </select>
                                          </div>
                                       </li>

                                       <li class="col-md-4">
                                          <label class="description" for="dose">Dose: </label>
                                          <div>
                                             <input id="dose" name="dose" class="form-control" type="text"
                                                value="<?php echo $patientDetails['dosage']; ?>" autocomplete="off">
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-4">
                                          <label class="description" for="roa">Route of Administration: </label>
                                          <div>
                                             <select class="form-control" id="roa" name="roa">
                                                <option value=""></option>
                                                <option value="Subcutaneous" <?php echo ("Subcutaneous" == $patientDetails['routeOfAdmin']) ? 'selected' : ''; ?>>Subcutaneous</option>
                                                <option value="Intramuscular" <?php echo ("Intramuscular" == $patientDetails['routeOfAdmin']) ? 'selected' : ''; ?>>Intramuscular</option>
                                                <option value="Intravenous" <?php echo ("Intravenous" == $patientDetails['routeOfAdmin']) ? 'selected' : ''; ?>>Intravenous</option>
                                                <option value="Oral" <?php echo ("Oral" == $patientDetails['routeOfAdmin']) ? 'selected' : ''; ?>>Oral
                                                </option>
                                             </select>
                                          </div>
                                       </li>
                                       <?php
                                       $customRequired='';
                                       if(isset($patientDetails['wcStatus'])){
                                          if($patientDetails['wcStatus'] == 5){
                                             $customRequired='required';
                                          }
                                       }
                                       ?>
                                       <li class="clearfix"></li>
                                       <li class="col-md-4">
                                          <label class="description" for="pwkl">Patient Weight (kg/lb) <span
                                                class="req">*</span></label>
                                          <div>
                                             <input id="pwkl" name="pwkl"  <?=$customRequired;?> class="form-control" type="text"
                                                value="<?php echo $patientDetails['patientWeight']; ?>"
                                                autocomplete="off">
                                             <div class="invalid-feedback">Please Enter Weight</div>
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-6 fixselectmultiple">
                                          <label class="description" for="indication">Indications: <span
                                                class="req">*</span></label>
                                                <select class="form-control select2bs4" multiple <?=$customRequired;?> name="indication[]" id="indication">
                                                   <option value="" disabled>Select Indication</option>
                                                   <option  <?php if (in_array("AD", explode(",", $patientDetails['indication']))) {
                                                         echo "selected";
                                                      } ?> value="AD">AD</option>
                                                   <option <?php if (in_array("Asthma", explode(",", $patientDetails['indication']))) {
                                                         echo "selected";
                                                      } ?> value="Asthma">Asthma</option>
                                                   <option <?php if (in_array("PN", explode(",", $patientDetails['indication']))) {
                                                         echo "selected";
                                                      } ?> value="PN">PN</option>
                                                   <option <?php if (in_array("CRSwNP", explode(",", $patientDetails['indication']))) {
                                                         echo "selected";
                                                      } ?> value="CRSwNP">CRSwNP</option>
                                                   <option <?php if (in_array("EOE", explode(",", $patientDetails['indication']))) {
                                                         echo "selected";
                                                      } ?> value="EOE">EOE</option>
                                                </select>
                                             <div class="invalid-feedback">Please Select Indication</div>
                                         
                                       </li>
                                       <li class="clearfix"></li>
                                       <li id="ad-questionnaire" class="col-md-6 <?php 
                                             echo (in_array("AD", explode(",", $patientDetails['indication'])) || 
                                             in_array("PN", explode(",", $patientDetails['indication']))) ? '' : 'hidden'; 
                                             ?>">
                                          <label class="description" for="adMedication">AD & PN Medications: </label>
                                          <select class="form-control" name="adMedication">
                                          <option value="">Select AD & PN Medications</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Protopic (tacrolimus) - TCI"){ echo 'selected'; } ?> value="Protopic (tacrolimus) - TCI">Protopic (tacrolimus) - TCI</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Elidel (pimecrolimus) - TCI"){ echo 'selected'; } ?> value="Elidel (pimecrolimus) - TCI">Elidel (pimecrolimus) - TCI</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Temovate (clobetasol) - TCS"){ echo 'selected'; } ?> value="Temovate (clobetasol) - TCS">Temovate (clobetasol) - TCS</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Desowen (desonide) - TCS"){ echo 'selected'; } ?> value="Desowen (desonide) - TCS">Desowen (desonide) - TCS</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Cortizone-10 (hydrocortisone) - TCS"){ echo 'selected'; } ?> value="Cortizone-10 (hydrocortisone) - TCS">Cortizone-10 (hydrocortisone) - TCS</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Luxiq (betamethasone) - TCS"){ echo 'selected'; } ?> value="Luxiq (betamethasone) - TCS">Luxiq (betamethasone) - TCS</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Betamethasone valerate - TCS"){ echo 'selected'; } ?> value="Betamethasone valerate - TCS">Betamethasone valerate - TCS</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Betamethasone dipropionate - TCS"){ echo 'selected'; } ?> value="Betamethasone dipropionate - TCS">Betamethasone dipropionate - TCS</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Diflucortolone valerate - TCS"){ echo 'selected'; } ?> value="Diflucortolone valerate - TCS">Diflucortolone valerate - TCS</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Hydrocortisone 17-butyrate - TCS"){ echo 'selected'; } ?> value="Hydrocortisone 17-butyrate - TCS">Hydrocortisone 17-butyrate - TCS</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Mometasone furoate - TCS"){ echo 'selected'; } ?> value="Mometasone furoate - TCS">Mometasone furoate - TCS</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Methylprednisolone aceponate - TCS"){ echo 'selected'; } ?> value="Methylprednisolone aceponate - TCS">Methylprednisolone aceponate - TCS</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Narrowband UVB(311-313 nm) - Phototherapy"){ echo 'selected'; } ?> value="Narrowband UVB(311-313 nm) - Phototherapy">Narrowband UVB(311-313 nm) - Phototherapy</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Broadband UVB (280-320 nm) - Phototherapy"){ echo 'selected'; } ?> value="Broadband UVB (280-320 nm) - Phototherapy">Broadband UVB (280-320 nm) - Phototherapy</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="UVA + UVB (280-400 nm) - Phototherapy"){ echo 'selected'; } ?> value="UVA + UVB (280-400 nm) - Phototherapy">UVA + UVB (280-400 nm) - Phototherapy</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="UVA1 (340-400 nm)* - Phototherapy"){ echo 'selected'; } ?> value="UVA1 (340-400 nm)* - Phototherapy">UVA1 (340-400 nm)* - Phototherapy</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Mycophenolate mofetil (MMF) - Immuno suppressants"){ echo 'selected'; } ?> value="Mycophenolate mofetil (MMF) - Immuno suppressants">Mycophenolate mofetil (MMF) - Immuno suppressants</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Azathioprine - Immuno suppressants"){ echo 'selected'; } ?> value="Azathioprine - Immuno suppressants">Azathioprine - Immuno suppressants</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Methotrexate - Immuno suppressants"){ echo 'selected'; } ?> value="Methotrexate - Immuno suppressants">Methotrexate - Immuno suppressants</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Cyclosporin - Immuno suppressants"){ echo 'selected'; } ?> value="Cyclosporin - Immuno suppressants">Cyclosporin - Immuno suppressants</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Adtralza (tralokinumab) - Biologics"){ echo 'selected'; } ?> value="Adtralza (tralokinumab) - Biologics">Adtralza (tralokinumab) - Biologics</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Rinvoq (upadacitinib) - Biologics"){ echo 'selected'; } ?> value="Rinvoq (upadacitinib) - Biologics">Rinvoq (upadacitinib) - Biologics</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="Cibinqo (abrocitinib) - Biologics"){ echo 'selected'; } ?> value="Cibinqo (abrocitinib) - Biologics">Cibinqo (abrocitinib) - Biologics</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="DUPIXENT (dupliumab) - Biologics"){ echo 'selected'; } ?> value="DUPIXENT (dupliumab) - Biologics">DUPIXENT (dupliumab) - Biologics</option>
                                          <option <?php if(isset($patientDetails['adMedication']) && $patientDetails['adMedication']=="EBGLYSS (lebrikizumab) - Biologics"){ echo 'selected'; } ?> value="EBGLYSS (lebrikizumab) - Biologics">EBGLYSS (lebrikizumab) - Biologics</option>
                                          </select>
                                       </li>
                                       <li class="clearfix"></li>
                                       <!-- Asthma Questionnaire Section -->
                                       <li id="asthma-questionnaire" class="col-md-6 <?php 
                                             echo (in_array("Asthma", explode(",", $patientDetails['indication']))) ? '' : 'hidden'; 
                                             ?>">
                                       <label class="description" for="asthmaMedication">Asthma Medications: </label>
                                       <select name="asthmaMedication" class="form-control">
                                          <option value="">Select Asthma Medications</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Alvesco (ciclesonide) - ICS"){ echo 'selected'; } ?> value="Alvesco (ciclesonide) - ICS">Alvesco (ciclesonide) - ICS</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Asmanex Twisthaler (mometasone furoate) - ICS"){ echo 'selected'; } ?> value="Asmanex Twisthaler (mometasone furoate) - ICS">Asmanex Twisthaler (mometasone furoate) - ICS</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Flovent HFA (fluticasone propionate) - ICS"){ echo 'selected'; } ?> value="Flovent HFA (fluticasone propionate) - ICS">Flovent HFA (fluticasone propionate) - ICS</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Flovent Diskus (fluticasone propionate) - ICS"){ echo 'selected'; } ?> value="Flovent Diskus (fluticasone propionate) - ICS">Flovent Diskus (fluticasone propionate) - ICS</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Pulmicort Turbohaler (budesonide) - ICS"){ echo 'selected'; } ?> value="Pulmicort Turbohaler (budesonide) - ICS">Pulmicort Turbohaler (budesonide) - ICS</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="QVAR (beclomethasone dipropionate) - ICS"){ echo 'selected'; } ?> value="QVAR (beclomethasone dipropionate) - ICS">QVAR (beclomethasone dipropionate) - ICS</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Foradil Aerolizer (formoterol) - LABA"){ echo 'selected'; } ?> value="Foradil Aerolizer (formoterol) - LABA">Foradil Aerolizer (formoterol) - LABA</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Oxeze Turbohaler (formoterol) - LABA"){ echo 'selected'; } ?> value="Oxeze Turbohaler (formoterol) - LABA">Oxeze Turbohaler (formoterol) - LABA</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Onbrez Breezhaler (indacaterol) - LABA"){ echo 'selected'; } ?> value="Onbrez Breezhaler (indacaterol) - LABA">Onbrez Breezhaler (indacaterol) - LABA</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Serevent Diskus (salmeterol) - LABA"){ echo 'selected'; } ?> value="Serevent Diskus (salmeterol) - LABA">Serevent Diskus (salmeterol) - LABA</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Seebri Breezhaler (glycopyrronium) - LAMA"){ echo 'selected'; } ?> value="Seebri Breezhaler (glycopyrronium) - LAMA">Seebri Breezhaler (glycopyrronium) - LAMA</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Spiriva Handihaler (tiotopium) - LAMA"){ echo 'selected'; } ?> value="Spiriva Handihaler (tiotopium) - LAMA">Spiriva Handihaler (tiotopium) - LAMA</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Tudorza Genuair (aclidinium) - LAMA"){ echo 'selected'; } ?> value="Tudorza Genuair (aclidinium) - LAMA">Tudorza Genuair (aclidinium) - LAMA</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Advair Diskus (fluticasone propionate / salmeterol) - ICS / Controller (LABA)"){ echo 'selected'; } ?> value="Advair Diskus (fluticasone propionate / salmeterol) - ICS / Controller (LABA)">Advair Diskus (fluticasone propionate / salmeterol) - ICS / Controller (LABA)</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Advair (fluticasone propionate / salmeterol) - ICS / Controller (LABA)"){ echo 'selected'; } ?> value="Advair (fluticasone propionate / salmeterol) - ICS / Controller (LABA)">Advair (fluticasone propionate / salmeterol) - ICS / Controller (LABA)</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Breo Ellipta (fluticonase furoate / vilanterol) - ICS / Controller (LABA)"){ echo 'selected'; } ?> value="Breo Ellipta (fluticonase furoate / vilanterol) - ICS / Controller (LABA)">Breo Ellipta (fluticonase furoate / vilanterol) - ICS / Controller (LABA)</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Symbicort Turbohaler (budesonide / formoterol) - ICS / Controller (LABA)"){ echo 'selected'; } ?> value="Symbicort Turbohaler (budesonide / formoterol) - ICS / Controller (LABA)">Symbicort Turbohaler (budesonide / formoterol) - ICS / Controller (LABA)</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Zenhale (mometasone furoate / formoterol) - ICS / Controller (LABA)"){ echo 'selected'; } ?> value="Zenhale (mometasone furoate / formoterol) - ICS / Controller (LABA)">Zenhale (mometasone furoate / formoterol) - ICS / Controller (LABA)</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Enerzair Breezhaler (mometasone fuorate / indacterol / glycopyrronium) - ICS / Controller (LABA/LAMA)"){ echo 'selected'; } ?> value="Enerzair Breezhaler (mometasone fuorate / indacterol / glycopyrronium) - ICS / Controller (LABA/LAMA)">Enerzair Breezhaler (mometasone fuorate / indacterol / glycopyrronium) - ICS / Controller (LABA/LAMA)</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Trelegy Ellipta (fluticasone furoate / umeclidinium / vilanterol) - ICS / Controller (LABA/LAMA)"){ echo 'selected'; } ?> value="Trelegy Ellipta (fluticasone furoate / umeclidinium / vilanterol) - ICS / Controller (LABA/LAMA)">Trelegy Ellipta (fluticasone furoate / umeclidinium / vilanterol) - ICS / Controller (LABA/LAMA)</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Anoro Ellipta (umeclidinium / vilanterol) - Controller"){ echo 'selected'; } ?> value="Anoro Ellipta (umeclidinium / vilanterol) - Controller">Anoro Ellipta (umeclidinium / vilanterol) - Controller</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Ultibo Breezhaler (indacaterol / glycopyrronium) - Controller"){ echo 'selected'; } ?> value="Ultibo Breezhaler (indacaterol / glycopyrronium) - Controller">Ultibo Breezhaler (indacaterol / glycopyrronium) - Controller</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Ventolin (salbutamol) - SABA"){ echo 'selected'; } ?> value="Ventolin (salbutamol) - SABA">Ventolin (salbutamol) - SABA</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Airomir (salbutamol) - SABA"){ echo 'selected'; } ?> value="Airomir (salbutamol) - SABA">Airomir (salbutamol) - SABA</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Salbutamol HFA generics - SABA"){ echo 'selected'; } ?> value="Salbutamol HFA generics - SABA">Salbutamol HFA generics - SABA</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Bricanyl (terbutaline) - SABA"){ echo 'selected'; } ?> value="Bricanyl (terbutaline) - SABA">Bricanyl (terbutaline) - SABA</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Atrovent HFA (ipratopium) - SAMA"){ echo 'selected'; } ?> value="Atrovent HFA (ipratopium) - SAMA">Atrovent HFA (ipratopium) - SAMA</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Prednisone - OCS"){ echo 'selected'; } ?> value="Prednisone - OCS">Prednisone - OCS</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Prednisolone - OCS"){ echo 'selected'; } ?> value="Prednisolone - OCS">Prednisolone - OCS</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Methylprednisolone - OCS"){ echo 'selected'; } ?> value="Methylprednisolone - OCS">Methylprednisolone - OCS</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Dexamethasone - OCS"){ echo 'selected'; } ?> value="Dexamethasone - OCS">Dexamethasone - OCS</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Nucala (mepolizumab) - Biologics"){ echo 'selected'; } ?> value="Nucala (mepolizumab) - Biologics">Nucala (mepolizumab) - Biologics</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Cinqair (reslizumab) - Biologics"){ echo 'selected'; } ?> value="Cinqair (reslizumab) - Biologics">Cinqair (reslizumab) - Biologics</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Fasenra (benralizumab) - Biologics"){ echo 'selected'; } ?> value="Fasenra (benralizumab) - Biologics">Fasenra (benralizumab) - Biologics</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="Xolair (omalizumab) - Biologics"){ echo 'selected'; } ?> value="Xolair (omalizumab) - Biologics">Xolair (omalizumab) - Biologics</option>
                                          <option <?php if(isset($patientDetails['asthmaMedication']) && $patientDetails['asthmaMedication']=="DUPIXENT (dupliumab) - Biologics"){ echo 'selected'; } ?> value="DUPIXENT (dupliumab) - Biologics">DUPIXENT (dupliumab) - Biologics</option>
                                       </select>
                                       
                                       </li>
                                       <li class="clearfix"></li>
                                       <!-- CRSwNP MEDICATIONS	 Questionnaire Section -->
                                       <li id="CRSwNP-questionnaire" class="col-md-6 <?php 
                                             echo (in_array("CRSwNP", explode(",", $patientDetails['indication']))) ? '' : 'hidden'; 
                                             ?>">
                                          <label class="description" for="CRSwNPMedication">CRSwNP Medications: </label>
                                          <select class="form-control" name="CRSwNPMedication">
                                             <option value="">Select CRSwNP Medications</option>
                                             <option <?php if(isset($patientDetails['CRSwNPMedication']) && $patientDetails['CRSwNPMedication']=="Prednisone - Oral (Systemic) Corticosteroids"){ echo 'selected'; } ?> value="Prednisone - Oral (Systemic) Corticosteroids">Prednisone - Oral (Systemic) Corticosteroids</option>
                                             <option <?php if(isset($patientDetails['CRSwNPMedication']) && $patientDetails['CRSwNPMedication']=="Prednisolone - Oral (Systemic) Corticosteroids"){ echo 'selected'; } ?> value="Prednisolone - Oral (Systemic) Corticosteroids">Prednisolone - Oral (Systemic) Corticosteroids</option>
                                             <option <?php if(isset($patientDetails['CRSwNPMedication']) && $patientDetails['CRSwNPMedication']=="Methylprednisolone - Oral (Systemic) Corticosteroids"){ echo 'selected'; } ?> value="Methylprednisolone - Oral (Systemic) Corticosteroids">Methylprednisolone - Oral (Systemic) Corticosteroids</option>
                                             <option <?php if(isset($patientDetails['CRSwNPMedication']) && $patientDetails['CRSwNPMedication']=="Dexamethasone - Oral (Systemic) Corticosteroids"){ echo 'selected'; } ?> value="Dexamethasone - Oral (Systemic) Corticosteroids">Dexamethasone - Oral (Systemic) Corticosteroids</option>
                                             <option <?php if(isset($patientDetails['CRSwNPMedication']) && $patientDetails['CRSwNPMedication']=="Mometasone furoate Nasonex (50 mcg) - Intranasal Corticosteroids"){ echo 'selected'; } ?> value="Mometasone furoate Nasonex (50 mcg) - Intranasal Corticosteroids">Mometasone furoate Nasonex (50 mcg) - Intranasal Corticosteroids</option>
                                             <option <?php if(isset($patientDetails['CRSwNPMedication']) && $patientDetails['CRSwNPMedication']=="Fluticasone - azelastine Dymista (137mcg/50 mcg) - Intranasal Corticosteroids"){ echo 'selected'; } ?> value="Fluticasone - azelastine Dymista (137mcg/50 mcg) - Intranasal Corticosteroids">Fluticasone - azelastine Dymista (137mcg/50 mcg) - Intranasal Corticosteroids</option>
                                             <option <?php if(isset($patientDetails['CRSwNPMedication']) && $patientDetails['CRSwNPMedication']=="Fluticasone furoate Avamys (27.5 mcg) - Intranasal Corticosteroids"){ echo 'selected'; } ?> value="Fluticasone furoate Avamys (27.5 mcg) - Intranasal Corticosteroids">Fluticasone furoate Avamys (27.5 mcg) - Intranasal Corticosteroids</option>
                                             <option <?php if(isset($patientDetails['CRSwNPMedication']) && $patientDetails['CRSwNPMedication']=="Fluticasone propionate Flonase (50 mcg) - Intranasal Corticosteroids"){ echo 'selected'; } ?> value="Fluticasone propionate Flonase (50 mcg) - Intranasal Corticosteroids">Fluticasone propionate Flonase (50 mcg) - Intranasal Corticosteroids</option>
                                             <option <?php if(isset($patientDetails['CRSwNPMedication']) && $patientDetails['CRSwNPMedication']=="Triamcinolone acetonide Nasacort AQ (55 mcg) - Intranasal Corticosteroids"){ echo 'selected'; } ?> value="Triamcinolone acetonide Nasacort AQ (55 mcg) - Intranasal Corticosteroids">Triamcinolone acetonide Nasacort AQ (55 mcg) - Intranasal Corticosteroids</option>
                                             <option <?php if(isset($patientDetails['CRSwNPMedication']) && $patientDetails['CRSwNPMedication']=="Ciclesonide Omnaris (50 mcg) - Intranasal Corticosteroids"){ echo 'selected'; } ?> value="Ciclesonide Omnaris (50 mcg) - Intranasal Corticosteroids">Ciclesonide Omnaris (50 mcg) - Intranasal Corticosteroids</option>
                                             <option <?php if(isset($patientDetails['CRSwNPMedication']) && $patientDetails['CRSwNPMedication']=="Beclomethasone dipropionate Beconase AQ (50 mcg) - Intranasal Corticosteroids"){ echo 'selected'; } ?> value="Beclomethasone dipropionate Beconase AQ (50 mcg) - Intranasal Corticosteroids">Beclomethasone dipropionate Beconase AQ (50 mcg) - Intranasal Corticosteroids</option>
                                             <option <?php if(isset($patientDetails['CRSwNPMedication']) && $patientDetails['CRSwNPMedication']=="Budesonide Rhinocort Aqua (64 mcg, 100 mcg) Pulmicort (0.125 mg/mL, 0.25 mg/mL, 0.5 mg/mL) - Intranasal Corticosteroids"){ echo 'selected'; } ?> value="Budesonide Rhinocort Aqua (64 mcg, 100 mcg) Pulmicort (0.125 mg/mL, 0.25 mg/mL, 0.5 mg/mL) - Intranasal Corticosteroids">Budesonide Rhinocort Aqua (64 mcg, 100 mcg) Pulmicort (0.125 mg/mL, 0.25 mg/mL, 0.5 mg/mL) - Intranasal Corticosteroids</option>
                                             <option <?php if(isset($patientDetails['CRSwNPMedication']) && $patientDetails['CRSwNPMedication']=="Montelukast (Singulair 5mg, 10mg) - Leukotriene Inhibitor"){ echo 'selected'; } ?> value="Montelukast (Singulair 5mg, 10mg) - Leukotriene Inhibitor">Montelukast (Singulair 5mg, 10mg) - Leukotriene Inhibitor</option>
                                             <option <?php if(isset($patientDetails['CRSwNPMedication']) && $patientDetails['CRSwNPMedication']=="Azithromycine 500mg - Antibiotics"){ echo 'selected'; } ?> value="Azithromycine 500mg - Antibiotics">Azithromycine 500mg - Antibiotics</option>
                                          </select>
                                       </li>
                                       <li class="clearfix"></li>

                                       <li class="col-md-4">
                                          <label class="description" for="oluse">Off-Label Use: <span
                                                class="req">*</span></label>
                                          <div>
                                             <select  class="form-control" <?=$customRequired;?>  id="oluse" name="oluse">
                                                <option value="" selected="selected"></option>
                                                <option value="Y" <?php echo ("Y" == $patientDetails['offLabelUse']) ? 'selected' : ''; ?>>Yes</option>
                                                <option value="N" <?php echo ("N" == $patientDetails['offLabelUse']) ? 'selected' : ''; ?>>No</option>
                                             </select>
                                             <div class="invalid-feedback">Please Select Off-Label Use</div>
                                          </div>
                                       </li>

                                       <li class="clearfix"></li>

                                       <li class="col-md-6">
                                          <label class="description" for="prescriberName">Prescriber's Name : </label>
                                          <div>
                                             <input id="prescriberName" name="prescriberName" class="form-control"
                                                type="text" value="<?php echo $patientDetails['prescriberName']; ?>"
                                                autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-6">
                                          <label class="description" for="prescriberSpecialty">Prescriber's Specialty:
                                          </label>
                                          <div>
                                             <input id="prescriberSpecialty" name="prescriberSpecialty"
                                                class="form-control" type="text"
                                                value="<?php echo $patientDetails['prescriberSpecialty']; ?>"
                                                autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-6">
                                          <label class="description" for="team">Team: </label>
                                          <div>
                                             <input id="team" name="team" class="form-control" type="text"
                                                value="<?php echo $patientDetails['team']; ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-6">
                                          <label class="description" for="staff">Staff: </label>
                                          <div>
                                             <input id="staff" name="staff" class="form-control" type="text"
                                                value="<?php echo $patientDetails['staff']; ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li>
                                          <span class="description">Did Patient get Sample Dose from Prescribers office?
                                             <span class="req">*</span></span>
                                          <div>
                                             <fieldset>

                                                <span class="flex">
                                                   <input type="radio" id="yesDpgsd" <?php echo ("Y" == $patientDetails['presciberOffice']) ? 'checked' : ''; ?>
                                                      name="Dpgsd" value="Y" class="custom-radio">
                                                   <label for="yesDpgsd" class="radio-label">Yes</label>
                                                </span>

                                                <span class="flex">
                                                   <input type="radio" id="noDpgsd" <?php echo ("N" == $patientDetails['presciberOffice']) ? 'checked' : ''; ?>
                                                      name="Dpgsd" value="N" class="custom-radio">
                                                   <label for="noDpgsd" class="radio-label">No</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>

                                       <li class="sampleDosePrescriber col-md-4">
                                          <fieldset>
                                             <label class="smpDate">Date Patient Received Sample Dose: </label>
                                             <div>
                                                <input type="date" class="form-control" id="smpDate"
                                                   value="<?php echo $patientDetails['sampleDoseReceived']; ?>"
                                                   name="smpDate">
                                             </div>
                                          </fieldset>
                                       </li>


                                       <li class="text-center ftitle accordion">
                                          <h3>
                                             Pre-Treatment Phase
                                          </h3>
                                       </li>

                                       <li>
                                          <h4>Screening/Immunization</h4>
                                       </li>
                                       <?php

                                       $ScrnConfirmationDate = 'hidden';
                                       $screeningVaccinationRequired = 'hidden';
                                       $scrnImmFollowUpDate = 'hidden';

                                       if ($patientDetails['sis'] == 4) {
                                          $ScrnConfirmationDate = '';
                                       }
                                       if ($patientDetails['sis'] == 1 || $patientDetails['sis'] == 2) {
                                          $screeningVaccinationRequired = '';
                                          $scrnImmFollowUpDate = '';
                                       }
                                       ?>
                                       <li class="col-md-6">
                                          <label class="description" for="sis">Screening/Immunization Status: </label>
                                          <div>
                                             <select class="form-control" id="sis" name="sis">
                                                <option value=" "></option>
                                                <option value="1" <?php echo ("1" == $patientDetails['sis']) ? 'selected' : ''; ?>>Pending - Screening/Immunization Required</option>
                                                <option value="2" <?php echo ("2" == $patientDetails['sis']) ? 'selected' : ''; ?>>Pending - Patient Update</option>
                                                <option value="3" <?php echo ("3" == $patientDetails['sis']) ? 'selected' : ''; ?>>Pending - Medical Clerance Received</option>
                                                <option value="4" <?php echo ("4" == $patientDetails['sis']) ? 'selected' : ''; ?>>Completed - Medical Clerance Confirmed</option>
                                                <option value="5" <?php echo ("5" == $patientDetails['sis']) ? 'selected' : ''; ?>>Screening/Immunization Not Required</option>
                                             </select>
                                          </div>
                                       </li>


                                       <li class="screeningVaccinationRequired <?= $screeningVaccinationRequired; ?>">
                                          <span class="description">Screenings/Vaccinations Required: </span>
                                          <div>
                                             <fieldset>
                                                <span><input id="tbskin" name="svr[]" class="form-checkbox" <?php if (in_array("TB Skin", explode(",", $patientDetails['svr']))) {
                                                   echo "checked";
                                                } ?> type="checkbox" value="TB Skin"
                                                      autocomplete="off">
                                                   <label class="choice" for="tbskin">TB Skin</label>
                                                </span>
                                                <span><input id="TBQ" name="svr[]" class="form-checkbox" <?php if (in_array("TBQ", explode(",", $patientDetails['svr']))) {
                                                   echo "checked";
                                                } ?> type="checkbox" value="TBQ" autocomplete="off">
                                                   <label class="choice" for="TBQ">TBQ</label>
                                                </span>
                                                <span><input id="Chest" name="svr[]" class="form-checkbox" <?php if (in_array("Chest X-Ray", explode(",", $patientDetails['svr']))) {
                                                   echo "checked";
                                                } ?> type="checkbox" value="Chest X-Ray"
                                                      autocomplete="off">
                                                   <label class="choice" for="Chest">Chest X-Ray</label>
                                                </span>
                                                <span><input id="Shingrix" name="svr[]" class="form-checkbox" <?php if (in_array("Shingrix", explode(",", $patientDetails['svr']))) {
                                                   echo "checked";
                                                } ?> type="checkbox" value="Shingrix"
                                                      autocomplete="off">
                                                   <label class="choice" for="Shingrix">Shingrix</label>
                                                </span>
                                                <span><input id="HepatitisB" name="svr[]" class="form-checkbox" <?php if (in_array("Hepatitis B", explode(",", $patientDetails['svr']))) {
                                                   echo "checked";
                                                } ?> type="checkbox" value="Hepatitis B"
                                                      autocomplete="off">
                                                   <label class="choice" for="HepatitisB">Hepatitis B</label>
                                                </span>
                                                <span><input id="HepatitisC" name="svr[]" class="form-checkbox" <?php if (in_array("Hepatitis C", explode(",", $patientDetails['svr']))) {
                                                   echo "checked";
                                                } ?> type="checkbox" value="Hepatitis C"
                                                      autocomplete="off">
                                                   <label class="choice" for="HepatitisC">Hepatitis C</label>
                                                </span>
                                                <span><input id="HIV" name="svr[]" class="form-checkbox" <?php if (in_array("HIV", explode(",", $patientDetails['svr']))) {
                                                   echo "checked";
                                                } ?> type="checkbox" value="HIV" autocomplete="off">
                                                   <label class="choice" for="HIV">HIV</label>
                                                </span>
                                                <span><input id="Prevnar" name="svr[]" class="form-checkbox" <?php if (in_array("Prevnar", explode(",", $patientDetails['svr']))) {
                                                   echo "checked";
                                                } ?> type="checkbox" value="Prevnar"
                                                      autocomplete="off">
                                                   <label class="choice" for="Prevnar">Prevnar</label>
                                                </span>
                                                <span><input id="Twinrix" name="svr[]" class="form-checkbox" <?php if (in_array("Twinrix", explode(",", $patientDetails['svr']))) {
                                                   echo "checked";
                                                } ?> type="checkbox" value="Twinrix"
                                                      autocomplete="off">
                                                   <label class="choice" for="Twinrix">Twinrix</label>
                                                </span>
                                                <span><input id="Other" name="svr[]" class="form-checkbox" <?php if (in_array("Other", explode(",", $patientDetails['svr']))) {
                                                   echo "checked";
                                                } ?> type="checkbox" value="Other" autocomplete="off">
                                                   <label class="choice" for="Other">Other</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>

                                       <li class="<?php if (in_array("TB Skin", explode(",", $patientDetails['svr']))) {
                                          echo "";
                                       } else {
                                          echo 'hidden';
                                       } ?> tbskinshow">
                                          <label class="description">TB Skin Screening Status </label>
                                          <div class="inline-flex">
                                             <fieldset>
                                                <span><input id="tbskinscreeningPending" <?php echo ("Pending" == $patientDetails['tbskinscreening']) ? 'checked' : ''; ?> name="tbskinscreening" class="custom-radio" type="radio"
                                                      value="Pending" autocomplete="off">
                                                   <label class="choice" for="tbskinscreeningPending">Pending</label>
                                                </span>
                                                <span><input id="tbskinscreeningReceived" <?php echo ("Received" == $patientDetails['tbskinscreening']) ? 'checked' : ''; ?> name="tbskinscreening" class="custom-radio" type="radio"
                                                      value="Received" autocomplete="off">
                                                   <label class="choice" for="tbskinscreeningReceived">Received</label>
                                                </span>
                                                <span><input id="tbskinscreeningConfirmed" <?php echo ("Confirmed" == $patientDetails['tbskinscreening']) ? 'checked' : ''; ?> name="tbskinscreening" class="custom-radio" type="radio"
                                                      value="Confirmed" autocomplete="off">
                                                   <label class="choice"
                                                      for="tbskinscreeningConfirmed">Confirmed</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>
                                       <li class="<?php if (in_array("Chest X-Ray", explode(",", $patientDetails['svr']))) {
                                          echo "";
                                       } else {
                                          echo 'hidden';
                                       } ?>  chestxrayshow">
                                          <label class="description">Chest X-Ray Screening Status </label>
                                          <div class="inline-flex">
                                             <fieldset>
                                                <span><input id="CXSSPending" name="CXSS" <?php echo ("Pending" == $patientDetails['cxss']) ? 'checked' : ''; ?>
                                                      class="custom-radio" type="radio" value="Pending"
                                                      autocomplete="off">
                                                   <label class="choice" for="CXSSPending">Pending</label>
                                                </span>
                                                <span><input id="CXSSReceived" name="CXSS" <?php echo ("Received" == $patientDetails['cxss']) ? 'checked' : ''; ?>
                                                      class="custom-radio" type="radio" value="Received"
                                                      autocomplete="off">
                                                   <label class="choice" for="CXSSReceived">Received</label>
                                                </span>
                                                <span><input id="CXSSConfirmed" name="CXSS" <?php echo ("Confirmed" == $patientDetails['cxss']) ? 'checked' : ''; ?>
                                                      class="custom-radio" type="radio" value="Confirmed"
                                                      autocomplete="off">
                                                   <label class="choice" for="CXSSConfirmed">Confirmed</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>

                                       <li class="<?php if (in_array("Other", explode(",", $patientDetails['svr']))) {
                                          echo "";
                                       } else {
                                          echo 'hidden';
                                       } ?> otherScreenImm">
                                          <label class="description" for="osi">Other Screenings/Immunizations: </label>
                                          <div>
                                             <textarea id="osi" name="osi" placeholderforcheck="" class="form-control"
                                                rows="8" cols="90"><?php echo $patientDetails['osi']; ?></textarea>
                                          </div>
                                       </li>

                                       <li class="col-md-6 scrnImmFollowUpDate <?= $scrnImmFollowUpDate; ?>">
                                          <label class="description" for="sisfupd">Screening/Immunization Status Follow
                                             Up Date: </label>
                                          <div>
                                             <input type="date" class="form-control" id="sisfupd" name="sisfupd"
                                                value="<?php echo $patientDetails['sisfupd']; ?>"
                                                placeholder="Screening/Immunization Status Follow Up Date">
                                          </div>
                                       </li>

                                       <li class="">
                                          <label for="sid" class="description">Screening/Immunization Documentation:
                                          </label>

                                          <?php if (count($screeningdocs) > 0) {
                                             foreach ($screeningdocs as $md) { ?>
                                                <div class="row mg10">
                                                   <div class="col-md-6">
                                                      <input type="text" disabled name="sid[]" multiple
                                                         class="form-control fileInput" value="<?= $md['filename']; ?>"
                                                         title="<?= $md['filename']; ?>" id="pmmd">
                                                   </div>
                                                   <div class="col-md-6">
                                                      <a class="btn btn-success"
                                                         href="uploads/<?= $patientDetails['province']; ?><?= $patientDetails['krollId']; ?>/<?= $md['module']; ?>/<?= $md['filename']; ?>"
                                                         download><i title="Download Attachment"
                                                            class="fa fa-download"></i></a>
                                                      <a class="btn btn-info text-white"
                                                         href="uploads/<?= $patientDetails['province']; ?><?= $patientDetails['krollId']; ?>/<?= $md['module']; ?>/<?= $md['filename']; ?>"
                                                         target="_blank"><i title="View Attachment" class="fa fa-eye"></i></a>
                                                      <button type="button" data-id="<?= $md['id']; ?>"
                                                         class="btn btn-danger deleteDocument" id="delete"><i
                                                            title="Delete Attachment" class="fa fa-trash"></i></button>
                                                   </div>
                                                </div>
                                             <?php }
                                          } ?>


                                          <div class="row" id="fileInputs2">
                                             <div class="col-md-6">
                                                <input type="file" name="screeningDocs[]" id="sid" multiple
                                                   class="form-control fileInput">
                                             </div>
                                             <div class="col-md-6">
                                                <button type="button" class="btn btn-default" id="addRowBtn2"><i
                                                      title="Add New Attachment" class="fa fa-plus"></i></button>
                                             </div>
                                          </div>
                                       </li>

                                       <li class="col-md-4 <?= $ScrnConfirmationDate; ?>">

                                          <label class="description" for="sicd">Screening/Immunization Confirmation
                                             Date: </label>
                                          <div>
                                             <input type="date" class="form-control"
                                                value="<?php echo $patientDetails['sicd']; ?>" id="sicd" name="sicd"
                                                placeholder="Screening/Immunization Confirmation Date">
                                          </div>

                                       </li>

                                       <li class="clearfix"></li>


                                       <li class="col-md-4">
                                          <label class="description" for="mccb">Medical Clearance Confirmed By: </label>
                                          <div>
                                             <select class="form-control" id="mccb" name="mccb">
                                                <option value="" <?php echo ("" == $patientDetails['mccb']) ? 'selected' : ''; ?>>Medical Clearance Confirmed By</option>
                                                <option value="Jessie Reid" <?php echo ("Jessie Reid" == $patientDetails['mccb']) ? 'selected' : ''; ?>>Jessie Reid
                                                </option>
                                                <option value="Jasmine Lu" <?php echo ("Jasmine Lu" == $patientDetails['mccb']) ? 'selected' : ''; ?>>Jasmine Lu
                                                </option>
                                                <option value="Juwariah Mahmood" <?php echo ("Juwariah Mahmood" == $patientDetails['mccb']) ? 'selected' : ''; ?>>Juwariah
                                                   Mahmood</option>
                                                <option value="Kam Bhucher" <?php echo ("Kam Bhucher" == $patientDetails['mccb']) ? 'selected' : ''; ?>>Kam Bhucher
                                                </option>
                                                <option value="Lavina Chagani" <?php echo ("Lavina Chagani" == $patientDetails['mccb']) ? 'selected' : ''; ?>>Lavina
                                                   Chagani</option>
                                                <option value="Nadia Abou Elnas" <?php echo ("Nadia Abou Elnas" == $patientDetails['mccb']) ? 'selected' : ''; ?>>Nadia Abou
                                                   Elnas</option>
                                                <option value="Nadia Sutcliffe" <?php echo ("Nadia Sutcliffe" == $patientDetails['mccb']) ? 'selected' : ''; ?>>Nadia
                                                   Sutcliffe</option>
                                                <option value="Nancy Moore" <?php echo ("Nancy Moore" == $patientDetails['mccb']) ? 'selected' : ''; ?>>Nancy Moore
                                                </option>
                                                <option value="Namarit Rai" <?php echo ("Namarit Rai" == $patientDetails['mccb']) ? 'selected' : ''; ?>>Namarit Rai
                                                </option>
                                                <option value="Prachi Patel" <?php echo ("Prachi Patel" == $patientDetails['mccb']) ? 'selected' : ''; ?>>Prachi Patel
                                                </option>
                                                <option value="Ranvir Rai" <?php echo ("Ranvir Rai" == $patientDetails['mccb']) ? 'selected' : ''; ?>>Ranvir Rai
                                                </option>
                                                <option value="Ryan Marsall" <?php echo ("Ryan Marsall" == $patientDetails['mccb']) ? 'selected' : ''; ?>>Ryan Marsall
                                                </option>
                                                <option value="Sonia Sohal" <?php echo ("Sonia Sohal" == $patientDetails['mccb']) ? 'selected' : ''; ?>>Sonia Sohal
                                                </option>
                                                <option value="Zunera Alim" <?php echo ("Zunera Alim" == $patientDetails['mccb']) ? 'selected' : ''; ?>>Zunera Alim
                                                </option>
                                             </select>
                                          </div>
                                       </li>

                                       <li class="text-center ftitle accordion">
                                          <h3>
                                             Counseling
                                          </h3>
                                       </li>

                                       <li class="col-md-4">
                                          <label class="description" for="counselingStatus">Counseling Status: </label>
                                          <div>
                                             <select class="form-control" id="counselingStatus" name="counselingStatus">
                                                <option value=""></option>
                                                <option <?php if (isset($patientDetails['counselingStatus'])) {
                                                   if ($patientDetails['counselingStatus'] == "1") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="1">Pending - Not Yet Completed</option>
                                                <option <?php if (isset($patientDetails['counselingStatus'])) {
                                                   if ($patientDetails['counselingStatus'] == "2") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="2">Completed - Counseling Complete
                                                </option>
                                             </select>
                                          </div>
                                       </li>

                                       <li class="col-md-4">
                                          <label class="description" for="csfud">Counseling Status Follow Up Date:
                                          </label>
                                          <input type="date" class="form-control" value="<?php if (isset($patientDetails['csfud'])) {
                                             echo $patientDetails['csfud'];
                                          } ?>" id="csfud" name="csfud">
                                       </li>

                                       <li class="clearfix"></li>

                                       <li class="col-md-4">

                                          <label class="description" for="ccd">Counseling Completion Date: </label>
                                          <div>
                                             <input type="date" class="form-control" id="ccd" value="<?php if (isset($patientDetails['ccd'])) {
                                                echo $patientDetails['ccd'];
                                             } ?>" name="ccd" placeholder="Counseling Completion Date">
                                          </div>

                                       </li>

                                       <li class="col-md-4">
                                          <label class="description" for="ccby">Counseling Completed By: </label>
                                          <div>
                                             <select class="form-control" id="ccby" name="ccby">
                                                <option value="" selected="selected">Counseling Completed By</option>
                                                <option <?php if (isset($patientDetails['ccby'])) {
                                                   if ($patientDetails['ccby'] == "Jessie Reid") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="Jessie Reid">Jessie Reid</option>
                                                <option <?php if (isset($patientDetails['ccby'])) {
                                                   if ($patientDetails['ccby'] == "Juwariah Mahmood") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="Juwariah Mahmood">Juwariah
                                                   Mahmood</option>
                                                <option <?php if (isset($patientDetails['ccby'])) {
                                                   if ($patientDetails['ccby'] == "Kam Bhucher") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="Kam Bhucher">Kam Bhucher
                                                </option>
                                                <option <?php if (isset($patientDetails['ccby'])) {
                                                   if ($patientDetails['ccby'] == "Nadia Abou Elnas") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="Nadia Abou Elnas">Nadia
                                                   Abou Elnas</option>
                                                <option <?php if (isset($patientDetails['ccby'])) {
                                                   if ($patientDetails['ccby'] == "Nadia Sutcliffe") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="Nadia Sutcliffe">Nadia
                                                   Sutcliffe</option>
                                                <option <?php if (isset($patientDetails['ccby'])) {
                                                   if ($patientDetails['ccby'] == "Namarit Rai") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="Nancy Moore">Namarit Rai</option>
                                                <option <?php if (isset($patientDetails['ccby'])) {
                                                   if ($patientDetails['ccby'] == "Namarit Rai") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="Namarit Rai">Namarit Rai</option>
                                                <option <?php if (isset($patientDetails['ccby'])) {
                                                   if ($patientDetails['ccby'] == "Prachi Patel") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="Prachi Patel">Prachi Patel
                                                </option>
                                                <option <?php if (isset($patientDetails['ccby'])) {
                                                   if ($patientDetails['ccby'] == "Ranvir Rai") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="Ranvir Rai">Ranvir Rai</option>
                                                <option <?php if (isset($patientDetails['ccby'])) {
                                                   if ($patientDetails['ccby'] == "Ryan Marsall") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="Ryan Marsall">Ryan Marsall
                                                </option>
                                                <option <?php if (isset($patientDetails['ccby'])) {
                                                   if ($patientDetails['ccby'] == "Zunera Alim") {
                                                      echo 'selected';
                                                   }
                                                } ?>value="Sonia Sohal">Zunera Alim</option>
                                                <option <?php if (isset($patientDetails['ccby'])) {
                                                   if ($patientDetails['ccby'] == "Zunera Alim") {
                                                      echo 'selected';
                                                   }
                                                } ?>value="Zunera Alim">Zunera Alim</option>
                                                <option <?php if (isset($patientDetails['ccby'])) {
                                                   if ($patientDetails['ccby'] == "Jasmine Lu") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="Jasmine Lu">Jasmine Lu</option>
                                             </select>
                                          </div>
                                       </li>

                                       <li>
                                          <label class="description" for="counselingNotes">Counseling Notes: </label>
                                          <div>
                                             <textarea id="counselingNotes" name="counselingNotes" class="form-control"
                                                rows="8" cols="90"><?php if (isset($patientDetails['counselingNotes'])) {
                                                   echo $patientDetails['counselingNotes'];
                                                } ?></textarea>
                                          </div>
                                       </li>

                                       <li>
                                          <label class="description" for="screeningImmunization">Screening/Immunization
                                             Status Notes: </label>
                                          <div>
                                             <textarea id="screeningImmunization" name="screeningImmunization"
                                                class="form-control" rows="8" cols="90"><?php if (isset($patientDetails['screeningImmunization'])) {
                                                   echo $patientDetails['counselingNotes'];
                                                } ?></textarea>
                                          </div>
                                       </li>
                                    </ul>
                                    <div class="form-group text-center mar-b-0">
                                       <input type="button" value="BACK" class="btn btn-secondary back">
                                       <input type="button" value="NEXT" class="btn btn-primary next">
                                       <input type="submit" value="SAVE & NEXT" name="updateWelcomeCall" class="btn btn-primary">
                                       <input type="submit" value="SAVE" id="updateWelcomeCall" name="updateWelcomeCall"
                                          class="btn btn-success save">
                                    </div>
                                 </form>
                              </div>
                           </div>

                           <div class="form-container animated">
                              <!--<h2 class="text-center form-title">Welcome Call</h2> -->
                              <!-- FORM SECTION -->
                              <div class="row">
                              <div class="formnote2 text-left"><span class="colorred">*</span> Mandatory Fields</div>
                                 <form method="POST" class="araddpatient editWc" enctype="multipart/form-data">
                                    <!--NEW WELCOME CALL -->
                                    <ul class="inbuiltwc row">
                                    <li class="text-center ftitle accordion">
                                          <h3>
                                             Indication Details 
                                          </h3>
                                       </li>

                                       <li class="col-md-4">
                                          <label class="description" for="indication">Indications: <span
                                                class="req">*</span></label>
                                          <div>
                                                <input disabled value="<?php if (isset($patientDetails['indication'])) { echo $patientDetails['indication']; }?>" 
                                                class="form-control">
                                             <div class="invalid-feedback">Please Select Indication</div>
                                          </div>
                                       </li>
                                      
                                       <li class="clearfix"></li>

                                       <li class="col-md-4">
                                          <label class="description" for="ipmctst">Is the patient medically cleared to start treatment? </label>
                                          <div>
                                          <fieldset>
                                             <span class="flex">
                                                <input  type="radio" id="yesipmctst" <?php if(isset($indicationDetails['ipmctst'])){ echo ("Y" == $indicationDetails['ipmctst']) ? 'checked' : ''; }?>
                                                   name="ipmctst" value="Y" class="custom-radio">
                                                <label for="yesipmctst" class="radio-label">Yes</label>
                                             </span>
                                             <span class="flex">
                                                <input  type="radio" id="noipmctst" <?php if(isset($indicationDetails['ipmctst'])) { echo ("N" == $indicationDetails['ipmctst']) ? 'checked' : ''; } ?>
                                                   name="ipmctst" value="N" class="custom-radio">
                                                <label for="noipmctst" class="radio-label">No</label>
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <?php if (in_array("Asthma", explode(",", $patientDetails['indication']))) { ?>
                                       <li class="text-center ftitle accordion">
                                          <h3>
                                             Patient with Asthma
                                          </h3>
                                       </li>
                                       <li class="col-md-4">
                                          <label class="description" for="isHighDoseICS">Patient is on high dose ICS? </label>
                                          <div>
                                          <fieldset>
                                             <span class="flex">
                                                <input  type="radio" id="yesisHighDoseICS" <?php if(isset($indicationDetails['isHighDoseICS'])){ echo ("Y" == $indicationDetails['isHighDoseICS']) ? 'checked' : ''; }?>
                                                   name="isHighDoseICS" value="Y" class="custom-radio">
                                                <label for="yesisHighDoseICS" class="radio-label">Yes</label>
                                             </span>
                                             <span class="flex">
                                                <input  type="radio" id="noisHighDoseICS" <?php if(isset($indicationDetails['isHighDoseICS'])) { echo ("N" == $indicationDetails['isHighDoseICS']) ? 'checked' : ''; } ?>
                                                   name="isHighDoseICS" value="N" class="custom-radio">
                                                <label for="noisHighDoseICS" class="radio-label">No</label>
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-4">
                                          <label class="description" for="isexacerbations1">Exacerbations in the last 12 months: </label>
                                          <div>
                                          <fieldset>
                                             <span class="flex">
                                                <input  type="radio" id="isexacerbations2" <?php if(isset($indicationDetails['isexacerbations2'])){ echo ("Y" == $indicationDetails['isexacerbations2']) ? 'checked' : ''; }?>
                                                   name="isexacerbations2" value="Y" class="custom-radio">
                                                <label for="isexacerbations2" class="radio-label">>=2 or</label>
                                             </span>
                                             <span class="flex">
                                                <input  type="radio" id="isexacerbations1" <?php if(isset($indicationDetails['isexacerbations1'])) { echo ("Y" == $indicationDetails['isexacerbations1']) ? 'checked' : ''; } ?>
                                                   name="isexacerbations1" value="Y" class="custom-radio">
                                                <label for="isexacerbations1" class="radio-label">at least 1 requiring hospitalization AND/OR:</label>
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-6">
                                          <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <input  type="radio" id="iseosCount" <?php if(isset($indicationDetails['eosCount'])){ echo ($indicationDetails['eosCount']!="") ? 'checked' : ''; }?>
                                                   name="iseosCount" value="Y" class="custom-radio">
                                                <label for="iseosCount" class="radio-label wimax">Blood eosinophil (EOS) count >= 150 cells/ul:</label>
                                                <input type="text" class="form-control" name="eosCount" id="eosCount" value="<?php if(isset($indicationDetails['eosCount'])){ echo $indicationDetails['eosCount']; }?>"> OR:
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-6">
                                          <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <input  type="radio" id="isfenoLevel" <?php if(isset($indicationDetails['fenoLevel'])){ echo ($indicationDetails['fenoLevel']!="") ? 'checked' : ''; }?>
                                                   name="isfenoLevel" value="Y" class="custom-radio">
                                                <label for="isfenoLevel" class="radio-label wimax">FeNO level >=25 ppb:</label>
                                                <input type="text" class="form-control" name="fenoLevel" id="fenoLevel" value="<?php if(isset($indicationDetails['fenoLevel'])){ echo $indicationDetails['fenoLevel']; }?>"> OR:
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-6">
                                          <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <input  type="radio" id="isscWeeks" <?php if(isset($indicationDetails['scWeeks'])){ echo ($indicationDetails['scWeeks']!="") ? 'checked' : ''; }?>
                                                   name="isscWeeks" value="Y" class="custom-radio">
                                                <label for="isscWeeks" class="radio-label wimax">Systemic corticosteroids:</label>
                                                <input type="text" class="form-control" name="scWeeks" id="scWeeks" value="<?php if(isset($indicationDetails['scWeeks'])){ echo $indicationDetails['scWeeks']; }?>"> 
                                                 <span class="wimax">weeks. Dosing:</span>
                                                <input type="text" class="form-control" name="scDosing" id="scDosing" value="<?php if(isset($indicationDetails['scDosing'])){ echo $indicationDetails['scDosing']; }?>"> OR:
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-6">
                                          <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <input  type="radio" id="istotalIgE" <?php if(isset($indicationDetails['totalIgE'])){ echo ($indicationDetails['totalIgE']!="") ? 'checked' : ''; }?>
                                                   name="istotalIgE" value="Y" class="custom-radio">
                                                <label for="istotalIgE" class="radio-label wimax">Total IgE level:</label>
                                                <input type="text" class="form-control" name="totalIgE" id="totalIgE" value="<?php if(isset($indicationDetails['totalIgE'])){ echo $indicationDetails['totalIgE']; }?>">
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-6">
                                          <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <input  type="radio" id="isotherAsthmaScore" <?php if(isset($indicationDetails['otherAsthmaScore'])){ echo ($indicationDetails['otherAsthmaScore']!="") ? 'checked' : ''; }?>
                                                   name="isotherAsthmaScore" value="Y" class="custom-radio">
                                                <label for="isotherAsthmaScore" class="radio-label wimax">Other asthma-relevant test scores (specify):</label>
                                                <input type="text" class="form-control" name="otherAsthmaScore" id="otherAsthmaScore" value="<?php if(isset($indicationDetails['otherAsthmaScore'])){ echo $indicationDetails['otherAsthmaScore']; }?>">
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>
                                       <?php } if (in_array("CRSwNP", explode(",", $patientDetails['indication']))) { ?>

                                       <li class="text-center ftitle accordion">
                                          <h3>
                                             Patient with CRSwNP
                                          </h3>
                                       </li>
                                       <li class="col-md-12">
                                          <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <label for="nos" class="radio-label wimax">Number of surgeries:</label>
                                                <input type="text" class="form-control" name="nos" id="nos" value="<?php if(isset($indicationDetails['nos'])){ echo $indicationDetails['nos']; }?>"> 
                                                 <span class="wimax">Date of the last surgery (YYYY/MM/DD): </span>
                                                <input type="date" class="form-control" name="lastSurgeryDate" id="lastSurgeryDate" value="<?php if(isset($indicationDetails['lastSurgeryDate'])){ echo $indicationDetails['lastSurgeryDate']; }?>">
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-6">
                                          <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <input  type="radio" id="isSurgeryRequired" <?php if(isset($indicationDetails['isSurgeryRequired'])){ echo ($indicationDetails['isSurgeryRequired']=="Y") ? 'checked' : ''; }?>
                                                   name="isSurgeryRequired" value="Y" class="custom-radio">
                                                <label for="isSurgeryRequired" class="radio-label wiFull">Patient is not a candidate for surgery:</label><br>
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-8">
                                          <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <label for="rationale" class="radio-label wimax">Rationale:</label>
                                                <input type="text" class="form-control" name="rationale" id="rationale" value="<?php if(isset($indicationDetails['rationale'])){ echo $indicationDetails['rationale']; }?>"> 
                                               
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-8">
                                          <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <input  type="radio" id="isscWeeks2" <?php if(isset($indicationDetails['scWeeks2'])){ echo ($indicationDetails['scWeeks2']!="") ? 'checked' : ''; }?>
                                                   name="isscWeeks2" value="Y" class="custom-radio">
                                                <label for="isscWeeks2" class="radio-label wimax">Systemic corticosteroids:</label>
                                                <input type="text" class="form-control" name="scWeeks2" id="scWeeks2" value="<?php if(isset($indicationDetails['scWeeks2'])){ echo $indicationDetails['scWeeks2']; }?>"> 
                                                 <span class="wimax">weeks. Dosing:</span>
                                                <input type="text" class="form-control" name="scDosing2" id="scDosing2" value="<?php if(isset($indicationDetails['scDosing2'])){ echo $indicationDetails['scDosing2']; }?>"> OR:
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-8">
                                          <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <input  type="radio" id="isotherCrsScore" <?php if(isset($indicationDetails['otherCrsScore'])){ echo ($indicationDetails['otherCrsScore']!="") ? 'checked' : ''; }?>
                                                   name="isotherCrsScore" value="Y" class="custom-radio">
                                                <label for="isotherCrsScore" class="radio-label wimax">Other CRSwNP-relevant test scores (specify):</label>
                                                <input type="text" class="form-control" name="otherCrsScore" id="otherCrsScore" value="<?php if(isset($indicationDetails['otherCrsScore'])){ echo $indicationDetails['otherCrsScore']; }?>">
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>

                                       <li class="clearfix"></li>
                                       <li class="col-md-8">
                                          <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <label for="" class="radio-label wiFull">Current and prior treatments for asthma and/or CRSwNP:</label>
                                             </span>
                                             <?php 
                                          $treatmentStr = isset($indicationDetails['treatment']) ? $indicationDetails['treatment'] : ''; 
                                          $treatment = !empty($treatmentStr) ? explode(',', $treatmentStr) : [];
                                          $doseStr = isset($indicationDetails['dose']) ? $indicationDetails['dose'] : ''; 
                                          $dose = !empty($doseStr) ? explode(',', $doseStr) : [];
                                          $dateFromStr = isset($indicationDetails['dateFrom']) ? $indicationDetails['dateFrom'] : ''; 
                                          $dateFrom = !empty($dateFromStr) ? explode(',', $dateFromStr) : [];
                                          $dateToStr = isset($indicationDetails['dateTo']) ? $indicationDetails['dateTo'] : ''; 
                                          $dateTo = !empty($dateToStr) ? explode(',', $dateToStr) : [];
                                          ?>

                                          <table class="table-bordered table">
                                             <thead>
                                                <tr>
                                                      <th>Treatment</th>
                                                      <th>Dose</th>
                                                      <th>Date</th>
                                                      <th></th>
                                                      <th></th>
                                                </tr>
                                             </thead>
                                             <tbody>
                                                <?php for ($i = 0; $i < 3; $i++): ?>
                                                <tr>
                                                      <td>
                                                         <input type="text" name="indicationTreatment[]" class="form-control" 
                                                               value="<?php echo isset($treatment[$i]) ? htmlspecialchars($treatment[$i]) : ''; ?>"/>
                                                      </td>
                                                      <td>
                                                         <input type="text" name="indicationDose[]" class="form-control" 
                                                               value="<?php echo isset($dose[$i]) ? htmlspecialchars($dose[$i]) : ''; ?>"/>
                                                      </td>
                                                      <td>
                                                         <input type="date" name="indicationDate[]" class="form-control" 
                                                               value="<?php echo isset($dateFrom[$i]) ? htmlspecialchars($dateFrom[$i]) : ''; ?>"/>
                                                      </td>
                                                      <td>to</td>
                                                      <td>
                                                         <input type="date" name="indicationDateTo[]" class="form-control" 
                                                               value="<?php echo isset($dateTo[$i]) ? htmlspecialchars($dateTo[$i]) : ''; ?>"/>
                                                      </td>
                                                </tr>
                                                <?php endfor; ?>
                                             </tbody>
                                          </table>
                                          </fieldset>
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>

                                       <li class="col-md-12">
                                       <label for="" class="radio-label wiFull">Does the patient suffer from coexisting diseases, including: </label>
                                       <div>
                                       <?php 

                                       $coexistingDiseasesStr = isset($indicationDetails['coexistingDiseases']) ? $indicationDetails['coexistingDiseases'] : []; 
                                       $coexistingDiseases = !empty($coexistingDiseasesStr) ? explode(',', $coexistingDiseasesStr) : [];

                                       ?>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <input  type="checkbox" id="iscoAsthma"  <?php echo in_array("Asthma", $coexistingDiseases) ? 'checked' : ''; ?>
                                                   name="coexistingDiseases[]" value="Asthma" class="custom-radio">
                                                <label for="iscoAsthma" class="radio-label wiFull">Asthma:</label>

                                                <input  type="checkbox" id="iscoCRSwNP"  <?php echo in_array("CRSwNP", $coexistingDiseases) ? 'checked' : ''; ?>
                                                   name="coexistingDiseases[]" value="CRSwNP" class="custom-radio">
                                                <label for="iscoCRSwNP" class="radio-label wiFull">CRSwNP:</label>

                                                <input  type="checkbox" id="iscoAD"  <?php echo in_array("Atopic Dermatitis (AD)", $coexistingDiseases) ? 'checked' : ''; ?>
                                                   name="coexistingDiseases[]" value="Atopic Dermatitis (AD)" class="custom-radio">
                                                <label for="iscoAD" class="radio-label wiFull">Atopic Dermatitis (AD):</label>

                                                <input  type="checkbox" id="iscoAspirin" <?php echo in_array("Aspirin-exacerbated respiratory disease (AERD)", $coexistingDiseases) ? 'checked' : ''; ?>
                                                   name="coexistingDiseases[]" value="Aspirin-exacerbated respiratory disease (AERD)" class="custom-radio">
                                                <label for="iscoAspirin" class="radio-label wimax">Aspirin-exacerbated respiratory disease (AERD)</label>
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>
                                       <?php } if (in_array("EOE", explode(",", $patientDetails['indication']))) { ?>

                                       <li class="text-center ftitle accordion">
                                          <h3>
                                             Patient with EOE
                                          </h3>
                                       </li>

                                       <li class="col-md-12">
                                       <label for="istestScoreAvailable" class="radio-label wiFull">Test Scores (if available): </label>
                                       <div>
                                       <fieldset>
                                          <span class="flex ">
                                             <?php 
                                                $testScoreStr = isset($indicationDetails['testScore']) ? $indicationDetails['testScore'] : []; 
                                                $testScore = !empty($testScoreStr) ? explode(',', $testScoreStr) : [];
                                             ?>

                                             <!-- BSA Radio Button -->
                                             <input type="checkbox" id="isBSAtestScore" name="isTestScore" value="BSA" class="custom-radio"
                                                   <?php echo (!empty($testScore[0])) ? 'checked' : ''; ?>>
                                             <label for="isBSAtestScore" class="radio-label wimax">BSA:</label>
                                             <input type="text" class="form-control" name="testScore[]" value="<?php echo isset($testScore[0]) ? $testScore[0] : ''; ?>">

                                             <!-- IGA Radio Button -->
                                             <input type="checkbox" id="isIGAtestScore" name="isTestScore" value="IGA" class="custom-radio"
                                                   <?php echo (!empty($testScore[1])) ? 'checked' : ''; ?>>
                                             <label for="isIGAtestScore" class="radio-label wimax">IGA:</label>
                                             <input type="text" class="form-control" name="testScore[]" value="<?php echo isset($testScore[1]) ? $testScore[1] : ''; ?>">

                                             <!-- EASI Radio Button -->
                                             <input type="checkbox" id="isEASItestScore" name="isTestScore" value="EASI" class="custom-radio"
                                                   <?php echo (!empty($testScore[2])) ? 'checked' : ''; ?>>
                                             <label for="isEASItestScore" class="radio-label wimax">EASI:</label>
                                             <input type="text" class="form-control" name="testScore[]" value="<?php echo isset($testScore[2]) ? $testScore[2] : ''; ?>">

                                             <!-- DLQI Radio Button -->
                                             <input type="checkbox" id="isDLQItestScore" name="isTestScore" value="DLQI" class="custom-radio"
                                                   <?php echo (!empty($testScore[3])) ? 'checked' : ''; ?>>
                                             <label for="isDLQItestScore" class="radio-label wimax">DLQI</label>
                                             <input type="text" class="form-control" name="testScore[]" value="<?php echo isset($testScore[3]) ? $testScore[3] : ''; ?>">

                                             <!-- NRS Radio Button -->
                                             <input type="checkbox" id="isNRStestScore" name="isTestScore" value="NRS" class="custom-radio"
                                                   <?php echo (!empty($testScore[4])) ? 'checked' : ''; ?>>
                                             <label for="isNRStestScore" class="radio-label wimax">NRS</label>
                                             <input type="text" class="form-control" name="testScore[]" value="<?php echo isset($testScore[4]) ? $testScore[4] : ''; ?>">
                                          </span>
                                       </fieldset>
                                          </div>
                                       </li>

                                       <li class="col-md-8">
                                       <label for="ispastTherapies" class="radio-label wiFull">Past therapies: </label>
                                       <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <input  type="radio" id="isTC" <?php if(isset($indicationDetails['isTC'])){ echo ($indicationDetails['isTC']=="Y") ? 'checked' : ''; }?>
                                                   name="isTC" value="Y" class="custom-radio">
                                                <label for="isTC" class="radio-label wimax">Tropical corticosteroids: Name(s):</label>
                                                <input type="text" class="form-control" name="tcvalue" id="tcvalue" value="<?php if(isset($indicationDetails['tcvalue'])){ echo $indicationDetails['tcvalue']; }?>">
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>

                                       <li class="col-md-8">
                                       <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <input  type="radio" id="isTacrolimus" <?php if(isset($indicationDetails['isTacrolimus'])){ echo ($indicationDetails['isTacrolimus']=="Y") ? 'checked' : ''; }?>
                                                   name="isTacrolimus" value="Y" class="custom-radio">
                                                <label for="isTacrolimus" class="radio-label wimax">Tacrolimus:</label>
                                                <input type="text" class="form-control" name="tracolimusWeeks" id="tracolimusWeeks" value="<?php if(isset($indicationDetails['tracolimusWeeks'])){ echo $indicationDetails['tracolimusWeeks']; }?>">weeks.
                                                <label for="tracolimusDosing" class="radio-label wimax">Dosing:</label>
                                                <input type="text" class="form-control" name="tracolimusDosing" id="tracolimusDosing" value="<?php if(isset($indicationDetails['tracolimusDosing'])){ echo $indicationDetails['tracolimusDosing']; }?>">
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>
                                       <li class="col-md-8">
                                       <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <input  type="radio" id="isPime" <?php if(isset($indicationDetails['isPime'])){ echo ($indicationDetails['isPime']=="Y") ? 'checked' : ''; }?>
                                                   name="isPime" value="Y" class="custom-radio">
                                                <label for="isPime" class="radio-label wimax">Pimecrolimus:</label>
                                                <input type="text" class="form-control" name="pimeWeeks" id="pimeWeeks" value="<?php if(isset($indicationDetails['pimeWeeks'])){ echo $indicationDetails['pimeWeeks']; }?>">weeks.
                                                <label for="pimeDosing" class="radio-label wimax">Dosing:</label>
                                                <input type="text" class="form-control" name="pimeDosing" id="pimeDosing" value="<?php if(isset($indicationDetails['pimeDosing'])){ echo $indicationDetails['pimeDosing']; }?>">
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>
                                       <li class="col-md-8">
                                       <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <input  type="radio" id="isSystemic3" <?php if(isset($indicationDetails['isSystemic3'])){ echo ($indicationDetails['isSystemic3']=="Y") ? 'checked' : ''; }?>
                                                   name="isSystemic3" value="Y" class="custom-radio">
                                                <label for="isSystemic3" class="radio-label wimax">Systemic corticosteroids:</label>
                                                <input type="text" class="form-control" name="systemicWeeks3" id="systemicWeeks3" value="<?php if(isset($indicationDetails['systemicWeeks3'])){ echo $indicationDetails['systemicWeeks3']; }?>">weeks.
                                                <label for="systemicDosing3" class="radio-label wimax">Dosing:</label>
                                                <input type="text" class="form-control" name="systemicDosing3" id="systemicDosing3" value="<?php if(isset($indicationDetails['systemicDosing3'])){ echo $indicationDetails['systemicDosing3']; }?>">
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>
                                       <li class="col-md-8">
                                       <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <input  type="radio" id="isImmuno" <?php if(isset($indicationDetails['isImmuno'])){ echo ($indicationDetails['isImmuno']=="Y") ? 'checked' : ''; }?>
                                                   name="isImmuno" value="Y" class="custom-radio">
                                                <label for="isImmuno" class="radio-label wiFull">Immunosuppressants:</label>
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>

                                     <li class="col-md-8">
                                       <div>
                                          <fieldset>
                                             <span class="flex wiFull">

                                                <input  type="radio" id="isMethotrexate" <?php if(isset($indicationDetails['isMethotrexate'])){ echo ($indicationDetails['isMethotrexate']!="") ? 'checked' : ''; }?>
                                                   name="isMethotrexate" value="Y" class="custom-radio">
                                                <label for="isMethotrexate" class="radio-label wimax">Methotrexate:</label>

                                                <input type="text" class="form-control" name="methotrexateWeeks" id="methotrexateWeeks" value="<?php if(isset($indicationDetails['methotrexateWeeks'])){ echo $indicationDetails['methotrexateWeeks']; }?>">weeks.
                                                <label for="methotrexateDosing" class="radio-label wimax">Dosing:</label>
                                                <input type="text" class="form-control" name="methotrexateDosing" id="methotrexateDosing" value="<?php if(isset($indicationDetails['methotrexateDosing'])){ echo $indicationDetails['methotrexateDosing']; }?>">
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>

                                       <li class="col-md-8">
                                       <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <input  type="radio" id="isCyclosporine" <?php if(isset($indicationDetails['isCyclosporine'])){ echo ($indicationDetails['isCyclosporine']=="Y") ? 'checked' : ''; }?>
                                                   name="isCyclosporine" value="Y" class="custom-radio">
                                                <label for="isCyclosporine" class="radio-label wimax">Cyclosporine:</label>
                                                <input type="text" class="form-control" name="cyclosporineWeeks" id="cyclosporineWeeks" value="<?php if(isset($indicationDetails['cyclosporineWeeks'])){ echo $indicationDetails['cyclosporineWeeks']; }?>">weeks.
                                                <label for="cyclosporineDosing" class="radio-label wimax">Dosing:</label>
                                                <input type="text" class="form-control" name="cyclosporineDosing" id="cyclosporineDosing" value="<?php if(isset($indicationDetails['cyclosporineDosing'])){ echo $indicationDetails['cyclosporineDosing']; }?>">
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>

                                       <li class="col-md-12">
                                       <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <input  type="radio" id="isOther" <?php if(isset($indicationDetails['isOther'])){ echo ($indicationDetails['isOther']!="") ? 'checked' : ''; }?>
                                                   name="isOther" value="Y" class="custom-radio">
                                                <label for="isOther" class="radio-label wimax">Others:</label>
                                                <input type="text" class="form-control" name="otherName" id="otherName" value="<?php if(isset($indicationDetails['otherName'])){ echo $indicationDetails['otherName']; }?>"> :
                                                <input type="text" class="form-control" name="otherWeeks" id="otherWeeks" value="<?php if(isset($indicationDetails['otherWeeks'])){ echo $indicationDetails['otherWeeks']; }?>">weeks.
                                                <label for="otherDosing" class="radio-label wimax">Dosing:</label>
                                                <input type="text" class="form-control" name="otherDosing" id="otherDosing" value="<?php if(isset($indicationDetails['otherDosing'])){ echo $indicationDetails['otherDosing']; }?>">
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>

                                       <li class="col-md-12">
                                                <label for="refractoryIneligible" class="radio-label wiFull">Ineligible (i.e., contraindication, refractory) if applicable:</label>
                                       </li>

                                       <li class="col-md-12">
                                       <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <input  type="radio" id="isPhoto" <?php if(isset($indicationDetails['isPhoto'])){ echo ($indicationDetails['isPhoto']=="Y") ? 'checked' : ''; }?>
                                                   name="isPhoto" value="Y" class="custom-radio">
                                                <label for="isPhoto" class="radio-label wimax">Phototherapy:</label>
                                       
                                                <input type="text" class="form-control" name="photoWeeks" id="photoWeeks" value="<?php if(isset($indicationDetails['photoWeeks'])){ echo $indicationDetails['photoWeeks']; }?>">weeks.
                                                <label for="notAccessibleReason" class="radio-label wimax">Not accessible. Reason:</label>
                                                <input type="text" class="form-control" name="notAccessibleReason" id="notAccessibleReason" value="<?php if(isset($indicationDetails['notAccessibleReason'])){ echo $indicationDetails['notAccessibleReason']; }?>">
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>

                                       <li class="col-md-8">
                                       <div>
                                          <fieldset>
                                             <span class="flex wiFull">
                                                <input  type="radio" id="isNoAccessToInfo" <?php if(isset($indicationDetails['isNoAccessToInfo'])){ echo ($indicationDetails['isNoAccessToInfo']=="Y") ? 'checked' : ''; }?>
                                                   name="isNoAccessToInfo" value="Y" class="custom-radio">
                                                <label for="isNoAccessToInfo" class="radio-label wiFull">No access to information:</label>
                                             </span>
                                          </fieldset>
                                          </div>
                                       </li>
                                       <hr>
                                       <li class="col-md-12">
                                          <p>I hereby confirm the patient:</p>
                                          <ul>
                                             <li>has a documented diagnosis of eosinophilic esophagitis confirmed by endoscopy and is >=12 years of age, weighing at least 40 kg</li>
                                             <li>continues to experience symptoms of eosinophilic esophagitis despite treatment including but not limited to dysphagia,food impaction,and chest pain</li>
                                          </ul>
                                          <p><b>AND</b></p>
                                          <ul>
                                             <li>disease is inadequately controlled by treatment with:</li>
                                             <li>
                                                <fieldset>
                                                   <span class="flex wiFull">
                                                      <input  type="radio" id="isHighDosePPI" <?php if(isset($indicationDetails['isHighDosePPI'])){ echo ($indicationDetails['isHighDosePPI']=="Y") ? 'checked' : ''; }?>
                                                         name="isHighDosePPI" value="Y" class="custom-radio">
                                                      <label for="isHighDosePPI" class="radio-label wiFull">high dose PPI fpr a minimum 8 weeks, and/or</label>
                                                   </span>
                                                </fieldset>
                                             </li>
                                             <li>
                                                <fieldset>
                                                   <span class="flex wiFull">
                                                      <input  type="radio" id="isTopicalCorticosteroids" <?php if(isset($indicationDetails['isTopicalCorticosteroids'])){ echo ($indicationDetails['isTopicalCorticosteroids']=="Y") ? 'checked' : ''; }?>
                                                         name="isTopicalCorticosteroids" value="Y" class="custom-radio">
                                                      <label for="isTopicalCorticosteroids" class="radio-label wiFull">topical corticosteroids for a minimum of 6 weeks or is not eligible for treatment with topical corticosteroids</label>
                                                   </span>
                                                </fieldset>
                                             </li>
                                          </ul>
                                                <fieldset>
                                                   <span class="flex wiFull">
                                                  
                                                      <label for="additionalRelevantMedication" class="radio-label wimax">Additional relevant medication:</label>
                                                      <input type="text" class="form-control" name="additionalRelevantMedication" id="additionalRelevantMedication" value="<?php if(isset($indicationDetails['additionalRelevantMedication'])){ echo $indicationDetails['additionalRelevantMedication']; }?>">
                                                      </span>
                                                </fieldset>
                                       </li>
                                       <?php }  ?>
                                       </ul>
                                       <div class="form-group text-center mar-b-0">
                                       <input type="submit" value="SAVE" name="saveIndicationDetails" class="btn btn-success save">
                                       </div>
                                       </form>
                                       <form method="POST" class="araddpatient editWc" enctype="multipart/form-data">
                                       <ul class="inbuiltwc row">
                                       <li class="text-center ftitle accordion">
                                          <h3>
                                             Coverage Details
                                          </h3>
                                       </li>

                                       <li>
                                          <label class="description" for="notesForNav">Notes For Navigator: </label>
                                          <div>
                                             <textarea id="notesForNav" name="notesForNav" class="form-control" rows="8"
                                                cols="90"><?php if (isset($repatientDetails['notesForNav'])) {
                                                   echo $repatientDetails['notesForNav'];
                                                } ?></textarea>
                                          </div>
                                       </li>

                                       <li class="col-md-4">
                                          <label class="description" for="reimbursementStatus">Reimbursement Status
                                          </label>
                                          <div>
                                             <select class="form-control" id="reimbursementStatus"
                                                name="reimbursementStatus">
                                                <option value="" selected="selected"></option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "1") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="1">Pending - SA Submitted by RX Connect
                                                </option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "2") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="2">Pending - SA Submitted by PSP</option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "3") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="3">Pending - EAP Submitted</option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "4") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="4">Pending - Limited Use Code</option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "8") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="8">Pending - Appeal Submission</option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "11") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="11">Pending - patient to be enrolled into
                                                   PSP</option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "12") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="12">Pending - PSP to initiate SA process
                                                </option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "13") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="13">Pending - patient to provide PSP with
                                                   more information</option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "14") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="14">Pending - Patient to provide Rx
                                                   Connect with more information</option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "15") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="15">Pending - Patient Signature</option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "16") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="16">Pending - Physician Signature
                                                </option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "17") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="17">Pending- Insurance decision</option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "10") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="10">Complete - Free of Charge</option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "6") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="6">Complete - Coverage Established
                                                </option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "24") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="24">Complete - Coverage Established- PPN
                                                </option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "25") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="25">Complete - Coverage Established - Not
                                                   using Rx Pharmacy</option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "26") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="26">Complete- Coverage Established - Not
                                                   using Rx Connect</option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "27") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="27">Complete- Compassionate</option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "30") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="30">Patient prefers local pharmacy - No
                                                   reimb</option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "7") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="7">Reimbursement Not Required</option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "18") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="18">PSP to start EAP process</option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "19") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="19">Rx Connect to start EAP Process
                                                </option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "20") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="20">Rx Connect to start SA process
                                                </option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "21") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="21">Pending EAP decision</option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "22") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="22">Patient transfered out</option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "23") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="23">Pending Medical clearance from MD
                                                </option>
                                                <option <?php if (isset($repatientDetails['reimbursementStatus'])) {
                                                   if ($repatientDetails['reimbursementStatus'] == "37") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="37">Pending - Screening Test/Immunization
                                                </option>
                                             </select>
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>

                                       <li class="col-md-4">
                                          <label for="status">Patient Status:</label>
                                          <select id="pstatus" class="form-control" name="pstatus">
                                             <option value="">Select Patient Status</option>
                                             <?php foreach ($pstatus as $pa) { ?>
                                                <option <?php if (isset($repatientDetails['patientStatus'])) {
                                                   if ($repatientDetails['patientStatus'] == $pa['StatusID']) {
                                                      echo 'selected';
                                                   }
                                                } ?> value="<?= $pa['StatusID']; ?>"><?= $pa['StatusName']; ?></option>
                                             <?php } ?>
                                             <!-- Options will be dynamically populated via jQuery -->
                                          </select>

                                       </li>
                                       <li class="col-md-4">
                                          <label for="substatus">Patient Substatus:</label>
                                          <select id="substatus" class="form-control" name="substatus" <?php if (isset($repatientDetails['patientSubStatus'])) {
                                             if ($repatientDetails['patientSubStatus'] == '') {
                                                echo 'disabled';
                                             }
                                          } ?>>

                                             <?php if (isset($repatientDetails['patientSubStatus'])) {
                                                if ($repatientDetails['patientSubStatus'] != '') { ?>
                                                   <option <?php if (isset($repatientDetails['patientSubStatus'])) {
                                                      echo 'selected';
                                                   } ?>
                                                      value="<?php if (isset($repatientDetails['patientSubStatus'])) {
                                                         echo $repatientDetails['patientSubStatus'];
                                                      } ?>">
                                                      <?php if (isset($repatientDetails['patientSubStatus'])) {
                                                         echo getPatientSubStatus($pdo, $repatientDetails['patientSubStatus']);
                                                      } ?>
                                                   </option>
                                                <?php }
                                             } else { ?>
                                                <option value="">Select Substatus</option>
                                             <?php } ?>
                                             <!-- Options will be dynamically populated based on Patient Status -->
                                          </select>

                                       </li>
                                       <li>
                                          <label class="description" for="rsn">Reimbursement Status Notes: </label>
                                          <div>
                                             <textarea id="rsn" name="rsn" class="form-control" rows="8" cols="90"><?php if (isset($repatientDetails['rsn'])) {
                                                echo $repatientDetails['notesForNav'];
                                             } ?></textarea>
                                          </div>
                                       </li>

                                       <li class="col-md-5">
                                          <label class="description">Reimbursement Status Follow Up Date: </label>
                                          <input type="date" class="form-control" value="<?php if (isset($repatientDetails['rsfud'])) {
                                             echo $repatientDetails['rsfud'];
                                          } ?>" id="rsfud" name="rsfud">
                                       </li>

                                       <li class="col-md-4">
                                          <label class="description">Reimbursement Completion Date: </label>
                                          <input type="date" class="form-control" value="<?php if (isset($repatientDetails['rcd'])) {
                                             echo $repatientDetails['rcd'];
                                          } ?>" id="rcd" name="rcd" min="<?php echo date('Y-m-d'); ?>">
                                       </li>
                                       <li class="col-md-4 fixselect">
                                          <label class="description">Reimbursement Completed By: </label>
                                          <select class="form-control select2bs4" id="rcby" name="rcby">

                                             <?php $rcby = '';
                                             if (isset($repatientDetails['rcby'])) {
                                                $rcby = $repatientDetails['rcby'];
                                             } ?>
                                             <option value="" <?= ($rcby == "") ? 'selected' : '' ?>></option>
                                             <?php foreach ($employees as $emp) { ?>
                                                <option value="<?= $emp['empId']; ?>" <?= ($rcby == $emp['empId']) ? 'selected' : '' ?>><?= $emp['userName']; ?></option>

                                             <?php } ?>
                                          </select>
                                       </li>

                                       <li class="text-center ftitle accordion">
                                          <h3>
                                             Physician Details
                                          </h3>
                                       </li>
                                       <li class="col-md-4 physicianId">
                                          <label class="description">Physician Name: </label>
                                          <select class="form-control" id="physicianId" name="physicianId">

                                             <?php $physicianId = '';
                                             if (isset($repatientDetails['physicianId'])) {
                                                $physicianId = $repatientDetails['physicianId'];
                                             } ?>
                                             <option value="" <?= ($physicianId == "") ? 'selected' : '' ?>></option>
                                             <option value="0">Add New Physician</option>
                                             <?php foreach ($physicians as $physician) { ?>
                                                <option value="<?= $physician['id']; ?>"
                                                   <?= ($physicianId == $physician['id']) ? 'selected' : '' ?>>
                                                   <?= $physician['firstName']; ?>
                                                   <?= $physician['lastName']; ?>
                                                </option>

                                             <?php } ?>
                                          </select>
                                       </li>
                                       <li class="clearfix"></li>

                                       <li class="col-md-4 hidden customPhysician physicianDetails">
                                          <label class="description">Physician First Name: </label>
                                          <input type="text" name="physicianFirstName" class="form-control" value="<?php if (isset($physicianDetails['firstName'])) {
                                             echo $physicianDetails['fullName'];
                                          } ?>" id="physicianFirstName">
                                       </li>
                                       <li class="col-md-4 hidden customPhysician physicianDetails">
                                          <label class="description">Physician Last Name: </label>
                                          <input type="text" name="physicianLastName" class="form-control" value="<?php if (isset($physicianDetails['lastName'])) {
                                             echo $physicianDetails['lastName'];
                                          } ?>" id="physicianLastName">
                                       </li>
                                       <li class="clearfix"></li>

                                       <li class="col-md-4 physicianDetails">
                                          <label class="description">Physician Hospital/Site : </label>
                                          <input type="text" name="hospital" class="form-control" value="<?php if (isset($physicianDetails['hospital'])) {
                                             echo $physicianDetails['hospital'];
                                          } ?>" id="hospital">
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-4 physicianDetails">
                                          <label class="description">Physician Primary Specialty: </label>
                                          <input type="text" name="primarySpecialty" class="form-control" value="<?php if (isset($physicianDetails['primarySpecialty'])) {
                                             echo $physicianDetails['primarySpecialty'];
                                          } ?>" id="primarySpecialty">
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-4 physicianDetails">
                                          <label class="description">Physician Street Address: </label>
                                          <input type="text" name="physicianAddress" class="form-control" value="<?php if (isset($physicianDetails['streetAddress'])) {
                                             echo $physicianDetails['streetAddress'];
                                          } ?>" id="physicianAddress">
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-4 physicianDetails">
                                          <label class="description">Physician City: </label>
                                          <input type="text" name="physicianCity" class="form-control" value="<?php if (isset($physicianDetails['city'])) {
                                             echo $physicianDetails['city'];
                                          } ?>" id="physicianCity">
                                       </li>

                                       <li class="col-md-4 physicianDetails">
                                          <label class="description">Physician Province: </label>
                                          <select class="form-control" name='physicianProvince' required
                                             id="physicianProvince">
                                             <option>Select Province</option>
                                             <?php foreach ($provinces as $province) { ?>
                                                <option <?php if (isset($physicianDetails['province'])) {
                                                   if ($physicianDetails['province'] == $province['provinceName']) {
                                                      echo 'selected';
                                                   }
                                                } ?> value="<?php echo $province['provinceName']; ?>">
                                                   <?php echo $province['provinceName']; ?>
                                                </option>
                                             <?php } ?>
                                          </select>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-4 physicianDetails">
                                          <label class="description">Physician Postal Code: </label>
                                          <input type="text" name="physicianPostalCode" class="form-control" value="<?php if (isset($physicianDetails['postalCode'])) {
                                             echo $physicianDetails['postalCode'];
                                          } ?>" id="physicianPostalCode">
                                       </li>


                                       <li class="clearfix"></li>

                                       <li class="col-md-4 physicianDetails">
                                          <label class="description">Physician Contact Number: </label>
                                          <input type="text" name="physicianPhone" class="form-control" value="<?php if (isset($physicianDetails['phone'])) {
                                             echo $physicianDetails['phone'];
                                          } ?>" id="physicianPhone" data-inputmask="&quot;mask&quot;: &quot;(999) 999-9999&quot;"
                                                data-mask="" inputmode="text">
                                       </li>
                                       <li class="col-md-4 physicianDetails">
                                          <label class="description">Physician Email Address: </label>
                                          <input type="email" name="physicianEmail" class="form-control" value="<?php if (isset($physicianDetails['email'])) {
                                             echo $physicianDetails['email'];
                                          } ?>" id="physicianEmail">
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-4 physicianDetails">
                                          <label class="description">Physician Fax: </label>
                                          <input type="text" name="physicianFax" class="form-control" value="<?php if (isset($physicianDetails['fax'])) {
                                             echo $physicianDetails['fax'];
                                          } ?>" id="physicianFax">
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="customPhysician hidden">
                                          <button name="submitPhysician" class="btn btn-primary"
                                             id="submitPhysician">Save</button>
                                          <button name="resetPhysician" class="btn btn-secondary"
                                             id="resetPhysician">Reset</button>
                                       </li>

                                       <li class="text-center ftitle accordion">
                                          <h3>
                                             Pharmacy Details
                                          </h3>
                                       </li>
                                       <li class="col-md-4">
                                          <label class="description" for="pharmacyType">Pharmacy Type: </label>
                                          <div>
                                             <select id="pharmacyType" name="pharmacyType" class="form-control"
                                                autocomplete="off">
                                                <option value="" <?php if (isset($repatientDetails['pharmacyType'])) {
                                                   if ($repatientDetails['pharmacyType'] == '') {
                                                      echo 'selected';
                                                   }
                                                } ?>>Select Pharmacy</option>
                                                <option value="Rx Connect Specialty Pharmacy" <?php if (isset($repatientDetails['pharmacyType'])) {
                                                   if ($repatientDetails['pharmacyType'] == 'Rx Connect Specialty Pharmacy') {
                                                      echo 'selected';
                                                   }
                                                } ?>>Rx Connect Specialty Pharmacy</option>
                                                <option value="Rx Connect Pharmacy Solutions (Alberta)" <?php if (isset($repatientDetails['pharmacyType'])) {
                                                   if ($repatientDetails['pharmacyType'] == 'Rx Connect Pharmacy Solutions (Alberta)') {
                                                      echo 'selected';
                                                   }
                                                } ?>>Rx Connect Pharmacy Solutions (Alberta)</option>
                                                <option value="Other" <?php if (isset($repatientDetails['pharmacyType'])) {
                                                   if ($repatientDetails['pharmacyType'] == 'Other') {
                                                      echo 'selected';
                                                   }
                                                } ?>>Other</option>
                                             </select>
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-4">
                                          <label class="description" for="pharmacyName">Pharmacy Name: </label>
                                          <div>
                                             <input id="pharmacyName" name="pharmacyName" class="form-control"
                                                type="text" value="<?php if (isset($repatientDetails['pharmacyName'])) {
                                                   echo $repatientDetails['pharmacyName'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-4">
                                          <label class="description" for="pharmacyPhone">Pharmacy Phone: </label>
                                          <div>
                                             <input id="pharmacyPhone" name="pharmacyPhone" class="form-control"
                                                type="text" value="<?php if (isset($repatientDetails['pharmacyPhone'])) {
                                                   echo $repatientDetails['pharmacyPhone'];
                                                } ?>" autocomplete="off" data-inputmask="&quot;mask&quot;: &quot;(999) 999-9999&quot;"
                                                data-mask="" inputmode="text">
                                          </div>
                                       </li>
                                       <li class="col-md-4">
                                          <label class="description" for="pharmacyFax">Pharmacy Fax: </label>
                                          <div>
                                             <input id="pharmacyFax" name="pharmacyFax" class="form-control" type="text"
                                                value="<?php if (isset($repatientDetails['pharmacyFax'])) {
                                                   echo $repatientDetails['pharmacyFax'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="text-center ftitle accordion">
                                          <h3>Clinic Details</h3>
                                       </li>
                                       <li class="col-md-4">
                                          <label class="description" for="treatmentFacilityName">Treatment Facility
                                             Name: </label>
                                          <div>
                                             <input id="treatmentFacilityName" name="treatmentFacilityName"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['treatmentFacilityName'])) {
                                                   echo $repatientDetails['treatmentFacilityName'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-4">
                                          <label class="description" for="treatmentFacilityType">Treatment Facility
                                             Type: </label>
                                          <div>
                                             <input id="treatmentFacilityType" name="treatmentFacilityType"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['treatmentFacilityType'])) {
                                                   echo $repatientDetails['treatmentFacilityType'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-4">
                                          <label class="description" for="treatmentFacilityProvince">Treatment Facility
                                             Province: </label>
                                          <div>
                                             <select class="form-control" name='treatmentFacilityProvince' required
                                                id="treatmentFacilityProvince">
                                                <option>Select Province</option>
                                                <?php foreach ($provinces as $province) { ?>
                                                   <option <?php if (isset($repatientDetails['treatmentFacilityProvince'])) {
                                                      if ($repatientDetails['treatmentFacilityProvince'] == $province['provinceName']) {
                                                         echo 'selected';
                                                      }
                                                   } ?>
                                                      value="<?php echo $province['provinceName']; ?>">
                                                      <?php echo $province['provinceName']; ?>
                                                   </option>
                                                <?php } ?>
                                             </select>

                                          </div>
                                       </li>
                                       <li class="col-md-4">
                                          <label class="description" for="treatmentFacilityPostalCode">Treatment
                                             Facility Postal Code: </label>
                                          <div>
                                             <input id="treatmentFacilityPostalCode" name="treatmentFacilityPostalCode"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['treatmentFacilityPostalCode'])) {
                                                   echo $repatientDetails['treatmentFacilityPostalCode'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>


                                       <li class="text-center ftitle accordion">
                                          <h3>Primary Plan</h3>
                                       </li>

                                       <li class="col-md-4">
                                          <label class="description" for="ipal">Insurance Provider (all locations):
                                          </label>
                                          <div>
                                             <select class="form-control" id="ipal" name="ipal">
                                                <option value="" <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "") {
                                                      echo 'selected';
                                                   }
                                                } ?>></option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "52") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="52">Adjudicare</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "57") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="57">Alberta Blue Cross (Group)</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "58") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="58">Alberta Blue Cross (Non group)
                                                </option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "53") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="53">Benecaid</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "59") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="59">BC Pharmacare</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "4") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="4">
                                                   Canada Life</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "5") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="5">
                                                   Chamber of Commerce</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "6") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="6">
                                                   Claim secure</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "7") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="7">
                                                   Coughlin Associates</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "8") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="8">
                                                   Cowan Insurance</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "9") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="9">
                                                   Desjardins</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "10") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="10">Equitable Life</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "39") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="39">Empire Life</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "11") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="11">Global Benefits</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "12") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="12">GMS Insurance</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "13") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="13">Greenshield</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "14") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="14">Group Medical Services</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "15") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="15">Group Premier Medical</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "16") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="16">Group Source</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "17") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="17">Industrial Alliance</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "18") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="18">Johnson cold - RTO</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "19") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="19">Johnston Group</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "20") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="20">La Survivance</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "21") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="21">Le Capital</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "22") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="22">Local 180/183</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "23") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="23">Manion Wilkens</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "43") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="43">MDM Insurance</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "24") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="24">Manulife</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "25") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="25">Manulife Affinity Markets</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "26") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="26">Medic Construction</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "27") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="27">NIHB</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "40") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="40">NexGenRx</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "47") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="47">ODB - Seniors</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "48") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="48">
                                                   ODB - OHIP+</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "49") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="49">
                                                   ODSP</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "28") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="28">
                                                   Ontario Blue Cross</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "29") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="29">Ontario Drug Plan</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "51") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="51">Ontario Works</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "30") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="30">OTIP - Ontario Teachers</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "61") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="61">Pacific Blue Cross</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "31") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="31">RBC Insurance</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "32") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="32">
                                                   Reliable</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "33") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="33">
                                                   Rwam</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "34") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="34">
                                                   Standard Life</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "35") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="35">
                                                   Sunlife</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "36") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="36">
                                                   The Cooperators</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "37") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="37">
                                                   Trillium</option>
                                                <option <?php if (isset($repatientDetails['ipal'])) {
                                                   if ($repatientDetails['ipal'] == "50") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="50">
                                                   Veterans Affairs Canada</option>
                                             </select>
                                          </div>
                                       </li>

                                       <li class="clearfix"></li>

                                       <li class="col-md-4">
                                          <label class="description" for="Carrier">Carrier: </label>
                                          <div>
                                             <input id="Carrier" name="Carrier" class="form-control" type="text" value="<?php if (isset($repatientDetails['Carrier'])) {
                                                echo $repatientDetails['Carrier'];
                                             } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-4">
                                          <label class="description" for="groupCN">Group/Contract Number: </label>
                                          <div>
                                             <input id="groupCN" name="groupCN" class="form-control" type="text" value="<?php if (isset($repatientDetails['groupCN'])) {
                                                echo $repatientDetails['groupCN'];
                                             } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="">
                                          <label class="description" for="certificateNumber">Client ID/Certificate
                                             Number: </label>
                                          <div>
                                             <input id="certificateNumber" name="certificateNumber" value="<?php if (isset($repatientDetails['certificateNumber'])) {
                                                echo $repatientDetails['certificateNumber'];
                                             } ?>" class="form-control" type="text" value="" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="">
                                          <span class="description">Cardholder: </span>
                                          <div class="inline-flex">
                                             <fieldset>
                                                <span><input id="cardholderSelf" <?php if (isset($repatientDetails['cardholder'])) {
                                                   if ($repatientDetails['cardholder'] == "Self") {
                                                      echo 'checked';
                                                   }
                                                } ?>
                                                      name="cardholder" class="custom-radio" type="radio" value="Self"
                                                      autocomplete="off">
                                                   <label class="choice" for="cardholderSelf">Self</label>
                                                </span>
                                                <span><input id="cardholderSpouse" name="cardholder"
                                                      class="custom-radio" type="radio" value="Spouse" <?php if (isset($repatientDetails['cardholder'])) {
                                                         if ($repatientDetails['cardholder'] == "Spouse") {
                                                            echo 'checked';
                                                         }
                                                      } ?> autocomplete="off">
                                                   <label class="choice" for="cardholderSpouse">Spouse</label>
                                                </span>
                                                <span><input id="cardholderDependent" name="cardholder"
                                                      class="custom-radio" type="radio" value="Dependent" <?php if (isset($repatientDetails['cardholder'])) {
                                                         if ($repatientDetails['cardholder'] == "Dependent") {
                                                            echo 'checked';
                                                         }
                                                      } ?> autocomplete="off">
                                                   <label class="choice" for="cardholderDependent">Dependent</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>
                                       <?php $cardholder1 = 'hidden';
                                       if (isset($repatientDetails['cardholder'])) {
                                          if ($repatientDetails['cardholder'] == "Spouse") {
                                             $cardholder1 = '';
                                          }
                                       }
                                       if (isset($repatientDetails['cardholder'])) {
                                          if ($repatientDetails['cardholder'] == "Dependent") {
                                             $cardholder1 = '';
                                          }
                                       }
                                       ?>
                                       <li class="<?= $cardholder1; ?> cardholderShow">
                                          <fieldset>
                                             <label class="description">Cardholder Name (Primary): </label>
                                             <div class="row">
                                                <span class="col-md-4 simple_name_1 nextline">
                                                   <input id="cardFirst" name="cardholderName1" type="text" value="<?php if (isset($repatientDetails['cardholderName1'])) {
                                                      echo $repatientDetails['cardholderName1'];
                                                   } ?>" class="form-control" maxlength="125" size="8" value=""
                                                      autocomplete="off">
                                                   <label class="" for="cardFirst">First</label>
                                                </span>

                                                <span class="col-md-4 simple_name_2 nextline">
                                                   <input id="cardLast" name="cardholderName2" type="text" value="<?php if (isset($repatientDetails['cardholderName2'])) {
                                                      echo $repatientDetails['cardholderName2'];
                                                   } ?>" class="form-control" maxlength="125" size="14" value=""
                                                      autocomplete="off">
                                                   <label for="cardLast">Last</label>
                                                </span>
                                             </div>

                                          </fieldset>
                                       </li>

                                       <li class="<?= $cardholder1; ?> col-md-4 cardholderShow">
                                          <fieldset>
                                             <label class="description">Cardholder Date of Birth (Primary): </label>
                                             <input type="date" class="form-control" id="cardholderDOB" value="<?php if (isset($repatientDetails['cardholderDOB'])) {
                                                echo $repatientDetails['cardholderDOB'];
                                             } ?>" name="cardholderDOB">
                                          </fieldset>
                                       </li>
                                       <li class="clearfix"></li>

                                       <li class="col-md-4">
                                          <label class="description" for="coveragePercentage">Coverage percentage:
                                          </label>
                                          <div class="inline-flex">

                                             <input id="coveragePercentage" name="coveragePercentage"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['coveragePercentage'])) {
                                                   echo $repatientDetails['coveragePercentage'];
                                                } ?>" autocomplete="off">
                                             <span class="block right">%</span>
                                          </div>
                                       </li>
                                       <li id="li_298" class="col-md-4">
                                          <label class="description" for="coinsurancePayment">Coinsurance payment:
                                          </label>
                                          <div class="inline-flex">
                                             <span class="block">$</span>
                                             <input id="coinsurancePayment" name="coinsurancePayment" value="<?php if (isset($repatientDetails['coinsurancePayment'])) {
                                                echo asDollarsx($repatientDetails['coinsurancePayment']);
                                             } ?>" class="form-control " type="text" value="" autocomplete="off">
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>

                                       <li class="col-md-4">
                                          <label class="description" for="deductible">Deductible: </label>
                                          <div>
                                             <input id="deductible" name="deductible" class="form-control" value="<?php if (isset($repatientDetails['deductible'])) {
                                                echo $repatientDetails['deductible'];
                                             } ?>" type="text" value="" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-4">
                                          <label class="description" for="annualMax">Annual Max: </label>
                                          <div>
                                             <input id="annualMax" name="annualMax" class="form-control" value="<?php if (isset($repatientDetails['annualMax'])) {
                                                echo $repatientDetails['annualMax'];
                                             } ?>" type="text" value="" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="clearfix"></li>
                                       <li class="col-md-4">
                                          <label class="description" for="lifetimeMax">Lifetime Max: </label>
                                          <div>
                                             <input id="lifetimeMax" name="lifetimeMax" class="form-control" value="<?php if (isset($repatientDetails['lifetimeMax'])) {
                                                echo $repatientDetails['lifetimeMax'];
                                             } ?>" type="text" value="" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-4">
                                          <label class="description" for="copayMax">Copay Max (Sliding Copay): </label>
                                          <div>
                                             <input id="copayMax" name="copayMax" class="form-control" type="text"
                                                value="<?php if (isset($repatientDetails['copayMax'])) {
                                                   echo $repatientDetails['copayMax'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="">
                                          <span class="description">SA/EAP Required (Primary Plan)? </span>
                                          <div class="inline-flex">
                                             <fieldset>
                                                <span><input id="sarequiredYes" name="sarequired" class="custom-radio"
                                                      type="radio" value="Y" <?php if (isset($repatientDetails['sarequired'])) {
                                                         if ($repatientDetails['sarequired'] == "Y") {
                                                            echo 'checked';
                                                         }
                                                      } ?>
                                                      autocomplete="off">
                                                   <label class="choice" for="sarequiredYes">Yes</label>
                                                </span>
                                                <span><input id="sarequiredNo" name="sarequired" class="custom-radio"
                                                      type="radio" value="N" <?php if (isset($repatientDetails['sarequired'])) {
                                                         if ($repatientDetails['sarequired'] == "N") {
                                                            echo 'checked';
                                                         }
                                                      } ?>
                                                      autocomplete="off">
                                                   <label class="choice" for="sarequiredNo">No</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>
                                       <?php $sarequiredshow = 'hidden';
                                       if (isset($repatientDetails['sarequired'])) {
                                          if ($repatientDetails['sarequired'] == "Y") {
                                             $sarequiredshow = '';
                                          }
                                       } ?>

                                       <li class="<?= $sarequiredshow; ?> col-md-4 sarequiredshow">
                                          <fieldset>
                                             <label class="description" id="dAppealSub">SA Initiated Date (Primary):
                                             </label>
                                             <div>
                                                <input type="date" class="form-control" id="dAppealSub" value="<?php if (isset($repatientDetails['dAppealSub'])) {
                                                   echo $repatientDetails['dAppealSub'];
                                                } ?>" name="dAppealSub">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="clearfix <?= $sarequiredshow; ?> sarequiredshow"></li>

                                       <li class="<?= $sarequiredshow; ?> col-md-4 sarequiredshow">
                                          <fieldset>
                                             <label class="description" id="saMdSentDate">SA Sent to MD Date (Primary):
                                             </label>
                                             <div>
                                                <input type="date" class="form-control" id="saMdSentDate" value="<?php if (isset($repatientDetails['saMdSentDate'])) {
                                                   echo $repatientDetails['saMdSentDate'];
                                                } ?>" name="saMdSentDate">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="<?= $sarequiredshow; ?> col-md-4 sarequiredshow">
                                          <fieldset>
                                             <label class="description" id="saMdReceivedDate">SA Received by MD Date
                                                (Primary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saMdReceivedDate" value="<?php if (isset($repatientDetails['saMdReceivedDate'])) {
                                                   echo $repatientDetails['saMdReceivedDate'];
                                                } ?>" name="saMdReceivedDate">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="clearfix <?= $sarequiredshow; ?> sarequiredshow"></li>

                                       <li class="<?= $sarequiredshow; ?> col-md-4 sarequiredshow">
                                          <fieldset>
                                             <label class="description" id="saPatientSentDate">SA Sent to Patient Date
                                                (Primary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saPatientSentDate" value="<?php if (isset($repatientDetails['saPatientSentDate'])) {
                                                   echo $repatientDetails['saPatientSentDate'];
                                                } ?>" name="saPatientSentDate">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="<?= $sarequiredshow; ?> col-md-4 sarequiredshow">
                                          <fieldset>
                                             <label class="description" id="saPatientReceivedDate">SA Received by
                                                Patient Date (Primary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saPatientReceivedDate"
                                                   value="<?php if (isset($repatientDetails['saPatientReceivedDate'])) {
                                                      echo $repatientDetails['saPatientReceivedDate'];
                                                   } ?>" name="saPatientReceivedDate">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="clearfix <?= $sarequiredshow; ?> sarequiredshow"></li>

                                       <li class="<?= $sarequiredshow; ?> col-md-4 sarequiredshow">
                                          <fieldset>
                                             <label class="description">SA/EAP Submission Date (Primary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saEapSub" value="<?php if (isset($repatientDetails['saEapSub'])) {
                                                   echo $repatientDetails['saEapSub'];
                                                } ?>" name="saEapSub">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="<?= $sarequiredshow; ?> col-md-4 sarequiredshow">
                                          <fieldset>
                                             <label class="description">SA/EAP Outcome Date (Primary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saEapOutcome" value="<?php if (isset($repatientDetails['saEapOutcome'])) {
                                                   echo $repatientDetails['saEapOutcome'];
                                                } ?>" name="saEapOutcome">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="clearfix <?= $sarequiredshow; ?> sarequiredshow"></li>

                                       <li class="<?= $sarequiredshow; ?> col-md-4 sarequiredshow">
                                          <fieldset>
                                             <label class="description">SA/EAP Expiry Date (Primary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saEapExpiry" value="<?php if (isset($repatientDetails['saEapExpiry'])) {
                                                   echo $repatientDetails['saEapExpiry'];
                                                } ?>" name="saEapExpiry">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="<?= $sarequiredshow; ?> col-md-4 sarequiredshow">
                                          <fieldset>

                                             <label class="description">SA/EAP Expiry Follow Up Date (Primary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saEapExpF" value="<?php if (isset($repatientDetails['saEapExpF'])) {
                                                   echo $repatientDetails['saEapExpF'];
                                                } ?>" name="saEapExpF">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="clearfix <?= $sarequiredshow; ?> sarequiredshow"></li>

                                       <li class="<?= $sarequiredshow; ?> col-md-4 sarequiredshow">
                                          <label class="description" for="luCode">LU Code (Primary): </label>
                                          <div>
                                             <input id="luCode" name="luCode" class="form-control" type="text" value="<?php if (isset($repatientDetails['luCode'])) {
                                                echo $repatientDetails['luCode'];
                                             } ?>" autocomplete="off">
                                          </div>
                                       </li>



                                       <li class="<?= $sarequiredshow; ?> col-md-4 sarequiredshow">
                                          <fieldset>

                                             <label class="description">LU Expiry Date (Primary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="luExpiry" value="<?php if (isset($repatientDetails['luExpiry'])) {
                                                   echo $repatientDetails['luExpiry'];
                                                } ?>" name="luExpiry">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <!-- <li class="hidden sarequiredshow">
                                       <fieldset>
                                          <label class="description" id="dAppealSub">Date Appeal Submitted (Primary): </label>
                                          <div>
                                             <input type="date" class="form-control" id="dAppealSub" value="<?php if (isset($repatientDetails['dAppealSub'])) {
                                                echo $repatientDetails['dAppealSub'];
                                             } ?>" name="dAppealSub">
                                          </div>
                                       </fieldset>
                                    </li> -->


                                       <li class="">
                                          <label class="description">Does Patient Have a Secondary Plan? </label>
                                          <div class="inline-flex">
                                             <fieldset>
                                                <span><input id="dphspYes" name="dphsp" class="custom-radio"
                                                      type="radio" value="Y" <?php if (isset($repatientDetails['dphsp'])) {
                                                         if ($repatientDetails['dphsp'] == "Y") {
                                                            echo 'checked';
                                                         }
                                                      } ?>
                                                      autocomplete="off">
                                                   <label class="choice" for="dphspYes">Yes</label>
                                                </span>
                                                <span><input id="dphspNo" name="dphsp" class="custom-radio" type="radio"
                                                      value="N" <?php if (isset($repatientDetails['dphsp'])) {
                                                         if ($repatientDetails['dphsp'] == "N") {
                                                            echo 'checked';
                                                         }
                                                      } ?>
                                                      autocomplete="off">
                                                   <label class="choice" for="dphspNo">No</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>
                                       <!--Secondary Start -->
                                       <?php $secondaryShow = 'hidden';
                                       if (isset($repatientDetails['dphsp'])) {
                                          if ($repatientDetails['dphsp'] == "Y") {
                                             $secondaryShow = '';
                                          }
                                       } ?>
                                       <li class="text-center ftitle accordion <?= $secondaryShow; ?> secondaryShow">
                                          <h3>Secondary Plan</h3>
                                       </li>

                                       <li class="col-md-6  <?= $secondaryShow; ?> secondaryShow">
                                          <label class="description" for="ipal_secondary">Secondary Insurance Provider
                                             (all locations): </label>
                                          <div>
                                             <select class="form-control" id="ipal_secondary" name="ipal_secondary">
                                                <option value="" <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal'] == "") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                </option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "52") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="52">Adjudicare</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "57") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="57">Alberta Blue Cross (Group)</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "58") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="58">Alberta Blue Cross (Non group)
                                                </option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "53") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="53">Benecaid</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "59") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="59">BC Pharmacare</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "4") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="4">Canada Life</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "5") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="5">Chamber of Commerce</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "6") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="6">Claim secure</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "7") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="7">Coughlin Associates</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "8") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="8">Cowan Insurance</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "9") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="9">Desjardins</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "10") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="10">Equitable Life</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "39") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="39">Empire Life</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "11") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="11">Global Benefits</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "12") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="12">GMS Insurance</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "13") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="13">Greenshield</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "14") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="14">Group Medical Services</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "15") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="15">Group Premier Medical</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "16") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="16">Group Source</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "17") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="17">Industrial Alliance</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "18") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="18">Johnson cold - RTO</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "19") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="19">Johnston Group</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "20") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="20">La Survivance</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "21") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="21">Le Capital</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "22") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="22">Local 180/183</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "23") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="23">Manion Wilkens</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "43") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="43">MDM Insurance</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "24") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="24">Manulife</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "25") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="25">Manulife Affinity Markets</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "26") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="26">Medic Construction</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "27") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="27">NIHB</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "40") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="40">NexGenRx</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "47") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="47">ODB - Seniors</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "48") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="48">ODB - OHIP+</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "49") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="49">ODSP</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "28") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="28">Ontario Blue Cross</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "29") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="29">Ontario Drug Plan</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "51") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="51">Ontario Works</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "30") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="30">OTIP - Ontario Teachers</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "61") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="61">Pacific Blue Cross</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "31") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="31">RBC Insurance</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "32") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="32">Reliable</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "33") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="33">Rwam</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "34") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="34">Standard Life</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "35") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="35">Sunlife</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "36") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="36">The Cooperators</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "37") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="37">Trillium</option>
                                                <option <?php if (isset($repatientDetails['ipal_secondary'])) {
                                                   if ($repatientDetails['ipal_secondary'] == "50") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="50">Veterans Affairs Canada</option>
                                             </select>
                                          </div>
                                       </li>

                                       <li class="clearfix <?= $secondaryShow; ?> secondaryShow"></li>

                                       <li class="col-md-4 <?= $secondaryShow; ?> secondaryShow">
                                          <label class="description" for="Carrier_secondary">Carrier (Secondary Plan):
                                          </label>
                                          <div>
                                             <input id="Carrier_secondary" name="Carrier_secondary" class="form-control"
                                                type="text" value="<?php if (isset($repatientDetails['Carrier_secondary'])) {
                                                   echo $repatientDetails['Carrier_secondary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-5 <?= $secondaryShow; ?> secondaryShow">
                                          <label class="description" for="groupCN_secondary">Group/Contract Number
                                             (Secondary): </label>
                                          <div>
                                             <input id="groupCN_secondary" name="groupCN_secondary" class="form-control"
                                                type="text" value="<?php if (isset($repatientDetails['groupCN_secondary'])) {
                                                   echo $repatientDetails['groupCN_secondary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="<?= $secondaryShow; ?> secondaryShow">
                                          <label class="description" for="certificateNumber_secondary">Client
                                             ID/Certificate Number (Secondary): </label>
                                          <div>
                                             <input id="certificateNumber_secondary" name="certificateNumber_secondary"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['certificateNumber_secondary'])) {
                                                   echo $repatientDetails['certificateNumber_secondary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="<?= $secondaryShow; ?> secondaryShow">
                                          <span class="description">Cardholder (Secondary): </span>
                                          <div class="inline-flex">
                                             <fieldset>
                                                <span>
                                                   <input id="cardholderSelf_secondary" <?php if (isset($repatientDetails['cardholderSelf_secondary'])) {
                                                      if ($repatientDetails['cardholder_secondary'] == "Self") {
                                                         echo 'checked';
                                                      }
                                                   } ?> name="cardholder_secondary" class="custom-radio"
                                                      type="radio" value="Self" autocomplete="off">
                                                   <label class="choice" for="cardholderSelf_secondary">Self</label>
                                                </span>
                                                <span>
                                                   <input id="cardholderSpouse_secondary" name="cardholder_secondary"
                                                      class="custom-radio" type="radio" <?php if (isset($repatientDetails['cardholder_secondary'])) {
                                                         if ($repatientDetails['cardholder_secondary'] == "Spouse") {
                                                            echo 'checked';
                                                         }
                                                      } ?> value="Spouse" autocomplete="off">
                                                   <label class="choice" for="cardholderSpouse_secondary">Spouse</label>
                                                </span>
                                                <span>
                                                   <input id="cardholderDependent_secondary" name="cardholder_secondary"
                                                      class="custom-radio" type="radio" value="Dependent" <?php if (isset($repatientDetails['cardholder_secondary'])) {
                                                         if ($repatientDetails['cardholder_secondary'] == "Dependent") {
                                                            echo 'checked';
                                                         }
                                                      } ?> autocomplete="off">
                                                   <label class="choice"
                                                      for="cardholderDependent_secondary">Dependent</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>
                                       <?php $cardholder2 = 'hidden';
                                       if (isset($repatientDetails['cardholder_secondary'])) {
                                          if ($repatientDetails['cardholder_secondary'] == "Spouse") {
                                             $cardholder2 = '';
                                          }
                                       }
                                       if (isset($repatientDetails['cardholder_secondary'])) {
                                          if ($repatientDetails['cardholder_secondary'] == "Dependent") {
                                             $cardholder2 = '';
                                          }
                                       }
                                       ?>
                                       <li class="<?= $cardholder2; ?> cardholder_secondaryShow">
                                          <fieldset>
                                             <label class="description">Cardholder Name (Secondary): </label>

                                             <div class="row">
                                                <span class="col-md-4 simple_name_1 nextline">
                                                   <input id="cardSecondaryFirst" name="cardholderSecondaryName1"
                                                      type="text" value="<?php if (isset($repatientDetails['cardholderSecondaryName1'])) {
                                                         echo $repatientDetails['cardholderSecondaryName1'];
                                                      } ?>" class="form-control" maxlength="125" size="8" value=""
                                                      autocomplete="off">
                                                   <label for="cardSecondaryFirst">First</label>
                                                </span>

                                                <span class="col-md-4 simple_name_2 nextline">
                                                   <input id="cardSecondaryLast" name="cardholderSecondaryName2"
                                                      type="text" value="<?php if (isset($repatientDetails['cardholderSecondaryName2'])) {
                                                         echo $repatientDetails['cardholderSecondaryName2'];
                                                      } ?>" class="form-control" maxlength="125" size="14" value=""
                                                      autocomplete="off">
                                                   <label for="cardSecondaryLast">Last</label>
                                                </span>
                                             </div>

                                          </fieldset>
                                       </li>

                                       <li class="<?= $cardholder2; ?> col-md-4 cardholder_secondaryShow">
                                          <fieldset>
                                             <label class="description">Cardholder Date of Birth (Secondary): </label>
                                             <input type="date" class="form-control" id="cardholderSecondaryDOB" value="<?php if (isset($repatientDetails['cardholderSecondaryDOB'])) {
                                                echo $repatientDetails['cardholderSecondaryDOB'];
                                             } ?>" name="cardholderSecondaryDOB">
                                          </fieldset>
                                       </li>
                                       <li class="clearfix  <?= $secondaryShow; ?> secondaryShow"></li>


                                       <li class="col-md-4 <?= $secondaryShow; ?> secondaryShow">
                                          <label class="description" for="coveragePercentage_secondary">Coverage
                                             percentage (Secondary): </label>
                                          <div class="inline-flex">
                                             <input id="coveragePercentage_secondary"
                                                name="coveragePercentage_secondary" class="form-control" type="text"
                                                value="<?php if (isset($repatientDetails['coveragePercentage_secondary'])) {
                                                   echo $repatientDetails['coveragePercentage_secondary'];
                                                } ?>" autocomplete="off">
                                             <span class="block right">%</span>
                                          </div>
                                       </li>





                                       <li class="col-md-4 <?= $secondaryShow; ?> secondaryShow">
                                          <label class="description" for="deductible_secondary">Deductible (Secondary):
                                          </label>
                                          <div>
                                             <input id="deductible_secondary" name="deductible_secondary"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['deductible_secondary'])) {
                                                   echo $repatientDetails['deductible_secondary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>
                                       <li class="clearfix  <?= $secondaryShow; ?> secondaryShow"></li>
                                       <li class="col-md-4  hidden secondaryShow">
                                          <label class="description" for="annualMax_secondary">Annual Max (Secondary):
                                          </label>
                                          <div>
                                             <input id="annualMax_secondary" name="annualMax_secondary"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['annualMax_secondary'])) {
                                                   echo $repatientDetails['annualMax_secondary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="clearfix  <?= $secondaryShow; ?> secondaryShow"></li>
                                       <li class="col-md-4  <?= $secondaryShow; ?> secondaryShow">
                                          <label class="description" for="lifetimeMax_secondary">Lifetime Max
                                             (Secondary): </label>
                                          <div>
                                             <input id="lifetimeMax_secondary" name="lifetimeMax_secondary"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['lifetimeMax_secondary'])) {
                                                   echo $repatientDetails['lifetimeMax_secondary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-5  <?= $secondaryShow; ?> secondaryShow">
                                          <label class="description" for="copayMax_secondary">Copay Max (Sliding Copay)
                                             (Secondary): </label>
                                          <div>
                                             <input id="copayMax_secondary" name="copayMax_secondary"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['copayMax_secondary'])) {
                                                   echo $repatientDetails['copayMax_secondary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="<?= $secondaryShow; ?> secondaryShow">
                                          <span class="description">SA/EAP Required (Secondary Plan)? </span>
                                          <div class="inline-flex">
                                             <fieldset>
                                                <span>
                                                   <input id="sarequiredYes_secondary" <?php if (isset($repatientDetails['sarequired_secondary'])) {
                                                      if ($repatientDetails['sarequired_secondary'] == "Y") {
                                                         echo 'checked';
                                                      }
                                                   } ?> name="sarequired_secondary" class="custom-radio"
                                                      type="radio" value="Y" autocomplete="off">
                                                   <label class="choice" for="sarequiredYes_secondary">Yes</label>
                                                </span>
                                                <span>
                                                   <input id="sarequiredNo_secondary" name="sarequired_secondary" <?php if (isset($repatientDetails['sarequired_secondary'])) {
                                                      if ($repatientDetails['sarequired_secondary'] == "N") {
                                                         echo 'checked';
                                                      }
                                                   } ?> class="custom-radio" type="radio" value="N"
                                                      autocomplete="off">
                                                   <label class="choice" for="sarequiredNo_secondary">No</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>
                                       <?php $sarequired_secondaryshow = 'hidden';
                                       if (isset($repatientDetails['sarequired_secondary'])) {
                                          if ($repatientDetails['sarequired_secondary'] == "Y") {
                                             $sarequired_secondaryshow = '';
                                          }
                                       } ?>
                                       <li class="<?= $sarequired_secondaryshow; ?> col-md-4 sarequired_secondaryshow">
                                          <fieldset>
                                             <label class="description" id="dAppealSub_secondary">SA Initiated Date
                                                (Secondary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="dAppealSub_secondary" value="<?php if (isset($repatientDetails['dAppealSub_secondary'])) {
                                                   echo $repatientDetails['dAppealSub_secondary'];
                                                } ?>" name="dAppealSub_secondary">
                                             </div>
                                          </fieldset>
                                       </li>
                                       <!--New Added -->
                                       <li class="clearfix <?= $sarequired_secondaryshow; ?> sarequired_secondaryshow">
                                       </li>

                                       <li class="<?= $sarequired_secondaryshow; ?> col-md-4 sarequired_secondaryshow">
                                          <fieldset>
                                             <label class="description" id="saMdSentDate2">SA Sent to MD Date
                                                (Secondary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saMdSentDate2" value="<?php if (isset($repatientDetails['saMdSentDate2'])) {
                                                   echo $repatientDetails['saMdSentDate2'];
                                                } ?>" name="saMdSentDate2">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="<?= $sarequired_secondaryshow; ?> col-md-4 sarequired_secondaryshow">
                                          <fieldset>
                                             <label class="description" id="saMdReceivedDate2">SA Received by MD Date
                                                (Secondary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saMdReceivedDate2" value="<?php if (isset($repatientDetails['saMdReceivedDate2'])) {
                                                   echo $repatientDetails['saMdReceivedDate2'];
                                                } ?>" name="saMdReceivedDate2">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="clearfix <?= $sarequired_secondaryshow; ?> sarequired_secondaryshow">
                                       </li>

                                       <li class="<?= $sarequired_secondaryshow; ?> col-md-4 sarequired_secondaryshow">
                                          <fieldset>
                                             <label class="description" id="saPatientSentDate2">SA Sent to Patient Date
                                                (Secondary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saPatientSentDate2" value="<?php if (isset($repatientDetails['saPatientSentDate2'])) {
                                                   echo $repatientDetails['saPatientSentDate2'];
                                                } ?>" name="saPatientSentDate2">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="<?= $sarequired_secondaryshow; ?> col-md-4 sarequired_secondaryshow">
                                          <fieldset>
                                             <label class="description" id="saPatientReceivedDate2">SA Received by
                                                Patient Date (Secondary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saPatientReceivedDate2"
                                                   value="<?php if (isset($repatientDetails['saPatientReceivedDate2'])) {
                                                      echo $repatientDetails['saPatientReceivedDate2'];
                                                   } ?>" name="saPatientReceivedDate2">
                                             </div>
                                          </fieldset>
                                       </li>
                                       <!-- New Added End -->
                                       <li class="<?= $sarequired_secondaryshow; ?> sarequired_secondaryshow clearfix">
                                       </li>
                                       <li class="<?= $sarequired_secondaryshow; ?> col-md-4 sarequired_secondaryshow">
                                          <fieldset>
                                             <label class="description">SA/EAP Submission Date (Secondary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saEapSub_secondary" value="<?php if (isset($repatientDetails['saEapSub_secondary'])) {
                                                   echo $repatientDetails['saEapSub_secondary'];
                                                } ?>" name="saEapSub_secondary">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="<?= $sarequired_secondaryshow; ?> col-md-4 sarequired_secondaryshow">
                                          <fieldset>
                                             <label class="description">SA/EAP Outcome Date (Secondary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saEapOutcome_secondary"
                                                   value="<?php if (isset($repatientDetails['saEapOutcome_secondary'])) {
                                                      echo $repatientDetails['saEapOutcome_secondary'];
                                                   } ?>" name="saEapOutcome_secondary">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="<?= $sarequired_secondaryshow; ?> sarequired_secondaryshow clearfix">
                                       </li>

                                       <li class="<?= $sarequired_secondaryshow; ?> col-md-4 sarequired_secondaryshow">
                                          <fieldset>
                                             <label class="description">SA/EAP Expiry Date (Secondary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saEapExpiry_secondary"
                                                   value="<?php if (isset($repatientDetails['saEapExpiry_secondary'])) {
                                                      echo $repatientDetails['saEapExpiry_secondary'];
                                                   } ?>" name="saEapExpiry_secondary">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="<?= $sarequired_secondaryshow; ?> col-md-4 sarequired_secondaryshow">
                                          <fieldset>
                                             <label class="description">SA/EAP Expiry Follow Up Date (Secondary):
                                             </label>
                                             <div>
                                                <input type="date" class="form-control" id="saEapExpF_secondary" value="<?php if (isset($repatientDetails['saEapExpF_secondary'])) {
                                                   echo $repatientDetails['saEapExpF_secondary'];
                                                } ?>" name="saEapExpF_secondary">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="<?= $sarequired_secondaryshow; ?> sarequired_secondaryshow clearfix">
                                       </li>

                                       <li class="<?= $sarequired_secondaryshow; ?> col-md-4 sarequired_secondaryshow">
                                          <label class="description" for="luCode_secondary">LU Code (Secondary):
                                          </label>
                                          <div>
                                             <input id="luCode_secondary" name="luCode_secondary" class="form-control"
                                                type="text" value="<?php if (isset($repatientDetails['luCode_secondary'])) {
                                                   echo $repatientDetails['luCode_secondary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="<?= $sarequired_secondaryshow; ?> col-md-4 sarequired_secondaryshow">
                                          <fieldset>
                                             <label class="description">LU Expiry Date (Secondary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="luExpiry_secondary" value="<?php if (isset($repatientDetails['luExpiry_secondary'])) {
                                                   echo $repatientDetails['luExpiry_secondary'];
                                                } ?>" name="luExpiry_secondary">
                                             </div>
                                          </fieldset>
                                       </li>



                                       <li class="<?= $secondaryShow; ?> secondaryShow">
                                          <label class="description">Does Patient Have a Tertiary Plan? </label>
                                          <div class="inline-flex">
                                             <fieldset>
                                                <span>
                                                   <input id="dphspYes_tertiary" name="dphsp_tertiary" <?php if (isset($repatientDetails['dphsp_tertiary'])) {
                                                      if ($repatientDetails['dphsp_tertiary'] == "Y") {
                                                         echo 'checked';
                                                      }
                                                   } ?> class="custom-radio" type="radio" value="Y" autocomplete="off">
                                                   <label class="choice" for="dphspYes_tertiary">Yes</label>
                                                </span>
                                                <span>
                                                   <input id="dphspNo_tertiary" name="dphsp_tertiary"
                                                      class="custom-radio" type="radio" <?php if (isset($repatientDetails['dphsp_tertiary'])) {
                                                         if ($repatientDetails['dphsp_tertiary'] == "N") {
                                                            echo 'checked';
                                                         }
                                                      } ?> value="N" autocomplete="off">
                                                   <label class="choice" for="dphspNo_tertiary">No</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>
                                       <?php $tertiaryShow = 'hidden';
                                       if (isset($repatientDetails['dphsp_tertiary'])) {
                                          if ($repatientDetails['dphsp_tertiary'] == "Y") {
                                             $tertiaryShow = '';
                                          }
                                       } ?>

                                       <!--Secondary End -->
                                       <!--Tertiary Start -->
                                       <li class="text-center ftitle accordion <?= $tertiaryShow; ?> tertiaryShow">
                                          <h3>Tertiary Plan</h3>
                                       </li>

                                       <li class="col-md-6 <?= $tertiaryShow; ?> tertiaryShow">
                                          <label class="description" for="ipal_tertiary">Tertiary Insurance Provider
                                             (all locations): </label>
                                          <div>
                                             <select class="form-control" id="ipal_tertiary" name="ipal_tertiary">
                                                <option value="" <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal'] == "") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                </option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "52") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="52">Adjudicare</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "57") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="57">Alberta Blue Cross (Group)</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "58") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="58">Alberta Blue Cross (Non group)
                                                </option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "53") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="53">Benecaid</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "59") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="59">BC Pharmacare</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "4") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="4">Canada Life</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "5") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="5">Chamber of Commerce</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "6") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="6">Claim secure</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "7") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="7">Coughlin Associates</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "8") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="8">Cowan Insurance</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "9") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="9">Desjardins</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "10") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="10">Equitable Life</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "39") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="39">Empire Life</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "11") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="11">Global Benefits</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "12") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="12">GMS Insurance</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "13") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="13">Greenshield</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "14") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="14">Group Medical Services</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "15") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="15">Group Premier Medical</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "16") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="16">Group Source</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "17") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="17">Industrial Alliance</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "18") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="18">Johnson cold - RTO</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "19") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="19">Johnston Group</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "20") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="20">La Survivance</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "21") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="21">Le Capital</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "22") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="22">Local 180/183</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "23") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="23">Manion Wilkens</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "43") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="43">MDM Insurance</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "24") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="24">Manulife</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "25") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="25">Manulife Affinity Markets</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "26") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="26">Medic Construction</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "27") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="27">NIHB</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "40") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="40">NexGenRx</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "47") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="47">ODB - Seniors</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "48") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="48">ODB - OHIP+</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "49") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="49">ODSP</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "28") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="28">Ontario Blue Cross</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "29") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="29">Ontario Drug Plan</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "51") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="51">Ontario Works</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "30") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="30">OTIP - Ontario Teachers</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "61") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="61">Pacific Blue Cross</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "31") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="31">RBC Insurance</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "32") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="32">Reliable</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "33") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="33">Rwam</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "34") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="34">Standard Life</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "35") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="35">Sunlife</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "36") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="36">The Cooperators</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "37") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="37">Trillium</option>
                                                <option <?php if (isset($repatientDetails['ipal_tertiary'])) {
                                                   if ($repatientDetails['ipal_tertiary'] == "50") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="50">Veterans Affairs Canada</option>
                                             </select>
                                          </div>
                                       </li>

                                       <li class="clearfix <?= $tertiaryShow; ?> tertiaryShow"></li>

                                       <li class="col-md-4 <?= $tertiaryShow; ?> tertiaryShow">
                                          <label class="description" for="Carrier_tertiary">Carrier (Tertiary): </label>
                                          <div>
                                             <input id="Carrier_tertiary" name="Carrier_tertiary" class="form-control"
                                                type="text" value="<?php if (isset($repatientDetails['Carrier_tertiary'])) {
                                                   echo $repatientDetails['Carrier_tertiary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-4 <?= $tertiaryShow; ?> tertiaryShow">
                                          <label class="description" for="groupCN_tertiary">Group/Contract Number
                                             (Tertiary): </label>
                                          <div>
                                             <input id="groupCN_tertiary" name="groupCN_tertiary" class="form-control"
                                                type="text" value="<?php if (isset($repatientDetails['groupCN_tertiary'])) {
                                                   echo $repatientDetails['groupCN_tertiary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="<?= $tertiaryShow; ?> tertiaryShow">
                                          <label class="description" for="certificateNumber_tertiary">Client
                                             ID/Certificate Number (Tertiary): </label>
                                          <div>
                                             <input id="certificateNumber_tertiary" name="certificateNumber_tertiary"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['certificateNumber_tertiary'])) {
                                                   echo $repatientDetails['certificateNumber_tertiary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="<?= $tertiaryShow; ?> tertiaryShow">
                                          <span class="description">Cardholder (Tertiary): </span>
                                          <div class="inline-flex">
                                             <fieldset>
                                                <span>
                                                   <input id="cardholderSelf_tertiary" <?php if (isset($repatientDetails['cardholder_tertiary'])) {
                                                      if ($repatientDetails['cardholder_tertiary'] == "Self") {
                                                         echo 'checked';
                                                      }
                                                   } ?> name="cardholder_tertiary" class="custom-radio"
                                                      type="radio" value="Self" autocomplete="off">
                                                   <label class="choice" for="cardholderSelf_tertiary">Self</label>
                                                </span>
                                                <span>
                                                   <input id="cardholderSpouse_tertiary" name="cardholder_tertiary"
                                                      class="custom-radio" type="radio" value="Spouse" <?php if (isset($repatientDetails['cardholder_tertiary'])) {
                                                         if ($repatientDetails['cardholder_tertiary'] == "Spouse") {
                                                            echo 'checked';
                                                         }
                                                      } ?> autocomplete="off">
                                                   <label class="choice" for="cardholderSpouse_tertiary">Spouse</label>
                                                </span>
                                                <span>
                                                   <input id="cardholderDependent_tertiary" name="cardholder_tertiary"
                                                      class="custom-radio" type="radio" value="Dependent" <?php if (isset($repatientDetails['cardholder_tertiary'])) {
                                                         if ($repatientDetails['cardholder_tertiary'] == "Dependent") {
                                                            echo 'checked';
                                                         }
                                                      } ?> autocomplete="off">
                                                   <label class="choice"
                                                      for="cardholderDependent_tertiary">Dependent</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>
                                       <?php $cardholder3 = 'hidden';
                                       if (isset($repatientDetails['cardholder_tertiary'])) {
                                          if ($repatientDetails['cardholder_tertiary'] == "Spouse") {
                                             $cardholder3 = '';
                                          }
                                       }
                                       if (isset($repatientDetails['cardholder_tertiary'])) {
                                          if ($repatientDetails['cardholder_tertiary'] == "Dependent") {
                                             $cardholder3 = '';
                                          }
                                       }
                                       ?>
                                       <li class="<?= $cardholder3; ?> cardholder_tertiaryShow">
                                          <fieldset>
                                             <label class="description">Cardholder Name (Tertiary): </label>
                                             <div class="row">
                                                <span class="col-md-4 simple_name_1 nextline">
                                                   <input id="cardTertiaryFirst" name="cardholderTertiaryName1"
                                                      type="text" class="form-control" maxlength="125" size="8" value="<?php if (isset($repatientDetails['cardholderTertiaryName1'])) {
                                                         echo $repatientDetails['cardholderTertiaryName1'];
                                                      } ?>" autocomplete="off">
                                                   <label for="cardTertiaryFirst">First</label>
                                                </span>

                                                <span class="col-md-4 simple_name_2 nextline">
                                                   <input id="cardTertiaryLast" name="cardholderTertiaryName2"
                                                      type="text" class="form-control" maxlength="125" size="14" value="<?php if (isset($repatientDetails['cardholderTertiaryName2'])) {
                                                         echo $repatientDetails['cardholderTertiaryName2'];
                                                      } ?>" autocomplete="off">
                                                   <label for="cardTertiaryLast">Last</label>
                                                </span>
                                             </div>

                                          </fieldset>
                                       </li>

                                       <li class="<?= $cardholder3; ?> col-md-4 cardholder_tertiaryShow">
                                          <fieldset>
                                             <label class="description">Cardholder Date of Birth (Tertiary): </label>
                                             <input type="date" class="form-control" id="cardholderTertiaryDOB"
                                                name="cardholderTertiaryDOB" value="<?php if (isset($repatientDetails['cardholderTertiaryDOB'])) {
                                                   echo $repatientDetails['cardholderTertiaryDOB'];
                                                } ?>">
                                          </fieldset>
                                       </li>
                                       <li class="clearfix <?= $tertiaryShow; ?> tertiaryShow"></li>

                                       <li class="col-md-4 <?= $tertiaryShow; ?> tertiaryShow">
                                          <label class="description" for="coveragePercentage_tertiary">Coverage
                                             percentage (Tertiary): </label>
                                          <div class="inline-flex">
                                             <input id="coveragePercentage_tertiary" name="coveragePercentage_tertiary"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['coveragePercentage_tertiary'])) {
                                                   echo $repatientDetails['coveragePercentage_tertiary'];
                                                } ?>" autocomplete="off">
                                             <span class="block right">%</span>
                                          </div>
                                       </li>



                                       <li class="clearfix <?= $tertiaryShow; ?> tertiaryShow"></li>

                                       <li class="col-md-4 <?= $tertiaryShow; ?> tertiaryShow">
                                          <label class="description" for="deductible_tertiary">Deductible (Tertiary):
                                          </label>
                                          <div>
                                             <input id="deductible_tertiary" name="deductible_tertiary"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['deductible_tertiary'])) {
                                                   echo $repatientDetails['deductible_tertiary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-4 <?= $tertiaryShow; ?> tertiaryShow">
                                          <label class="description" for="annualMax_tertiary">Annual Max (Tertiary):
                                          </label>
                                          <div>
                                             <input id="annualMax_tertiary" name="annualMax_tertiary"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['annualMax_tertiary'])) {
                                                   echo $repatientDetails['annualMax_tertiary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="clearfix <?= $tertiaryShow; ?> tertiaryShow"></li>

                                       <li class="col-md-4 <?= $tertiaryShow; ?> tertiaryShow">
                                          <label class="description" for="lifetimeMax_tertiary">Lifetime Max (Tertiary):
                                          </label>
                                          <div>
                                             <input id="lifetimeMax_tertiary" name="lifetimeMax_tertiary"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['lifetimeMax_tertiary'])) {
                                                   echo $repatientDetails['lifetimeMax_tertiary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-5 <?= $tertiaryShow; ?> tertiaryShow">
                                          <label class="description" for="copayMax_tertiary">Copay Max (Sliding Copay)
                                             (Tertiary): </label>
                                          <div>
                                             <input id="copayMax_tertiary" name="copayMax_tertiary" class="form-control"
                                                type="text" value="<?php if (isset($repatientDetails['copayMax_tertiary'])) {
                                                   echo $repatientDetails['copayMax_tertiary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="<?= $tertiaryShow; ?> tertiaryShow">
                                          <span class="description">SA/EAP Required (Tertiary Plan)? </span>
                                          <div class="inline-flex">
                                             <fieldset>
                                                <span>
                                                   <input id="sarequiredYes_tertiary" name="sarequired_tertiary" <?php if (isset($repatientDetails['sarequired_tertiary'])) {
                                                      if ($repatientDetails['sarequired_tertiary'] == "Y") {
                                                         echo 'checked';
                                                      }
                                                   } ?> class="custom-radio" type="radio" value="Y"
                                                      autocomplete="off">
                                                   <label class="choice" for="sarequiredYes_tertiary">Yes</label>
                                                </span>
                                                <span>
                                                   <input id="sarequiredNo_tertiary" name="sarequired_tertiary" <?php if (isset($repatientDetails['sarequired_tertiary'])) {
                                                      if ($repatientDetails['sarequired_tertiary'] == "N") {
                                                         echo 'checked';
                                                      }
                                                   } ?> class="custom-radio" type="radio" value="N"
                                                      autocomplete="off">
                                                   <label class="choice" for="sarequiredNo_tertiary">No</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>
                                       <?php $sarequired_tertiaryShow = 'hidden';
                                       if (isset($repatientDetails['sarequired_tertiary'])) {
                                          if ($repatientDetails['sarequired_tertiary'] == "Y") {
                                             $sarequired_tertiaryShow = '';
                                          }
                                       } ?>
                                       <li class="<?= $sarequired_tertiaryShow; ?> col-md-4 sarequired_tertiaryShow">
                                          <fieldset>
                                             <label class="description" for="dAppealSub_tertiary">SA Initiated Date
                                                (Tertiary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="dAppealSub_tertiary"
                                                   name="dAppealSub_tertiary" value="<?php if (isset($repatientDetails['dAppealSub_tertiary'])) {
                                                      echo $repatientDetails['dAppealSub_tertiary'];
                                                   } ?>">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <!--New Added -->
                                       <li class="clearfix <?= $sarequired_tertiaryShow; ?> sarequired_tertiaryShow">
                                       </li>

                                       <li class="<?= $sarequired_tertiaryShow; ?> col-md-4 sarequired_tertiaryShow">
                                          <fieldset>
                                             <label class="description" id="saMdSentDate3">SA Sent to MD Date
                                                (Tertiary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saMdSentDate3" value="<?php if (isset($repatientDetails['saMdSentDate3'])) {
                                                   echo $repatientDetails['saMdSentDate3'];
                                                } ?>" name="saMdSentDate3">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="<?= $sarequired_tertiaryShow; ?> col-md-4 sarequired_tertiaryShow">
                                          <fieldset>
                                             <label class="description" id="saMdReceivedDate3">SA Received by MD Date
                                                (Tertiary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saMdReceivedDate3" value="<?php if (isset($repatientDetails['saMdReceivedDate3'])) {
                                                   echo $repatientDetails['saMdReceivedDate3'];
                                                } ?>" name="saMdReceivedDate3">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="clearfix <?= $sarequired_tertiaryShow; ?> sarequired_tertiaryShow">
                                       </li>

                                       <li class="<?= $sarequired_tertiaryShow; ?> col-md-4 sarequired_tertiaryShow">
                                          <fieldset>
                                             <label class="description" id="saPatientSentDate3">SA Sent to Patient Date
                                                (Tertiary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saPatientSentDate3" value="<?php if (isset($repatientDetails['saPatientSentDate3'])) {
                                                   echo $repatientDetails['saPatientSentDate3'];
                                                } ?>" name="saPatientSentDate3">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="<?= $sarequired_tertiaryShow; ?> col-md-4 sarequired_tertiaryShow">
                                          <fieldset>
                                             <label class="description" id="saPatientReceivedDate3">SA Received by
                                                Patient Date (Tertiary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saPatientReceivedDate3"
                                                   value="<?php if (isset($repatientDetails['saPatientReceivedDate3'])) {
                                                      echo $repatientDetails['saPatientReceivedDate3'];
                                                   } ?>" name="saPatientReceivedDate3">
                                             </div>
                                          </fieldset>
                                       </li>
                                       <!-- New Added End -->
                                       <li class="clearfix <?= $sarequired_tertiaryShow; ?> sarequired_tertiaryShow">
                                       </li>
                                       <li class="<?= $sarequired_tertiaryShow; ?> col-md-4 sarequired_tertiaryShow">
                                          <fieldset>
                                             <label class="description">SA/EAP Submission Date (Tertiary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saEapSub_tertiary"
                                                   name="saEapSub_tertiary" value="<?php if (isset($repatientDetails['saEapSub_tertiary'])) {
                                                      echo $repatientDetails['saEapSub_tertiary'];
                                                   } ?>">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="<?= $sarequired_tertiaryShow; ?> col-md-4 sarequired_tertiaryShow">
                                          <fieldset>
                                             <label class="description">SA/EAP Outcome Date (Tertiary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saEapOutcome_tertiary"
                                                   name="saEapOutcome_tertiary" value="<?php if (isset($repatientDetails['saEapOutcome_tertiary'])) {
                                                      echo $repatientDetails['saEapOutcome_tertiary'];
                                                   } ?>">
                                             </div>
                                          </fieldset>
                                       </li>
                                       <li class="clearfix <?= $sarequired_tertiaryShow; ?> sarequired_tertiaryShow">
                                       </li>
                                       <li class="<?= $sarequired_tertiaryShow; ?> col-md-4 sarequired_tertiaryShow">
                                          <fieldset>
                                             <label class="description">SA/EAP Expiry Date (Tertiary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saEapExpiry_tertiary"
                                                   name="saEapExpiry_tertiary" value="<?php if (isset($repatientDetails['saEapExpiry_tertiary'])) {
                                                      echo $repatientDetails['saEapExpiry_tertiary'];
                                                   } ?>">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="<?= $sarequired_tertiaryShow; ?> col-md-4 sarequired_tertiaryShow">
                                          <fieldset>
                                             <label class="description">SA/EAP Expiry Follow Up Date (Tertiary):
                                             </label>
                                             <div>
                                                <input type="date" class="form-control" id="saEapExpF_tertiary"
                                                   name="saEapExpF_tertiary" value="<?php if (isset($repatientDetails['saEapExpF_tertiary'])) {
                                                      echo $repatientDetails['saEapExpF_tertiary'];
                                                   } ?>">
                                             </div>
                                          </fieldset>
                                       </li>
                                       <li class="clearfix <?= $sarequired_tertiaryShow; ?> sarequired_tertiaryShow">
                                       </li>
                                       <li class="<?= $sarequired_tertiaryShow; ?> col-md-4 sarequired_tertiaryShow">
                                          <label class="description" for="luCode_tertiary">LU Code (Tertiary): </label>
                                          <div>
                                             <input id="luCode_tertiary" name="luCode_tertiary" class="form-control"
                                                type="text" value="<?php if (isset($repatientDetails['luCode_tertiary'])) {
                                                   echo $repatientDetails['luCode_tertiary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>
                                       <li class="<?= $sarequired_tertiaryShow; ?> col-md-4 sarequired_tertiaryShow">
                                          <fieldset>
                                             <label class="description">LU Expiry Date (Tertiary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="luExpiry_tertiary"
                                                   name="luExpiry_tertiary" value="<?php if (isset($repatientDetails['luExpiry_tertiary'])) {
                                                      echo $repatientDetails['luExpiry_tertiary'];
                                                   } ?>">
                                             </div>
                                          </fieldset>
                                       </li>



                                       <li class="<?= $tertiaryShow; ?> tertiaryShow">
                                          <label class="description">Does Patient Have a Quaternary Plan? </label>
                                          <div class="inline-flex">
                                             <fieldset>
                                                <span>
                                                   <input id="dphspYes_quaternary" name="dphsp_quaternary" <?php if (isset($repatientDetails['dphsp_quaternary'])) {
                                                      if ($repatientDetails['dphsp_quaternary'] == "Y") {
                                                         echo 'checked';
                                                      }
                                                   } ?> class="custom-radio" type="radio" value="Y" autocomplete="off">
                                                   <label class="choice" for="dphspYes_quaternary">Yes</label>
                                                </span>
                                                <span>
                                                   <input id="dphspNo_quaternary" name="dphsp_quaternary" <?php if (isset($repatientDetails['dphsp_quaternary'])) {
                                                      if ($repatientDetails['dphsp_quaternary'] == "N") {
                                                         echo 'checked';
                                                      }
                                                   } ?> class="custom-radio" type="radio" value="N" autocomplete="off">
                                                   <label class="choice" for="dphspNo_quaternary">No</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>
                                       <?php $quaternaryShow = 'hidden';
                                       if (isset($repatientDetails['dphsp_quaternary'])) {
                                          if ($repatientDetails['dphsp_quaternary'] == "Y") {
                                             $quaternaryShow = '';
                                          }
                                       } ?>
                                       <!--Tertiary End -->
                                       <!--Quaternary Start -->
                                       <li class="text-center ftitle accordion <?= $quaternaryShow; ?> quaternaryShow">
                                          <h3>Quaternary Plan</h3>
                                       </li>

                                       <li class="col-md-6 <?= $quaternaryShow; ?> quaternaryShow">
                                          <label class="description" for="ipal_quaternary">Quaternary Insurance Provider
                                             (all locations): </label>
                                          <div>
                                             <select class="form-control" id="ipal_quaternary" name="ipal_quaternary">
                                                <option value="" <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal'] == "") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                </option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "52") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="52">Adjudicare</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "57") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="57">Alberta Blue Cross (Group)</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "58") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="58">Alberta Blue Cross (Non group)
                                                </option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "53") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="53">Benecaid</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "59") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="59">BC Pharmacare</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "4") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="4">Canada Life</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "5") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="5">Chamber of Commerce</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "6") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="6">Claim secure</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "7") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="7">Coughlin Associates</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "8") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="8">Cowan Insurance</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "9") {
                                                      echo 'selected';
                                                   }
                                                } ?>
                                                   value="9">Desjardins</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "10") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="10">Equitable Life</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "39") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="39">Empire Life</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "11") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="11">Global Benefits</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "12") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="12">GMS Insurance</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "13") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="13">Greenshield</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "14") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="14">Group Medical Services</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "15") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="15">Group Premier Medical</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "16") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="16">Group Source</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "17") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="17">Industrial Alliance</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "18") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="18">Johnson cold - RTO</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "19") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="19">Johnston Group</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "20") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="20">La Survivance</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "21") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="21">Le Capital</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "22") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="22">Local 180/183</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "23") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="23">Manion Wilkens</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "43") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="43">MDM Insurance</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "24") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="24">Manulife</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "25") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="25">Manulife Affinity Markets</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "26") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="26">Medic Construction</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "27") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="27">NIHB</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "40") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="40">NexGenRx</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "47") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="47">ODB - Seniors</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "48") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="48">ODB - OHIP+</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "49") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="49">ODSP</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "28") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="28">Ontario Blue Cross</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "29") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="29">Ontario Drug Plan</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "51") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="51">Ontario Works</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "30") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="30">OTIP - Ontario Teachers</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "61") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="61">Pacific Blue Cross</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "31") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="31">RBC Insurance</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "32") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="32">Reliable</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "33") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="33">Rwam</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "34") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="34">Standard Life</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "35") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="35">Sunlife</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "36") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="36">The Cooperators</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "37") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="37">Trillium</option>
                                                <option <?php if (isset($repatientDetails['ipal_quaternary'])) {
                                                   if ($repatientDetails['ipal_quaternary'] == "50") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="50">Veterans Affairs Canada</option>
                                             </select>
                                          </div>
                                       </li>

                                       <li class="clearfix <?= $quaternaryShow; ?> quaternaryShow"></li>

                                       <li class="col-md-4 <?= $quaternaryShow; ?> quaternaryShow">
                                          <label class="description" for="Carrier_quaternary">Carrier (Quaternary):
                                          </label>
                                          <div>
                                             <input id="Carrier_quaternary" name="Carrier_quaternary"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['Carrier_quaternary'])) {
                                                   echo $repatientDetails['Carrier_quaternary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-5 <?= $quaternaryShow; ?> quaternaryShow">
                                          <label class="description" for="groupCN_quaternary">Group/Contract Number
                                             (Quaternary): </label>
                                          <div>
                                             <input id="groupCN_quaternary" name="groupCN_quaternary"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['groupCN_quaternary'])) {
                                                   echo $repatientDetails['groupCN_quaternary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="<?= $quaternaryShow; ?> quaternaryShow">
                                          <label class="description" for="certificateNumber_quaternary">Client
                                             ID/Certificate Number (Quaternary): </label>
                                          <div>
                                             <input id="certificateNumber_quaternary"
                                                name="certificateNumber_quaternary" class="form-control" type="text"
                                                value="<?php if (isset($repatientDetails['certificateNumber_quaternary'])) {
                                                   echo $repatientDetails['certificateNumber_quaternary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="<?= $quaternaryShow; ?> quaternaryShow">
                                          <span class="description">Cardholder (Quaternary): </span>
                                          <div class="inline-flex">
                                             <fieldset>
                                                <span>
                                                   <input id="cardholderSelf_quaternary" <?php if (isset($repatientDetails['cardholder_quaternary'])) {
                                                      if ($repatientDetails['cardholder_quaternary'] == "Self") {
                                                         echo 'checked';
                                                      }
                                                   } ?> name="cardholder_quaternary"
                                                      class="custom-radio" type="radio" value="Self" autocomplete="off">
                                                   <label class="choice" for="cardholderSelf_quaternary">Self</label>
                                                </span>
                                                <span>
                                                   <input id="cardholderSpouse_quaternary" <?php if (isset($repatientDetails['cardholder_quaternary'])) {
                                                      if ($repatientDetails['cardholder_quaternary'] == "Spouse") {
                                                         echo 'checked';
                                                      }
                                                   } ?> name="cardholder_quaternary"
                                                      class="custom-radio" type="radio" value="Spouse"
                                                      autocomplete="off">
                                                   <label class="choice"
                                                      for="cardholderSpouse_quaternary">Spouse</label>
                                                </span>
                                                <span>
                                                   <input id="cardholderDependent_quaternary" <?php if (isset($repatientDetails['cardholder_quaternary'])) {
                                                      if ($repatientDetails['cardholder_quaternary'] == "Dependent") {
                                                         echo 'checked';
                                                      }
                                                   } ?> name="cardholder_quaternary"
                                                      class="custom-radio" type="radio" value="Dependent"
                                                      autocomplete="off">
                                                   <label class="choice"
                                                      for="cardholderDependent_quaternary">Dependent</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>
                                       <?php $cardholder4 = 'hidden';
                                       if (isset($repatientDetails['cardholder_quaternary'])) {
                                          if ($repatientDetails['cardholder_quaternary'] == "Spouse") {
                                             $cardholder4 = '';
                                          }
                                       }
                                       if (isset($repatientDetails['cardholder_quaternary'])) {
                                          if ($repatientDetails['cardholder_quaternary'] == "Dependent") {
                                             $cardholder4 = '';
                                          }
                                       }
                                       ?>
                                       <li class="<?= $cardholder4; ?> cardholder_quaternaryShow">
                                          <fieldset>
                                             <label class="description">Cardholder Name (Quaternary): </label>

                                             <div class="row">
                                                <span class="col-md-4 simple_name_1 nextline">
                                                   <input id="cardQuaternaryFirst" name="cardholderQuaternaryName1"
                                                      type="text" class="form-control" maxlength="125" size="8" value="<?php if (isset($repatientDetails['cardholderQuaternaryName1'])) {
                                                         echo $repatientDetails['cardholderQuaternaryName1'];
                                                      } ?>" autocomplete="off">
                                                   <label for="cardQuaternaryFirst">First</label>
                                                </span>

                                                <span class="col-md-4 simple_name_2 nextline">
                                                   <input id="cardQuaternaryLast" name="cardholderQuaternaryName2"
                                                      type="text" value="<?php if (isset($repatientDetails['cardholderQuaternaryName2'])) {
                                                         echo $repatientDetails['cardholderQuaternaryName2'];
                                                      } ?>" class="form-control" maxlength="125" size="14" value="<?php if (isset($repatientDetails['cardholderQuaternaryName2'])) {
                                                          echo $repatientDetails['cardholderQuaternaryName2'];
                                                       } ?>" autocomplete="off">
                                                   <label for="cardQuaternaryLast">Last</label>
                                                </span>
                                             </div>

                                          </fieldset>
                                       </li>

                                       <li class="<?= $cardholder4; ?> col-md-4 cardholder_quaternaryShow">
                                          <fieldset>
                                             <label class="description">Cardholder Date of Birth (Quaternary): </label>

                                             <input type="date" class="form-control" id="cardholderQuaternaryDOB" value="<?php if (isset($repatientDetails['cardholderQuaternaryDOB'])) {
                                                echo $repatientDetails['cardholderQuaternaryDOB'];
                                             } ?>" name="cardholderQuaternaryDOB">
                                          </fieldset>
                                       </li>
                                       <li class="clearfix <?= $quaternaryShow; ?> quaternaryShow"></li>
                                       <li class="col-md-4 <?= $quaternaryShow; ?> quaternaryShow">
                                          <label class="description" for="coveragePercentage_quaternary">Coverage
                                             percentage (Quaternary): </label>
                                          <div class="inline-flex">
                                             <input id="coveragePercentage_quaternary"
                                                name="coveragePercentage_quaternary" value="<?php if (isset($repatientDetails['coveragePercentage_quaternary'])) {
                                                   echo $repatientDetails['coveragePercentage_quaternary'];
                                                } ?>" class="form-control" type="text" autocomplete="off">
                                             <span class="block right">%</span>
                                          </div>
                                       </li>

                                       <li class="clearfix <?= $quaternaryShow; ?> quaternaryShow"></li>
                                       <li class="col-md-4 <?= $quaternaryShow; ?> quaternaryShow">
                                          <label class="description" for="deductible_quaternary">Deductible
                                             (Quaternary): </label>
                                          <div>
                                             <input id="deductible_quaternary" name="deductible_quaternary"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['deductible_quaternary'])) {
                                                   echo $repatientDetails['deductible_quaternary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-4 <?= $quaternaryShow; ?> quaternaryShow">
                                          <label class="description" for="annualMax_quaternary">Annual Max (Quaternary):
                                          </label>
                                          <div>
                                             <input id="annualMax_quaternary" name="annualMax_quaternary"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['annualMax_quaternary'])) {
                                                   echo $repatientDetails['annualMax_quaternary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="clearfix <?= $quaternaryShow; ?> quaternaryShow"></li>

                                       <li class="col-md-4 <?= $quaternaryShow; ?> quaternaryShow">
                                          <label class="description" for="lifetimeMax_quaternary">Lifetime Max
                                             (Quaternary): </label>
                                          <div>
                                             <input id="lifetimeMax_quaternary" name="lifetimeMax_quaternary"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['lifetimeMax_quaternary'])) {
                                                   echo $repatientDetails['lifetimeMax_quaternary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-5 <?= $quaternaryShow; ?> quaternaryShow">
                                          <label class="description" for="copayMax_quaternary">Copay Max (Sliding Copay)
                                             (Quaternary): </label>
                                          <div>
                                             <input id="copayMax_quaternary" name="copayMax_quaternary"
                                                class="form-control" type="text" value="<?php if (isset($repatientDetails['copayMax_quaternary'])) {
                                                   echo $repatientDetails['copayMax_quaternary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="<?= $quaternaryShow; ?> quaternaryShow">
                                          <span class="description">SA/EAP Required (Quaternary Plan)? </span>
                                          <div class="inline-flex">
                                             <fieldset>
                                                <span>
                                                   <input id="sarequiredYes_quaternary" <?php if (isset($repatientDetails['sarequired_quaternary'])) {
                                                      if ($repatientDetails['sarequired_quaternary'] == "Y") {
                                                         echo 'checked';
                                                      }
                                                   } ?> name="sarequired_quaternary"
                                                      class="custom-radio" type="radio" value="Y" autocomplete="off">
                                                   <label class="choice" for="sarequiredYes_quaternary">Yes</label>
                                                </span>
                                                <span>
                                                   <input id="sarequiredNo_quaternary" <?php if (isset($repatientDetails['sarequired_quaternary'])) {
                                                      if ($repatientDetails['sarequired_quaternary'] == "N") {
                                                         echo 'checked';
                                                      }
                                                   } ?> name="sarequired_quaternary"
                                                      class="custom-radio" type="radio" value="N" autocomplete="off">
                                                   <label class="choice" for="sarequiredNo_quaternary">No</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>
                                       <?php $sarequired_quaternaryShow = 'hidden';
                                       if (isset($repatientDetails['sarequired_quaternary'])) {
                                          if ($repatientDetails['sarequired_quaternary'] == "Y") {
                                             $sarequired_quaternaryShow = '';
                                          }
                                       } ?>
                                       <li
                                          class="<?= $sarequired_quaternaryShow; ?> col-md-4 sarequired_quaternaryShow">
                                          <fieldset>
                                             <label class="description" id="dAppealSub_quaternary">SA Initiated Date
                                                (Quaternary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="dAppealSub_quaternary"
                                                   value="<?php if (isset($repatientDetails['dAppealSub_quaternary'])) {
                                                      echo $repatientDetails['dAppealSub_quaternary'];
                                                   } ?>" name="dAppealSub_quaternary">
                                             </div>
                                          </fieldset>
                                       </li>
                                       <!--New Added -->
                                       <li
                                          class="clearfix <?= $sarequired_quaternaryShow; ?> sarequired_quaternaryShow">
                                       </li>

                                       <li
                                          class="<?= $sarequired_quaternaryShow; ?> col-md-4 sarequired_quaternaryShow">
                                          <fieldset>
                                             <label class="description" id="saMdSentDate4">SA Sent to MD Date
                                                (Quaternary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saMdSentDate4" value="<?php if (isset($repatientDetails['saMdSentDate4'])) {
                                                   echo $repatientDetails['saMdSentDate4'];
                                                } ?>" name="saMdSentDate4">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li
                                          class="<?= $sarequired_quaternaryShow; ?> col-md-4 sarequired_quaternaryShow">
                                          <fieldset>
                                             <label class="description" id="saMdReceivedDate4">SA Received by MD Date
                                                (Quaternary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saMdReceivedDate4" value="<?php if (isset($repatientDetails['saMdReceivedDate4'])) {
                                                   echo $repatientDetails['saMdReceivedDate4'];
                                                } ?>" name="saMdReceivedDate4">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li
                                          class="clearfix <?= $sarequired_quaternaryShow; ?> sarequired_quaternaryShow">
                                       </li>

                                       <li
                                          class="<?= $sarequired_quaternaryShow; ?> col-md-4 sarequired_quaternaryShow">
                                          <fieldset>
                                             <label class="description" id="saPatientSentDate4">SA Sent to Patient Date
                                                (Quaternary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saPatientSentDate4" value="<?php if (isset($repatientDetails['saPatientSentDate4'])) {
                                                   echo $repatientDetails['saPatientSentDate4'];
                                                } ?>" name="saPatientSentDate4">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li
                                          class="<?= $sarequired_quaternaryShow; ?> col-md-4 sarequired_quaternaryShow">
                                          <fieldset>
                                             <label class="description" id="saPatientReceivedDate4">SA Received by
                                                Patient Date (Quaternary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saPatientReceivedDate4"
                                                   value="<?php if (isset($repatientDetails['saPatientReceivedDate4'])) {
                                                      echo $repatientDetails['saPatientReceivedDate4'];
                                                   } ?>" name="saPatientReceivedDate4">
                                             </div>
                                          </fieldset>
                                       </li>
                                       <!-- New Added End -->

                                       <li
                                          class="clearfix <?= $sarequired_quaternaryShow; ?> sarequired_quaternaryShow">
                                       </li>

                                       <li class="<?= $sarequired_quaternaryShow; ?> col-md-4 quaternaryShow">
                                          <fieldset>
                                             <label class="description">SA/EAP Submission Date (Quaternary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saEapSub_quaternary" value="<?php if (isset($repatientDetails['saEapSub_quaternary'])) {
                                                   echo $repatientDetails['saEapSub_quaternary'];
                                                } ?>" name="saEapSub_quaternary">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li
                                          class="<?= $sarequired_quaternaryShow; ?> col-md-4 sarequired_quaternaryShow">
                                          <fieldset>
                                             <label class="description">SA/EAP Outcome Date (Quaternary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saEapOutcome_quaternary"
                                                   value="<?php if (isset($repatientDetails['saEapOutcome_quaternary'])) {
                                                      echo $repatientDetails['saEapOutcome_quaternary'];
                                                   } ?>" name="saEapOutcome_quaternary">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li
                                          class="clearfix <?= $sarequired_quaternaryShow; ?> sarequired_quaternaryShow">
                                       </li>

                                       <li
                                          class="<?= $sarequired_quaternaryShow; ?> col-md-4 sarequired_quaternaryShow">
                                          <fieldset>
                                             <label class="description">SA/EAP Expiry Date (Quaternary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="saEapExpiry_quaternary"
                                                   value="<?php if (isset($repatientDetails['saEapExpiry_quaternary'])) {
                                                      echo $repatientDetails['saEapExpiry_quaternary'];
                                                   } ?>" name="saEapExpiry_quaternary">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li
                                          class="<?= $sarequired_quaternaryShow; ?> col-md-4 sarequired_quaternaryShow">
                                          <fieldset>
                                             <label class="description">SA/EAP Expiry Follow Up Date (Quaternary):
                                             </label>
                                             <div>
                                                <input type="date" class="form-control" id="saEapExpF_quaternary" value="<?php if (isset($repatientDetails['saEapExpF_quaternary'])) {
                                                   echo $repatientDetails['saEapExpF_quaternary'];
                                                } ?>" name="saEapExpF_quaternary">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li
                                          class="clearfix <?= $sarequired_quaternaryShow; ?> sarequired_quaternaryShow">
                                       </li>

                                       <li
                                          class="<?= $sarequired_quaternaryShow; ?> col-md-4 sarequired_quaternaryShow">
                                          <label class="description" for="luCode_quaternary">LU Code (Quaternary):
                                          </label>
                                          <div>
                                             <input id="luCode_quaternary" name="luCode_quaternary" class="form-control"
                                                type="text" value="<?php if (isset($repatientDetails['luCode_quaternary'])) {
                                                   echo $repatientDetails['luCode_quaternary'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li
                                          class="<?= $sarequired_quaternaryShow; ?> col-md-4 sarequired_quaternaryShow">
                                          <fieldset>
                                             <label class="description">LU Expiry Date (Quaternary): </label>
                                             <div>
                                                <input type="date" class="form-control" id="luExpiry_quaternary" value="<?php if (isset($repatientDetails['luExpiry_quaternary'])) {
                                                   echo $repatientDetails['luExpiry_quaternary'];
                                                } ?>" name="luExpiry_quaternary">
                                             </div>
                                          </fieldset>
                                       </li>



                                       <!--Quaternary End -->

                                       <li class="line"></li>

                                       <li class="">
                                          <label class="description">Does plan have a MANDATORY PPN on file? </label>
                                          <div class="inline-flex">
                                             <fieldset>
                                                <span><input id="dphmpfYes" name="dphmpf" <?php if (isset($repatientDetails['dphmpf'])) {
                                                   if ($repatientDetails['dphmpf'] == "Y") {
                                                      echo 'checked';
                                                   }
                                                } ?>
                                                      class="custom-radio" type="radio" value="Y" autocomplete="off">
                                                   <label class="choice" for="dphmpfYes">Yes</label>
                                                </span>
                                                <span><input id="dphmpfNo" name="dphmpf" <?php if (isset($repatientDetails['dphmpf'])) {
                                                   if ($repatientDetails['dphmpf'] == "N") {
                                                      echo 'checked';
                                                   }
                                                } ?>
                                                      class="custom-radio" type="radio" value="N" autocomplete="off">
                                                   <label class="choice" for="dphmpfNo">No</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>

                                       <li class="hidden">
                                          <label class="description">Does the Patient Have Any Public Coverage? </label>
                                          <div>
                                             <fieldset>
                                                <span><input id="dphapcYes" name="dphapc" <?php if (isset($repatientDetails['dphapc'])) {
                                                   if ($repatientDetails['dphapc'] == "Y") {
                                                      echo 'checked';
                                                   }
                                                } ?>
                                                      class="custom-radio" type="radio" value="Y" autocomplete="off">
                                                   <label class="choice" for="dphapcYes">Yes</label>
                                                </span>
                                                <span><input id="dphapcNo" name="dphapc" <?php if (isset($repatientDetails['dphapc'])) {
                                                   if ($repatientDetails['dphapc'] == "N") {
                                                      echo 'checked';
                                                   }
                                                } ?>
                                                      class="custom-radio" type="radio" value="N" autocomplete="off">
                                                   <label class="choice" for="dphapcNo">No</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>

                                       <li class="hidden">
                                          <label class="description" for="pcct">Please Confirm Coverage Type: </label>
                                          <div>
                                             <input id="pcct" name="pcct" class="form-control" type="text" value="<?php if (isset($repatientDetails['pcct'])) {
                                                echo $repatientDetails['pcct'];
                                             } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="hidden">
                                          <label class="description" for="pcd">Public Coverage Details: </label>
                                          <div>
                                             <textarea id="pcd" name="pcd" class="form-control" rows="8" cols="90"><?php if (isset($repatientDetails['pcd'])) {
                                                echo $repatientDetails['pcd'];
                                             } ?></textarea>
                                          </div>
                                          <p class="remarks"><small>Group Number, Health Number</small></p>
                                       </li>

                                       <li class="">
                                          <label class="description">Financial Assistance </label>
                                          <div class="inline-flex">
                                             <fieldset>
                                                <span><input id="financialAssistanceYes" name="financialAssistance"
                                                      <?php if (isset($repatientDetails['financialAssistance'])) {
                                                         if ($repatientDetails['financialAssistance'] == "Y") {
                                                            echo 'checked';
                                                         }
                                                      } ?> class="custom-radio" type="radio" value="Y"
                                                      autocomplete="off">
                                                   <label class="choice" for="financialAssistanceYes">Yes</label>
                                                </span>
                                                <span><input id="financialAssistanceNo" name="financialAssistance" <?php if (isset($repatientDetails['financialAssistance'])) {
                                                   if ($repatientDetails['financialAssistance'] == "N") {
                                                      echo 'checked';
                                                   }
                                                } ?> class="custom-radio" type="radio" value="N"
                                                      autocomplete="off">
                                                   <label class="choice" for="financialAssistanceNo">No</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>

                                       <li>
                                          <label class="description" for="copayCard">CoPay Card: </label>
                                          <div>
                                             <input id="copayCard" name="copayCard" class="form-control" type="text"
                                                value="<?php if (isset($repatientDetails['copayCard'])) {
                                                   echo $repatientDetails['copayCard'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-4">
                                          <label class="description" for="piRxCRM">Patient invited to RxCRM: </label>
                                          <div>
                                             <select class="form-control" id="piRxCRM" name="piRxCRM">
                                                <option value="" <?php if (isset($repatientDetails['piRxCRM'])) {
                                                   if ($repatientDetails['piRxCRM'] == "") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                </option>
                                                <option value="1" <?php if (isset($repatientDetails['piRxCRM'])) {
                                                   if ($repatientDetails['piRxCRM'] == "1") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Yes
                                                </option>
                                                <option value="2" <?php if (isset($repatientDetails['piRxCRM'])) {
                                                   if ($repatientDetails['piRxCRM'] == "2") {
                                                      echo 'selected';
                                                   }
                                                } ?>>No
                                                </option>
                                                <option value="3" <?php if (isset($repatientDetails['piRxCRM'])) {
                                                   if ($repatientDetails['piRxCRM'] == "3") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Patient
                                                   declined</option>
                                             </select>
                                          </div>
                                       </li>

                                       <li class="">
                                          <label class="description">Consent: verbal consent obtained for RxC staff to
                                             send messages, documents &amp; forms via RXCRM (app or appless): </label>
                                          <div class="inline-flex">
                                             <fieldset>
                                                <span><input id="consentYes" name="consent" class="custom-radio" <?php if (isset($repatientDetails['consent'])) {
                                                   if ($repatientDetails['consent'] == "Y") {
                                                      echo 'checked';
                                                   }
                                                } ?>
                                                      type="radio" value="Y" autocomplete="off">
                                                   <label class="choice" for="consentYes">Yes</label>
                                                </span>
                                                <span><input id="consentNo" name="consent" class="custom-radio" <?php if (isset($repatientDetails['consent'])) {
                                                   if ($repatientDetails['consent'] == "N") {
                                                      echo 'checked';
                                                   }
                                                } ?>
                                                      type="radio" value="N" autocomplete="off">
                                                   <label class="choice" for="consentNo">No</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>

                                       <li class="">
                                          <label class="description">Consent: verbal consent obtained to release and
                                             share information with Physicians, PSP, Public and Private Payor: </label>
                                          <div class="inline-flex">
                                             <fieldset>
                                                <span><input id="consentReleaseYes" <?php if (isset($repatientDetails['consentRelease'])) {
                                                   if ($repatientDetails['consentRelease'] == "Y") {
                                                      echo 'checked';
                                                   }
                                                } ?> name="consentRelease" class="custom-radio" type="radio"
                                                      value="Y" autocomplete="off">
                                                   <label class="choice" for="consentReleaseYes">Yes</label>
                                                </span>
                                                <span><input id="consentReleaseNo" name="consentRelease" <?php if (isset($repatientDetails['consentRelease'])) {
                                                   if ($repatientDetails['consentRelease'] == "N") {
                                                      echo 'checked';
                                                   }
                                                } ?> class="custom-radio" type="radio" value="N" autocomplete="off">
                                                   <label class="choice" for="consentReleaseNo">No</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>

                                       <li class="col-md-12">
                                          <fieldset class="row">

                                             <label class="description">Name of Rx Connect Employee that obtained verbal
                                                consent: </label>
                                             <span class="col-md-4 nextline">
                                                <input id="consentVFirst" name="consentVFirst" type="text"
                                                   class="form-control" maxlength="255" size="8" value="<?php if (isset($repatientDetails['consentVFirst'])) {
                                                      echo $repatientDetails['consentVFirst'];
                                                   } ?>" autocomplete="off">
                                                <label for="consentVFirst">First</label>
                                             </span>
                                             <span class="col-md-4 nextline">
                                                <input id="consentVLast" name="consentVLast" type="text"
                                                   class="form-control" maxlength="255" size="14" value="<?php if (isset($repatientDetails['consentVLast'])) {
                                                      echo $repatientDetails['consentVLast'];
                                                   } ?>" autocomplete="off">
                                                <label for="consentVLast">Last</label>
                                             </span>
                                          </fieldset>
                                       </li>

                                       <li class="text-center ftitle accordion">
                                          <h3>
                                             First Appointment Details
                                          </h3>
                                       </li>

                                       <li class="">
                                          <label class="description">Injection Training Location: </label>
                                          <div class="inline-flex">
                                             <fieldset>
                                                <span><input id="injTraLocV" name="injTraLoc" class="custom-radio"
                                                      type="radio" value="1" <?php if (isset($repatientDetails['injTraLoc'])) {
                                                         if ($repatientDetails['injTraLoc'] == "1") {
                                                            echo 'checked';
                                                         }
                                                      } ?>
                                                      autocomplete="off">
                                                   <label class="choice" for="injTraLocV">Virtual</label>
                                                </span>
                                                <span><input id="injTraLocC" name="injTraLoc" class="custom-radio"
                                                      type="radio" value="2" <?php if (isset($repatientDetails['injTraLoc'])) {
                                                         if ($repatientDetails['injTraLoc'] == "2") {
                                                            echo 'checked';
                                                         }
                                                      } ?>
                                                      autocomplete="off">
                                                   <label class="choice" for="injTraLocC">Clinic</label>
                                                </span>
                                                <span><input id="injTraLocP" name="injTraLoc" class="custom-radio"
                                                      type="radio" value="3" <?php if (isset($repatientDetails['injTraLoc'])) {
                                                         if ($repatientDetails['injTraLoc'] == "3") {
                                                            echo 'checked';
                                                         }
                                                      } ?>
                                                      autocomplete="off">
                                                   <label class="choice" for="injTraLocP">Patient Denied</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>
                                       <?php $virtualShow = 'hidden';
                                       $clinicShow = 'hidden';
                                       if (isset($repatientDetails['injTraLoc'])) {
                                          if ($repatientDetails['injTraLoc'] == "1") {
                                             $virtualShow = '';
                                          }
                                       }
                                       if (isset($repatientDetails['injTraLoc'])) {
                                          if ($repatientDetails['injTraLoc'] == "2") {
                                             $clinicShow = '';
                                          }
                                       }
                                       ?>
                                       <li class="<?= $virtualShow; ?> col-md-6 virtualShow">
                                          <label class="description" for="vinjTraSites">Virtual Injection Training
                                             Sites: </label>
                                          <div>
                                             <select class="form-control" id="vinjTraSites"
                                                name="vinjTraSites">
                                                <option value="" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                </option>
                                                <option value="4" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "4") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Rx Connect Pharmacy Solutions - Alberta</option>
                                                <option value="5" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "5") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Bowmanville Infusion Clinic</option>
                                                <option value="6" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "6") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Burlington GI Infusion Clinic</option>
                                                <option value="7" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "7") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Burlington North Infusion Centre</option>
                                                <option value="8" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "8") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Burlington South Infusion Clinic</option>
                                                <option value="9" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "9") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Calgary Infusion Clinic</option>
                                                <option value="10" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "10") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Cambridge Injection Centre</option>
                                                <option value="26" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "26") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Chatham Infusion Clinic</option>
                                                <option value="11" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "11") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Hamilton Infusion Clinic</option>
                                                <option value="12" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "12") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Markham Infusion Centre</option>
                                                <option value="13" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "13") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Milton Infusion Clinic</option>
                                                <option value="14" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "14") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Mississauga North Infusion Clinic</option>
                                                <option value="16" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "16") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Niagara Infusion Centre</option>
                                                <option value="29" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "29") {
                                                      echo 'selected';
                                                   }
                                                } ?>>NS Clinic</option>
                                                <option value="18" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "18") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Oakville Infusion Clinic (Dr Dua)</option>
                                                <option value="20" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "20") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Ottawa Infusion Clinic</option>
                                                <option value="28" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "28") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Rx Connect Specialty Pharmacy - ONTARIO</option>
                                                <option value="27" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "27") {
                                                      echo 'selected';
                                                   }
                                                } ?>>St Catherine's Infusion Clinic (Dr Pratt)
                                                </option>
                                                <option value="23" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "23") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Virtual</option>
                                                <option value="24" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "24") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Waterloo Infusion Clinic</option>
                                                <option value="25" <?php if (isset($repatientDetails['vinjTraSites'])) {
                                                   if ($repatientDetails['vinjTraSites'] == "25") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Windsor Infusion Clinic</option>
                                             </select>
                                          </div>
                                       </li>
                                       <li class="<?= $virtualShow; ?> clearfix"></li>
                                       <li class="<?= $clinicShow; ?> col-md-6 clinicShow">
                                          <label class="description" for="clinicInjTrainingSites">Clinic Injection
                                             Training Sites: </label>
                                          <div>
                                             <select class="form-control" id="clinicInjTrainingSites"
                                                name="clinicInjTrainingSites">
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "") {
                                                      echo 'selected';
                                                   }
                                                } ?> value=""></option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "4") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="4">Rx Connect Pharmacy Solutions -
                                                   Alberta</option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "5") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="5">Bowmanville Infusion Clinic</option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "7") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="7">Burlington North Infusion Centre
                                                </option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "8") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="8">Burlington South Infusion Clinic
                                                </option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "9") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="9">Calgary Infusion Clinic</option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "10") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="10">Cambridge Injection Centre</option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "11") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="11">Hamilton Infusion Clinic</option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "12") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="12">Markham Injection Centre</option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "13") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="13">Milton Infusion Clinic</option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "14") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="14" selected="selected">Mississauga North
                                                   Infusion Clinic</option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "16") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="16">Niagara Infusion Centre</option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "18") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="18">Oakville Infusion Clinic (Dr Dua)
                                                </option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "19") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="19">Rx Connect Specialty Pharmacy -
                                                   ONTARIO</option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "20") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="20">Ottawa Infusion Clinic</option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "23") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="23">Virtual</option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "24") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="24">Waterloo Infusion Clinic</option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "25") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="25">Windsor Infusion Clinic</option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "27") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="27">Chatam Infusion Clinic</option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "28") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="28">Not Rx Connect clinic</option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "29") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="29">Scarborough Clinic Dr. Hessami -
                                                   Injection Clinic</option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "33") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="33">St. Catherines clinic</option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "30") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="30">NS Clinic</option>
                                                <option <?php if (isset($repatientDetails['clinicInjTrainingSites'])) {
                                                   if ($repatientDetails['clinicInjTrainingSites'] == "34") {
                                                      echo 'selected';
                                                   }
                                                } ?> value="34">Toronto Clinic Dr.Morris/Dr.Bacher -
                                                   Injection Clinic</option>
                                             </select>
                                          </div>
                                       </li>
                                       <!--begin here -->
                                       <li class="hidden">
                                          <label class="description">Infusion Services Location: </label>
                                          <div>
                                             <fieldset>

                                                <span><input id="islc" name="isl" <?php if (isset($repatientDetails['isl'])) {
                                                   if ($repatientDetails['isl'] == "1") {
                                                      echo 'checked';
                                                   }
                                                } ?>
                                                      class="custom-radio" type="radio" value="1" autocomplete="off">
                                                   <label class="choice" for="islc">Clinic</label>
                                                </span>
                                                <span><input id="islo" name="isl" <?php if (isset($repatientDetails['isl'])) {
                                                   if ($repatientDetails['isl'] == "2") {
                                                      echo 'checked';
                                                   }
                                                } ?>
                                                      class="custom-radio" type="radio" value="2" autocomplete="off">
                                                   <label class="choice" for="islo">Other</label>
                                                </span>
                                             </fieldset>
                                          </div>
                                       </li>


                                       <li class="hidden">
                                          <label class="description" for="clinicInfSite">Clinic Infusion Sites: </label>
                                          <div>
                                             <select class="form-control" id="clinicInfSite" name="clinicInfSite">
                                                <option value="" <?php if (isset($repatientDetails['clinicInfSite'])) {
                                                   if ($repatientDetails['clinicInfSite'] == "") {
                                                      echo 'selected';
                                                   }
                                                } ?>></option>
                                                <option value="5" <?php if (isset($repatientDetails['clinicInfSite'])) {
                                                   if ($repatientDetails['clinicInfSite'] == "5") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Bowmanville Infusion Clinic</option>
                                                <option value="6" <?php if (isset($repatientDetails['clinicInfSite'])) {
                                                   if ($repatientDetails['clinicInfSite'] == "6") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Burlington GI Infusion Clinic</option>
                                                <option value="7" <?php if (isset($repatientDetails['clinicInfSite'])) {
                                                   if ($repatientDetails['clinicInfSite'] == "7") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Burlington North Infusion Centre</option>
                                                <option value="8" <?php if (isset($repatientDetails['clinicInfSite'])) {
                                                   if ($repatientDetails['clinicInfSite'] == "8") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Burlington South Infusion Clinic</option>
                                                <option value="9" <?php if (isset($repatientDetails['clinicInfSite'])) {
                                                   if ($repatientDetails['clinicInfSite'] == "9") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Calgary Infusion Clinic</option>
                                                <option value="26" <?php if (isset($repatientDetails['clinicInfSite'])) {
                                                   if ($repatientDetails['clinicInfSite'] == "26") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Chatham Infusion Clinic</option>
                                                <option value="11" <?php if (isset($repatientDetails['clinicInfSite'])) {
                                                   if ($repatientDetails['clinicInfSite'] == "11") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Hamilton Infusion Clinic</option>
                                                <option value="13" <?php if (isset($repatientDetails['clinicInfSite'])) {
                                                   if ($repatientDetails['clinicInfSite'] == "13") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Milton Infusion Clinic</option>
                                                <option value="14" <?php if (isset($repatientDetails['clinicInfSite'])) {
                                                   if ($repatientDetails['clinicInfSite'] == "14") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Mississauga North Infusion Clinic</option>
                                                <option value="16" <?php if (isset($repatientDetails['clinicInfSite'])) {
                                                   if ($repatientDetails['clinicInfSite'] == "16") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Niagara Infusion Centre</option>
                                                <option value="18" <?php if (isset($repatientDetails['clinicInfSite'])) {
                                                   if ($repatientDetails['clinicInfSite'] == "18") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Oakville Infusion Clinic (Dr Dua)</option>
                                                <option value="20" <?php if (isset($repatientDetails['clinicInfSite'])) {
                                                   if ($repatientDetails['clinicInfSite'] == "20") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Ottawa Infusion Clinic</option>
                                                <option value="28" <?php if (isset($repatientDetails['clinicInfSite'])) {
                                                   if ($repatientDetails['clinicInfSite'] == "28") {
                                                      echo 'selected';
                                                   }
                                                } ?>>NS Clinic</option>
                                                <option value="24" <?php if (isset($repatientDetails['clinicInfSite'])) {
                                                   if ($repatientDetails['clinicInfSite'] == "24") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Waterloo Infusion Clinic</option>
                                                <option value="25" <?php if (isset($repatientDetails['clinicInfSite'])) {
                                                   if ($repatientDetails['clinicInfSite'] == "25") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Windsor Infusion Clinic</option>
                                             </select>
                                          </div>
                                       </li>

                                       <li class="hidden">
                                          <label class="description" for="infOther">Infusion Other: </label>
                                          <div>
                                             <input id="infOther" name="infOther" class="form-control" type="text"
                                                value="<?php if (isset($repatientDetails['infOther'])) {
                                                   echo $repatientDetails['infOther'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>

                                       <li class="col-md-6">
                                          <fieldset>
                                             <label class="description">First Appointment Date: </label>
                                             <div>
                                                <input type="date" class="form-control" id="firstAppDate" value="<?php if (isset($repatientDetails['firstAppDate'])) {
                                                   echo $repatientDetails['firstAppDate'];
                                                } ?>" name="firstAppDate">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="clearfix"></li>

                                       <li class="col-md-7">
                                          <span class="description">Appointment Time: </span>
                                          <fieldset class="inline-flex">
                                             <span class="nextline">
                                                <input id="appointTimeHH" name="appointTimeHH" class="form-control "
                                                   size="2" type="text" maxlength="2" value="<?php if (isset($repatientDetails['appointTimeHH'])) {
                                                      echo $repatientDetails['appointTimeHH'];
                                                   } ?>" autocomplete="off">
                                                <label for="appointTimeHH" class="text-center">HH</label>
                                             </span>
                                             <span class="nextline">
                                                <input id="appointTimeMM" name="appointTimeMM" class="form-control "
                                                   size="2" type="text" maxlength="2" value="<?php if (isset($repatientDetails['appointTimeMM'])) {
                                                      echo $repatientDetails['appointTimeMM'];
                                                   } ?>" autocomplete="off">
                                                <label for="appointTimeMM" class="text-center">MM</label>
                                             </span>
                                             <span class="nextline">
                                                <select class="form-control" style="width:8em" id="appointTime"
                                                   name="appointTime">
                                                   <option <?php if (isset($repatientDetails['appointTime'])) {
                                                      if ($repatientDetails['appointTime'] == "AM") {
                                                         echo 'selected';
                                                      }
                                                   } ?>
                                                      value="AM">AM</option>
                                                   <option <?php if (isset($repatientDetails['appointTime'])) {
                                                      if ($repatientDetails['appointTime'] == "PM") {
                                                         echo 'selected';
                                                      }
                                                   } ?>
                                                      value="PM">PM</option>
                                                </select>
                                                <label for="appointTime" class="text-center">AM/PM</label>
                                             </span>
                                          </fieldset>
                                       </li>

                                       <li class="clearfix"></li>

                                       <li class="col-md-4">
                                          <fieldset>
                                             <label class="description">Treatment Start Date: </label>
                                             <div>
                                                <input type="date" class="form-control" id="trtStrtDate" value="<?php if (isset($repatientDetails['trtStrtDate'])) {
                                                   echo $repatientDetails['trtStrtDate'];
                                                } ?>" name="trtStrtDate">
                                             </div>
                                          </fieldset>
                                       </li>

                                       <li class="clearfix"></li>

                                       <li class="col-md-4">
                                          <label class="description" for="infFess">Infusion Fees: </label>
                                          <div>
                                             <select class="form-control" id="infFess" name="infFess">
                                                <option value="" <?php if (isset($repatientDetails['infFess'])) {
                                                   if ($repatientDetails['infFess'] == "") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                </option>
                                                <option value="1" <?php if (isset($repatientDetails['infFess'])) {
                                                   if ($repatientDetails['infFess'] == "1") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Pending
                                                   patient appointment</option>
                                                <option value="2" <?php if (isset($repatientDetails['infFess'])) {
                                                   if ($repatientDetails['infFess'] == "2") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Paid
                                                </option>
                                                <option value="3" <?php if (isset($repatientDetails['infFess'])) {
                                                   if ($repatientDetails['infFess'] == "3") {
                                                      echo 'selected';
                                                   }
                                                } ?>>To be
                                                   paid at clinic</option>
                                             </select>
                                          </div>
                                       </li>

                                       <li class="clearfix"></li>

                                       <li class="col-md-4">
                                          <label class="description" for="cashpp">Cash Paying Patient: </label>
                                          <div>
                                             <select class="form-control" id="cashpp" name="cashpp">
                                                <option value="" <?php if (isset($repatientDetails['cashpp'])) {
                                                   if ($repatientDetails['cashpp'] == "") {
                                                      echo 'selected';
                                                   }
                                                } ?>></option>
                                                <option value="1" <?php if (isset($repatientDetails['cashpp'])) {
                                                   if ($repatientDetails['cashpp'] == "1") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Yes
                                                </option>
                                                <option value="2" <?php if (isset($repatientDetails['cashpp'])) {
                                                   if ($repatientDetails['cashpp'] == "2") {
                                                      echo 'selected';
                                                   }
                                                } ?>>No
                                                </option>
                                                <option value="3" <?php if (isset($repatientDetails['cashpp'])) {
                                                   if ($repatientDetails['cashpp'] == "3") {
                                                      echo 'selected';
                                                   }
                                                } ?>>NA
                                                </option>
                                             </select>
                                          </div>
                                       </li>

                                       <li class="clearfix"></li>

                                       <!--
                                    <li class="hidden">
                                       <label class="description" for="uid">UID: </label>
                                       <div>
                                          <input id="uid" name="uid" readonly="readonly" class="form-control" type="text" value="" autocomplete="off">
                                       </div>
                                    </li> -->


                                       <!--
                                    <li class="hidden">
                                       <label class="description" for="hpatientId">Patient ID </label>
                                       <div>
                                          <input id="hpatientId" name="hpatientId" readonly="readonly" class="form-control" type="text" value="" autocomplete="off">
                                       </div>
                                    </li>-->

                                       <li class="col-md-4">
                                          <label class="description" for="coverageType">Coverage Type </label>
                                          <div>
                                             <select class="form-control" id="coverageType" name="coverageType">
                                                <option value="" <?php if (isset($repatientDetails['coverageType'])) {
                                                   if ($repatientDetails['coverageType'] == "") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                </option>
                                                <option value="1" <?php if (isset($repatientDetails['coverageType'])) {
                                                   if ($repatientDetails['coverageType'] == "1") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Public</option>
                                                <option value="2" <?php if (isset($repatientDetails['coverageType'])) {
                                                   if ($repatientDetails['coverageType'] == "2") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Private</option>
                                                <option value="3" <?php if (isset($repatientDetails['coverageType'])) {
                                                   if ($repatientDetails['coverageType'] == "3") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Public + Private</option>
                                                <option value="4" <?php if (isset($repatientDetails['coverageType'])) {
                                                   if ($repatientDetails['coverageType'] == "4") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Compassionate</option>
                                             </select>
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-4">
                                          <label class="description" for="trtStatus">Treatment Status </label>
                                          <div>
                                             <select class="form-control" id="trtStatus" name="trtStatus">
                                                <option value="" <?php if (isset($repatientDetails['trtStatus'])) {
                                                   if ($repatientDetails['trtStatus'] == "") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                </option>
                                                <option value="1" <?php if (isset($repatientDetails['trtStatus'])) {
                                                   if ($repatientDetails['trtStatus'] == "1") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                   Pending</option>
                                                <option value="11" <?php if (isset($repatientDetails['trtStatus'])) {
                                                   if ($repatientDetails['trtStatus'] == "11") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                   Pending - Patient unreachable</option>
                                                <option value="13" <?php if (isset($repatientDetails['trtStatus'])) {
                                                   if ($repatientDetails['trtStatus'] == "13") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                   Pending - Medical clearance</option>
                                                <option value="20" <?php if (isset($repatientDetails['trtStatus'])) {
                                                   if ($repatientDetails['trtStatus'] == "20") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                   Pending - test</option>
                                                <option value="2" <?php if (isset($repatientDetails['trtStatus'])) {
                                                   if ($repatientDetails['trtStatus'] == "2") {
                                                      echo 'selected';
                                                   }
                                                } ?>>On
                                                   treatment</option>
                                                <option value="21" <?php if (isset($repatientDetails['trtStatus'])) {
                                                   if ($repatientDetails['trtStatus'] == "21") {
                                                      echo 'selected';
                                                   }
                                                } ?>>On
                                                   Treatment - Rx Connect</option>
                                                <option value="6" <?php if (isset($repatientDetails['trtStatus'])) {
                                                   if ($repatientDetails['trtStatus'] == "6") {
                                                      echo 'selected';
                                                   }
                                                } ?>>On
                                                   treatment-Transfer out PPN</option>
                                                <option value="7" <?php if (isset($repatientDetails['trtStatus'])) {
                                                   if ($repatientDetails['trtStatus'] == "7") {
                                                      echo 'selected';
                                                   }
                                                } ?>>On
                                                   treatment-Transfer out pt choice</option>
                                                <option value="9" <?php if (isset($repatientDetails['trtStatus'])) {
                                                   if ($repatientDetails['trtStatus'] == "9") {
                                                      echo 'selected';
                                                   }
                                                } ?>>On
                                                   treatment-Transfer for bridging</option>
                                                <option value="14" <?php if (isset($repatientDetails['trtStatus'])) {
                                                   if ($repatientDetails['trtStatus'] == "14") {
                                                      echo 'selected';
                                                   }
                                                } ?>>On
                                                   treatment - Transfer compassionate use
                                                </option>
                                                <option value="3" <?php if (isset($repatientDetails['trtStatus'])) {
                                                   if ($repatientDetails['trtStatus'] == "3") {
                                                      echo 'selected';
                                                   }
                                                } ?>>On
                                                   hold</option>
                                                <option value="23" <?php if (isset($repatientDetails['trtStatus'])) {
                                                   if ($repatientDetails['trtStatus'] == "23") {
                                                      echo 'selected';
                                                   }
                                                } ?>>Not
                                                   enrolled due to high deductible - changed
                                                   medication</option>
                                                <option value="4" <?php if (isset($repatientDetails['trtStatus'])) {
                                                   if ($repatientDetails['trtStatus'] == "4") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                   Discontinued</option>
                                                <option value="15" <?php if (isset($repatientDetails['trtStatus'])) {
                                                   if ($repatientDetails['trtStatus'] == "15") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                   Discontinued - Pt choice</option>
                                                <option value="16" <?php if (isset($repatientDetails['trtStatus'])) {
                                                   if ($repatientDetails['trtStatus'] == "16") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                   Discontinued - MD choice</option>
                                                <option value="5" <?php if (isset($repatientDetails['trtStatus'])) {
                                                   if ($repatientDetails['trtStatus'] == "5") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                   Transferred to other pharmacy</option>
                                                <option value="17" <?php if (isset($repatientDetails['trtStatus'])) {
                                                   if ($repatientDetails['trtStatus'] == "17") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                   Transfer to other pharmacy - Pt choice</option>
                                                <option value="8" <?php if (isset($repatientDetails['trtStatus'])) {
                                                   if ($repatientDetails['trtStatus'] == "8") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                   Transferred PPN</option>
                                             </select>
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <li class="col-md-4">
                                          <label class="description" for="pspPatientId">PSP Patient ID </label>
                                          <div>
                                             <input id="pspPatientId" name="pspPatientId" class="form-control"
                                                type="text" value="<?php if (isset($repatientDetails['pspPatientId'])) {
                                                   echo $repatientDetails['pspPatientId'];
                                                } ?>" autocomplete="off">
                                          </div>
                                       </li>
                                       <li class="clearfix"></li>
                                       <!-- <li class="col-md-4">
                                          <label class="description" for="drugStatus">Drug Status: </label>
                                          <div>
                                             <select class="form-control" id="drugStatus" name="drugStatus">
                                                <option value="" <?php if (isset($repatientDetails['drugStatus'])) {
                                                   if ($repatientDetails['drugStatus'] == "") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                </option>
                                                <option value="1" <?php if (isset($repatientDetails['drugStatus'])) {
                                                   if ($repatientDetails['drugStatus'] == "1") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                   Bridging</option>
                                                <option value="2" <?php if (isset($repatientDetails['drugStatus'])) {
                                                   if ($repatientDetails['drugStatus'] == "2") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                   Commercial</option>
                                                <option value="3" <?php if (isset($repatientDetails['drugStatus'])) {
                                                   if ($repatientDetails['drugStatus'] == "3") {
                                                      echo 'selected';
                                                   }
                                                } ?>>
                                                   Compassionate (FOC)</option>
                                             </select>
                                          </div>
                                       </li> -->
                                       <li class="col-md-4 patientType fixselect">
                                          <label class="description" for="drugStatus">Patient Type:  <a id="getActivityInfo">(Activity Status)</a> </label>
                                          
                                                <!--NEW INPUT -->
<select class="form-control select2bs4" name="patientType" id="patientType">
   <option title="" <?php if (isset($repatientDetails['patientType'])) {if ($repatientDetails['patientType'] == "") {echo 'selected';}} ?> value="0"></option>
   <option  <?php if (isset($repatientDetails['patientType'])) {if ($repatientDetails['patientType'] == "1") {echo 'selected';}} ?> title="Pts receiving free goods because of approved clinical trial participation" value="1">Clinical Trial <i class="fa fa-info-circle"></i></option>
   <option  <?php if (isset($repatientDetails['patientType'])) {if ($repatientDetails['patientType'] == "2") {echo 'selected';}} ?> title="Patients who have all doses covered by Payer, including those who may be on dose optimization" value="2">Commercial</option>
   <option  <?php if (isset($repatientDetails['patientType'])) {if ($repatientDetails['patientType'] == "3") {echo 'selected';}} ?> value="3" title="Patient has regular dosing covered by payer and alternate dosing funded by Sanofi" >Commercial - Alt. Dose Free Goods </option>
   <option  <?php if (isset($repatientDetails['patientType'])) {if ($repatientDetails['patientType'] == "4") {echo 'selected';}} ?> value="4" title="PAP approved patients (medically approved on label compassionate requests)">Compassionate </option>
   <option  <?php if (isset($repatientDetails['patientType'])) {if ($repatientDetails['patientType'] == "5") {echo 'selected';}} ?> value="5"  title="Expanded FastStart where coverage is not yet available (ex. AD Infant)">Fast Start - Bridge </option>
   <option  <?php if (isset($repatientDetails['patientType'])) {if ($repatientDetails['patientType'] == "6") {echo 'selected';}} ?> value="6" title="FastStart patient">Fast Start - Retro </option>
   <option  <?php if (isset($repatientDetails['patientType'])) {if ($repatientDetails['patientType'] == "7") {echo 'selected';}} ?> value="7"  title="Patient is not eligible for FastStart but, if they are on drug, it is due to something like being incorrectly sampled by the MD, or re-enrolling in the program while they are already on drug; incorrectly sampled patients will not be continued to free drug after payer denial **new update so some previously incorrectly sampled patients are grandfathered to the LTB group">Fast Start Criteria Not Met </option>
   <option  <?php if (isset($repatientDetails['patientType'])) {if ($repatientDetails['patientType'] == "8") {echo 'selected';}} ?> title="PAP dose optimization;  includes patients who had commercial coverage, andbecause of a dose optimization, they are now 100% free goods" value="8">Free Goods - Dose Opt</option>
   <option  <?php if (isset($repatientDetails['patientType'])) {if ($repatientDetails['patientType'] == "9") {echo 'selected';}} ?> value="9" title="Patients who have expended all coverage and are now receiving free goods ">Lifetime Plan Max </option>
   <option  <?php if (isset($repatientDetails['patientType'])) {if ($repatientDetails['patientType'] == "10") {echo 'selected';}} ?> value="10" title="Patients who lost coverage due to job or insurance access change">LOC </option>
   <option  <?php if (isset($repatientDetails['patientType'])) {if ($repatientDetails['patientType'] == "11") {echo 'selected';}} ?> value="11" title="Patients who qualified for FastStart but were denied by their payer">Long Term Bridging - Denial </option>
   <option  <?php if (isset($repatientDetails['patientType'])) {if ($repatientDetails['patientType'] == "12") {echo 'selected';}} ?> value="12" title="Legacy Asthma Bridging Program">Long Term Bridging - No Payer Access </option>
   <option  <?php if (isset($repatientDetails['patientType'])) {if ($repatientDetails['patientType'] == "13") {echo 'selected';}} ?> value="13" title="Patients who have commercial coverage but the low annual amount does not cover the full annual cost of treatment.">Low Annual Max </option>
   <option  <?php if (isset($repatientDetails['patientType'])) {if ($repatientDetails['patientType'] == "14") {echo 'selected';}} ?> value="14" title="SA lapse for RAMQ & NIHB patients with non-Innomar pharmacy; in the case of your pharmacy, it would be patients outside your pharmacy network vs outside of Innomar's network">SA Lapse </option>
   <option  <?php if (isset($repatientDetails['patientType'])) {if ($repatientDetails['patientType'] == "15") {echo 'selected';}} ?> value="15" title="SA lapse due to renewal delays (exc. RAMQ & NIHB) with an Innomar pharmacy">SA Lapse - Retro </option>
   <option  <?php if (isset($repatientDetails['patientType'])) {if ($repatientDetails['patientType'] == "16") {echo 'selected';}} ?> value="16" title="SA lapse for 1st NIHB/RAMQ renewals">Short Term Bridging/ Limited Timeframe </option>
   <option  <?php if (isset($repatientDetails['patientType'])) {if ($repatientDetails['patientType'] == "17") {echo 'selected';}} ?> value="17" title="Information available is not sufficient to confirm FastStart eligiblity">Undefined / Missing Information </option>
</select>
                                                  
                                                <!--NEW INPUT -->

                                            
                                             
                                         
                                       </li>
                                       
                                    </ul>
                                    <!-- Reimbursement CALL END -->
                                    <div class="form-group text-center mar-b-0">
                                       <input type="button" value="BACK" class="btn btn-secondary back">
                                       <input type="button" value="NEXT" class="btn btn-primary next">
                                       <input type="submit" name="reimbursementUpdate" value="SAVE & NEXT" class="btn btn-primary">
                                       <input type="submit" value="SAVE" name="reimbursementUpdate"
                                          class="btn btn-success save">
                                    </div>
                                 </form>
                              </div>
                           </div>

                           <div class="form-container animated">
                              <h2 class="text-center form-title">Review</h2>
                              <!-- FORM SECTION -->
                              <div class="row">
                                 <?php include 'review_include.php'; ?>
                                 <div class="form-group text-center mar-b-0">
                                    <input type="button" value="BACK" class="btn btn-secondary back">
                                    <a href="patient_form_download.php?id=<?= $_GET['id']; ?>&fileId=<?= $_GET['fileId']; ?>"
                                       target="_blank" class="btn btn-default bg-gradient-default">Download</a>
                                 </div>
                              </div>
                           </div>

                           <script src="js/editPatient.js"></script>
                           <!-- bs-custom-file-input -->
                           <script src="plugins/bs-custom-file-input/bs-custom-file-input.min.js"></script>
                           
      </div>
   </div>
</div>

<?php include('../footer.php');
ob_end_flush();
?>
                          