Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/mybp1/
Upload File :
Current File : /var/www/html/mmishra/mybp1/elreceipt.inc

<h1>Licensee Receipt</h1>
<?php
$tbl = "el_billing";
$month = previous_month();//date("M-Y");
$id = $_REQUEST["id"];

echo "<b>For individual receipt, select FlatNo</b> <select name='id'>";
//$rs = mysql_query("select * from $tbl where month='$month' and payable>0 and subsidy>0 order by flatno");
$rs = mysql_query("select * from $tbl where payable>0 and subsidy>0 order by flatno");
while ($o = mysql_fetch_object($rs)) {
	echo "<option value='$o->id'";
	if ($o->id == $id) echo " selected";
	echo ">$o->flatno (Rs. $o->amount/$o->payable)</option>";
}
echo "</select> <input type='submit' name='submit' value='OK'>";

$rs = mysql_query("select * from el_config");
if (mysql_num_rows($rs)) {
	$o = mysql_fetch_object($rs);
	$unitrate = $o->unitrate;
	$receipt = $o->receipt;
	$receiptto = $o->receiptto;
	$summary = $o->summary;
	$summaryto = $o->summaryto;
}

if ($id)
	$rs = mysql_query("select * from $tbl where id=$id");
else
	$rs = mysql_query("select * from $tbl where month='$month' and payable>0 and subsidy>0 order by flatno");
while ($o = mysql_fetch_object($rs)) {
	$flatno = $o->flatno;
	$curreading = $o->curreading;
	$prevreading = $o->prevreading;
	$units = $o->units;
	$amount = $o->amount;
	if (!$amount) $amount = 0;
	$subsidy = $o->subsidy;
	if (!$subsidy) $subsidy = 0;
	$payable = $o->payable;
	if (!$payable) $payable = 0;
	//get flat details
	$sr = mysql_query("select * from el_flats where flatno='$flatno'");
	while ($q = mysql_fetch_object($sr)) {
		$flattype = $q->flattype;
		$meterno = $q->meterno;
	}
	//get licensee details
	$sr = mysql_query("select * from el_licensee where flatno='$flatno'");
	while ($q = mysql_fetch_object($sr)) {
		$fullname = $q->fullname;
		$designation = $q->designation;
		$email = $q->email;
		$category = $q->category;
	}

	$str .= "<div align='right'>Ref: IIITA/$id/$month<br>Date: ".date("d/m/Y")."</div><b>
	To-<dir> 
		$fullname<br>
		$flatno, $flattype<br>
		IIITA Campus, Deoghat<br>
		Jhalwa, Allahabad - 211012
	</dir></b></p>
	<table width='100%' border='1' style='border-collapse: collapse'>
	<thead>
	<tr><th colspan='7'>Electricity bill for the month of $month (@ Rs. $unitrate)</th></tr>
	<tr><th rowspan='2'>MeterNo</th><th colspan='3'>Readings & Consumption</th><th colspan='3'>Consumption Charges</th></tr>
	<tr><th>Previous</th><th>Current</th><th>Units</th><th>Amount</th><th>Admissibility</th><th>Payable</th></tr>
	</thead>
	<tfoot>
	<tr><th colspan='7'>Above readings have been taken on last date of $month and previous month.</th></tr>
	</tfoot>
	<tbody>
	<tr><td align='center'>$meterno</td><td align='center'>$prevreading</td><td align='center'>$curreading</td>
	<td align='center'>$units</td><td align='center'>Rs. $amount</td><td align='center'>Rs. $subsidy</td><td align='center'>Rs. $payable</td></tr>
	</tbody>
	</table><br>";
}
echo $str;
echo "<p>$receipt</p>";

?>