Your IP : 216.73.216.40


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

<h3>Meter Reading</h3>
<center>
<b>Electrician Name:</b> ___________________ <b>Month-Year:</b> _______________ <b>Dated:</b> _________________
<table width='100%' border='1' style='border-collapse: collapse'>
<tr><th rowspan='2'>No</th><th rowspan='2'>SiteNo</th><th rowspan='2'>Licensee</th><th rowspan='2'>MeterNo</th>
<th colspan='2'>Readings</th></tr><tr><th>Previous</th><th width='200'>Current</th></tr>

<?php
$tbl = "el_reading";

	$rs = mysql_query("select *,
    	least(
      	case when locate('0', flatno)>0 then locate('0', flatno) else length(flatno)+1 end,
      	case when locate('1', flatno)>0 then locate('1', flatno) else length(flatno)+1 end,
      	case when locate('2', flatno)>0 then locate('2', flatno) else length(flatno)+1 end,
      	case when locate('3', flatno)>0 then locate('3', flatno) else length(flatno)+1 end,
      	case when locate('4', flatno)>0 then locate('4', flatno) else length(flatno)+1 end,
      	case when locate('5', flatno)>0 then locate('5', flatno) else length(flatno)+1 end,
      	case when locate('6', flatno)>0 then locate('6', flatno) else length(flatno)+1 end,
      	case when locate('7', flatno)>0 then locate('7', flatno) else length(flatno)+1 end,
      	case when locate('8', flatno)>0 then locate('8', flatno) else length(flatno)+1 end,
      	case when locate('9', flatno)>0 then locate('9', flatno) else length(flatno)+1 end) pos
  	from el_flats order by left(flatno, pos-1), mid(flatno, pos, length(flatno)-pos+1)+0");


	while ($o = mysql_fetch_object($rs)) {
		$i++;
		$flatno = $o->flatno;
		$meterno = $o->meterno;
		$prevreading = $o->reading;
		//get category of licensee
		$sr = mysql_query("select * from el_licensee where flatno='$flatno'");
		if (mysql_num_rows($sr)) {
			$q = mysql_fetch_object($sr);
			$fullname = $q->fullname;
			$category = $q->category;
			$external = $q->external;
			$sharing = $q->sharing;
		} else {
			$fullname = 'VACANT';
			$category = 'None';
			$external = '--';
			$sharing = 'No';
		}	
		//get previous reading
		$sr = mysql_query("select * from el_reading where flatno='$flatno' order by id desc limit 0,1");
		if (mysql_num_rows($sr)) {
			$q = mysql_fetch_object($sr);
			$prevreading = $q->reading;
		}
		echo "<tr><td>$i</td><td>$flatno <input type='hidden' name='flatno[]' value='$flatno'></td>
		<td>$fullname (".($external == 'Yes' ? 'External' : ($external == 'No' ? 'Internal' : $external)).")</td>
		<td>$meterno</td><td>$prevreading</td>
		<td></td></tr>";
	}

?>

</table>
</center>
<br><br><br>