<!DOCTYPE html>
<html>

    <head>
        <title>Enquiry List</title>
    </head>

    <body>
        <div class="heading">
            <div class="logo col-6">
                <img src="images/pdf/logo.png">
            </div>
            <div class="companay_name col-6 text-right">
                 <?php
                
                $model_Company = MasCompany::model()->find();
                
                ?>
                
                <h3><?php echo $model_Company->company_name; ?></h3>
                <p><?php echo $model_Company->company_address; ?>
                <?php echo ', '.$model_Company->company_location; ?>
                <?php echo ', '.$model_Company->country->country_name; ?></p>
                <p><?php echo 'Phone : '. $model_Company->company_phone_no; ?></p>
                <p><?php echo 'Email : '.$model_Company->company_email_id; ?></p>
            </div>
        </div>
        <div class="clearfix"></div>
        <div class="title">
            <div class="col-6">
                <div style="height: 10px;"></div>
            </div>
            <div class="col-6 text-right">
                <h1>MATERIAL REQUEST LIST</h1>
                <div class="details-box">
                </div>
            </div>
        </div>
        <div class="clearfix"></div>
        <div class="table-body">
            <table id="tbl_enquiry_table" class="table table-fixed table-primary dataTable" width="100%">
                <thead>
                    <tr>
                        <th>No</th>
                        <th>Job No</th>
                        <th>Item</th>
                        <th class="text-right">Quantity Request</th>
                        <th class="text-right">Quantity Delivered</th>
                        <th class="text-right">Quantity Balance</th>
                        <th>Unit </th>

                    </tr>
                </thead>
                <tbody>
                    <?php
                    $condition .= 't.material_status = "N"';
                    if ($file_id != '') {
                        $condition .= ' AND t.file_id ="' . $file_id . '"';
                    }

                    $model_registration_list = MaterialRequest::model()->findAll(array('condition' => $condition));
                    foreach ($model_registration_list as $i => $model) {
                        ?>
                    <input type="hidden" id="file_id" name="file_id" value="<?php echo $file_id; ?>">

                    <tr>
                        <td><?php echo $i + 1; ?></td>
                        <td><?php echo $model->file_id; ?></td>
                        <td><?php echo $model->item; ?></td>
                        <td class="text-right"><?php echo $model->quantity_request; ?></td>
                        <td class="text-right"><?php echo $model->quantity_delivered; ?></td>
                        <td class="text-right">
                            <?php
                            $balance_qnty = $model->quantity_request - $model->quantity_delivered; 
                            echo number_format($balance_qnty, 2, '.', '');
                            ?>
                        </td>
                        <td><?php echo $model->unit; ?></td>
                    </tr>
                <?php } ?>               
                </tbody>
            </table>
        </div>
       
            <htmlpagefooter name="myfooter">
                <div style="border-top: 1px dotted #000000; font-size: 12px; text-align: center; padding-top: 10px; ">
                    <div style="text-align:center;width:100%">This report is auto generated by Bluesky project on <?php
        date_default_timezone_set("Asia/Dubai");
        echo date('d/m/Y') . " " . date("h:i:sa");
        ?> </div>
                    <div style="text-align:center;width:100%">Page {PAGENO} of {nb} </div>
                </div>
            </htmlpagefooter>
            <sethtmlpagefooter name="myfooter" page="all" value="on" />
     
    </body>

</html>
