<!DOCTYPE html>
<html>
    <head>
        <title>DO</title>
        <style>
            body{padding:0px!important;font-size:12px;}
            table{
                border-collapse: collapse;}
            .item_table {
                border-collapse: collapse;
                font-size:12px!important;
                margin:0px;
            }
            table.item_table,.item_table th,.item_table td {
                border: 1px solid black; 
                font-family:'Times New Roman', Times, serif;
                padding:1px;
            } 

            .second-colom{
                height:100px;
                border-bottom:1px solid;
                text-align:center;
                width:100%;
            }

            .col-sm-3{
                width:25%;
                float:left;
                position:relative;
                min-height:1px;
                font-size:10px;

            }
            .col-sm-6{
                width:50%;
                float:left;
                position:relative;
                min-height:1px;
                font-size:10px;

            }
            .nobdr_table, .nobdr_table td{ border:none!important;padding:0px!important}

        </style>

    </head>
    <body style="font-family: "Times New Roman", Times, serif">
          <br>
        <br>
        <br>
        <br>
        <br>
        <br>
        <br>
        <br>
        <div class="main" >
            <htmlpageheader name="firstpage" style="display:none">
            </htmlpageheader>

            <htmlpageheader name="otherpages" style="display:none">
                <div style="text-align:center; float:left; width:100%;font-family:'Times New Roman', Times, serif;font-style:italic;margin-bottom:10c.m;"> 

                 
                 
                </div>
            </htmlpageheader>

            <sethtmlpageheader name="firstpage" value="off" show-this-page="1" />
            <sethtmlpageheader name="otherpages" value="on" />






        </div>
        <?php
        $crm_login_company_id = Yii::app()->user->master_user_company_id;
        $privillage_modal = new MasCompanySettings();
        $privillage_condition = 'crm_company_id=' . $crm_login_company_id;
        $privillage_settings_module = $privillage_modal->find(array('condition' => $privillage_condition));
        $bonus_quantity = $privillage_settings_module->bonus_quantity;

        $model_Delivery = DeliveryNote::model()->findByPk($id);
        $settings = MasCompany::model()->findByPk(Yii::app()->user->master_user_company_id);
        $delivery_note_order=DeliveryNote::deliverynoteorder($model_Delivery->order_id,$id);
        ?>
        <div style="float:left; width:100%;padding-top: 20px;margin:0;">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td width="12%">No. </td>
                    <td>:<span style="color: red"> <?php echo $id; ?></span></td>
                    <td width=" " align="right" style="padding-right:60px;"><span  style="float:left; text-align:left; font-weight:bold; margin-left: 39%;margin-bottom: 15px;font-size:13px; ">DELIVERY ORDER</span></td>
                    <td width="12%">Date</td>
                    <td width="20%">: <?php echo date('d/m/Y', STRTOTIME($model_Delivery->delivery_date)); ?></td>
                </tr>
                <tr>
                    <td>LPO No.</td>
                    <td>: <?php echo $model_Delivery->lpo; ?></td>
                    <td>&nbsp;</td>
                    <td>Order No.</td>
                    <td>: <?php echo $model_Delivery->order_id; ?></td>
                </tr>
                <tr>
                    <td>LPO Date</td>
                    <td>: <?php
        if ($model_Delivery->order->lpo_date != '' && $model_Delivery->order->lpo_date != '0000-00-00') {
            echo date('d/m/Y', STRTOTIME($model_Delivery->order->lpo_date));
        }
        ?></td>
                    <td>&nbsp;</td>
    <td><?php echo $delivery_note_order; ?></td>
    <td></td>
                </tr>
                <tr>
                    <td>M/s./Mr.</td>
                    <td colspan="2">: <?php echo $model_Delivery->customer->customer_name; ?></td>
                    <td>W/O</td>
                    <td>: </td>
                </tr>
            </table>
        </div>
        <br/>
        <div style="width:100%;float:left;font-size:9px; font-family:'Times New Roman', Times, serif">
            <p style="font-size:12px;margin:4px 0;">Please receive the following goods in good condition.</p>
            <br/>
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table">
                <thead>
                    <tr>
                        <th width="7%" align="center" valign="middle" scope="col">Sr #</th>
                        <?php if ($type == 1) { ?>
                            <th class="text-left" style="width:15%">Part No</th>
                        <?php } ?>
                        <?php if ($type == 2) { ?>
                            <th class="text-left" style="width:15%">OEM No</th>
                        <?php } ?>
                        <th width=" " align="center" valign="middle" scope="col">Item Description</th>
                        <th width="5%" align="left" valign="top" scope="col">Unit</th>
                        <th width="5%" align="center" valign="top" scope="col">Quantity</th>                  
                        <th width="20%" align="left" valign="top" scope="col">Remarks</th>          
                    </tr>
                </thead>
                <tbody>              
                    <?php
                    $m = 1;
                    $condition .= '1=1';
                    $condition .= ' AND t.delivery_note_id ="' . $id . '"';
                    $total = 0;
                    $j = 1;
                    $model_DeliveryItems = DeliveryNoteItem::model()->findAll(array('condition' => $condition, 'order' => 'id ASC'));
                    foreach ($model_DeliveryItems as $i => $each_DeliveryItem) {
                        if ($each_DeliveryItem->picked_qty > 0 || $each_DeliveryItem->picked_bonus_qty > 0) {
                            ?>
                            <tr>
                                <td class="text-center"><?php echo $m; ?></td> <?php if ($type == 1) { ?>
                                    <td>
                                        <?php echo $each_DeliveryItem->product->hiring_part_number; ?>
                                    </td>
                                <?php } ?>
                                <?php if ($type == 2) { ?>
                                    <td>
                                        <?php echo $each_DeliveryItem->product->oem_number; ?>
                                    </td>
                                <?php } ?>                       
                                <td><?php echo nl2br($each_DeliveryItem->description); ?>
                                    <?php
                                    if ($each_DeliveryItem->product->have_serial_no == 'Y') {
                                        echo 'SR# ' . HiringPackageDetails::getSerialNo($id, $each_DeliveryItem->product_id);
                                    }
                                    ?>
                                </td>
                                <td class="text-center"><?php echo $each_DeliveryItem->unitdetails->name; ?></td>
                                <td class="text-center"><?php echo (int) $each_DeliveryItem->picked_qty; ?></td>
                                <td><?php echo $each_DeliveryItem->remarks; ?></td>                      
                            </tr>
                            <?php
                            $m++;
                        }
                    }
                    ?>             
                </tbody>
            </table>
        </div>
        <br/>
        <br/>
        <div style="width:100%;float:left;padding-top:5px;padding-bottom:10px; text-align:left;font-size:12px;">

            <span style="font-size:10px;font-family:'Times New Roman', Times, serif"><b>Terms and Conditions:-</b></span>
            <div style="font-size:12px; border-style: double; border:2px solid; border-spacing: 15px; border-collapse: separate; padding: 10px;border-color: #7a1d8b;" >
                <?php echo nl2br($model_Delivery->terms_and_conditions); ?>
            </div>

        </div>
        <div style="width:100%;float:left; font-size:10px; margin-top:40px; font-family:'Times New Roman', Times, serif">
            <div style="width:27%; float:left;"><span><b>Receiver's Name/Signature and Date </b></span></div>
            <div style="width:45%; float:left;"><span><b>: </b></span></div>
            <div style="float:left; text-align:center; font-family:'Times New Roman', Times, serif">
                <span><b>For <?php if (Yii::app()->user->master_company_code == 'ARK') {
                                            ?>ARK ENGINEERING SERVICES
                                        <?php } else {
                                            ?>ACE CENTRO ENTERPRISES
                                        <?php } ?></b></span></div>
        </div>
        <div style="width:100%;float:left; font-size:10px; margin-top:40px; font-family:'Times New Roman', Times, serif">
            <div style="width:27%; float:left;"><span><b>Receiver's Contact Number: </b></span></div>
            <div style="width:25%; float:left;"><span><b>: </b></span></div>
            <div style="float:left; text-align:center; font-family:'Times New Roman', Times, serif">&nbsp;</div>
        </div>
    </div>
<htmlpagefooter name="firstfooter">
    <div style="text-align:right;width:100%;"><i>Contd...</i></div> 
    <div style="text-align:center;width:100%;"><img src="images/innovating.png" /></div> 
</htmlpagefooter>
<sethtmlpagefooter name="firstfooter" page="all" value="on" />

<htmlpagefooter name="lastfooter">
    <div style="text-align:right;width:100%;">Contd...</div> 

    <div style="text-align:center;width:100%;"><img src="images/innovating.png" /></div> 
</htmlpagefooter>
<sethtmlpagefooter name="lastfooter" value="off" />

<htmlpagefooter name="myfooter">

    <div style="text-align:center;width:100%;"><img src="images/innovating.png" /></div> 
</htmlpagefooter>
<sethtmlpagefooter name="myfooter" page="all" value="on" />
   
</body>

</html>


<?php //exit;?>
