<?php 
$pgMod="pocketmoney";
$pgAct="view";
unset($_SESSION["recept"]);
if(isset($_GET['action']) && trim($_GET['action'])!='')
		$pgAct=strtolower($_GET['action']);
		
	if($pgAct=="viewall"){
	global $db,$LinksDetails;
	$pgTable = "student";
	$dataAry = array();
	$sqlArray = array(); 
	$i = 0;
	$table = "";
	$select = "";
	$where = "";
	$whereAry = array();
	
	$whereAry[] = " school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and status=1 and issue_TC=0";
	if (isset($_REQUEST["class"]) && $_REQUEST["class"] != "") {
		$whereAry[] = " class='".$_REQUEST["class"]."' ";
	}
	if(isset($_REQUEST["section"]) && $_REQUEST["section"]!="" && $_REQUEST["section"]!="undefined"){
		$whereAry[] = " section='".$_REQUEST["section"]."' ";
	}
	if (isset($_REQUEST["q"]) && $_REQUEST["q"] != "") {
		$whereAry[] = " (admissionno like '%".$_REQUEST["q"]."%'
					OR name like '%".$_REQUEST["q"]."%'
					OR class like '%".$_REQUEST["q"]."%'
					OR section like '%".$_REQUEST["q"]."%'
					OR medium like '%".$_REQUEST["q"]."%'
					OR cast like '%".$_REQUEST["q"]."%'
					OR fname like '%".$_REQUEST["q"]."%'
					OR mobile like '%".$_REQUEST["q"]."%') ";
	}
	
	if (is_array($whereAry) && count($whereAry) > 0)
		$where = " WHERE " . implode(" AND ", $whereAry);
		
	$pcount = $db->getVal("select count(admissionno) from  student $where");

	$startV = $_REQUEST['startV'];
	$endV = $_REQUEST['endV'];
	$ProDetail["totPost"] = $pcount;

	$contentDetail = $db->getRows("select * from student $where order by name DESC " . ($endV == 'All' ? "" : "limit $startV, $endV"));
	$ProDetail["query"] = $db->getLastQuery();
	$ProDetail["ncount"] = count($contentDetail);
	$ProDetail["tcolumn"] = 9;
	if (is_array($contentDetail) && count($contentDetail) > 0) {
		$aryData = array();
		$i = 0; 
		foreach ($contentDetail as $iList) {
			$button = ""; 
			$aryPgAct["src"] = "Student";
			$aryPgAct["id"] = $iList['idno'];
			$aryPgAct["page_id"] = $pgMod;
			$image="<img src='".URL_ROOT."uploads/product/50/50/".$iList['front_image']."' width='50'  />";
			$button = "";
		
		
			$aryPgAct["action"] = "add";

// 			$button .= '<a href="'.URL_ADMIN_HOME.getQueryString($aryPgAct).'&action=add&id='.$iList['idno'].'"><button type="button" class="btn btn-info">PayFee</button></a>';
            $button .= '<a style="float:left" href="'.URL_ADMIN_HOME.getQueryString($aryPgAct).'"><button type="button" class="btn btn-info">Pay Fees</button></a>';
            $aryPgAct["page_id"]="pocket_record";
            $button .= '<a style="float:left" href="'.URL_ADMIN_HOME.getQueryString($aryPgAct).'"><button type="button" class="btn btn-danger">View Record</button></a>';
			$i++;
			//$aryPgAct["action"] = "submenu";
			$aryData[] = array(
				POST($iList['admissionno']),
				POST($iList['name']),
				POST($iList['class'])."(".POST($iList['section']).")",

				POST($iList['fname']),
			
				$button,
			);
		}
		$ProDetail["Result"] = $aryData;
	}
	echo json_encode($ProDetail);
	exit;
}

		
if(isset($_GET["id"]) && $_GET["id"]!=""){
}
	 
if(isset($_SESSION['msg']) && $_SESSION['msg']!="")
{
	?>
	<div class="alert alert-success">
	  <a class="close" data-dismiss="alert">×</a>
	  <i class="icon icon-thumbs-up-alt"></i> <b>Notice</b><?php echo $_SESSION['msg'] ?></i>
	</div>
	<?php
	unset($_SESSION["msg"]);
}
if(is_array($alert_err) && count($alert_err)>0)
{
	?>
	<div class="alert alert-error">
	  <a class="close" data-dismiss="alert">×</a>
	  <i class="icon icon-warning-sign"></i> <b>Notice</b> <?php echo $alert_err[0] ?></i>
	</div>
	<?php
}
if($pgAct=="add" && isset($_GET['id']) && trim($_GET['id']) !='')
{ 
	if(isset($_SESSION['form']))
	{
		$aryForm=$_SESSION['form'];
		unset($_SESSION['form']);
	}
	$aryForm=$db->getRow("SELECT * FROM student WHERE school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_GET['id']."'");
?>
<style>
.st {
	width: 55px;
	display: inline-block;
	color: #021EF0;
}
.recepit {
	width: 717px !important;
	height: 344px !important;
}
.outer, .inner{ 
  max-height: 800px;
  min-height: 405px;
 }
 .outer .undefined{
  background-color: #DADADA !important;
  border: 5px inset #181616 !important;
  min-height: 440px;
  min-width:675px;
}
.half {
	width: 49%;
	display: inline-block;
	vertical-align: top;
	border-left: 5px solid #f00;
border-right: 5px solid #f00;
}
.half .input-block-level {
	width: 80px;
}
.half .table td {
	padding: 3px 5px;
}
.half center {
	font-weight: bold;
	border-top: 1px solid #f00;
	padding: 5px;
	background-color: #A7A1A1;
	color: #000;
}
</style>
<!-- Forms --> 
<div id="printDiv">		
     <div class="row-fluid">
        <div class="span12">
            <div class="top-bar">
                <h3><i class="icon-cog"></i> Student detail</h3>
                <input type="hidden" id="stucls" value="<?php echo $aryForm["class"]; ?>" />
                <div style="float:right; margin-top:5px;"> 
                 <button onclick="showreceipt()" class="btn btn-danger">Receipt History</button>
                      <script>
                         function showreceipt(){
                             getPopup("<?php echo URL_ROOT ?>print/?page_id=receipt_history&id=<?php echo $_GET["id"] ?>");
                			$(".close").click(function() {
                				$(this).parent().remove();
                			});
                			$(".outer").click(function() {
                			    location.reload();
                				$(this).remove();
                			});
                         }
                     </script>
                 <a href="javascript:;" onclick="window.open('print/?page_id=pocket_record&id='+<?php echo $_GET["id"]?>)"  class="btn btn-danger">Print</a>
            	 <a href="javascript:;" onclick="checkRecept('<?php echo $aryForm["class"]; ?>')" class="btn btn-danger">Receipt</a>
                </div>
            </div>
            <div class="well" id="userdetails" style="padding: 0;margin: 0;">
            	<table class="table">
                	<tr style="border-right: 5px solid #f00;border-left: 5px solid #f00;">
                    	<td><strong class="st">Name</strong></td><td style="border-right:5px solid #f00"><?php echo $aryForm["name"] ?></td>
                        <td><strong class="st">Class</strong></td><td style="border-right:5px solid #f00"><?php echo $aryForm["class"] ?></td>
                        <td><strong class="st">Section</strong></td><td style="border-right:5px solid #f00"><?php echo $aryForm["section"] ?></td>
                        <td><strong class="st">Adm.No</strong></td><td style="border-right:5px solid #f00"><?php echo $aryForm["admissionno"] ?></td>
                        <td rowspan="2"><?php if($aryForm["photo"]!=""){
                        ?><img src="media/photo/<?php echo $aryForm["photo"]; ?>" style="height:70px" /><?php
                    }else{
                        echo "No photo uploaded";
                    }?></td>
                    </tr>
                    <tr style="border-right: 5px solid #f00;border-left: 5px solid #f00;">
                    	<td><strong class="st">DOB</strong></td><td style="border-right:5px solid #f00"><?php echo $aryForm["dob"] ?></td>
                        <td><strong class="st">Father</strong></td><td style="border-right:5px solid #f00"><?php echo $aryForm["fname"] ?></td>
                        <td><strong class="st">DOA</strong></td><td style="border-right:5px solid #f00"><?php echo $aryForm["doa"] ?></td>
                        <td><strong class="st">Contact</strong></td><td style="border-right:5px solid #f00"><?php echo $aryForm["mobile"] ?></li></td>
                    </tr>
                </table>
            </div>
        </div>
     </div> 
     <div class="row-fluid">
        <div class="span12">
            <div class="top-bar">
                <h3><i class="icon-cog"></i> Payment detail</h3>
                <div style="float:right; margin-top:5px">
                
                </div>
            </div>
            <div class="well no-padding">
                 
             	<div class="half">
                  <center>All Income</center>
                  <table class="table">
                    <thead>
                        <tr>
                        	<th>Quater</th>
                            <th>Detail</th>
                            <th>Amount Given</th>
                            <th style="display:none" width="50px">Late Fee</th>
                            <th>Date</th>
                            <th>Status</th>
                            <th><span class="action">Action</span></th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody id="tbody" style="border-top:2px solid #F00">
                    	<?php 
					if($_GET["id"]!=''){ $allincome=0;$i=1;
					 $all_product=$db->getRows("select * from transaction where school_id='".$_SESSION["admin"]["school_id"]."' and tfor='hostel-income' and rid='".$_GET["id"]."' and session='".$_SESSION["admin"]["session"]."'");
					 //echo $db->getErMsg();
					 //echo"<pre>";print_r($all_product);echo"</pre>";
					  if(is_array($all_product) && count($all_product))
                      {
                        foreach($all_product as $iPro)
                        {
							$allincome+=$iPro["amount"]
							?>
                      <tr>
                      	<td>Other <?php echo $i; ?></td>
                        <td><input type="hidden" name="idno" value="<?php echo $_GET["id"]; ?>" />
                        <input style="width:150px" type="text" placeholder="enter detail" id="reasion<?php echo $i; ?>" readonly="readonly" class="input-block-level" value="<?php echo $iPro["tid"]; ?>" name="reasion[]"></td>
                        <td><input type="text" w id="givenother<?php echo $i; ?>" class="input-block-level" value="<?php echo $iPro["amount"]; ?>" name="othergiven[]" readonly="readonly">
                        <input type="hidden" id="feeother<?php echo $i; ?>" class="input-block-level" value="<?php echo $iPro["amount"]; ?>" name="fee[]" readonly="readonly"></td>
                        <td style="display:none"></td>
                        <td><input type="text" id="odte<?php echo $i ?>" class="odate<?php echo $i ?> datepicker span12" value="<?php echo date("Y-m-d H:i:g"); ?>" /></td>
                        <td><font color="#99CC00">Paid</font></td>
                        <td><?php
                        echo '<a data-class="recepit" href="print/?page_id=pocket_recepit&idno='.$_GET["id"].'&udate='.date("d-m-Y").'&amount='.$iPro["amount"].'&type=fee&paytype=hostel-income&detail='.$iPro["tid"].'&install='.$i.'&class='.$aryForm["class"].'" class="btn btn-danger fancybox">Delete</button>';
						$totalOther+=(int)$iPro["amount"];
						$payOther+=(int)$iPro["amount"]; 
						?></td>
                        <td>
                        <?php 
						
						$LastQ=$db->getVal("select max(id) from transaction where idno='".$_GET["id"]."' and school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and type='".$iPro["tid"]."'");
						if($iPro["amount"]>0){ ?>
                                <input type="checkbox" class="other" name="newRec[]" data-month="<?php echo $i; ?>" data-rr="<?php echo $iPro["id"] ?>" value="<?php echo $iPro["amount"]; ?>" data-class="<?php echo $iPro["tid"]; ?>" /><?php //print_r($recpChkData); ?>
                            <?php }?>
                            </td>
                      </tr>
                     <?php $i++;} 
					 ?>
                      <tr>
                      
                      	<td>Other <?php echo $i; ?></td>
                        <td > <input type="hidden" name="idno" value="<?php echo $_GET["id"]; ?>" />
                        <input style="width:150px" type="text" placeholder="enter detail" id="reasion<?php echo $i; ?>" class="input-block-level" value="pocket_money_<?php echo $i; ?>" name="reasion[]"></td>
                        <td><input type="text" onkeyup="$('#feeother<?php echo $i; ?>').val(this.value)" id="givenother<?php echo $i; ?>" class="input-block-level" value="" name="othergiven[]" >
                        <input type="hidden" id="feeother<?php echo $i; ?>" class="input-block-level" value="" name="fee[]" ></td>
                        <td style="display:none"></td>
                        <td><input type="text" id="odte<?php echo $i ?>" class="odate<?php echo $i ?> datepicker span12" value="<?php echo date("Y-m-d H:i:g"); ?>" /></td>
                        <td>---</td>
                        <td><a style="float:left" href="javascript:;" id="saveother<?php echo $i ?>" onclick="payotherincome('<?php echo $i; ?>')"><button type="button" class="btn btn-info">Pay Fees</button></a>
                        <a style="display:none" id="add" href="javascript:;"><button type="button" class="btn btn-info">Add Other</button></a>
                        </td>
                        <td></td>
                      </tr>
					 <?php	
					 }else{
					 ?>
                      <tr>
                      
                      	<td>Other <?php echo $i; ?></td>
                        <td > <input type="hidden" name="idno" value="<?php echo $_GET["id"]; ?>" />
                        <input  style="width:150px" type="text" placeholder="enter detail" id="reasion<?php echo $i; ?>" class="input-block-level" value="pocket_money_<?php echo $i; ?>"  name="reasion[]"></td>
                        <td><input type="text" onkeyup="$('#feeother<?php echo $i; ?>').val($(this).val())" id="givenother<?php echo $i; ?>" class="input-block-level" value="" name="othergiven[]">
                        <input type="hidden" id="feeother<?php echo $i; ?>" class="input-block-level" value="" name="fee[]" ></td>
                        <td></td>
                        <td><input type="text" id="odte<?php echo $i ?>" class="odate<?php echo $i ?> datepicker span12" value="<?php echo date("Y-m-d H:i:g"); ?>" /></td>
                        <td>---</td>
                        <td><a style="float:left" href="javascript:;" id="saveother<?php echo $i ?>" onclick="payotherincome('<?php echo $i; ?>')"><button type="button" class="btn btn-info">Pay Fees</button></a>
                        <a style="display:none" id="add" href="javascript:;"><button type="button" class="btn btn-info">Add Other</button></a>
                        </td>
                        <td style="display:none"></td>
                      </tr>
					 <?php					 
					 }
					 } ?>
                     <tr>
                     <td>Total</td><td></td>
                     <td><?php echo $allincome; ?></td></tr>
                  	</tbody>
                 </table>
                 
          </div>
          		<div class="half">
                  <center>All Expance</center>
                  <table class="table">
                    <thead>
                        <tr>
                        	<th>Quater</th>
                            <th>Detail</th>
                            <th>Amount Given</th>
                            <th style="display:none" width="50px">Late Fee</th>
                            <th>Date</th>
                            <th>Status</th>
                            <th><span class="action">Action</span></th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody id="tbody" style="border-top:2px solid #F00">
                    	<?php 
					if($_GET["id"]!=''){ $allexpance=0;$i=1;
					  $all_product=$db->getRows("select * from transaction where school_id='".$_SESSION["admin"]["school_id"]."' and tfor='hostel-expance' and rid='".$_GET["id"]."' and session='".$_SESSION["admin"]["session"]."'");
					 //echo $db->getErMsg();
					 //echo"<pre>";print_r($all_product);echo"</pre>";
					  if(is_array($all_product) && count($all_product))
                      {
                        foreach($all_product as $iPro)
                        {
							$allexpance+=$iPro["amount"];
							?>
                      <tr>
                      
                      	<td>Other <?php echo $i; ?></td>
                        <td><input type="hidden" name="idno" value="<?php echo $_GET["id"]; ?>" />
                        <input style="width:150px" type="text" placeholder="enter detail" id="ereasion<?php echo $i; ?>" readonly="readonly" class="input-block-level" value="<?php echo $iPro["tid"]; ?>" name="ereasion[]"></td>
                        <td><input type="text" w id="givenother1<?php echo $i; ?>" class="input-block-level" value="<?php echo $iPro["amount"]; ?>" name="othergiven[]" readonly="readonly">
                        <input type="hidden" id="feeother<?php echo $i; ?>" class="input-block-level" value="<?php echo $iPro["amount"]; ?>" name="fee[]" readonly="readonly"></td>
                        <td style="display:none"></td>
                        <td><input type="text" id="odte<?php echo $i ?>" class="odate<?php echo $i ?> datepicker span12" value="<?php echo date("Y-m-d H:i:g"); ?>" /></td>
                        <td><font color="#99CC00">Paid</font></td>
                        <td><?php
                        echo '<a data-class="recepit" href="print/?page_id=pocket_recepit&idno='.$_GET["id"].'&udate='.date("d-m-Y").'&amount='.$iPro["amount"].'&type=fee&paytype=hostel-expance&detail='.$iPro["tid"].'&install='.$i.'&class='.$aryForm["class"].'" class="btn btn-danger fancybox">Delete</button>';
						$totalOther+=(int)$iPro["amount"];
						$payOther+=(int)$iPro["amount"]; 
						?></td>
                        <td>
                        <?php 
						
						$LastQ=$db->getVal("select max(id) from transaction where idno='".$_GET["id"]."' and school_id='".$_SESSION["admin"]["school_id"]."' and session='".$_SESSION["admin"]["session"]."' and type='".$iPro["tid"]."'");
						if($iPro["amount"]>0){ ?>
                                <input type="checkbox" class="other-expance" name="newRec[]" data-month="<?php echo $i; ?>" data-rr="<?php echo $iPro["id"] ?>" value="<?php echo $iPro["amount"]; ?>" data-class="<?php echo $iPro["tid"]; ?>" /><?php //print_r($recpChkData); ?>
                            <?php }?>
                            </td>
                      </tr>
                     <?php $i++;} 
					 ?>
                      <tr>
                      
                      	<td>Other <?php echo $i; ?></td>
                        <td > <input type="hidden" name="idno" value="<?php echo $_GET["id"]; ?>" />
                        <input style="width:150px" type="text" placeholder="enter detail" id="ereasion<?php echo $i; ?>" class="input-block-level"  name="ereasion[]"></td>
                        <td><input type="text" onkeyup="$('#feeother<?php echo $i; ?>').val(this.value)" id="givenother1<?php echo $i; ?>" class="input-block-level" value="" name="othergiven[]" >
                        <input type="hidden" id="feeother<?php echo $i; ?>" class="input-block-level" value="" name="fee[]" ></td>
                        <td style="display:none"></td>
                        <td><input type="text" id="odte<?php echo $i ?>" class="odate<?php echo $i ?> datepicker span12" value="<?php echo date("Y-m-d H:i:g"); ?>" /></td>
                        <td>---</td>
                        <td><a style="float:left" href="javascript:;" id="saveother<?php echo $i ?>" onclick="payotherexpance('<?php echo $i; ?>')"><button type="button" class="btn btn-info">Pay Fees</button></a>
                        <a style="display:none" id="add" href="javascript:;"><button type="button" class="btn btn-info">Add Other</button></a>
                        </td>
                        <td></td>
                      </tr>
					 <?php	
					 }else{
						
					 ?>
                      <tr>
                      
                      	<td>Other <?php echo $i; ?></td>
                        <td > <input type="hidden" name="idno" value="<?php echo $_GET["id"]; ?>" />
                        <input  style="width:150px" type="text" placeholder="enter detail" id="ereasion<?php echo $i; ?>" class="input-block-level"  name="ereasion[]"></td>
                        <td><input type="text" onkeyup="$('#feeother<?php echo $i; ?>').val($(this).val())" id="givenother1<?php echo $i; ?>" class="input-block-level" value="" name="othergiven[]">
                        <input type="hidden" id="feeother<?php echo $i; ?>" class="input-block-level" value="" name="fee[]" ></td>
                        <td></td>
                        <td><input type="text" id="odte<?php echo $i ?>" class="odate<?php echo $i ?> datepicker span12" value="<?php echo date("Y-m-d H:i:g"); ?>" /></td>
                        <td>---</td>
                        <td><a style="float:left" href="javascript:;" id="saveother<?php echo $i ?>" onclick="payotherexpance('<?php echo $i; ?>')"><button type="button" class="btn btn-info">Pay Fees</button></a>
                        <a style="display:none" id="add" href="javascript:;"><button type="button" class="btn btn-info">Add Other</button></a>
                        </td>
                        <td style="display:none"></td>
                      </tr>
					 <?php					 
						 }
					 } ?>
                     <tr>
                     <td>Total</td><td></td>
                     <td><?php echo $allexpance; ?></td></tr>
                  	</tbody>
                 </table>
                 
          </div>
         </div>
    </div>
</div>        
<!-- / Forms -->
<?php
}else{
	?>

	<div class="row-fluid"><div class="span12"><div class="top-bar">
    <h3><i class="icon-eye-open"></i> <?php echo ucwords($pgAct." ".$pgMod); ?></h3>
    </div>
    <div class="well no-padding">
	<?php
	$aryPgAct=array("src"=>"Student", "page_id"=>$pgMod,"action"=>"add");
// 	$aryList=$db->getRows("select * from student where session='".$_SESSION["admin"]["session"]."' and (status=1)");
// 		$aryList=$db->getRows("select * from student where school_id='".$_SESSION["admin"]["school_id"]."' and status=1 and idno in (select idno from roomallocation) order by name");
// 	echo $db->getErMsg()." <hr>".$db->getLastQuery();
// 	if(is_array($aryList) && count($aryList)>0)
// 	{
		?>
        <!--<table class="table" id="example">-->
        
        <input type="hidden" id="tabletype" value="pocketmoney" />
        <input type="hidden" id="CurrentPage" name="CurrentPage" value="1">
        <input type="hidden" name="startV" id="startV" value="0">
        <input type="hidden" name="endV" id="endV" value="5">
        <div class="searchData"></div>
            <table class="table table-widget table-striped" id="mssresulttable" data-action="viewall" data-extra="&type=student" data-page="index.php?src=Student&page_id=pocketmoney&loadData=yes" data-table="student">
            <thead>
                <tr>
                    <th>Adm.No</th>
                    <th>Name</th>
                    <th>Class</th>
                    <th>Father</th>
                    <th>Action</th>
                </tr>
            </thead>
            <tbody id="resultBody">
           
            </tbody>

        </table>
                <div class="paginationData"></div>
		<?php
// 	}
/*	else{
		?>
        <div class="alert alert-info">
          <a class="close" data-dismiss="alert">×</a>
          <i class="icon icon-warning-sign"></i> <b>Notice</b> Record not found </i>
        </div>
        <?php
	}*/
	?>
	</div></div></div>
	<?php

}
?>
<!-- / Forms -->
<script type="text/javascript">
$(document).ready(function(e) {
    var oTable = $('#ajaxtable').dataTable( {
		"bProcessing": true,
		'sPaginationType': 'full_numbers',
		"sAjaxSource": 'ajax.php?type='+$('#tabletype').val(),
		'iDisplayLength': 5,
		"oLanguage": {
			"sSearch": "Search by any columns:"
		}
	});
});
function fetchByClass(){
	var name=$("#class").val();
	var section=$("#section").val();
	if(name!=""){
		var url='ajax.php?class='+name+'&type='+$('#tabletype').val();
		if(section!=""){
			url+='&section='+section
		}
		 oTable = $('#ajaxtable').dataTable( {
			"bProcessing": true,
			'sPaginationType': 'full_numbers',
			"bServerSide": false,
			"bDestroy":true,
			"sAjaxSource": url,
			'iDisplayLength': 5,
			"oLanguage": {
				"sSearch": "Search by any columns:"
			}
		});
	}else{
		var oTable = $('#ajaxtable').dataTable( {
			"bProcessing": true,
			'sPaginationType': 'full_numbers',
			"bServerSide": false,
			"bDestroy":true,
			"sAjaxSource": 'ajax.php?type='+$('#tabletype').val(),
			'iDisplayLength': 5,
			"oLanguage": {
				"sSearch": "Search by any columns:"
			}
		});
	}
}
function changeIns(){
	var cla=$("#class").val();
	var id=$("#noInstallment").val();
	var bus=$("#bus").val();
	$.post( "ajax.php", { type: "installment" ,class: cla, bus: bus , nos: id } , function( data ) {
	  	$("#ins").html(data);
		getTotal();
	});
	
}
function getTotal(){
	var sum=0;var classfee=0;var busfee=0;
	var cost = document.getElementsByName('fee[]');
	classfee=$('#classfee').val();
	for(var i=0;i<cost.length;i++)
	{
		sum = parseInt(sum) + parseInt(cost[i].value);
	}
	$('#feetotal').val(sum);
	$('#discount').val(parseInt(classfee)-parseInt(sum));
}
function paynow(id){
	$("#save"+id).hide();
	var given=$("#given"+id).val();
	var udate=$("#fdate"+id).val();
	var fee=$("#fee"+id).val();
	if(given==""){
		alert("Amount cannot blank");
		$("#save"+id).show();
	}else{
		$.post( "ajax.php", { 	type: "feepayment" ,	
								fee: fee, 
								given: given, 
								udate: udate,
								student_id:'<?php echo $_GET["id"] ?>',
								id: id } , function( data ) {
			if(data==0)
			{
				window.location='<?php echo curPageURL(); ?>';
			}
			else
			{
				$("#save"+id).show();
				alert(data);
			}
		});
	}
}
function paybusnow(id){
	$("#savebus"+id).hide();
	var busgiven=$("#busgiven"+id).val();
	var udate=$("#bdate"+id).val();
	//alert(udate);return false;exit;
	var busfee=$("#busfee"+id).val();
	if(busgiven==""){
		alert("Amount cannot blank");
		$("#savebus"+id).show();
	}else{
		$.post( "ajax.php", { 	type: "busfeepayment" ,	
								busfee: busfee, 
								udate: udate, 
								busgiven: busgiven, 
								student_id:'<?php echo $_GET["id"] ?>',
								id: id } , function( data ) {
			if(data==0)
			{
				window.location='<?php echo curPageURL(); ?>';
			}
			else
			{
				$("#savebus"+id).show();
				alert(data);
			}
		});
	}
}
function payhostelnow(id){
	$("#savehostel"+id).hide();
	var hostelgiven=$("#hostelgiven"+id).val();
	var udate=$("#hosdate"+id).val();
	var hostelfee=$("#hostelfee"+id).val();
	//alert(hostelgiven+"\n"+hostelfee);
	if(hostelgiven==""){
		alert("Amount cannot blank");
		$("#hostelbus"+id).show();
	}else{
		$.post( "ajax.php", { 	type: "hostelfeepayment" ,	
								hostelfee: hostelfee, 
								udate: udate, 
								hostelgiven: hostelgiven, 
								student_id:'<?php echo $_GET["id"] ?>',
								id: id } , function( data ) {
			if(data==0)
			{
				window.location='<?php echo curPageURL(); ?>';
			}
			else
			{
				$("#hostelbus"+id).show();
				alert(data);
			}
		});
	}
}
function payotherincome(id){
    var STcls = $("#stucls").val();
	$("#saveother"+id).hide();
	var given=parseInt($("#givenother"+id).val());
	var fee=$("#reasion"+id).val();
	//alert(fee);
	 if(given==""){
		alert("Amount cannot blank");
		$("#saveother"+id).show();
	}else if(fee < given){
		alert("Amount("+given+") cannot greater then total Amount("+fee+")");
		$("#saveother"+id).show();
	}else{
		//alert(given+"="+fee);exit;
		var reasion=$("#reasion"+id).val();
		var udate=$("#odte"+id).val();//alert(udate);return true;
		$.post( "ajax.php", { 	type: "feeotherincome" ,	
								fee: fee, 
								given: given,
								udate: udate, 
								reasion: reasion, 
								student_id:'<?php echo $_GET["id"] ?>',
								id: id } , function( data ) {//alert(data);return false;
			if(data==0)
			{
				window.location='<?php echo curPageURL(); ?>';
			}
			else
			{
				// alert(data);
				$("#saveother"+id).show();

				var name = "0"; var bus = "0"; var hostel = "0"; var hostelFine = "0"; var busFine = "0"; var nameFine = "0"; var msg = "";

                // getPopup("<?php echo URL_ROOT ?>print/?page_id=pocket_recepitNew&idno=<?php echo $_GET["id"]."&udate=".date("Y-m-d")."&amount="; ?>"+totalSum+"&type=fee&fee-Tution%20Fees="+name+"&fee-Bus%20Fees="+bus+"&fee-Hostel%20Fees="+hostel+"&fee-Hostel%20Fine="+hostelFine+"&fee-Bus%20Fine="+busFine+"&fee-Tution%20Fine="+nameFine+"&rrid="+rrid+otherfee+"&paytype=classfee&detail=pay fee for "+msg+"&class="+STcls+"&install=1"+
// 	extraFee+extraFineFee+ext+extFine+month+"&total="+tot,"1","recepit");

        		getPopup("<?php echo URL_ROOT ?>print/?page_id=pocket_recepitNew&idno=<?php echo $_GET["id"]."&udate=".date("Y-m-d")."&amount="; ?>"+given+"&type=fee&fee-Tution%20Fees="+name+"&fee-Bus%20Fees="+bus+"&fee-Hostel%20Fees="+hostel+"&fee-Hostel%20Fine="+hostelFine+"&fee-Bus%20Fine="+busFine+"&fee-Tution%20Fine="+nameFine+"&rrid=rrid-"+data+"&fee-"+reasion+"="+given+"&paytype=classfee&detail=pay fee for "+reasion+"&class="+STcls+"&install=1&total="+given,"1","recepit");
            	$(".close").click(function() {
            		$(this).parent().remove();
            	    location.reload();
            	});
            	$(".outer").click(function() {
            		$(this).remove();
            		location.reload();
            	});
				
			}
		});
	}
}

function payotherexpance(id){
    var STcls = $("#stucls").val();
	$("#saveother"+id).hide();
	var given=parseInt($("#givenother1"+id).val());
	var fee=$("#ereasion"+id).val();
	//alert(fee);
	 if(given==""){
		alert("Amount cannot blank");
		$("#saveother"+id).show();
	}else if(fee < given){
		alert("Amount("+given+") cannot greater then total Amount("+fee+")");
		$("#saveother"+id).show();
	}else{
		//alert(given+"="+fee);exit;
		var reasion=$("#ereasion"+id).val();
		var udate=$("#odte"+id).val();//alert(udate);return true;
		$.post( "ajax.php", { 	type: "feeotherexpance" ,	
								fee: fee, 
								given: given,
								udate: udate, 
								reasion: reasion, 
								student_id:'<?php echo $_GET["id"] ?>',
								id: id } , function( data ) {//alert(data);return false;
			if(data==0)
			{
				window.location='<?php echo curPageURL(); ?>';
			}
			else
			{
				// alert(data);
				$("#saveother"+id).show();
				
								var name = "0"; var bus = "0"; var hostel = "0"; var hostelFine = "0"; var busFine = "0"; var nameFine = "0"; var msg = "";

                // getPopup("<?php echo URL_ROOT ?>print/?page_id=pocket_recepitNew&idno=<?php echo $_GET["id"]."&udate=".date("Y-m-d")."&amount="; ?>"+totalSum+"&type=fee&fee-Tution%20Fees="+name+"&fee-Bus%20Fees="+bus+"&fee-Hostel%20Fees="+hostel+"&fee-Hostel%20Fine="+hostelFine+"&fee-Bus%20Fine="+busFine+"&fee-Tution%20Fine="+nameFine+"&rrid="+rrid+otherfee+"&paytype=classfee&detail=pay fee for "+msg+"&class="+STcls+"&install=1"+
// 	extraFee+extraFineFee+ext+extFine+month+"&total="+tot,"1","recepit");

        		getPopup("<?php echo URL_ROOT ?>print/?page_id=pocket_recepitNew&idno=<?php echo $_GET["id"]."&udate=".date("Y-m-d")."&amount="; ?>"+given+"&type=fee&fee-Tution%20Fees="+name+"&fee-Bus%20Fees="+bus+"&fee-Hostel%20Fees="+hostel+"&fee-Hostel%20Fine="+hostelFine+"&fee-Bus%20Fine="+busFine+"&fee-Tution%20Fine="+nameFine+"&rrid=rrid-"+data+"&fee-"+reasion+"="+given+"&paytype=classfee&detail=pay fee for "+reasion+"&class="+STcls+"&install=1&total="+given,"1","recepit");
            	$(".close").click(function() {
            		$(this).parent().remove();
            	    location.reload();
            	});
            	$(".outer").click(function() {
            		$(this).remove();
            		location.reload();
            	});

			}
		});
	}
}

function payextranow(id,typeid){
	$("#saveextra"+typeid+id).hide();
	var given=$("#extragiven"+typeid+"fee"+id).val();
	var udate=$("#ex"+typeid+"date"+id).val();
	//alert(udate);return false;exit;
	var fee=$("#extra"+typeid+"fee"+id).val();
	if(given==""){
		alert("Amount cannot blank");
		$("#saveextra"+typeid+id).show();
	}else{
		$.post( "ajax.php", { 	type: "extrapayment" ,
								typeid : typeid	,
								fee: fee, 
								udate: udate, 
								given: given, 
								student_id:'<?php echo $_GET["id"] ?>',
								id: id } , function( data ) {
			if(data==0)
			{
				window.location='<?php echo curPageURL(); ?>';
			}
			else
			{
				$("#saveextra"+typeid+id).show();
				alert(data);
			}
		});
	}
}
<?php if($aryInstall["status"]==1){?>
$(document).ready(function(){
	var givenCost = document.getElementsByName('given[]');
	var j=0;
	for(var i=0;i<givenCost.length;i++)
	{
		if(givenCost[i].value=="")j++;
	}
	if(j==1){
		var lasttd=$(".classtd:last").html();
		var add_ins='<a style="float:left" onclick="addinstallment()" href="javascript:;"><button type="button" class="btn btn-info">add install</button></a>';
		$(".classtd:last").html(lasttd+' '+add_ins);
	}
	var givenCost = document.getElementsByName('busgiven[]');
	var j=0;
	for(var i=0;i<givenCost.length;i++)
	{
		if(givenCost[i].value=="")j++;
	}
	if(j==1){
		var lastbustd=$(".bustd:last").html();
		var add_bus_ins='<a style="float:left" onclick="addbusinstallment()" href="javascript:;"><button type="button" class="btn btn-info">add install</button></a>';
		$(".bustd:last").html(lastbustd+' '+add_bus_ins);
	}
	var givenCost = document.getElementsByName('hostelgiven[]');
	var j=0;
	for(var i=0;i<givenCost.length;i++)
	{
		if(givenCost[i].value=="")j++;
	}
	if(j==1){
		var lasthosteltd=$(".hosteltd:last").html();
		var add_hostel_ins='<a style="float:left" onclick="addhostelinstallment()" href="javascript:;"><button type="button" class="btn btn-info">add install</button></a>';
		$(".hosteltd:last").html(lasthosteltd+' '+add_hostel_ins);
	}
});
<?php } ?>
function addinstallment(){
	var ins = prompt ('How musch installment you want','2');
	var instalment_no=$(".classtd:last .instalment_no").val();
	var rested_instalment=12-instalment_no;
	if(ins>rested_instalment){
		alert("You maximun no of installment");
	}else
	if(ins!="" && ins!=0){
		make_installment(ins,instalment_no);
	}
}
function make_installment(id,instalment_no){
	var fee=$(".classtd:last .instalment").val();
	update_installment(id,fee,instalment_no,"update_fee_installment");
}
function addbusinstallment(){
	var ins = prompt ('How musch installment you want','2');
	var instalment_no=$(".bustd:last .instalmentbus_no").val();
	var rested_instalment=12-instalment_no;
	if(ins>rested_instalment){
		alert("You  reched  maximum no of installment");
	}else
	if(ins!="" && ins!=0){
		make_bus_installment(ins,instalment_no);
	}
}
function make_bus_installment(id,instalment_no){
	var fee=$(".bustd:last .instalmentbus").val();
	update_installment(id,fee,instalment_no,"update_bus_installment");
}
function addhostelinstallment(){
	var ins = prompt ('How musch installment you want','2');
	var instalment_no=$(".hosteltd:last .instalmenthostel_no").val();
	var rested_instalment=12-instalment_no;
	if(ins>rested_instalment){
		alert("You  reched  maximum no of installment");
	}else
	if(ins!="" && ins!=0){
		make_hostel_installment(ins,instalment_no);
	}
}
function make_hostel_installment(id,instalment_no){
	var fee=$(".hosteltd:last .instalmenthostel").val();
	update_installment(id,fee,instalment_no,"update_hostel_installment");
}
function update_installment(id,fee,instalment_no,type){
	$.post( "ajax.php", { 	type: type ,	
							id: id, 
							fee: fee,
							instalment_no:instalment_no, 
							student_id:'<?php echo $_GET["id"] ?>'
						} , function( data ) {
	  	
		if(data==0)
		{
			window.location='<?php echo curPageURL(); ?>';
		}
		else
		{
			alert(data);
		}
	});
}
function competeFee(){
	if(confirm('Are you sure want to pay?')){
		$.post( "ajax.php", { 	type: "competeFee" ,
								student_id:'<?php echo $_GET["id"] ?>'
							} , function( data ) {
			if(data==0)
			{
				window.location='<?php echo curPageURL(); ?>';
			}
			else
			{
				alert(data);
			}
		});
	}
}

$(document).ready(function(){
	$("#add").click(function(){
		var rowCount = ($('#tbody tr').length)+1;
		var add_tr='<tr><td>other '+rowCount+'</td><td><input type="hidden" name="idno" value="<?php echo $_GET["id"]; ?>" /><input class="input-block-level" type="text" placeholder="enter detail" name="fee[]" id="feeother'+rowCount+'"></td><td><input class="input-block-level" id="givenother'+rowCount+'" type="text" name="othergiven[]"></td><td></td><td></td><td><a href="javascript:;" id="saveother'+rowCount+'" onclick="payother(\''+rowCount+'\')"><button type="button" class="btn btn-info">Pay Fees</button></a><a class="delete" href="javascript:;"><button type="button" class="btn btn-info">Remove Other</button></a></td></tr>';
		$("#tbody").append($(add_tr));
		$('#tbody td a.delete').click(function(){
				$(this).parent().parent().remove(); 
		});	
	});
});

function checkRecept(STcls){
	var totalSum=0;var tot=0;
	var name=0;	var bus=0; var hostel=0; var otherlMonth="";	var extraFee="";	var other=0; var otherfee=""; var ext="";	var msg="";	var rrid="rrid";
	var nameFine=0;	var busFine=0; var hostelFine=0; var otherlMonthFine="";	var extraFeeFine="";	var otherFine=0; var otherFinefee=""; var extFine="";
	var busMonth="";	var hotelMonth="";	var tutionMonth="";	var otherMonth="";	var myotherMonth="";	var extraMonth=""; var m=""; var extrafee=0;
	var busFineMonth="";	var hotelFineMonth="";	var tutionFineMonth="";	var otherFineMonth="";	var myotherMonth="";	var extraFineMonth=""; var m=""; var extraFinefee=0;  var extraFineFee ="";
	$("input:checkbox[type=checkbox]:checked").each(function(){
		var amt=parseInt($(this).val());
		rrid=rrid+"-"+$(this).attr('data-rr');
		if($(this).attr("class")=="bus"){msg+=" bus";bus+=amt;if(busMonth=="")busMonth+=$(this).attr("data-month");else busMonth+=","+$(this).attr("data-month"); m+=","+$(this).attr("data-extramonth");tot+=parseInt($(this).attr("data-tot"));}
		else if($(this).attr("class")=="bus_fine"){msg+=" bus fine ";busFine+=amt;if(busFineMonth=="")busFineMonth+=$(this).attr("data-month");else busFineMonth+=","+$(this).attr("data-month"); m+=","+$(this).attr("data-extramonth");tot+=amt;}
		else if($(this).attr("class")=="hostel"){msg+=" hostel";hostel+=amt;if(hotelMonth=="")hotelMonth+=$(this).attr("data-month");else hotelMonth+=","+$(this).attr("data-month");tot+=parseInt($(this).attr("data-tot"));}
		else if($(this).attr("class")=="hostel_fine"){msg+=" hostel Fine";hostelFine+=amt;if(hotelFineMonth=="")hotelFineMonth+=$(this).attr("data-month");else hotelFineMonth+=","+$(this).attr("data-month");tot+=amt;}
		
		
		else if($(this).attr("class")=="other"){msg+= $(this).attr("data-class");otherfee+="&fee-"+$(this).attr("data-class")+"="+amt; if(otherlMonth=="")otherlMonth+=$(this).attr("data-month"); else otherlMonth+=","+$(this).attr("data-month");tot+=amt;}
		else if($(this).attr("class")=="other-expance"){msg+= $(this).attr("data-class");otherfee+="&fee-"+$(this).attr("data-class")+"="+amt; if(otherlMonth=="")otherlMonth+=$(this).attr("data-month"); else otherlMonth+=","+$(this).attr("data-month");tot+=amt;}
		else if($(this).attr("class")=="myother"){msg+= $(this).attr("data-class"); ext+="&fee-"+$(this).attr("data-class")+"="+amt;tot+=parseInt($(this).attr("data-tot"));}
		else if($(this).attr("class")=="myother_fine"){msg+= $(this).attr("data-class"); extFine+="&fee-"+$(this).attr("data-class")+"%20Remaining"+"="+amt;tot+=amt;}
		
		
		else if($(this).attr("class")=="cla"){msg+=" class";name+=amt;if(tutionMonth=="")tutionMonth+=$(this).attr("data-month");else tutionMonth+=","+$(this).attr("data-month"); m+=","+$(this).attr("data-extramonth");tot+=parseInt($(this).attr("data-tot")); }
		else if($(this).attr("class")=="cla_fine"){msg+=" class Fine";nameFine+=amt;if(tutionFineMonth=="")tutionFineMonth+=$(this).attr("data-month");else tutionFineMonth+=","+$(this).attr("data-month"); m+=","+$(this).attr("data-extramonth");tot+=amt;}
		
		
		else if($(this).attr("class")=="extrafee"){extraFee+="&extrafee-"+$(this).attr("data-name")+"`"+$(this).attr("data-month")+"="+amt;
if(extraMonth=="")extraMonth+=$(this).attr("data-month");else extraMonth+=","+$(this).attr("data-month");tot+=parseInt($(this).attr("data-tot"));}
		else if($(this).attr("class")=="extrafee_fine"){
			extraFineFee+="&extrafee-fine%20"+$(this).attr("data-name")+"`"+$(this).attr("data-month")+"="+amt;tot+=amt;
			 if(extraFineMonth=="")extraFineMonth+=$(this).attr("data-month");else extraFineMonth+=","+$(this).attr("data-month"); }
		//alert(amt+"-"+tot);
		totalSum+=amt;
	}); //alert(otherfee);
	//var month="&busMonth="+busMonth+"&hotelMonth="+hotelMonth+"&tutionMonth="+tutionMonth+"&otherMonth="+otherMonth+"&myotherMonth="+myotherMonth+"&extraMonth="+extraMonth;
	//alert(tot);
	var month="&Months="+busMonth+","+hotelMonth+","+tutionMonth+","+m+","+otherMonth+","+myotherMonth+","+extraMonth;
	//var tution_month="&tution_month="+tutionMonth;
	//var bus_month="&bus_month="+busMonth;
	getPopup("<?php echo URL_ROOT ?>print/?page_id=pocket_recepitNew&idno=<?php echo $_GET["id"]."&udate=".date("d-m-Y")."&amount="; ?>"+totalSum+"&type=fee&fee-Tution%20Fees="+name+"&fee-Bus%20Fees="+bus+"&fee-Hostel%20Fees="+hostel+"&fee-Hostel%20Fine="+hostelFine+"&fee-Bus%20Fine="+busFine+"&fee-Tution%20Fine="+nameFine+"&rrid="+rrid+otherfee+"&paytype=classfee&detail=pay fee for "+msg+"&class="+STcls+"&install=1"+
	extraFee+extraFineFee+ext+extFine+month+"&total="+tot,"1","recepit");
	$(".close").click(function() {
		$(this).parent().remove();
	});
	$(".outer").click(function() {
		$(this).remove();
	});
}
$(function() {
	$(".datepicker").each(function(index, element) {
        var d = new Date(); // for now
		datetext=d.getHours()+": "+d.getMinutes()+": "+d.getSeconds();
		$( this ).datepicker({
		  changeMonth: true,
		  changeYear: true,
		  showOn: "button",
		  buttonImage: "js/images/calendar.gif",
		  buttonImageOnly: true,
		  buttonText: "Select date",
		  dateFormat: 'yy-mm-dd ',
		  onSelect: function(datetext){
			var d = new Date(); // for now
			datetext=datetext+" "+d.getHours()+":"+d.getMinutes()+":"+d.getSeconds();
			$(this).val(datetext);
		  }
		});
    });
	getTotalMonthCost();
	$(".datepicker").hide();
});

function getTotalMonthCost(){
	var month=$("#MyActivatedMonth").val();
	var udetail=$("#userdetails").html();
	var total=0;htmlCode="";$("#appendDiv").remove();var htmlDisplay="<div>"+udetail+"</div>";
	var monthNames = [ "January", "February", "March", "April", "May", "June","July", "August", "September", "October", "November", "December" ];
	//$("input[data-month=month"+month+"]").each(function(index, element) {
//		var dataP=$(this).attr('data-value');
//		var typeP=$(this).attr('data-type');
//		var dataValP=(dataP).split("-");
//		total=total+parseFloat(dataValP[0]);
//	});
		var t="0",oldrem="0";	
		for(var i=1;i<=month;i++){
			var m=0;
			if(i<=9){
				m=i+3;
			}
			else{
				m=i-9;
			}
			m=m-1; 
			var jj=0;var c=0;
			var cnts=$("input[data-month=month"+i+"]").size();
			var str="";
			$("input[data-month=month"+i+"]").each(function(index, element) {c++;	
				
				var dataP=$(this).attr('data-value');
				var typeP=$(this).attr('data-type');
				var dataValP=(dataP).split("-");
				var dataN=$(this).attr('data-name');
				var dataT=$(this).attr('data-t');
				var idd=0;var left=0;
				if(typeP=="other"){
					idd=$(this).attr('data-idd');
					left=$(this).attr('data-left');
				}
				if(typeP=="tuition_fine" && dataValP[0]=="")
				      dataValP[1]=1;
				if(typeP=="bus_fine" && dataValP[0]=="")
					  dataValP[1]=1;
					//alert(left);  
				//alert(typeP+"-"+dataP);
				if(dataValP[1]=="" || dataValP[1]=="0"){//alert(typeP+"-"+dataValP[0]+" of  month"+i+" "+dataValP[1]);
					if(typeP=="tution" || typeP=="bus" || typeP=="other" || typeP=="hostel" || dataT=="extrafee")
							str=typeP;
					if(str!="" || c==1){
								total=total+parseFloat(dataValP[0]);
					jj=jj+1;
					if(jj==1){
						htmlDisplay+='<table class="table"><thead><tr><td colspan="'+cnts+'" style="text-align:center">'+monthNames[m]+'</td></tr><thead><tbody><tr>'; 
					}
					}
					if(total==0){}
					else{
						htmlCode+='<input type="hidden" name="pay-type[]" value="'+typeP+'">';
						htmlCode+='<input type="hidden" name="pay-value[]" value="'+dataValP[0]+'">';
						htmlCode+='<input type="hidden" name="pay-month[]" value="'+i+'">';
						htmlCode+='<input type="hidden" name="pay-name[]" value="'+dataN+'">';
						htmlCode+='<input type="hidden" name="pay-idd[]" value="'+idd+'">';
						htmlCode+='<input type="hidden" name="pay-left[]" value="'+left+'">';
						htmlDisplay+='<td>'+dataN+' ';
						htmlDisplay+='<br/>'+dataValP[0]+'</td>';
					}
				}
				/*if(dataValP[1]=="" || dataValP[1]=="0"){//alert(typeP+"-"+dataValP[0]+" of  month"+i+" "+dataValP[1]);
					if(t==typeP){
						total=total+parseFloat(dataValP[0])-oldrem;
						t="0";
						oldrem="";
					}else{
						total=total+parseFloat(dataValP[0]);
					}
				}else if(dataValP[0]>dataValP[1]){
					var rem=dataValP[0]-dataValP[1];
					total=total+rem;
					t=typeP;oldrem=rem;
				}//alert(dataP+" - "+t+" - "+total)*/
				
			});
			htmlDisplay+='</tr></tbody></table>';
		}
    $("#paybymonth").append("<div id='appendDiv'>"+htmlCode+"</div>")
	$("#feedetailDiv").html(htmlDisplay+"<hr/>Total : "+total)
	$("#paytotalMoth").val(total);
	//feedetailDiv
}
function showDetail(id){
	$( "#"+id ).dialog({
      resizable: false,
      modal: true,
	  height:400,
	  width:700,
      buttons: {
	   "Print": function() {
          printDiv('feedetailDiv')
        },
       Cancel: function() {
          $( this ).dialog( "close" );
        }
      }
    });
}
</script>
<style>
.top-bar, .accordion .accordion-toggle{
	overflow:inherit !important;
	width: 96%;
	display:inline-block !important;
}
</style>