<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <link rel="stylesheet" href="style.css">
        <title>Rizwan</title>
        <style>
            
            * {
    
    font-family: 'Times New Roman';
}

td,
th,
tr,
table {
    border-top: 1px solid black;
    border-collapse: collapse;
}

td.description,
th.description {
    width: 100px;
    max-width: 100px;
}

td.quantity,
th.quantity {
    width: 40px;
    max-width: 40px;
    word-break: break-all;
}

td.price,
th.price {
    width: 75px;
    max-width: 75px;
    
}

.centered {
    text-align: center;
    align-content: center;
}

.ticket {
    width: 235px;
    max-width: 235px;
}

img {
    max-width: inherit;
    width: inherit;
}

@media print {
    .hidden-print,
    .hidden-print * {
        display: none !important;
    }
}
        </style>
    </head>
    <body>
        <div class="ticket">
            
<?php if($quality_checked_print[0]['qc_status']==1){ ?>
<img src="<?php echo base_url();?>assets/logo.png" style="width:150px;"/><br/>
            <h3 class="centered">QUALITY CHECKED</h3>
                
            <p class="description" style="text-align: center;"><b>QC Release #.</b><?php echo $quality_checked_print[0]['grn_no']; ?> </p>
            <p class="description" style="text-align: center;"><b>Challan #</b><?php echo $quality_checked_print[0]['dc_no']; ?> </p>
            <p class="description" style="text-align: center;"><b>Lot #</b><?php echo $quality_checked_print[0]['lot_no']; ?> </p>
            <p class="description" style="text-align: center;"><b>Date:</b><?php $date = $quality_checked_print[0]['created'];
                                                 echo date("d-m-Y", strtotime($date)); ?> </p>
            <p class="description" style="text-align: center;"><b>Supplier:</b><?php  echo vendor($quality_checked_print[0]['vendor_id']); ?>
        </p>
            <table>
                <thead>
                    <tr >
                        
                      
                      
                        <th class="description">Item</th>
                         <th class="description" >P.O</th>
                          <th class="description" >QTY</th>
                         <th class="description" >Unit</th>
                        
                    </tr>
                </thead>
                <tbody>
                    
                    <tr>
                       
                        
                        <td class="description" style="text-align: center;"><?php if($quality_checked_print[0]['product_id'] ==0){  echo material_name($quality_checked_print[0]['material_id']); }else if($quality_checked_print[0]['material_id']==0){ ?></td>
                        <td class="description" style="text-align: center;"><?php echo product_name($quality_checked_print[0]['product_id']); } ?></td>
                        <td class="description" style="text-align: center;"><?php echo po_number($quality_checked_print[0]['po_id']); ?></td>
                       <td class="description" style="text-align: center;"><?php echo $quality_checked_print[0]['qty']; ?></td>

                       <td class="description" style="text-align: center;"><?php echo get_unit_name($quality_checked_print[0]['unit']); ?></td>
                    </tr>


                  
                    <!-- <tr>
                        <td class="quantity"></td>
                        <td class="description">TOTAL</td>
                        <td class="price"><?php //echo $sum; ?></td>
                    </tr> -->
                </tbody>
            </table>
            
            <p class="description" style="text-align: center;"><b>GRN#:<?php echo $quality_checked_print[0]['grn_no']; ?> </b><?php   ?>
<hr></hr>
            <?php } else if($quality_checked_print[0]['qc_status']==3){ ?>
                <img src="<?php echo base_url();?>assets/logo.png" style="width:150px;"/><br/>
               <h3 class="centered">REJECTED</h3>
                
            <p class="description" style="text-align: center;"><b>QC Release #.</b><?php echo $quality_checked_print[0]['release_no']; ?> </p>
            <p class="description" style="text-align: center;"><b>Challan #</b><?php echo $quality_checked_print[0]['dc_no']; ?> </p>
            <p class="description" style="text-align: center;"><b>Date:</b><?php $date = $quality_checked_print[0]['created'];
                                                 echo date("d-m-Y", strtotime($date)); ?> </p>
            <p class="description" style="text-align: center;"><b>Supplier:</b><?php  echo vendor($quality_checked_print[0]['vendor_id']); ?>
        </p>
            <table border="1">
                <thead>
                    <tr >
                        
                       
                        <th class="description">Item</th>
                         <th class="description">P.O</th>
                          <th class="description">QTY</th>
                         <th class="description" >Unit</th>
                        
                    </tr>
                </thead>
                <tbody>
                    
                    <tr>
                       
                        
                      
                       
                        <td class="description" style="text-align: center;"><?php if($quality_checked_print[0]['product_id'] ==0){  echo material_name($quality_checked_print[0]['material_id']); }else if($quality_checked_print[0]['material_id']==0){ ?></td>
                        <td class="description" style="text-align: center;"><?php echo product_name($quality_checked_print[0]['product_id']); } ?></td>
                        <td class="description" style="text-align: center;"><?php echo po_number($quality_checked_print[0]['po_id']); ?></td>
                       <td class="description" style="text-align: center;"><?php echo $quality_checked_print[0]['qty']; ?></td>
                        <td class="description" style="text-align: center;"><?php echo get_unit_name($quality_checked_print[0]['unit']); ?></td>
                    </tr>


                  
                    <!-- <tr>
                        <td class="quantity"></td>
                        <td class="description">TOTAL</td>
                        <td class="price"><?php //echo $sum; ?></td>
                    </tr> -->
                </tbody>
            </table>


            <?php } ?>
            <!--<p class="centered">
                <br>www.rizwanassociate.com</p>-->
        </div>
        <button id="btnPrint" class="hidden-print">Print</button>
        <script src="script.js"></script>
    </body>
    <script type="text/javascript">
    const $btnPrint = document.querySelector("#btnPrint");
$btnPrint.addEventListener("click", () => {
    window.print();
});
</script>
</html>
