| Current Path : /var/www/html/mmishra/iws8/html/ilight/ |
| Current File : /var/www/html/mmishra/iws8/html/ilight/elreceipt.inc.bak |
<h3>Licensee Receipt</h3>
<?php
$tbl = "el_billing";
$month = previous_month();//date("M-Y");
$id = $_REQUEST["id"];
$ext = $_REQUEST["ext"];
$mailing = $_REQUEST["mailing"];
echo "<table width='100%'>
<tr><td width='25%'>
</td><th>
Select licensee <select name='id'>
<option value=''></option>";
$rs = mysql_query("select * from $tbl where month='$month' order by flatno");
while ($o = mysql_fetch_object($rs)) {
echo "<option value='$o->id'";
if ($o->id == $id) echo " selected";
echo ">$o->flatno ($o->licensee)</option>";
}
echo "</select> <input type='submit' name='submit' value='OK'>
</th><td width='25%' align='right'>
<font size='+1'>[ </font>
<a href='?pg=$pg&month=$month'>Refresh</a>
<font size='+1'> ] </font>
<input type='hidden' name='ext' value='$ext'>
</td></tr>
</table>";
$rs = mysql_query("select * from el_config");
if (mysql_num_rows($rs)) {
$o = mysql_fetch_object($rs);
$unitrate = $o->unitrate;
$subsidymode = $o->subsidymode;
$receipt = $o->receipt;
$receiptto = $o->receiptto;
$summary = $o->summary;
$summaryto = $o->summaryto;
$bill = $o->bill;
$billto = $o->billto;
}
if ($id) {
$rs = mysql_query("select * from $tbl where id=$id");
} else {
$rs = mysql_query("select * from $tbl where month='$month' order by id");
}
while ($o = mysql_fetch_object($rs)) {
$i++;
$id = $o->id;
$flatno = $o->flatno;
$licensee = $o->licensee;
$mainfees = $o->mainfees;
$category = $o->category;
$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;
//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;
}
$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 with mainfees
$payable = $payable + $mainfees;
//summarized figures
$tunit += $consumedunit;
$tcharge += $consumedcharge;
$tamount += $totalamount;
$tsubsidy += $subsidy;
$tpayable += $payable;
$data = "<tr>
<td align='center'>$meterno</td>
<td align='center'>$contactedload</td>
<td align='center'>$prevreading</td>
<td align='center'>$curreading</td>
<td align='center'>".number_format($consumedunit,2)."</td>
<td align='center'>Rs.".number_format($consumedcharge,2)."</td>
<td align='center'>Rs.".number_format($mainfees,2)."</td>";
if ($external == 'Yes') {
$data .= "<td align='center'>".number_format($fixedcharge,2)."</td>
<td align='center'>".number_format(round($subtotal),2)."</td>
<td align='center'>".number_format($plcharge,2)."</td>
<td align='center'>".number_format($edcharge,2)."</td>
<td align='center'>".number_format($rscharge,2)."</td>
<td align='center'>Rs.".number_format($totalamount,2)."</td>";
} else {
$data .= "<td align='center'>".number_format($subsidy,2)."</td>
<td align='center'>".number_format($excessunit,2)."</td>";
}
$data .= "<td align='center'>Rs.".number_format($payable,2)."</td></tr>";
$mailbody = "<div align='right'>Ref.No.: IIIT-A/iLight-$id/$month<br>Date: ".date("d/m/Y")."</div><b>
To-<dir>
$fullname<br>
$flatno, IIITA Campus<br>
Devghat, Jhalwa, Allahabad-211012
</dir></b>
<table width='100%' border='1' style='border-collapse: collapse'>
<thead>";
if ($ext == 1) {
$mailbody .= "
<tr><th colspan='14'>Electricity bill for the month of $month<br>
(Unit rate: Rs. $unitrate/unit, Fixed rate: $fixedrate/KVA/month, P.Load rate: $plrate/KVA/month, ED rate: $edrate%, Reg. Surcharge: $rscrate%)</th></tr>
<tr>
<th rowspan='2'>MeterNo</th>
<th rowspan='2'>Contacted<br>Load</th>
<th colspan='2'>KWH Meter Reading</th>
<th colspan='2'>Consumption</th>
<th colspan='7'>Connection Charges</th>
<th rowspan='2'>Payable<br>Amount</th></tr>
<tr><th>Previous</th><th>Current</th><th>Units</th><th>Charges</th>
<th>UserFees</th><th>Fixed</th><th>SubTotal</th><th>PLC</th><th>ED</th><th>Sur</th><th>Total</th>
</tr>
</thead>
<tfoot>
<tr><th colspan='5'>Total</th>
<th>".number_format($tunit,2)."</th>
<th>Rs.".number_format(round($tcharge),2)."</th>
<td colspan='5'></td><th nowrap>Rs.".number_format($tamount,2)."</th>
<th>Rs.".number_format($tpayable,2)."</th></tr>
<tr><th colspan='14'>Above readings have been taken on the last dates of this and previous month.</th></tr>
</tfoot>
<tbody>$data</tbody>
</table><br>
<p>$bill</p>";
} else {
$mailbody .= "
<tr><th colspan='8'>Electricity charge for the month of $month</th></tr>
<tr><th rowspan='2'>MeterNo</th><th colspan='3'>Readings & Consumption</th>
<th colspan='4' width='50%'>Connection Charges (@ Rs. $unitrate/unit, admissibility and maintenance fees as per category)</th></tr>
<tr><th>Previous</th><th>Current</th><th>Units</th><th>Amount</th><th>Admissibility</th><th>UserFees</th><th>Payable</th></tr>
</thead>
<tfoot>
<tr><th colspan='8'>Above readings have been taken on the last dates of this 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'>".number_format($consumedunit,2)."</td><td align='center' nowrap>Rs.".number_format($consumedcharge,2)."</td>
<td align='center' nowrap>".($subsidymode == 'Rupees' ? 'Rs.' : '').number_format($subsidy,2).
($subsidymode == 'Units' ? ' units': '')."</td>
<td align='center' nowrap>Rs.".number_format($userfees,2)."</td>
<td align='center' nowrap>Rs.".number_format($payable,2)."</td></tr>
</tbody>
</table><br>
<p>$receipt</p>";
}
$str .= "<hr>($i) $mailbody";
$tunit = 0; $tcharge = 0; $tamount = 0; $tsubsidy = 0; $tpayable = 0;
}
echo $str;
?>