function hmgt_patient_invoice_print($invoice_id)
{
    $obj_invoice = new Hmgtinvoice();
    if ($_REQUEST['invoice_type'] == 'invoice') {
        $invoice_data = get_invoice_data($invoice_id);
    }
    if ($_REQUEST['invoice_type'] == 'income') {
        $income_data = $obj_invoice->hmgt_get_income_data($invoice_id);
    }
    if ($_REQUEST['invoice_type'] == 'expense') {
        $expense_data = $obj_invoice->hmgt_get_income_data($invoice_id);
    }
    //$invoice_data=get_invoice_data($invoice_id);
    //var_dump($income_data);
    //exit;
    ?>
		
			
			<div class="modal-body">
				<div id="invoice_print" style="width: 90%;margin:0 auto;"> 
				<div class="modal-header">
			
			<h4 class="modal-title"><?php 
    echo get_option('hmgt_hospital_name');
    ?>
</h4>
			</div>
					<table width="100%" border="0">
						<tbody>
							<tr>
								<td width="70%">
									<img style="max-height:80px;" src="<?php 
    echo get_option('hmgt_hospital_logo');
    ?>
">
								</td>
								<td width="24%" align="right">
								<h4><?php 
    if (!empty($invoice_data)) {
        $invoice_no = $invoice_data->invoice_number;
        _e('Invoice number', 'hospital_mgt');
        echo " : " . $invoice_no;
    }
    ?>
 </h4>
									<h4><?php 
    // _e('Invoice number','hospital_mgt');
    ?>
 </h4>
									<h5><?php 
    $issue_date = 'DD-MM-YYYY';
    if (!empty($income_data)) {
        $issue_date = $income_data->income_create_date;
        $payment_status = $income_data->payment_status;
    }
    if (!empty($invoice_data)) {
        $issue_date = $invoice_data->invoice_create_date;
        $payment_status = $invoice_data->status;
    }
    if (!empty($expense_data)) {
        $issue_date = $expense_data->income_create_date;
        $payment_status = $expense_data->payment_status;
    }
    echo __('Issue Date', 'hospital_mgt') . " : " . $issue_date;
    ?>
</h5>
									<h5><?php 
    echo __('Status', 'hospital_mgt') . " : " . $payment_status;
    ?>
</h5>
								</td>
							</tr>
						</tbody>
					</table>
					<hr>
					<table width="100%" border="0">
						<tbody>
							<tr>
								<td align="left">
									<h4><?php 
    _e('Payment To', 'hospital_mgt');
    ?>
 </h4>
								</td>
								<td align="right">
									<h4><?php 
    _e('Bill To', 'hospital_mgt');
    ?>
 </h4>
								</td>
							</tr>
							<tr>
								<td valign="top" align="left">
									<?php 
    echo get_option('hmgt_hospital_name') . "<br>";
    echo get_option('hmgt_hospital_address') . ",";
    echo get_option('hmgt_contry') . "<br>";
    echo get_option('hmgt_contact_number') . "<br>";
    ?>
									
								</td>
								<td valign="top" align="right">
									<?php 
    if (!empty($expense_data)) {
        echo $party_name = $expense_data->party_name;
    } else {
        if (!empty($income_data)) {
            $patiet_id = $income_data->party_name;
        }
        if (!empty($invoice_data)) {
            $patiet_id = $invoice_data->patient_id;
        }
        $patient = get_userdata($patiet_id);
        echo $patient->display_name . "<br>";
        echo get_user_meta($patiet_id, 'address', true) . ",";
        echo get_user_meta($patiet_id, 'city_name', true) . ",";
        echo get_user_meta($patiet_id, 'zip_code', true) . ",";
        echo get_user_meta($patiet_id, 'country_name', true) . "<br>";
        echo get_user_meta($patiet_id, 'mobile', true) . "<br>";
    }
    ?>
								</td>
							</tr>
						</tbody>
					</table>
					<hr>
					<h4><?php 
    _e('Invoice Entries', 'hospital_mgt');
    ?>
</h4>
					<table class="table table-bordered" width="100%" border="1" style="border-collapse:collapse;">
						<thead>
							<tr>
								<th class="text-center">#</th>
								<th width="60%"><?php 
    _e('Entry', 'hospital_mgt');
    ?>
 </th>
								<th><?php 
    _e('Price', 'hospital_mgt');
    ?>
</th>
							</tr>
						</thead>
						<tbody>
						<?php 
    $id = 1;
    $total_amount = 0;
    if (!empty($income_data) || !empty($expense_data)) {
        if (!empty($expense_data)) {
            $income_data = $expense_data;
        }
        $patient_all_income = $obj_invoice->get_onepatient_income_data($income_data->party_name);
        foreach ($patient_all_income as $result_income) {
            $income_entries = json_decode($result_income->income_entry);
            foreach ($income_entries as $each_entry) {
                $total_amount += $each_entry->amount;
                ?>
							<tr>
								<td class="text-center"><?php 
                echo $id;
                ?>
</td>
								<td><?php 
                echo $each_entry->entry;
                ?>
 </td>
								<td class="text-right"> <?php 
                echo $each_entry->amount;
                ?>
</td>
							</tr>
								<?php 
                $id += 1;
            }
        }
    }
    if (!empty($invoice_data)) {
        $total_amount = $invoice_data->invoice_amount;
        ?>
							<tr>
								<td class="text-center"><?php 
        echo $id;
        ?>
</td>
								<td><?php 
        echo $invoice_data->invoice_title;
        ?>
 </td>
								<td class="text-right"> <?php 
        echo $invoice_data->invoice_amount;
        ?>
</td>
							</tr>
							<?php 
    }
    ?>
						</tbody>
					</table>
					<table width="100%" border="0">
						<tbody>
							
							<?php 
    if (!empty($invoice_data)) {
        $vat = $total_amount * ($invoice_data->vat_percentage / 100);
        $total_with_tax = $total_amount + $vat;
        $grand_total = $total_with_tax - $invoice_data->discount;
        ?>
							<tr>
								<td width="80%" align="right"><?php 
        _e('Sub Total :', 'hospital_mgt');
        ?>
</td>
								<td align="right"><?php 
        echo $total_amount;
        ?>
</td>
							</tr>
							<tr>
								<td width="80%" align="right"><?php 
        _e('Vat Percentage :', 'hospital_mgt');
        ?>
</td>
								<td align="right"><?php 
        echo $vat;
        ?>
</td>
							</tr>
							<tr>
								<td width="80%" align="right"><?php 
        _e('Discount :', 'hospital_mgt');
        ?>
</td>
								<td align="right"><?php 
        echo $invoice_data->discount;
        ?>
</td>
							</tr>
							<tr>
								<td colspan="2">
									<hr style="margin:0px;">
								</td>
							</tr>
							<?php 
    }
    if (!empty($income_data)) {
        $grand_total = $total_amount;
    }
    ?>
								
							<tr>
								<td width="80%" align="right"><?php 
    _e('Grand Total :', 'hospital_mgt');
    ?>
</td>
								<td align="right"><h4><?php 
    echo $grand_total;
    ?>
</h4></td>
							</tr>
						</tbody>
					</table>
				</div>
				
			</div>
	
	<?php 
    die;
}
<?php

$obj_invoice = new Hmgtinvoice();
$active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'invoicelist';
?>

<!-- POP up code -->
<div class="popup-bg">
    <div class="overlay-content">
    <div class="modal-content">
    <div class="invoice_data">
     </div>

    </div>
    </div>

</div>
<!-- End POP-UP Code -->
<div class="page-inner" style="min-height:1631px !important">
<div class="page-title">
		<h3><img src="<?php 
echo get_option('hmgt_hospital_logo');
?>
" class="img-circle head_logo" width="40" height="40" /><?php 
echo get_option('hmgt_hospital_name');
?>
</h3>
	</div>
	<?php 
if (isset($_POST['save_invoice'])) {
    if ($_REQUEST['action'] == 'edit') {
<?php

//This is Dashboard at admin side
$obj_invoice = new Hmgtinvoice();
if ($active_tab == 'expenselist') {
    $invoice_id = 0;
    if (isset($_REQUEST['income_id'])) {
        $invoice_id = $_REQUEST['income_id'];
    }
    $edit = 0;
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit') {
        $edit = 1;
        $result = $obj_invoice->hmgt_get_invoice_data($invoice_id);
    }
    ?>
			     <script type="text/javascript">
$(document).ready(function() {
	jQuery('#tblexpence').DataTable({
		 "order": [[ 2, "Desc" ]],
		 "aoColumns":[
	                  {"bSortable": true},
	                  {"bSortable": true},
	                  {"bSortable": true},
	                  
	                                   
	                  {"bSortable": false}
	               ]
		});
		
	
} );
<?php

//This is Dashboard at admin side
$obj_invoice = new Hmgtinvoice();
?>
	<script type="text/javascript">

$(document).ready(function() {
	$('#expense_form').validationEngine();
	$('#invoice_date').datepicker({
		  changeMonth: true,
	        changeYear: true,
	        dateFormat: 'yy-mm-dd',
	        yearRange:'-65:+0',
	        onChangeMonthYear: function(year, month, inst) {
	            $(this).val(month + "/" + year);
	        }
                    
                }); 
		
} );
</script>
	
     <?php 
if ($active_tab == 'addexpense') {
    $expense_id = 0;
    if (isset($_REQUEST['expense_id'])) {
        $expense_id = $_REQUEST['expense_id'];
    }
    $edit = 0;
    if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'edit') {