
PK 
<?php
ob_start();
//error_reporting(E_ALL ^ E_NOTICE);
@session_start();
ini_set('allow_url_include',1);
date_default_timezone_set("Asia/Kolkata");
set_time_limit(600);
ini_set('max_execution_time',600);
require_once '../includes/settings/PDODB.php';
include '../includes/modules/functions.php';
$function = new FUNCTIONS();
if(empty($_SESSION['adminId'])){
header("Location: ../index.php");
exit();
}
$pdodb = PDODB::getInstance();
$curdate = date("d-m-Y");
$sql = "SELECT * FROM `tn_student` WHERE `isActive`=1";
//print_r($sql); exit;
$Studentdata = $pdodb->query($sql);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>INSPINIA | Basic Form</title>
<?php include_once '../layout/style.php'; ?>
</head>
<body>
<div id="wrapper">
<?php $currentPage = 'outstanding-list'; include_once '../layout/side-bar.php'; ?>
<div id="page-wrapper" class="gray-bg">
<?php include_once '../layout/header.php'; ?>
<div class="row wrapper border-bottom white-bg page-heading">
<div class="col-lg-8">
<h2>Outstanding Payment List</h2>
</div>
<div class="col-sm-4">
<button class="btn btn-primary btn-md pull-right" onclick="history.go(-1);"><i class="fa fa-arrow-circle-left"></i> BACK </button>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="ibox float-e-margins">
<div class="ibox-content">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover dataTables-example" id="editable">
<thead>
<tr>
<th>S.No</th>
<th>Balance</th>
<th>Student Name</th>
<th>Mobile</th>
<th>Email</th>
<th>Course Name</th>
<th>Course Start Date</th>
<th>Course End Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php for($i=0;$i<count($Studentdata);$i++){
$curdate = date("Y-m-d");
$sql = "SELECT * FROM `tn_order` WHERE `isInstallment`=1 AND `studentId`='".$Studentdata[$i]['id']."' AND `endDate` > '".$curdate."' AND `isActive`=1 ORDER BY `id` DESC LIMIT 1"; //exit;
$order = $pdodb->query($sql);
$account = $function->getAccountDetails($ac_id=NULL,$uid=NULL,$isActive=1,$orderBy='ASC');
if ($order == true) {
$courseid = $order[0]['courseId'];
$studentId = $order[0]['studentId'];
$coursedata = $function->getCourse($id=$courseid,$isActive=1,$orderBy='ASC');
$courseName = $coursedata[0]['courseName'];
//$instlmentamt = 0;
$curdate = date('Y-m-d', strtotime(' +1 day'));
//print_r($curdate); //exit;
$sql = "SELECT * FROM `tn_accounts` WHERE `date` <= '".$curdate."' AND uid ='".$studentId."' ORDER BY `date` ASC"; //exit;
// Assuming $studentId is the student ID you want to filter by
//echo $sql = "SELECT * FROM `tn_accounts` WHERE `tn_accounts`.`date` <= CURDATE() AND `uid` = '".$studentId."' ORDER BY `tn_accounts`.`date` ASC";
$account = $pdodb->query($sql);
//print_r($account); //exit;
$bal = 0; // Initialize balance with installment amount
for($j=0;$j<count($account);$j++){
if ($Studentdata[$i]['id']==$account[$j]['uid']) {
$bal += (int)$account[$j]['debit']-(int)$account[$j]['credit'];
}
}
//if ($bal>1 || $bal <1){
if ($bal>1){
?>
<tr>
<td><?=$i+1;?></td>
<td class="center"><?=$bal;?></td>
<td class="center"><?=$Studentdata[$i]['username'];?></td>
<td class="center"><?=$Studentdata[$i]['mobileno'];?></td>
<td class="center"><?=$Studentdata[$i]['uemail'];?></td>
<td class="center"><?=$courseName;?></td>
<td class="center"><?=date('d-M, Y', strtotime($order[0]['startDate']));?></td>
<td class="center"><?=date('d-M, Y', strtotime($order[0]['endDate']));?></td>
<td class="center">
<a class="btn btn-primary btn-xs" href="pay.php?id=<?=$Studentdata[$i]['id'];?>"> Click to Pay</a>
<a class="btn btn-success btn-xs" target="_blank" href="../student/account-details.php?id=<?=$Studentdata[$i]['id'];?>"><i class="fa fa-calculator"></i> A/c Details</a>
</td>
</tr>
<?php } } } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include_once '../layout/script.php'; ?>
<script type="text/javascript">
$(document).ready(function() {
$('#editable thead th').each(function() {
var title = $(this).text();
if(title == 'Mobile'){
$(this).append('<br /><input type="text" placeholder="Search ' + title + '" />');
}
});
// DataTable
var table = $('#editable').DataTable();
table.columns().every( function () {
var that = this;
var searchTextBox = $('input', this.header() );
searchTextBox.on( 'keyup change', function () {
if ( that.search() !== this.value ) {
that
.search( this.value )
.draw();
}
});
searchTextBox.on('click', function (e){
e.stopPropagation();
})
});
$(".dataTables_filter").hide();
} );
</script>
</body>
</html>


PK 99