function hmgt_view_priscription()
{
    $obj_medicine = new Hmgtmedicine();
    $obj_treatment = new Hmgt_treatment();
    $obj_prescription = new Hmgtprescription();
    $result = $obj_prescription->get_prescription_data($_REQUEST['prescription_id']);
    ?>
			<div class="modal-header">
			<a href="#" class="close-btn-cat badge badge-success pull-right">X</a>
			<h4 class="modal-title"><?php 
    echo get_option('hmgt_hospital_name');
    ?>
</h4>
			</div>
			<hr>
			<div class="panel-body prescription_pop_content">
			<table width="100%" border="0">
	            <tbody><tr>
	                <td valign="top" align="left">
	                        <?php 
    _e('Patient Name', 'hospital_mgt');
    ?>
 : <?php 
    echo hmgt_get_display_name($result->patient_id);
    ?>
<br>
	                    
	                        <?php 
    _e('Sex', 'hospital_mgt');
    ?>
 : <?php 
    echo get_user_meta($result->patient_id, 'gender', true);
    ?>
 <br>
	                                    </td>
	                <td valign="top" align="right">
	                   <?php 
    _e('Doctor Name', 'hospital_mgt');
    ?>
 : <?php 
    echo hmgt_get_display_name($result->prescription_by);
    ?>
<br>
	                   <?php 
    _e('Date', 'hospital_mgt');
    ?>
 : <?php 
    echo $result->pris_create_date;
    ?>
<br>
	                  
	                </td>
	            </tr>
	        	</tbody>
        	 </table>
        	 <hr>
        	 <div class="row">
            <div class="col-md-12">

                <div data-collapsed="0" class="panel panel-primary">
                        
                    <div class="panel-body">
                            
                        <b><?php 
    _e('Case History', 'hospital_mgt');
    ?>
 : </b>
                        
                        <p><?php 
    echo $result->case_history;
    ?>
</p>                        
                        <hr>     
                         <b><?php 
    _e('Treatment', 'hospital_mgt');
    ?>
 : </b>
                        
                        <p><?php 
    echo $treatment = $obj_treatment->get_treatment_name($result->teratment_id);
    ?>
</p>   
                        <hr>                       
                        <b> <?php 
    _e('Medication', 'hospital_mgt');
    ?>
 : </b>
                        <div class="table-responsive">
                        <table class="table">
                        <tr>
                        <th><?php 
    _e('Name', 'hospital_mgt');
    ?>
</th>
                        <th><?php 
    _e('Times', 'hospital_mgt');
    ?>
</th>
                        <th><?php 
    _e('Days', 'hospital_mgt');
    ?>
</th>
                        </tr>
                        <?php 
    $all_medicine_list = json_decode($result->medication_list);
    if (!empty($all_medicine_list)) {
        foreach ($all_medicine_list as $retrieved_data) {
            ?>
                        	<tr>
											
											<td><?php 
            $medicine = $obj_medicine->get_single_medicine($retrieved_data->medication_name);
            echo $medicine->medicine_name;
            ?>
</td>
											<td><?php 
            echo $retrieved_data->time;
            ?>
</td>
											<td><?php 
            echo $retrieved_data->per_days;
            ?>
</td>
											</tr>
                        	<?php 
        }
    }
    ?>
                        
                       
                        </table>
                        </div>
                        <hr>
                        
                        <b><?php 
    _e('Extra Note', 'hospital_mgt');
    ?>
 :</b>
                        
                        <p><?php 
    echo $result->treatment_note;
    ?>
</p>
                        <?php 
    $all_entry = json_decode($result->custom_field);
    if (!empty($all_entry)) {
        foreach ($all_entry as $entry) {
            ?>
                      		<hr>
                      		<b><?php 
            echo $entry->label;
            ?>
</b>
                      		<P><?php 
            echo $entry->value;
            ?>
</P>
                      		
                      		<?php 
        }
    }
    ?>
					<hr>
                    </div>

                </div>
				<div class="print-button pull-left">
						<a  href="?page=hmgt_prescription&print=print&prescription_id=<?php 
    echo $_POST['prescription_id'];
    ?>
" target="_blank"class="btn btn-success"><?php 
    _e('Print', 'hospital_mgt');
    ?>
</a>
				</div>
            </div>
        	</div>
        	 </div>
	<?php 
    die;
}
} );
</script>
<?php 
if (isset($_REQUEST['save_appointment'])) {
    if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'insert' || $_REQUEST['action'] == 'edit')) {
        $result = $obj_appointment->hmgt_add_appointment($_POST);
        if ($result) {
            $hmgt_sms_service_enable = 0;
            if (isset($_POST['hmgt_sms_service_enable'])) {
                $hmgt_sms_service_enable = $_POST['hmgt_sms_service_enable'];
            }
            if ($hmgt_sms_service_enable) {
                $doctor_number = "+" . hmgt_get_countery_phonecode(get_option('hmgt_contry')) . get_user_meta($_REQUEST['doctor_id'], 'mobile', true);
                $patient_number = "+" . hmgt_get_countery_phonecode(get_option('hmgt_contry')) . get_user_meta($_REQUEST['patient_id'], 'mobile', true);
                $doctor_name = hmgt_get_display_name($_REQUEST['doctor_id']);
                $patient_name = hmgt_get_display_name($_REQUEST['patient_id']);
                $message = "The Appointment has been booked for {$patient_name} with Dr. {$doctor_name} on DATE : " . $_REQUEST['appointment_date'] . " TIME : " . $_REQUEST['appointment_time'];
                if ($current_sms_service == 'clickatell') {
                    $clickatell = get_option('hmgt_clickatell_sms_service');
                    $to1 = $doctor_number;
                    $to2 = $patient_number;
                    $message = $message_content;
                    $username = $clickatell['username'];
                    //clickatell username
                    $password = $clickatell['password'];
                    // clickatell password
                    $api_key = $clickatell['api_key'];
                    //clickatell apikey
                    $baseurl = "http://api.clickatell.com";
                    $url = "{$baseurl}/http/auth?user={$username}&password={$password}&api_id={$api_key}";
                    $ret = file($url);
</h3>
        <p class="message-date"><?php 
if ($box == 'sendbox') {
    echo mysql2date('d/m/y', $message->date);
} else {
    echo mysql2date('d/m/y', $message->msg_date);
}
?>
</p>
	</div>
	<div class="message-sender">                                
    	<p><?php 
if ($box == 'sendbox') {
    echo hmgt_get_display_name($message->post_author);
} else {
    echo hmgt_get_display_name($message->sender);
}
?>
 <span>&lt;<?php 
if ($box == 'sendbox') {
    echo hmgt_get_emailid_byuser_id($message->post_author);
} else {
    echo hmgt_get_emailid_byuser_id($message->sender);
}
?>
&gt;</span></p>
    </div>
    <div class="message-content">
    	<p><?php 
if ($box == 'sendbox') {
    echo $message->post_content;
?>
</th>
             <th>
                  <?php 
_e('Description', 'hospital_mgt');
?>
            </th>
            </tr>
 		<?php 
$message = $obj_message->hmgt_get_inbox_message(get_current_user_id(), $limit, $max);
foreach ($message as $msg) {
    ?>
 			<tr>
 			
            <td><?php 
    echo hmgt_get_display_name($msg->sender);
    ?>
</td>
             <td>
                 <a href="?page=hmgt_message&tab=inbox&tab=view_message&from=inbox&id=<?php 
    echo $msg->message_id;
    ?>
"> <?php 
    echo $msg->msg_subject;
    ?>
</a>
            </td>
            <td>&nbsp;
            </td>
            <td>
                <?php 
            </th>
            </tr>
 		<?php 
$offset = 0;
if (isset($_REQUEST['pg'])) {
    $offset = $_REQUEST['pg'];
}
$message = $obj_message->hmgt_get_send_message(get_current_user_id(), $max, $offset);
foreach ($message as $msg_post) {
    if ($msg_post->post_author == get_current_user_id()) {
        ?>
 			<tr>
 			<td class="hidden-xs message_for">
            	<span><?php 
        if (get_post_meta($msg_post->ID, 'message_for', true) == 'user') {
            echo hmgt_get_display_name(get_post_meta($msg_post->ID, 'message_for_userid', true));
        } else {
            echo get_role_name_in_message(get_post_meta($msg_post->ID, 'message_for', true));
        }
        ?>
</span>
            </td>
            <td class="message_title"><a href="?dashboard=user&page=message&tab=view_message&from=sendbox&id=<?php 
        echo $msg_post->ID;
        ?>
"><?php 
        echo $msg_post->post_title;
        ?>
</a></td>
             <td class="messsage_body">
                  <?php