Current File : /home/inlingua/public_html/sensoriumpsychologists.com/diagnostics/franchise/new_admission.php
<?php 
require_once("../franchise_between/check_franchise.php");
require_once("../franchise_between/user_details_msg_setup.php");
require_once("../franchise_between/accounts_banks_funcs.php");
require_once("../franchise_between/student_funcs.php");
require_once("../franchise_between/validate_functions.php");
include_once('../../classes/mailclass.php');

$accounts_obj=new accounts_funcs();
$admission_fees=$accounts_obj->get_admission_fees();
$student_obj=new student_funcs();

/*$balance=0;
$e_wallet_obj=new e_wallet();
$e_wallet_obj->set_value("franchise_id",$session_id);
$balance=$e_wallet_obj->e_wallet_balance();
?>
<?php
if($balance<$admission_fees)
{
	echo("Error : Insufficient funds...Please add more funds...!!!");
	exit();
}*/

if(!empty($_POST)){
	//echo "<pre>";
	//print_r($_REQUEST);
	//die;
	
	$school = explode('@@', $_POST['school_name']);
$arr = explode('/', $_REQUEST['dob']);
$dateOfBirth = $arr[2].'-'.$arr[1].'-'.$arr[0];
//echo $dateOfBirth = date("Y-m-d", strtotime($_REQUEST['dob']));
$today = date("Y-m-d");
$diff = date_diff(date_create($dateOfBirth), date_create($today));
	
	$password=hash('sha256', $_POST['ppasscode']);
	$child_name=$_POST['child_name'];
	$email=$_POST['email'];
	$age=$diff->format('%y');
	$gender=$_POST['gender'];
	$dob_day=$arr[0];
	$dob_month=$arr[1];
	$dob_year=$arr[2];
	$education=$_POST['education'];
	$school_name=$school[0];
	$contact_no=$_POST['contact_no'];
	$informant=$_POST['informant'];
	$c_local=$_POST['c_local'];
	$c_city=$_POST['c_city'];
	$c_district=$_POST['c_district'];
	$c_state=$_POST['c_state'];
	$c_pincode=$_POST['c_pincode'];
	$p_local=$_POST['p_local'];
	$p_city=$_POST['p_city'];
	$p_district=$_POST['p_district'];
	$p_state=$_POST['p_state'];
	$p_pincode=$_POST['p_pincode'];
	$problem=$_POST['problem'];
	$walking=$_POST['walking'];
	$first_sentence=$_POST['first_sentence'];
	$toilet_behaviour=$_POST['toilet_behaviour'];
	$self_help=$_POST['self_help'];
	$sleeping_pattern=$_POST['sleeping_pattern'];
	$play=$_POST['play'];
	$play_group=$_POST['play_group'];
	$type_of_play=$_POST['type_of_play'];
	$behav_with_family=$_POST['behav_with_family'];
	$reln_with_siblings=$_POST['reln_with_siblings'];
	$franchise_id=$session_id;
	

	
	$p_city=trim($p_city);
	$total_chars=strlen($p_city);
	
	if($total_chars<3){
		echo("Error : Permanent City must be atleast 3 characters long...");
		exit();
	}
	
	$student_obj->set_value("franchise_id",$franchise_id);
	$student_obj->set_value("child_name",$child_name);
	$student_obj->set_value("email",$email);
	$student_obj->set_value("age",$age);
	$student_obj->set_value("gender",$gender);
	$student_obj->set_value("dob_date",$dob_date);
	$student_obj->set_value("education",$education);
	$student_obj->set_value("school_name",$school_name);
	$student_obj->set_value("contact_no",$contact_no);
	$student_obj->set_value("informant",$informant);
	$student_obj->set_value("c_local",$c_local);
	$student_obj->set_value("c_city",$c_city);
	$student_obj->set_value("c_district",$c_district);
	$student_obj->set_value("c_state",$c_state);
	$student_obj->set_value("c_pincode",$c_pincode);
	$student_obj->set_value("p_local",$p_local);
	$student_obj->set_value("p_city",$p_city);
	$student_obj->set_value("p_district",$p_district);
	$student_obj->set_value("p_state",$p_state);
	$student_obj->set_value("p_pincode",$p_pincode);
	$student_obj->set_value("problem",$problem);
	$student_obj->set_value("walking",$walking);
	$student_obj->set_value("first_sentence",$first_sentence);
	$student_obj->set_value("toilet_behaviour",$toilet_behaviour);
	$student_obj->set_value("self_help",$self_help);
	$student_obj->set_value("sleeping_pattern",$sleeping_pattern);
	$student_obj->set_value("play",$play);
	$student_obj->set_value("play_group",$play_group);
	$student_obj->set_value("type_of_play",$type_of_play);
	$student_obj->set_value("behav_with_family",$behav_with_family);
	$student_obj->set_value("reln_with_siblings",$reln_with_siblings);
	$student_obj->set_value("admission_fees",$admission_fees);
	$student_obj->set_value("password",$password);
	
	$payment_no=$student_obj->new_admission();
	if($payment_no>0)
	{
	$to=$email;
	user_register_mail_diagnostics($to,$child_name,$email,$_POST['ppasscode']);
	}
	$msg="Saved successfully...";
	
	$temp_filename="student_initial_fees_payment.php?payment_no=".$payment_no;
	header("Location:redirect_back.php?q=".$temp_filename."&msg=".$msg);
}
?>
<!doctype html>
<html>
<?php include("common/page_head.php");?>
<script src="javascript/numberkey.js"></script>

<body>
<?php include("common/header_var.php");
$top_enrollment=$top_val;
include("common/header.php");

?>
<link rel="stylesheet" href="css/jquery-ui.css">
  <script src="jquery/jquery.js"></script>
  <script src="css/jquery-ui.js"></script>
  <link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/custom.css" />
<div id="main_container">
<div id="main">
<br />
<br />
<div class="top_heading_page">NEW ADMISSION</div>
<br>
<br>
     
<div class="sc_contact_form sc_contact_form_contact contact-form" style="border:1px solid #c3c3cc; padding:25px;">
<form  class="validate123 comment-form --contact" name="myForm" id="newadmission" method="POST">
          			<?php 
			$today = date("ymd");
			$rand = strtoupper(substr(uniqid(sha1(time())),0,4));
			$unique1 = $today . $rand;
			
			$pass=rand(1000,1000000);
			?>
			 <input type="hidden" name="registration_no" value="<?php echo "SU".$unique1;?>" >
			 <input type="hidden" name="ppasscode" value="<?php echo $pass;?>" >
           
 <div class="row" id="next-1"> 
 <div class="col-lg-12"><h3>PERSONAL DETAILS</h3></div>
<div class="col-lg-4">
<label class="required" for="f_name">Student's Name</label>
<input id="child_name" type="text" name="child_name" placeholder="Student Name">
</div>


 
 <div class="col-lg-4">
<label class="required" for="f_name">Email</label>
<input id="email" type="text" name="email" placeholder="Email" onblur="return check_username();">
<div id="Info" style="color:red;font-size:16px;"></div>
<span id="Loading" style="display: none;"><img src="../../css/loader.gif" alt=""></span>
</div>

 <div class="col-lg-4">
<label class="required" for="f_name">Contact No</label>
<input id="contact_no" type="text" name="contact_no" placeholder="Contact No">
</div>
 
<div class="col-lg-4">
<label class="required" for="f_name">Date Of Birth</label>
<input id="dob" type="text" name="dob" placeholder="Date Of Birth" autocomplete="off">
</div>

<div class="col-lg-4">
<label class="required" for="f_name">Gender</label>
<select name="gender" id="gender">
              <option value="">---Gender---</option>
              <option>Male</option>
              <option>Female</option>
            </select>
</div>
<div class="col-lg-4">
<label class="required" for="f_name">Education</label>
<select name="education" id="education">
              <option value="">---std---</option>
              <option value="1">1st</option>
              <option value="2">2nd</option>
              <option value="3">3rd</option>
              <option value="4">4th</option>
              <option value="5">5th</option>
             
            </select>
</div>



<div class="col-lg-4">
<label class="required" for="school_name">School Name</label>

<select class="form-control" name="school_name" id="school_name">
<option value="">---School Name---</option>
        <?php  
		$conditions="where type='franchise' and status='active'";
		$columns_array=array("table_id","name");
		$table_name="shristi_login";
		$student_obj->view_all_school($table_name,$columns_array,$conditions,$to_select=$session_id); 
		?>
</select>		
</div>

<div class="col-lg-4">
<label class="required" for="f_name">Informant</label>
<input type="text" id="informant"  name="informant" placeholder="informant">
</div>
 
   
</div> 
 
			          
 <div class="row" id="next-2" style="display:none;"> 
 <div class="col-lg-12">
 <h3>ADDRESS</h3>
 </div>
<div class="col-lg-6">
CORRESPONDANCE ADDRESS&nbsp;&nbsp;<span style="color:#F00;font-weight:bold;font-size:1.4em;">*</span>
<div class="col-lg-12">
<label class="required" for="c_local">Local Address</label>
<textarea placeholder="Local Address" name="c_local" style="margin-bottom: 10px;" id="c_local" rows="3"></textarea>
</div>

<div class="col-lg-12">
<label class="required" for="c_city">City</label>
<input type="text" placeholder="City" name="c_city" id="c_city"  />
</div>
<div class="col-lg-12">
<label class="required" for="c_district">District</label>
<input type="text" placeholder=" District" name="c_district" id="c_district" />
</div>
<div class="col-lg-12">
<select class="textboxes" name="c_state" id="c_state">
                <option value="">--- Select ---</option>
                <?php  $student_obj->view_all_states(); ?> 
              </select>
</div>			  

<div class="col-lg-12">
<label class="required" for="c_pincode">Pincode</label>
<input type="text" placeholder=" Pincode" name="c_pincode" id="c_pincode" onkeypress="return isNumberKey(event)" maxlength="6"  class="textboxes" />
</div>

</div> 

<div class="col-lg-6">
<div class="col-lg-12">PERMANENT ADDRESS&nbsp;&nbsp;<span style="color:#F00;font-weight:bold;font-size:1.4em;">*</span>
<input type="button" value="Copy Correspondance Address" onClick="copy_addr()" ></div>
<div class="col-lg-12">
<label class="required" for="p_local">Permanent Address</label>
<textarea placeholder="Permanent Address" name="p_local" style="margin-bottom: 10px;" id="p_local" rows="3"></textarea>
</div>

<div class="col-lg-12">
<label class="required" for="p_city">City</label>
<input type="text" placeholder="City" name="p_city" id="p_city"  />
</div>
<div class="col-lg-12">
<label class="required" for="p_district">District</label>
<input type="text" placeholder=" District" name="p_district" id="p_district" />
</div>
<div class="col-lg-12">
<select class="textboxes" name="p_state" id="p_state">
                <option value="">--- Select ---</option>
                 <?php  $student_obj->view_all_states(); ?>  
              </select>
</div>			  

<div class="col-lg-12">
<label class="required" for="p_pincode">Pincode</label>
<input type="text" placeholder=" Pincode" name="p_pincode" id="p_pincode" onkeypress="return isNumberKey(event)" maxlength="6"  class="textboxes" />
</div>





</div> 
 

</div> 
 
  <div class="row" id="next-3" style="display:none;"> 
 <div class="col-lg-12">
 <h3>PROBLEMS & BEHAVIOURS</h3>
 </div> 
 
 
 
 <div class="col-lg-12">
<label class="required" for="problem">PRESENTING PROBLEMS OF THE CHILD</label>
<textarea name="problem" id="problem" rows="2"></textarea>
</div>

<div class="col-lg-12"><h5>POSTNATAL DEVELOPMENT :</h5></div> 


<div class="col-lg-6">
<label class="required" for="walking">Walking</label>
<select name="walking" id="walking">
                <option value="">---</option>
                <option value="10-11 months">10-11 months</option>
                <option value="12-13 months">12-13 months</option>
                <option value="14-16 months" >14-16 months</option>
                <option value="17-20 months">17-20 months</option>
              </select>
</div>
 
 <div class="col-lg-6">
<label class="required" for="first_sentence">First Sentence</label>
<select name="first_sentence" id="first_sentence">
                <option value="">---</option>
                <option value="10-12 months">10-12 months</option>
                <option value="12-13 months">12-13 months</option>
                <option value="13-15 months">13-15 months</option>
                <option value="16-24 months">16-24 months</option>
                <option value="not yet">not yet</option>
              </select>
</div>
 
  <div class="col-lg-12">
 <h5>CHILD'S BEHAVIOUR : </h5>
 
 </div>
 <div class="col-lg-4">
<label class="required" for="toilet_behaviour">Toilet Behaviour</label>
<select name="toilet_behaviour" id="toilet_behaviour">
                <option value="">---</option>
                <option value="Dependent" >Dependent</option>
                <option value="Independent">Independent</option>
              </select>
</div>
 <div class="col-lg-4">
<label class="required" for="self_help">Self help skills (bathing, eating, dressing, communication skills)</label>
<select name="self_help" id="self_help">
                <option value="">---</option>
                <option value="Dependent" >Dependent</option>
                <option value="Independent">Independent</option>
              </select>
</div>
 
 <div class="col-lg-4">
<label class="required" for="sleeping_pattern">Sleeping Pattern</label>
<select name="sleeping_pattern" id="sleeping_pattern">
                <option value="">---</option>
                <option value="Normal" >Normal</option>
                <option value="Disturbed" >Disturbed</option>
              </select>
</div>
 
 
 <div class="col-lg-4">
<label class="required" for="play">Play (during free time)</label>
<select name="play" id="play" >
                <option value="">---</option>
                <option value="yes" >Yes</option>
                <option value="no" >No</option>
              </select>
</div>
 
<div class="col-lg-4">
<label class="required" for="play_group">Play Group</label>
<select name="play_group" id="play_group">
                <option value="">---</option>
                <option value="yes" >Yes</option>
                <option value="no" >No</option>
              </select>
</div> 
 
<div class="col-lg-4">
<label class="required" for="type_of_play">Type of play</label>
<select name="type_of_play" id="type_of_play">
                <option value="">---</option>
                <option value="Indoor games" >Indoor games</option>
                <option value="outdoor games" >outdoor games</option>
                <option value="indoor as well as outdoor" >indoor as well as outdoor</option>
                <option value="All Type" >All Type</option>
              </select>
</div>  
 
 <div class="col-lg-4">
<label class="required" for="behav_with_family">Behaviour with family</label>
<select name="behav_with_family" id="behav_with_family">
                <option value="">---</option>
                <option value="normal" >Normal</option>
                <option value="good" >Good</option>
                <option value="normal but some times aggresive" >normal but some times aggresive</option>
                <option value="sads" >Sads</option>
                <option value="poor" >Poor</option>
              </select>
</div>
 
<div class="col-lg-4">
<label class="required" for="reln_with_siblings">Relationship with siblings</label>
<select name="reln_with_siblings" id="reln_with_siblings">
                <option value="">---</option>
                <option value="normal and emotionally attached" >Normal and Emotionally attached</option>
                <option value="moderate rivalry" >Moderate Rivalry</option>
                <option value="severely affected and emotionally detached" >Severely affected and emotionally detached</option>
                
              </select>
</div>  
 
 </div>
 
 <div id="submit-1" >


	
	<div class="col-md-12" style="overflow: hidden; margin-top:20px;">
		<div class="sc_contact_form_button3">
            <div class="site-btn" value="Save & Next >>" onClick="submit_form();">
				Save & Next >>
			</div>
		</div>
    </div>
	
	
	</div>
      <!--<input type="submit" name="sumnit" value="Save Now"  />--></td>
  

<div id="submit-2" style="display:none;">


  
  <div class="col-md-12" style="overflow: hidden; margin-top:20px;">
		<div class="sc_contact_form_button3">
            <div class="site-btn" value="Save & Next >>" onClick="submit_form_next();">
				Save & Next >>
			</div>
		</div>
    </div>
  

</div>
<div id="submit-3" style="display:none;">


	
<div class="col-md-12" style="overflow: hidden; margin-top:20px;">
		<div class="sc_contact_form_button3">
            <div class="site-btn" value="Save" onClick="submit_form_save();">
				Save 
			</div>
		</div>
    </div>	
	
	</div>
						
						</form>						 
                    </div>
   
</div>

</div>
<br>
<br>

    <script language="javascript">
        $(document).ready(function () {
            $("#dob").datepicker({
                changeMonth: true,
                 changeYear: true,
				  dateFormat: "dd/mm/yy",
				 yearRange: "-90:+00"
            });
        });
  
function submit_form()
{
	if($("#child_name").val()=="")
	{
		alert("Error : Please enter child's name...");
		$("#child_name").focus();
		return false;
	}
	if($("#email").val()=="")
	{
		alert("Error : Please enter Email...");
		$("#email").focus();
		return false;
	}
	if($("#age").val()=="")
	{
		alert("Error : Please select child's age...");
		$("#age").focus();
		return false;
	}
	if($("#gender").val()=="")
	{
		alert("Error : Please select gender");
		$("#gender").focus();
		return false;
	}
	if($("#dob_day").val()=="")
	{
		alert("Error : Please select Day in D.O.B");
		$("#dob_day").focus();
		return false;
	}
	if($("#dob_month").val()=="")
	{
		alert("Error : Please select Month in D.O.B");
		$("#dob_month").focus();
		return false;
	}
	if($("#dob_year").val()=="")
	{
		alert("Error : Please select Year in D.O.B");
		$("#dob_year").focus();
		return false;
	}
	if($("#education").val()=="")
	{
		alert("Error : Please select Education");
		$("#education").focus();
		return false;
	}
	if($("#school_name").val()=="")
	{
		alert("Error : Please enter school name");
		$("#school_name").focus();
		return false;
	}
	if($("#contact_no").val()=="")
	{
		alert("Error : Please select contact no");
		$("#contact_no").focus();
		return false;
	}
	if($("#informant").val()=="")
	{
		alert("Error : Please select informant");
		$("#informant").focus();
		return false;
	}
	
	

	else
	{
		
	$("#next-2").show();
    $("#next-1").hide();	
	$("#submit-1").hide();	
	$("#submit-2").show();	
	//return false;	
	}	
		
}	
	
function submit_form_next()
{	
	
	if($("#c_local").val()=="")
	{
		alert("Error : Please enter local address in 'Correspondance Address'");
		$("#c_local").focus();
		return false;
	}
	if($("#c_city").val()=="")
	{
		alert("Error : Please enter city in 'Correspondance Address'");
		$("#c_city").focus();
		return false;
	}
	if($("#c_district").val()=="")
	{
		alert("Error : Please enter district in 'Correspondance Address'");
		$("#c_district").focus();
		return false;
	}
	if($("#c_state").val()=="")
	{
		alert("Error : Please select state in 'Correspondance Address'");
		$("#c_state").focus();
		return false;
	}
	if($("#c_pincode").val()=="")
	{
		alert("Error : Please enter pincode in 'Correspondance Address'");
		$("#c_pincode").focus();
		return false;
	}
	if($("#p_local").val()=="")
	{
		alert("Error : Please enter local address in 'Permanent Address'");
		$("#p_local").focus();
		return false;
	}
	if($("#p_city").val()=="")
	{
		alert("Error : Please enter city in 'Permanent Address'");
		$("#p_city").focus();
		return false;
	}
	var p_city=$("#p_city").val();
	if(p_city.length<3)
	{
		alert("Error : City in 'Permanent Address' must be 3 characters long");
		$("#p_city").focus();
		return false;
	}
	if($("#p_district").val()=="")
	{
		alert("Error : Please enter district in 'Permanent Address'");
		$("#p_district").focus();
		return false;
	}
	if($("#p_state").val()=="")
	{
		alert("Error : Please select state in 'Permanent Address'");
		$("#p_state").focus();
		return false;
	}
	if($("#p_pincode").val()=="")
	{
		alert("Error : Please enter pincode in 'Permanent Address'");
		$("#p_pincode").focus();
		return false;
	}else {
		$("#next-3").show();	
	$("#next-2").hide();
	$("#submit-2").hide();	
	$("#submit-3").show();	
		
	}	
	
}

function submit_form_save()
{	
	if($("#problem").val()=="")
	{
		alert("Error : Please enter 'PRESENTING PROBLEM OF THE CHILD'");
		$("#problem").focus();
		return false;
	}
	if($("#walking").val()=="")
	{
		alert("Error : Please select walking");
		$("#walking").focus();
		return false;
	}
	if($("#first_sentence").val()=="")
	{
		alert("Error : Please select first sentence");
		$("#first_sentence").focus();
		return false;
	}
	if($("#toilet_behaviour").val()=="")
	{
		alert("Error : Please select 'Toilet Behaviour'");
		$("#toilet_behaviour").focus();
		return false;
	}
	if($("#self_help").val()=="")
	{
		alert("Error : Please select 'Self help skills'");
		$("#self_help").focus();
		return false;
	}
	if($("#sleeping_pattern").val()=="")
	{
		alert("Error : Please select 'Sleeping Pattern'");
		$("#sleeping_pattern").focus();
		return false;
	}
	if($("#play").val()=="")
	{
		alert("Error : Please enter 'Play (during free time)'");
		$("#play").focus();
		return false;
	}
	if($("#play_group").val()=="")
	{
		alert("Error : Please enter 'Play Group'");
		$("#play_group").focus();
		return false;
	}
	if($("#type_of_play").val()=="")
	{
		alert("Error : Please enter 'Type of Play'");
		$("#type_of_play").focus();
		return false;
	}
	if($("#behav_with_family").val()=="")
	{
		alert("Error : Please enter 'Behaviour with Family'");
		$("#behav_with_family").focus();
		return false;
	}
	if($("#reln_with_siblings").val()=="")
	{
		alert("Error : Please enter 'Relationaship with Siblings'");
		$("#reln_with_siblings").focus();
		return false;
	}
	var ans=confirm("Are you sure you want to continue?");
	if(ans==true)
	{
		document.getElementById('newadmission').submit();
	}
	else
	{
		return false;
	}
}
function copy_addr()
{
	$("#p_local").val($("#c_local").val());
	$("#p_city").val($("#c_city").val());
	$("#p_district").val($("#c_district").val());
	$("#p_state").val($("#c_state").val());
	$("#p_pincode").val($("#c_pincode").val());
}

function check_username(){
	var username = $("#email").val();
	if(username.length > 2){
		$('#Loading').show();
		$.post("https://www.sensoriumpsychologists.com/lib/ajaxclass.php", {
			username: $('#email').val(),
		}, function(response){
			$('#Info').show();
			 $('#Loading').hide();
			$('#Info').html(response);
			
		});
		return false;
	}
}
</script>
</body>

</html>