
<script>
	function printDiv(divName) {
     var printContents = document.getElementById(divName).innerHTML;
     var originalContents = document.body.innerHTML;

    // document.body.innerHTML = printContents.fontsize(12);
     window.print();

	 if( window.print()) {
         window.location.href = "../user/searchhousebalance";
		alert(" printing...........");
    }else {

	
		      return      window.location.href = "../user/searchhousebalance";

		    // document.body.innerHTML = originalContents;

	}
}


       
		 
  
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid").val(itemid); 
		  
		  
		   
        });
		



		$(document).on("click", "#editbtn", function()
        {
          var mycategoryid = $(this).data('id');
		  $("#mycategoryid").val(mycategoryid); 
		   
		   		   
   var opening = $(this).data('opening');
		   $("#opening2").val(opening);
 
		    var closing = $(this).data('closing');
		   $("#closing").val(closing); 
		var roomid = $(this).data('roomid');
		   $("#roomid").val(roomid); 
		   		var roomchargeid = $(this).data('roomchargeid');
		   $("#roomchargeid").val(roomchargeid); 
        });
		
		




	</script>
   <style type="text/css">
  
  

    #printable { display: none; }

    #myprint { display: none; }
#print{  	


    background-repeat: no-repeat;
	font-size;12px;
  
    


}


#sale{  	
background-image:url(images/add.png) ;

    background-repeat: no-repeat;
  
    width:100px; height:50px;


}
    
    @media print
    {
    	#non-printable { display: none; }
    	#printableArea { display: block; font-size:16; width:100%; }
		    	#myprint { display: block; font-size:16; width:100%; }

    }
    </style>







 <div class="row">

 

   	<div class="col-md-12">

				 
				 	<div class="print-hide" id="non-printable"  >
<form name="print" method="post" action="">
 
 <div class="row">

 

   	<div class="col-md-6">
				 <a class="btn btn-success" href="<?php echo base_url(); ?>admin/viewpallmyplots">	GO BACK</a> ||

										     <a data-toggle='modal' data-target='#viewsms' class="btn btn-primary">View Meter readings reports </a></br>
				 <a class="btn btn-success" href="<?php echo base_url(); ?>admin/viewmeterreadings">	Refresh</a> 

</div> 	 
<a data-toggle='modal' data-target='#openreadingModal' class="btn btn-success">Start Meter Readings </a>
<a data-toggle='modal' data-target='#closereadingModal' class="btn btn-warning">Close Meter Readings </a>

   	<div class="col-md-6">
<input type="submit" id="print"  accesskey="p" class="btn btn-primary"  name="print"onclick="printDiv('printableArea')" value="Print Report!" />
</form></div></div>
							</div> 
     
	 
	 <?php
	 	$session_data = $this->session->userdata('logged_in');

    $data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
 $data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
        
		
			 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
	        		$configuration = $this->usermodel->populateallarray('smsconfig','id',$companyid);
   		
$mydate=date('Y-m-d');
$mytime=date('H:i:s');
		 	 $year = Date('Y') ;
		  $month = Date('m') ; 
		  
		

		  
		  
	 ?>
	 
	 
	 <!--
					 <a class="btn btn-info"href="<?php echo base_url(); ?>admin/confirmreading">Confirm Reading</a><BR>

-->
 <div class="panel panel-primary" data-collapsed="0">
 	<div class="table-responsive">
			<div id="printableArea">
			
			<table width="100%">
           
			
			<tr>
				 	
	<td colspan="2" width="100%">
	<center>
					
										<?php $bussinessname=$configuration[0]['businessname']; if(isset($bussinessname)) {echo   $bussinessname; }?>
		</center>	
		</td>

			</tr>
			<?php if(isset($fromdate)) {
			
				
				
			
			?>
		<tr>
				<td>

				<h4><b>Bookings  between <?php echo $fromdate; ?> AND <?php echo $todate; ?>.</b></h4>	</td>
					<td><h4><b>Printed on <?php echo $date = date("Y-m-d"); ?></b></h4></td>

		</tr>
			
			
				<?php 
				
				}
			
			?>
			
			
			
</table >
			
			
			
			
			

<table  border="1"width="100%">
             <thead>
	<tr>
	<th colspan="11">
	
								<h4><b><center>DETAILED METER READINGS  REPORT</CENTER> </b></h4>	
</th> 
	</tr>
		

         <tr>
		 
		 		   <th>Year </th>
		 		   <th>Month </th>
		 		   <th>Status </th>
		 		   <th>Type </th>

		 
    
   
    
<th>Customer</th> 	
	
	
	 <th>Rm No </th>
	<th> No</th>
		<th>Meter No</th>
		<th>Open</th>
		<th>Closed</th>
		<th>Used</th>

	<th>Rate </th> 
		<th>Standing</br>charge </th> 

		<th>Total </th> 


	 <th>Served By</th> 
	 <th>Edit</th> 
	 <th>Cancel</th> 


                 </tr>
             </thead>
<?php
	
				echo $this->session->flashdata('msg');
				 echo $this->session->flashdata('deletemsg'); 
		if(validation_errors()):
		 endif;
 if(!is_array($readings)) 

 {




    
       echo '<div class="alert alert-warning text-center">There is no booking found by now from system..</div>';
    
    }else {
?>
    
             <?php 
  $totalamount=0;
  $totalpaid=0;
    $actualtotal=0;
    $people=0;
    $discount=0;

    $totalbalance=0;


	  

  	foreach ($readings as $c): 
									// echo$totalpaid= $c->card+$c->amount+$c->mpesa+$c->voucher+$c->cheque;;
		

             ?>


							 
										<?php
					
		
                 echo form_open('admin/updatemeterreading' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>	
							<input type="hidden" name="view" value="admin/viewmeterreadings" class="form-control" required placeholder="Enter view">
							<input type="hidden" name="myid" value="<?php echo set_value('myid',$c->id); ?>" class="form-control" required placeholder="Enter id">

							<input type="hidden" name="branchid" value="<?php echo set_value('branchid',$c->branchid); ?>" class="form-control" required placeholder="Enter branchid">
							<input type="hidden" name="houseno" value="<?php echo set_value('houseno',$c->houseno); ?>" class="form-control" required placeholder="Enter qty available">
							<input type="hidden" name="plotno" value="<?php echo set_value('plotno',$c->plotno); ?>" class="form-control" required placeholder="Enter code">
							
							<input type="hidden" name="closing" value="<?php echo set_value('closing',$c->closing); ?>" class="form-control" required placeholder="Enter closing">
							<input type="hidden" name="roomid" value="" class="form-control" required placeholder="Enter closing">
							<input type="hidden" name="roomchargeid" value="<?php echo set_value('roomchargeid',$c->roomchargeid); ?>" class="form-control" required placeholder="Enter roomchargeid">


             <tr>
                
            <?php 
		$id=$c->id;
	


   $houseno=$c->houseno;
   $plotno=$c->plotno;


		  $mychargetype = $this->usermodel->populatealldataarray('charges','id >', 0,'id', $c->type);
		$TYPE=$mychargetype[0]["type"];
?>
             <td><?php echo $c->year ; ?></td> 

             <td><?php echo $c->month ; ?></td> 
             <td><?php echo $c->status ; ?></td> 

                         <td><?php echo $TYPE ; ?></td> 

						 				         <td><?php 
					
   $tenantid=$c->tenantid;
				    $tenants = $this->accomodationmodel->gettenantbyid($tenantid);
 if(is_array($tenants)) {
   foreach($tenants as $tenantsrow){

    $names=$tenantsrow->surname. " ".$tenantsrow->firstname ; 
   
   ?>
   
					 <?php   {echo  $names;}  ?> 
					
						 <span id="myprint"><?php echo $names ; ?></span>

   
   <?php
    

}
    } else {
    echo 'No tenant.';
}
?>
				 
				 
		</td>

				 	 <td><?php echo $c->houseno ; ?></td> 
				<td><?php echo $c->plotno ; ?></td> 
			
											<td><?php echo $c->meternumber ; ?></td> 
											<td>
<?php
if($c->status=="open"){
?>	
										  					<input type="text" name="opening" id="non-printable" style="width:50%; margin:0px" value="<?php echo set_value('opening',$c->opening); ?>" class="form-control2" required placeholder=" opening" >
																								 <span id="myprint"><?php echo $c->opening ; ?></span>

<?php
}else{
?>	
										  					<input type="hidden" name="opening" id="non-printable" style="width:50%; margin:0px" value="<?php echo set_value('opening',$c->opening); ?>" class="form-control2" required placeholder=" opening" >
																							<?php echo $c->opening ; ?>

	
<?php
}	


?>			
											</td>
										<td><?php echo $c->closing ; ?></td> 
										<td><?php echo $c->usedqty ; ?></td> 

																<td><?php echo $c->rate ; ?></td> 
																<td><?php echo $c->charge ; ?></td> 
																<td><?php echo $c->totalamount ; ?></td> 

													      
		 <td>
												 
	<?php 
	
	    $actualtotal= $actualtotal+$c->usedqty;
	    $totalamount= $totalamount+$c->totalamount;
					// $branch="";
					 $userid=$c->userid;

					 $user= $this->usermodel->populateall('people','id',$userid);



if(is_array($user)) {

   foreach($user as $userhrow){

   echo $userhrow->surname;
 
 
}} else {
    echo 'No Name.';
}
	
?>
												 
	 </td>	
 <td id="non-printable">
 	<td><?php echo $c->createdat ; ?>

 <button type="submit"  value="editreading" name="btn_updatemeterreading" class="btn btn-default"> <span class="glyphicon glyphicon-pencil">Save </button>

 </td>
	 <td> 

 
 
					<div class="btn-group">
                                    <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown">
                                        More <span class="caret"></span>
                                    </button>
									<?php
										if($usertype=="admin"){
											
											?>
                                    <ul class="dropdown-menu dropdown-primary pull-right" role="menu">
                                        
                                        <!-- teacher EDITING LINK -->
                                      
										
											  <li> 
										 <a class="btn btn-danger managebtn" id="managebtndelete"		 data-id='<?php echo  $c->id;?>'    data-toggle='modal' data-target='#myModal<?php  $c->id; ?>'>	 


                                                <i class="glyphicon glyphicon-pencil"></i>
																Cancel
                                                </a>
                                                        </li>
									
									
                                                          <li class="divider"></li>
                                        
                                     	  <li> 

	 <a class="btn btn-primary editbtn" id="editbtn"  data-roomchargeid='<?php echo  $c->roomchargeid;?>' data-tenantid='<?php echo  $c->tenantid;?>' data-roomid='<?php echo  $c->roomid;?>' data-opening='<?php echo  $c->opening;?>'   data-closing='<?php echo  $c->closing;?>'  data-id='<?php echo  $c->id;?>' data-toggle='modal' data-target='#editProductModel'> 	 

                                                <i class="glyphicon glyphicon-pencil"></i>
																Update Closing
                                                </a>
                                                        </li>
                                       
                                    </ul>
											<?php
										}
										?>
                                </div>
</td>	 

		 
		 
             </tr>
 <?php echo form_close();?>	
             <?php endforeach; ?>
			

              <?php }?>
			  <tr>
			  <td colspan="10"> <b>Total Amount</b></td>
				 	 <td colspan="3"><b><?php  if(isset($actualtotal)){ echo $actualtotal; } ?></b></td> 
			  				 	 <td colspan="2"><b><?php  if(isset($totalamount)){ echo $totalamount; } ?></b></td> 

			  </tr>

        </table>

    </div>    </div>
</div>







<div id="viewsms" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Reading Report</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');

 $finalendate=date("Y-m-d H:59:59");
  $finalstartdate=date("Y-m-d 00:00:00");
  
  
  
//

				echo $this->session->flashdata('msg'); 
		
                 echo form_open('admin/searchmeterreadings' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>

		


 <div class="form-group">
    <label for="inputplotno" class="col-sm-2 control-label">Building Name</label>
    <div class="col-sm-10">
	<select class="form-control" name="plotno"  id="branchid" required>
	
	
	<option value=""   >---Select --</option>
			
								
	<option value="all"  selected >---All --</option>

	
	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('plot','branchid',$branchid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

   //echo $courserow->coursename;
    ?>
					<option   value="<?=  $maincategoryrow->id;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>

		
	</div>
  </div>


  
  
  <div class="form-group">
    <label for="inputstatus" class="col-sm-2 control-label">House No </label>
    <div class="col-sm-10">
                           		  		<input type="text" name="houseno" value="<?php echo set_value('houseno',"all"); ?>" class="form-control"  placeholder="Enter Rooms no ">


		
	</div>
  </div>
  
  
  
  
  
  

  <div class="form-group">
    <label for="inputfromdate" class="col-sm-2 control-label">From Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="fromdate" value="<?php echo set_value('fromdate',$finalstartdate); ?>" class="form-control" required placeholder="Enter start date">
		 
				
		<span class="text-danger"> <?php echo form_error('fromdate'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputtodate" class="col-sm-2 control-label">	To Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="todate" value="<?php echo set_value('todate',$finalendate); ?>" class="form-control" required placeholder="Enter End date">
		 
				
		<span class="text-danger"> <?php echo form_error('todate'); ?>
		
		</span>
	</div>
  </div>
  

  
    

   
  
  <div class="form-group">
    <label for="inputstatus" class="col-sm-2 control-label">Status </label>
    <div class="col-sm-10">
      <select name="status" required class="form-control" id="section_selector_holder">
		                            <option value="" >--Select Status--</option>
			                     <option value="all">all</option>

									 
									 <option value="open">open</option>
									 			                         <option selected value="reserved">reserved</option>

									   	 <option selected value="closed">closed</option>

			                    </select>
		

		
	</div>
  </div>
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="readings" name="btn_viewmeterreading" class="btn btn-primary"> View Report  </button>

    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

		</div>
	    </div>
    </div>	

	



	<div id="openreadingModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Start meter readings</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to start the reading? </h3>
      </div>
      <div class="modal-footer">
	  	

     
		<?PHP
				$session_data = $this->session->userdata('logged_in');
 echo $this->session->flashdata('deletemsg'); 

		
                 echo form_open('admin/startmeterreading' , array('class' => 'form-horizontal ', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>


	

  <div class="form-group">
    <label for="inputmetername" class="col-sm-2 control-label">Meter name</label>
    <div class="col-sm-10">
	<select class="form-control" name="metername"  id="metername" required>
	
	
	<option value="" selected="selected" >---Select meter name to start--</option>
	<option value="waterno" >Water Meter</option>
	<option value="electricityno" >Electricity Meter</option>
	<option value="bowholeno" >Bowholeno Meter</option>

				
</select>

		
	</div>
  </div>
  
  <div class="form-group">
    <label for="inputtype" class="col-sm-2 control-label">Meter Type</label>
    <div class="col-sm-10">
	<select class="form-control" name="type"  id="type" required>
	
	
	<option value="" selected="selected" >---Select meter type to start--</option>

					
								

	
	
	<?php 
					 
					 		$maincategory2 = $this->usermodel->populateall('charges','companyid',$companyid);


							


if(is_array($maincategory2)) {

   foreach($maincategory2 as $maincategoryrow2){

   //echo $courserow->coursename;
    ?>
					<option  value="<?=  $maincategoryrow2->id;   ?>"><?=  $maincategoryrow2->type; ?></option>



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>

		
	</div>
  </div>

  <div class="form-group">
    <label for="inputfromdate" class="col-sm-2 control-label">Opening Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="startdate" value="<?php echo set_value('startdate',$mydate); ?>" class="form-control" required placeholder="Enter start date">
		 
						  		<input type="hidden" name="postedtime" value="<?php echo set_value('postedtime',$mytime); ?>" class="form-control" required placeholder="Enter start time">

		<span class="text-danger"> <?php echo form_error('fromdate'); ?>
	Time:	<?php echo $mytime; ?>

		</span>
	</div>
  </div>
  

 <div class="form-group">
    <label for="inputplotno" class="col-sm-2 control-label">Building Name</label>
    <div class="col-sm-10">
	<select class="form-control" name="plotno"  id="branchid" required>
	
	
	<option value=""  selected >---Select --</option>
			
								

	
	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('plot','branchid',$branchid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

   //echo $courserow->coursename;
    ?>
					<option   value="<?=  $maincategoryrow->id;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>

		
	</div>
  </div>



  <div class="form-group">
    <label for="inputreadingtype" class="col-sm-2 control-label">Reading Type</label>
    <div class="col-sm-10">
	
	<select name="readingtype" class="form-control" required>
<option value="" >Select type</option>

<option value="all" selected="selected" >All  Reading</option>
<option value="single"  >Single  Reading</option>


	</select>		 

	</div>
  </div>



  <div class="form-group">
    <label for="inputroomno" class="col-sm-2 control-label">Room No.</label>
    <div class="col-sm-10">
	
   				<input type="text" name="roomno" value="<?php echo set_value('roomno','all'); ?>" id="roomno" class="form-control"  placeholder="Enter room no">

	</div>
  </div>







  <div class="form-group">
    <label for="inputbranchname" class="col-sm-2 control-label">Counter/ branch</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchid"  id="branchid" required>
	
	
	<option value=""   >---Select one Branch/Counter to Open--</option>

					
								

	
	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

   //echo $courserow->coursename;
    ?>
					<option selected="selected" value="<?=  $maincategoryrow->id;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>

		
	</div>
  </div>



  <div class="form-group">
    <label for="inputamount" class="col-sm-2 control-label">Year</label>
    <div class="col-sm-10">
	
   				<input type="number" name="year" value="<?php echo set_value('year',$year); ?>" id="idno" class="form-control"  placeholder="Enter year">

	</div>
  </div>






  <div class="form-group">
    <label for="inputmonth" class="col-sm-2 control-label">Month</label>
    <div class="col-sm-10">
	
	<select name="month" class="form-control" required>
<option value="" >Select month</option>

<option value="<?php echo $month; ?>" selected="selected" ><?php echo  $month; ?></option>
<option value="01"  >01</option>
<option value="02"  >02</option>
<option value="03"  >03</option>
<option value="04"  >04</option>
<option value="05"  >05</option>

<option value="06"  >06</option>
<option value="07"  >07</option>
<option value="08"  >08</option>
<option value="09"  >09</option>
<option value="10"  >10</option>
<option value="11"  >11</option>
<option value="12"  >12</option>

	</select>		 

	</div>
  </div>








  





				<input type="hidden" name="view" value="user/viewproducts" id="view" class="form-control" required placeholder="Enter view">

 <button type="button" class="btn btn-success" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="openmeter" value="meter" class="btn btn-info"> Start Readings </button>

	<?php echo form_close();?>
      </div>
    </div>

  </div>

  </div>				
	
	
	
	
	



	<div id="closereadingModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Close meter readings</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to close the reading? </h3>
      </div>
      <div class="modal-footer">
	  	

     
		<?PHP
				$session_data = $this->session->userdata('logged_in');
 echo $this->session->flashdata('deletemsg'); 

		
                 echo form_open('admin/closemeterreading' , array('class' => 'form-horizontal ', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>


  <div class="form-group">
    <label for="inputclosetype" class="col-sm-2 control-label">Close type</label>
    <div class="col-sm-10">
	<select class="form-control" name="closetype"  id="closetype" required>
	
	
	<option value="" >---Select close type--</option>
	<option value="close"   >Close Only</option>
	<option value="closeopen" selected="selected" >Close and open new Meter readings</option>

				
</select>

		
	</div>
  </div>
	

  <div class="form-group">
    <label for="inputmetername" class="col-sm-2 control-label">Meter type</label>
    <div class="col-sm-10">
	<select class="form-control" name="metername"  id="metername" required>
	
	
	<option value="" selected="selected" >---Select meter type to close--</option>
	<option value="waterno" >Water Meter</option>
	<option value="electricityno" >Electricity Meter</option>
	<option value="bowholeno" >Bowhole Meter</option>

				
</select>

		
	</div>
  </div>
  <div class="form-group">
    <label for="inputbranchname" class="col-sm-2 control-label">Counter/ branch</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchid"  id="branchid" required>
	
	
	<option value=""  >---Select one Branch/Counter to Open--</option>

					<option value="Main"  >-Main Store-</option>
					
								

	
	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

   //echo $courserow->coursename;
    ?>
					<option selected="selected" value="<?=  $maincategoryrow->id;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>

		
	</div>
  </div>

  <div class="form-group">
    <label for="inputfromdate" class="col-sm-2 control-label">Closing Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="startdate" value="<?php echo set_value('startdate',$mydate); ?>" class="form-control" required placeholder="Enter start date">
		 
						  		<input type="hidden" name="postedtime" value="<?php echo set_value('postedtime',$mytime); ?>" class="form-control" required placeholder="Enter start time">

		<span class="text-danger"> <?php echo form_error('fromdate'); ?>
	Time:	<?php echo $mytime; ?>

		</span>
	</div>
  </div>
  


 <div class="form-group">
    <label for="inputplotno" class="col-sm-2 control-label"> Name</label>
    <div class="col-sm-10">
	<select class="form-control" name="plotno"  id="branchid" required>
	
	
	<option value="" selected="selected" >---Select building to close--</option>
			
								

	
	
	<?php 
					 
					 		//$maincategory = $this->usermodel->populateall('plot','companyid',$companyid);
					 		$maincategory = $this->usermodel->populateall('plot','branchid',$branchid);


							


if(is_array($maincategory)) {

   foreach($maincategory as $maincategoryrow){

   //echo $courserow->coursename;
    ?>
					<option selected="selected"  value="<?=  $maincategoryrow->id;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

}} else {
    echo 'No main counter available.';
}
	
?>
</select>

		
	</div>
  </div>


  <div class="form-group">
    <label for="inputreadingtype" class="col-sm-2 control-label"></label>
    <div class="col-sm-10">
	Reading Type
	<select name="readingtype" class="form-control" required>
<option value="" >Select type</option>

<option value="all" selected="selected" >All  Reading</option>
<option value="single"  >Single  Reading</option>


	</select>		 

	</div>
  </div>



  <div class="form-group">
    <label for="inputroomno" class="col-sm-2 control-label"> No.</label>
    <div class="col-sm-10">
	
   				<input type="text" name="roomno" value="<?php echo set_value('roomno','all'); ?>" id="roomno" class="form-control"  placeholder="Enter room no">

	</div>
  </div>



  <div class="form-group">
    <label for="inputyear" class="col-sm-2 control-label">Year to close</label>
    <div class="col-sm-10">
	
   				<input type="number" name="year" value="<?php echo set_value('year',$year); ?>" id="idno" class="form-control"  placeholder="Enter year">

	</div>
  </div>






  <div class="form-group">
    <label for="inputmonth" class="col-sm-2 control-label">Month to close</label>
    <div class="col-sm-10">
	
	<select name="month" class="form-control" required>
<option value="" >Select month</option>

<option value="<?php echo $month; ?>" selected="selected" ><?php echo  $month; ?></option>
<option value="01"  >01</option>
<option value="02"  >02</option>
<option value="03"  >03</option>
<option value="04"  >04</option>
<option value="05"  >05</option>
<option value="06"  >06</option>
<option value="07"  >07</option>
<option value="08"  >08</option>
<option value="09"  >09</option>
<option value="10"  >10</option>
<option value="11"  >11</option>
<option value="12"  >12</option>

	</select>		 

	</div>
  </div>


  <div class="form-group">
    <label for="inputmethod" class="col-sm-2 control-label">Standing Charge</label>
    <div class="col-sm-10">
	<select class="form-control" name="method"  id="method" required>
	
	
	<option value=""  >---Select Standing Charge method--</option>
	<option value="automatic" selected="selected" >Pick from System</option>
	<option value="manual" >Enter total Amt Manually(Distribution) </option>
	<option value="Tariff" >Enter Pick from tariff table </option>

				
</select>

		
	</div>
  </div>
  
  
  
  <div class="form-group">
    <label for="inputmetcategory" class="col-sm-2 control-label">Tariff Category</label>
    <div class="col-sm-10">
	<select class="form-control" name="category"  id="category" required>
	
	
	<option value=""  >---Select Category--</option>
		<option value="na" selected="selected" >None</option>

	<option value="residential" >Residential /Government</option>
	<option value="commercial" >Commercial/ Industrial</option>
	<option value="standpipes" >Standpipes/ Water Kiosk</option>
	<option value="schools" >Universities/ Colleges</option>

				
</select>

		
	</div>
  </div>
  
  
  
  
  
  
  
  
  
  
  
  

  <div class="form-group">
    <label for="inputtotalconsumed" class="col-sm-2 control-label">Total Standing Charge</label>
    <div class="col-sm-10">
	
   				<input type="number" name="totalconsumed" value="<?php echo set_value('totalconsumed'); ?>" id="totalconsumed" class="form-control"  placeholder="Enter total amount to distribute">

	</div>
  </div>


  <div class="form-group">
    <label for="inputnextyear" class="col-sm-2 control-label">Year to open</label>
    <div class="col-sm-10">
	
   				<input type="number" name="nextyear" value="<?php echo set_value('year',$year); ?>" id="nextyear" class="form-control"  placeholder="Enter year">

	</div>
  </div>






  <div class="form-group">
    <label for="inputnextmonth" class="col-sm-2 control-label">Month to open</label>
    <div class="col-sm-10">
	
	<select name="nextmonth" class="form-control" required>
<option value="" >Select month to open</option>

<option value="<?php echo $month; ?>" selected="selected" ><?php echo  $month; ?></option>
<option value="01"  >01</option>
<option value="02"  >02</option>
<option value="03"  >03</option>
<option value="04"  >04</option>
<option value="05"  >05</option>
<option value="06"  >06</option>
<option value="07"  >07</option>
<option value="08"  >08</option>
<option value="09"  >09</option>
<option value="10"  >10</option>
<option value="11"  >11</option>
<option value="12"  >12</option>

	</select>		 

	</div>
  </div>







  





				<input type="hidden" name="view" value="user/viewproducts" id="view" class="form-control" required placeholder="Enter view">

 <button type="button" class="btn btn-success" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="closemeter" value="meter" class="btn btn-info"> Close Readings </button>

	<?php echo form_close();?>
      </div>
    </div>

  </div>

  </div>				
	
	
	
	





		
<div id="editProductModel" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Update closing</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('admin/updatemeterreading' , array('class' => 'form-horizontal form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
	<input type="hidden" name="myid" value=""id="mycategoryid" class="form-control" required placeholder="Enter mycategoryid">
		 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="admin/viewmeterreadings">
	  		
			
				<input type="hidden" name="roomid" value=""id="roomid" class="form-control" required placeholder="Enter roomid">
				<input type="hidden" name="roomchargeid" value=""id="roomchargeid" class="form-control" required placeholder="Enter roomchargeid">

			
			
			
			
			
			
			
			
	<div class="form-group">
    <label for="inputclosing" class="col-sm-2 control-label">	Closing </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="closing" value="<?php echo set_value('closing'); ?>" id="closing" class="form-control" required placeholder="Enter closing">
		 
				
		<span class="text-danger"> <?php echo form_error('closing'); ?>
		
		</span>
	</div>
  </div>
  	<div class="form-group">
    <label for="inputopening" class="col-sm-2 control-label">	Opening </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="opening" value="<?php echo set_value('opening'); ?>" id="opening2" class="form-control" required placeholder="Enter opening">
		 
				
		<span class="text-danger"> <?php echo form_error('opening'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  




	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit"  value="editreading" name="btn_updatemeterreading" class="btn btn-default"> <span class="glyphicon glyphicon-pencil">Save </button>


    </div>
  </div>
  					<?php echo form_close();?>
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

		</div>
	    </div>
    </div>
					


	   <div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Cancel</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to cancel this item? </h3>
      </div>
      <div class="modal-footer">
	  	

     
		<?PHP
				$session_data = $this->session->userdata('adminlogged_in');
 echo $this->session->flashdata('deletemsg'); 

		
                 echo form_open('user/deleteallbyid' , array('class' => 'form-horizontal ', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
 <input type="hidden" id="table"name="table" class="table" placeholder="bookroom" value="meterreading">
 <input type="hidden" id="view2"name="view2" class="view2" placeholder="view2" value="">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="admin/viewmeterreadings">
 <input type="hidden" id="itemid"name="itemid" class="itemid" placeholder="itemid" value=""><br>
           <input type="hidden" id="houseno"name="houseno" class="form-control" placeholder="houseno"  value="">

          <input type="hidden" id="plotno1"name="plotno" class="form-control" placeholder="plotno"  value="">
 <button type="button" class="btn btn-success" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="btn_delete" value="deletebyid" class="btn btn-danger"> Cancel  </button>

	<?php echo form_close();?>
      </div>
    </div>

  </div>

  </div>
</div>