<link href="<?php echo base_url(); ?>assets/autocomplete/jquery-ui.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>assets/autocomplete/ui.theme.css" rel="stylesheet">
    <link href="<?php echo base_url(); ?>assets/autocomplete/autocomplete.css" rel="stylesheet">
    <script src="<?php echo base_url(); ?>assets/autocomplete/jquery-ui.min.js"></script>

        <script type="text/javascript">  
		
			   $(this).ready( function() {  
            $("#product").autocomplete({  
 
                minLength: 1,  
                source:   
                function(req, add){  
                    $.ajax({  
                             url: "<?php echo base_url(); ?>/Systemusers/productlookup",  
                        dataType: 'json',  
                        type: 'POST',  
                        data: req,  
                        success:      
                        function(data){  
                            if(data.response =="true"){  
                                add(data.message);  
                                console.log(data);
                            }  
                        },  
                    });  
                },  
                     
            });  
        });
					   $(this).ready( function() {  
            $("#myproduct").autocomplete({  
 
                minLength: 1,  
                source:   
                function(req, add){  
                    $.ajax({  
                             url: "<?php echo base_url(); ?>/Systemusers/productlookup",  
                        dataType: 'json',  
                        type: 'POST',  
                        data: req,  
                        success:      
                        function(data){  
                            if(data.response =="true"){  
                                add(data.message);  
                                console.log(data);
                            }  
                        },  
                    });  
                },  
                     
            });  
        });
		
		 $(document).on("click", "#managebtndelete", function()
        {
          var itemid = $(this).data('id');
		  $("#itemid1").val(itemid); 
		  
		  
		   
        });
		
		 $(document).on("click", "#managebtnreturn", function()
        {
     var mycategoryid = $(this).data('id');
		  $("#mycategoryid").val(mycategoryid); 
		  
		     var qty = $(this).data('qty');
		  $("#qty").val(qty); 
		    var origin = $(this).data('origin');
		  $("#origin").val(origin); 
		      var status = $(this).data('status');
		  $("#status").val(status); 
		  
     var invoice = $(this).data('invoice');
		  $("#invoice").val(invoice); 
		  
		  
     var details = $(this).data('details');
		  $("#details").val(details); 
		  
		     var dateleased = $(this).data('dateleased');
		  $("#dateleased").val(dateleased); 
		    var duedate = $(this).data('duedate');
		  $("#duedate").val(duedate); 
		      var amount = $(this).data('amount');
		  $("#amount").val(amount); 
		       var mode = $(this).data('mode');
		  $("#mode").val(mode); 
			       var destination = $(this).data('destination');
		  $("#destination").val(destination); 
		  	       var incharge = $(this).data('incharge');
		  $("#incharge").val(incharge); 
		        var receiver = $(this).data('receiver');
		  $("#receiver").val(receiver); 
		  
		      var receiveridno = $(this).data('receiveridno');
		  $("#receiveridno").val(receiveridno); 
		   var receiverphone = $(this).data('receiverphone');
		  $("#receiverphone").val(receiverphone); 
		     var receiveremail = $(this).data('receiveremail');
		  $("#receiveremail").val(receiveremail); 
		     var receiveraddress = $(this).data('receiveraddress');
		  $("#receiveraddress").val(receiveraddress);
 var totalvalue = $(this).data('totalvalue');
		  $("#totalvalue").val(totalvalue);
 	 var dateposted = $(this).data('dateposted');
		  $("#dateposted").val(dateposted);	 
 var branchfrom = $(this).data('branchfrom');
		  $("#from").val(branchfrom);			  
  var riderdetails = $(this).data('riderdetails');
		  $("#riderdetails").val(riderdetails);			  
 
 
		  
		  
		  
		  
        });
		
		
		
		
		
		
		
		
		     	   $(this).ready( function() {  
            $("#myuser").autocomplete({  
 
                minLength: 1,  
                source:   
                function(req, add){  
                    $.ajax({  
                        url: "<?php echo base_url(); ?>Systemusers/customerSaleslookup",  
                        dataType: 'json',  
                        type: 'POST',  
                        data: req,  
                        success:      
                        function(data){  
                            if(data.response =="true"){  
                                add(data.message);  
                                console.log(data);
                            }  
                        },  
                    });  
                },  
                     
            });  
        });
		
		
  
		
			   $(this).ready( function() {  
            $("#incharge").autocomplete({  
 
                minLength: 1,  
                source:   
                function(req, add){  
                    $.ajax({  
                        url: "<?php echo base_url(); ?>Systemusers/customerSaleslookup",  
                        dataType: 'json',  
                        type: 'POST',  
                        data: req,  
                        success:      
                        function(data){  
                            if(data.response =="true"){  
                                add(data.message);  
                                console.log(data);
                            }  
                        },  
                    });  
                },  
                     
            });  
        });
		
		
    </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 Delivery Reports  </span>
	  <a data-toggle='modal' data-target='#addModal' class="btn btn-info">Add new Delivery  </a>
	  <a data-toggle='modal' class="btn btn-primary" data-target='#addsupplierModal' class=" btn-info"> Add Customer</a>
<!--
				 <a data-toggle='modal' data-target='#viewuserModal' class="btn btn-default">Detailed Report   </a>
				

-->				<a data-toggle='modal' data-target='#usersummaryModal' class="btn btn-default">Summary Report   </a>
					

            	</div>
            </div>
			<div class="panel-body">

			
	<div class="widget-content nopadding table_holder table-responsive" >				
				<?PHP
 $mydate=date("Y-m-d H:i:s");
 //     echo $this->session->flashdata('deletemsg'); 

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;
					}
					 $finalstartdate=date("Y-m-d 00:00:00");
					  $finalendate=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'];	
	 		 $data['surname'] = $session_data['surname'];
	 $username = $data['surname'];	
	 
	 	 $smsconfig = $this->usermodel->populateallarray('smsconfig','id',$companyid);
		 		$currenttime = date('H:i');

		    $mydate=date("Y-m-d H:i:s");

  	$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;
		 }
		 
		 
		 
		 
		 
		 
		 
		 						$updatepaymentmode=$this->usermodel->populatuserpermissionsdataarray('sales','updatepaymentmode',$userid);

		 
	 
	    $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);
			    $pendingmpesareports=$this->usermodel->populatuserpermissionsdataarray('cashiersales','mpesapendingreport',$userid);
				
				
	   $viewallaction=$this->usermodel->populatuserpermissionsdataarray('reports','viewall',$userid);
	   
	   
	   	   $viewdailycollections=$this->usermodel->populatuserpermissionsdataarray('cashiersales','viewdailycollections',$userid);

		   	   $adddailycollection=$this->usermodel->populatuserpermissionsdataarray('cashiersales','adddailycollection',$userid);
		   	   $clearallsales=$this->usermodel->populatuserpermissionsdataarray('cashiersales','clearallsales',$userid);
		   	   $viewtill=$this->usermodel->populatuserpermissionsdataarray('cashiersales','viewtill',$userid);
	      $selecttable=$this->usermodel->populatuserpermissionsdataarray('sales','selecttable',$userid);
		  		  	      $leaseitems=$this->usermodel->populatuserpermissionsdataarray('sales','leaseitems',$userid);

	      $viewreports=$this->usermodel->populatuserpermissionsdataarray('accomodation','viewreports',$userid);

				echo $this->session->flashdata('msg'); 
				?>
					<div class="row">
						<div class="col-md-12">
							<div class="col-md-12">
        <?php 
		$mypage=0;
		if(isset($page)) {$mypage=$page;}else{$mypage=0;}
        $attr = array("class" => "form-horizontal", "role" => "form", "id" => "search", "name" => "search");
        echo form_open("", $attr);?>
            <div class="form-group">

                <div class="col-md-3">
                    <input class="form-control" autofocus id="searchterm" name="searchterm" placeholder="Search for product by name, code,description.." type="text" value="<?php echo set_value('searchterm'); ?>" />
                </div>
				
					   <div class="col-md-2">
				   <select class="form-control"name="searchtype"  >
	
	<option value=""  >---Select way of search items---</option>

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

   <option value="Specific"  >Specific item</option>

   

</select>		
	
                </div>
                <div class="col-md-3">
                    <input id="btn_search" name="btn_search" type="submit" class="btn btn-default" value="Search" />
                    <a href="<?php echo base_url(). "user/viewparceldelivery"; ?>" class="btn btn-default">Refresh</a>

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

        </div>
					
							<div class="panel-body">
	
									
				<table class="tablesorter table table-bordered  table-hover" id="sortable_table">			

             <thead>
         <tr>
  									<th>Serial/Ref No </th>
									<th>Customer / Receiver </th>
	<th> Amount </th>
	
					<th>Dispatch to
					</th>
	<!--
								<th>Type </th>
								
									  -->
								
									

									
									
									<th>Receiver Phone </th>
									<!--
									
									<th>Receiver Address </th>
									-->
			<th>Origin </th>
					<!--	<th>Weight </th>
				<th>Qty </th>
						-->
							<th> Description /Payment Details </th>
	<th>Status </th>
		
			<th> Date </th>
													<th>From Branch </th>
														<th>To Branch </th>
		<th> User </th>
	
	
				
			<th>More</th>
		


                 </tr>
             </thead>
<?php
  $ttamount=0;
    $TTQTY=0;
 if(!is_array($viewlease)) 

 {


   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 

  	foreach ($viewlease as $c): 

		 

             ?>



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


  $ttamount=  $ttamount+$c->amount;
  $TTQTY=  $TTQTY+$c->qty;
$myinvoice=$c->invoice;
$customer=$c->customer;
$invoice_number=$c->invoice;

?>


              
  <td>
  	  	  	  	 <a  id="more" class=" btn-default"  href="<?php echo base_url();?>user/editparceldelivery?randomitemidentifier=<?php   {echo  $invoice_number;}  ?>"><?php echo $c->invoice  ;  ?></a>

  
  				 <a  id="non-printable"  href="<?php echo base_url();?>user/printparcelitem?invoice=<?php   if(isset($myinvoice)) {echo $myinvoice; } ?>&view=user/viewparceldelivery&customer=<?php   if(isset($customer)) {echo $customer; } ?>"> Print   </a>

  
  
  
  </td>
      <td><?php
	

	echo $c->receiver ;
	
	; ?></td>

	    <td><?php echo $c->amount ; ?></td>
		   	   	  <td><?php echo $c->destination ; ?></td>
 	<!--	
   <td><?php echo $c->type  ; ?></td>
   
   	  -->
 


	   	  <td><?php echo $c->receiverphone ; ?></td>
	   	<!--	  <td><?php echo $c->receiveraddress ; ?></td>
-->
	  <td><?php echo $c->origin ; ?></td>
<!--
 <td><?php echo $c->weight ; ?></td>
	   	  <td><?php echo $c->qty ; ?></td>
		  
		  -->
	   	  <td><?php echo $c->details ; ?></td>

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


	   	

	  
	  
	  
	  
	      <td><?php 
echo $c->dateposted ;

    		  $newDate = date('Y-m-d H:i:s');

	  //$newDate = date("Y-m-d");


		//$mycurrentdate = strtotime(date($newDate));

			//$mycurrentdate = strtotime(date($newDate));



		$mycurrentdate = strtotime(date($newDate));


	//$mycurrentdate = strtotime(date($newDate));





$finaldate = strtotime(date($c->dateposted));

									$secs =$mycurrentdate- $finaldate;// == <seconds between the two times>
									$days = $secs / 86400;
							 $finaldays=round($days,0);

if(($c->status=="Delivered") || ($c->status=="Delivered"))  {
	
	
}else{

		
			 
	
			if($finaldays <= 0){
			
			?>
			<div class="btn-success">
			<?php  echo $finaldays." Due"  ; 	?>
			</div>
			<?php
			}else if(($finaldays > 0) && ($finaldays <3)) {
		?>
			<div class="btn-warning">
			<?php  echo $finaldays." Overdue"  ; 	?>
			</div>
			<?php
			
			}else if($finaldays >=3){
			?>
			<div class="btn-danger">
			<?php  echo $finaldays." Overdue" ; 	?>
			</div>
			<?php
			}
}
			?>	
			 
			 
			 
			 
			 </td>
	  
	  
	  
	  
	  


    <td><?php 
	
								 
 
					// $branch="";
					 $branch=$c->branchfrom;

					 $branch= $this->usermodel->populateall('branch','id',$branch);



if(is_array($branch)) {

   foreach($branch as $branchrow){

   echo $branchrow->name;
 
 
}} else {
    echo 'Store';
}
	
?>
	
	
</td>



<td><?php 
	
								 
 
					// $branch="";
					 $mybranchid=$c->branchid;

					 $mybranch= $this->usermodel->populateall('branch','id',$mybranchid);



if(is_array($mybranch)) {

   foreach($mybranch as $mybranchrow){

   echo $mybranchrow->name;
 
 
}} else {
    echo 'Store';
}
	
?>
	
	
</td>

	 <td><?php  $userids= $c->userid ;

$myuser=$this->usermodel->geteuser($userids);
   echo $myname=$myuser[0]['firstname'];

  ?></td>
 
   <td>
 
 
					<div class="btn-group">
                                    <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-toggle="dropdown">
                                        More <span class="caret"></span>
                                    </button>
								
                                    <ul class="dropdown-menu dropdown-primary pull-right" role="menu">
                                        
	<li> 
 <a class="btn btn-warning managebtn" id="managebtnreturn"  data-riderdetails='<?php echo  $c->riderdetails;?>' data-branchfrom='<?php echo  $c->branchfrom;?>' data-dateposted='<?php echo  $c->dateposted;?>' data-totalvalue='<?php echo  $c->totalvalue;?>' data-receiveraddress='<?php echo  $c->receiveraddress;?>' data-receiveremail='<?php echo  $c->receiveremail;?>'  data-receiverphone='<?php echo  $c->receiverphone;?>' data-receiveridno='<?php echo  $c->receiveridno;?>' data-receiver='<?php echo  $c->receiver;?>'  data-incharge='<?php echo  $c->customer;?>'  data-destination='<?php echo  $c->destination;?>'data-invoice='<?php echo  $c->invoice;?>' data-mode='<?php echo  $c->mode;?>' data-details='<?php echo  $c->details;?>' data-dateleased='<?php echo  $c->dateposted;?>' data-duedate='<?php echo  $c->duedate;?>' data-amount='<?php echo  $c->amount;?>' 	   data-status='<?php echo  $c->status;?>' data-origin='<?php echo  $c->origin;?>' data-qty='<?php echo  $c->qty;?>'	 data-id='<?php echo  $c->id;?>'    data-toggle='modal' data-target='#UPDATEModal<?php  $c->id; ?>'>	 


                                                <i class="glyphicon glyphicon-pencil"></i>
																Update Status
                                                </a>
                                                        </li>                                        
											<?php
										if($usertype=="admin"){
											
											?>
											   <li class="divider"></li>
											  <li> 
										 <a class="btn btn-danger managebtn" id="managebtndelete"		 data-id='<?php echo  $c->id;?>'    data-toggle='modal' data-target='#deleteModal<?php  $c->id; ?>'>	 


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

	<?php endforeach;} ?>
<tr>
<td COLSPAN="2">
<B>TOTAL AMOUNT:
</B>
</td>
<td>
<B>
<?php echo   formatMoney($ttamount, $fractional=false)  ; ?>
</B>
</td>

<td COLSPAN="9">
<B>
<?php echo $TTQTY ; ?>
</B>
</td>
</tr>

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

        
        </div>
	</div>

	
	<div id="deleteModal" 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="view" value="parceldelivery">

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/viewparceldelivery">
 <input type="hidden" id="itemid1"name="itemid" class="itemid" placeholder="itemid" value=""><br>
 <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 id="viewuserModal" 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">Delivery 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/viewleaseditemsbyuser' , 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->populatealldatanoarraythree('people', 'companyid',$companyid,'status',1,'category','user');
	?>
		<option value="all" selected >-All users-</option>

	<?php

 }else{
				 			$allusers = $this->usermodel->populatealldatanoarraythree('people', 'userid',$userid,'status',1,'category','user');

 
  
 }
  ?>

	
	
	
	<?php 
				
				
	

	
if(is_array($allusers)) {

   foreach($allusers as $userrow){

   //echo $courserow->coursename;
    ?>
					<option value="<?=  $userrow->id;   ?>"><?=  $userrow->firstname ."- ".$userrow->surname ."(". $userrow->email.")"; ?></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="inputstatus" class="col-sm-2 control-label">Product Status?</label>
    <div class="col-sm-10">
	<select class="form-control" name="status"  required>
			<option value=""></option>

		<option value=""  >---Select Product Status---</option>
						<option value="all"   selected="selected"   >--ALL-</option>

		<option value="Dispatched"      >Dispatched</option>


			<option value="Undispatched"   >Undispatched</option>


			<option value="Failed Delivery"   >Failed Delivery</option>

		<option value="Returned and Received"  >Returned and Received</option>
		<option value="Returned"  >Returned</option>


 		<option value="Delivered"  >Delivered</option>



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

	</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="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($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=""  ></option>

	<option value=""  >--Do you want to group items on the report-</option>

	<option value="No" selected="selected" >No</option>
	<option value="Yes"  >Yes</option>



</select>
		

	</div>
  </div>


<div class="form-group">
    <label for="inputproduct" class="col-sm-2 control-label">	Product name :  </label>
    <div class="col-sm-10">
	
		  		<input type="text" required name="product" id="myproduct" value="<?php echo set_value('product','all'); ?>" class="form-control"  placeholder="Search item by name, code,serial No etc">
		 
				
		<span class="text-danger"> <?php echo form_error('product'); ?>
		
		</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-default"> View Delivery Items  </button>

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

    

				</div>

		</div>
	    </div>
    </div>
	
	
	
	
	
	
			<div id="viewfastslowmovingModal" 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"> Delivery status report </h4>
      </div>
      <div class="modal-body">
      


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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewleaseditemsmovement' , 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">Branch</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>
	
  
  <div class="form-group">
    <label for="inputmovement" class="col-sm-2 control-label">Movement </label>
    <div class="col-sm-10">
	<select class="form-control" name="movement"  required>

	<option value=""  >--Select Movement type-</option>

	<option value="Slow">Slow</option>
	<option value="Fast"   selected="selected"  >Fast</option>



</select>
		

	</div>
  </div>

  

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

		<option value=""  >---Select Product Status---</option>
						<option value="all"   selected="selected"   >--ALL-</option>

		<option value="Dispatched"      >Dispatched</option>


			<option value="Undispatched"   >Undispatched</option>


			<option value="Failed Delivery"   >Failed Delivery</option>

		<option value="Returned and Received"  >Returned and Received</option>
		<option value="Returned"  >Returned</option>


 		<option value="Delivered"  >Delivered</option>



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

	</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="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($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=""  ></option>

	<option value=""  >--Do you want to group items on the report-</option>

	<option value="No">No</option>
	<option value="Yes"   selected="selected"  >Yes</option>



</select>
		

	</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 Delivery Items  </button>

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

    

				</div>

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

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

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

		
                 echo form_open('user/addparceldelivery' , 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/viewparceldelivery?"id="view" class="form-control" required placeholder="Enter status">


	<input type="hidden" name="action" value="update" class="form-control" required placeholder="Enter invoiceno">

	<input type="hidden" id="mycategoryid" name="mycategoryid" value="" class="form-control" required placeholder="Enter invoiceno">

  
  


     <div class="form-group">
    <label for="inputmode" class="col-sm-2 control-label">Payment Mode?</label>
    <div class="col-sm-10">
	<select class="form-control" id="mode" name="mode" required>
	
	<option value=""  >---Select Payment mode---</option>
	<option value="COD"  > C.O.D (Cash On Delivery)</option>
	<option value="Prepaid" selected="selected" >Prepaid</option>

	


</select>
		

	</div>
  </div>
  	
	<div class="form-group">
    <label for="inputorigin" class="col-sm-2 control-label">From(Origin)</label>
    <div class="col-sm-10">
	
		  		<input type="text" id="origin" name="origin" value="<?php echo set_value('origin'); ?>" class="form-control" required placeholder="Enter origin">
		 
				
		<span class="text-danger"> <?php echo form_error('origin'); ?>
		
		</span>
	</div>
  </div>


	<div class="form-group">
    <label for="inputdestination" class="col-sm-2 control-label">To(Destination)</label>
    <div class="col-sm-10">
	
		  		<input type="text" id="destination" name="destination" value="<?php echo set_value('destination'); ?>" class="form-control" required placeholder="Enter destination">
		 
				
		<span class="text-danger"> <?php echo form_error('destination'); ?>
		
		</span>
	</div>
  </div>


	<div class="form-group">
    <label for="inputincharge" class="col-sm-2 control-label">Sender</label>
    <div class="col-sm-10">
	
		  		<input type="text" id="incharge" name="incharge" value="<?php echo set_value('incharge'); ?>" class="form-control" required placeholder="Enter Person incharge name">
		 
				
		<span class="text-danger"> <?php echo form_error('incharge'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputreceiver" class="col-sm-2 control-label">Receiver Name</label>
    <div class="col-sm-10">
	
		  		<input type="text" id="receiver" name="receiver" value="<?php echo set_value('receiver'); ?>" class="form-control" required placeholder="Enter receiver name">
		 
				
		<span class="text-danger"> <?php echo form_error('receiver'); ?>
		
		</span>
	</div>
  </div>
  <div class="form-group">
    <label for="inputreceiveridno" class="col-sm-2 control-label">Receiver IDNO</label>
    <div class="col-sm-10">
	
		  		<input type="text" id="receiveridno" name="receiveridno" value="<?php echo set_value('receiveridno'); ?>" class="form-control"  placeholder="Enter receiver ID number">
		 
				
		<span class="text-danger"> <?php echo form_error('receiveridno'); ?>
		
		</span>
	</div>
  </div>
 	<div class="form-group">
    <label for="inputreceiverphone" class="col-sm-2 control-label">Receiver Phone</label>
    <div class="col-sm-10">
	
		  		<input type="text" id="receiverphone" name="receiverphone" value="<?php echo set_value('receiverphone'); ?>" class="form-control" required placeholder="Enter receiver phone number">
		 
				
		<span class="text-danger"> <?php echo form_error('receiverphone'); ?>
		
		</span>
	</div>
  </div>
	<div class="form-group" style="display:none">
    <label for="inputreceiveremail" class="col-sm-2 control-label">Receiver Email</label>
    <div class="col-sm-10">
	
		  		<input type="text" id="receiveremail" name="receiveremail" value="<?php echo set_value('receiveremail'); ?>" class="form-control"  placeholder="Enter receiver Email">
		 
				
		<span class="text-danger"> <?php echo form_error('receiveremail'); ?>
		
		</span>
	</div>
  </div>
	<div class="form-group">
    <label for="inputreceiveraddress" class="col-sm-2 control-label">	Receiver Address </label>
    <div class="col-sm-10">

				<textarea id="receiveraddress" name="receiveraddress" value="<?php echo set_value('receiveraddress'); ?>"  class="form-control"  placeholder="Enter receiver address details"></textarea>
			
		<span class="text-danger"> <?php echo form_error('receiveraddress'); ?>
		
		</span>
	</div>
  </div>
		


<div class="form-group" style="display:none">
    <label for="inputtotalvalue" class="col-sm-2 control-label">	Percel Value:  </label>
    <div class="col-sm-10">
	
		  		<input type="text"  name="totalvalue" id="totalvalue" value="<?php echo set_value('totalvalue'); ?>" class="form-control"  placeholder="Enter total Value of all the items">
		 
				
		<span class="text-danger"> <?php echo form_error('totalvalue'); ?>
		
		</span>
	</div>
  </div>
  
  
  	<div class="form-group" >
    <label for="inputamount" class="col-sm-2 control-label">Amount :  </label>
    <div class="col-sm-10">
	
		  		<input type="text"  id="amount" name="amount" value="<?php echo set_value('amount'); ?>" class="form-control"  placeholder="Enter  amount ">
		 
				
		<span class="text-danger"> <?php echo form_error('amount'); ?>
		
		</span>
	</div>
  </div>
<div class="form-group" style="display:none">
    <label for="inputqty" class="col-sm-2 control-label">Quantity :  </label>
    <div class="col-sm-10">
	
		  		<input type="text" id="qty" name="qty" value="<?php echo set_value('qty'); ?>" class="form-control" required placeholder="Enter  Quantity ">
		 
				
		<span class="text-danger"> <?php echo form_error('qty'); ?>
		
		</span>
	</div>
  </div>
  


  		  	<div class="form-group" style="display:none">
    <label for="inputduedate" class="col-sm-2 control-label">Due Date</label>
    <div class="col-sm-10">
	
		  		<input type="date" id="duedate"name="duedate" value="<?php echo set_value('duedate'); ?>" class="form-control"  placeholder="Enter Due Date ">
		 
				
		<span class="text-danger"> <?php echo form_error('duedate'); ?>
		
		</span>
	</div>
  </div>
  			 

  	<div class="form-group" >
    <label for="inputdateposted" class="col-sm-2 control-label">Posting Date</label>
    <div class="col-sm-10">
	
		  		<input type="text" id="dateposted" name="dateposted" value="<?php echo set_value('dateposted'); ?>" class="form-control" required placeholder="Enter Posting Date  ">
		 
				
		<span class="text-danger"> <?php echo form_error('dateposted'); ?>
		
		</span>
	</div>
  </div>
  
   
  
  
  
  
     <div class="form-group">
    <label for="inputfrom" class="col-sm-2 control-label">Branch</label>
    <div class="col-sm-10">
	

	<select class="form-control" name="from"  id="from" required>
	
	<option value=""  selected="selected" ></option>
	<option value=""   >---Select Branch---</option>

	
	<?php 
					 

					 $branch= $this->usermodel->populateall('branch','companyid',$companyid);



if(is_array($branch)) {

   foreach($branch as $branchrow){

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



	<?php

}} else {
    echo 'No branch available.';
}
	
?>


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

	</div>
  </div>
  	
  
  
  
  
  
  
  
	<div class="form-group" >
    <label for="inputinvoice" class="col-sm-2 control-label">Tracking No </label>
    <div class="col-sm-10">
		

			<input type="text"  id="invoice" name="invoice" value="<?php echo set_value('invoice'); ?>" class="form-control" required placeholder="Enter invoiceno">

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

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

				<textarea id="details" name="details" value="<?php echo set_value('details'); ?>"  class="form-control"  placeholder="Enter remarks">Paid</textarea>
			
		<span class="text-danger"> <?php echo form_error('details'); ?>
		
		</span>
	</div>
  </div>
		
<div class="form-group">
    <label for="inputriderdetails" class="col-sm-2 control-label">Rider Details</label>
    <div class="col-sm-10">
	
		  		<input type="text" id="riderdetails" name="riderdetails" value="<?php echo set_value('riderdetails'); ?>" class="form-control" required placeholder="Enter rider details">
		 
				
		<span class="text-danger"> <?php echo form_error('riderdetails'); ?>
		
		</span>
	</div>
  </div>

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

		<option value=""  >---Select Delivery Status---</option>
						<option value="Booked"     >--Booked-</option>

		<option value="Dispatched"      >Dispatched</option>


			<option value="Undispatched"   >Undispatched</option>


			<option value="Failed Delivery"   >Failed Delivery</option>

		<option value="Returned and Received"  >Returned and Received</option>
		<option value="Returned"  >Returned</option>


 		<option value="Delivered"  >Delivered</option>



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

	</div>
  </div>
  



	         <button type="submit"  value="delivery" name="btn_parceldelivery" class="btn btn-primary"> Update </button>

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

  </div>

  </div>		
	
	
	
	
	
	
		<div id="usersummaryModal" 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">Delivery Report per Customer</h4>
      </div>
      <div class="modal-body">
      


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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/viewdeliveryitemsbycustomer' , 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">Select Customer?</label>
    <div class="col-sm-10">
			  		<input type="text" id="myuser" name="user" value="<?php echo set_value('incharge',"all"); ?>" class="form-control" required placeholder="Enter Person incharge name">

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

		<option value=""  >---Select Delivery Status---</option>
						<option value="Booked"     >--Booked-</option>

		<option value="Dispatched"     >Dispatched</option>
<option value="Returned"  >Returned</option>


 		<option value="Delivered"  >Delivered</option>



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

	</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="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($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=""  ></option>

	<option value=""  >--Do you want to group items on the report-</option>

	<option value="No" selected="selected" >No</option>
	<option value="Yes"  >Yes</option>



</select>
		

	</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 Delivery Items  </button>

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

    

				</div>

		</div>
	    </div>
    </div>
	
	
	
	
	
	
	
	
	
	
	
					
	
				<div id="addsupplierModal" 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  Campany/Customer</h4>
      </div>
      <div class="modal-body">
      
	  	

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/addmember' , 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="status" value="1"id="status" class="form-control" required placeholder="Enter status">

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


	
		 
				
		 
				
					<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" >
	<option value=""  >---Select category---</option>
	<option value="member" selected="selected"  >Customer</option>
		<option value="supplier"  >Supplier</option>
				<option value="user"  >Employee</option>
				
								<option value="accomodation" >Accomodation</option>

				<option value="reseller"  >Reseller/Agents</option>

	</select>		 
				
		<span class="text-danger"> <?php echo form_error('category'); ?>
		
		</span>
	</div>
  </div>
				
						
						
						
						
						
						
	<div class="form-group">
    <label for="inputfirstname" class="col-sm-2 control-label"> Contact	Names<span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="text" name="firstname" value="<?php echo set_value('firstname'); ?>" class="form-control" required placeholder="Enter first and last name">
		 
				
		<span class="text-danger"> <?php echo form_error('firstname'); ?>
		
		</span>
	</div>
  </div>

  
  	<div class="form-group">
    <label for="inputphone" class="col-sm-2 control-label">	Phone <span style="color:red;">*</span></label>
    <div class="col-sm-10">
	
		  		<input type="text" name="phone"   minlength="12"	maxlength="14"   value="<?php echo set_value('phone'); ?>" class="form-control" required placeholder="Enter phone e.g 254712345678">
		 
				
		<span class="text-danger"> e.g 254712345678 <?php echo form_error('phone'); ?>
		
		</span>
	</div>
  </div>
  
   	<div class="form-group">
    <label for="inputphoneaddress_1" class="col-sm-2 control-label">Card Number/ Phone 2	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="address_1" value="<?php echo set_value('address_1'); ?>" class="form-control"  placeholder="Enter Card Number/ Phone 2">
		 
				
		<span class="text-danger"><?php echo form_error('address_1'); ?>
		
		</span>
	</div>
  </div>
  
  			
					<div class="form-group">
    <label for="inputcompany" class="col-sm-2 control-label">	Business Name </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="company" required value="<?php echo set_value('company'); ?>" class="form-control"  placeholder="Enter company name if any">
		 
				
		<span class="text-danger"> <?php echo form_error('company'); ?>
		
		</span>
	</div>
  </div>	
						
						
			
  	<div class="form-group">
    <label for="inputidno" class="col-sm-2 control-label">			ID Number 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="idno" value="<?php echo set_value('idno'); ?>" class="form-control"  placeholder="Enter idno if any ">
		 
				
		<span class="text-danger"> <?php echo form_error('idno'); ?>
		
		</span>
	</div>
  </div>
  
    	<div class="form-group">
    <label for="inputidnumber" class="col-sm-2 control-label">			PIN  Number 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="idnumber" value="<?php echo set_value('idnumber'); ?>"  minlength="11"	maxlength="14"  class="form-control"  placeholder="Enter Campany Pin">
		 
				
		<span class="text-danger"> <?php echo form_error('idnumber'); ?>
		
		</span>
	</div>
  </div>
  
  
   	<div class="form-group">
    <label for="inputphonegender" class="col-sm-2 control-label">Contact	Gender	 </label>
    <div class="col-sm-10">
	
	<select class="form-control" name="gender" >
	
	<option value=""  >---Select Gender---</option>
	<option value="female"  >female</option>
		<option value="male"  >male</option>
	</select>		 
				
		<span class="text-danger"> <?php echo form_error('gender'); ?>
		
		</span>
	</div>
  </div>
   <div class="form-group">
    <label for="inputcountry" class="col-sm-2 control-label">Country?</label>
    <div class="col-sm-10">
	<select class="form-control" name="country" >
	


	
	<?php 
					 
			$mycountry = $this->nationmodel->populatenation();
	


if(is_array($mycountry)) {

   foreach($mycountry as $mycountryrow){

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



	<?php

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

	</div>
  </div>
  
  
  
  
    	<div class="form-group">
    <label for="inputemail" class="col-sm-2 control-label">	Email </label>
    <div class="col-sm-10">
	
		  		<input type="email" name="email" value="<?php echo set_value('email'); ?>" class="form-control"  placeholder="Enter Your email">
		 
				
		<span class="text-danger"> <?php echo form_error('email'); ?>
		
		</span>
	</div>
  </div>
  
  	
  
  
     
  
  
  
  
    
  	<div class="form-group">
    <label for="inputcity" class="col-sm-2 control-label">	City 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="city" value="<?php echo set_value('city'); ?>" class="form-control"  placeholder="Enter City or town">
		 
				
		<span class="text-danger"> <?php echo form_error('city'); ?>
		
		</span>
	</div>
  </div>
  
  
  
 
  
 
  
  	<div class="form-group">
    <label for="inputentrydate" class="col-sm-2 control-label">	Entry date  	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="entrydate" value="<?php echo set_value('entrydate'); ?>" class="form-control"  placeholder="Enter Entry date">
		 
				
		<span class="text-danger"> <?php echo form_error('entrydate'); ?>
		
		</span>
	</div>
  </div>
  
  
   	<div class="form-group">
    <label for="inputzip" class="col-sm-2 control-label">	Due Date </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="zip" value="<?php echo set_value('zip'); ?>" class="form-control"  placeholder="Enter Due Date">
		 
				
		<span class="text-danger"> <?php echo form_error('zip'); ?>
		
		</span>
	</div>
  </div>
  
  
  
   	<div class="form-group">
    <label for="inputwebsite" class="col-sm-2 control-label">Renewal	Comments /Website	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="website" value="<?php echo set_value('website'); ?>" class="form-control"  placeholder="Enter Comments if any">
		 
				
		<span class="text-danger"> <?php echo form_error('website'); ?>
		
		</span>
	</div>
  </div>
  
    
	
	  	<div class="form-group">
    <label for="inputsalesperson" class="col-sm-2 control-label">	Sales Person 	 </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="salesperson" value="<?php echo set_value('city'); ?>" class="form-control"  placeholder="Enter sales person">
		 
				
		<span class="text-danger"> <?php echo form_error('salesperson'); ?>
		
		</span>
	</div>
  </div>
	
  
  
  
  
  
  
  
  
  
	<div class="form-group">
    <label for="inputcomments" class="col-sm-2 control-label">	Description</label>
    <div class="col-sm-10">

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

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="member" name="btn_addmember" class="btn btn-primary"> Add Campany   </button>

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

    

				</div>

		</div>
	    </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 Delivery </h4>
      </div>
      <div class="modal-body">
      
	  	

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


 $finalsalesid = $userid.time();
				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/addparceldelivery' , 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="viewss" value="user/viewparceldelivery"id="view" class="form-control" required placeholder="Enter status">

<input type="hidden" name="view" value="user/editparceldelivery?randomitemidentifier=" class="form-control" required placeholder="Enter invoiceno">
	<input type="hidden" name="invoice" value="<?php echo set_value('invoiceno',$finalsalesid); ?>" class="form-control" required placeholder="Enter invoiceno">



	<input type="hidden" name="action" value="insert" class="form-control" required placeholder="Enter invoiceno">

	<input type="hidden" name="mycategoryid" value="" class="form-control" required placeholder="Enter invoiceno">

  
     <div class="form-group">
    <label for="inputfrom" class="col-sm-2 control-label">From Branch</label>
    <div class="col-sm-10">
	<select class="form-control" name="from" required>
	
	<option value=""  >---Select Branch---</option>

	
	<?php 
					 

					 $branch= $this->usermodel->populateall('branch','companyid',$companyid);



if(is_array($branch)) {

   foreach($branch as $branchrow){

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



	<?php

}} else {
    echo 'No branch available.';
}
	
?>


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

	</div>
  </div>
  	
  
  
  
     <div class="form-group">
    <label for="inputfrom" class="col-sm-2 control-label">To Branch</label>
    <div class="col-sm-10">
	<select class="form-control" name="branchid" required>
	
	<option value=""  >---Select Branch---</option>

	
	<?php 
					 

					 $branch= $this->usermodel->populateall('branch','companyid',$companyid);



if(is_array($branch)) {

   foreach($branch as $branchrow){

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



	<?php

}} else {
    echo 'No branch available.';
}
	
?>


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

	</div>
  </div>
  	
  
  
     <div class="form-group">
    <label for="inputmode" class="col-sm-2 control-label">Payment Mode?</label>
    <div class="col-sm-10">
	<select class="form-control" name="mode" required>
	
	<option value=""  selected="selected"  >---Select Payment mode---</option>
	<option value="COD"   > C.O.D (Cash On Delivery)</option>
	<option value="Prepaid" >Prepaid</option>
	<option value="Credit" >Invoice</option>
	<option value="Cash" >Cash</option>
	<option value="Mpesa" >Till/Mpesa</option>
	<option value="Bank" >Bank</option>

		<option value="Phone" >Phone</option>
		<option value="PIJ" >PIJ</option>



</select>
		

	</div>
  </div>
  	
	<div class="form-group">
    <label for="inputorigin" class="col-sm-2 control-label">From (Origin)</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="origin" value="<?php echo set_value('origin','Nairobi'); ?>" class="form-control" required placeholder="Enter origin">
		 
				
		<span class="text-danger"> <?php echo form_error('origin'); ?>
		
		</span>
	</div>
  </div>


	<div class="form-group">
    <label for="inputdestination" class="col-sm-2 control-label">To (Destination)</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="destination" value="<?php echo set_value('destination'); ?>" class="form-control" required placeholder="Enter destination">
		 
				
		<span class="text-danger"> <?php echo form_error('destination'); ?>
		
		</span>
	</div>
  </div>


	<div class="form-group" style="display:none">
    <label for="inputincharge" class="col-sm-2 control-label">Sender</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="incharge" value="<?php echo set_value('incharge',$username); ?>" class="form-control" required placeholder="Enter Person incharge name">
		 
				
		<span class="text-danger"> <?php echo form_error('incharge'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group">
    <label for="inputreceiver" class="col-sm-2 control-label">Receiver Name</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="receiver" value="<?php echo set_value('receiver'); ?>" class="form-control" required placeholder="Enter receiver name">
		 
				
		<span class="text-danger"> <?php echo form_error('receiver'); ?>
		
		</span>
	</div>
  </div>
  <div class="form-group">
    <label for="inputreceiveridno" class="col-sm-2 control-label">Receiver IDNO</label>
    <div class="col-sm-10">
	
		  		<input type="text"  name="receiveridno" value="<?php echo set_value('receiveridno'); ?>" class="form-control"  placeholder="Enter receiver ID number">
		 
				
		<span class="text-danger"> <?php echo form_error('receiveridno'); ?>
		
		</span>
	</div>
  </div>
 	<div class="form-group">
    <label for="inputreceiverphone" class="col-sm-2 control-label">Receiver Phone</label>
    <div class="col-sm-10">
	
		  		<input type="text"  name="receiverphone" value="<?php echo set_value('receiverphone'); ?>" class="form-control" required placeholder="Enter receiver phone number">
		 
				
		<span class="text-danger"> <?php echo form_error('receiverphone'); ?>
		
		</span>
	</div>
  </div>
	<div class="form-group" style="display:none">
    <label for="inputreceiveremail" class="col-sm-2 control-label">Receiver Email</label>
    <div class="col-sm-10">
	
		  		<input type="text"  name="receiveremail" value="<?php echo set_value('receiveremail'); ?>" class="form-control"  placeholder="Enter receiver Email">
		 
				
		<span class="text-danger"> <?php echo form_error('receiveremail'); ?>
		
		</span>
	</div>
  </div>
	<div class="form-group" style="display:none">
    <label for="inputreceiveraddress" class="col-sm-2 control-label">	Receiver Address </label>
    <div class="col-sm-10">

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

  
  <div class="form-group">
    <label for="inputstatus" class="col-sm-2 control-label">Status?</label>
    <div class="col-sm-10">
	<select class="form-control" name="status"  required>

		<option value=""  >---Select Delivery Status---</option>
						<option value="Booked"     >--Booked-</option>

		<option value="Dispatched"    selected="selected"   >Dispatched</option>
<option value="Returned"  >Returned</option>


 		<option value="Delivered"  >Delivered</option>



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

	</div>
  </div>
  


<div class="form-group" style="display:none">
    <label for="inputtotalvalue" class="col-sm-2 control-label">	Percel Value:  </label>
    <div class="col-sm-10">
	
		  		<input type="text"  name="totalvalue" value="<?php echo set_value('totalvalue'); ?>" class="form-control"  placeholder="Enter total Value of all the items">
		 
				
		<span class="text-danger"> <?php echo form_error('totalvalue'); ?>
		
		</span>
	</div>
  </div>
  	<div class="form-group">
    <label for="inputdetails" class="col-sm-2 control-label">	Description  </label>
    <div class="col-sm-10">

				<textarea name="details" value="<?php echo set_value('details'); ?>"  class="form-control"  placeholder="Enter remarks/ Description"></textarea>
			
		<span class="text-danger"> <?php echo form_error('details'); ?>
		
		</span>
	</div>
  </div>
  
  	<div class="form-group" >
    <label for="inputamount" class="col-sm-2 control-label">Amount :  </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="amount" value="<?php echo set_value('amount',0); ?>" class="form-control"  placeholder="Enter  amount charged">
		 
				
		<span class="text-danger"> <?php echo form_error('amount'); ?>
		
		</span>
	</div>
  </div>
<div class="form-group" style="display:none">
    <label for="inputqty" class="col-sm-2 control-label">Quantity :  </label>
    <div class="col-sm-10">
	
		  		<input type="text" name="qty" value="<?php echo set_value('qty',1); ?>" class="form-control" required placeholder="Enter  Quantity Delivered">
		 
				
		<span class="text-danger"> <?php echo form_error('qty'); ?>
		
		</span>
	</div>
  </div>
  


  		  	<div class="form-group" style="display:none">
    <label for="inputduedate" class="col-sm-2 control-label">Due Date</label>
    <div class="col-sm-10">
	
		  		<input type="date" name="duedate" value="<?php echo set_value('duedate', $mydate); ?>" class="form-control"  placeholder="Enter Due Date ">
		 
				
		<span class="text-danger"> <?php echo form_error('duedate'); ?>
		
		</span>
	</div>
  </div>
  			 

  	<div class="form-group" >
    <label for="inputdateposted" class="col-sm-2 control-label">Posting Date</label>
    <div class="col-sm-10">
	
		  		<input type="text" name="dateposted" value="<?php echo set_value('dateposted', $mydate); ?>" class="form-control" required placeholder="Enter Date Delivery ">
		 
				
		<span class="text-danger"> <?php echo form_error('dateposted'); ?>
		
		</span>
	</div>
  </div>
  
   
  
  
  
  
  
  
  
  
  
	<div class="form-group" >
    <label for="inputinvoice" class="col-sm-2 control-label">Tracking No </label>
    <div class="col-sm-10">
		
			<input type="text"  name="invoice" value="<?php echo set_value('invoice',$finalsalesid); ?>" class="form-control" required placeholder="Enter invoiceno">

			<input type="hidden"  name="invoice33" value="<?php echo set_value('invoice'); ?>" class="form-control" required placeholder="Enter invoiceno">

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

  
  
  
  

		
<div class="form-group">
    <label for="inputriderdetails" class="col-sm-2 control-label">Official Receiver</label>
    <div class="col-sm-10">
	
		  		<input type="text"name="riderdetails" value="<?php echo set_value('riderdetails'); ?>" class="form-control" required placeholder="Enter Official Receiver">
		 
				
		<span class="text-danger"> <?php echo form_error('riderdetails'); ?>
		
		</span>
	</div>
  </div>

	

	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="delivery" name="btn_parceldelivery" class="btn btn-primary"> Next >>> </button>

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

    

				</div>

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

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

 
</div>

	


















