Current File : /home/inlingua/public_html/dwarka/icentex/pg/ingl_invoice_main.select.php |
<?php
// Created on: 13-04-2013
session_start();
/*
$loggedUserNo = $_SESSION['loggedUserNo'];
if ($loggedUserNo == "")
{ echo "Please <a href='index.php'>login</a> first.";
exit(0);
}
*/
// Include header
include "header_in.php";
?>
<aside class="contentbox-head"> <span class="title">View Fees (<span class="status-row"><a style="color:white;" href="ingl_invoice_main.main.php" title='Add entry'>Add New Fees</a></span>
)</span>
</aside>
<div id="contentnew">
<form method="post" >
<table>
<tr>
<td>
Name:<input name="search_name" list="Name" placeholder="Name" value="<?php echo $_REQUEST['search_name'] ?>"><datalist id="Name" name="Name"></datalist>
Reference No:<input list="RefNo" name="ref_No" placeholder="Reference No" value="<?php echo $_REQUEST['ref_No'] ?>" style="width:100px;"><datalist id="RefNo" name="RefNo"></datalist>
Mobile:<input list="Mobile" placeholder="Mobile" name="mobile" style="width:100px;" value="<?php echo $_REQUEST['mobile'] ?>"><datalist id="Mobile" name="mobile"></datalist><br/>
Reg Id:
<input list="Invoice_No" placeholder="Reg. Id" name="course_id" width="100px;" value="<?php echo $_REQUEST['invoice_no'] ?>"><datalist id="Invoice_No" name="Invoice_No"></datalist>
<input type="submit" name="submit" value="Search">
</td>
</tr>
</table>
</form>
<?php if ($_SESSION['dispMesg'][1] != "" && (date("U") - $_SESSION['dispMesg'][0] < 7))
{ ?>
<span id='mesgSpan'><font color='#da0000'><?php echo $_SESSION['dispMesg'][1];?></font></span>
<script>
setTimeout(function() { $('#mesgSpan').fadeOut('slow'); }, 4000); // <-- time in milliseconds
</script>
<br>
<?php
}
unset($_SESSION['dispMesg']);
?>
<link media="screen" rel="stylesheet" href="../attendance/colorbox.css" />
<script src="../attendance/js/jquery.colorbox.js"></script>
<script>
function lightb()
{
$(document).ready(function(){
$(".lightbox").colorbox({width:"50%", height:"70%", iframe:true,onClosed:function(){ window.parent.location.reload(); }});
});
}
</script>
<?php
// Include the database connection details
require('../dbConnection.php');
// Include common functions
require('../commonFunc.php');
// Include common functions
require('../globalVars.php');
// Include the table handler class
require('../dbHandler.class.php');
// Init and connect to database
$dbObject = new dbHandler();
$dbObject->connect();
// Records selection sql
/*
$sqlQuery = "SELECT a.*,c.ref_No,c.mobile,( select course_id from ingl_invoice_detail d where a.recNo=d.main_id limit 1 ) as course_id,dt.amount as dtamt,dt.category_id as catrgoary FROM ingl_invoice_main a left join timesheet_location b on
a.centre=b.recNo inner join ingl_admission c on a.student_id=c.ref_No INNER JOIN ingl_invoice_detail dt ON a.invoice_no = dt.invoice_no
GROUP BY `recNo`,b.location,a.student_name,c.ref_No,c.mobile having 1=1 && b.location='".$_SESSION['branch']."' ";
*/
//echo '<pre>'; print_r($_SESSION);
$sqlQuery = "SELECT * FROM ingl_invoice_main where 1=1 && centre='".$_SESSION['branch_id']."' ";
if($_REQUEST['search_name']!="")
{
$sqlQuery.=" && student_name like '%".$_REQUEST['search_name']."%'";
}
if($_REQUEST['ref_No']!="")
{
$sqlQuery.=" && student_id like '%".$_REQUEST['ref_No']."%'";
}
if($_REQUEST['mobile']!="")
{
$queryS="select * from ingl_admission where mobile='".$_REQUEST['mobile']."' order by recNo desc limit 0,1";
$resultS=mysqli_query($conn,$queryS);
$numS=mysqli_fetch_array($resultS);
$sqlQuery.=" && student_id like '%".$numS['ref_No']."%'";
}
if($_REQUEST['course_id']!="")
{
$sqlQuery.=" && course_id = '".$_REQUEST['course_id']."'";
}
$sqlQuery.=" order by recNo desc";
//echo "$sqlQuery";
// Prepare page navigation
$resultsPerPage = 20; // number of rows to return per page
// Prepare add on URL
$addOnUrl = "&ref_No=".$_REQUEST['ref_No']."&mobile=".$_REQUEST['mobile']."&search_name=".$_REQUEST['search_name']."&course_id=".$_REQUEST['course_id']."";
$offset=$_REQUEST['offset'];
//echo $sqlQuery;
if ($resultsPerPage > 0)
{ $prev_next_links = $dbObject->prev123Next($sqlQuery, $resultsPerPage,$addOnUrl);
$sqlQuery .= " limit " . $offset . "," . $resultsPerPage ;
}
//echo $sqlQuery; exit;
// Print navigation bar
function printArray($element) {
echo "$element";
}
/*
if ($resultsPerPage > 0 && $prev_next_links && count($prev_next_links) > 1)
{ echo "Page: ";
array_walk($prev_next_links, 'printArray');
}
*/
// Select records from table
$selectedRecords = $dbObject->Select($sqlQuery);
?>
<table border='0' class='pa-nor pa-table listing-table' width="100%">
<tr valign='top' class='rowH'>
<th>ID</th>
<th>Entry No.</th>
<th>Name</th>
<th>Reg Id</th>
<th>Ref. No.</th>
<th>Mobile</th>
<th align="right">Amount</th>
<th>Status</th>
<th>Action</th>
</tr>
<?php
// If no records selected, print message
if (!$selectedRecords)
{ ?>
<tr><td colspan='5'>There are no entries</td></tr>
<?php
}
$i=1;
while($objectData=$dbObject->SelectNext())
{
$queryU="select course_id,amount as dtamt,category_id as catrgoary from ingl_invoice_detail where main_id='".$objectData['recNo']."' limit 1";
$resultU=mysqli_query($conn,$queryU);
$data=mysqli_fetch_assoc($resultU);
$dtamt=$data['dtamt'];
$catrgoary=$data['catrgoary'];
$course_id=$data['course_id'];
$querym="SELECT mobile FROM ingl_admission where ref_No='".$objectData['student_id']."' ";
$resultm=mysqli_query($conn,$querym);
$datam=mysqli_fetch_assoc($resultm);
$mobile=$datam['mobile'];
if($objectData['status_delete']=="1")
{
$stat="Cancelled";
$can_color="#DB704D";
}
else if($objectData['status_delete']=="2")
{
$stat="Refunded";
$can_color="#CCCC00";
}
else{
$stat="";
$can_color="";
}
?>
<tr valign='top' onmouseover="this.className='pa-row-highlight'" onmouseout="this.className='pa-nor'">
<td><?php echo $i;?></td>
<td>
<?php echo $objectData['invoice_no'];?>
<br>
</td>
<td><?php echo $objectData['student_name'];?></td>
<td><?php echo $course_id;?></td>
<td><?php echo $objectData['student_id'];?> </td>
<td><?php echo $mobile;?> </td>
<td align='right'><?php echo $dtamt;?></td>
<td style="background-color:<?php echo $can_color; ?>"><?php echo $stat;?></td>
<td>
<?php if($_SESSION['id']==$objectData['createdBy'])
{
if($objectData['type']=='M' ) {
?>
<span class="icon22"><a href='ingl_material_main.main.php?aC=sM&kV=<?php echo $objectData['recNo'] ;?>' title='Modify entry'></a> |</span>
<?php
}
else
{ if($objectData['type']=='I'){ ?>
<span class="icon22"><a href='ingl_invoice_main.main.php?aC=sM&kV=<?php echo $objectData['recNo'] ;?>' title='Modify entry'></a> |</span>
<?php
} if($objectData['type']=='M'){ ?>
<span class="icon22"><a href='ingl_material_main.main.php?aC=sM&kV=<?php echo $objectData['recNo'] ;?>' title='Modify entry'></a> |</span>
<?php }
}
}
if($objectData['type']=='M'){
?>
<a href='ingl_material_main.main.php?aC=sV&kV=<?php echo $objectData['recNo'] ;?>' title='View entry'><img src='images/view.png' border='0' hspace='2'></a> <?php
}
else
{?>
<a href='ingl_invoice_main.main.php?aC=sV&kV=<?php echo $objectData['recNo'] ;?>' title='View entry'><img src='images/view.png' border='0' hspace='2'></a>
<?php }
if($_SESSION['id']==$objectData['createdBy'])
{
?>
| <a style="display:none" onclick='return confDel();' href='ingl_invoice_main.main.php?aC=Delete&kV=<?php echo $objectData['recNo'] ;?>' title='Cancel entry'><img src='images/delete.png' border='0' hspace='2'></a>
<?php
if($i=="1" && ($offset==0 || $offset=="") && !isset($_REQUEST['submit']) ){
?><span class="icon22">
| <a onclick='return confDel();' href='ingl_invoice_main.main.php?aC=Delete&kV=<?php echo $objectData['recNo'] ;?>' title='Delete entry' class="del" ></a></span>
<?php
}
}
if($objectData['status_delete']!="2")
{
?>
<br>
<a href="refund.php?kV=<?php echo $objectData['recNo'] ;?>" class='lightbox' onclick='lightb();'>Refund</a>
<?php
}
?>
</td>
</tr>
<?php
$i++;
}
?>
</table>
<?php
// Print navigation bar
if ($resultsPerPage > 0 && $prev_next_links && count($prev_next_links) > 1)
{ echo "Page: ";
array_walk($prev_next_links, 'printArray');
echo "<br>";
}
?>
</div>
<script type="text/javascript">
function confDel()
{ var agree = confirm("Click OK to Cancel/Delete");
if (agree)
return true;
else
return false;
}
</script>
<?php
$dbObject->CloseConnection();
// Include footer
include "footer_in.php";
?>