<!DOCTYPE html>
<html>
    <?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_count           = $privillage_modal->count(array('condition'=>$privillage_condition));
        $privillage_settings_module = $privillage_modal->find();
        $master_permission        = $privillage_settings_module->permissions;
        $master_permission_array  = json_decode($master_permission, true);
    ?>

<head>
    <title>Production Goods Receipt</title>
</head>

<body>
    
    <div class="">
        <div class="col-6">
            <br>
            <?php
                         $model = ProductionGoodsReceipt::model()->findByPk($id);
?>
                <!--<span style="color:#1e62a3;font-size: 18px;margin-bottom: 25px"><b>

                 echo $title." # ".$model->id;</b></span><br>-->
                <div class="h3" style="margin-top: 0;margin-bottom: 0;">
                    <?php echo "Production Goods Receipt"; ?>
                </div>
                <div class="input-block">
                    <b><?php echo $model->id;?></b>
                </div>
            <b>Part Number</b> : <?php echo $model->product->part_number;?><br>
                
            <small><b>Description </b> : <?php echo $model->description;?></small>
                
        </div>
        <div class="col-5 offset-1" style="color:#101010;">
            <div class="text-right">
                <img src="<?php echo Yii::app()->baseUrl . '/images/logo/'.Yii::app()->user->pdf_company_logo; ?>" class="logo">
            </div>
            <br>
            <table class="table" style="width:100%">
                <tr>
                    <td>PO. No</td>
                    <td>
                        <?php echo $model->order->id;?>
                    </td>
                </tr>
                <tr>
                    <td>PO. Date</td>
                    <td>
                        <?php echo date('d/m/Y',STRTOTIME($model->order->productionorder_date));?>
                    </td>
                </tr>
                <tr>
                    <td>End Date</td>
                    <td>
                        <?php echo date('d/m/Y',STRTOTIME($model->order->end_date));?>
                    </td>
                </tr>
                <tr>
                    <td><b>Quantity</b></td>
                    <td>
                        <b> <?php echo $model->quantity;?></b>
                    </td>
                </tr>
                <tr>
                    <td>Unit</td>
                    <td>
                        <?php echo $model->order->unitdetails->name;?>
                    </td>
                </tr>
                
                
                
            </table>
        </div>
    </div>
    <br>
    <div class="col-md-12">
        <table id="" class="table">
            <thead>
                <tr>
                    <th class="text-center bc-tl" style="width:5%">No</th>
                    <th class="text-center" style="width:10%">Part No</th>
                    <th class="text-center" style="width:45%">Description</th>
                    <th class="text-center" style="width:10%">Qty</th>
                    <th class="text-center" style="width:10%">Unit</th>
                    <th class="text-center" style="width:10%">Rate</th>
                    <th class="text-center" style="width:10%">Amount</th>
                    
                </tr>
            </thead>
            <tbody>
                
                    <?php 
                $m=1;
                $condition .= '1=1';
                $condition .= ' AND t.production_goods_receipt_id ="' . $id.'"';
                $total=0;
                $model_items = ProductionGoodsReceiptItem::model()->findAll(array('condition'=>$condition));
                foreach ( $model_items as $i =>  $model_items) {
                    
                ?>
                <tr>
                        <td>
                            <?php echo $m++;?>
                        </td>
                        <td>
                            <?php echo $model_items->product_name;?>
                        </td>
                        <td>
                            <?php echo $model_items->description;?>
                        </td>
                        
                        <td class="text-right">
                            <?php echo Yii::app()->numberFormatter->formatCurrency($model_items->quantity," ");?>
                        </td>
                        <td>
                            <?php echo $model_items->unitdetails_mes->name;?>
                        </td>
                        <td class="text-right">
                            <?php echo Yii::app()->numberFormatter->formatCurrency($model_items->rate," ");?>
                        </td>
                        <td class="text-right">
                            <?php echo Yii::app()->numberFormatter->formatCurrency($model_items->amount," ");?>
                        </td>
                </tr>
                
                    <?php
                       
                    } ?>
        
                            
            </tbody>
        </table>
        
    </div>
    <br/>
    <br/>
    <div class="box" style="width: 100%; margin-bottom: 21rem;">
    <br><br>


<div style="position:relative">
    
    <div style="float:left; width: 40%;text-align: center;"> 
         ___________________________________________  <br>
         <div class="row" style="margin-top: 1rem; margin-left: 2px;"><h5 style="text-align: center;">Received By / Signature</h5></div>
    </div>
    <div style="width: 20%;"></div>
    <div style="width: 40%;float: right;text-align: center;"> 
        ___________________________________________ <br>
        <div class="row" style="margin-top: 1rem; margin-left: 2px;"><h5 style="text-align: center;">Received By / Signature</h5></div>
    </div>
</div>
</div>
   <htmlpagefooter name="myfooter">

            <div style="text-align:center;width:100%;font-size:10px"><?= Yii::app()->user->footer_autogenerated; ?>
        <?php
                  date_default_timezone_set("Asia/Dubai");
                 echo date('d/m/Y')." ".date("h:i:sa"); ?>
    </div>

    
        <div style="border-top: 1px dotted #000000; font-size: 12px; text-align: center; padding-top: 10px; background-color: #d7faeb;">
             <div style="text-align:center;width:100%">
                <b><?= Yii::app()->user->footer_line_1 ?></b><br>
                <?= Yii::app()->user->footer_line_2 ?>
            </div>
            <div style="text-align:center;width:100%">Page {PAGENO} of {nb} </div>
        </div>
    </htmlpagefooter>
</body>

</html>
