Current File : /home/inlingua/public_html/dwarka/icentex/pg/ingl_invoice_payment.select.php |
<?php
// Created on: 10-05-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";
?>
<h3 class='pa-nor-navbar'><a href='index.php'>Home</a> >> <a href='ingl_invoice_payment.select.php'>ingl_Entry_payment</a> (<a href="ingl_invoice_payment.main.php?invice_no=<?php echo $_REQUEST['kV']; ?>" title='Add Receipt'>Add New Receipt</a>)</h3>
<div id="contentnew">
<?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']);
?>
<?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.*,m.bill_details,b.invoice_no,b.student_name,b.final_amount,( select course_id from ingl_invoice_detail d where b.recNo=d.main_id limit 1 ) as course_id FROM ingl_invoice_payment a left join ingl_invoice_main b on a.invice_no=b.recNo INNER JOIN ingl_billing_main m ON a.product_id = m.recNo where 1=1";
$sqlQuery .= " && invice_no='".$_REQUEST['kV']."' ";
// Prepare page navigation
$resultsPerPage = 20; // number of rows to return per page
// Prepare add on URL
$addOnUrl = "";
if ($resultsPerPage > 0)
{ $prev_next_links = $dbObject->prev123Next($sqlQuery, $resultsPerPage,$addOnUrl);
$sqlQuery .= " limit " . $offset . "," . $resultsPerPage ;
}
// 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' width="100%">
<tr valign='top' class='rowH'>
<td>Id</td>
<td>Receipt No</td>
<td>Product</td>
<td>Name</td>
<td>Reg. Id</td>
<td>Amount</td>
<td>Payment Mode</td>
<td>Date</td>
<td>Action</td>
</tr>
<?php
// If no records selected, print message
if (!$selectedRecords)
{ ?>
<tr><td colspan='5'>There are no entries</td></tr>
<?php
}
$i=1;
$received=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><a href='rcpt_pdf.php?recNo=<?php echo $_GET['kV'] ;?>' target='_blank'><?php echo $objectData['rcpt_id'];?></a></td>
<td><?php echo $objectData['bill_details'];?></td>
<td><?php echo $objectData['student_name'];?></td>
<td><?php echo $objectData['course_id'];?></td>
<td><?php echo $objectData['amount'];?></td>
<td><?php echo $objectData['payment_mode'];?></td>
<td><?php echo $objectData['createDate'];?></td>
<td>
<a href='ingl_invoice_payment.main.php?aC=sM&kV=<?php echo $objectData['recNo'] ;?>&invice_no=<?php echo $objectData['invice_no']; ?>' title='Modify entry'><img src='images/edit.png' border='0' hspace='2'></a> |
<a href='ingl_invoice_payment.main.php?aC=sV&kV=<?php echo $objectData['recNo'] ;?>&invice_no=<?php echo $objectData['invice_no']; ?>' title='View entry'><img src='images/view.png' border='0' hspace='2'></a> |
<a onclick='return confDel();' href='ingl_invoice_payment.main.php?aC=Delete&kV=<?php echo $objectData['recNo'] ;?>&invice_no=<?php echo $objectData['invice_no']; ?>' title='Delete entry'><img src='images/delete.png' border='0' hspace='2'></a>
</td>
</tr>
<?php
$i++;
$payment=$objectData['final_amount'];
$received=$received+$objectData['amount'];
}
?>
<tr style="background-color:#cccccc;">
<td align="right" colspan="3">
<?php $Qurey=" SELECT TA.recNo, TA.Product1, TA.Product2, main2.bill_details AS Product3 FROM (
SELECT T.recNo, T.Product1, main1.bill_details AS Product2, T.reg_product3 FROM (
SELECT reg.recNo, main.bill_details AS Product1, reg.reg_product2, reg.reg_product3
FROM ingl_invoice_reg reg INNER JOIN ingl_billing_main main ON reg.reg_product1 = main.recNo )T
INNER JOIN ingl_billing_main main1 ON T.reg_product2 = main1.recNo )TA
INNER JOIN ingl_billing_main main2 ON TA.reg_product3 = main2.recNo where TA.recNo='".$_REQUEST['kV']."' ";
$Result=mysqli_query($conn,$Qurey);
$Row=mysqli_fetch_assoc($Result);
echo $Row['Product1'];
?>
</td>
<td colspan="3" align="right"><b>Total Received</b></td><td><?php echo $received; ?></td><td colspan="3"></td>
</tr>
<tr style="background-color:#cccccc;">
<td align="right" colspan="3"><?php echo $Row['Product2']; ?></td>
<td colspan="3" align="right"><b>To Pay</b></td><td><?php echo $payment; ?></td><td colspan="3"></td>
</tr>
<tr style="background-color:#cccccc;">
<td align="right" colspan="3"><?php echo $Row['Product3'];?></td>
<td colspan="3" align="right"><b>Balance</b></td><td><?php /*echo $payment-$received;*/ echo "0.00"; ?></td><td colspan="3"></td>
</tr>
</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 delete permanently or cancel");
if (agree)
return true;
else
return false;
}
</script>
<?php
$dbObject->CloseConnection();
// Include footer
include "footer_in.php";
?>