<?php  
    $modelCredit = Creditnote::model()->findByPk($id);
?>
<!DOCTYPE html>
<html>

<head>
    <title>HIRING RETURN</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%;

 }


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

</style>
</head>

<body>

    <div class="">
   <?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
        
    }
    ?>
<div  style="width:100%;float: left;margin-top: 10px;font-size:11px;font-family:'Times New Roman', Times, serif;"> 
<div style="text-align:left; float:left; width:50%;" >
<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;"> 

   <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" />
  <div style="float:left;">
      
    

  <span style="font-weight:bold;padding-bottom: 6px;float: left;"><?php echo strtoupper($modelCredit->customer->customer_name); ?></span><br />

  <span style="padding-bottom: 6px;float: left;"><?php if($modelCredit->customer->customer_address != '') {     ?>       
                <small><?php echo strtoupper($modelCredit->customer->customer_address); ?></small><br>
                <small><?php echo strtoupper('PO BOX : '.$modelCredit->customer->customer_postal_code.', '.$modelCredit->customer->customer_location); ?></small><br>
				    <small><?php echo strtoupper($modelCredit->customer->customer_city.', '.$modelCredit->customer->country->country_name); ?></small><br>					 
					 <?php } ?> </span>
   <table class="" style="width:100%">
                <tr>
                        <td style="width: 120px">Tel</td>
                        <td style="width: 2px">:</td>
                        <td style="float: left;">
                            <?php echo strtoupper($modelCredit->customer->customer_phone_no); ?>
                        </td>
                </tr>
                <tr>
                    <td>Fax</td>
                        <td>:</td>
                    <td>
                        <?php echo strtoupper($modelCredit->customer->customer_fax); ?>
                    </td>
                </tr>
                <tr>
                    <td>TRN</td>
                        <td>:</td>
                    <td>
                        <?php echo strtoupper($modelCredit->customer->customer_trn_no); ?>
                    </td>
                </tr>
                <!--tr>
                    <td>Kind Attn.</td>
                        <td>:</td>
                    <td>
                        <?php //echo  strtoupper($modelCredit->customercontact->person_name); ?>
                    </td>
                </tr-->
                   <tr>
                    <td><b>RETURN #</b></td>
                        <td>:</td>
                    <td style="text-align:left;">
                        <b><?php echo $modelCredit->id;?></b>
                    </td>
                </tr>
            </table>  
 

  </div>

 </div>

 <div style="text-align:right; float:right;padding-left: 60px; width:40%;" >
     
    <table class="table" style="width:100%">
                <tr>
                  
                        <td class="bc-tl">File ID</td>
                        <td>
                            <?php echo $modelCredit->file_id;?>
                        </td>
                </tr>
                <tr>
                    <td>Customer ID</td>
                    <td>
                        <?php echo $modelCredit->customer_id;?>
                    </td>
                </tr>
                <tr>
                    <td>Return Date</td>
                    <td>
                        <?php echo date('d/m/Y',STRTOTIME($modelCredit->credited_date));?>
                    </td>
                </tr>
                <tr>
                    <td>Order No</td>
                    <td>
                    <?php echo $modelCredit->order_id;?>
                    </td>
                </tr>
                
                <tr>
                    <td>Currency</td>
                    <td>
                        <?php 
                        $modelCurrency = new MasCurrency();
                        $modelCurrency = $modelCurrency->getCurrencyDetails($modelCredit->currency);
                        echo $modelCurrency->currency_code;
                        if($modelCurrency->currency_code!="AED"){
                            echo "/".$modelCredit->exchange_rate;
                        }
                        ?>
                    </td>
                </tr>
              
            </table>
     
     


  </div>
 
  <div style="float:right;margin-right: 30%; width:60%;padding: 5px 10px; border: 1px solid #7D26CD;border-radius: 4px;font-size:15px;margin-top:20px;margin-bottom:20px;width:270px;" align="center">
                    <b>HIRING RETURN</b>
        </div> 

 </div>
      
    <div class="col-md-12">
        <table id="" class="table">
            <thead>
                <tr>
                    <th class="text-center bc-tl">No</th>
                    <th class="text-center">Item</th>
                    <th class="text-center" style="width:30%">Description</th>
                    <th>Batch</th>
                    <th>Serial No</th>
                    <th class="text-center" style="width:4%">Qty(P)</th>
                    <th class="text-center" style="width:4%">Qty(R)</th>
                    <th class="text-center">Unit</th>                    
                </tr>
            </thead>
            <tbody>
                
                    <?php  $modelCreditItems = CreditnoteItem::model()->findAll(array('condition'=>'creditnote_id = '.$id.' AND returned_quantity>0'));
                        $total = $total_vat = 0;
                        foreach ( $modelCreditItems as $i =>  $modelCreditItems) {     ?>
                        
                
                <tr>
                        <td>
                            <?php echo $i+1;?>
                        </td>
                        <td>
                            <?php echo $modelCreditItems->product->hiring_part_number;?>
                        </td>
                        <td>
                            <?php echo $modelCreditItems->description;?>
                        </td>
                        <td><?php echo $modelCreditItems->pdtloc->batch_no;?></td>
                        <td><?php echo $modelCreditItems->pdtloc->serial_no;?></td>
                        <td class="text-right">
                            <?php echo Yii::app()->numberFormatter->formatCurrency($modelCreditItems->quantity," ");?>
                        </td>
                         <td class="text-right">
                            <?php echo Yii::app()->numberFormatter->formatCurrency($modelCreditItems->returned_quantity," ");?>
                        </td>
                        <td>
                            <?php echo $modelCreditItems->product->unit->symbol;?>
                        </td>                        
                </tr>
                <?php } ?>                
       
            </tbody>
        </table>
   
 
    </div>
           <?php if($modelCredit->reason!='')
       {
       ?>
        <div class="box" style="width: 100%">
            <h5>Reason</h5>
            <div class="h5sub-details">
                <?php echo nl2br($modelCredit->reason); ?>
            </div>
        </div>
        <?php
       }
      ?>
            <?php if($modelCredit->remarks!='')
       {
       ?>
            <div class="box" style="width: 100%">
                <h5>Remarks</h5>
                <div class="h5sub-details">
                    <?php echo  nl2br($modelCredit->remarks); ?>
                </div>
            </div>
            <?php } ?>
             <?php if($modelCredit->notes!='')
       {
       ?>
            <div class="box" style="width: 100%">
                <h5>Notes</h5>
                <div class="h5sub-details">
                    <?php echo  nl2br($modelCredit->notes); ?>
                </div>
            </div>
            <?php } ?>

  <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>
