
	 <link href="<?php echo base_url(); ?>assets/select/chosen.min.css" rel="stylesheet" media="screen">
	
		   
		   		   <script src="<?php echo base_url(); ?>assets/select/chosen.jquery.min.js"></script>

				   	 <script type="text/javascript">
        
        
            $(document).ready(function() { 

                
                $("#plotno").change(function(){
                 	var plotnoid = $("#plotno").val();
                     /*dropdown post *///
                      $.ajax({
			 		url:"<?php echo base_url();?>admin/populatehouseid",
			 		
					 data: {plotno: $(this).val()},

                    type: "POST",
                    success:function(data){
                        
                        $("#houseid").html(data);
                    }
                
                    });

               
                });

            });
               $(function () {
        $("#plotno").change(function () {
            if ($(this).val() == "") {
                $("#house").hide();
            } 
            else {
                $("#house").show();
            }
        });
    });
          
        </script>
	
<script type="text/javascript">
        
        
            $(document).ready(function() { 

                
                $("#plotno2").change(function(){
                 	var plotnoid = $("#plotno").val();
                     /*dropdown post *///
                      $.ajax({
			 		url:"<?php echo base_url();?>admin/populatehouseid",
			 		
					 data: {plotno: $(this).val()},

                    type: "POST",
                    success:function(data){
                        
                        $("#houseid").html(data);
                    }
                
                    });

               
                });

            });
               $(function () {
        $("#plotno").change(function () {
            if ($(this).val() == "") {
                $("#house").hide();
            } 
            else {
                $("#house").show();
            }
        });
    });
          
        </script>
	
        <script>
        $(function() {
<!--             $(".datepicker").datepicker(); -->
<!--             $(".uniform_on").uniform() -->;
            $(".chzn-select").chosen();
   <!--          $('.textarea').wysihtml5(); -->

        });
        </script>
                  
                  
			 

<ul class="nav nav-tabs bordered">
			<li class="active">
            	<a href="#add" data-toggle="tab"><i class="entypo-menu"></i> 
						View Reports

                    	</a></li>
						
						
						<li>
            	<a href="<?php echo base_url(); ?>admin/viewpallmyplots" data-toggle="tab"><i class="entypo-menu"></i> 
						
										 <a href="<?php echo base_url(); ?>admin/viewpallmyplots">	NEW BOOKING</a>

                    	</a></li>
							<li>
            	<a href="<?php echo base_url(); ?>admin/viewpallmyplots" data-toggle="tab"><i class="entypo-menu"></i> 
						
										 <a href="<?php echo base_url(); ?>admin/viewpallmyplots">	Go back</a>

                    	</a></li>
						
						
										<li>
            										<a data-toggle='modal' data-target='#CollectionsModal' class="btn btn-info"> Daily Collections  </a>

						
						</li>
						
						
						
						
						
		
			
		</ul>
    	<!------CONTROL TABS END------>
        
		<div class="tab-content">
            <!----TABLE LISTING STARTS-->
            <div  class="tab-pane box active" id="list">
				
    
		<div class="panel panel-primary" data-collapsed="0">


		
<div class="row">
<div class="col-md-6">
		<div class="panel panel-primary" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" >
            		<i class="entypo-plus-circled"></i>
			Advance Search for specific house
            	</div>
            </div>
			<div class="panel-body">


<?PHP

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

   
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
	 $data['branchid'] = $session_data['branchid'];
	 $branchid = $data['branchid'];
	 
	 
	    $addproductaction=$this->usermodel->populatuserpermissionsdataarray('reports','add',$userid);

	 $updateaction=$this->usermodel->populatuserpermissionsdataarray('reports','update',$userid);
  $updatebuyingpriceaction=$this->usermodel->populatuserpermissionsdataarray('reports','update',$userid);
  $deleteaction=$this->usermodel->populatuserpermissionsdataarray('reports','delete',$userid);
	   $viewallaction=$this->usermodel->populatuserpermissionsdataarray('reports','viewall',$userid);
	   $dontshowprofit=$this->usermodel->populatuserpermissionsdataarray('reports','dontshowprofit',$userid);
 $viewaccounting=$this->usermodel->populatuserpermissionsdataarray('accountingreports','view',$userid);


   $userid=$data['id'];
 //$finalendate=date("Y-m-d H:59:59");
 // $finalstartdate=date("Y-m-d 00:00:00");
  
  
    $finalstartdate1=date("Y-m-01 00:00:00");

	 	 $smsconfig = $this->usermodel->populateallarray('smsconfig','id',$companyid);
		 		$currenttime = date('H:i');

		 
		  $year=date("Y");
		  $month=date("m");
		   $day=date("d");
		   
		   $subtract=$day-1;
		   $add=$day+1;
		        if ($subtract<10){
			  $subtract="0".$subtract;
		   }else{
			   $subtract=$subtract; 
		   }
		$finalstartdate="";
		$finalendate="";
		  $myfromdate=$smsconfig[0]['fromdate'];
		 $mytodate=$smsconfig[0]['todate'];
		 $starttime=$smsconfig[0]['starttime'];
		 $duetime=$smsconfig[0]['duetime'];
		 //echo $myfromdate;
		if(($myfromdate=="Current") &&($mytodate=="Current") &&  ($currenttime>=$starttime)){
	
		  $finalstartdate=$year.'-'.$month.'-'.$day.' '. $starttime.':00';
		
		 }else if(($myfromdate=="Current") &&($mytodate=="Next") &&  ($currenttime>=$starttime)){
	
		  $finalstartdate=$year.'-'.$month.'-'.$day.' '. $starttime.':00';
		
		 }
		 
		  else if(($myfromdate=="Current") &&($mytodate=="Current") && ($currenttime<$starttime)){
					  $finalstartdate=$year.'-'.$month.'-'.$day.' '. $starttime.':00';


				//	echo $finalstartdate;
		 }
		 
		 else if(($myfromdate=="Current") &&($mytodate=="Next") && ($currenttime<$starttime)){
						 if(($day=="01") || ($day=="1")){
				 
				 $currentdate=$year.'-'.$month.'-'.$day;

 $mynewfromdate = strtotime ( '-1 month' , strtotime ( $currentdate ) ) ;
$newfromdate = date ( 'Y-m-d' , $mynewfromdate );
$finalstartdate = date("Y-m-t", strtotime($newfromdate)).' '.$starttime.':00';
			 }else{
			
								  $finalstartdate=$year.'-'.$month.'-'.$subtract.' '. $starttime.':00';

			
			 }
	
		 }



		
		 
		 
		if(($mytodate=="Next") && ($currenttime>=$duetime)){
	
		  $finalendate=$year.'-'.$month.'-'.$add.' '. $duetime.':00';
				//echo $finalstartdate;
		
		 }else if(($mytodate=="Next") && ($currenttime<$duetime)){
			
		  $finalendate=$year.'-'.$month.'-'.$day.' '. $duetime.':00';
		  
				//	echo $finalstartdate;
		 }else  if(($mytodate=="Current") && ($currenttime>=$duetime)){
		 		  $finalendate=$year.'-'.$month.'-'.$day.' '. $duetime.':00';

		 }else  if(($mytodate=="Current") && ($currenttime<$duetime)){
					  $finalendate=$year.'-'.$month.'-'.$day.' '. $duetime.':00';

		  
				//	echo $finalstartdate;
		 }
		 
		 
		 
  
  
   	 $finalendatechecker = htmlspecialchars(trim(explode('-',date("Y-m-d", strtotime($finalendate)))[0]));	
		
					
		 if($finalendatechecker=="1970"){
			 
			 

		$mynew_date = date("Y-m-d", strtotime("+1 day"));
			 
			 
		 $finalendate=$mynew_date.' '. $duetime.':00';	 
		 }
		
		 
  
  
   $transactionid = 'rand' .rand(100, 9900) . 'trc' . time();

  
  
  
     $mydate=date("Y-m-d");

  
  
   //$finalendate=date("Y-m-d H:i:s");
 
   $myuser=$this->usermodel->geteuser($userid);
   $myname=$myuser[0]['firstname'];
   function formatMoney($number, $fractional=false) {
						if ($fractional) {
							$number = sprintf('%.2f', $number);
						}
						while (true) {
							$replaced = preg_replace('/(-?\d+)(\d\d\d)/', '$1,$2', $number);
							if ($replaced != $number) {
								$number = $replaced;
							} else {
								break;
							}
						}
						return $number;
					}	
?>

 

			<?PHP
		
				echo $this->session->flashdata('msg'); 
		
                 echo form_open('admin/searchhousebalance' , 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="user" value="all" id="user" class="form-control" required placeholder="user">

 
					<input type="hidden" name="houseno" value="all" id="fromdate" class="form-control" required placeholder="houseno">

  
   <div class="form-group" >
						<label for="field-2" class="col-sm-2 control-label">House Name</label>
		                    <div class="col-sm-10">
		                        <select name="plotno" class="chzn-select"  width="100%"id="plotno"  required>
		                            <option  value="">--Select house--</option>
				 <option value="all" selected>--All Houses--</option>

									   <?php
									$plot = $this->accomodationmodel->populateallplots();


if(is_array($plot)) {

   foreach($plot as $plotrow){

    ?>
	    <option  value="<?php echo set_value('plotno',$plotrow->id); ?> "><?=$plotrow->name;?></option>

   
    <?php

}} else {
    echo 'There is no plot in the system.... Please add plot first.';
}

?>
			                        
			                    </select>
								     <span class="text-danger"><?php echo form_error('plotno'); ?></span>
			                </div>
	</div>
	
	
	
	
	
	
	
	
     <div class="form-group">
    <label for="inputuser" class="col-sm-2 control-label">User?</label>
    <div class="col-sm-10">
	<select class="form-control" name="user" required>
	
	<option value=""  >---Select user---</option>

		<option value="all"  selected >All/everyone</option>

	
	
	<?php 
				
				
			//$allusers= $this->usermodel->populateall('people','companyid',$companyid);
						$allusers = $this->usermodel->populatealldatanoarraythree('people', 'companyid',$companyid,'status',1,'category','user');


	
if(is_array($allusers)) {

   foreach($allusers as $userrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $userrow->id;   ?>"><?=  $userrow->email ."(". $userrow->firstname ."- ".$userrow->surname.")"; ?></option>



	<?php

}} else {
    echo 'No user available.';
}
	
?>
</select>
		
						<span class="text-danger"><?php echo form_error('people'); ?>

	</div>
  </div>
  
	
	
	

	
	
	
	
	

	
	 <div class="form-group">
						<label for="field-2" class="col-sm-2 control-label">Display Type</label>
		                    <div class="col-sm-10">
		                        <select name="display"  class="form-control" id="section_selector_holder">

		                            <option value="all" >--All-</option>
			                        <option  selected  value="yes">Detailed </option>
																		   <option  value="No">Summary</option>
																		   <option  value="BreakFast">BreakFast List</option>

												                        <option   value="balance">Current Balance Only</option>

									 

			                    </select>
							 <span class="text-danger"><?php echo form_error('display'); ?></span>

			                </div>
	</div>
	
	
	
			 <div class="form-group">
						<label for="field-2" class="col-sm-2 control-label">Category</label>
		                    <div class="col-sm-10">
		                        <select name="category"  class="form-control">
		                           									<option value="all">--ALL--</option>

								   <option selected value="active">Check-in</option>
									<option value="inactive">Check-out</option>

									
									<option selected value="pactive">Previous Check-in</option>


									   <option value="pinactive">Futue Check-out</option>
									   

									   
									<option value="reserved">Reserved</option>

									   
									   

			                    </select>
							 <span class="text-danger"><?php echo form_error('category'); ?></span>

			                </div>
	</div>
	
	
	
		    <label for="inputfromdate" class="col-sm-2 control-label">From Date </label>

				<div class="col-sm-5">
					<div class="form-group">

                     		  		<input type="date" name="fromdate" value="<?php echo set_value('fromdate',date("Y-m-d", strtotime($finalstartdate))); ?>" class="form-control" required placeholder="Enter start date">

					</div>
				</div>
				<div class="col-sm-5">
					<div class="form-group">
					

							  		<input type="time"  name="frotime" value="<?php echo set_value('frotime',$starttime.":00"); ?>" class="form-control" required placeholder="Enter start time">

					</div>
				</div>
			

			
			
						    <label for="inputfromdate" class="col-sm-2 control-label">To Date </label>

				<div class="col-sm-5">
					<div class="form-group">

		  		<input type="date" name="todate" value="<?php echo set_value('todate',date("Y-m-d", strtotime($finalendate))); ?>" class="form-control" required placeholder="Enter End date">

					</div>
				</div>
				<div class="col-sm-5">
					<div class="form-group">
					

							  		<input type="time"  name="totime" value="<?php echo set_value('totime',$duetime.":00"); ?>" class="form-control" required placeholder="Enter stop time">

					</div>
				</div>
			
  	
	
	
	
	
	<div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">Customer Name / Company</label>
    <div class="col-sm-10">
				    	
			  	<select style="width :100%" name="tenantid"  class="chzn-select" required>
<option value="" >---Select customer---</option>
<option value="all"  selected>-All--</option>

		<?php 

//$nation = $this->nationmodel->populatenation();


if(is_array($tenant)) {

   foreach($tenant as $tenantrow){

    ?>
	    <option value="<?php echo set_value('tenant',$tenantrow->id); ?> "><?=$tenantrow->company." ".$tenantrow->firstname." IDNO ".$tenantrow->idno;;?></option>

   
    <?php

}} else {
    echo 'There is no other  tenant for this house.... Please add tenant first.';
}

?>
	</select>
				

	  <span class="text-danger"><?php echo form_error('tenantid'); ?></span>

	  
	  
	</div>
  </div>
	
	
	
	
	
	   <div class="form-group" >
						<label for="field-2" class="col-sm-2 control-label">Charge Type</label>
		                    <div class="col-sm-10">
		                        <select name="chargeid" class="chzn-select" style="width :100%" id="plotno"  required>
		                            <option  value="">--Select charge type--</option>
				 <option value="all" selected>--All Charges--</option>

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


if(is_array($roomcharges)) {

   foreach($roomcharges as $roomchargesrow){

    ?>
	    <option  value="<?php echo set_value('chargeid',$roomchargesrow->id); ?> "><?=$roomchargesrow->type;?></option>

   
    <?php

}} else {
    echo 'There is no charge added.';
}

?>
			                        
			                    </select>
								     <span class="text-danger"><?php echo form_error('plotno'); ?></span>
			                </div>
	</div>
	
	
	
	
	
	
	
	
	
	
  
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-7">
     
	       <button type="submit" name="btn_tenant"value="tenant" class="btn btn-primary">View details</button>

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

	<div class="col-md-6">
		<div class="panel panel-primary" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" >
            		<i class="entypo-plus-circled"></i>
			MORE REPORTS
            	</div>
            </div>
			<div class="panel-body">
									 <a data-toggle='modal' data-target='#salesexpensesModal' class="btn btn-success">Sales and Expenses Report </a>

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

<div class="col-md-6">
		<div class="panel panel-primary" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" >
            		<i class="entypo-plus-circled"></i>
	Search  for debtors report
            	</div>
            </div>
			<div class="panel-body">





				<?PHP

 $transactionid = 'rand' .rand(100, 9900) . 'trc' . time();

				echo $this->session->flashdata('msg'); 
		
                 echo form_open('admin/searchhousebycustomer' , 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="user" value="all" id="user" class="form-control" required placeholder="user">
  					<input type="hidden" name="tenantid" value="all" id="tenantid" class="form-control" required placeholder="user">

 
					<input type="hidden" name="houseno" value="all" id="fromdate" class="form-control" required placeholder="houseno">

  
   <div class="form-group" >
						<label for="field-2" class="col-sm-2 control-label">House Name</label>
		                    <div class="col-sm-10">
		                        <select name="plotno" class="chzn-select"  width="100%"id="plotno"  required>
		                            <option  value="">--Select house--</option>
				 <option value="all" >--All Houses--</option>

									   <?php
									$plot = $this->accomodationmodel->populateallplots();


if(is_array($plot)) {

   foreach($plot as $plotrow){

    ?>
	    <option selected value="<?php echo set_value('plotno',$plotrow->id); ?> "><?=$plotrow->name;?></option>

   
    <?php

}} else {
    echo 'There is no plot in the system.... Please add plot first.';
}

?>
			                        
			                    </select>
								     <span class="text-danger"><?php echo form_error('plotno'); ?></span>
			                </div>
	</div>
	
	
	
	
	
	
	
	
	
	 <div class="form-group">
						<label for="field-2" class="col-sm-2 control-label">Date Range</label>
		                    <div class="col-sm-10">
		                        <select name="daterange"  class="form-control" id="section_selector_holder">
		                            <option value="all" >--Use Date Range to search customer--</option>
			                        <option   selected="selected" value="yes">Yes</option>
									   <option  value="No">No</option>
									 

			                    </select>
							 <span class="text-danger"><?php echo form_error('daterange'); ?></span>

			                </div>
	</div>
	
	

	
	
	
		    <label for="inputfromdate" class="col-sm-2 control-label">From Date </label>

				<div class="col-sm-5">
					<div class="form-group">

                     		  		<input type="date" name="fromdate" value="<?php echo set_value('fromdate',date("Y-m-d", strtotime($finalstartdate))); ?>" class="form-control" required placeholder="Enter start date">

					</div>
				</div>
				<div class="col-sm-5">
					<div class="form-group">
					

							  		<input type="time"  name="frotime" value="<?php echo set_value('frotime',$starttime.":00"); ?>" class="form-control" required placeholder="Enter start time">

					</div>
				</div>
			

			
			
						    <label for="inputfromdate" class="col-sm-2 control-label">To Date </label>

				<div class="col-sm-5">
					<div class="form-group">

		  		<input type="date" name="todate" value="<?php echo set_value('todate',date("Y-m-d", strtotime($finalendate))); ?>" class="form-control" required placeholder="Enter End date">

					</div>
				</div>
				<div class="col-sm-5">
					<div class="form-group">
					

							  		<input type="time"  name="totime" value="<?php echo set_value('totime',$duetime.":00"); ?>" class="form-control" required placeholder="Enter stop time">

					</div>
				</div>
			
  	
  
  
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-7">
     
	       <button type="submit" name="btn_tenant"value="tenant" class="btn btn-primary">Search  </button>

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

	<div class="col-md-6">
		<div class="panel panel-primary" data-collapsed="0">
        	<div class="panel-heading">
            	<div class="panel-title" >
            		<i class="entypo-plus-circled"></i>
			Advance Balance Search for specific room per house
            	</div>
            </div>
			<div class="panel-body">





	<?php
		
                 echo form_open('admin/searchhousebalance' , 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="field-2" class="col-sm-2 control-label">House Name</label>
		                    <div class="col-sm-10">
		                        <select name="plotno" class="chzn-select"  width="100%"id="plotno2"  required>
		                            <option  value="">--Select House--</option>
													 <option value="all" selected>--All Houses--</option>

									   <?php
									$plot = $this->accomodationmodel->populateallplots();


if(is_array($plot)) {

   foreach($plot as $plotrow){

    ?>
	    <option   value="<?php echo set_value('plotno',$plotrow->id); ?> "><?=$plotrow->name;?></option>

   
    <?php

}} else {
    echo 'There is no plot in the system.... Please add plot first.';
}

?>
			                        
			                    </select>
								     <span class="text-danger"><?php echo form_error('plotno'); ?></span>
			                </div>
	</div>
	
	   <div class="form-group" >
						<label for="field-2" class="col-sm-2 control-label">Room number</label>
		                    <div class="col-sm-10" id="house"  >
		                        <select name="houseno" class="form-control"  id="houseid"   >

								
			                        
			                    </select>
								
								     <span class="text-danger"><?php echo form_error('houseno'); ?></span>
			                </div>
	</div>

 	 <div class="form-group">
						<label for="field-2" class="col-sm-2 control-label">Category2 </label>
		                    <div class="col-sm-10">
		                        <select name="category"  class="form-control">
		                            <option selected value="active">Check in</option>
							 <option value="reserved">Reserved</option>

									   <option value="inactive">Check out</option>
									<option value="all">--ALL--</option>

			                    </select>
							 <span class="text-danger"><?php echo form_error('category'); ?></span>

			                </div>
	</div>
	
	    <label for="inputfromdate" class="col-sm-2 control-label">From Date </label>

				<div class="col-sm-5">
					<div class="form-group">

                     		  		<input type="date" name="fromdate" value="<?php echo set_value('fromdate',date("Y-m-d", strtotime($finalstartdate))); ?>" class="form-control" required placeholder="Enter start date">

					</div>
				</div>
				<div class="col-sm-5">
					<div class="form-group">
					

							  		<input type="time"  name="frotime" value="<?php echo set_value('frotime',$starttime.":00"); ?>" class="form-control" required placeholder="Enter start time">

					</div>
				</div>
			

			
			
						    <label for="inputfromdate" class="col-sm-2 control-label">To Date </label>

				<div class="col-sm-5">
					<div class="form-group">

		  		<input type="date" name="todate" value="<?php echo set_value('todate',date("Y-m-d", strtotime($finalendate))); ?>" class="form-control" required placeholder="Enter End date">

					</div>
				</div>
				<div class="col-sm-5">
					<div class="form-group">
					

							  		<input type="time"  name="totime" value="<?php echo set_value('totime',$duetime.":00"); ?>" class="form-control" required placeholder="Enter stop time">

					</div>
				</div>
			
  	
  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-7">
     
	       <button type="submit" name="btn_tenant"value="tenant" class="btn btn-primary">View details</button>

    </div>
  </div>
                    
                <?php echo form_close();?>
            </div>
        </div>
    </div>
	
	</div>
	
	
	
	
	
	
<div id="CollectionsModal" 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">Daily collections/Payments Report</h4>
      </div>
      <div class="modal-body">
      
	  	

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('admin/collections' , 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="inputbranchname" class="col-sm-2 control-label">Counter</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchname"  id="branchname" required>
	
	
	<option value=""  >---Select Branch/Counter Name--</option>
<?php
									 if( $viewallaction==true){
										 ?>
					<option value="all"  selected="selected"  >All branches/Counters</option>
									<?php
									 }
							
	?>
	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','companyid',$companyid);


							


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="inputcategory" class="col-sm-2 control-label">Category?</label>
    <div class="col-sm-10">
	<select class="form-control" name="category" required>
	<option  value=""  >---Select Report to View--</option>
<option selected="selected" value="payment">Payments Received</option>
	<option value="paid" >Purchases Paid</option>
	<option value="bill" >Bills Paid</option>


	
</select>
		
						<span class="text-danger"><?php echo form_error('download'); ?>

	</div>
  </div>
	
	
						    <label for="inputfromdate" class="col-sm-2 control-label">From Date </label>

				<div class="col-sm-5">
					<div class="form-group">

                     		  		<input type="date" name="fromdate" value="<?php echo set_value('fromdate',date("Y-m-d", strtotime($finalstartdate))); ?>" class="form-control" required placeholder="Enter start date">

					</div>
				</div>
				<div class="col-sm-5">
					<div class="form-group">
					

							  		<input type="time"  name="frotime" value="<?php echo set_value('frotime',$starttime.":00"); ?>" class="form-control" required placeholder="Enter start time">

					</div>
				</div>
			

			
			
						    <label for="inputfromdate" class="col-sm-2 control-label">To Date </label>

				<div class="col-sm-5">
					<div class="form-group">

		  		<input type="date" name="todate" value="<?php echo set_value('todate',date("Y-m-d", strtotime($finalendate))); ?>" class="form-control" required placeholder="Enter End date">

					</div>
				</div>
				<div class="col-sm-5">
					<div class="form-group">
					

							  		<input type="time"  name="totime" value="<?php echo set_value('totime',$duetime.":00"); ?>" class="form-control" required placeholder="Enter stop time">

					</div>
				</div>
			
  	


  <div class="form-group">
    <label for="inputgroup" class="col-sm-2 control-label">Group Items?</label>
    <div class="col-sm-10">
	<select class="form-control" name="group"  required>
	
	
	<option value=""  >---Use Group Items?--</option>

					<option  value="yes">Yes</option>
					<option   selected="selected" value="no">No(Everything)</option>

</select>
		

		
	</div>
  </div>
	
    

   
 <div class="form-group">
	 
	 
	 
    <label for="inputdownload" class="col-sm-2 control-label">Download?</label>
    <div class="col-sm-10">
	<select class="form-control" name="download" required>
	<option  value=""  >---Do you want to download report in Excel--</option>
<option selected="selected" value="no">No (I just want to  view sales)</option>
	<option value="yes" >Yes(I want to download)</option>


	
</select>
		
						<span class="text-danger"><?php echo form_error('download'); ?>

	</div>
  </div>
	
	
	
	

	
	
	
	
	
	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="collections" name="btn_collections" class="btn btn-primary"> View Summary Sales  </button>

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

    

				</div>

		</div>
	    </div>
    </div>	
	
	
	
	
	
	
	
  
<div id="salesexpensesModal" 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">Report for rooms sold and expenses</h4>
      </div>
      <div class="modal-body">
      
	  	

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

				echo $this->session->flashdata('deletemsg'); 


				echo $this->session->flashdata('msg'); 
		
                 echo form_open('admin/searchroomssoldandexpenses' , 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/viewhousekeeping"id="view" class="form-control" required placeholder="Enter status">
<input type="hidden" name="action" value="insert" class="form-control" required placeholder="Enter action">
<input type="hidden" name="mycategoryid" value="" class="form-control" required placeholder="Enter action">






 <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  date("Y-m-01 00:00:00"); ?>" 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  date("Y-m-d 23:59:59"); ?>" 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="inputcashbanked" class="col-sm-2 control-label">Cash in the Bank </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="cashbanked" value="0" class="form-control" required placeholder="Enter cash in the bank">
		 
				
		<span class="text-danger"> <?php echo form_error('cashbanked'); ?>
		
		</span>
	</div>
  </div>
  
  

  
	 <div class="form-group" >
						<label for="field-2" class="col-sm-2 control-label">House Name</label>
		                    <div class="col-sm-10">
		                        <select name="plotno" class="form-control"  width="100%"id="plotno"  required>
		                            <option  value="">--Select house--</option>
				 <option value="all" selected>--All Houses--</option>

									   <?php
									$plot = $this->accomodationmodel->populateallplots();


if(is_array($plot)) {

   foreach($plot as $plotrow){

    ?>
	    <option  value="<?php echo set_value('plotno',$plotrow->id); ?> "><?=$plotrow->name;?></option>

   
    <?php

}} else {
    echo 'There is no plot in the system.... Please add plot first.';
}

?>
			                        
			                    </select>
								     <span class="text-danger"><?php echo form_error('plotno'); ?></span>
			                </div>
	</div>
	
  
  

	

	
	 <div class="form-group">

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

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

    

				</div>

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



			
			
			
			
			</div>
			</div>
			
			
			
			
			
			
			
			





