<!DOCTYPE html>
<html lang="en">


<!-- Mirrored from edumin.dexignlab.com/xhtml/add-departments.html by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 17 Nov 2020 13:56:15 GMT -->
<head>
    
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Rizwan </title>
    <!-- Favicon icon -->
    <link rel="icon" type="image/png" sizes="16x16" href="<?php echo base_url();?>assets/images/favicon.png">
    <link rel="stylesheet" href="<?php echo base_url();?>assets/vendor/bootstrap-select/dist/css/bootstrap-select.min.css">
    <link rel="stylesheet" href="<?php echo base_url();?>assets/css/style.css">
    <!-- Pick date -->
   <link rel="stylesheet" href="<?php echo base_url();?>assets/vendor/pickadate/themes/default.css">
    <link rel="stylesheet" href="<?php echo base_url();?>assets/vendor/pickadate/themes/default.date.css">
     <link href="<?php echo base_url();?>assets/vendor/datatables/css/jquery.dataTables.min.css" rel="stylesheet">
    <!-- Custom Stylesheet -->
     

</head>

<body>

    <!--*******************
        Preloader start
    ********************-->
        <div id="preloader">
        <div class="sk-three-bounce">
            <div class="sk-child sk-bounce1"></div>
            <div class="sk-child sk-bounce2"></div>
            <div class="sk-child sk-bounce3"></div>
        </div>
    </div>
    <!--*******************
        Preloader end
    ********************-->

    <!--**********************************
        Main wrapper start
    ***********************************-->
    <div id="main-wrapper">

      <?php  $this->load->view('header'); ?>
        
        <!--**********************************
            Content body start
        ***********************************-->
        <div class="content-body">
            <!-- row -->
            <div class="container-fluid">
                    
                <div class="row page-titles mx-0">
                    <div class="col-sm-6 p-md-0">
                        <div class="welcome-text">
                            <h4>Delivery Challan</h4>
                        </div>
                    </div>
                    <div class="col-sm-6 p-md-0 justify-content-sm-end mt-2 mt-sm-0 d-flex">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item"><a href="index.html">Home</a></li>
                            <li class="breadcrumb-item active"><a href="javascript:void(0);">Delivery Challan</a></li>
                         
                        </ol>
                    </div>
                </div>
                
                <div class="row">


                    <div class="col-12">
            
                               
                            
                                                  

                            <div class="col-12">

                                 <div class="card">

                            <div class="card-body">
                                <button type="button" class="btn btn-rounded btn-success" onclick="btnExport_monthly();"><span class="btn-icon-left text-success"><i class="fa fa-download color-success"></i>
                                    </span>Download</button>
                               <br/><br/><br/>
                                <div class="table-responsive">

                                    <table id="example" class="table table-striped table-bordered" style="font-size:12px;min-width: 845px">
                                        <thead>
                                            <tr>
                                                
                                                <th>SO No</th>
                                                <th>Company</th>
                                                <th>Product</th> 
                                                 <th>Deliverd Qty</th>
                                                 <th>Qty</th>
                                                 <th>Remaining Qty</th>
                                                <th>Status</th>
                                                <th>Delivery Date</th>
                                                <th>Gst Apply</th>
                                                <th>Action</th>
                                                
                                            </tr>
                                        </thead>
                                        <tbody>
                                           
                                              <?php 
                                              
                                               if(!empty($get_po)) { ?>

                                            
                                                <?php foreach ($get_po as $all_get_po) {
                                                 
                                                 ?>
                                            <tr>
                                              
                                                <td><strong><?php echo $all_get_po['so_no']; ?></strong></td>
                                                 <td><?php echo $all_get_po['party_name']; ?></td>
                                                 <td>
                                                  <?php

                                                  $product =  sale_order_pro($all_get_po['id']); 

                                                  echo product_name($product);

                                                 ?></td>

                                                  <td>
                                                    <?php  $deliver = deliverd_qty($all_get_po['id']); ?>
                                                    <?php if($deliver !=""){ ?>
                                                    <strong><?php echo $deliver; ?></strong>

                                                  <?php }else{ ?>

                                                  <?php echo "0"; } ?>
                                                  </td>


                                                 <td><?php echo qty_so($all_get_po['id']);


                                                  ?></td>

                                                  <td><?php  echo qty_so($all_get_po['id'])-$deliver;


                                                  ?></td>
                                                 <td>
                                                  <?php if($all_get_po['status']==0){ ?>
                                                  <strong><span class="badge badge-warning">
                                                    Open Order
                                                  </span></strong>
                                                <?php }else{ ?>

                                                   <strong><span class="badge badge-success">
                                                    Completed
                                                  </span></strong>

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


                                                  $date =  so_delivery_date($all_get_po['id']); 

                                                

                                                  echo date("d-m-Y", strtotime($date) ); 


                                                   ?></td>

                                                   <td> <?php $gst = gst_apply($all_get_po['id']); 

                                                   if($gst ==0 || $gst==""){ ?>

                                                    <span class="badge badge-danger">
                                                    No
                                                  </span>

                                                  <?php  }else{ ?>

                                                    <span class="badge badge-success">
                                                    Yes
                                                  </span>
                                                   <?php } ?></td>
                                               
                                                <td>
                                                  <a href="<?php echo base_url('Sales_order/view_invoice_details_so/'.$all_get_po['id']);?> " target="_blank"  class="badge badge-primary">View</a>

                                                  <a href="<?php echo base_url('Sales_order/view_dc_invoice/'.$all_get_po['id']);?> " target="_blank"  class="badge badge-primary">View DC</a>

                                                     <?php if($all_get_po['status']==0){ ?>
                                                  <button data-toggle="modal" data-target=".bd-example-modal-lg" class="badge badge-success" onclick="reciving_po(<?php echo $all_get_po['id']; ?>);">Add Challan</button>

                                                <?php }else{ ?>


                                                <?php } ?>
                                                </td>
                                            </tr>
                                        <?php }
                                               
                                            }
                                        
                                         ?>
                                               
                                        </tbody>
                                        <tbody>
                                          
                                            
                                        </tbody>
                                    </table>
                                </div>
                                
                            </div>
                            </div>
                            </div>
                        </div>
                    </div>

                   
                </div>
            </div>
       
        <!--**********************************
            Content body end
        ***********************************-->


        <!--**********************************
            Footer start
        ***********************************-->
        
        <!--**********************************
            Footer end
        ***********************************-->

        <!--**********************************
           Support ticket button start
        ***********************************-->

        <!--**********************************
           Support ticket button end
        ***********************************-->


    </div>
    

    <div class="modal fade bd-example-modal-lg" style="width: 100%;" tabindex="-1" role="dialog" aria-hidden="true">
              <div class="modal-dialog modal-lg">
                  <div class="modal-content">
                      <div class="modal-header">
                        
                          <button type="button" class="close" data-dismiss="modal"><span>&times;</span>
                          </button>
                      </div>
                      <div class="modal-body">
                    
                   
                         <div class="card-body" id="reciving_po">
                    
                          </div>
                      



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



         <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
        <style>
        .redborder{
            border:1px solid red;
        }
        </style>

    <script type='text/javascript'>

      function reciving_po(id) { 
      var id =  id;
      $.ajax({
                type:'POST',
                url:'<?php echo base_url('Sales_order/add_d_challan'); ?>',
                data:{id:id},
                dataType:'json',
                success:function(data){
                    //console.log('first'+data);
                    //if(data.status === 'true'){
                     //$('#reciving_po').show(data.html);
                     $('#reciving_po').show().html(data.html);
                     
                       //$('#bom_details').show(data);
                   /* }else{
                        //console.log('third'+data);          
                    }*/
                },
                error:function(data){console.log(data.responseText);}
            });
       
        } 


        
    var add_order = $('#add_purchase_order');   
    
    add_order.on('submit',function(e){

        e.preventDefault();
        
        var add_add_order = add_order.serialize();
         //var id = $('#main_product').val();
      
            $.ajax({
                type:'POST',
                url:'<?php echo base_url('Purchase_order/add_purchase_order'); ?>',
                data:add_add_order,
                dataType:'json',
                success:function(data){
                    console.log('first'+data.status);
                    if(data.status === 'true'){
                        console.log('second'+data.status);
                        $('#purchase_order_success').show().html('Purchase Order added Successfully');
                       setTimeout(function(){location.href="<?php echo base_url('Purchase_order/purchase_order_all/'); ?>"} , 2000);
                    }else{
                        console.log('third'+data);          
                    }
                },
                error:function(data){console.log(data.responseText);}
            });
       // }
    });

    function delete_data(id) { 
        var id = id;
        if (confirm('Are you sure you want to Delete.?')) {
  

        var pro_id = $('#product_id').val();
         $.ajax({
                type:'POST',
                url:'<?php echo base_url('Masterlist/bom_delete_material/'); ?>'+id,
                data:id,
                dataType:'json',
                success:function(data){
                    console.log('first'+data.status);
                    
                        console.log('second'+data.status);
                        //debugger;
                        $('#material_bom_danger').show().html('Bom Component Deleted Successfully');
                       setTimeout(function(){location.href="<?php echo base_url('Masterlist/boms_details/'); ?>"+pro_id} , 2000);
                    
                },
                error:function(data){console.log(data.responseText);}
            });

         } else {
  
            }
        } 



   


 function btnExport_monthly()
{
    
    var tab_text="<table border='2px'><tr bgcolor='#ebebeb'>";
    var textRange; var j=0;
    tab = document.getElementById('example5'); // id of table

    for(j = 0 ; j < tab.rows.length ; j++) 
    {     
        tab_text=tab_text+tab.rows[j].innerHTML+"</tr>";
        //tab_text=tab_text+"</tr>";
    }

    tab_text=tab_text+"</table>";
    tab_text= tab_text.replace(/<A[^>]*>|<\/A>/g, "");//remove if u want links in your table
    tab_text= tab_text.replace(/<img[^>]*>/gi,""); // remove if u want images in your table
    tab_text= tab_text.replace(/<input[^>]*>|<\/input>/gi, ""); // reomves input params


    var ua = window.navigator.userAgent;
    var msie = ua.indexOf("MSIE "); 

    if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./))      // If Internet Explorer
    {
        txtArea2.document.open("txt/html","replace");
        txtArea2.document.write(tab_text);
        txtArea2.document.close();
        txtArea2.focus(); 
        sa=txtArea2.document.execCommand("SaveAs",true,"Generation_School_Report");
    }  
    else                 //other browser not tested on IE 11
        sa = window.open('data:application/vnd.ms-excel,' + encodeURIComponent(tab_text));  

    return (sa);
}
    
    </script>   

       <?php  $this->load->view('footer'); ?>
        
</body>

<!-- Mirrored from edumin.dexignlab.com/xhtml/add-departments.html by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 17 Nov 2020 13:56:15 GMT -->
</html> 