Coursesubject PHP
Coursesubject PHP
Coursesubject PHP
php
if (isset($_POST['btnCartSubmit'])) {
# code...
$query = "SELECT * FROM tblstudent s, course c WHERE s.COURSE_ID=c.COURSE_ID
AND IDNO=".$_SESSION['IDNO'];
$result = mysqli_query($mydb->conn,$query) or
die(mysqli_error($mydb->conn));
$row = mysqli_fetch_assoc($result);
// echo $totunits['Unit'];
// units to be taken
$totunit =0;
$query = "SELECT *
FROM `subject` s, `course` c WHERE s.COURSE_ID=c.COURSE_ID
AND COURSE_NAME='".$row['COURSE_NAME']."' AND
COURSE_LEVEL=".$row['YEARLEVEL']."
AND SEMESTER ='".$_SESSION['SEMESTER']."' AND
NOT FIND_IN_SET( `PRE_REQUISITE` , (
SELECT GROUP_CONCAT(SUBJ_CODE SEPARATOR ',') FROM
tblstudent s,grades g,subject sub
WHERE s.IDNO=g.IDNO AND g.SUBJ_ID=sub.SUBJ_ID AND AVE
<=74.5
AND s.IDNO =" .$_SESSION['IDNO'].")
)";
$mydb->setQuery($query);
$cur = $mydb->loadResultList();
foreach ($cur as $result) {
$totunit += $result->UNIT ;
}
if (isset( $_SESSION['gvCart'])){
$count_cart = count($_SESSION['gvCart']);
// if (isset($_POST['regsubmit'])) {
// $_SESSION['STUDID'] = $_POST['IDNO'];
// $_SESSION['FNAME'] = $_POST['FNAME'];
// $_SESSION['LNAME'] = $_POST['LNAME'];
// $_SESSION['MI'] = $_POST['MI'];
// $_SESSION['PADDRESS'] = $_POST['PADDRESS'];
// $_SESSION['SEX'] = $_POST['optionsRadios'];
// $_SESSION['BIRTHDATE'] = date_format(date_create($_POST['BIRTHDATE']),'Y-m-
d');
// $_SESSION['NATIONALITY'] = $_POST['NATIONALITY'];
// $_SESSION['BIRTHPLACE'] = $_POST['BIRTHPLACE'];
// $_SESSION['RELIGION'] = $_POST['RELIGION'];
// $_SESSION['CONTACT'] = $_POST['CONTACT'];
// $_SESSION['CIVILSTATUS'] = $_POST['CIVILSTATUS'];
// $_SESSION['GUARDIAN'] = $_POST['GUARDIAN'];
// $_SESSION['GCONTACT'] = $_POST['GCONTACT'];
// $_SESSION['COURSEID'] = $_POST['COURSE'];
// // $_SESSION['SEMESTER'] = $_POST['SEMESTER'];
// $_SESSION['USER_NAME'] = $_POST['USER_NAME'];
// $_SESSION['PASS'] = $_POST['PASS'];
// if ($res) {
// # code...
// message("Student already exist.", "error");
// redirect(web_root."index.php?q=enrol");
// }else{
// if($userStud){
// message("Username is already taken.", "error");
// redirect(web_root."index.php?q=enrol");
// }else{
// if($_SESSION['COURSEID']=='Select' || $_SESSION['SEMESTER']=='Select' ){
// message("Select course and semester exactly" , "error");
// redirect("index.php?q=enrol");
// }else{
// $age =
date_diff(date_create($_SESSION['BIRTHDATE']),date_create('today'))->y;
// }else{
// # code...
// $student = New Student();
// $student->IDNO = $_SESSION['STUDID'];
// $student->FNAME = $_SESSION['FNAME'];
// $student->LNAME = $_SESSION['LNAME'];
// $student->MNAME = $_SESSION['MI'];
// $student->SEX = $_SESSION['SEX'];
// $student->BDAY = $_SESSION['BIRTHDATE'];
// $student->BPLACE = $_SESSION['BIRTHPLACE'];
// $student->STATUS = $_SESSION['CIVILSTATUS'];
// $student->NATIONALITY = $_SESSION['NATIONALITY'];
// $student->RELIGION = $_SESSION['RELIGION'];
// $student->CONTACT_NO = $_SESSION['CONTACT'];
// $student->HOME_ADD = $_SESSION['PADDRESS'];
// $student->ACC_USERNAME = $_SESSION['USER_NAME'];
// $student->ACC_PASSWORD = sha1($_SESSION['PASS']);
// $student->COURSE_ID = $_SESSION['COURSEID'];
// $student->SEMESTER = $_SESSION['SEMESTER'];
// $student->student_status ='New';
// $student->YEARLEVEL = 1;
// $student->NewEnrollees = 1;
// $student->create();
// @$_SESSION['IDNO'] = $_SESSION['STUDID'];
// }
// // redirect("index.php?q=profile");
// }
// }
// }
// }
?>
<form action="index.php?q=payment" method="POST">
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- Main content -->
<?php //check_message(); ?>
<section class="invoice">
<!-- title row -->
<div class="row">
<div class="col-xs-12">
<h3 class="page-header">
<i class="fa fa-user"></i> Student Information
<small class="pull-right">Date: <?php echo date('m/d/Y'); ?></small>
</h3>
</div>
<!-- /.col -->
</div>
<!-- info row -->
<div class="row invoice-info">
<div class="col-sm-8 invoice-col">
<address>
<b>Name : <?php echo $_SESSION['LNAME']. ', ' .$_SESSION['FNAME'] .'
' .$_SESSION['MI'];?></b><br>
Address : <?php echo $_SESSION['PADDRESS'];?><br>
Contact No.: <?php echo $_SESSION['CONTACT'];?><br>
</address>
</div>
if (isset($_SESSION['STUDID'])) {
# code...
$_SESSION['COURSELEVEL'] = $singlecourse->COURSE_LEVEL ;
}elseif(isset($_SESSION['IDNO'])){
$stud = New Student();
$singleStud = $stud->single_student($_SESSION['IDNO']);
$_SESSION['COURSELEVEL'] = $singleStud->YEARLEVEL ;
}
echo $_SESSION['COURSE_YEAR'] = $singlecourse->COURSE_NAME.'-'.
$_SESSION['COURSELEVEL'];
?></b><br>
<b>Semester : <?php echo $_SESSION['SEMESTER']; ?></b> <br/>
<b>Academic Year : <?php echo $_SESSION['SY']; ?></b>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
<div class="row">
<div class="col-xs-12">
<h3 class="page-header">
<i class="fa fa-book"></i> List of Subjects
<!-- <small class="pull-right">Date: 2/10/2014</small> -->
</h3>
</div>
<!-- /.col -->
</div>
if ($row['student_status']=='Irregular') {
# code...
$totunit = 0;
$query = "SELECT *
FROM `subject` s, `course` c WHERE s.COURSE_ID=c.COURSE_ID
AND COURSE_NAME='".$row['COURSE_NAME']."' AND
COURSE_LEVEL=".$row['YEARLEVEL']."
AND SEMESTER ='".$_SESSION['SEMESTER']."' AND
NOT FIND_IN_SET( `PRE_REQUISITE` , (
SELECT GROUP_CONCAT(SUBJ_CODE SEPARATOR ',') FROM
tblstudent s,grades g,subject sub
WHERE s.IDNO=g.IDNO AND g.SUBJ_ID=sub.SUBJ_ID AND AVE
<=74.5
AND s.IDNO =" .$_SESSION['IDNO'].")
)";
$mydb->setQuery($query);
$cur = $mydb->loadResultList();
foreach ($cur as $result) {
echo '<tr>';
// echo '<td width="5%" align="center"></td>';
echo '<td>' . $result->SUBJ_ID.'</a></td>';
echo '<td>'. $result->SUBJ_CODE.'</td>';
echo '<td>'. $result->SUBJ_DESCRIPTION.'</td>';
echo '<td>' . $result->UNIT.'</a></td>';
echo '</tr>';
$totunit += $result->UNIT ;
}
if (isset($_SESSION['gvCart'])){
$count_cart = count($_SESSION['gvCart']);
echo '<tr>';
// echo '<td width="5%" align="center"></td>';
echo '<td>' . $result->SUBJ_ID.'</a></td>';
echo '<td>'. $result->SUBJ_CODE.'</td>';
echo '<td>'. $result->SUBJ_DESCRIPTION.'</td>';
echo '<td>' . $result->UNIT.'</a></td>';
echo '</tr>';
$totunit += $result->UNIT;
}
}
}
}else{
$totunit = '';
$mydb->setQuery("SELECT * FROM `subject` s, `course` c
WHERE s.COURSE_ID=c.COURSE_ID AND CONCAT(`COURSE_NAME` , '-',
`COURSE_LEVEL` ) ='".$_SESSION['COURSE_YEAR']."' AND SEMESTER='".
$_SESSION['SEMESTER']."'");
$cur = $mydb->loadResultList();
$totunit += $result->UNIT;
}
}
?>
<tr>
<td colspan="3" align="right" >Total Units</td>
<td><?php echo $totunit;?></td>
</tr>
</tbody>
</table>
<div class="row">
<!-- accepted payments column -->
<div class="col-xs-6">
<p class="lead">Tuition:</p>
<p class="lead">
<?php
$subtot = '';
$perunit = 209;
$entrancefee = 5693;
$totsem = 0;
$_SESSION['SUBTOT'] = $subtot;
$_SESSION['ENTRANCEFEE'] = $entrancefee;
$_SESSION['TOTSEM'] = $totsem;
$_SESSION['TOTUNIT'] = $totunit;
?>
</p>
<br/>
<br/>
<div class="table-responsive">
<table class="table">
<tr>
<th style="width:50%">Tuition Fees:</th>
<td> ₱ <?php echo $subtot; ?></td>
</tr>
<tr>
<th>Miscellaneous Fee</th>
<td> ₱ <?php echo $entrancefee ; ?></td>
</tr>
<!-- <tr>
<th>Shipping:</th>
<td>$5.80</td>
</tr> -->
<tr>
<th>Total Semester:</th>
<td> ₱ <?php echo $totsem; ?>
<input type="hidden" id="totsem" name="totsem" value="<?php echo
$totsem; ?>">
</td>
</tr>
<?php
$student = New Student();
$result = $student->single_student($_SESSION['IDNO']);
if ($result->student_status=='Regular' || $result-
>student_status=='Irregular') {
?>
<tr>
<th>Partial Payment:</th>
<td><input type="text" id="PartialPayment" autocompete="false"
name="PartialPayment" required="true"></td>
</tr>
<tr>
<th>Balance:</th>
<td> ₱ <span id="Balance">0.00</span>
<input type="hidden" id="txtBalance" name="txtBalance" value="">
</td>
</tr>
<?php
}
?>
</table>
</div>
</div>
<!-- /.col -->
</div>
<!-- /.row -->
?>
<form method="post"
action="https://www.sandbox.paypal.com/cgi-bin/webscr">
<input type="hidden" value="[email protected]"
name="business">
<!-- Specify a Buy Now button. -->
<input type="hidden" value="_xclick" name="cmd">
<input type="hidden" value="Partial Payments" name="item_name">
<!-- <input type="hidden" value="22.16" name="amount"> -->
<input type="hidden" id="partial" value="1600" name="amount">
<!-- <input type="hidden" name="currency_code" value="USD"> -->
<input type="hidden" name="currency_code" value="PHP">
<!-- <input type="hidden" value="item_number" name="item_number"> -->
<input type="hidden" name="return" value="http://localhost<?php echo
web_root ?>index.php?q=payment">
<input type="hidden" name="cancel_return" value="http://localhost<?php
echo web_root ?>index.php">
<!-- Display the payment button. -->
<input type="image" name="submit" id="btnpay" border="0"
src="img/BTNPAYNOW.png" alt="PayPal - The safer, easier way to pay online">
<img alt="" border="0" width="1" height="1"
src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
</form>
<?php
}
?>
</div>
</div>
</section>
<!-- /.content -->
<div class="clearfix"></div>
</div>
<!--
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"
target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="48ZBBK2C2CGSE">
<input type="image"
src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0"
name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif"
width="1" height="1">
</form> -->