<?php
include('../config/config.php');
include('../classes/classAccounts.php');
################# delete account head #######################################

if(isset($_GET['ahid'])&&$_GET['ahid']!='')
{
	try
	{
		$ahid = base64_decode($_GET['ahid']);
		$delAccHeadOb = new classAccounts;
		$delAccHeadOb->setAccountHeadID($ahid);
		$delAccHeadOb->deleteAccountHeads();
	}
	catch (MyException $e)
	{
		$error_message = $e->getUserMsg();
	}
}

################# delete account #######################################

if(isset($_GET['aaid'])&&$_GET['aaid']!='')
{
	try
	{
		$aaid = base64_decode($_GET['aaid']);
		$delAccOb = new classAccounts;
		$delAccOb->setAccountID($aaid);
		$delAccOb->deleteAccounts();
	}
	catch (MyException $e)
	{
		$error_message = $e->getUserMsg();
	}
}

################# retrieve all accounts #######################################

if(isset($_POST['search_account_no'])&&$_POST['search_account_no']!='')
{
	$search_account_no = $_POST['search_account_no'];
}
else
{
	$search_account_no = NULL;
}


try
{
	$accOb = new classAccounts;
	$accounts_array = $accOb->retrieveAccountHeadsAndAccounts($_SESSION['security']['org_id'],$search_account_no);
}
catch (MyException $e)
{
	$error_message = $e->getUserMsg();
}



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

?>
<!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('printmgmtaccounts.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="dbadmin.php"><img src="../images/icondb.png"></a></td>
              <td width="12%" align="center"><a href="mgmtaccounts.php"><img src="../images/iconaccounts.png"></a></td>
              <td width="12%" align="center"><a <?php if($_SESSION['security']['userrole_id']!=100){?>href="#add_acchead-box" class="add_acchead-window" id="add_acchead"<?php } ?> title="<?php if($_SESSION['security']['userrole_id']==100){?>This option is not available in this Demo.<?php } ?>"><img src="../images/iconaccount.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="dbadmin.php">Main Admin</a></td>
              <td align="center"><a href="mgmtaccounts.php">Accounts Setup</a></td>
              <td align="center"><a <?php if($_SESSION['security']['userrole_id']!=100){?>href="#add_acchead-box" class="add_acchead-window" id="add_acchead"<?php } ?> title="<?php if($_SESSION['security']['userrole_id']==100){?>This option is not available in this Demo.<?php } ?>">Add Account Head</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">
          
            <header class="panel-heading">
              <h2>MANAGE ACCOUNTS</h2>
            </header>
            
            <?php
            if(isset($error_message)&&$error_message!='')
            {
                ?>
                <span class="message_red"><?php echo $error_message;?></span>
                <?php
            }
            ?>
            
            <table width="100%" border="0" cellpadding="1" cellspacing="0">
            <form action="" method="post">
              <tr>
              
                <td width="7%" align="right">Search By Account No: </td>
                <td width="5%"><input type="text" name="search_account_no" value="" class="form-control" aria-controls="dynamic-table"></td>
                <td width="5%"><input name="search" type="submit" class="btn btn-success btn-sm" value="Search"/></td>
                
                <td width="5%" align="right"><a href="mgmtaccounts.php">View All</a></td>
               <!-- <td width="5%" align="right">ID: </td>
                <td width="15%">
                	<input type="text" class="form-control" aria-controls="dynamic-table">
                </td>
                
                <td width="5%" align="right">Phone: </td>
                <td width="15%">
                	<input type="text" class="form-control" aria-controls="dynamic-table">
                </td>-->
                
                <td width="15%" align="right"><div class="row-fluid"></div></td>
                <td width="10%"></td>
                
              </tr>
              </form>
            </table>
            
            <br><br><br>

            <div class="panel-body" style="padding-top: 0px; margin-top: -34px;">
              <div class="adv-table">
              
              <table  class="display table table-bordered" id="dynamic-table">
                
                  <thead>
                  
                    <tr>
                      <th width="5%" align="center">&nbsp;</th>
                      <th width="15%">Accounts</th>
                      <th width="55%"> <!--<table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td width="20%">Beds</td>
                      <td width="20%"></td>
                      <td width="20%">Fee</td>
                      <td width="30%">Detail</td>
                      <td width="10%"></td></table>-->
                  
                  </th>
                      <!--<th width="10%">No. of Beds</th>
                      <th width="10%">Ward Incharge</th>-->
                      <th width="5%" align="center" class="hidden-phone">Delete</th>
                    </tr>
                    
                  </thead>
                  
                  <tbody>
                   <?php
				   	
					
					if(isset($accounts_array[0]['acchead_id'])&&$accounts_array[0]['acchead_id']!='')
					{
						for($a=0;$a<count($accounts_array);$a++)
						{
							
							$acchead_id = $accounts_array[$a]['acchead_id'];
							$acchead_id_encode = base64_encode($acchead_id);
							$acchead_no = $accounts_array[$a]['acchead_no'];
							$acchead_name = ucwords($accounts_array[$a]['acchead_name']);
							$acchead_blocked = $accounts_array[$a]['acchead_blocked'];
							
							
							?>
                            <tr>
                            
                            <td width="5%" align="center"><a href="#update_acchead-box" class="update_acchead-window update_acchead" id="<?php echo $a;?>">Edit</a></td>
                            
                            <td><?php echo $acchead_no;?> - <?php echo $acchead_name;?><br>
                            <?php
                            if(count($accounts_array)>0)
                            {
								?>
								<span style="float:left;"><a href="#add_account-box" class="add_account-window add_account" id="<?php echo $a;?>"><span class="message_red">Add Account</span></a></span>
								<?php
                            }
                            ?></td>
                            
                            <td>
                            <?php
                            if(isset($accounts_array[$a]['account_details'][0])&&$accounts_array[$a]['account_details'][0]!='')
                            {
								for($aa=0;$aa<count($accounts_array[$a]['account_details']);$aa++)
								{
									
									$account_acchead_id = $accounts_array[$a]['account_details'][$aa]['acchead_id'];
									
									$account_id = $accounts_array[$a]['account_details'][$aa]['account_id'];
									$account_id_encode = base64_encode($account_id);
									
									$account_name = ucwords($accounts_array[$a]['account_details'][$aa]['account_name']);
									$account_no = $accounts_array[$a]['account_details'][$aa]['account_no'];
									$account_type = $accounts_array[$a]['account_details'][$aa]['type'];
									$account_identifier = $accounts_array[$a]['account_details'][$aa]['account_identifier'];
									
									?>
									
									<table width="100%" class="display table table-bordered table-striped">
									<tr>
                                        <td width="10%" align="left">
                                        <span style="float:left;"><?php 
                                       
                                        ?><a href="mgmtaccounts.php?aaid=<?php echo $account_id_encode;?>"><span class="message_red">Delete</span></a><?php ?></span>
                                        </td>
                                        
                                        <td width="90%" align="left">Account No: 
                                        <strong><a href="#update_account-box" class="update_account-window update_account" id="<?php echo $a.$aa;?>"><?php echo $account_no;?></a></strong>
                                        
                                        <br>
                                        
                                        <span style="float:left;">Detail: <?php echo $account_name;?></span>
                                        
                                        </td>
									</tr>
									</table>
									
                                    <input type="hidden" name="account_acchead_id" class="set_to_pop" id="account_acchead_id_<?php echo $a.$aa;?>" value="<?php echo $account_acchead_id;?>">
                                    
                                    <input type="hidden" name="account_acchead_name" class="set_to_pop" id="account_acchead_name_<?php echo $a.$aa;?>" value="<?php echo $acchead_name;?>">
                                    
									<input type="hidden" name="account_id" class="set_to_pop" id="account_id_<?php echo $a.$aa;?>" value="<?php echo $account_id;?>">
									<input type="hidden" name="account_name" class="set_to_pop" id="account_name_<?php echo $a.$aa;?>" value="<?php echo $account_name;?>">
                                    <input type="hidden" name="account_no" class="set_to_pop" id="account_no_<?php echo $a.$aa;?>" value="<?php echo $account_no;?>">
                                     <input type="hidden" name="account_type" class="set_to_pop" id="account_type_<?php echo $a.$aa;?>" value="<?php echo $account_type;?>">
                                     <input type="hidden" name="account_identifier" class="set_to_pop" id="account_identifier_<?php echo $a.$aa;?>" value="<?php echo $account_identifier;?>">
									<?php 
								}
                            }
                            else
                            {
								?>
								There are no accounts in this account head.<p>
								<?php
                            }
                            ?>
                            </td>
                            
                            <!--<td align="right"></td>
                            
                            <td></td>-->
                            
                            <td align="center" class="hidden-phone"><?php 
                            if(count($accounts_array[$a]['account_details'])==0)
                            {
                                ?><a href="mgmtaccounts.php?ahid=<?php echo $acchead_id_encode;?>"><img src="../images/delete.png"></a><?php
                            }
                            ?></td>
                            
                            </tr>
                            
                    		<input type="hidden" name="acchead_id" class="set_to_pop" id="acchead_id_<?php echo $a;?>" value="<?php echo $acchead_id;?>">
                            <input type="hidden" name="acchead_no" class="set_to_pop" id="acchead_no_<?php echo $a;?>" value="<?php echo $acchead_no;?>">
                            <input type="hidden" name="acchead_name" class="set_to_pop" id="acchead_name_<?php echo $a;?>" value="<?php echo $acchead_name;?>">
                            
                            <input type="hidden" name="acchead_blocked" class="set_to_pop" id="acchead_blocked_<?php echo $a;?>" value="<?php echo $acchead_blocked;?>">	
                    		<?php	
                         }
					}
					else
					{
						?>
                        <tr>
                             <td colspan="6">No Account Heads entered yet!</td>
                        </tr>
                        <?php
					}
					?>       
                  </tbody>
                  
               </table>
                
              </div>
            </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="add_acchead-box" class="add_acchead-popup">
    
    <div class="pop_header">
        <span>Add Account Head</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_acchead_form"></div>
            
            <form action="" method="post" id="insert_acchead_form" class="cmxform form-horizontal" onsubmit="return false;">
            
            <div class="form-group">
                <label class="control-label col-lg-3" for="firstname">Acc Head No:</label>
                <div class="col-lg-6">
                	<input type="text" name="acchead_no" value="" class="form-control">
                </div>
            </div>
            
             <div class="form-group">
                <label class="control-label col-lg-3" for="firstname">Acc Head Name:</label>
                <div class="col-lg-6">
                	<input type="text" name="acchead_name" value="" class="form-control">
                </div>
            </div>
            
            <div class="form-group">
           	 	<label class="control-label col-lg-3" for="firstname">Acc Head Identifier:</label>
                <div class="col-lg-6">
                    <select name="acchead_identifier"  class="form-control">
                        <option value="G">G</option>
                        <option value="D">D</option>
                    </select>
                    
                </div>
            </div>
            
             <div class="form-group">
                <label class="control-label col-lg-3" for="firstname">Acc Head Blocked:</label>
                <div class="col-lg-6">
                	<input type="checkbox" name="acchead_blocked" value="1" class="form-control">
                </div>
            </div>
            
            <p align="right">
            	<input type="hidden" name="add_acchead" value="Add_Acchead">
                <input name="ajax_submit" type="submit" class="ajax_submit btn btn-info" value="Add"/>
            </p>
            
            </form>
            
            </td>
        </tr>
    </table>
    
</div>

<div id="update_acchead-box" class="update_acchead-popup">
    
    <div class="pop_header">
        <span>Update Account Head</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_acchead_form"></div>
            
            <form action="" method="post" id="update_acchead_form" class="cmxform form-horizontal" onsubmit="return false;">
            
            <div class="form-group">
                <label class="control-label col-lg-3" for="firstname">Acc Head No:</label>
                <div class="col-lg-6">
                	<input type="text" name="acchead_no" id="acchead_no" value="" class="form-control">
                </div>
            </div>
            
             <div class="form-group">
                <label class="control-label col-lg-3" for="firstname">Acc Head Name:</label>
                <div class="col-lg-6">
                	<input type="text" name="acchead_name" id="acchead_name" value="" class="form-control">
                </div>
            </div>
            
            <div class="form-group">
           	 	<label class="control-label col-lg-3" for="firstname">Acc Head Identifier:</label>
                <div class="col-lg-6">
                    <select name="acchead_identifier" id="acchead_identifier"  class="form-control">
                        <option value="G">G</option>
                        <option value="D">D</option>
                    </select>
                    
                </div>
            </div>
            
             <div class="form-group">
                <label class="control-label col-lg-3" for="firstname">Acc Head Blocked:</label>
                <div class="col-lg-6">
                	<input type="checkbox" name="acchead_blocked" id="acchead_blocked" value="1" class="form-control">
                </div>
            </div>
            
            <p align="right">
            	<input type="hidden" name="acchead_id" id="acchead_id" value="">
            	<input type="hidden" name="update_acchead" value="Update_Acchead">
                <input name="ajax_submit" type="submit" class="ajax_submit btn btn-info" value="Update"/>
            </p>
            
            </form>
            
            </td>
        </tr>
    </table>
    
</div>



<div id="add_account-box" class="add_account-popup">
    
    <div class="pop_header">
        <span>Add Account</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><p>
            
            <div id="result_insert_account_form"></div>
            
            <form action="" method="post" id="insert_account_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" id="account_head">
                	
                </div>
            </div>
            
            <div class="form-group">
                <label class="control-label col-lg-3" for="firstname">Account No:</label>
                <div class="col-lg-6">
                	<input type="text" name="account_no" value="" class="form-control">
                </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="text" name="account_name" value="" class="form-control"> 
                </div>
            </div>
              
            <div class="form-group">
           	 	<label class="control-label col-lg-3" for="firstname">Account Identifier:</label>
                <div class="col-lg-6">
                    <select name="account_identifier"  class="form-control">
                        <option value="G">G</option>
                        <option value="D">D</option>
                    </select>
                    
                </div>
            </div>
            
            <div class="form-group">
           	 	<label class="control-label col-lg-3" for="firstname">Account Type:</label>
                <div class="col-lg-6">
                    <select name="account_type"  class="form-control">
                        <option value="Income">Income</option>
                        <option value="Expense">Expense</option>
                    </select>
                    
                </div>
            </div>
            
             <div class="form-group">
                <label class="control-label col-lg-3" for="firstname">Account Blocked:</label>
                <div class="col-lg-6">
                	<input type="checkbox" name="account_blocked" value="1" class="form-control">
                </div>
            </div>
            
           
            <p align="right">
            	<input type="hidden" name="account_head_id" id="account_head_id" value="" class="form-control">
            	<input type="hidden" name="add_account" value="Add_Account">
                <input name="ajax_submit" type="submit" class="ajax_submit btn btn-info" value="Add"/>
            </p>
            
            </form>
            
            </td>
        </tr>
    </table>
    
</div>

<div id="update_account-box" class="update_account-popup">
    
    <div class="pop_header">
        <span>uUdate Account</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><p>
            
            <div id="result_update_account_form"></div>
            
            <form action="" method="post" id="update_account_form" class="cmxform form-horizontal" onsubmit="return false;">
           
            <div class="form-group">
                <label class="control-label col-lg-3" for="firstname">Account No:</label>
                <div class="col-lg-6">
                	<input type="text" name="account_no" id="account_no" value="" class="form-control">
                </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="text" name="account_name" id="account_name" value="" class="form-control"> 
                </div>
            </div>
              
            <div class="form-group">
           	 	<label class="control-label col-lg-3" for="firstname">Account Identifier:</label>
                <div class="col-lg-6">
                    <select name="account_identifier" id="account_identifier"  class="form-control">
                        <option value="G">G</option>
                        <option value="D">D</option>
                    </select>
                    
                </div>
            </div>
            
            <div class="form-group">
           	 	<label class="control-label col-lg-3" for="firstname">Account Type:</label>
                <div class="col-lg-6">
                    <select name="account_type" id="account_type"  class="form-control">
                        <option value="Income">Income</option>
                        <option value="Expense">Expense</option>
                    </select>
                    
                </div>
            </div>
            
             <div class="form-group">
                <label class="control-label col-lg-3" for="firstname">Account Blocked:</label>
                <div class="col-lg-6">
                	<input type="checkbox" name="account_blocked" id="account_blocked" value="1" class="form-control">
                </div>
            </div>
            
           
            <p align="right">
            	<input type="hidden" name="account_id" id="account_id" value="" class="form-control">
            	<input type="hidden" name="update_account" value="Update_Account">
                <input name="ajax_submit" type="submit" class="ajax_submit btn btn-info" value="Add"/>
            </p>
            
            </form>
            
            </td>
        </tr>
    </table>
    
</div>



<script>

$(".update_acchead").click(function() {
	
	var id = this.id;
	
	acchead_id = $("#acchead_id_"+id).val();
	acchead_no = $("#acchead_no_"+id).val();
	acchead_name = $("#acchead_name_"+id).val();
	acchead_blocked = $("#acchead_blocked_"+id).val();
	
	
	$("#acchead_id").val(acchead_id);
	$("#acchead_no").val(acchead_no);
	$("#acchead_name").val(acchead_name);
	
	if(acchead_blocked==1)
	{
		$( "#acchead_blocked" ).prop( "checked", true );
	}
	else
	{
		$( "#acchead_blocked" ).prop( "checked", false );
	}
	
	
});

$(".add_account").click(function() {
	
	var id = this.id;
	
	acchead_id = $("#acchead_id_"+id).val();
	acchead_name = $("#acchead_name_"+id).val();
	
	$("#account_head_id").val(acchead_id);
	$("#account_head").html(acchead_name);
	
	
});

$(".update_account").click(function() {
	
	var id = this.id;
	//alert(id);
	account_id = $("#account_id_"+id).val();
	account_no = $("#account_no_"+id).val();
	account_name = $("#account_name_"+id).val();
	account_type = $("#account_type_"+id).val();
	account_identifier = $("#account_identifier_"+id).val();
	account_blocked = $("#account_blocked_"+id).val();
	
	$("#account_id").val(account_id);
	$("#account_no").val(account_no);
	$("#account_name").val(account_name);
	$("#account_type").val(account_type);
	$("#account_identifier").val(account_identifier);
	if(account_blocked==1)
	{
		$( "#account_blocked" ).prop( "checked", true );
	}
	else
	{
		$( "#account_blocked" ).prop( "checked", false );
	}
	
	
});
</script>