Current File : /home/inlingua/www/sensoriumpsychologists.com/screening/franchise/student_initial_fees_payment.php
<?php require_once("../franchise_between/check_franchise.php");
require_once("../franchise_between/user_details_msg_setup.php");
require_once("../franchise_between/validate_functions.php");
require_once("../franchise_between/student_funcs.php");
require_once("../franchise_between/payment_funcs.php");
require_once("../franchise_between/accounts_banks_funcs.php");
require_once("../franchise_between/e_wallet_funcs.php");

$balance=0;
$e_wallet_obj=new e_wallet();
$e_wallet_obj->set_value("franchise_id",$session_id);
$balance=$e_wallet_obj->e_wallet_balance();

$payment_no=$_GET['payment_no'];
$validate_obj=new validate_functions();
$validate_obj->check_isset_empty($payment_no,"Payment No");
$validate_obj->check_is_num($payment_no,"Payment No");

$payment_obj=new payment_funcs();
$payment_obj->set_value("franchise_id",$session_id);
$payment_obj->view_initial_payment_unpaid($payment_no);
$student_id=$payment_obj->get_value("student_id");
$amount=$payment_obj->get_value("amount");
$_SESSION['amount_to_be_paid']=$amount;

$student_obj=new student_funcs();
$student_obj->set_value("franchise_id",$session_id);
$student_obj->view_child_applied($student_id);
$child_name=$student_obj->get_value("child_name");
$email=$student_obj->get_value("email");
$age=$student_obj->get_value("age");
$gender=$student_obj->get_value("gender");
$school_name=$student_obj->get_value("school_name");

$registration_no=$student_obj->get_value("registration_no");
$status=$student_obj->get_value("status");
$dob_date=$student_obj->get_value("dob_date");

//echo"<pre>";
//print_r($_REQUEST);

if(!empty($_POST))
{
	$payment_mode=$_POST['payment_mode'];
	if(($payment_mode!="online")&&($payment_mode!="ewallet")&&($payment_mode!="head_office"))
	{
		echo("Error : Invalid request...");
		exit();
	}
	if($payment_mode=="head_office")
	{
		$payment_obj->pay_student_to_head_office($student_id,$payment_no);
		$msg="Updated successfully...";
		$temp_filename="student_initial_fees_payment_head_office.php?payment_no=".$payment_no;
		unset($_SESSION['amount_to_be_paid']);
		header("Location: /franchise/redirect_back.php?q=".$temp_filename."&msg=".$msg);
	}
	else if($payment_mode=="ewallet"){
		if($balance<$amount)
		{
			echo("Error : E-Wallet balance insufficient...");
			exit();
		}
		$payment_obj->pay_student_to_ewallet($student_id,$payment_no);
		$msg="Updated successfully...";
		$temp_filename="student_initial_fees_payment_ewallet.php?payment_no=".$payment_no;
		unset($_SESSION['amount_to_be_paid']);
		header("Location: /franchise/redirect_back.php?q=".$temp_filename."&msg=".$msg);
	}
	else if($payment_mode=="online"){
		/*if($balance<$amount)
		{
			echo("Error : E-Wallet balance insufficient...");
			exit();
		}
		$payment_obj->pay_student_to_ewallet($student_id,$payment_no);
		$msg="Updated successfully...";
		$temp_filename="student_initial_fees_payment_ewallet.php?payment_no=".$payment_no;
		unset($_SESSION['amount_to_be_paid']);*/
		header("Location: /franchise/online_payment.php?payment_no=".$payment_no);
	}
}
?>
<!doctype html>
<html>
<?php include("common/page_head.php");?>
<body>
<?php include("common/header_var.php");?>
<?php
$top_enrollment=$top_val;
?>
<?php include("common/header.php");?>
<div id="main_container">
  <div id="main">
  <br><br>
    <fieldset>
    <legend>STUDENT SUMMARY</legend>
    <table border="0" class="tables_fieldset" cellpadding="3px" cellspacing="0">
  <?php require_once("common/student_summary_in_page_unregistered.php");?>
    </table>
    </fieldset>
  <br><br>
    <fieldset>
    <legend>PAYMENT SUMMARY</legend>
    <table border="0" class="tables_fieldset" cellpadding="3px" cellspacing="0">
      <tr>
        <td style="font-weight:bold;width:150px;">Payment Type</td>
        <td style="font-weight:bold;width:20px;">:</td>
        <td>Admission Fees</td>
      </tr>
      <tr>
        <td style="font-weight:bold;">Amount to be paid</td>
        <td style="font-weight:bold;">:</td>
        <td><?php echo("Rs. ".$amount."/-");?>&nbsp;</td>
      </tr>
      <tr>
        <td colspan="3"><br>
        <form method="post" name="my_form">
          <select name="payment_mode" id="payment_mode" onChange="payment_proceed()">
            <option value="online">Online (Payment Gateway)</option>
            <option value="ewallet">E-Wallet</option>
            <option value="head_office">Pay to Head Office</option>
          </select>
          &nbsp;&nbsp;
          <div class="button_div" onClick="pay_now()" style="color:#FFF;background-color:#060;cursor:pointer;">PROCEED</div><br><br>
          <div style="position:relative;">
            <table cellpadding="5px" cellspacing="0">
              <tr id="balance_tr" style="display:none;">
                <td
                <?php
				if($balance<$amount)
				{
					echo(" style=\"color:#F00;\"");
				}
				else
				{
					echo(" style=\"color:#090;\"");
				}
				?>
                >E-Wallet Balance : <?php echo("Rs. ".$balance."/-");?></td>
              </tr>
              <?php //require_once("common/payments_only.php");?>
            </table>
          </div>
        </form>
        </td>
      </tr>
    </table>
    </fieldset>
  </div>
</div>
  <br><br><br><br>
<input type="hidden" id="amount_db" value="<?php echo($amount);?>" />
<input type="hidden" id="balance_db" value="<?php echo($balance);?>" />
<script>
function payment_proceed()
{
	var payment_mode=$("#payment_mode").val();
	if(payment_mode=="ewallet"){
		$("#balance_tr").show();
	}else{
		$("#balance_tr").hide();
	}
}

function pay_now(){
	var balance=Number($("#balance_db").val());
	var amount=Number($("#amount_db").val());
	if($("#payment_mode").val()=="ewallet")
	{
		if(balance<amount)
		{
			alert("Error : E-Wallet balance insufficient...");
			return false;
		}
	}
	var ans=confirm("Are you sure you want to continue ?");
	if(ans==true)
	{
		document.my_form.submit();
	}
	else
	{
		return false;
	}
}
</script>
</body>	
</html>