Current File : /home/inlingua/www/noida/icentex_noida/pg-2APR/individual_payment_report.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">Individual Payment Report (<span class="status-row"><a href="<?php echo "reports/individualReport.xlsx" ?>" target="_blank">Download Excel Report</a></span>)</span>
</aside><hr/>
<div id="contentnew">
<form method="post" >
<table>
<tr>
Reference No: <input type="text" name="ref_No" value="<?php echo $_REQUEST['ref_No'] ?>"> Mobile: <input type="text" name="mobile" value="<?php echo $_REQUEST['mobile'] ?>" style="width:100px;"> Entry No: <input type="text" name="invoice_no" value="<?php echo $_REQUEST['invoice_no'] ?>" style="width:100px;"> <input type="submit" name="submit" value="Search"></td>
</tr>
</table>
</form>
<?php
if(trim($_REQUEST['ref_No'])!="" || trim($_REQUEST['mobile'])!="" || trim($_REQUEST['invoice_no'])!=""){
// 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();
// Init and connect to database
$dbObject1 = new dbHandler();
$dbObject1->connect();
$querylocation="select primarycenter from timesheet_user where recNo='".$_SESSION['id']."'";
$resultlocation=mysql_query($querylocation) or die(mysql_error());
$numlocation=mysql_fetch_array($resultlocation);
$queryloc="select * from timesheet_location where status='1' && location='".$_SESSION['branch']."' order by location";
$resultloc=mysql_query($queryloc) or die(mysql_error());
$numloc=mysql_fetch_array($resultloc);
// Records selection sql
$sqlQuery1 = "SELECT a.*,b.location,c.*,c.amount as amt,d.ref_No FROM ingl_invoice_main a left join timesheet_location b on
a.centre=b.recNo left join ingl_invoice_detail c on a.recNo=c.main_id left join ingl_admission d on a.student_id=d.recNo where 1=1 ";
if($_REQUEST['ref_No']!="")
{
$sqlQuery1.=" && d.ref_No like '%".$_REQUEST['ref_No']."'";
}
if($_REQUEST['mobile']!="")
{
$sqlQuery1.=" && d.mobile='".$_REQUEST['mobile']."'";
}
if($_REQUEST['invoice_no']!="")
{
$sqlQuery1.=" && invoice_no='".$_REQUEST['invoice_no']."'";
}
$sqlQuery1.=" && location='".$numloc['location']."'";
$sqlGroup=$sqlQuery1;
$sqlGroup.=" group by invoice_no order by b.location,a.createDate desc";
$sqlQuery1.=" order by b.location,a.createDate desc";
//echo $sqlQuery1;
// Select records from table
$selectedRecords1 = $dbObject1->Select($sqlQuery1);
?>
Invoices:
<table border='0' class='pa-nor pa-table listing-table' width="100%">
<tr valign='top' class='rowH'>
<th>ID</th>
<th>Centre</th>
<th>Entry No.</th>
<th>Date</th>
<th>Ref. No.</th>
<th>Name</th>
<th>Category</th>
<th>Product</th>
<th>Registration ID</th>
<th align="right">Amount</th>
</tr>
<?php
$i=1;
$prodcat= new dbHandler();
$prodcat->connect();
$query_prodcat="select recNo,bill_category from ingl_billing_cat order by bill_category";
$result_prodcat=$prodcat->select($query_prodcat);
$prodcat_array=array();
while($data_prodcat=$prodcat->SelectNext($result_prodcat)){
$prodcat_array[''.$data_prodcat[recNo].'']=$data_prodcat['bill_category'];
}
$subprodcat_array=array();
$subprodcat= new dbHandler();
$subprodcat->connect();
$query_subprodcat="select recNo,bill_details from ingl_billing_main";
$result_subprodcat=$subprodcat->select($query_subprodcat);
while($data_subprodcat=$subprodcat->SelectNext($result_subprodcat))
{
$subprodcat_array[''.$data_subprodcat[recNo].'']=$data_subprodcat['bill_details'];
}
$tot=0;
while($objectData1=$dbObject1->SelectNext())
{
?>
<tr valign='top' onmouseover="this.className='pa-row-highlight'" onmouseout="this.className='pa-nor'">
<td><?php echo $i;?></td>
<td><?php echo $objectData1['location'];?></td>
<td>
<?php echo $objectData1['invoice_no'];?>
</td>
<td>
<?php echo date("d-m-Y",strtotime($objectData1['createDate']));?>
</td>
<td><?php echo $objectData1['ref_No'];?></td>
<td><?php echo $objectData1['student_name'];?></td>
<td><?php echo $prodcat_array[$objectData1['category_id']];?></td>
<td><?php echo $subprodcat_array[$objectData1['product_id']];?></td>
<td ><?php echo $objectData1['course_id'];?></td>
<td align='right'><?php echo $objectData1['amt'];?></td>
</tr>
<?php
$i++;
$tot=$tot+$objectData1['amt'];
}
$tot_ini=$tot;
?>
<tr><td colspan="8">Total</td><td align='right'><?php echo $tot?></td></tr>
</table>
<?php
// Records selection sql
$sqlQuery = "SELECT a.*,b.location,c.*,d.ref_No,d.mobile FROM ingl_invoice_main a left join timesheet_location b on
a.centre=b.recNo left join ingl_invoice_payment c on a.recNo=c.invice_no left join ingl_admission d on a.student_id=d.recNo where 1=1 ";
if($_REQUEST['ref_No']!=""){
$sqlQuery.=" && d.ref_No like '%".$_REQUEST['ref_No']."'";
}
if($_REQUEST['mobile']!="")
{
$sqlQuery.=" && d.mobile='".$_REQUEST['mobile']."'";
}
if($_REQUEST['invoice_no']!="")
{
$sqlQuery.=" && invoice_no='".$_REQUEST['invoice_no']."'";
}
$sqlQuery.=" && location='".$numloc['location']."'";
/*
if($_REQUEST['category'][0]!="" && $_REQUEST['category'][0]!="0"){
$sqlQuery.=" && category_id='".$_REQUEST['category'][0]."'";
}
if($_REQUEST['product'][0]!="" && $_REQUEST['product'][0]!="0"){
$sqlQuery.=" && product_id='".$_REQUEST['product'][0]."'";
}
*/
$sqlQuery.=" order by b.location,c.createDate desc";
// Select records from table
$selectedRecords = $dbObject->Select($sqlQuery);
//echo $sqlQuery;
?>
Payments:
<!--<table border='0' class='pa-nor pa-table listing-table' width="100%">
<tr valign='top' class='rowH'>
<th>ID</th>
<th>Centre</th>
<th>Entry No.</th>
<th>Receipt No.</th>
<th>Date</th>
<th>Reference No.</th>
<th>Name</th>
<th align="right">Amount</th>
<th> Payment Mode </th>
<th>Cheque No./<br>Transaction Id</th>
<th>Favour Of/<br>Transaction Details </th>
</tr>
<?php
// If no records selected, print message
if (!$selectedRecords)
{ ?>
<tr><td colspan='5'>There are no entries</td></tr>
<?php
}
$i=1;
$tot=0;
while($objectData=$dbObject->SelectNext())
{
?>
<tr valign='top' onmouseover="this.className='pa-row-highlight'" onmouseout="this.className='pa-nor'">
<td><?php echo $i;?></td>
<td><?php echo $objectData['location'];?></td>
<td>
<?php echo $objectData['invoice_no'];?>
</td>
<td>
<?php echo $objectData['rcpt_id'];?>
</td>
<td>
<?php echo date("d-m-Y",strtotime($objectData['createDate']));?>
</td>
<td>
<?php echo $objectData['ref_No'];?>
</td>
<td><?php echo $objectData['student_name'];?></td>
<td align='right'><?php echo $objectData['amount'];?></td>
<td><?php echo $objectData['payment_mode'];?></td>
<td><?php echo $objectData['cheque_no'];?></td>
<td><?php echo $objectData['favour_of'];?></td>
</tr>
<?php
$i++;
$tot=$tot+$objectData['amount'];
}
?>
<tr><td colspan="7">Total</td><td align='right'><?php echo $tot?></td><td colspan="2"> </td></tr>
<tr style="background-color:#CCCCCC;"><td colspan="7">Balance Left</td><td align='right'><?php echo ($tot_ini-$tot)?></td><td colspan="3"> </td></tr>
</table>-->
<?php
}
?>
</div>
<?php
//include("05featuredemo1_payment.php");
include("rptindividuallpaymentreport.php");
//$dbObject1->CloseConnection();
// Include footer
include "footer_in.php";
?>