<html>

    <head>
        <title> Hiring External Transfer Receipt </title>
    </head>
    <body>

        <div class="">
            <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:10cm;"> 

                    <img src="<?php echo 'images/'.Yii::app()->user->company_logo; ?>" style="height:90px;"/><br />
                    ---- Page {PAGENO} ----
                </div>
            </htmlpageheader>

            <sethtmlpageheader name="firstpage" value="off" show-this-page="1" />
            <sethtmlpageheader name="otherpages" value="on" />
            <?php if(Yii::app()->user->master_company_code == 'ARK'){?>
    <div class="header" style="width:100%;float: left;padding-bottom:10px;">
        <img src="images/arkheader.png"/>
    </div>
    <?php }
    else{
        ?>
        <div class="header" style="width:100%;float: left;border-bottom: 6px solid #850EA6;padding-bottom:10px;">

   <div style="text-align:left; float:left; width:37%; font-family:'Times New Roman', Times, serif;"> 

    

     <p style="margin:0px;padding:0px;font-size: 18px;"><span style="color:#b61f70;">ACE</span><span style="color:#0080e2;"> CENTRO </span><span style="color:#782a88;" > ENTERPRISES</span></p>

     <div style="float:left;font-size:12px;line-height:16px;">

      <p style="padding: 0px;margin:0px;float: left;">P. O. Box 95325, Abu Dhabi - U.A.E.</p>

      <p style="padding: 0px;margin:0px;float: left;">TRN	:	100226227500003</p>

      <p style="padding: 0px;margin:0px;float: left;">T	&nbsp;	&nbsp; &nbsp;: +971 2 6737900 </p>

      <p style="padding: 0px;margin:0px;float: left;">F	&nbsp;	&nbsp; &nbsp;:	+971 2 6737800</p>

      <p style="padding: 0px;margin:0px;float: left;">E	&nbsp;	&nbsp; &nbsp;:	info@acecentro.com</p>

      <p style="padding: 0px;margin:0px;float: left;">W&nbsp;	&nbsp; &nbsp;:	www.acecentro.com </p>

      </div>

   </div>

   <div style="text-align:center; float:left; width:30%;"> 

   <img src="images/logo.png" style="margin-top:10px;height:110px;"/>

   </div>

   <div style="float:right; width:30%;"> 

   <p style="text-align:right;margin:0px;padding:0px;font-size: 20px;"><span style="color:#b61f70;float:right;text-align:right;font-family:tahoma;">ايـــس</span><span style="color:#0080e2;float:right;text-align:right;font-family:tahoma;"> سينـتـرو </span><span style="color:#782a88;float:right;text-align:right;font-family:tahoma;" > للــمشـاريع</span></p>
   <div style="float:left;font-size:12px;text-align:right;">
 	<p style="margin:0px;float: right;font-family:tahoma;">صندوق بريد 95325 ، أبو ظبي - الإمارات العربية المتحدةم.</p>
      <p style="margin:0px;float: right;font-family:tahoma;">رقم التسجيل الضريبي : 100226227500003</p>
      <p style="margin:0px;float: right;font-family:tahoma;">+971 2 6737900	:ت </p>

      <p style="margin:0px;float: right;font-family:tahoma;">+971 2 6737800 : ف </p>

      <p style="margin:0px;float: right;font-family:tahoma;">info@acecentro.com : لإ </p>

      <p style="margin:0px;float: right;font-family:tahoma;">www.acecentro.com : إ    </p>

      </div>

 </div>

</div>
        <?php
        
    }
    ?>
            <?php $model = HireInventoryIndirectTransfer::model()->findByPk($id); ?>
            <div  style="width:100%;float: left;margin-top: 10px;font-size:11px;font-family:'Times New Roman', Times, serif;"> 
                <div style="text-align:right; float:right;padding-left: 60px; width:40%;" >

                <table class="table" style="width:100%">
                <tr>
                        <td class="bc-tl">Transfer No</td>
                        <td>
                            <?php echo $model->id;?>
                        </td>
                </tr>
                 <tr>
                    <td>Transfer Date</td>
                    <td>
                        <?php echo date('d/m/Y',STRTOTIME($model->transfer_date));?>
                    </td>
                </tr>
                <tr>
                    <td>From Warehouse</td>
                    <td>
                        <?php echo $model->warehouseFrom->warehouse_name;?>
                    </td>
                </tr>
                <tr>
                    <td>Destination</td>
                    <td>
                        <?php echo $model->intermediate_location;?>
                    </td>
                </tr>
            </table>
                </div>
        </div>
        <br>
        <div style="float:right;margin-right: 30%; width:60%;padding: 5px 10px; border: 1px solid #7D26CD;border-radius: 4px;font-size:15px;margin-top:4px;margin-bottom:8px;width:270px;" align="center">
            <b> HIRING EXTERNAL TRANSFER</b>
        </div> 
        <br/>
        </div>
        <br>
        <div class="col-md-12">
            <table id="" class="table">
            <thead>
                <tr>
                    <th class="text-left" style="width:10%">No</th>
                    <th class="text-left" style="width:20%">Item</th>
                    <th class="text-left">Item Description</th>
                    <th class="text-left" style="width:12%">Quantity</th>
                </tr>
            </thead>
            <tbody>
               
                    <?php
                $m=1;
                $condition .= '1=1';
                $condition .= ' AND t.indirect_transfer_id ="' . $id.'"';
                $model_Items = HireInventoryIndirectTransferItem::model()->findAll(array('condition'=>$condition));
                foreach ( $model_Items as $i =>  $each_Item) {                   
                    $header_id          =  $id; 
                    $sl_no="";
                    if ($each_Item->stock->have_serial_no == 'Y') {
                       $modelStockLedger = StockLedgerHiring::model()->findAll(array('condition'=>'header_id IN ('.$header_id.') AND product_id='.$each_Item->item_id.' AND (transaction_type="HIRE_INDIRECT_TRANSFER_IN" OR transaction_type="HIRE_INDIRECT_TRANSFER_OUT")'));
                        if(!empty($modelStockLedger)){
                            foreach ($modelStockLedger as $each){
                                $productlocatin_id = $each->product_location_id;
                                $eachsl_no=ProductLocationHiringDetails::getSerialNo($productlocatin_id);
                                if($sl_no==''){
                                    $sl_no=$eachsl_no;
                                }else{
                                    $sl_no.=' , '.$eachsl_no;
                                }
                            }
                        }	
                    }
                    $batch_no="";
                    if ($each_Item->stock->have_expiry_date == 'Y') {
                        $model = StockLedger::model()->findAll(array('condition'=>'header_id IN ('.$header_id.') AND product_id='.$each_Item->item_id.' AND (transaction_type="HIRE_INDIRECT_TRANSFER_IN" OR transaction_type="HIRE_INDIRECT_TRANSFER_OUT")'));
                        if(!empty($model)){
                            foreach ($model as $each){
                                $productlocatin_id = $each->product_location_id;
                                $eachbatch_no=ProductLocationDetails::getBatchNoWithExpDate($productlocatin_id);
                                if($batch_no==''){
                                    $batch_no=$eachbatch_no;
                                }else{
                                    $batch_no.=' , '.$eachbatch_no;
                                }
                            }
                        }
                    }                        
                ?>
                 <tr>
                        <td>
                            <?php echo $m;?>
                        </td>
                        <td>
                            <?php echo $each_Item->item_name;?>
                        </td>
                        <td>
                            <?php echo $each_Item->item_description;?>
                            <?php if(!empty($sl_no)){?>
                            <br/>
                            Serial No:<?php echo $sl_no; ?>
                            <?php } ?>
                            <?php if(!empty($batch_no)){?>
                            <br/>
                            Batch No:<?php echo $batch_no; ?>
                            <?php } ?>
                        </td>

                        <td class="text-right">
                            <?php echo Yii::app()->numberFormatter->formatCurrency($each_Item->transfer_qty," ");?>
                        </td>
                        
                        
                </tr>
                
                    <?php $m++;
       
        
        }
        ?>
                 

            </tbody>
        </table>
        <?php if($model->indirect_transfer_description!='')
       {
       ?>
        <div class="box">
            <h5>Description</h5>
            <div class="h5sub-details">
                <?php echo nl2br($model->indirect_transfer_description); ?>
            </div>
        </div>
        <?php } ?>
        <?php if($model->reference!='')
       {
       ?>
        <div class="box">
            <h5>Reference</h5>
            <div class="h5sub-details">
                <?php echo nl2br($model->reference); ?>
            </div>
        </div>
        <?php
       }
      ?>

        </div>
    <htmlpagefooter name="firstfooter">
        <div style="text-align:right;width:100%;"><i>Contd...</i></div> 
        <div style="text-align:center;width:100%;"><img src="<?php echo 'images/'.Yii::app()->user->company_footer_logo; ?>" /></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="<?php echo 'images/'.Yii::app()->user->company_footer_logo; ?>" /></div> 
    </htmlpagefooter>
    <sethtmlpagefooter name="lastfooter" value="off" />

    <htmlpagefooter name="myfooter">

        <div style="text-align:center;width:100%;"><img src="<?php echo 'images/'.Yii::app()->user->company_footer_logo; ?>" /></div> 
    </htmlpagefooter>
    <sethtmlpagefooter name="myfooter" page="all" value="on" /> 
</body>

</html>