     
<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/viewdailycollections";
		alert(" printing...........");
    }else {

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

		    // document.body.innerHTML = originalContents;

	}
}


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








	</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>




	 <script type="text/javascript">
  
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid1").val(itemid); 
		  
		  
		   
        });
		
		
		
    </script> 

 
 <div class="row">
  
   	

   	<div class="col-md-12">
	
  
		<div class="panel panel-default" data-collapsed="0" id="non-printable">
        	<div class="panel-heading">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>
						 <span class="pull-right"> View Daily Collections</span>	
	<?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'];	
	    $addproductaction=$this->usermodel->populatuserpermissionsdataarray('reports','add',$userid);
	 	 $smsconfig = $this->usermodel->populateallarray('smsconfig','id',$companyid);

	 $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);
	        		$configuration = $this->usermodel->populateallarray('smsconfig','id',$companyid);
					
					  	   $viewdailycollections=$this->usermodel->populatuserpermissionsdataarray('cashiersales','viewdailycollections',$userid);

		   	   $adddailycollection=$this->usermodel->populatuserpermissionsdataarray('cashiersales','adddailycollection',$userid);
//$mydate=date('Y-m-d');
   $mydate=date("Y-m-d H:i:s");
$mytime=date('H:i:s');	$currenttime = date('H:i');

		 
  	$dateString = '2020-02-05';
 
//Last date of current month.
//echo$lastDateOfMonth = date("Y-m-t", strtotime($dateString));
		  $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'];
		
	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';


				
		 }
		 
		 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.'-'.$add.' '. $duetime.':00';

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

		  
				//	echo $finalstartdate;
		 }
		 
		 
		 
		 
		 
	
	?>						 
						 <a data-toggle='modal' data-target='#addModal' class="btn btn-primary">Add 	Collections </a>

						 <a  id="more" class="btn btn-primary" href="<?php echo base_url();?>user/mysales">  Back to cashier sales   </a>

	 <?php 
				 	 if( $adddailycollection==true){
										 ?>
						 						 						 <a data-toggle='modal' data-target='#colectionModal' class="btn btn-primary"> 	Collections Report </a>
									<?php
									 }
									 ?>
 	<div class="print-hide" id="non-printable"  >

<form name="print" method="post" action="">
 
 <div class="row">

 

   	<div class="col-md-6">
				
	
</div>
   	<div class="col-md-6">
<input type="submit" id="print"  accesskey="p" class="btn btn-primary"  name="print"onclick="printDiv('printableArea')" value="print receipt!" />
</form></div></div>
							</div> 
				
            	</div>
            </div>
			<div class="panel-body">

				<div class="widget-content nopadding table_holder table-responsive" >				
	<?PHP



				echo $this->session->flashdata('msg'); 
								?>	
										
					<div class="row">
						<div class="col-md-12">
							
							<div class="panel-body">
	
							<div class="table-responsive">
			<div id="printableArea">		
									
				<table class="tablesorter table table-bordered  table-hover" id="sortable_table">			

             <thead>
			 <tr>
				 	
	<td colspan="20" width="100%">
	<center>
					
										<?php $bussinessname=$configuration[0]['businessname']; if(isset($bussinessname)) {echo   $bussinessname; }?>
		</center>	
		</td>

			</tr>
         <tr>
      <th>#</th>
     <th>Date</th>
	  <th>Opening balance </th> 
	  	  <th>TT Sales </th>
		  	  	  <th>Total </th>

  
	  <th>Mpesa Sales</th> 
	 
	
	 
		 	 	 
				  <th>TT Expense </th> 
				 	  <th>Advance </th> 
					  	  <th>Purchase </th> 
						  					  	  <th>Amt Collected </th> 

												  	  <th>Closing Balance </th> 

		   <th>Name</th>
		   	   <th>Description</th>

		      <th>Approved by?</th>
	    
		 
		 
	 <th>more</th> 

                 </tr>
             </thead>
<?php
 echo $this->session->flashdata('imagemsg1'); 
		 
		    
$session_data = $this->session->userdata('logged_in');
 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
	
$data['surname'] = $session_data['surname'];
$data['id'] = $session_data['id'];
 $data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
$surname=$data['surname'];
   $userid=$data['id'];
	    $count=0;
				  $totalamount=0;
  $totalpaid=0;
    
    $people=0;
    $discount=0;

    $totalbalance=0;
	    $roomtype=0;
   $mpesa=0;
      $card=0;
	   $cash=0;
	    $credit=0;
			    $cheque=0;
		

	   $voucher=0;
	  $expense=0;
	  	   $slestotal=0;

	   $sortmoney=0;
	  $tax=0;
 if(!is_array($collections)) 

 {


 				   

    }else {
?>
    
             <?php 
	
  
  	foreach ($collections as $c): 

		 

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

	  	   $slestotal= $c->openingbalance+ $c->totalsales;

  $credit=$credit+$c->credit;
    $voucher=$voucher+$c->voucher;
  $card=$card+$c->card;
  $cash=$cash+$c->cash;
    $cheque=$cheque+$c->cheque;
	    $discount=$discount+$c->discount;
 $expense=$expense+$c->expense;
   $mpesa=$mpesa+$c->mpesa;
    
	   $sortmoney=$sortmoney+$c->sortmoney;
	  $tax=$tax+$c->tax;
   

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

  <td><?php echo $c->entrydate; ?></td>
  
  
  	<td><?php echo $c->openingbalance; ?></td>
					 <td><?php echo $c->totalsales; ?></td>
  					 <td><?php echo $slestotal; ?></td>

  
					 <td><?php echo $c->mpesa; ?></td>
					 					 


										 		 <td> <a  href="<?php echo base_url();?>user/viewexpenses"><?php echo $c->expense; ?> </a></td>
												 <td><?php echo $c->sortmoney; ?></td>
													<td><?php echo $c->tax; ?></td>
													<td><?php echo $c->cashcollected; ?></td>
													<td><?php echo $c->closingbalance; ?></td>


	   <td><?php echo $c->name ; ?></td>
	       <td><?php echo $c->description ; ?></td>

	   <td><?php echo $c->controller ; ?></td>

		
			
	      
		  	<td id="non-printable">

 
 
					<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='#deltemyModal<?php  $c->id; ?>'>	 


                                                <i class="glyphicon glyphicon-pencil"></i>
																Delete
                                                </a>
                                                        </li>
									
									
                                        <li class="divider"></li>
                                        
                                        <!-- teacher DELETION LINK -->
                                        
                                    </ul>
											<?php
										}
										?>
                                </div>
</td>
             </tr>

	<?php endforeach;} ?>
		 <tr>

			  <td> <b> <?php echo  $count;  ?> </b></td>
		
			 <td colspan="2"> <b> Collections  Summary: </b></td>



		

			  <td>  <b><?php echo $cash;  ?> </b></td>
			  <td >  <b><?php echo $mpesa;  ?> </b></td>
			  	<td >  <b><?php echo $card;  ?> </b></td>
			  	<td >  <b><?php echo $cheque;  ?> </b></td>

			     <td >  <b><?php echo $credit;  ?> </b></td>
			  	<td >  <b><?php echo $voucher;  ?> </b></td>
							  	<td >  <b ><?php echo $discount;  ?> </b></td>
  	<td >  <b ><?php echo $expense;  ?> </b></td>
	
	
	  	<td >  <b ><?php echo $sortmoney;  ?> </b></td>
		  	<td >  <b ><?php echo $tax;  ?> </b></td>
	
					<td > </td>
										<td > </td>

															<td > </td>

			 </tr>


        </table>
</div>	</div>	
			  <div class="col-md-12 text-center">    <?php echo $links; ?>
					   		<span style="color:red; font-size:20px"><?php  echo $total_rows. "  Records in the system. " ;?>    </span>

        
        </div>						
									
									
					</div>	

								
<div id="addModal" 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">Add new daily collection</h4>
      </div>
      <div class="modal-body">

	  	

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

$img_id = rand(100, 990000).time();

				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/addcollections' , 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="user/viewdailycollections" id="view" class="form-control" required placeholder="Enter cash">
      		
	
	 <div class="form-group">
    <label for="inputbranchid" class="col-sm-2 control-label">Counter</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchid"  id="branchid" required>
	
	
	<option value=""  >---Select Branch/Counter Name--</option>
<?php
									 if( $viewallaction==true){
										 ?>
					<option value="all"  >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 selected="selected" value="<?=  $maincategoryrow->id;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

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

		
	</div>
  </div>
  	 <div class="form-group">
    <label for="inputopeningbalance" class="col-sm-2 control-label">Opening balance</label>
    <div class="col-sm-10">
	
									<input type="text" name="openingbalance" value="0" id="openingbalance" class="form-control"  placeholder="Enter Opening balance">

			
	
        <span class="text-danger"><?php echo form_error('openingbalance'); ?></span>
	</div>
  </div>
  
    	 <div class="form-group">
    <label for="inputtotalsales" class="col-sm-2 control-label">TT Sales</label>
    <div class="col-sm-10">
	
									<input type="text" name="totalsales" value="0" id="totalsales" class="form-control"  placeholder="Enter total  sales">

			
	
        <span class="text-danger"><?php echo form_error('totalsales'); ?></span>
	</div>
  </div>
  <center> Summary Sales Details</center>
  <hr width="100%" style="height: 3px;color: #123455;background-color: #123455;border: none;">
   <div class="form-group" style="display:none">
    <label for="inputamount" class="col-sm-2 control-label">Cash Sales</label>
    <div class="col-sm-10">
				<input type="text" name="cash" value="0" id="cash" class="form-control" required placeholder="Enter cash">
        <span class="text-danger"><?php echo form_error('amount'); ?></span>
	</div>
  </div>
   <div class="form-group">
    <label for="inputmpesa" class="col-sm-2 control-label">Mpesa Sales</label>
    <div class="col-sm-10">
				<input type="text" name="mpesa" value="0" id="mpesa" class="form-control" required placeholder="Enter Mpesa">
        <span class="text-danger"><?php echo form_error('mpesa'); ?></span>
	</div>
  </div>
     <div class="form-group" style="display:none">
    <label for="inputcredit" class="col-sm-2 control-label">Credit Sales</label>
    <div class="col-sm-10">
				<input type="text" name="credit" value="0" id="credit" class="form-control" required placeholder="Enter credit amount">
        <span class="text-danger"><?php echo form_error('credit'); ?></span>
	</div>
  </div>
  <div class="form-group" style="display:none">
    <label for="inputcard" class="col-sm-2 control-label">Visa/Master Card Sales</label>
    <div class="col-sm-10">
				<input type="text" name="card" value="0" id="card" class="form-control" required placeholder="Enter card amount">
        <span class="text-danger"><?php echo form_error('card'); ?></span>
	</div>
  </div>
  
   <div class="form-group" style="display:none">
    <label for="inputcheque" class="col-sm-2 control-label">Cheque/Bank Sales</label>
    <div class="col-sm-10">
				<input type="text" name="cheque" value="0" id="cheque" class="form-control" required placeholder="Enter cheque amount">
        <span class="text-danger"><?php echo form_error('cheque'); ?></span>
	</div>
  </div>
  
  <div class="form-group"style="display:none" >
    <label for="inputpoints" class="col-sm-2 control-label">L Points Sales</label>
    <div class="col-sm-10">
				<input type="text" name="points" value="0" id="points" class="form-control" required placeholder="Enter points amount">
        <span class="text-danger"><?php echo form_error('points'); ?></span>
	</div>
  </div>
  
  
  
  
  
    <div class="form-group" style="display:none">
    <label for="inputvoucher" class="col-sm-2 control-label">Voucher Sales</label>
    <div class="col-sm-10">
				<input type="text" name="voucher" value="0" id="voucher" class="form-control" required placeholder="Enter voucher amount">
        <span class="text-danger"><?php echo form_error('voucher'); ?></span>
	</div>
  </div>
  
      <center> Expense Details</center>
  <hr width="100%" style="height: 3px;color: #123455;background-color: #123455;border: none; ">
  

    <div class="form-group">
    <label for="inputexpense" class="col-sm-2 control-label">Total Expense</label>
    <div class="col-sm-10">
	
									<input type="text" name="expense" value="0" id="expense" class="form-control"  placeholder="Enter total Expense">

			
	
        <span class="text-danger"><?php echo form_error('expense'); ?></span>
	</div>
  </div>
  
  
     <div class="form-group">
    <label for="inputsortmoney" class="col-sm-2 control-label">Advance</label>
    <div class="col-sm-10">
	
									<input type="text" name="sortmoney" value="0" id="tax" class="form-control"  placeholder="Enter Advance">

			
	
        <span class="text-danger"><?php echo form_error('sortmoney'); ?></span>
	</div>
  </div>
     
  
    <div class="form-group">
    <label for="inputtax" class="col-sm-2 control-label">Purchase</label>
    <div class="col-sm-10">
	
									<input type="text" name="tax" value="0" id="tax" class="form-control"  placeholder="Enter Purchase">

			
	
        <span class="text-danger">Cash to Purchase from shop<?php echo form_error('tax'); ?></span>
	</div>
  </div>
  
  
  
  <center> Other Details</center>
  <hr width="100%" style="height: 3px;color: #123455;background-color: #123455;border: none;">
  
     <div class="form-group">
    <label for="inputcashcollected" class="col-sm-2 control-label">Amount Colled (From Counter)</label>
    <div class="col-sm-10">
				<input type="text" name="cashcollected" value="0" id="cashcollected" class="form-control" required placeholder="Enter cash collected">
        <span class="text-danger"><?php echo form_error('cashcollected'); ?></span>
	</div>
  </div>
  <div class="form-group">
    <label for="inputclosingbalance" class="col-sm-2 control-label">Closing balance</label>
    <div class="col-sm-10">
	
									<input type="text" name="closingbalance" value="0" id="closingbalance" class="form-control"  placeholder="Enter Closing balance">

			
	
        <span class="text-danger"><?php echo form_error('closingbalance'); ?></span>
	</div>
  </div>
  
   	<div class="form-group">
    <label for="inputname" class="col-sm-2 control-label">Name? </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="name" value="<?php echo set_value('name'); ?>" class="form-control" required placeholder="Enter the person in charge">
		 
				
		<span class="text-danger">Person in charge <?php echo form_error('name'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">ID No </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="idno" value="<?php echo set_value('idno'); ?>" class="form-control"  placeholder="idno of person incharge ">
		 
				
		<span class="text-danger"> <?php echo form_error('idno'); ?>
		
		</span>
	</div>
  </div>
  <div class="form-group">
    <label for="inputcontact" class="col-sm-2 control-label">Contact </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="contact" value="<?php echo set_value('contact'); ?>" class="form-control"  placeholder="Phone of person incharge ">
		 
				
		<span class="text-danger"> <?php echo form_error('contact'); ?>
		
		</span>
	</div>
  </div>
  	<div class="form-group">
    <label for="inputcontroller" class="col-sm-2 control-label">Approved by? </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="controller" value="<?php echo set_value('controller'); ?>" class="form-control" required placeholder="Confirmed by?">
		 
				
		<span class="text-danger"> <?php echo form_error('controller'); ?>
		
		</span>
	</div>
  </div>
  
  
  
  
  
  
  
  
  	<div class="form-group">
    <label for="inputdatespent" class="col-sm-2 control-label">	Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="entrydate" value="<?php echo $mydate;?>" class="form-control" required placeholder="Enter date ">
		 
				
		<span class="text-danger"> <?php echo form_error('datespent'); ?>
		
		</span>
	</div>
  </div>
 

	<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">	Description</label>
    <div class="col-sm-10">

				<textarea name="description" value="<?php echo set_value('description'); ?>"  class="form-control"  required placeholder="Enter description"></textarea>
			
		<span class="text-danger"> <?php echo form_error('description'); ?>
		
		</span>
	</div>
  </div>
		

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="collections" name="btn_addcollections" class="btn btn-primary"> Add Collections   </button>

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

    

				</div>

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





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

			
			</div>
		</div>
  
  </div>
			
			
			
			<div id="colectionModal" 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">Collection Report</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
//$session_data = $this->session->userdata('logged_in');
 //$mydate=date("Y-m-d");
 					 // $mydate=date("Y-m-d H:i:s");
 $fromdate=date("Y-m-d 00:00:00");


				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewdailycollectionreport' , 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="branchid"  id="branchid" required>
	
	
	<option value=""  >---Select Branch/Counter Name--</option>
<?php
									 if( $viewallaction==true){
										 ?>
					<option value="all"  >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 selected="selected" value="<?=  $maincategoryrow->id;   ?>"><?=  $maincategoryrow->name; ?></option>



	<?php

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

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

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="event" name="btn_addevent" class="btn btn-primary"> View Collections</button>

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

    

				</div>

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

	
	
	
		
					             <div id="deltemyModal" 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">Delete</h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to delete 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/deletebyid' , 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="view" value="dailycollections">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/viewdailycollections">
 <input type="hidden" id="itemid1"name="itemid" class="itemid" placeholder="itemid" value=""><br>
          <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"> Delete  </button>

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

  </div>

  </div>
		
		
  

 
</div>


















