<!DOCTYPE html>
<html>
<head>
 <title>ORDER ACKNOWLEDGEMENT</title>
<style>
/*@page {
	margin-top: 1cm;
	margin-bottom: 3.6cm;
	margin-left: 1cm;
	margin-right: 1cm;
	header: html_myHeader;
	//footer: html_myfooter;
	/*size: landscape;*/
	font-family:Times New Roman;
}*/
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 style="font-family: "Times New Roman", Times, serif">

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

   <img src="images/logo.png" style="height:90px;"/><br />
    ---- Page {PAGENO} ----
   </div>
</htmlpageheader>

<sethtmlpageheader name="firstpage" value="off" show-this-page="1" />
<sethtmlpageheader name="otherpages" value="on" />
    
    
    
    <!--htmlpageheader name="myHeader">
       <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="images/logo.png" style="height:90px;"/><br />
    ---- Page {PAGENO} ----
   </div>
         </htmlpageheader>
         <sethtmlpageheader name="myHeader" page="1" value="0" />
<sethtmlpageheader name="myHeader" page="ALL" value="1" show-this-page="1" /-->
<!--Page 1 Start -->
<div >
  <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 

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

        $settings = MasCompany::model()->findByPk(Yii::app()->user->master_user_company_id);
        $model = Order::model()->findByPk($id);
        $condition= 't.order_id ="' . $id.'"';
        $modelOrderServiceItems = OrderServiceItem::model()->findAll(array('condition'=>$condition,'order' => 'id ASC'));
    ?>
<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%;" >

  <div style="float:left;">
      
    

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

  <span style="padding-bottom: 6px;float: left;"><?php echo strtoupper(nl2br($model->billing_address)); ?></span>
   <table class="" style="width:100%">
                <tr>
                        <td style="width: 100px">Tel</td>
                        <td style="width: 2px">:</td>
                        <td style="float: left;">
                            <?php echo strtoupper($model->customer->customer_phone_no); ?>
                        </td>
                </tr>
                <tr>
                    <td>Fax</td>
                        <td>:</td>
                    <td>
                        <?php echo strtoupper($model->customer->customer_fax); ?>
                    </td>
                </tr>
                <tr>
                    <td>TRN</td>
                        <td>:</td>
                    <td>
                        <?php echo strtoupper($model->customer->customer_trn_no); ?>
                    </td>
                </tr>
                <tr>
                    <td>Kind Attn.</td>
                        <td>:</td>
                    <td>
                        <?php echo  strtoupper($model->customercontact->person_name); ?>
                    </td>
                </tr>
                   <tr>
                    <td><b>ORDER #</b></td>
                        <td>:</td>
                    <td style="text-align:left;">
                        <b><?php echo /*$modelOrder->invoice_no.'/'.*/$model->id;?></b>
                    </td>
                </tr>
            </table>  
  <!--
  <br />

  Tel	:	<?php echo strtoupper($modelOrder->customer->customer_phone_no); ?><br />

  Fax	:	<?php echo strtoupper($modelOrder->customer->customer_fax); ?><br />
  
  TRN	:   <?php echo strtoupper($modelOrder->customer->customer_trn_no); ?></span><br />

  Attn.	:	<?php echo  strtoupper($modelOrder->contact->person_name); ?></span><br />

 TAX INVOICE #:	<?php echo /*$modelOrder->invoice_no.'/'.*/$modelOrder->id;?></span><br />
 
 -->

  </div>

 </div>

 <div style="text-align:right; float:right;padding-left: 60px; width:40%;" >
     
    <table class="table" style="width:100%">
                <tr>
                    <?php
            $modelOrder = Order::model()->findByPk($id);
            $model_lead=Lead::model()->find(array('condition'=>'file_id="'.$modelOrder->file_id.'"'));
            ?>
                        <td class="bc-tl">File ID</td>
                        <td>
                            <?php echo $modelOrder->file_id;?>
                        </td>
                </tr>
                 <tr>
                    <td>Qtn. ID</td>
                    <td>
                        <?php echo $modelOrder->tender_file_id;?>
                    </td>
                </tr>
                <tr>
                    <td>Customer ID</td>
                    <td>
                        <?php echo $modelOrder->customer_id;?>
                    </td>
                </tr>
                <tr>
                    <td>Order Date</td>
                    <td>
                        <?php echo date('d/m/Y',STRTOTIME($modelOrder->order_date));?>
                    </td>
                </tr>
                <tr>
                    <td>Delivery Date</td>
                    <td>
                        <?php echo date('d/m/Y',STRTOTIME($modelOrder->delivery_date));?>
                    </td>
                </tr>
                <tr>
                    <td>Currency</td>
                    <td>
                        <?php echo $model->currencyname->currency_code;?>
                    </td>
                </tr>
                   <tr>
                    <td>LPO</td>
                    <td>
                        <?php 
                        echo $model->lpo;
                        if ($model->lpo_date!='' && $model->lpo_date!='0000-00-00') {
                            echo ','.date("d/m/Y", strtotime($model->lpo_date));
                        }
                        ?>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <?php echo $model->leadowner->first_name.' '.$model->leadowner->last_name.' , '.$model->leadowner->phno;?>
                    </td>
                </tr>
            </table> 
     
     

 
  </div>

 </div>
<br/>
<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>ORDER ACKNOWLEDGEMENT</b>
        </div> 
 <br/>
 <div style="width:100%;float:left;padding-top:10px;font-size:9px; font-family:'Times New Roman', Times, serif">
  <table width="100%" border="0" cellspacing="0" cellpadding="0" class="table">
            <thead>
                <tr>
                    <th class="text-center bc-tl">No</th>
                    <th class="text-center">Part No</th>
                    <th class="text-center" style="width:35%">Description</th>
                    <?php $colspqn="9";
                    if(isset($master_permission_array['inventory_image_show_order'])){ 
                        $colspqn=$colspqn+1; ?>
                    <th class="text-center">Image</th>
                    <?php } ?>
                    <th class="text-center" style="width:4%">Qty</th>
                    <?php if($bonus_quantity=="Y"){ 
                         $colspqn=$colspqn+1;
                        ?>
                     <th class="text-center" style="width:4%">Bonus Qty</th>                     
                     <?php } ?>
                    <th class="text-center">Unit</th>
                    <th class="text-center" style="width:7%">Rate</th>
                    <th class="text-center" style="width:4%">Tax(%)</th>
					<th class="text-center">Tax Amount</th>
                    <th class="text-center" style="width:3%">Total Discount</th>
                    <th class="text-center bc-tr" style="width:7%">Net Amount</th>
                </tr>
            </thead>
            <tbody>
                
                    <?php
                $m=1;
                $condition= 't.order_id ="' . $id.'"';
                if($modelOrder->order_type=='H'){
                     $condition .= ' AND  checked="1"';
                }
                $total=0;
                $modelItems= OrderItem::model()->with('hiringitem')->findAll(array('condition'=>$condition,'order' => 't.id ASC'));
                $total_tax_amount=0;
                foreach ( $modelItems as $i =>  $eachitem) {
                    
                    /*if($eachitem->product->inventory_type == '2'){
                        ?>
                        <tr style="background: red;">
                            <td colspan=<?php echo $colspqn; ?>><?php echo $eachitem->description;?></td>
                        </tr>
                
                        <?php
                    }
                    else */if($eachitem->product_id == 999999){ ?>
                              <tr style="background-color: #d0f5c5; color: white;"><td colspan="<?= $colspqn+1 ?>"><b><?php echo $eachitem->description;?></b></td></tr>
                     <?php   }
                    else
                    {
                        
                        if($eachitem->hiringitem->type==4 || $eachitem->hiring_item_id==0){
                ?>
                <tr>
                        <td>
                            <?php echo $m;?>
                        </td>
                        <td>
                            <?php 
                            if($model->order_type=='H')
                            echo $eachitem->product->hiring_part_number;
                            else
                            echo $eachitem->product->part_number;?>
                        </td>
                        <td>
                            <?php echo nl2br($eachitem->description);?>
                            <br/>
                            <?php echo nl2br($eachitem->product->html_description);?>
                        </td>
                        <?php if(isset($master_permission_array['inventory_image_show_order'])){ ?>
                        <td>
                           <?php if($eachitem->product->item_image != ''){ ?>
                           <img src="<?php echo Yii::app()->baseUrl . '/uploads/inventoryimages/'.$eachitem->product->item_image; ?>">
                           <?php } ?>
                        </td>
                        <?php } ?>
                        <td class="text-right">
                            <?php echo Yii::app()->numberFormatter->formatCurrency($eachitem->quantity," ");?>
                        </td>
                        <?php if($bonus_quantity=="Y"){ ?>
                            <td class="text-right">
                                <?php echo Yii::app()->numberFormatter->formatCurrency($eachitem->bonus_qty," ");?>
                            </td>
                        <?php } ?>
                        <td>
                            <?php echo $eachitem->orderunit->name;?>
                        </td>
                        <?php $rate=($eachitem->amount+$eachitem->addition_amount)/$eachitem->quantity;?>
                        <td class="text-right">
                            <?php echo Yii::app()->numberFormatter->formatCurrency($rate," ");?>
                        </td>
                         <td class="text-right">
                            <!--// $eachitem->tax_vat_amount.' ('.$eachitem->tax_vat_percentage.'%)' -->
							 <?= (int) $eachitem->tax_vat_percentage ?>
                        </td>
						<td class="text-right">
                            <?php $taxamount=  $eachitem->tax_vat_amount;
							echo $taxamount;
							$total_tax_amount+=$eachitem->tax_vat_amount;
							?>
                        </td>
                           <td class="text-right">
                            <?= $eachitem->deduction_amount; ?>
                        </td>
						
                        <td class="text-right">
                            <?php
 $net_amount = $eachitem->net_amount + $eachitem->tax_vat_amount;
                            echo Yii::app()->numberFormatter->formatCurrency($net_amount," ");?>
							
                        </td>
                </tr>
               
                    <?php 
                        $m=$m+1;
                        $total+=$eachitem->net_amount;
                        }
                        }
        } ?>
         <?php 
    if(count($modelOrderServiceItems)>0){
        foreach($modelOrderServiceItems as $i=>$eachServiceItem){
          
            ?>
             <tr>
               <td>
                                <?php echo $m;?>
                            </td>
                            <td>
                                <?php echo $eachServiceItem->product->part_number;?>
                            </td>
                            <td>
                                <?php echo $eachServiceItem->description;?>
                            </td>
                           
                            <td class="text-right">
                                <?php echo Yii::app()->numberFormatter->formatCurrency($eachServiceItem->quantity," ");?>
                            </td>
                            <td><?php echo (!empty($eachServiceItem->unit_name))?$eachServiceItem->unit_name:$eachServiceItem->product->unit->symbol?></td>
                            <?php $rate=$eachServiceItem->rate;?>
                            <td class="text-right">
                                <?php echo Yii::app()->numberFormatter->formatCurrency($rate," ");?>
                            </td>
                         <td class="text-right">
							 <?= (int) $eachServiceItem->tax_vat_percentage ?>
                        </td>
                            <td class="text-right">
                                <?php echo Yii::app()->numberFormatter->formatCurrency($eachServiceItem->tax_vat_amount," ");?>
                            </td>
                              <td class="text-right">0.00</td>
                            <td class="text-right">
                                <?php echo Yii::app()->numberFormatter->formatCurrency($eachServiceItem->net_amount," ");?>
                            </td>  
              </tr>
            <?php
            $m++;
            $total+=$eachServiceItem->net_amount;
            $total_tax_amount+=$eachServiceItem->tax_vat_amount;
        }
    }
    ?>
                <?php if( $modelOrder->total_tax_amount > 0 ) : ?>
                <tr>
                        <td class="text-right" colspan=<?php echo $colspqn; ?>><b>Total</b></td>
                        <td class="text-right"><b><?php echo Yii::app()->numberFormatter->formatCurrency($total," ");?></b></td>
                </tr>
                <tr>
                     <td class="text-right" colspan=<?php echo $colspqn; ?>><b>VAT</b></td>
                     <td class="text-right"><b><?php echo Yii::app()->numberFormatter->formatCurrency($total_tax_amount," ");?></b></td>
                </tr>
                <?php endif; ?>
                
                <?php
                    $Addition=OrderAddition::model()->findAll(array('condition'=>'order_id='.$modelOrder->id.' AND calculated_value>0'));
                    $Dedution=OrderDeduction::model()->findAll(array('condition'=>'order_id='.$modelOrder->id.' AND calculated_value>0'));
                    if(!empty($Addition))
                    {
                        foreach ($Addition as $eachAddition)
                        {
                      ?>
                    <tr>
                        <?php 
                        $total+=$eachAddition->calculated_value;
         ?>
                            <td class="text-right" colspan=<?php echo $colspqn; ?>>
                                <?php
                        echo MasFooterItems::getFooterItemName($eachAddition->particular);
                        ?>
                            </td>
                            <td class="text-right">+
                                <?php echo Yii::app()->numberFormatter->formatCurrency($eachAddition->calculated_value," ");?>
                            </td>
                    </tr>
                    <?php
                    }
                    }
                    if(!empty($Dedution))
                    {
                        foreach ($Dedution as $eachDed)
                        {
                      ?>
                        <tr>
                            <?php
                        $total-=$eachDed->calculated_value;
         ?>
                                <td class="text-right" colspan=<?php echo $colspqn; ?>>
                                    <?php
                        echo MasFooterItems::getFooterItemName($eachDed->particular);
                        ?>
                                </td>
                                <td class="text-right">-
                                    <?php echo Yii::app()->numberFormatter->formatCurrency($eachDed->calculated_value," ");?>
                                </td>
                        </tr>
                        <?php
                    }
                    }
                    ?>
                            <tr>
                                <td class="text-right total bc-bl" colspan=<?php echo $colspqn; ?>><b>Grand Total  </b></td>
                                <!--<td></td>-->
                                <?php $total += $total_tax_amount; ?>
                                <td class="text-right total bc-br"><b><?php echo Yii::app()->numberFormatter->formatCurrency($total," ");?></b></td>
                            </tr>
                            <tr>
                                <td class="text-right" colspan=<?php echo $colspqn+1; ?>>
                                    <b>
                                    <?php if($total > 0){
                                    echo MasCurrency::number_to_currency(number_format(($total), 2, '.', ''), $modelOrder->currency);
                                }
                                else{
                                    echo "FOC(Free Of Cost)";
                                } ?>
                                    </b>
                                    </td>
                            </tr>
                           
            </tbody>
        </table>
    </div>
  <?php 
         /*echo '<pre>';
         print_r($modelOrder);*/
         
         if($modelOrder->payment_terms!=0)
       {
       ?>
        <div class="box" style="width:100%">
            <h5>Payment Terms</h5>
            <div class="h5sub-details">
                <?php echo nl2br ($modelOrder->paymentTerm->payment_terms); ?>
            </div>
        </div>
        <?php } ?>
             <?php $model =  OwnerBankDetails::model()->find(array('condition' => 'currency_id='.$modelOrder->currency)); 
          if(empty($model))
              $model =  OwnerBankDetails::model()->find(array('condition' => 'currency_id=23'));   
          if(!empty($model)){
    ?>
    

          <div class="box"  style="width: 100%;">
                <h5>Bank Details</h5>
                <table class="" style="width:100%">
                <tr>
                        <td style="width: 90px">Account Name</td>
                        <td style="width: 2px">:</td>
                        <td style="float: left;"><?php echo $model->bank_account_name; ?></td>
                        
                        <td style="width: 90px">Account No</td>
                        <td style="width: 2px">:</td>
                        <td style="float: left;"><?php echo $model->bank_ac_no; ?></td>
                </tr>
                <tr>
                        <td style="width: 90px">Bank Name</td>
                        <td style="width: 2px">:</td>
                        <td style="float: left;"><?php echo $model->bank->bank_name; ?></td>
                        
                        <td style="width: 90px">Bank Branch</td>
                        <td style="width: 2px">:</td>
                        <td style="float: left;"><?php echo $model->bank_branch; ?></td>
                </tr>
                <tr>
                        <td style="width: 90px">IBAN #</td>
                        <td style="width: 2px">:</td>
                        <td style="float: left;"><?php echo $model->bank_iban; ?></td>
                        
                        <td style="width: 90px">Swift Code</td>
                        <td style="width: 2px">:</td>
                        <td style="float: left;"><?php echo $model->bank_swift; ?></td>
                </tr>
                </table>
            </div>
          <?php } ?>
         <?php if($modelOrder->payment_terms!=0)
       {
       ?>

 <div class="box"  style="width: 100%">
            <h5>Payment Terms</h5>
            <div class="h5sub-details">
                <?php echo nl2br ($modelOrder->paymentTerm->payment_terms); ?>
            </div>
        </div>
        <?php } ?>
        <?php if($modelOrder->terms_and_conditions!='')
       {
       ?>

        <div class="box"  style="width: 100%">
            <h5>Terms and Conditions</h5>
            <div class="h5sub-details">
                <?php echo $modelOrder->terms_and_conditions; ?>
            </div>
        </div>
        <?php
       }
      ?>
    <?php if($modelOrder->notes!='')
            {
       ?>
            <div class="box"  style="width: 100%">
                <h5>Notes</h5>
                <div class="h5sub-details">
                    <?php echo  nl2br ($modelOrder->notes); ?>
                </div>
            </div>
    <?php   } ?>
</div>
<div class="start-newpage" style="page-break-before:always">

<div style="width:100%;float:left;font-size:12px;margin-top:5px; font-family:'Times New Roman', Times, serif">

 <div style="width:50%;float:left;">
     
      <span>For and on behalf of,</span><br />

 <span><b>ACE CENTRO ENTERPRISES</b></span>

     
  



 </div>

 

  <div style="width:50%;float:left;margin-left:105px;margin-top:5px; font-family:'Times New Roman', Times, serif">

    <span>Terms and conditions accepted by:</span><br />

 <span><b><?php echo strtoupper($modelOrder->customer->customer_name); ?></b></span>
 </div>

</div>



<div style="width:100%;float:left; text-align:center;font-size:12px;">

 <p style="padding:0px;margin:0px;">Sign</p> 
 <p style="padding:0px;margin:0px;">Date</p> 
 <p style="padding:0px;margin:0px;">Stamp</p> 

</div>



<div style="width:100%;float:left;font-size:12px;">

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

 
<div style="border-bottom:1px solid #000;width:150px; "></div>

 <span><b>Name:</b></span><br />

 <em>Finance Department</em><br />

 <span>Cell : +971 52 315 9460</span><br />

 </div>

 <div style="width:50%;float:left;font-size:12px;margin-left:105px; font-family:'Times New Roman', Times, serif">

 
<div style="border-bottom:1px solid #000;width:150px;"></div>

<span><b><?php echo  strtoupper($modelOrder->customercontact->person_name); ?></b></span><br />

 <em>Authorized Signatory:</em><br />

 <span>Cell : <?php echo  strtoupper($modelOrder->customercontact->contact_mobile_no); ?></span><br />


 

 </div>

</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;?>

