

 <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">
  
			  $(function() {
<!--             $(".datepicker").datepicker(); -->
<!--             $(".uniform_on").uniform() -->;
            $(".chzn-select").chosen();
   <!--          $('.textarea').wysihtml5(); -->

        });

		 $(document).ready(function() { 
			   $("#days").hide();
           

					});
						 

						         $(function () {
        $("#reporttype").change(function () {
            if ($(this).val() == "Aging") {
            
			
               $("#days").show();
              					   $("#todate").hide();
          

            } else {
 $("#days").hide();
              					 
								 $("#todate").show();

            
			
            }
        });
    });
		
					
					
					
					
					
		
    </script>  

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

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

		    // document.body.innerHTML = originalContents;

	}
}
	</script>

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

    #myprint { display: none; }
#print{  	


    background-repeat: no-repeat;
	font-size;20px;
  
    width:100%; 


}

#sale{  	


    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">
	<?PHP
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;
					}
					 $fromdate=date("Y-m-d 00:00:00");
					  $mydate=date("Y-m-d H:i:s");

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

	 $updateaction=$this->usermodel->populatuserpermissionsdataarray('reports','update',$userid);
  $updatebuyingpriceaction=$this->usermodel->populatuserpermissionsdataarray('reports','update',$userid);
  $deleteaction=$this->usermodel->populatuserpermissionsdataarray('reports','delete',$userid);
	 
			    $cashiersales=$this->usermodel->populatuserpermissionsdataarray('cashiersales','all',$userid);
			    $cashierreprint=$this->usermodel->populatuserpermissionsdataarray('sales','reprint',$userid);
						$updatepaymentmode=$this->usermodel->populatuserpermissionsdataarray('sales','updatepaymentmode',$userid);
 	 $wiewinvoices=$this->usermodel->populatuserpermissionsdataarray('incomeexpenses','wiewinvoices',$userid);
	      $viewbills=$this->usermodel->populatuserpermissionsdataarray('incomeexpenses','viewbills',$userid);
  $viewdebtors=$this->usermodel->populatuserpermissionsdataarray('incomeexpenses','viewdebtors',$userid);
  $viewcreditors=$this->usermodel->populatuserpermissionsdataarray('incomeexpenses','viewcreditors',$userid);
    $viewexpense=$this->usermodel->populatuserpermissionsdataarray('incomeexpenses','viewexpense',$userid);

  $addpeople=$this->usermodel->populatuserpermissionsdataarray('members','add',$userid);
  		$viewallcounters=$this->usermodel->populatuserpermissionsdataarray('cashiersales','viewallcounters',$userid);

  
  
  $smsconfig = $this->usermodel->populateallarray('smsconfig','id',$companyid);
	  $starttime=$smsconfig[0]['starttime'];
		 $duetime=$smsconfig[0]['duetime'];
  
  
  
  
  
  
  
				echo $this->session->flashdata('msg'); 
								?>	
  
		<div class="panel panel-default" data-collapsed="0">
        	<div class="panel-heading" id="non-printable" id="non-printable">
            	<div class="panel-title" id="redcolor" >
            		<i class="entypo-plus-circled"></i>
	

	 

				 <span class="pull-right"> View All invoices</span>
				 	  	  			 
						  <?php

 if( $viewexpense==true){
 ?>
 						 <a href="<?php echo base_url();?>user/viewexpenses" class="btn btn-default"> View Expense</a>

 
<?php	
}
  ?>
 <?php

 if( $viewbills==true){
 ?>
 						 <a href="<?php echo base_url();?>user/paybill" class="btn btn-default"> Pay bills</a>

 
<?php	
}
  ?>
	  <?php

 if( $wiewinvoices==true){
 ?>
 	  	  				 	  	  				 <a href="<?php echo base_url();?>user/allinvoices" class="btn btn-default"> All Invoices</a>
	  	  				 <a href="<?php echo base_url();?>user/incoicepayments" class="btn btn-default"> Receive Payments</a>

 
<?php	
}
  ?>
	  <?php

 if( $viewdebtors==true){
 ?>
 	  	  				 <a href="<?php echo base_url();?>user/allcreditors" class="btn btn-default"> All Debtors</a>

 
<?php	
}
  ?>
	  <?php

 if( $viewcreditors==true){
 ?>
 						 	  	  				 <a href="<?php echo base_url();?>user/viewallcreditors" class="btn btn-default"> All Creditors</a>

 
<?php	
}
  ?>
	  <?php

 if( $addpeople==true){
 ?>
                         <a data-toggle='modal' data-target='#addsupplierModal' class="btn btn-default">Add Campany </a>

 
<?php	
}
  ?>
	  					
				 				 	  <a data-toggle='modal' data-target='#purchaseModal' class="btn btn-default">Search for aged Reports</a>

All invoices
				 <div class="pull-right"  >
<form name="print" method="post" action="">
 <input type="submit" id="print"  accesskey="p" class="btn btn-default"  name="print"onclick="printDiv('sortable_table')" value="print receipt!" />

 </form></div>
            	</div>
            </div>
			
	<div class="widget-content nopadding table_holder table-responsive" >				
			
					<div class="row">
						<div class="col-md-12" id="sortable_table">
							<center>	<b>	<?php  if(isset($title)) {echo $title; }   ?></b>	</center>
							<div class="panel-body">
			
									
  <table cellpadding="0" cellspacing="0" border="0" class="table  table-striped" id="example" style="border-color:#CCCCCC; width:100%;"  >

             <thead>
			 
			  <tr>
						
								<td colspan="4" ><center  >
								
						
									

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


$data['surname'] = $session_data['surname'];
$data['id'] = $session_data['id'];

$surname=$data['surname'];
   $userid=$data['id'];
   $fiscalyear=$this->usermodel->populateallarray('fiscalyear','status', "active");
	$startdateyear=$fiscalyear[0]['startdate'];
								
								
    $startdate = date('Y-m-01 00:00:00');
		   
		   //
		   
		   
		   $enddate = date('Y-m-d H:i:s');
		      $enddate1 = date('Y-m-d 23:59:59');

										$bussinessname=$configuration[0]['businessname']; if(isset($bussinessname)) {echo   $bussinessname; }
							$mysupplier=$this->usermodel->populateallarray('people','id', $userid);
								$customername=$mysupplier[0]['firstname'];
										?>
												<span id="mytitle"><b> </BR>DEBTORS REPORT </b>		
								
								<br><b>Printed by: <?php echo $customername;  ?>----Signature--------</b></span>

								</center></td>
																	<td id="non-printable"></td>

								
							</tr>
         <tr>
		  <th>Customer ID</th>  
															  <th>Customer Name</th>                            


														<th> Expected Total</th> 
														<th> Paid</th>
                                              <th> Bal</th>   
										                     

								
  <th id="non-printable">More</th>    

                 </tr>
             </thead>
<?php



 if(!is_array($salesreport)) {
				    echo '<div class="alert alert-danger text-center">No data found</div>';

			 }else{
 if(!is_array($salesreport)) 

 {


   echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='1'>";
    
       echo '<div class="alert alert-warning text-center">There no records found..</div>';
    echo "</td>";
   echo "</tr>";
    }else {
?>
    
             <?php 
  $total=0; 
    $totalcash=0; 
		  $totaltax=0; 
$totalmpesa=0;		  
$ttpaid=0;

$totalcredit=0;		  




  	foreach ($salesreport as $c): 


             ?>



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

?>

	    <td><?php echo $c->customer; ?></td>  
<td>
 
  <?php  $userids= $c->customer ;
  
    if($userids!=""){

$myuser=$this->usermodel->getpeople($userids);
    $myname=$myuser[0]['company'];
	    $phone=$myuser[0]['phone'];

     $firstname=$myuser[0]['firstname'];
   if($myname!=""){
	   echo $myname."-".$phone;
	   
   }else{
	   
	   echo $firstname."-".$phone; 
	   
   }
	}else{
		echo $name= $c->name;
		
	}

  ?>
 
 
 </td>
 
 <td>
 <?php
  echo formatMoney($c->total , true);
 $ttbaklance=$c->total-$c->credit;
 $ttpaid=$ttpaid+ $ttbaklance;
 $totalcredit=$totalcredit+$c->credit ;	
 ?> 
 
 </td>
    <td><?php echo formatMoney($ttbaklance,true); ?></td>
   
												  <td><?php  echo formatMoney($c->credit , true); ?></td>
											

 <td id="non-printable">

 
 
					<div class="btn-group">
                                    <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
                                        More <span class="caret"></span>
                                    </button>
									
                                    <ul class="dropdown-menu dropdown-default pull-right" role="menu">
                                    
									

  <li>
                     <a  id="more" target="_blank" class="btn btn-info" href="<?php echo base_url();?>user/getinvoivebysupplier?randomitemidentifier=<?php   {echo  $userids;}  ?>">Pending Invoices  </a>

</li>
  </br>
  
  
  
    <li>
                     <a  id="more" target="_blank" class="btn btn-info" href="<?php echo base_url();?>user/getallinvoivebysupplier?randomitemidentifier=<?php   {echo  $userids;}  ?>">All Invoices  </a>
</li>
  
    </br>        
		    <li>
                     <a  id="more" target="_blank" class="btn btn-info" href="<?php echo base_url();?>user/viewallstatements?randomitemidentifier=<?php   {echo  $userids;}  ?>&startdate=<?php   {echo  $startdateyear;}  ?>&enddate=<?php   {echo  $enddate1;}  ?>&supplier=<?php   {echo  $userids;}  ?>&type=Customer&bankname=bankname&reporttype=summary">Customer Statement  </a>
</li>
    </br>
          
  
  
  
  
                                    </ul>
										
                                </div>
</td>
         
             </tr>

	<?php endforeach;} ?>
	
       <tfoot>
	   
								<tr border="1" background="green">
									<td colspan='2'><center><b>Expected  Amount:</b></center></td>
									<td><b>
		<?php if(isset($total)) {echo formatMoney($total, true);  }?>
		<b></td>

		<td>  <b><?php if(isset($ttpaid)) {echo formatMoney($ttpaid, true);  }?><b></td>
	<td>  <b><?php if(isset($totalcredit)) {echo formatMoney($totalcredit, true);  }?><b></td>

		<td	id="non-printable"></td>
			
			
</tr>
	       </tfoot>

	
	
              <?php }?>
 
        </table>
		 <div class="col-md-12 text-center">  <?php if(isset($links)) {echo $links; }?>
					   		<span style="color:red; font-size:20px"> <?php if(isset($total_rows)) {echo $total_rows . "   Records. " ;; }?>  </span>

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




	<div id="purchaseModal" 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">Invoice Report by date</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
				

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

				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewagingreport' , 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( $viewallcounters==true){
										 ?>
					<option value="all"  >All branches/Counters</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.';
}
 }else{
?>
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('branch','id',$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="inputreporttype" class="col-sm-2 control-label">Report type?</label>
    <div class="col-sm-10">
	<select class="form-control" name="reporttype" required id="reporttype">
	
	<option value=""  >---Select your option---</option>

		<option value="all"  >-Normal Report-</option>
			<option value="Aging" selected="selected" >--Aging report(Due Dates)</option>

</select>
		

	</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($frommydate))); ?>" 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>
			

			
	 <div id="todate">
			
						    <label for="inputtodate" 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($mydate))); ?>" 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>
  
	
	 <div class="form-group" id="days">
    <label for="inputduration" class="col-sm-2 control-label">Days/Duration?</label>
    <div class="col-sm-10">
	<select class="form-control" name="duration" required>
	
	<option value=""  >---Select Days/Duration---</option>

		<option value="0"  >-Current(Due today)-</option>
		<option value="30" selected="selected" >-Due Past  30 days</option>
		<option value="60"  >-Due Past  60 days</option>
		<option value="90"  >-Due Past  90 days</option>
		<option value="120"  >-Due Past 120 days</option>
		<option value="150"  >-Due Past 150 days</option>
		<option value="180"  >-Due Past 180 days</option>
		<option value="210"  >-Due Past 210 days</option>
		<option value="240"  >-Due Past 240 days</option>
		<option value="270"  >-Due Past 270 days</option>
		<option value="300"  >-Due Past 300 days</option>
		<option value="360"  >-Due Past 360 days</option>
		<option value="720"  >-Due Past 2 Years</option>
		<option value="1080"  >-Due Past 3 Years</option>
		<option value="1440"  >-Due Past 4 Years</option>
		<option value="1800"  >-Due Past 5 Years</option>
				<option value="1801"  >-Due Over 5 Years</option>


</select>
		

	</div>
  </diV>
	
	
	
	
	
	

  
  
    <div class="form-group">
    <label for="inputsupplier" class="col-sm-2 control-label">customer?</label>
    <div class="col-sm-10">
	<select class="form-control" name="supplier" required>
	
	<option value=""  >---Select customer---</option>

		<option value="all" selected="selected"  >--I want view all/any invoice---</option>
	<?php 
					 
			//$mysuppliers =  $this->usermodel->populatemysupplier($companyid);
								//$mysuppliers= $this->usermodel->populateall('people','companyid',$companyid);
			$mysuppliers  = $this->usermodel->populatealldatanoarrayorderby('people','company','ASC','category','member','companyid', $companyid);


	
if(is_array($mysuppliers)) {

   foreach($mysuppliers as $suppliersrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $suppliersrow->id;   ?>"><?=  $suppliersrow->company ."(". $suppliersrow->firstname ."- ".$suppliersrow->phone.")"; ?></option>



	<?php

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

	</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=""  >---Select your option---</option>

		<option value="no" selected="selected" >--I want to view the invoice---</option>
			<option value="yes"  >--I want to download the invoices---</option>

</select>
		

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

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="event" name="btn_invoice" class="btn btn-default"> View invoice  </button>

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

    

				</div>

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





	<div id="purchaseModal222" 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">Invoice Report by date</h4>
      </div>
      <div class="modal-body">
      
	  	

				<?PHP
				

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

				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewagingreport' , 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="inputreporttype" class="col-sm-2 control-label">Report type?</label>
    <div class="col-sm-10">
	<select class="form-control" name="reporttype" required id="reporttype">
	
	<option value=""  >---Select your option---</option>

		<option value="all" selected="selected" >-Normal Report-</option>
			<option value="Aging"  >--Aging report(Due Dates)</option>

</select>
		

	</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($frommydate))); ?>" 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>
			

			
	 <div id="todate">
			
						    <label for="inputtodate" 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($mydate))); ?>" 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>
  
	
	 <div class="form-group" id="days">
    <label for="inputduration" class="col-sm-2 control-label">Days/Duration?</label>
    <div class="col-sm-10">
	<select class="form-control" name="duration" required>
	
	<option value=""  >---Select Days/Duration---</option>

		<option value="0" selected="selected" >-Current(Due today)-</option>
		<option value="30"  >-Due Next  30 days</option>
		<option value="60"  >-Due Past  60 days</option>
		<option value="90"  >-Due Past  90 days</option>
		<option value="120"  >-Due Past 120 days</option>
		<option value="150"  >-Due Past 150 days</option>
		<option value="180"  >-Due Past 180 days</option>
		<option value="210"  >-Due Past 210 days</option>
		<option value="240"  >-Due Past 240 days</option>
		<option value="270"  >-Due Past 270 days</option>
		<option value="300"  >-Due Past 300 days</option>
		<option value="360"  >-Due Past 360 days</option>
		<option value="361"  >-Due Over 361 days</option>
		<option value="91"  >-Due Over  91 days</option>

</select>
		

	</div>
  </diV>
	
	
	
	
	
	

  
  
    <div class="form-group">
    <label for="inputsupplier" class="col-sm-2 control-label">supplier?</label>
    <div class="col-sm-10">
	<select class="form-control" name="supplier" required>
	
	<option value=""  >---Select supplier---</option>

		<option value="all" selected="selected"  >--I want view all/any invoice---</option>
	<?php 
					 
			//$mysuppliers =  $this->usermodel->populatemysupplier($companyid);
								//$mysuppliers= $this->usermodel->populateall('people','companyid',$companyid);
			$mysuppliers  = $this->usermodel->populatealldatanoarrayorderby('people','company','ASC','category','supplier','companyid', $companyid);


	
if(is_array($mysuppliers)) {

   foreach($mysuppliers as $suppliersrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $suppliersrow->id;   ?>"><?=  $suppliersrow->company ."(". $suppliersrow->firstname ."- ".$suppliersrow->phone.")"; ?></option>



	<?php

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

	</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=""  >---Select your option---</option>

		<option value="no" selected="selected" >--I want to view the invoice---</option>
			<option value="yes"  >--I want to download the invoices---</option>

</select>
		

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

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="event" name="btn_invoice" class="btn btn-default"> View invoice  </button>

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

    

				</div>

		</div>
	    </div>
    </div>	
	
	<div id="deleteModel" 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('logged_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="table" value="sales">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/allinvoices">
 <input type="hidden" id="itemid1"name="itemid" class="itemid" placeholder="itemid" value=""><br>
 <button type="button" class="btn btn-default" data-dismiss="modal">No</button>
 		  	         <button type="submit" name="btn_delete" value="deletebyid" class="btn btn-danger"> Remove  </button>

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

  </div>

  </div>		
	
	
	
	
	
	
	
	
	
	
	
	
			<div id="userModal" 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">Sales Report per user</h4>
      </div>
      <div class="modal-body">
      


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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewgroupreceiptreportbyuser' , 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="type" value="all" class="form-control"  placeholder="Enter type">

  <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"  >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>
	
	
				  		<input type="hidden" name="view" value="viewgroupreceiptreport" class="form-control" required placeholder="Enter sales type">

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

						<?php
		
		 if($cashiersales==true){
			$allusers = $this->usermodel->populateall('people', 'companyid',$companyid);
	

 }else{
			$allusers = $this->usermodel->populateall('people', 'id',$userid);

 
  
 }
  ?>

	
	
	
	<?php 
				
				
	

	
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="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',$fromdate); ?>" 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',$mydate); ?>" 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="inputdisplay" class="col-sm-2 control-label">Dispaly type?</label>
    <div class="col-sm-10">
	<select class="form-control" name="display" required>
	<option  value="all"  >---Do you want to print user z-report--</option>
	<option value="yes" >Yes</option>
<option selected="selected" value="no">No i want to just view sales</option>

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

	</div>
  </div>
   

	 <div class="form-group">
    <label for="inputviewmaincategory" class="col-sm-2 control-label">Department Category?</label>
    <div class="col-sm-10">
	<select class="form-control" name="maincategory"  id="maincategory" required>
	
	<option selected="selected" value="all"  >---All/Any Category--</option>

	
	<?php 
					 
					 		$maincategory = $this->usermodel->populateall('maincategory','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 category available.';
}
	
?>
</select>
		
						<span class="text-danger"><?php echo form_error('maincategory'); ?>

	</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-default"> View Sales  </button>

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

    

				</div>

		</div>
	    </div>
    </div>
			<div id="deleteModel" 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('logged_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="table" value="sales">

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

 
</div>


















