<?php
session_start();
// ============
include("../../asset/theme/css/myfunc.php");
include("../../php_crud/my_class.php");
$obj = new my_class();
$base_url= $_SESSION["BASE_URL"];
$bs_url = $base_url.'/module/admission/download.php';
$branch_id = isset($_SESSION['LOGIN_BRANCH']) ? $_SESSION['LOGIN_BRANCH'] : '';

if ($branch_id != '') {
    $brans_obj = $obj->View_branch_details_By_Cond($branch_id);
    $inst_name = $brans_obj->insName;
    $ins_code_name = $brans_obj->insCodeName;
    $extablishd_year = $brans_obj->_establish_year;
    $ins_logo = $brans_obj->_logo_location;
    $ins_address = $brans_obj->_address;
    $inst_thanta = $brans_obj->thana_name;
    $ins_district = $brans_obj->distrinc_name;
    $ins_division = $brans_obj->division_name;
    $ins_web = $brans_obj->_web_address != '' ? $brans_obj->_web_address : '';
    $ins_email = $brans_obj->_email_add != '' ? '|| ' . $brans_obj->_email_add : '';
}

$admission_form_id = isset($_GET['form_number'])? $_GET['form_number']:'';
$class_name = isset($_GET['class_name'])? $_GET['class_name']:'';

// $session = '2016';
$table_name = '_students_admission_form';
$column = '*';


// $condition = 'branch_id=' . $branch_id . ' AND admission_form_id ="' . $admission_form_id.'" AND _approve_status="P"' ;

if($admission_form_id){
		$condition = 'admission_form_id ="' . $admission_form_id.'" AND _approve_status="P"' ;
		$brans_obj = $obj->View_column_details_By_Cond($table_name, $column, $condition);
}	
else if($class_name!=""){
	$condition = '_class ="'. $class_name.'" AND _approve_status="P"' ;
		$brans_obj = $obj->View_column_details_By_Cond($table_name, $column, $condition);
}

$count = $obj->num_of_rows($table_name, $condition);
 

?>
<style>
    .margin-Auto{ margin:0px auto;}
    .admit-card{ border: }
    .admit-body{}
</style>
<div class="page-content">
	
    
    
    <div class="page-header position-relative">
        <h1>
            Admit Card
            <input type="hidden" value="<?php echo  $branch_id?>" id="branch_id" />
            <input type="hidden" value="<?php echo  $admission_form_id?>" id="admission_form_id" />
            <input type="hidden" value="<?php // echo $session; ?>" id="session" />
          <?php if($admission_form_id && $count->num>0 ){ ?>    
            <button id="print-button" type="button" class="btn btn-warning" data-loading-text="Printing..." style="float:right" onclick="print_admit_card_mpdf(<?php echo $admission_form_id;?>)">
            	 <i class="icon-print bigger-160"></i>
                Print
             </button>
          <?php } ?>   
        </h1>

    </div>
    
<?php if($admission_form_id && $count->num>0){ ?>    
    <div class="row-fluid" style="margin:0px auto;" >
        <div class="span9 admit-card" style="border:1px solid #E3E3E3; float:none; margin:0px auto;min-height:300px; overflow: hidden;" >
            <div class="span12 admit-header" style="margin-bottom: 15px;">
                <img src="<?php echo $ins_logo ?>" style="top: 0px;width: 97px;height: 94px;float: left;margin-left: 30px;margin-top: 22px;" title="logo" alt="" id="image" />
                <h1 style="font-size: 25px;text-align: center;line-height: 29px;margin-bottom: 3px; margin-top: 20px;;"><b> <?php echo $inst_name; ?> </b>
<?php if ($ins_code_name) echo ' (' . $ins_code_name . ')'; ?>
                </h1>
                <h5 style="text-align:center;font-size:14px;margin-top:6px"><?php echo $ins_address; ?>,&nbsp<?php echo $inst_thanta; ?>,&nbsp<?php echo $ins_district ?>,&nbsp<?php echo $ins_division; ?> </h5>
                <h5 style="text-align:center;font-size:12px;line-height: 5px;"><?php echo $ins_web ?>  <?php echo $ins_email; ?> </h5>
            </div>

            <div class="span12 admit-body" style="margin-left:0px; width: 100%;">
                <div class="hr hr8 hr-double"></div>
                <div class="body-content" style="width:100%">
                    <div class="span12" style="width: 100%;">
                        <h3 style="text-align:center; margin-top:0px; text-decoration:underline" > Admission Card For Admission Test </h3>
                        <div class="body-left" style="float:left;width:65%; margin-left:5px">
                            <p>
                                <strong><span style="float: left; width: 165px;">Application No </span><span class="separator">:&nbsp;</span> </strong> <?php echo $admission_form_id; ?>
                            </p>
                            <p>
                                <strong><span style="float: left; width: 165px;">Name </span><span class="separator">:&nbsp;</span> </strong>  <?php echo $brans_obj['_candidate_name']; ?>
                            </p>
                            <p>
                                <strong><span style="float: left; width: 165px;">Date Of Birth </span><span class="separator">:&nbsp;</span> </strong>  <?php echo $brans_obj['_date_of_birth']; ?>
                            </p>
                            <p>
                                <strong><span style="float: left; width: 165px;">Class </span><span class="separator">: &nbsp;</span> </strong>   
								<?php $details_id=$brans_obj['_class'];
									  $table_name="_student_admission_details b LEFT JOIN _int_institute_setup c ON b._class_id=c._id";
									  $column="b._class_id,c._name,b._id";
									  $where_cond="b._id=".$details_id;
									  $child_list=$obj->View_all_data_row_column_By_Cond($table_name,$column,$where_cond);
									  $class_name1 = "";
									  foreach($child_list AS $index2=>$child){
										$class_name1 = $child['_name'];
									  }
									  echo $class_name1;//echo $brans_obj['_class'];
								?>
                            </p>
<?php if ($brans_obj['_department']) { 
		$dept_id = $brans_obj['_department'];
		$table_name="_int_institute_setup";
		$column="_name";
		$where_cond="_id='".$dept_id."'";
		$child_list=$obj->View_all_data_row_column_By_Cond($table_name,$column,$where_cond);
		$dept_name1="";
		foreach($child_list AS $index2=>$child){
			$dept_name1 = $child['_name'];
		}
?>     
        <p>
		<strong><span style="float: left; width: 165px;">Department </span><span class="separator">: &nbsp;</span> </strong>
		<?php echo $dept_name1; //echo $brans_obj['_department']; ?>
        </p>
        <?php } ?>
                            <p>
                                <strong><span style="float: left; width: 165px;">Exam Date and Time</span> 
                                    <span class="separator">:&nbsp;</span> </strong>  
                            </p>
                            <p>
                                <strong><span style="float: left; width: 165px;">Exam Center </span><span class="separator">:&nbsp;</span> </strong>  
								<?php echo $inst_name; //echo $brans_obj['_department']; ?>
							</p>
                           
                        </div>
                        <div class="body-right" style="float:left; width:34%"> 
                            <img src=" <?php echo $brans_obj['_std_photo']; ?>" width="150" height="150" />
                        </div>
                    </div>
                </div>

            </div>

            <div class="span12 admit-footer" style="margin-left:0px">
                <div class="hr hr8 hr-double"></div>
                <h3 style="text-align:center; margin-top:0px; text-decoration:underline" > General Instruction For Admissions </h3>
                <ol style="">
                    <li>Applicants Must Keep this admid card with them at the time of examination and should preserve it for future requirents. They have to bring ball point pen, pencil and eraser. </li>
                    <li>Calculator will not be allowed at examingation hall. </li>
                    <li>Mobile Phone or any other communicative device is strictly prohibited at examination hall. </li>
                    <li>Candidate will have to report at the examination hall 30 minuts before the examinaion start. </li>
                </ol>
            </div>
        </div>

    </div>
    
<?php }else{
	  echo '<h1 style="color: #4C8FBD;">Form Number is not available</h1>';
	
	} ?>    
</div>



<script>
function print_admit_card_mpdf(form_id){
	var dataStr="admission_form_id="+form_id;
	window.open('module/admission/admit_card_mpdf.php?'+dataStr);
}
/*$('#print-button').on(ace.click_event, function () {	 
	var dataStr="admission_form_id="+admission_form_id;
	//window.open('module/admission/admit_card_mpdf.php?'+datastr);
});*/
</script>
