     
<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">
        	<div class="panel-heading">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>
						 <span class="pull-right"> View Daily Collections</span>					                    
						

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


 	<div class="print-hide" id="non-printable"  >
	<?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');
	
	?>
<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!" />
</div></div>
</form>
							</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="16" width="100%">
	<center>
					
										<?php $bussinessname=$configuration[0]['businessname']; if(isset($bussinessname)) {echo   $bussinessname; }?>
		</center>	
		</td>

			</tr>
         <tr>
      <th>#</th>
     <th>Date</th>
	   <th>Description</th>
	   <th>Cash </th> 
	  <th>Mpesa </th> 
	 <th>Card </th> 
	 	 <th>Cheque </th> 

	 	 <th>Credit </th> 
		 	 	 <th>Voucher </th> 
				  <th>Discount </th> 
				  <th>TT Expense </th> 
				 	  <th>Short </th> 
					  	  <th>Tax </th> 
		   <th>Name</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;
	  
	   $sortmoney=0;
	  $tax=0;
 if(!is_array($collections)) 

 {


 				   

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

		 

             ?>



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


  $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->description ; ?></td>
	 	<td><?php echo $c->cash; ?></td>
					 <td><?php echo $c->mpesa; ?></td>
					 					 <td><?php echo $c->card; ?></td>
					 <td><?php echo $c->cheque; ?></td>

										 <td><?php echo $c->credit; ?></td>
										 <td><?php echo $c->voucher; ?></td>
										 										 <td><?php echo $c->discount; ?></td>

										 		 <td><?php echo $c->expense; ?></td>
												 <td><?php echo $c->sortmoney; ?></td>
													<td><?php echo $c->tax; ?></td>

	   <td><?php echo $c->name ; ?></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>	



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

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

 
</div>


















