  <!-- Main content -->
   <link rel="stylesheet" href="css/bootstrap.min.css">

<style type="text/css">
		tfoot input {
			width: 100%;
			padding: 3px;
			box-sizing: border-box;
		}
	</style>
   
    <link rel="stylesheet" href="css/bootstrap.min.css"> 
    <!--<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css">-->
 
    <link  href="vendor/new/multi/jquery.dataTables.min.css" rel="stylesheet" type="text/css"> 
	<script src="vendor/new/multi/jquery-3.5.1.js" ></script>
	<script src="vendor/new/multi/jquery.dataTables.min.js" ></script>
<?php
require_once("./connection_sql.php");
?>

<style>

    .view-cell{
        background-color: red;
        color: white; 
    }
    .table-hover tbody tr:hover td {
        background: aqua;
    }
</style>
 <section class="content" onload="search1();">

    <div class="box box-primary">
        <div class="box-header with-border">
            <h3 class="box-title">REJECT LIST</h3>
            <h4 style="float: right;height: 3px;"><b id="time"></b></h4>
        </div>
        <form role="form" class="form-horizontal">
            <div class="box-body">


                <div class="panel-body" style="overflow-x: auto">
                     
                <table width="100%" class="table table-striped table-bordered table-hover" id="example" style="width:auto" >
                    <thead> 

                     <tr>
                        <th>#</th>
                        <th style="background-color:#ffeb00">JOB NO</th>
                        <th>INVOICE NO</th>
                        <th>DATE</th>   
                        <th>CUSTOMER</th>
                        <th>MAKE</th> 
                        <th>SIZE</th>  
                        <th>SERIAL NO</th>  
                        <th>AMOUNT</th>  
                        <th>REPAIR</th>  
                        <th>TOTAL</th>  
                        <th>SEND DATE</th> 
                        <th>FINISH</th>   
                        <th>REMARK</th>   
                    </tr>
                </thead>


                <tbody>
                    <?php
                    $i=1;
                    include './connection_sql.php';
                    
                   if($_SESSION['company']==""){
                        $sql = "select * from dag_item WHERE  reject='1' and cancel='0' and invno is null  ";
                    }else{
                        $sql = "select * from dag_item WHERE  reject='1' and cancel='0' and invno is null  and company='".$_SESSION['company']."' ";
                    }
                    
                  


                    foreach ($conn->query($sql) as $row) {
                       
                        ?>
                        <tr>
                            <td ><?php echo $i; ?></td>
                            <td onclick="name(this)" style="background-color:#ffeb00"><?php echo $row['jobno']; ?></td> 
                            <td onclick="name(this)"><?php echo $row['refno']; ?></td> 
                            <td onclick="name(this)"><?php echo $row['sdate']; ?></td>   
                            <td onclick="name(this)"><?php echo $row['cusname']; ?></td>   
                            <td onclick="name(this)"><?php echo $row['marker']; ?></td>   
                            <td onclick="name(this)"><?php echo $row['size']; ?></td>   
                            <td onclick="name(this)"><?php echo $row['serialno']; ?></td>  
                            <td onclick="name(this)"><?php echo $row['amount']; ?></td>  
                            <td onclick="name(this)"><?php echo $row['repair']; ?></td>  
                            <td onclick="name(this)"><?php echo $row['total']; ?></td>  
                            <td onclick="name(this)"><?php echo $row['onhand_date']; ?></td>  
                            <td onclick="name(this)"><?php echo $row['pro_date']; ?></td>  
                            <td onclick="name(this)"><?php echo $row['remark']; ?></td>  
                             
                        </td>   


                    </tr>

                    <?php
                    $i= $i+1;
                }
                ?>
            </tbody>
        </table>
    </div>

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

</section>

<script>
 
  

function sendother(cdate) {
 
    xmlHttp = GetXmlHttpObject();
    if (xmlHttp == null) {
        alert("Browser does not support HTTP Request");
        return;
    }
    
    var msg = confirm("Do you want to Continue this ! ");
    if (msg == true) {
        var ocompany= prompt("Please Enter Company Name", "");
        if(ocompany.length == 0){
         
            alert('Enter Company');
        }
        
        var url = "onhandlist_data.php";
        var params ="Command="+"sendother";    
        params = params + "&id=" + cdate; 
        params = params + "&ocompany=" + ocompany; 

        xmlHttp.open("POST", url, true);

        xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        xmlHttp.setRequestHeader("Content-length", params.length);
        xmlHttp.setRequestHeader("Connection", "close");

        xmlHttp.onreadystatechange=item_del;

        xmlHttp.send(params);  

    }
}
 
function item_del() {

    var XMLAddress1;

    if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") {
        alert(xmlHttp.responseText);
        setTimeout("location.reload(true);", 500);
    }
}

 

 
   
        </script>
        
 <script type="text/javascript">
 $(document).ready(function() {
         
      var table =  $('#example').DataTable( {
            dom: 'Bfrtip',  
            lengthChange: true,
            fixedHeader: true,
            responsive: true,
            "deferRender": true,
            "pageLength": 10,
            
            buttons: ['pageLength',
                {
                    extend: 'print',
                    customize: function ( win ) {
                         $(win.document.body).find('table').addClass('printer');
     
                        
                    }
                }
            ]
        } );
        
            table.on( 'order.dt search.dt', function () {
            table.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
                cell.innerHTML = i+1;
            } );
             } ) 
              $('div.dataTables_filter input', table.table().container()).focus();
          table.buttons().container()
          .appendTo( '#example_wrapper .col-md-6:eq(0)' );
    } );
</script>