Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/ilight/
Upload File :
Current File : /var/www/html/mmishra/ilight/elsearch.inc

<h3>Consumption By SiteNo</h3>
<center>

<?php
$tbl = "el_billing";
//$month = previous_month();//date("M-Y");
$flatno = $_POST["flatno"];

echo "Site No. <input type='text' name='flatno' value='$flatno' size='10'>
<input type='submit' name='submit' value='OK'>";

if ($flatno) {
	//get consumption data
	$rs = mysql_query("select * from $tbl where flatno='$flatno' order by id");
	while ($o = mysql_fetch_object($rs)) {
		$i++;
		$month = $o->month;
	        $flatno = $o->flatno;
        	$licensee = $o->licensee;
		$userfees = $o->userfees;
        	$meterno = $o->meterno;
        	$contactedload = $o->contactedload;
        	$unitrate = $o->unitrate;
        	$fixedrate = $o->fixedrate;
        	$plrate = $o->plrate;
        	$edrate = $o->edrate;
        	$rscrate = $o->rscrate;
        	$subsidy = $o->subsidy;
        	$external = $o->external;

        	$prevreading = $o->prevreading;
        	$curreading = $o->curreading;

        	$consumedunit = $curreading - $prevreading;
        	$consumedcharge = $consumedunit * $unitrate;

        	if ($external == 'Yes') {
                	$fixedcharge = $contactedload * $fixedrate;
                	$subtotal = $consumedcharge + $fixedcharge;

                	$plcharge = $contactedload * $plrate;
                	$edcharge = $subtotal * $edrate/100;
                	$rscharge = $subtotal * $rscrate/100;

                	$totalamount = $subtotal + $plcharge + $edcharge + $rscharge;

                	$payable = $totalamount;
        	} else {
                	if ($consumedunit > $subsidy) {
                        	$excessunit =  $consumedunit - $subsidy;
                        	$payable = $excessunit * $unitrate;
                	} else {
                        	$excessunit =  0;
                        	$payable = $totalamount;
                	}
        	}
		$payable += $userfees;

		$str .= "<tr><td>$i</td><td>$month</td><td>$licensee</td><td>$meterno</td>
		<td align='right'>$prevreading</td><td align='right'>$curreading</td>
		<td align='right'>".number_format($consumedunit,2)."</td>
		<td align='right'>Rs.".number_format($unitrate,2)."</td>
		<td align='right'>Rs.".number_format($consumedcharge,2)."</td>
		<td align='right'>".number_format($subsidy,2)."</td>
		<td align='right'>Rs.".number_format($payable,2)."</td></tr>";
	}
	if ($str) 
		echo "
		<table width='100%' border='1' style='border-collapse: collapse'>
		<thead>
		<tr><th colspan='11'><h3>Electricity consumption and charges of Site No. $flatno</h3></th></tr>
		<tr><th rowspan='2'>No</th><th rowspan='2'>Month</th><th rowspan='2'>Licensee</th><th rowspan='2'>MeterNo</th>
		<th colspan='3'>Readings & Consumption</th><th colspan='4'>Consumption Charges</th></tr>
		<tr><th>Previous</th><th>Current</th><th>Units</th><th>@ Rate</th><th>Amount</th><th>Admissibility</th>
		<th>Payable</th></tr>
		</thead>
		<tfoot>
		<tr><th colspan='11'>Above readings have been taken on the last date of every month.</th></tr>
		</tfoot>
		<tbody> $str </tbody>
		</table>";
	else
		echo "<i><b>Error:</b>
		<dir>Records for FlatNo $flatno does not exist in database. Pl. contact office.</dir>
		</i>";
}

?>
</center>