<?php  $this->load->view('master/common/header.php',$data);
$base_name = $data['base_name'];
?>
<link href="<?php echo base_url();?>assets/libs/select2/select2.min.css" rel="stylesheet" type="text/css" />
<script src="<?php echo base_url();?>assets/libs/select2/select2.min.js"></script>

<style>
    .bg-ss:nth-child(2n)
    {
        background-color:white;
    }
    
    .form-group {
    margin: 2px 0;
}

.card{
    margin-bottom:3px;
}


.form-control
{
    height:28px;
}


.btnp
{
    margin-left:10px;
   margin-top:2px;
}
</style>
    <div class="content">
        
        <!-- Start Content-->
        <div class="container-fluid">
            
            <!-- start page title -->
            <div class="row">
                <div class="col-12">
                    <div class="page-title-box">
                        <div class="page-title-right">
                            <ol class="breadcrumb m-0">
                                <li class="breadcrumb-item">Staff</li>
                                <li class="breadcrumb-item">Quatation List</li>
                            </ol>
                        </div>
                        <h4 class="page-title text-uppercase"><?= $page;?></h4>
                    </div>
                </div>
            </div>     
            <!-- end page title --> 

            <div class="row">
                <div class="col-md-12 col-xl-12">
                    <div class="card-box">
                        <div class="row">
                            <div class="col-sm-12">
                                
           
      
      <div class="row order_list mt-3" >
                <div class="ord col-md-12 col-xl-12">
                    <div class="card-box">
                        <div class="row">
                            <div class="col-sm-12 table-responsive">
							    <table id="key-table" class="table table-bordered dt-responsive nowrap" style="border-collapse: collapse; border-spacing: 0; width: 100%;">
                                    <thead>
                                        <tr>
                                            <th>S.no.</th>
            								<th>Quatation No</th>
            								<th>Total Amount</th>
            						
            							    <th>Quatation Date</th>
            							    <th>Action</th>
                                        </tr>
                                    </thead>


                                        <tbody>
                                        
								<?php 
								$i=1;
				   
			
				      
				   $this->db->where('user_id',$user['id']);
				   $this->db->where('status',1);
				   $query3 = $this->db->get(' customer_invoice_list1');
                   foreach ($query3->result() as $row)
                   {

									?>
								        <tr>
                                            <td><?= $i;?></td>
        								     <td><?php $cid=$row->customer_id; echo $bill_no=$row->bill_no;?></td>
        								     <td><?php echo $row->total;?></td>
        							
        								     <td><?php echo $billdate=date('d-m-Y',strtotime($row->addon));?></td>
                                              
                                                
                                                     
                                        
                                                
                                          <td>
        								
        									<input type="hidden"  id="bill_no_<?php echo $row->id;?>" value="<?= $row->bill_no?>"> 
        									<input type="hidden"  id="due_<?php echo $row->id;?>" value="<?= $due?>"> 
        									<input type="hidden"  id="bill_date_<?php echo $row->id;?>" value="<?= $billdate?>"> 
        									<input type="hidden"  id="name_<?php echo $row->id;?>" value="<?= $name?>"> 
        									<input type="hidden"  id="user_id_<?php echo $row->id;?>" value="<?= $cid?>"> 
        									
        									
                                             
                                              <a class="btn btn-warning btn-sm" href="<?php echo base_url().'master/invoice1/order_list/'.$bill_no ?>" >
                                             <i class="fa fa-payment"></i> Manage Quatation
                                             </a>
                                             
        									</td>
        								</tr>
								<?php 
								$i++;
								}?>
							
							</tbody>
							</table>
							</div>
					    </div>
					</div>
				</div>
			
			</div>     
       
           
           
           
                                
                              
					        </div>
					    </div> 
				
					</div>
				</div>
				<!-- /.col-md-6 -->
			</div>
			
			
			
			
	
			<!-- /.row -->
		</div>
		<!-- /.container-fluid -->
	</div>
	<!-- /.content -->
</div>
<!-- /.content-wrapper -->

<script>
    function updstock(id)
    {
        bill_no=$('#bill_no_'+id).val();
        due=$('#due_'+id).val();
        bill_date=$('#bill_date_'+id).val();
        name=$('#name_'+id).val();
        user_id=$('#user_id_'+id).val();
       
        
        $('#name').val(name);
        $('#bill_no').val(bill_no);
        $('#bill_date').val(bill_date);
        $('#due').val(due);
        $('#user_id').val(user_id);
        
        
    }
</script>


<script>
 function collect()
  {
      
    
     paid=parseFloat($('#paid').val());
      due=  parseFloat($('#due').val());
        
      if(paid>due)
      {
            $('#success').css('display','none');
          $('#danger').css('display','block');
           $('#danger1').html('Invalid Enter Amount');
      }
      else
      {
        due=parseFloat($('#due').val());
        paid=parseFloat($('#paid').val());
        ndue=due-paid;
        $('#ndue').val(ndue)
         $('#danger').css('display','none');
      }
      
            
    
  }
</script>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Collection</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
       <form action="<?php echo base_url().'master/invoice/payment'?>" method="post">    
      <div class="modal-body">
  <div class="row"> 
  
   <div class="alert alert-success col-12 msg" id="success" role="alert" style="display:none;">
  <i class="fa fa-check-circle" aria-hidden="true"></i> <b>Success !! </b> <b id="success1"></b>
</div>

<div class="alert alert-danger col-12 msg" id="danger" role="alert" style="display:none;">
 <i class="fa fa-exclamation-triangle" aria-hidden="true"></i> <b>Error !! </b>  <b id="danger1"></b>
</div>                
           
      
           
 <div class="col-md-6">
  <div class="form-group mb-2">
    <label>Staff Name</label>
    <input type="text" readonly id="name" class="form-control"  >
    <input type="hidden" readonly id="user_id" name="user_id"  class="form-control"  >
  </div>
  </div>
  <div class="col-md-6">
   <div class="form-group mb-2">
    <label>Bill No</label>
    <input type="text" readonly id="bill_no" name="bill_no" class="form-control"  >
  </div>
   </div>
  <div class="col-md-6">
   <div class="form-group mb-2">
    <label>PayId</label>
    <input type="text" readonly id="payid" name="payid" value="<?php echo rand(111111,999999)?>"  class="form-control"  >
  </div>
   </div>
  <div class="col-md-6">
   <div class="form-group mb-2">
    <label>Pre Due</label>
    <input type="text" readonly id="due" name="due" class="form-control"  >
  </div>
   </div>
  <div class="col-md-6">
   <div class="form-group mb-2">
    <label>Paid</label>
    <input type="number" onkeyup="collect()" name="paid" id="paid" required class="form-control"  >
  </div>
</div> 


<div class="col-md-6">
   <div class="form-group mb-2">
    <label>New Dues</label>
    <input type="number" readonly id="ndue" required class="form-control"  >
  </div>
</div> 
 
  <div class="col-md-12">
       <div class="form-group mt-4">
   <center> <button type="submit" class="btn btn-primary"  >Collect Now</button></center>
      
      
  </div> 
  </div> 
   
    </div>  
      </div>
     </form>  
    </div>
  </div>
</div>




<?php $this->load->view('master/common/footer.php'); ?>
<script src="<?php echo base_url();?>assets/js/pages/form-advanced.init.js"></script>











