<?php
include('../config/config.php');
include('../classes/classPatient.php');
include("../classes/classImages.php");
include('../classes/classTransaction.php');
include('../classes/classWardMgmt.php');
include("../classes/classVisits.php");


################## Create Invoice Start ####################################


if(isset($_GET['adm_no'])&&isset($_GET['patient_id']))
{
	$_SESSION['temp']['adm_no'] = base64_decode($_GET['adm_no']);
	$_SESSION['temp']['patient_id'] = base64_decode($_GET['patient_id']);
	
}
if(isset($_SESSION['temp']['patient_id'])&&$_SESSION['temp']['patient_id']!='')
{
	$patient_id = $_SESSION['temp']['patient_id'];
}
if(isset($_SESSION['temp']['adm_no'])&&$_SESSION['temp']['adm_no']!='')
{
	$adm_no = $_SESSION['temp']['adm_no'];
}


################## Update payment details Start ####################################
try
{
	$allotmentPaymentOb = new classWardMgmt;
	$allotmentPaymentOb->setWardBedAdmissionNo($adm_no);
	$allotmentPaymentOb->createDischargeBill();
}
catch (MyException $e)
{
	$error_message = $e->getUserMsg();
}	
################## Retrieve Data Start ####################################

try
{
	
	$retrievePatientOb = new classPatient;
	if(isset($patient_id)&&($patient_id!=''&&$patient_id!=0))
	{
		$retrievePatientOb->setPatientAutoID($patient_id);
		$patient_single_detail = $retrievePatientOb->retrievePatientByPatientID();
	}
	
	$allotmentOb = new classWardMgmt;
	$allotmentOb->setWardBedAdmissionNo($adm_no);
	$dis_slip_array = $allotmentOb->retrieveDischargeBill();
	$allotment_array = $allotmentOb->retrieveAllotmentsByAdmNo();
}
catch (MyException $e)
{
	$error_message = $e->getUserMsg();
}	
		

try
{
	$tranOb = new classTransaction;
	$account_data = $tranOb->retrieveAccountHeadAndAccountByID(2,28);	
}
catch (MyException $e)
{
	$error_message = $e->getUserMsg();
}

/*echo '<pre>';
print_r($allotment_array);
echo '</pre>';
exit;*/

			


?>
<!DOCTYPE html>
<html><!-- InstanceBegin template="/Templates/main.dwt.php" codeOutsideHTMLIsLocked="false" -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<head> 
    <link rel="shortcut icon" href="../images/favicon.png">
    <!-- InstanceBeginEditable name="doctitle" -->
    <title>Med2TEC Hospital Management Information System</title>
    <!-- InstanceEndEditable -->
    <!--Core CSS -->
    <link href="../bs3/css/bootstrap.min.css" rel="stylesheet"> 
    <link href="../css/style.css" rel="stylesheet">
    <link href="../css/style-responsive.css" rel="stylesheet"/> 
    <link href="../popUp/popUp.css" rel="stylesheet">
    <link href="../css/bootstrap-fullcalendar.css" rel="stylesheet"/> 
    
    <link href="../css/clndr.css" rel="stylesheet">
    
    <link href="../css/css/font-awesome.css" rel="stylesheet">
    
    <link href="../assets/jquery-ui/jquery-ui-1.10.1.custom.min.css" rel="stylesheet">
    <link href="../assets/jvector-map/jquery-jvectormap-1.2.2.css" rel="stylesheet">    
    <link href="../assets/jquery-multi-select/css/multi-select.css" rel="stylesheet" type="text/css">
    <!--clock css-->
    <link href="../assets/css3clock/css/style.css" rel="stylesheet"> 
    <!--Morris Chart CSS -->
    <link rel="stylesheet" href="../assets/morris-chart/morris.css">
    <!-- Custom styles for this template -->
   
    <link href="../datepicker/jquery-ui.css" rel="stylesheet" >   
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>
<body>

<section id="container">
    <!--header start-->
    <header class="header fixed-top clearfix">
        <!--logo start-->
        <div class="brand">

            <a href="home.php" class="logo">
                <img src="../images/logo.png" alt="">
            </a>
            <div class="sidebar-toggle-box">
                <div class="fa fa-bars"></div>  
            </div>
        </div> 
        <!--logo end-->

        <div class="nav notify-row" id="top_menu" style="float: right; margin-top: 16px; margin-left: 0px; margin-right: 10px;">
            <!--  notification start -->
             <img alt="" src="../images/org_logos/<?php echo $_SESSION['security']['org_id']?>.png">
            <!--  notification end -->
        </div>
        <div class="top-nav clearfix">
            <!--search & user info start-->
            <ul class="nav pull-right top-menu">
                <li>
                    <div class="toggle-right-box"><!-- InstanceBeginEditable name="print" -->
                    <a href="javascript:Popup('printipddischarge.php')"><i class="fa fa-print" style="margin-left: 11px; margin-top: 11px;"></i></a>
					<!-- InstanceEndEditable --></div>
                </li>
                <!-- user login dropdown start-->
                <li class="dropdown">
                    <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                        <img alt="" src="../images/avatar1_small.jpg"> 
                        <span class="username"><?php echo $username;?></span>
                        <b class="caret"></b>
                    </a>
                    <ul class="dropdown-menu extended logout">
                        <li><a href="profile.php"><i class=" fa fa-suitcase"></i>Profile</a></li>
                        <li><a href="#update_password-box" class="update_password-window"><i class="fa fa-cog"></i> Change Password</a></li>
                        <li><a href="../logout.php"><i class="fa fa-key"></i> Log Out</a></li>
                    </ul>
                </li>
                <!-- user login dropdown end -->
                <li>
                    <div class="toggle-right-box">
                        <div class="fa fa-bars"></div>
                    </div>
                </li>
            </ul>
            <!--search & user info end-->
        </div>
    </header>
    <!--header end-->
    <!--sidebar start-->
   <aside>
        <div id="sidebar" class="nav-collapse">
            <!-- sidebar menu start-->
            <ul class="sidebar-menu" id="nav-accordion">
             <?php
					  
$orgOb = new classUser;
$orgOb->retrieveOrgDataByOrgID($_SESSION['security']['org_id']);

		  if($orgOb->getDB())
		  {
				if($_SESSION['security']['userrole_id']==1||$_SESSION['security']['userrole_id']==2||$_SESSION['security']['userrole_id']==9||$_SESSION['security']['userrole_id']==100)
				{
					?>
					  	<li>
                    	<a class="active" href="db.php" style="background:#0072BC;">
                        <i class="fa fa-dashboard"></i> 
                        <span>Dashboard</span>
                    	</a>
                		</li>
					  <?php
				}
		  }
				if($_SESSION['security']['userrole_id']==1||$_SESSION['security']['userrole_id']==2||$_SESSION['security']['userrole_id']==3||$_SESSION['security']['userrole_id']==5||$_SESSION['security']['userrole_id']==9||$_SESSION['security']['userrole_id']==10||$_SESSION['security']['userrole_id']==100)
				{
					?>
					    <li class="sub-menu">
                    	<a href="dbpatient.php" style="background:#BC1C4A;">
                        <i class="fa fa-user"></i>
                        <span>Patient Registration</span>
                    	</a>
                    	</li>
					  <?php
				}
		  
		  if($orgOb->getOPD())
		  {
				if($_SESSION['security']['userrole_id']==1||$_SESSION['security']['userrole_id']==2||$_SESSION['security']['userrole_id']==3||$_SESSION['security']['userrole_id']==4||$_SESSION['security']['userrole_id']==5||$_SESSION['security']['userrole_id']==9||$_SESSION['security']['userrole_id']==100)
				{
					?>
						<li class="sub-menu">
						<a href="dbopd.php" style="background:#003366;">
						<i class="fa fa-th"></i>
						<span>Out-Patient (OPD)</span>
						</a>
						</li>
						<?php
				}
		  }
		  if($orgOb->getIPD())
		  {
			  if($_SESSION['security']['userrole_id']==1||$_SESSION['security']['userrole_id']==2||$_SESSION['security']['userrole_id']==3||$_SESSION['security']['userrole_id']==9||$_SESSION['security']['userrole_id']==6||$_SESSION['security']['userrole_id']==15||$_SESSION['security']['userrole_id']==100)
				{
			  	?>
						<li class="sub-menu">
						<a href="dbipd.php" style="background:#8EC63F;">
						<i class="fa fa-th"></i>
						<span>In-Patient (IPD)</span>
						</a>
						</li>
						<?php
				}
					
		  }
		  if($orgOb->getOT())
		  {
			  if($_SESSION['security']['userrole_id']==1||$_SESSION['security']['userrole_id']==2||$_SESSION['security']['userrole_id']==3||$_SESSION['security']['userrole_id']==9||$_SESSION['security']['userrole_id']==6||$_SESSION['security']['userrole_id']==15||$_SESSION['security']['userrole_id']==100) 
				{
			   		?>
						<li class="sub-menu">
						<a href="dbot.php" style="background:#D6502A;">
						<i class="fa fa-th"></i>
						<span>Operation Theater</span>
						</a>
						</li>
                        <?php
				}
		  }			
		  if($orgOb->getPharmacy())
		  {
				if($_SESSION['security']['userrole_id']==1||$_SESSION['security']['userrole_id']==2||$_SESSION['security']['userrole_id']==3||$_SESSION['security']['userrole_id']==6||$_SESSION['security']['userrole_id']==7||$_SESSION['security']['userrole_id']==8||$_SESSION['security']['userrole_id']==9||$_SESSION['security']['userrole_id']==100)
				{
			  		?>
						<li class="sub-menu">
						<a href="dbpharmacy.php" style="background:#00869C;">
						<i class="fa fa-th"></i>
						<span>Pharmacy</span>
						</a>
						</li>
						<?php
				}
		  }
		  if($orgOb->getDiagnostic())
		  {
				if($_SESSION['security']['userrole_id']==1||$_SESSION['security']['userrole_id']==2||$_SESSION['security']['userrole_id']==3||$_SESSION['security']['userrole_id']==14||$_SESSION['security']['userrole_id']==9||$_SESSION['security']['userrole_id']==100)
				{
			  	?>
						<li>
						<a href="dbdiagnostics.php" style="background:#380E4D;">
						<i class="fa fa-th"></i>
						<span>Diagnostics </span>
						</a>
						</li>
						<?php
				}
		  }
		  
					  ?>
						<!--<li class="sub-menu">
						<a href="dbemergency.php" style="background:#3AC7F9;">
						<i class="fa fa-tasks"></i>
						<span>Facility Management </span>
						</a>
						</li>-->
						<?php
          if($orgOb->getAdmin())
		  {
				if($_SESSION['security']['userrole_id']==1||$_SESSION['security']['userrole_id']==2||$_SESSION['security']['userrole_id']==9||$_SESSION['security']['userrole_id']==100)
				{
					?>
						<li class="sub-menu">
						<a href="dbadmin.php" style="background:#28282E;">
						<i class="fa fa-laptop"></i>
						<span>Admin Panel</span>
						</a>
						</li>
						<?php
				}
		  }
		  ?>
               
            </ul> 
            <div style="position: absolute; bottom: 2%; padding-left:10%;"><a href="http://www.softusion.com/" target="_blank"><img width="30" height="40" src="../images/SoftusionLOGO.png" alt=""><span style="font-size: 11px; float: right; margin-top: 15%;">Designed by Softusion Inc.</span></a></div><br>
            <!-- sidebar menu end-->
        </div>
    </aside>
    <!--sidebar end-->
    <!--main content start-->
	<!-- InstanceBeginEditable name="center" -->
      <section id="main-content">
    <section class="wrapper">
    <table cellspacing="0" cellpadding="0" width="100%" border="0" style="font-size:11px;">
          <tbody>
            <tr>
      <td width="12%" align="center"><a href="dbipd.php"><img src="../images/icondb.png"></a></td>
      <td width="12%" align="center"><a href="mgmtinpatients.php"><img src="../images/iconipd.png"></a></td>
      <td width="12%" align="center"><a href="mgmtadmissions.php"><img src="../images/iconadm.png"></a></td>
              <td width="12%" align="center"></td>
              <td width="12%" align="center"></td>
              <td width="12%" align="center"></td>
              <td width="12%" align="center"></td>
              <td width="12%" align="center"></td>
              <td width="2%" align="center">&nbsp;</td>
            </tr>
            <tr>
      <td align="center"><a href="dbipd.php">In Patient</a></td>
      <td align="center"><a href="mgmtinpatients.php">Beds Register</a></td>
      <td align="center"><a href="mgmtadmissions.php">Admissions & Discharge</a></td>
              <td align="center"></td>
              <td align="center"></td>
              <td align="center"></td>
              <td align="center"></td>
              <td align="center"></td>
              <td height="24" align="center">&nbsp;</td>
            </tr>
          </tbody>
        </table>

<br>
      <!-- page start-->
       <div class="row">
            <div class="col-sm-12">
                <section class="panel">
                
                    <div class="panel-body invoice">
                        <div class="invoice-header">
                            <div class="invoice-title col-md-3 col-xs-12">
                                    <h2>DISCHARGE BILL</h2>
                            </div>
                        </div>
                      	<?php
						if(isset($error_message)&&$error_message!='')
						{
							?>
                            <table>
							<tr>
								<td><span class="message_red"><?php echo $error_message;?></span></td>
							</tr>
                            <tr><td>&nbsp;</td></tr>
                            </table>
							<?php
						}
						?>
                        
                        <?php
						if(isset($_SESSION['temp']['patient_id'])&&$_SESSION['temp']['patient_id']!='')
						{
							?>
							<div id="result"></div>
                            
							<table width="100%" border="0" align="left" cellspacing="0" cellpadding="0">
								<tbody>
									<tr>
										<td width="20%">Patient Name :</td>
										<td width="80%"><strong> <?php if(isset($patient_single_detail[0]['patient_fname'])){echo $patient_single_detail[0]['patient_fname'].' '.$patient_single_detail[0]['patient_lname'];}else{echo 'Outdoor';}?> </strong></td>
									</tr>
									<tr>
										<td>Phone :</td>
										<td><strong><?php if(isset($patient_single_detail[0]['phone'])){echo $patient_single_detail[0]['phone'];}?></strong></td>
									</tr>
                                    <tr>
										<td>Patient ID :</td>
										<td><?php  if(isset($patient_single_detail[0]['patient_id'])){echo $patient_single_detail[0]['patient_id'];}?></td>
									</tr>
									<tr>
										<td>&nbsp;</td>
										<td>&nbsp;</td>
									</tr>
									<tr>
										<td>Admission No:</td>
										<td><?php echo $adm_no;?></td>
									</tr>
                                    <!--<tr>
										<td>Bed No:</td>
                                        <td><?php echo $allotment_array[0]['ipd_bed_no'];?></td>
									</tr>-->
                                    
                                    <!--<tr>
                                    <td>Admitted at:</td>
                                    <td><?php echo date('d M Y h:i A',$allotment_array[0]['allot_time']);?></td>
									</tr>-->
                                    
                                    <tr>
                                    <td>Discharge Date/Time:</td>
                                    <td valign="top"><?php //echo date('d M Y h:i A',$allotment_array[0]['discharge_time']);?></td>
									</tr>
								</tbody>
							</table>
                                
                            <br><br>
                            
							<table class="table table-invoice" style="margin-top: 0px;">
								<thead>
									<tr>
										<th width="10%">ID</th>
										<th width="45%">Description</th>
										<th width="15%" class="text-center">Net Total</th>
									</tr>
								</thead>
								<tbody>
                                
                                <?php
								if(isset($allotment_array[0]['ipd_bed_allotment_id']))
								{
									for($a=0;$a<count($allotment_array);$a++)
									{
										?>
										
										<tr>
											<td width="10%"><?php echo $allotment_array[$a]['ipd_bed_allotment_id'];?></td>
											<td width="45%"><?php echo $allotment_array[$a]['ipd_bed_no'];?></td>
										   
											<td width="15%" class="text-center"><?php echo number_format($allotment_array[$a]['total_amount'],2);?></td>
										</tr> 
										
										<?php
									}
								}
								?>
                               
                               </tbody>
							</table>
                           
							<div class="row">
								<div class="col-md-3 invoice-block pull-right">
									<ul class="unstyled amounts">
                                    
										<li>Total: Rs. <span id="ipd_total_amount"><?php echo  $dis_slip_array[0]['total_amount']?></span></li>
                                        
										<li>Discount: 
                                        <select name="ipd_invoice_discount[]" class="ipd_invoice_discount" id="ipd_invoice_discount">
                                        
                                            <option value="0" <?php if($dis_slip_array[0]['discount']=='0'){echo 'selected';}?>>None</option>
                                            <option value="5" <?php if($dis_slip_array[0]['discount']=='5'){echo 'selected';}?>>5%</option>
                                            <option value="10" <?php if($dis_slip_array[0]['discount']=='10'){echo 'selected';}?>>10%</option>
                                            <option value="25" <?php if($dis_slip_array[0]['discount']=='25'){echo 'selected';}?>>25%</option>
                                            <option value="50" <?php if($dis_slip_array[0]['discount']=='50'){echo 'selected';}?>>50%</option>
                                            <option value="75" <?php if($dis_slip_array[0]['discount']=='75'){echo 'selected';}?>>75%</option>
                                            <option value="100" <?php if($dis_slip_array[0]['discount']=='100'){echo 'selected';}?>>100%</option>
                                        </select>
                                        </li>
                                        
										<!--<li>TAX (15%) ----- </li>-->
                                        
                                        <input type="hidden" name="ipd_amount_payable" id="ipd_amount_payable_form"  value="<?php echo $dis_slip_array[0]['amount_payable'];?>">
										<li class="grand-total">Grand Total: Rs. <span id="ipd_amount_payable"><?php echo $dis_slip_array[0]['amount_payable'];?></span></li>
                                        
									</ul>
								</div>
							</div>
						  
							<div class="text-center invoice-btn">
                            <form action="" method="post">
                            <input name="save_exit" type="submit" class="btn btn-success btn-lg" value="Save & Exit"/>
                             <a href="#transaction-box" class="transaction-window transaction_data btn btn-success btn-lg" id="">Receive Payment & Discharge</a>
                            <a href="javascript:Popup('printipddischarge.php')" class="btn btn-primary btn-lg"><i class="fa fa-print"></i> Print </a>
                            </form>
								<!--<a class="btn btn-success btn-lg"><i class="fa fa-check"></i> Submit Invoice </a>-->
								
							</div>
                            
                            <div class="col-md-9 payment-method">
                            <h4>Terms &amp; Conditions</h4>
                            <p>1. </p>
                            <p>2. </p>
                            <p>3. </p>
                            <br>
                            <h3 class="inv-label itatic">Wish you Health!</h3>
                            </div>
                            
                            <input type="hidden" name="ipd_bed_admission_no" id="ipd_bed_admission_no"  value="<?php echo $adm_no;?>">
							<?php
						}
						
						?>
                    </div>
                    
                </section>
            </div>
        </div>
      <!-- page end-->
    </section>
  </section>
  <!-- InstanceEndEditable --><!--main content end-->
<!--right sidebar start-->
 
<!--right sidebar end-->
</section>
<!-- Placed js at the end of the document so the pages load faster -->
<!--Core js-->
<!--<script src="../js/jquery-1.10.2.min.js"></script>-->
  
 
<script src="../assets/jquery-ui/jquery-ui-1.10.1.custom.min.js"></script>
<script src="../bs3/js/bootstrap.min.js"></script>



<script src="../js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="../popUp/popUp.js"></script>
<script src="../js/ajax.js"></script>

<script src="../js/lib/jquery.js"></script>
<script src="../assets/fullcalendar/fullcalendar/fullcalendar.min.js"></script>
<script src="../js/calendar/external-dragging-calendar.js"></script>
<script src="../js/accordion-menu/jquery.dcjqaccordion.2.7.js"></script>
<script src="../js/scrollTo/jquery.scrollTo.min.js"></script>
<script src="../js/nicescroll/jquery.nicescroll.js" type="text/javascript"></script>
<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="js/flot-chart/excanvas.min.js"></script><![endif]-->
<script src="../assets/jQuery-slimScroll-1.3.0/jquery.slimscroll.js"></script>
<script src="../assets/skycons/skycons.js"></script>
<script src="../assets/jquery.scrollTo/jquery.scrollTo.js"></script>
<script src="../js/jquery.easing.min.js"></script>
<script src="../assets/calendar/clndr.js"></script>
<script src="../js/underscore-min.js"></script>
<script src="../assets/calendar/moment-2.2.1.js"></script>
<script src="../js/calendar/evnt.calendar.init.js"></script>
<script src="../assets/jvector-map/jquery-jvectormap-1.2.2.min.js"></script>
<script src="../assets/jvector-map/jquery-jvectormap-us-lcc-en.js"></script>
<script src="../assets/gauge/gauge.js"></script>



<!--clock init-->
<script src="../assets/css3clock/js/script.js"></script>
<!--Easy Pie Chart-->
<script src="../assets/easypiechart/jquery.easypiechart.js"></script>
<!--Sparkline Chart-->
<!--Morris Chart-->
<script src="../assets/morris-chart/morris.js"></script>
<script src="../assets/morris-chart/raphael-min.js"></script>
<!--jQuery Flot Chart-->
<script src="../assets/flot-chart/jquery.flot.animator.min.js"></script>
<script src="../assets/flot-chart/jquery.flot.growraf.js"></script>
<script src="../js/dashboard.js"></script>
<script src="../js/custom-select/jquery.customSelect.min.js" ></script>
<!--common script init for all pages-->
<script src="../js/scripts.js"></script>
<!--dynamic table initialization -->
<script src="../js/dynamic_table/dynamic_table_init.js"></script>



<!--dynamic table initialization -->
<script src="../js/dynamic_table/dynamic_table_init.js"></script>
<!--<start===================>-->
<script src="../js/lib/jquery.js"></script>


<script src="../bs3/js/bootstrap.min.js"></script>



<script class="include" type="text/javascript" src="../js/accordion-menu/jquery.dcjqaccordion.2.7.js"></script>

<script src="../js/scrollTo/jquery.scrollTo.min.js"></script>
<script src="../js/nicescroll/jquery.nicescroll.js" type="text/javascript"></script>
<!--Easy Pie Chart-->
<script src="../assets/easypiechart/jquery.easypiechart.js"></script>
<!--Sparkline Chart-->
<script src="../assets/sparkline/jquery.sparkline.js"></script>
<!--jQuery Flot Chart-->
<script src="../assets/flot-chart/jquery.flot.js"></script>
<script src="../assets/flot-chart/jquery.flot.tooltip.min.js"></script>
<script src="../assets/flot-chart/jquery.flot.resize.js"></script>
<script src="../assets/flot-chart/jquery.flot.pie.resize.js"></script>
<script type="text/javascript" src="../assets/bootstrap-daterangepicker/daterangepicker.js"></script>
<script type="text/javascript" src="../assets/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>

<!--dynamic table-->
<!--common script init for all pages-->
<script src="../js/scripts.js"></script>

<!--dynamic table initialization -->
<script src="../js/dynamic_table/dynamic_table_init.js"></script>

<script type="text/javascript" src="../datepicker/jquery-1.9.1.js"></script>
<script type="text/javascript" src="../datepicker/jquery-ui.js"></script>

<!--<script type="text/javascript" src="../popUp/jquery-1.9.0.js"></script>-->
<script type="text/javascript">

 function Popup(apri) { 
	window.open(apri,"","top=10,left=200,width=800,height=700,status=no,menubar=no,toolbar=no,scrollbars=yes"); 
 }
</script> 

<div id="update_password-box" class="update_password-popup">
    
    <div class="pop_header">
        <span>Change Password</span>
        <a href="#" class="pop_close" style="float:right;">Close (X)</a>
    </div>
    
    <table width="100%" border="0" cellspacing="2" cellpadding="2" class="panel">
      <tr>
        <td>
          <div id="result_update_password_form"></div>
          
          <form action="" method="post" id="update_password_form" class="cmxform form-horizontal" onSubmit="return false;">
          	
            <br>
            
         	<div class="form-group">
            <label class="control-label col-lg-3" for="lastname">New Password:</label>
                <div class="col-lg-6">
                    <input type="password" name="password" class="form-control" value="" id="exampleInputPassword1">
                </div>
            </div>
           
            <p align="right">
            	<input type="hidden" name="user_id" value="<?php if(isset($user_id)&&$user_id!=''){echo $user_id;}else{ echo 
				$_SESSION['security']['user_id'];}?>">
                <input type="hidden" name="updateUserPwd" value="yes">
                <input name="ajax_submit" type="submit" class="ajax_submit btn btn-info" value="Update"/>
            </p>
            
          </form>
          </td>
          
      </tr>
    </table>
</div> 
 
</body>  
<!-- InstanceEnd --></html>


<div id="transaction-box" class="transaction-popup">
    
    <div class="pop_header">
        <span>Transaction</span>
        <a href="#" class="pop_close" style="float:right;">Close (X)</a>
    </div>
    
    <table width="100%" border="0" cellspacing="2" cellpadding="2" class="panel">
      <tr>
        <td>
          <div id="result_insert_ipdtrx_form" style="margin:10px;"></div>
          
          <form action="" method="post" id="insert_ipdtrx_form" class="cmxform form-horizontal" onSubmit="return false;">
          
           	<div class="form-group">
              <label class="control-label col-lg-3" for="firstname">Account Head:</label>
              <div class="col-lg-6">
              <input type="hidden" name="acchead_id" value="<?php echo $account_data[0]['acchead_id'];?>">
               <?php echo $account_data[0]['acchead_name'];?>
              </div>
            </div>
            
            <div class="form-group">
              <label class="control-label col-lg-3" for="firstname">Account Name:</label>
              <div class= "col-lg-6">
                <input type="hidden" name="account_id" value="<?php echo $account_data[0]['account_id'];?>">
               <?php echo $account_data[0]['account_name'];?>
              </div>
            </div>
            
            <div class="form-group">
              <label class="control-label col-lg-3" for="firstname">Account Type:</label>
              <div class="col-lg-6">
                 <input type="hidden" name="type" value="<?php echo $account_data[0]['type'];?>">
               <?php echo $account_data[0]['type'];?>
              </div>
            </div>
            
            <div class="form-group">
              <label class="control-label col-lg-3" for="lastname">Amount Payable:</label>
              <div class="col-lg-6" id="amount_payable_html">
               
              </div>
              <input type="hidden" name="amount_payable" id="amount_payable_value" value="">
            </div>
            
            <div class="form-group">
              <label class="control-label col-lg-3" for="lastname">Payment Amount:</label>
              <div class="col-lg-6">
                <input type="text" name="payment_amount" id="lastname" class="form-control">
              </div>
            </div>
            
            <div class="form-group">
              <label class="control-label col-lg-3" for="lastname">Description:</label>
              <div class="col-lg-6">
                <textarea name="description" cols="43" rows="5"></textarea>
              </div>
            </div>
            
            <p align="right">
              <input type="hidden" name="patient_id" id="patient_id" value="<?php echo $patient_id;?>">
              <input type="hidden" name="ipd_bed_admission_no" id="ipd_bed_admission_no" value="<?php echo $adm_no;?>">
              <input type="hidden" name="ipd_discharge_bill_id" id="ipd_discharge_bill_id" value="<?php echo $dis_slip_array[0]['ipd_discharge_bill_id'];?>">
              <input type="hidden" name="ipd_trx" value="yes">
              <input name="ajax_submit" type="submit" class="ajax_submit btn btn-info" value="Save" />
            </p>
            
          </form>
          </td>
          
      </tr>
    </table>
</div>

<script>
$(".transaction_data").click(function() {
	
	var id = this.id;
	amount_payable = $("#ipd_amount_payable_form").val();
	
	$("#amount_payable_html").html(amount_payable);
	$("#amount_payable_value").val(amount_payable);
	
	
});
</script>