<?php
// print_r($_GET);
// die();
//echo "<pre>";print_r($_GET);exit;
$rrid=explode("-",$_GET["rrid"]);$rr=array();for($i=1;$i<count($rrid);$i++){$rr[]=$rrid[$i];}$newrrid=implode("-",$rr);
$newrrid = trim($newrrid);
//$data=array();
foreach($_REQUEST as $key=>$val){
	$fess=explode("-",$key);
	if($fess[0]=="fee" && $val!=0){$i++;
		$feeData=$fess[1];
		$data[$feeData]=$val;
	}elseif($fess[0]=="extrafee" && $val!=0){$i++;
		$fe=explode("`",$fess[1]);
		$feeDat=$fe[0];
		if(array_key_exists($feeDat,$data))
		{
			$data[$feeDat]=$data[$feeDat]+$val;
		}
		else
		{
			$data[$feeDat]=$val;
		}
		
	}
}
$data1=$data;

// echo "select id from enquiry_receipt where idno='".$_GET["idno"]."' and detail='".json_encode($data)."' and amount='".$_GET["amount"]."' and session='".$_SESSION["admin"]["session"]."' and class='".$_GET["class"]."' and school_id='".$_SESSION["admin"]["school_id"]."' and type='".$_GET["type"]."' and install='".$_GET["install"]."' and paytype='Enquiry' and rrid='".$newrrid."'";
// die();
$isAlreadyEntry=$db->getVal("select id from enquiry_receipt where idno='".$_GET["idno"]."' and detail='".json_encode($data)."' and amount='".$_GET["amount"]."' and session='".$_SESSION["admin"]["session"]."' and class='".$_GET["class"]."' and school_id='".$_SESSION["admin"]["school_id"]."' and type='".$_GET["type"]."' and install='".$_GET["install"]."' and paytype='Enquiry' and rrid='".$newrrid."'");
//echo $db->getLastQuery();
if($_POST){
	$data=$db->getVal("select id from enquiry_receipt where id=".$_REQUEST["id"]." and type='".$_REQUEST["type"]."'"); 
	//echo $db->getLastQuery();
	if($data!=""){
// 		echo "record already exit";
	}else{
		$_POST["school_id"]=$_SESSION["admin"]["school_id"];
		$_POST["added_by"]=$_SESSION["admin"]["uid"];
		//print_r($_POST);exit;
		$db->insertAry("enquiry_receipt",$_POST);
		sms(mydetail("mobile",$_GET["idno"],"student"),"Dear Parent, Amount of Rs. ".$_POST['amount']." successfully submitted in ".$LinksDetails["site_name"],"fee_submit");
	}
}
//echo $db->getLastQuery().$db->getErMsg();
?>
<script>
    var headPrint='<div class="headPrint"><img src="<?php echo $LinksDetails["logo"] ?>" height="60px"><h1><?php echo ucfirst(trim($LinksDetails["site_name"])) ?></h1></div>';
	var root='<?php echo URL_ROOT ?>';
	</script>
<script type="text/javascript" src="<?php echo URL_ROOT ?>js/jquery-1.9.1.js"></script>
<link href='<?php echo URL_ROOT ?>assets/css/print.css' rel='stylesheet'>
<script type="text/javascript" src="<?php echo URL_ROOT ?>js/custom.js"></script>
<?php 
include("../db.php");
$id=$db->getval("select max(id) from enquiry_receipt where school_id='".$_SESSION["admin"]["school_id"]."' and type='".$_REQUEST["type"]."'")+1;
if(isset($_REQUEST["receiptid"]))$id=$_REQUEST["receiptid"];
elseif($_POST)$id=$_POST["id"];

$aryForm=$db->getRow("SELECT * FROM enquiry WHERE school_id='".$_SESSION["admin"]["school_id"]."' and idno='".$_GET['idno']."'");
?><style>
.recept {
font-weight: bold;
font-size: 20px;
color: #FC0D0D;
}
.headprint .logo{
	margin: -5px 10px 0px 0px !important;
}

#pm1 {
    display:none;
}
#txnid {
    display:none;
}
#bankname {
    display:none;
}
#tdate {
    display:none;
}
</style>

<?php 
// if(isset($_REQUEST['byreceipt'])){
 
// } else {
if($isAlreadyEntry > 0) { ?>
    <body>
    <?php } else { ?>
    <body onload="document.frm1.submit()">
    <?php } 
    // } 
    ?>

<form method="post" action="" id='printMe' name="frm1">

<input type="hidden" name="id" value="<?php if($isAlreadyEntry!="")echo $isAlreadyEntry; else echo $id ?>" />
<input type="hidden" name="idno" value="<?php echo $_GET["idno"] ?>" />
<input type="hidden" name="udate" value="<?php echo $_GET["udate"] ?>" />
<input type="hidden" name="detail" value='<?php echo json_encode($data); ?>' />
<input type="hidden" name="amount" value="<?php echo $_GET["amount"] ?>" />
<input type="hidden" name="remaining" value="<?php echo $_GET["total"]-$_GET["amount"] ?>" />
<input type="hidden" name="total" value="<?php echo $_GET["total"] ?>" />
<?php if(isset($_GET["Months"])){
			$im=explode(",",$_GET["Months"]);
			$mn=array_unique($im); $months=implode(",",$mn);?>
<input type="hidden" name="Months" value="<?php echo $months ?>" />
<?php }elseif(isset($_REQUEST["month"])){ ?>
<input type="hidden" name="Months" value="<?php echo $_REQUEST["month"] ?>" />
<?php } ?>
<input type="hidden" name="session" value="<?php echo $_SESSION["admin"]["session"] ?>" />
<input type="hidden" name="class" value="<?php echo $_GET["class"] ?>" />
<input type="hidden" name="type" value="<?php echo $_GET["type"] ?>" />
<input type="hidden" name="install" value="<?php echo $_GET["install"] ?>" />
<input type="hidden" name="rrid" value="<?php echo $newrrid; ?>" />
<input type="hidden" name="paytype" value="Enquiry" />

<div style="display:flex;">
<div style="width:49%; border: 4px solid black;background: #C1CCD8;">
<div class="headPrint" style="background: #C1CCD8; border-bottom: 4px solid black;"> 
<table width="100%">
        <tr>
          <td width="10%"><img style="top:3px;position:relative;" src="<?php echo $LinksDetails["logo"] ?>" class="logo" height="50px" width="70px"></td>
           <td  style="text-align:center"><h5 style="margin:0; padding:0;"><?php echo ucfirst($LinksDetails["site_name"]) ?></h5>
            <span style="text-align:center;font-size:13px;"><?php echo ucfirst(nl2br($LinksDetails["contact_content"])); ?></span>
			</td>
        </tr>
      </table>
  </div>
<table width="100%" style='background: #C1CBD8;font-size:12px;'>
    <tr>
        <td width="20%"><strong>R.No</strong></td><td><span class="recept"><?php if($isAlreadyEntry!=""){echo $isAlreadyEntry; $rid = $isAlreadyEntry;} else { echo $id; $rid = $id;} ?></span></td>
        <td width="20%"><strong>Date</strong></td><td><?php echo date("d-m-Y",strtotime($_REQUEST["udate"])); ?></td>
    </tr>
    <tr>
        <td><strong>Name</strong></td><td><?php echo $aryForm["name"]; ?></td>
         <td><strong>Class</strong></td><td><?php echo $aryForm["apply_class"]; ?></td>
    </tr>
    <tr>
        <td><strong>Father's</strong></td><td><?php echo $aryForm["fname"]; ?></td>
        <td><strong>Mother's</strong></td><td><?php echo $aryForm["mname"]; ?></td>
    </tr>
    
        <tr>
        <td><strong>Contact</strong></td><td><?php echo $aryForm["mobile"]; ?></td>
        <td><strong>Adm/No</strong></td><td><?php echo $aryForm["admissionno"]; ?></td>

    </tr>
    <tr>
        <td><strong>Issued By</strong></td>
        <td><?php 
		$addb=$_SESSION["admin"]["uid"];
		if(isset($_REQUEST["receiptid"]))$addb=$db->getVal("select added_by from enquiry_receipt where id=".$_REQUEST["receiptid"]);
		echo $db->getVal("select name from users where id=".$addb);
		 ?></td>
		 
		         <td><strong>Mode</strong></td>
        <td>
	    	<?php 
    	    	if($isAlreadyEntry!=''){
            		$payment_mode=$db->getRow("SELECT payment_mode FROM enquiry_receipt WHERE  id= '$isAlreadyEntry'");
        		}
		        else { $payment_mode=$db->getRow("SELECT payment_mode FROM enquiry_receipt WHERE  id= '$id'"); }
            ?>
    		<span id='pm1'><?=  $payment_mode['payment_mode']?></span>
		     <select id='status' name='payment_mode' onchange='change_pm()'>
		          <option <?php if($payment_mode['payment_mode'] == 'Cash') echo "selected";?> >Cash</option>
       	   	      <option <?php if($payment_mode['payment_mode'] == 'Cheque') echo "selected";?>>Cheque</option>
       	   	      <option <?php if($payment_mode['payment_mode'] == 'NEFT') echo "selected";?>>NEFT</option>
       	   	      <option <?php if($payment_mode['payment_mode'] == 'UPI') echo "selected";?>>UPI</option>
       	   	      <option <?php if($payment_mode['payment_mode'] == 'Bank Deposit') echo "selected";?>>Bank Deposit</option>
       	   	      <option <?php if($payment_mode['payment_mode'] == 'POS') echo "selected";?>>POS</option>
       	   	      <option <?php if($payment_mode['payment_mode'] == 'Debit Card') echo "selected";?>>Debit Card</option>
       	   	      <option <?php if($payment_mode['payment_mode'] == 'Credit Card') echo "selected";?>>Credit Card</option>
       	   	      <option <?php if($payment_mode['payment_mode'] == 'Online Payment') echo "selected";?>>Online Payment</option>
       	   	      <option <?php if($payment_mode['payment_mode'] == 'Mobile Wallet') echo "selected";?>>Mobile Wallet</option>
       	   	      <option <?php if($payment_mode['payment_mode'] == 'POS-2') echo "selected";?>>POS-2</option>
			</select>
        </td>
    </tr>

    <tr>
          <?php 
		if($isAlreadyEntry!=''){
		$cheque_number=$db->getVal("SELECT txnid FROM enquiry_receipt WHERE  id= '$isAlreadyEntry'"); 
		
		$bankname=$db->getVal("SELECT bankname FROM enquiry_receipt WHERE  id= '$isAlreadyEntry'"); 
		}
		else { 
		    $cheque_number=$db->getVal("SELECT txnid FROM enquiry_receipt WHERE  id= '$id'");
		    $bankname=$db->getVal("SELECT bankname FROM enquiry_receipt WHERE  id= '$id'"); 
		}
     ?>
    <td><strong>Cheque No/Tr. No.</strong></td>

    <td>
        <span id="txnid"><?php echo $cheque_number; ?></span>
        <input id="txnidtext" type="text" name="txnid" value="<?php echo $cheque_number; ?>" style="background-color:white !important; height: 23px; width:90px; font-size:15px !important;border:solid 1px !important;">
    </td>
     <td><strong>Bank Name</strong></td>
    
    <td>
        <span id="bankname"><?php echo $bankname; ?></span>
        <input id="banknametext" type="text" name="bankname" value="<?php echo $bankname; ?>" style="background-color:white !important; height: 23px; width:90px; font-size:15px !important;border:solid 1px !important;">
    </td>
    </tr>
    <tr>
        <td><strong>Transaction Date</strong></td>
        <?php
            if($isAlreadyEntry!=''){
                $tdate=$db->getVal("select tdate from enquiry_receipt where id='$isAlreadyEntry' ");
            }
            else {
                $tdate=$db->getVal("select tdate from enquiry_receipt where id='$id' ");
            }
        ?>
        <td>
            <span id="tdate"><?php echo $tdate; ?></span>
            <input id="tdatetext" type="text" name="tdate" value="<?php echo $tdate; ?>" style="background-color:white !important; height: 25px; width:90px; font-size:15px !important;border:solid 1px !important;">
        </td>
    </tr>
    
    <tr>
        
        <!--<td><strong>Issued By</strong></td><td><?php 
		$addb=$_SESSION["admin"]["uid"];
		if(isset($_REQUEST["receiptid"]))$addb=$db->getVal("select added_by from receipt where id=".$_REQUEST["receiptid"]);
		echo $db->getVal("select name from users where id=".$addb);
		//echo $db->getLastQuery();
		 ?></td>-->
    </tr>
	<tr>
    <td colspan="4">
    
<?php
echo "<table width='100%' border='1'>
<tr>
	<th>Sr. No</th><th>Fee Head</th><th>Paid</th>
</tr>";

$i=0; //$data=array();
foreach($data1 as $key=>$val){
	$fess=explode("-",$key);
	//if($fess[0]=="fee" && $val!=0)
	//if($key!="" && $val!="")
	{
		$i++;
		$feeData=$fess[1]; 
		$data1[$feeData]=$val;
		?>
		<tr style="text-align: center;">
			<td><?php echo $i; ?></td><td><?php 
			if($key=="Bus_Fees")echo "Conveyance Fee"; 
			elseif($key=="bus")echo "Transport Fee";
			elseif($key=="tution")echo "Tuition Fee";
			elseif($key=="Tution_Fees")echo "Tuition Fee";
			elseif($key=="hostel")echo "Hostel Fee";
			else echo $key; ?></td><td><?php echo $val; ?></td>
		</tr>
		<?php
	}
}
$aryList=$db->getRows("SELECT * FROM extra_Recepit where school_id='".$_SESSION["admin"]["school_id"]."' and  session='".$_SESSION["admin"]["session"]."'");
if(is_array($aryList) && count($aryList)>0){
	foreach($aryList as $aList){$i++
		?><tr>
            <td><?php  echo $i;?></td><td><?php echo $aList["name"] ?></td><td>0</td>
        </tr><?php		
	}
}
echo "<tr><th></th><th>Total Paid Amount</th><th>".$_REQUEST["amount"]."</th></tr>";
	

echo "</table><hr/><div class='footerPrint'><span>Signature...............................</span></div>";//.$isAlreadyEntry;
if($isAlreadyEntry!=""){
	echo '<input style="background: firebrick;color: white;height: 26px;width: 53px;border: 2px inset snow;border-radius: 10px;" type="button"  onclick="printDivNoHeader(\'printMe\')" value="Print">';
}elseif($_POST){
	echo '<input style="background: firebrick;color: white;height: 26px;width: 53px;border: 2px inset snow;border-radius: 10px;" type="button"  onclick="printDivNoHeader(\'printMe\')" value="Print">';
}elseif(isset($_GET['save'])){
	echo '<input style="background: firebrick;color: white;height: 26px;width: 53px;border: 2px inset snow;border-radius: 10px;" type="button"  onclick="printDivNoHeader(\'printMe\')" value="Print">';
}
else{
	echo '<input id="saveprintme" style="background: firebrick;color: white;height: 26px;width: 53px;border: 2px inset snow;border-radius: 10px; display:none;" type="submit" value="save">';
	echo '<input style="background: firebrick;color: white;height: 26px;width: 53px;border: 2px inset snow;border-radius: 10px;"  onclick="checkreceptNo(\''.$id.'\')" type="button" value="save">';
}
?>

<input id="updatebtn" style="background: firebrick;color: white;height: 26px;width: 53px;border: 2px inset snow;border-radius: 10px;" type="button"  onclick="update()" value="Update">

<style type="text/css">
@media print {
    #myPrntbtn {
        display :  none;
    }
    #updatebtn{
        display: none;
    }
    
    #status {
        display:none;
    }
    
    #pm1 {
        display:block;
    }

    #txnidtext {
        display:none;
    }    
    #txnid{
        display:block;
    }
    
    #banknametext {
        display:none;
    }    
    #bankname{
        display:block;
    }

    #tdatetext {
        display:none;
    }    
    #tdate{
        display:block;
    }
    
}

</style>


	</td></tr>
</table>
<span style="color:red;text-align:center;font-size:14px;"><?php echo "[" ?>Note : If any correction,Please consult to fee counter.<?php echo "]" ?></span>
</div>
<!--<br/><br/><br/><div style="border-top:3px dotted black;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><br/><br/>-->
<div style="width:49%;float:left;margin-left:10px;border: 4px solid black;background: #C1CCD8;">
<div class="headPrint" style="background: #C1CCD8;border-bottom: 2px solid black;"> <table width="100%">
         <tr>
          <td width="10%"><img style="top:3px;position:relative;" src="<?php echo $LinksDetails["logo"] ?>" class="logo" height="50px" width="70px"></td>
           <td  style="text-align:center"><h5 style="margin:0; padding:0;"><?php echo ucfirst($LinksDetails["site_name"]) ?></h5>
            <span style="text-align:center;font-size:13px;"><?php echo ucfirst(nl2br($LinksDetails["contact_content"])); ?></span>
			</td>
        </tr>
      </table></div>
      <table width="100%" style='background: #C1CBD8;font-size:12px;'>
    <tr>
        <td width="20%"><strong>R.No</strong></td><td><span class="recept"><?php if($isAlreadyEntry!="")echo $isAlreadyEntry; else echo $id; ?></span></td>
        <td width="20%"><strong>Date</strong></td><td><?php echo date("d-m-Y",strtotime($_REQUEST["udate"])); ?></td>
    </tr>
    <tr>
        <td><strong>Name</strong></td><td><?php echo $aryForm["name"]; ?></td>
         <td><strong>Class</strong></td><td><?php echo $aryForm["apply_class"]; ?></td>
    </tr>
    <tr>
        <td><strong>Father's</strong></td><td><?php echo $aryForm["fname"]; ?></td>
        <td><strong>Mother's</strong></td><td><?php echo $aryForm["mname"]; ?></td>
    </tr>
    <tr>
        <td><strong>Contact</strong></td><td><?php echo $aryForm["mobile"]; ?></td>
         <td><strong>Adm/No	</strong></td><td><?php //echo $aryForm["apply_class"]; ?></td>
    </tr>
    <tr>
        <td><strong>Issued By</strong></td>
        <td><?php 
		$addb=$_SESSION["admin"]["uid"];
		if(isset($_REQUEST["receiptid"]))$addb=$db->getVal("select added_by from enquiry_receipt where id=".$_REQUEST["receiptid"]);
		echo $db->getVal("select name from users where id=".$addb);
		 ?></td>
        <td><strong>Mode</strong></td>
        <td>
            		<?php 
		if($isAlreadyEntry!=''){
		$payment_mode=$db->getRow("SELECT payment_mode FROM enquiry_receipt WHERE  id= '$isAlreadyEntry'"); 
		}
		else { $payment_mode=$db->getRow("SELECT payment_mode FROM enquiry_receipt WHERE  id= '$id'"); }
				
		?>
		
		<span id='pm' ><?=  $payment_mode['payment_mode']?></span>
        </td>
    </tr>
    
    <tr>
          <?php 
		if($isAlreadyEntry!=''){
		$cheque_number=$db->getRow("SELECT txnid FROM enquiry_receipt WHERE  id= '$isAlreadyEntry'"); 
		
		$bankname=$db->getRow("SELECT bankname FROM enquiry_receipt WHERE  id= '$isAlreadyEntry'"); 
		}
		else { 
		    $cheque_number=$db->getRow("SELECT txnid FROM enquiry_receipt WHERE  id= '$id'");
		    $bankname=$db->getRow("SELECT bankname FROM enquiry_receipt WHERE  id= '$id'"); 
		}
		
// if(!empty($cheque_number)){
		?>      
          <td><strong>Cheque No/Tr. No.</strong></td>
         <td><?php echo $cheque_number['txnid']; ?></td>
           <td><strong>Bank Name</strong></td>
         <td><?php echo $bankname['bankname'] ?></td>
   
     <?php  /* }  
     else
     {
     ?>
    <td><strong>Cheque No/Tr. No.</strong></td>
    
    <td></td>
     <td><strong>Bank Name</strong></td>
    
    <td></td>
     <?php  } */?>
    </tr>
    <tr>
        <td><strong>Transaction Date</strong></td>
        <?php
            if($isAlreadyEntry!=''){
                $tdate=$db->getVal("select tdate from enquiry_receipt where id='$isAlreadyEntry' ");
            }
            else {
                $tdate=$db->getVal("select tdate from enquiry_receipt where id='$id' ");
            }
            
            if($tdate != ''){
        ?>
            <td><?php echo $tdate;
             ?></td>
            <?php 
        } ?>
    </tr>

    
    <tr>
        
        <!--<td><strong>Issued By</strong></td><td><?php 
		$addb=$_SESSION["admin"]["uid"];
		if(isset($_REQUEST["receiptid"]))$addb=$db->getVal("select added_by from enquiry_receipt where id=".$_REQUEST["receiptid"]);
		echo $db->getVal("select name from users where id=".$addb);
		//echo $db->getLastQuery();
		 ?></td>-->
    </tr>
	<tr>
    <td colspan="4">
    
<?php
echo "<table width='100%' border='1'>
<tr>
	<th>Sr. No</th><th>Fee Head</th><th>Paid</th>
</tr>
";
$i=0; //$data=array();
foreach($data1 as $key=>$val){
	$fess=explode("-",$key);
	if($key!="" && $val!="")
	{
		$i++;
		$feeData=$fess[1]; 
		$data1[$feeData]=$val;
		?>
		<tr style="text-align: center;">
			<td><?php echo $i; ?></td><td><?php 
			if($key=="Bus_Fees")echo "Conveyance Fee"; 
			elseif($key=="bus")echo "Transport Fee";
			elseif($key=="tution")echo "Tuition Fee";
			elseif($key=="Tution_Fees")echo "Tuition Fee";
			elseif($key=="hostel")echo "Hostel Fee";
			else echo $key; ?></td><td><?php echo $val; ?></td>
		</tr>
		<?php
	}
}
$aryList=$db->getRows("SELECT * FROM extra_Recepit where school_id='".$_SESSION["admin"]["school_id"]."' and  session='".$_SESSION["admin"]["session"]."'");
if(is_array($aryList) && count($aryList)>0){
	foreach($aryList as $aList){$i++
		?><tr>
            <td><?php  echo $i;?></td><td><?php echo $aList["name"] ?></td><td>0</td>
        </tr><?php		
	}
}
echo "<tr><th></th><th>Total Paid Amount</th><th>".$_REQUEST["amount"]."</th></tr>";
if(isset($_REQUEST["total"])){
	
}
echo "</table><hr/><div class='footerPrint'><span>Signature...............................</span></div>";//.$isAlreadyEntry;

?>
	</td></tr>
</table>
<!--<table width="100%" style='background: #C1CBD8;font-size:12px;'>
    <tr>
        <td width="20%"><strong>Rec.no</strong></td><td><span class="recept"><?php if($isAlreadyEntry!="")echo $isAlreadyEntry; else echo $id; ?></span></td>
        <td width="20%"><strong>Date</strong></td><td><?php echo date("d-m-Y",strtotime($_REQUEST["udate"])); ?></td>
    </tr>
    <tr>
        <td><strong>Name</strong></td><td><?php echo $aryForm["name"]; ?></td>
        <?php if(isset($_REQUEST["month"])){ 
			$ipi=$_REQUEST["month"];$months=="";
			if($ipi<=9){
				$newDate=date("Y")."-".($ipi+3)."-1";
				$months= date("M",strtotime($newDate));//."(".($ij+3).")";
			}
			else{
				$newDate=date("Y")."-".($ipi-9)."-1";
				$months= date("M",strtotime($newDate));//."(".($ij-9).")";
			}
			?><td><strong>Month</strong></td><td><?php echo $months; ?></td><?php
		 }elseif(isset($_GET["Months"])){
			$im=explode(",",$_GET["Months"]);
			$mn=array_unique($im);$months="";
		 	if(is_array($mn) && count($mn)){
				foreach($mn as $ipi){					
					if($ipi!=""){
						if($months!="")$months.=",";
						if($ipi<=9){
							$newDate=date("Y")."-".($ipi+3)."-1";
							$months.= date("M",strtotime($newDate));//."(".($ij+3).")";
						}
						else{
							$newDate=date("Y")."-".($ipi-9)."-1";
							$months.= date("M",strtotime($newDate));//."(".($ij-9).")";
						}
					}
				}
			}
			//$m=explode(",",$_REQUEST['extraMonth']);
			?><td><strong>Month</strong></td><td><?php echo $months;?></td><?php
		 }else{ ?>
        <td><strong>ID No.</strong></td><td><?php echo $aryForm["idno"]; ?></td>
        <?php }?>
    </tr>
    <tr>
        <td><strong>Father Name</strong></td><td><?php echo $aryForm["fname"]; ?></td>
        <td><strong>Mother Name</strong></td><td><?php echo $aryForm["mname"]; ?></td>
    </tr>
    <tr>
        <td><strong>Class</strong></td><td><?php echo $aryForm["class"]; ?></td>
        <td><strong>Issued By</strong></td><td><?php 
		$addb=$_SESSION["admin"]["uid"];
		if(isset($_REQUEST["receiptid"]))$addb=$db->getVal("select added_by from receipt where id=".$_REQUEST["receiptid"]);
		echo $db->getVal("select name from users where id=".$addb);
		//echo $db->getLastQuery();
		 ?></td>
    </tr>
	<tr>
    <td colspan="4">
    
<?php
echo "<table width='100%' border='1'>
<tr>
	<th>Sr. No</th><th>Fee Head</th><th>Paid</th>
</tr>
";
$i=0; //$data=array();
foreach($data as $key=>$val){
	$fess=explode("-",$key);
	//if($fess[0]=="fee" && $val!=0)
	{
		$i++;
		$feeData=$fess[1]; 
		$data[$feeData]=$val;
		?>
		<tr style="text-align: center;">
			<td><?php echo $i; ?></td><td><?php 
			if($key=="Bus_Fees")echo "Conveyance Fee"; 
			elseif($key=="bus")echo "Transport Fee";
			elseif($key=="tution")echo "Tuition Fee";
			elseif($key=="tution_fees")echo "Tuition Fee";
			elseif($key=="bus")echo "Transport Fee";
			elseif($key=="hostel")echo "Hostel Fee";
			else echo $key; ?></td><td><?php echo $val; ?></td>
		</tr>
		<?php
	}
}
$aryList=$db->getRows("SELECT * FROM extra_Recepit where school_id='".$_SESSION["admin"]["school_id"]."' and  session='".$_SESSION["admin"]["session"]."'");
if(is_array($aryList) && count($aryList)>0){
	foreach($aryList as $aList){$i++
		?><tr>
            <td><?php  echo $i;?></td><td><?php echo $aList["name"] ?></td><td>0</td>
        </tr><?php		
	}
}
echo "<tr><th></th><th>Total Paid Amount</th><th>".$_REQUEST["amount"]."</th></tr>";
if(isset($_REQUEST["total"])){
	
}
echo "</table><hr/><div class='footerPrint'><span>Signature...............................</span></div>";//.$isAlreadyEntry;

?>
	</td></tr>
</table>-->
<br/>
<span style="color:red;text-align:center;font-size:14px;"><?php echo "[" ?>Note : If any correction,Please consult to fee counter.<?php echo "]" ?></span>
</div>
</div>
</form>

<script>
function checkreceptNo(id){
	$.post( "<?php echo URL_ROOT ?>Enquiry/ajax.php", { 
			type: "checkreceptNo_enquiry" ,
			paytype: '<?php echo $_REQUEST["type"] ?>',
			id: id
		} , function( data ) {
			//alert(data);return false;
		data=data.trim();
		if(data==""){
			$("#saveprintme").click();
		}
		else{
			alert("receipt id already exit");
		}
	});
}

function change_pm()
{
	var v= $('#status').val(); 
	$('#pm').text(v);
	$('#pm1').text(v);
}

function update(){

    var mode = $("#status").val();
    var txnid = $("#txnidtext").val();
    var bankname = $("#banknametext").val();
    var tdate = $("#tdatetext").val();

    $.post( "<?php echo URL_ROOT ?>print/ajax.php", {
			type: "updatereceiptEnquiry",
			rid: "<?php echo $rid; ?>",
			idno: "<?php echo $_GET['idno'] ?>",
			mode: mode,
			txnid: txnid,
			bankname: bankname,
			tdate: tdate
		} , function( data ) {
            // alert(data);
            location.reload();
	});    

}


</script>