<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">
	
 <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">  
        $(this).ready( function() {  
            $("#id").autocomplete({  
 
                minLength: 1,  
                source:   
                function(req, add){  
                    $.ajax({  
					<?php  
if($purchaseorder[0]['fob'] =="Main"){
	
	?>
						   url: "<?php echo base_url(); ?>Systemusers/productlookup",  

<?php  
}else{
	
?>
					   url: "<?php echo base_url(); ?>Systemusers/lookupquotation",  

<?php  
}
	
?>
//
                      <!--  url: "<?php echo base_url(); ?>Systemusers/lookup",   -->
                        dataType: 'json',  
                        type: 'POST',  
                        data: req,  
                        success:      
                        function(data){  
                            if(data.response =="true"){  
                                add(data.message);  
                                console.log(data);
                            }  
                        },  
                    });  
                },  
                     
            });  
        });  
		
		
		
		
		   $(this).ready( function() { 
var searchterm = $("#idxxx").val();
                     var frombranch = $("#from").val();	  
            $("#searchterm").autocomplete({  
 
                minLength: 1,  
                source:   
                function(req, add){  
                    $.ajax({  
                       //url: "<?php echo base_url(); ?>Systemusers/productlookup",
                       url: "<?php echo base_url(); ?>Systemusers/productlookupdispatch",  
						
                        dataType: 'json',  
                        type: 'POST',  
                        data: req,  
										 ///data: {term: $(this).val(),frombranch: frombranch},

                        success:      
                        function(data){  
                            if(data.response =="true"){  
                                add(data.message);  
                                console.log(data);
                            }  
                        },  
                    });  
                },  
                     
            });  
        });  
		
		
		
		
		
		
		
		
		
			
		 $(document).on("click", "#managebtndelete", function()
        {
          var transactionid = $(this).data('id');
		  $("#transactionid").val(transactionid); 
   var myid = $(this).data('myid');
		  $("#myid").val(myid); 
		   
		   
        });
		  $(function() {
<!--             $(".datepicker").datepicker(); -->
<!--             $(".uniform_on").uniform() -->;
            $(".chzn-select").chosen();
   <!--          $('.textarea').wysihtml5(); -->

        });
		
		
		 $(document).on("click", "#convertsales", function()
        {
          var salesid = $(this).data('id');
		  $("#salesid").val(salesid); 
		  
		            var salesinvoice = $(this).data('invoice');
		  $("#salesinvoice").val(salesinvoice); 
		   
        });
		
		
		

	$(document).on("click", "#invocebtn", function()
        {
          var phone = $(this).data('phone');
		  $("#phone1").val(phone); 
		   
		   		   
   var message = $(this).data('message');
		   $("#message1").val(message);
 
	
		  
		  
		   
        });
		
        </script>
	   	
 
 <div class="row">
  
   	

   	<div class="col-md-12">

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

      $mydate=date("Y-m-d H:i:s");
 $date = Date('Y-m-d') ;
		 	 $year = Date('Y') ;
		  $month = Date('m') ;
 	$data['id'] = $session_data['id'];
        
		 $userid = $data['id'];
$data['companyid'] = $session_data['companyid'];
	 $companyid = $data['companyid'];
		 $data['usertype'] = $session_data['usertype'];
	 $usertype = $data['usertype'];	
    $deletebank=$this->usermodel->populatuserpermissionsdataarray('accounting','deletebank',$userid);
 $weight=$purchaseorder[0]['weight'];
		  $productdiscountaction=$this->usermodel->populatuserpermissionsdataarray('sales','productdiscount',$userid);
  $viewbprice=$this->usermodel->populatuserpermissionsdataarray('productlist','viewbprice',$userid);
  $updatequotation=$this->usermodel->populatuserpermissionsdataarray('quotation','update',$userid);


   
   $people=$this->usermodel->populateallarray('people','id', $purchaseorder[0]['supplier']);
							  $phone=$people[0]['phone'];
							  
							  $salesid=$purchaseorder[0]['invoice'];
							  	$receiptlink= base_url()."printquotation?invoice=".$salesid;
								$receiptemessage="Hello, this is to inform you that your Quotation has been generated. Thank you for showing interest. We are Looking for forward to doing business with you. Click here to download/Print the Quotation: ".$receiptlink."";
	 	    $dontshowstock=$this->usermodel->populatuserpermissionsdataarray('productlist','dontshowstock',$userid);

  
  ?>
		<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-center"> Update/Create   </span>
				                    <a  class="btn btn-primary"  href="<?php echo base_url(); ?>user/allquatation">Back</a>

	    	<?php  
if($purchaseorder[0]['deliverymethod'] !="requisition"){
	
	?>

	<a  id="more" class="btn btn-success"  target="_blank" href="https://api.whatsapp.com/send?phone=<?php echo  $phone;?>&text=<?php echo  $receiptemessage;?>&source=&data=&app_absent="> Whatsapp Quote </a>
	<a class="btn btn-warning invocebtn" id="invocebtn" data-phone='<?php echo  $phone;?>'   data-message='<?php echo  $receiptemessage;?>'  data-id='<?php echo  $salesid;?>' data-toggle='modal' data-target='#addinvoicesmsModal'> 	 

                                                <i class="glyphicon glyphicon-pencil"></i>
																Send Quote through  sms
                                                </a>
	
<?php  
}
?>






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


	<div class="col-md-12">

				<?PHP
				echo" No. ".$purchaseorder[0]['id'];
//$session_data = $this->session->userdata('logged_in');


		
                 echo form_open('user/addquatation' , array('class' => 'form-inline form-groups-bordered validate', 'enctype' => 'multipart/form-data'));
				 if(validation_errors()):
				 $salesid=$purchaseorder[0]['invoice'];

				 ?>
<div class='alert alert-danger text-center'><?php echo validation_errors(); ?></div>
<?php endif;?>
 </div>
	<div class="col-md-12">
		<input type="hidden" name="deliverymethod" value="<?php echo set_value('deliverymethod',$purchaseorder[0]['deliverymethod']); ?>" class="form-control" required placeholder="Enter deliverymethod">

									<input type="hidden" name="view" value="user/viewnewquotation?randomitemidentifier=<?php echo $purchaseorder[0]['invoice']; ?>" class="form-control" required placeholder="Enter invoiceno">
								<input type="hidden" name="action" value="update" class="form-control" required placeholder="Enter invoiceno">

								<input type="hidden" name="itemid" value="<?php echo set_value('id',$purchaseorder[0]['id']); ?>" class="form-control" required placeholder="Enter invoiceno">

 			  		<input type="hidden" style="background:gray"readonly name="id" value="<?php echo set_value('id',$purchaseorder[0]['id']); ?>" class="form-control2" required placeholder="Enter  quotation number ">

		
	 
		
		
	
  	<?php  
if($purchaseorder[0]['deliverymethod'] !="requisition"){
	
	?>
		<div class="form-group">
    <label for="inputorderedby" class="col-sm-2 control-label">	Requested by: </label>
    <div class="col-sm-4">
	
		  		<input type="text" name="orderedby" value="<?php echo set_value('orderedby',$purchaseorder[0]['orderedby']); ?>" class="form-control"  placeholder="Enter  contact Name for P.O ">
		 
				
		<span class="text-danger"> <?php echo form_error('orderedby'); ?>
		
		</span>
	</div>
  </div>
  	<?php  
}else{
	
	?>

		
		<div class="form-group">
    <label for="inputorderedby" class="col-sm-2 control-label">	 </label>
    <div class="col-sm-4">
	
		  		<input type="hidden" name="orderedby" value="<?php echo set_value('orderedby',$purchaseorder[0]['orderedby']); ?>" class="form-control"  placeholder="Enter  contact Name for P.O ">
		 
			<input type="hidden" name="supplier" value="<?php echo set_value('supplier',$purchaseorder[0]['supplier']); ?>" class="form-control"  placeholder="Enter  supplier ">

		<span class="text-danger"> <?php echo form_error('orderedby'); ?>
		
		</span>
	</div>
  </div><?php  
}
	
	?>
  
 
  
  <?php  
if($purchaseorder[0]['deliverymethod']=="requisition"){
	
	?>
	 <div class="form-group">
    <label for="inputdisplayvat" class="col-sm-2 control-label">   Vat: </label>
    <div class="col-sm-4">
	
<input type="hidden"   name="displayvat" value="<?php echo set_value('displayvat',$purchaseorder[0]['displayvat']); ?>" class="form-control" required placeholder="Enter from">
<input type="hidden"   name="weight" value="<?php echo set_value('weight',$purchaseorder[0]['weight']); ?>" class="form-control" required placeholder="Enter to">
	</div>
  </div>
	
	 <?php 
}else{
	?>
	


  <div class="form-group">
    <label for="inputdisplayvat" class="col-sm-2 control-label">  Display Vat: </label>
    <div class="col-sm-4">
	
		 <select class="form-control2" name="displayvat" >
		<option value="<?php echo set_value('displayvat',$purchaseorder[0]['displayvat']); ?>" selected="selected" ><?php echo $purchaseorder[0]['displayvat']; ?></option>

	<option value=""  >---Disply vat?	---</option>
	<option value="no"  >No</option>
		<option value="yes"  >Yes</option>
	</select>	
			
	Image/Weight?<select class="form-control2" name="weight" >
		<option value="<?php echo set_value('weight',$purchaseorder[0]['weight']); ?>" selected="selected" ><?php echo $purchaseorder[0]['weight']; ?></option>

	<option value=""  >---	Add weight?	---</option>
	<option value="No"  >No</option>
		<option value="Yes"  >Yes</option>
	</select>	
	</div>
  </div>
  <?php 

}

?>
  
  
  
	   </div>
		<div class="col-md-12">

		
		  	<?php  
if($purchaseorder[0]['deliverymethod'] !="requisition"){
	
	?>
		
		 	<div class="form-group">
    <label for="inputsupplier" class="col-sm-2 control-label">Customer/ Business Name ?</label>
    <div class="col-sm-4">
		
	
		<select class="form-control"name="supplier" id="supplier" >
	
	<option value=""  >---Select Business/Customer Name---</option>


   <?php
 $countryid= $purchaseorder[0]['supplier'];
 		$mysupplier= $this->usermodel->populateall('people','id',$countryid);



if(is_array($mysupplier)) {

   foreach($mysupplier as $mysupplierrow){
$comapany=$mysupplierrow->company;
    ?>
					<option selected="selected" value="<?=  $mysupplierrow->id;   ?>"><?php if($comapany==""){echo $mysupplierrow->firstname;}else{ echo $comapany;}?></option>

   
    <?php

}} else {
 ?>
<option value=""  >---Select supplier/customer---</option>

		<?php 
}


	
					 
			$mycustomer= $this->usermodel->populateviewcustomers('people','firstname','ASC','companyid', $companyid);
	     // $mycustomer=$this->usermodel->populatealldatawhere('products','bulk',$userid);


if(is_array($mycustomer)) {

   foreach($mycustomer as $mycustomerrow){
$comapany=$mycustomerrow->company;

   //echo $courserow->coursename;
   ?>
					<option  value="<?=  $mycustomerrow->id;   ?>"><?php if($comapany==""){echo $mycustomerrow->firstname;}else{ echo $comapany;}?></option>





	<?php

}} else {
    echo 'No supplier available.';
}
	
?>
</select>		
		  		
				
		<span class="text-danger"> 	<?php echo form_error('supplier'); ?>
		
		</span>
	</div>
  </div>
		
				  	<?php  
}
	
	?>
			
			
		
					  <div class="form-group">
    <label for="inputcanceldate" class="col-sm-2 control-label">Expiry  Date </label>
    <div class="col-sm-4">

	<input type="text" name="canceldate" value="<?php echo set_value('canceldate',$purchaseorder[0]['canceldate']); ?>"id="canceldate" class="form-control" required placeholder="Enter cancel order date  (dd-mm-YYY) ">
			<span class="text-danger"> <?php echo form_error('canceldate'); ?>
		
		</span>
	</div>
  </div>		
		
		   </div>
	
		<div class="col-md-12">			
			  <div class="form-group">
    <label for="inputinvoice" class="col-sm-2 control-label">Ref No. </label>
    <div class="col-sm-4">
<input type="text" readonly name="invoice" value="<?php echo set_value('invoice',$purchaseorder[0]['invoice']); ?>" class="form-control" required placeholder="Enter ref no.">
		
		</span>
	</div>
  </div>		
		
				
			  <div class="form-group">
    <label for="inputorderdate" class="col-sm-2 control-label"> Generated Date </label>
    <div class="col-sm-4">

	<input type="text" name="orderdate" value="<?php echo set_value('orderdate',$purchaseorder[0]['orderdate']); ?>"id="orderdate" class="form-control" required placeholder="Enter specific order date  (dd-mm-YYY) ">
			<span class="text-danger"> <?php echo form_error('orderdate'); ?>
		
		</span>
	</div>
  </div>		
			
		
	 
		</div>
		<div class="col-md-12">

<?php  
if($purchaseorder[0]['deliverymethod']=="requisition"){
	?>
	
			  <div class="form-group">
    <label for="inputterms" class="col-sm-2 control-label">   </label>
    <div class="col-sm-4">

		<input type="hidden" name="terms" value="<?php echo set_value('terms',$purchaseorder[0]['terms']); ?>"id="terms" class="form-control" required placeholder="Enter Terms of payment  ">
			<span class="text-danger"> <?php echo form_error('terms'); ?>
		
		</span>
	</div>
  </div>

	
	<?php 	
}else{
	?>
					  <div class="form-group">
    <label for="inputterms" class="col-sm-2 control-label">Terms   </label>
    <div class="col-sm-4">

	<input type="text" name="terms" value="<?php echo set_value('terms',$purchaseorder[0]['terms']); ?>"id="terms" class="form-control" required placeholder="Enter Terms of payment  ">
			<span class="text-danger"> <?php echo form_error('terms'); ?>
		
		</span>
	</div>
  </div>
 	
		
		<?php 	
}
?>	



  	 
			    <div class="form-group">
    <label for="inputamount" class="col-sm-2 control-label"> Amount   </label>
    <div class="col-sm-4">
		
				<input type="text" readonly  name="amount" value="<?php echo set_value('amount',$purchaseorder[0]['amount']) ;?>" id="dob" class="form-control" required  placeholder="Please enter amount ">

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

				</div>
		<div class="col-md-12">	
					
  
      <div class="form-group">
    <label for="inputpreparedby" class="col-sm-2 control-label"> Prepared By?   </label>
    <div class="col-sm-4">
		<select class="form-control"name="preparedby" id="preparedby" >
	
	<option value=""  >---Select Name---</option>


   <?php
 $preparedby= $purchaseorder[0]['preparedby'];
 		$preparedbydata= $this->usermodel->populateall('people','id',$preparedby);



if(is_array($preparedbydata)) {

   foreach($preparedbydata as $preparedbydatarow){
$mycomapanys=$preparedbydatarow->company;
    ?>
	<option selected="selected" value="<?=  $preparedbydatarow->id;   ?>"><?php if($mycomapanys==""){echo $preparedbydatarow->firstname;}else{ echo $mycomapanys;}?></option>

   
    <?php

}} else {
 ?>

		<?php 
}
	
?>
</select>


			</BR>
			<B>Approved By? </B>

<select class="form-control"name="approvedby" id="approvedby" >
	
	<option value=""  >---Select Name---</option>


   <?php
 $approvedby= $purchaseorder[0]['approvedby'];
 		$byid= $this->usermodel->populateall('people','id',$approvedby);



if(is_array($byid)) {

   foreach($byid as $byidrow){
$mycomapany=$byidrow->company;
    ?>
	<option selected="selected" value="<?=  $byidrow->id;   ?>"><?php if($mycomapany==""){echo $byidrow->firstname;}else{ echo $mycomapany;}?></option>

   
    <?php

}} else {
 ?>

		<?php 
}
	
?>
</select>











			</BR>	
		</span>
	</div>
  </div>
			
  
 
<div class="form-group">
    <label for="inputdescription" class="col-sm-2 control-label">Note/Message/Department</label>
    <div class="col-sm-4">

	<textarea name="description" class="form-control" placeholder="Bussines/comments/note"><?php echo set_value('description',$purchaseorder[0]['description']); ?></textarea> 
				 	</br><b>Delivery Status:</b><select class="form-control2" name="deliverydate" >
	<option value="<?php echo set_value('deliverydate',$purchaseorder[0]['deliverydate']); ?>" selected="selected" ><?php echo $purchaseorder[0]['deliverydate']; ?></option>

	<option value=""  >--select one---</option>
					<option value="Completed"  >Completed</option>
	<option value="New"  >New</option>
		<option value="Ongoing"  >Ongoing</option>
			<option value="Pending"  >Pending</option>

	</select>
	
	
	
	<select class="form-control" name="department" >
	 
	<option value="" >--Department--</option>

	
	
	   <?php
	   $department=$purchaseorder[0]['department'];
	   

	   	if($action=="insert"){
			$allplots1=false;
		}else{
			
		
 		$allplots1= $this->usermodel->populateall('department','id',$department);	
			
		}
	   
	   
	   




if(is_array($allplots1)) {

   foreach($allplots1 as $allplotsrow){

    ?>
			<option selected="selected" value="<?=  $allplotsrow->id;   ?>"><?=  $allplotsrow->name; ?></option>

   
    <?php

}} else {
 ?>

		<?php 
}

										$allplots1= $this->usermodel->populatealldatanoarray('department','id <>',"",'id >',0);


	
if(is_array($allplots1)) {

   foreach($allplots1 as $plotnamerow){

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



	<?php

}} else {
    echo 'No bank available.';
}
	
?>
</select>
		
		
			
	
	
	
	
	
	
	</div>
  </div>
  
</div>
	
  	<div class="col-md-12">					
				
		
					 
<?php  
if($purchaseorder[0]['deliverymethod']=="requisition"){
	
	
	$tobranch=$purchaseorder[0]['shippingto'];
	
		$frombranch=$purchaseorder[0]['fob'];

	?>
	
	
	
	
	
	
<input type="hidden" id="from"   name="myfrom" value="<?php echo set_value('invoice',$purchaseorder[0]['fob']); ?>" class="form-control" required placeholder="Enter from">
<input type="hidden" id="to"   name="myto" value="<?php echo set_value('invoice',$purchaseorder[0]['shippingto']); ?>" class="form-control" required placeholder="Enter to">

	 

<div class="form-group">
    <label for="inputfob" class="col-sm-2 control-label">	From </label>

    <div class="col-sm-4">
	<select class="form-control" name="fob" required >


	
	<?php 

			
			if($frombranch=="Main"){
				?>
			 	<option value="Main" selected="selected" >Main Store</option>

				<?php
				
			}else{
					 $branch= $this->usermodel->populateall('branch','id',$frombranch);



if(is_array($branch)) {

   foreach($branch as $branchrow){

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



	<?php

}} else {
    echo 'No branch available.';
}
	
	}
	?>
				 	<option value="Main"  >Main Store</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="inputshippingto" class="col-sm-2 control-label">To?
	

	</label>
    <div class="col-sm-4">
	<select class="form-control" name="shippingto" required>
	
	<option value=""  >---Where to?---</option>
			 	<option value="Main" selected="selected" >Main Store</option>

	
	<?php 

			
			if($tobranch=="Main"){
				?>
			 	<option value="Main" selected="selected" >Main Store</option>

				<?php
				
			}else{
					 $branch= $this->usermodel->populateall('branch','id',$tobranch);



if(is_array($branch)) {

   foreach($branch as $branchrow){

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



	<?php

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

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

	
	
	
	
	
	
	
	

	
	<?php  
}else{
 ?>
			 
			<div class="form-group">
    <label for="inputshippingto" class="col-sm-2 control-label">Shipping to?</label>
    <div class="col-sm-4">
	<textarea name="shippingto" class="form-control" placeholder="Enter shipping details if any..It can be the same company detils"><?php echo set_value('shippingto',$purchaseorder[0]['shippingto']); ?></textarea> 

			
	</div>
  </div>
			
		
		
		
		
		
		
		
	<?php  
}
 ?>
			 
		
		
		
		
		
 					
			
  		 <div class="form-group">
    <label for="inputterms" class="col-sm-2 control-label"> </label>

    <div class="col-sm-4">
				 
<?php
if( $updatequotation==true){
		?>
	     	         <button type="submit"  name="btn_quatation"  value="quatation"  class="btn btn-primary"> Update</button>

	
	<?php
}
	?>


 <?php 
if($purchaseorder[0]['deliverymethod']=="requisition"){
		if($purchaseorder[0]['status']=="Approved"){
	 ?>	
					 <a  id="more" class="btn btn-info" href="<?php echo base_url();?>user/printrequisition?invoice=<?php   if(isset($purchaseorder[0]['invoice'])) {echo $purchaseorder[0]['invoice']; } ?>">  Print Requisition </a>
						 <a  id="more" class="btn btn-info" href="<?php echo base_url();?>user/printrequisitionnoprice?invoice=<?php   if(isset($purchaseorder[0]['invoice'])) {echo $purchaseorder[0]['invoice']; } ?>">  Print Requisition(No Price) </a>

<?php		
	}
	 
	?>
	
	
	
	
	
	
	
	
	
	
	
	
	

	
	<?php  
}else{
 ?>
			 
				 
				 

<a  id="more" class="btn btn-primary" href="<?php echo base_url();?>user/printquotation?invoice=<?php   if(isset($purchaseorder[0]['invoice'])) {echo $purchaseorder[0]['invoice']; } ?>">  Print Quotation    </a>

<a  id="more" class="btn btn-primary" href="<?php echo base_url();?>user/printprofomainvoice?invoice=<?php   if(isset($purchaseorder[0]['invoice'])) {echo $purchaseorder[0]['invoice']; } ?>">  Print proforma Invoice    </a>
<a  id="more" class="btn btn-primary" href="<?php echo base_url();?>user/printquotationhp?invoice=<?php   if(isset($purchaseorder[0]['invoice'])) {echo $purchaseorder[0]['invoice']; } ?>">  Print H.P   (whole sale) </a>
<a  id="more" class="btn btn-info" href="<?php echo base_url();?>user/loadingsheet?invoice=<?php   if(isset($purchaseorder[0]['invoice'])) {echo $purchaseorder[0]['invoice']; } ?>">  Print Loading sheet </a>

							 <a class="btn btn-success managebtn" id="convertsales"		data-invoice='<?php echo  $purchaseorder[0]['invoice'];?>'    data-id='<?php echo  $purchaseorder[0]['id'];?>'    data-toggle='modal' data-target='#convertsalesModal<?php  $purchaseorder[0]['id']; ?>'>	 


                                                <i class="glyphicon glyphicon-pencil"></i>
																Convert To Sales
                                                </a>

<?php
}

?>
    </div>
  </div>
		
  
  

	
  					<?php echo form_close();?>
					
		 </div>			
			  </div>		
			
				<div class="widget-content nopadding table_holder table-responsive"  >		
	
		
	
					
					
				
					<div class="table-responsive">
						<table id="register" class="table table-bordered " width="100%" >
						<thead>
							
								<tr>
								<th colspan="2">
										<?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;
					}
	 $session_data = $this->session->userdata('logged_in');
 echo $this->session->flashdata('deletemsg'); 

   
 	$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('quotation','add',$userid);

	 $updateaction=$this->usermodel->populatuserpermissionsdataarray('quotation','update',$userid);
  $updatebuyingpriceaction=$this->usermodel->populatuserpermissionsdataarray('quotation','updatebuyingprice',$userid);
  $deleteaction=$this->usermodel->populatuserpermissionsdataarray('quotation','delete',$userid);
  $updatesellingpriceaction=$this->usermodel->populatuserpermissionsdataarray('purchases','updatesellingprice',$userid);
    $updateclosedinvoiceaction=$this->usermodel->populatuserpermissionsdataarray('purchases','updateclosedinvoice',$userid);

      $invoicestatus=$this->usermodel->populateallarray('purchaseorder','invoice',$finalsalesid);
$myinvoice=$invoicestatus[0]["status"];
  
   echo $this->session->flashdata('productmsg'); 
                 echo form_open('user/addquotation' , 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="invoice" value="<?php echo set_value('invoice',$finalsalesid); ?>" class="form-control" required placeholder="Enter invoice">
<input type="hidden" name="unit"  value="<?php echo set_value('unit',1); ?>" class="form-control" required placeholder="unit" >
											 					<input type="hidden" name="deliverymethod" id="deliverymethod" value="<?php echo set_value('deliverymethod',$purchaseorder[0]['deliverymethod']); ?>" class="form-control" required placeholder="Buying price" >

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

		 			 		 									<input type="hidden" name="view" value="user/viewnewquotation?randomitemidentifier=<?php echo $purchaseorder[0]['invoice']; ?>" class="form-control" required placeholder="Enter invoiceno">
    											<input type="hidden" name="type"  value="QT" class="form-control" required placeholder="type" >

								</th>
								
								
								
								
								
								
								
								
								
					
					
								
								
								
								<th>
								

								
		  		<input type="text" name="qty" id="qty" value="<?php echo set_value('qty','1'); ?>" class="form-control" required placeholder="Qty" >
								
								</th>
							
								
								<th colspan="2">

								 <?php
 if( $productdiscountaction==true){
	 ?>

				
					  <?php
if($weight=="Yes"){
 ?>		
    <label for="inputdiscount" class="col-md-3 control-label">Discount</label>
    <div class="col-md-9">
	
		<select class="form-control" onchange="getdays()" id="discount"  name="discount" >
	
	<option value=""   >---Select Discount---</option>
	<option value="0:=Amount" selected="selected"  >0 (No discount)</option>

			<?php
			$getalldiscounts = $this->usermodel->populatealldatanoarray('discount', 'companyid',$companyid,'id >',0);

 		
				
	

	
if(is_array($getalldiscounts)) {

   foreach($getalldiscounts as $getalldiscountsrow){

   //echo $courserow->coursename;
    ?>
						<option  value="<?=  $getalldiscountsrow->discount.":=".$getalldiscountsrow->type;   ?>"><?=  $getalldiscountsrow->discount." (".$getalldiscountsrow->name.":".$getalldiscountsrow->type.")";?></option>




	<?php

}} else {
    echo 'No user available.';
}
	
?>
</select>
		
	
	
	 
		 	<?php
 }else{
	   ?>
														  		<input type="text"  style="width:100px" name="discount" value="<?php echo set_value('discount','0'); ?>" class="form-control2" required placeholder="Enter Discount">
 
	 
		<?php 
 }
 
		}else{


		}
  ?>
  
  
								 <?php
 if( $productdiscountaction==true){
	 
	 //
	 ?>

		<select name="mode" id="mode" class="form-control2">


<option  value="AMT" >AMT</option>
<option selected="selected"value="PC">PC%</option>
<option value="DIRECT">DRCT</option>
<option value="Money">Money</option>
<option  value="COMBINED" >Combined</option>
<option  value="TWOSTEPS" >Two Steps</option>





</select>										
				
							
	 
		 	<?php	
		}else{
?>
<input type="hidden" name="mode"  value="<?php echo set_value('mode'); ?>" class="form-control" required placeholder="type" >

		 	<?php	
		}
  ?>
  
  
  	<select name="salestype" id="salestypesalestypesalestypesalestype" class="form-control2">


<option selected="selected" value="retail" >Retail</option>
<option value="wholesale">Wholesale</option>






</select>	
  
  
  
  
  
    	<?php  
		echo $purchaseorder[0]['status'];
if($purchaseorder[0]['deliverymethod']=="requisition"){
	if((trim($purchaseorder[0]['status'])=="Approved")||(trim($purchaseorder[0]['deliverydate']=="Completed"))){
		
	?>

	   	<?php
	}else{
		?>
		
											<button type="submit"  value="sale" name="btn_addsale" class="btn btn-primary"> Click to add product   </button>

		<?php	
	}
	
}ELSE{
	
	?>
									<button type="submit"  value="sale" name="btn_addsale" class="btn btn-primary"> Click to add product   </button>

			
	   	<?php  
}
	
	?>
							

 
  					<?php echo form_close();?>
								
								</th>
								
							</tr>
								<tr>
								<th>Code</th>
								<th>Item Name</th>
<?php
if($weight=="Yes"){
 ?>
		
										<th>No Days</th>
											<th>No Children</th>
											
											
<?php
}
 ?>
	
								<th>Qty</th>
								
								
																			 
											 
	<?php  
if($purchaseorder[0]['deliverymethod'] !="requisition"){
	?>
				 
																	
	
							<th>Dsc</th>

	<?php  
}else{
	
	?>
							<th></th>

	<?php  
}
	
	?>

<?php  
if($purchaseorder[0]['deliverymethod']=="requisition"){
	?>
									<th> B Price</th>

<?php 	
}else{
	?>
								<th>S Price</th>
<?php 	
}
?>									
				
								<th>Total</th>
								

								<th></th>
									<th></th>	
							</tr>
						</thead>
						<?php
					
 if(!is_array($viewreceivings)) {
	  echo "<tr  style='margin-bottom:0px;margin-top:0px;' '>";
      echo "<td colspan='5'>";
    echo"There is no data found..";
    echo "</td>";
   echo "</tr>";

			 }else{
  $finaltotalb=0;
$totalcostb=0;
 $totalcost=0;
  $finaltotal=0;
  	foreach ($viewreceivings as $row){
		
	
 $itemid=$row->code;
  $myid=$row->id;
   $productid=$row->id;
		 		$recaiving= $this->usermodel->populateall('products', 'code',$itemid);
				
			
 if(is_array($recaiving)){
	 
	 foreach ($recaiving as $c){
 
   $c->code;

             ?>
				                    <tbody >
									
										 
										<?php
					
		
                 echo form_open('user/editquotation' , 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="<?php echo set_value('type',$row->type); ?>" class="form-control" required placeholder="type" >


			 		 									<input type="hidden" name="view" value="user/viewnewquotation?randomitemidentifier=<?php echo $purchaseorder[0]['invoice']; ?>" class="form-control" required placeholder="Enter invoiceno">
							
											<tr>
			 <td>
			 
			 <?php ; 
														
   $customer=$c->code;
   if($customer!=""){
	  
      $productname = $this->usermodel->populateallarray('products','code',$itemid);
  
?>
 <a class="btn primary editbtn" id="editbtn"data-tax_included='<?php echo  $productname[0]['tax_included'];?>' data-expdate='<?php echo  $productname[0]['expdate'];?>'data-store='<?php echo  $productname[0]['store'];?>' 	 data-orderamount='<?php echo  $productname[0]['orderamount'];?>' data-supplier='<?php echo  $productname[0]['supplier'];?>'  data-category='<?php echo  $productname[0]['category'];?>'  data-buyingprice='<?php echo  $productname[0]['buyingprice'];?>' data-sellingprice='<?php echo  $productname[0]['sellingprice'];?>'data-promoprice='<?php echo  $productname[0]['promoprice'];?>'  data-wholesaleprice='<?php echo  $productname[0]['wholesaleprice'];?>' data-code='<?php echo  $productname[0]['code'];?>' data-qty='<?php echo  $productname[0]['qty'];?>'	data-description='<?php echo  $productname[0]['description'];?>' data-name='<?php echo  $productname[0]['name'];?>'	data-reorderevel='<?php echo  $productname[0]['reorderevel'];?>'  data-id='<?php echo  $productname[0]['id'];?>' data-toggle='modal' data-target='#editProductModel'> <?php echo $productname[0]['code'] ; ?> </a>	 

<?php
	
   }else{
	    echo "No Product";  
   }

  
  ?>
  
  											<input type="hidden" name="code"  value="<?php echo set_value('code',$row->code); ?>" class="form-control" required placeholder="myid" >

  
  </td>
  								
													    <td><?php ; 
						 $receiptdescription=$configuration[0]['receiptdescription'];
									
   $customer=$c->code;
   if($customer!=""){
	  
     // $productname = $this->usermodel->geteproductbyid($customer);
  
     echo "<b>";
     echo$name=$productname[0]['name']; if($receiptdescription=="yes"){ echo"-".$description=$productname[0]['description'];}
	 
	 
	  echo "</b>";

	
   }else{
	    echo "No Product";  
   }

if($uom=$productname[0]['uom']!=""){
	
$uom=$productname[0]['uom'];
	
}
		
$finaluom="";
if($row->mode!=""){
	$finaluom=$row->mode;
}else{
		$finaluom=$uom;
}



  ?>
  
  <select class="chzn-select"  name="mode" style="width:50%"  >
	
		<option selected="selected" value="<?=  $finaluom;   ?>"> <?php echo $finaluom;?></option>

	
	<?php 
					 
				$uom  = $this->usermodel->populatealldatanoarray('uom','companyid', $companyid,'status',"active" );


							


if(is_array($uom)) {

   foreach($uom as $uomrow){

   //echo $courserow->coursename;
    ?>
			<option value="<?=  $uomrow->code;   ?>"> <?php echo $uomrow->name ?></option>




	<?php

}} else {
    echo 'No uom.';
}
	
?>
</select>
  
  	<textarea name="description" class="form-control" placeholder="Item description"><?php echo set_value('description',$row->description); ?></textarea> 

  


  
  </td>
  
  
  
  <?php
if($weight=="Yes"){
 ?>
	 <td>
    											<input type="text" name="unit"  value="<?php echo set_value('unit',$row->unit); ?>" class="form-control"  placeholder="Enter weight unit" >

  </td>
  
  <td>
  											<input type="text"  name="totalweight" id="totalweight" value="<?php echo set_value('totalweight',$row->totalweight); ?>" class="form-control"  placeholder="Enter total weight" >

  </td>
  	
								
											
<?php
}else{
	?>
	
	
	
    											<input type="hidden" name="unit"  value="<?php echo set_value('unit',$row->unit); ?>" class="form-control"  placeholder="Enter weight unit" >


  

  											<input type="hidden"  name="totalweight" id="totalweight" value="<?php echo set_value('totalweight',$row->totalweight); ?>" class="form-control"  placeholder="Enter total weight" >

 
  
	
	
	
	
<?php	
}
 ?>
  
  
  
												
													<td>
												<input type="hidden" name="invoice" id="invoice" value="<?php echo set_value('finalsalesid',$finalsalesid); ?>" class="form-control" required placeholder="finalsalesid" >
											<input type="hidden" readonly name="mycategoryid" id="mycategoryid" value="<?php echo set_value('mycategoryid',$row->id); ?>" class="form-control" required placeholder="itemid" >



										<input type="hidden" name="myid" id="myid" value="<?php echo set_value('myid',$row->id); ?>" class="form-control" required placeholder="myid" >
																		  		<input type="text" name="myqty" id="myqty" value="<?php echo set_value('myqty',$row->qty); ?>" class="form-control" required placeholder="Qty" >

									
	  	<?php  
if($purchaseorder[0]['deliverymethod'] =="requisition"){
	
	?>
	
	
		<span style="background:#F0F0F0	">		

<?php

	 
				if( $frombranch=="Main"){
											 $myproducts = $this->usermodel->populateallarray('products','code', $c->code);

				}else{
										 $myproducts = $this->usermodel->populatealldataarray('productlist','code', $c->code,'branch', $frombranch);
	
				}
 if( $dontshowstock==true){
 
			}else{
	 
	
		echo"Avl:".$availableqty=$myproducts[0]['qty'];
	
			}










	?>	
	</br>
											
		</span>		
	
	
	
	
		
																							  		Dispatched:<input type="text" name="totals" id="total" value="<?php echo set_value('total',$row->total); ?>" readonly class="form-control"  style="width:50%"placeholder="Qty Dispatch" >

		<?php  
}
	
	?>
		
											
											
											
											
											
											
											
											
											
											
</td>
							 	 <td>
											 
											 
	<?php  
if($purchaseorder[0]['deliverymethod'] !="requisition"){
	?>
				 
																	
	
					<input type="text" name="discount" id="discount" value="<?php echo set_value('discount',$row->discount); ?>" class="form-control" required placeholder="Enter discount" >

	<?php  
}else{
	
	?>
					<input type="hidden" name="discount" id="discount" value="<?php echo set_value('discount',$row->discount); ?>" class="form-control" required placeholder="Enter discount" >

	<?php  
}
	
	?>

											 </td>
											 
											 
							
										 	 <td>
											 					<input type="hidden" name="deliverymethod" id="deliverymethod" value="<?php echo set_value('deliverymethod',$purchaseorder[0]['deliverymethod']); ?>" class="form-control" required placeholder="Buying price" >

								<?php  
if($purchaseorder[0]['deliverymethod']=="requisition"){
	?>
						<input type="hidden" name="sellingprice" id="sellingprice" value="<?php echo set_value('sellingprice',$row->sprice); ?>" class="form-control" required placeholder="selling price" >

		<?PHP
if( $viewbprice==true){
	  ?>	
					<input type="hidden" name="buyingprice" id="buyingprice" value="<?php echo set_value('buyingprice',$row->bprice); ?>" class="form-control" required placeholder="Buying price" >

<?PHP

 }else{
	 ?>	
					<input type="text" name="buyingprice" id="buyingprice" value="<?php echo set_value('buyingprice',$row->bprice); ?>" class="form-control" required placeholder="Buying price" >

<?PHP
 }
   ?>

<?php 	
}else{
	?>
											<input type="hidden" name="buyingprice" id="buyingprice" value="<?php echo set_value('buyingprice',$row->bprice); ?>" class="form-control" required placeholder="Buying price" >

					<input type="text" name="sellingprice" id="sellingprice" value="<?php echo set_value('sellingprice',$row->sprice); ?>" class="form-control" required placeholder="selling price" >
<?php 	
}
?>					 
											 
											 
																	
	

											 </td>
											 
											 
											 
											 
											 
											 
											 
											 
											 	 <td><?php 
												 
	

 
  
												 
												 
												 $units=0;
												 
												 if(trim($row->unit) > 0 ){
													 $units=$row->unit;
												 }else{
													$units=1; 
												 }
												 $totalcostb=(((double)$row->qty)*((double)$row->bprice)* (double)$units ) ;
//$row->unit * $row->totalweight
												 $totalcost=(((double)$row->qty)*((double)$row->sprice) * (double)$units) ;
												 $finaltotal=(double)$finaltotal+(double)$totalcost;
												  $finaltotalb=(double)$finaltotalb+(double)$totalcostb;
												  
												 ?>
												 
												 
												
															<?php  
if($purchaseorder[0]['deliverymethod']=="requisition"){
	
	
	if( $viewbprice==true){
	 

 }else{
	
	echo $totalcostb;
 }
	
}else{
	echo $totalcost;
	
}
?>					 
						 
												 
												 
												 
												 
												 
												 
												 
												 </td>
				  
												  
											  
											  
											  
											  
											  
											  
											  
					<td  style='color:green'> 
				<?php
if($purchaseorder[0]['deliverymethod'] =="requisition"){
	
		if((trim($purchaseorder[0]['status'])=="Approved")||(trim($purchaseorder[0]['deliverydate']=="Completed"))){
		
	 ?>

	 
	 	<?php	

 }else{
	 
	 	 ?>
		                              <a  id="more" class="btn btn-danger" href="<?php echo base_url();?>user/deletepurchasedproducts?randomitemidentifier=<?php   {echo  $finalsalesid;}  ?>&itemid=<?php   {echo $row->id;}  ?>&view=user/viewnewquotation?randomitemidentifier=<?php   {echo  $finalsalesid;}  ?>&deltetable=purchaseorderlist&maintable=quotation"> <span class="glyphicon glyphicon-trash"></span> </a>

	 
	 	<?php
	
 }
}
  ?>
		                              </td> <td>
									  
									  
			 
    	<?php  
if($purchaseorder[0]['deliverymethod'] =="requisition"){
	
		if((trim($purchaseorder[0]['status'])=="Approved")||(trim($purchaseorder[0]['deliverydate']=="Completed"))){
		
	?>
	
	 	<?php	

 }else{
	 
	 
	?>
	
	<button type="submit"  value="myedit" name="btn_editreceivedproduct" class="btn btn-primary"> <span class="glyphicon glyphicon-pencil"></span> </a> Update  </button>

	 	<?php	


 }	 
}ELSE{
	
	?>
<button type="submit"  value="myedit" name="btn_editreceivedproduct" class="btn btn-primary"> <span class="glyphicon glyphicon-pencil"></span> </a> Update  </button>
		                              <a  id="more" class="btn btn-danger" href="<?php echo base_url();?>user/deletepurchasedproducts?randomitemidentifier=<?php   {echo  $finalsalesid;}  ?>&itemid=<?php   {echo $row->id;}  ?>&view=user/viewnewquotation?randomitemidentifier=<?php   {echo  $finalsalesid;}  ?>&deltetable=purchaseorderlist&maintable=quotation"> <span class="glyphicon glyphicon-trash"></span> </a>

			
	   	<?php  
}
	
	?>

					  

 <?php echo form_close();?>	
  					

 </td>
 </tr>
 <?php 
	 }?>
				<?php }?>							
	<?php }} ?>

              <?php ?>	

								<tr>
									<th colspan="4"></b>Invoice Number:	</b><?php echo$finalsalesid?>   : 
							
							
							<?php   $purchaseorder[0]['status'];
if($purchaseorder[0]['deliverymethod']=="requisition"){
	if(trim($purchaseorder[0]['status'])=="Approved"){


if($purchaseorder[0]['deliverydate']=="Completed"){	

echo "<span style='color:red'> Already Completed</span>";
}else{
	
	

	?>
	
	<a  id="more"  class="btn btn-success" href="<?php echo base_url();?>user/receiveitems?invoice=<?php   {echo  $finalsalesid;}  ?>"> Dispatch Items</a>
						<a  id="more"  class="btn btn-success" href="<?php echo base_url();?>user/closesquotationtatus?randomitemidentifier=<?php   {echo  $finalsalesid;}  ?>&status=closed"> Complete/Close</a>

	
	<?php  
	}
		}
}else{
	 ?>	
		<a  id="more"  class="btn btn-success" href="<?php echo base_url();?>user/receiveitems?invoice=<?php   {echo  $finalsalesid;}  ?>"> Dispatch Items</a>
	
<?php		
	
}
 ?>

							

						
							

								
								</th>
								<th colspan="4"><h3>Total:
								
																							<?php  
if($purchaseorder[0]['deliverymethod']=="requisition"){
							if(isset($finaltotalb)) {echo formatMoney($finaltotalb, true); }
	
}else{
	
							if(isset($finaltotal)) {echo formatMoney($finaltotal, true); }
	
}
?>					 
	
								
								
								</h3>
							</th>
							
							</tr>
				
									</tbody>
									
									
					</table>
				</div>	
			</div>			
					
					
					
					
					
					
					
					
					
			</div>							   
				
									
							
								
			<div class="modal-footer">

    

				</div>

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

 
</div>



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

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



				echo $this->session->flashdata('msg'); 
		
                 echo form_open('user/addsalessms' , 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="inputcontact" class="col-sm-2 control-label">	Contact </label>
    <div class="col-sm-10">
								<input type="hidden" name="view" value="user/viewnewquotation?randomitemidentifier=<?php echo $salesid ;?>" id="view" class="form-control" required placeholder="Enter view">

	
	<textarea name="contact" value="<?php echo set_value('contact'); ?>" id="phone1" class="form-control"  placeholder="Enter phone e.g  254712345678,254712345678"></textarea>

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

	

	<div class="form-group">
    <label for="inputmessage" class="col-sm-2 control-label">	Message</label>
    <div class="col-sm-10">
		
<textarea   maxlength="800" required name="message" id="message1" value="pos.robisearch.com/printinvoice?refnumber=11597205277" class="form-control" rows="3" cols="60" onFocus="countChars('textbox','char_count',0)" onKeyDown="countChars('textbox','char_count',0)" onKeyUp="countChars('textbox','char_count',0)"></textarea> <br />Characters:<span id="char_count"></span>

			
		
			
		<span class="char_count"> <?php echo form_error("message"); ?>
		
		</span>
	</div>
  </div>
		

	
	
	 <div class="form-group">

    <div class="col-sm-offset-2 col-sm-10">
     
	         <button type="submit"  value="sms" name="btn_addsms" class="btn btn-primary"> Send SMS   </button>

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

    

				</div>

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



	
	
	<div id="convertsalesModal" 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">Convert Quotation </h4>
      </div>
      <div class="modal-body">
        <h3>Are you sure you want to convert this quotation to? </h3>
      </div>
      <div class="modal-footer">
	  	

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

		
                 echo form_open('user/convertsales' , 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="quotation">



     	<div class="form-group">
    <label for="inputtype" class="col-sm-2 control-label">Convert to?	 </label>
    <div class="col-sm-10">
	
	<select class="form-control" name="type" required  id="type" >
	

	<option value=""  >---Which sales type do you need?---</option>

				<option  selected="selected" value="SalesOrder"  >Sales Order/Cash/Invoice</option>

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







 <input type="hidden" id="salesid"name="salesid" class="salesid" placeholder="salesid" value=""><br>

 <input type="hidden" id="view"name="view" class="view" placeholder="view" value="user/viewnewsalesorder?randomitemidentifier=<?php echo $finalsalesid ; ?>">

  <input type="hidden" id="salesinvoice"name="salesinvoice" class="salesinvoice" placeholder="salesinvoice" value=""><br>

 <button type="button" class="btn btn-success" data-dismiss="modal">Cancel</button>
 		  	         <button type="submit" name="btn_convertquotation" value="quotation" class="btn btn-danger"> Covert Now  </button>

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

  </div>

  </div>		
	
	
	














