<!DOCTYPE html>
<html>
<head>
 <title>Invoice List</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 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="<?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 >
  <?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 

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

        $modelInvoice = Invoice::model()->findByPk($id);
        $settings = MasCompany::model()->findByPk(Yii::app()->user->master_user_company_id);
    ?>
<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($modelInvoice->customer->customer_name); ?></span><br />

  <span style="padding-bottom: 6px;float: left;"><?php echo strtoupper(nl2br($modelInvoice->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($modelInvoice->customer->customer_phone_no); ?>
                        </td>
                </tr>
                <tr>
                    <td>Fax</td>
                        <td>:</td>
                    <td>
                        <?php echo strtoupper($modelInvoice->customer->customer_fax); ?>
                    </td>
                </tr>
                <tr>
                    <td>TRN</td>
                        <td>:</td>
                    <td>
                        <?php echo strtoupper($modelInvoice->customer->customer_trn_no); ?>
                    </td>
                </tr>
                <tr>
                    <td>Attn.</td>
                        <td>:</td>
                    <td>
                        <?php echo  strtoupper($modelInvoice->contact->person_name); ?>
                    </td>
                </tr>
                   <tr>
                    <td><b>TAX INVOICE #</b></td>
                        <td>:</td>
                    <td style="text-align:left;">
                        <b><?php echo /*$modelInvoice->invoice_no.'/'.*/$modelInvoice->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>
                    <?php
            $modelQuotation=Quotes::model()->find(array('condition'=>'file_id="'.$modelInvoice->file_id.'"'));
            ?>
                        <td class="bc-tl">Qtn.#/Ord.#</td>
                        <td>
                            <?php echo (!empty($modelQuotation->id))?$modelQuotation->id:"NA";?> / <?php echo (!empty($modelInvoice->order_id))?$modelInvoice->order_id:"NA";?>
                        </td>
                </tr>
                <tr>
                    <td>Invoice Date</td>
                    <td>
                        <?php echo date('d/m/Y',STRTOTIME($modelInvoice->invoice_date));?>
                    </td>
                </tr>
                <tr>
                    <td>Currency</td>
                    <td>
                        <?php echo $modelInvoice->currencyname->currency_code;?>
                    </td>
                </tr>
                   <tr>
                    <td>LPO</td>
                    <td>
                        <?php echo $modelInvoice->order_details->lpo;
                        ?>
                    </td>
                </tr>
                <tr>
                    <td>LPO Date</td>
                    <td>
                        <?php 
                        if ($modelInvoice->order_details->lpo_date!='' && $modelInvoice->order_details->lpo_date!='0000-00-00') {
                            echo date("d/m/Y", strtotime($modelInvoice->order_details->lpo_date));
                        }
                        ?>
                    </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:18px;margin-top:4px;margin-bottom:8px;width:270px;" align="center">
                    <b>TAX INVOICE / <span style="font-family:tahoma;">فاتورة ضريبية </span></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 width="5%" align="center" valign="middle" scope="col">Sr #</th>
                <th width="65%" align="center" valign="middle" scope="col">Description</th>
                <th width="10%" align="left" valign="top" scope="col">U. Price<br>(<?php echo $modelInvoice->currencyname->currency_code ?>)</th>
                <th width="10%" align="center" valign="top" scope="col">Tax(%)</th>
                <th width="10%" align="center" valign="top" scope="col">Tax Amt</th>
                <th width="10%" align="left" valign="top" scope="col">T. Price<br>(<?php echo $modelInvoice->currencyname->currency_code ?>)</th>
                 </tr>
        </thead>
        <tbody>
             <tr>
                <td class="text-center">1</td>
                       
                       <td><?php echo nl2br ($modelInvoice->invoice_advance_remark); ?> </td>
                        <td class="text-right"><?php echo Yii::app()->numberFormatter->formatCurrency($modelInvoice->net_amount," ");?></td>
                        <td class="text-right">
                            <?php
                            $model_order_items = OrderItem::model()->find(array('condition' =>'order_id="'.$modelInvoice->order_id.'" and hiring_master="Y"'));
                             echo (int) $model_order_items->tax_vat_percentage;?>
                        </td>
                        <td class="text-right">
                            <?php echo $modelInvoice->total_tax_amount;?>
                        </td>
                        <td class="text-right"><?php echo Yii::app()->numberFormatter->formatCurrency($modelInvoice->net_amount+$modelInvoice->total_tax_amount," ");?></td>
                </tr>
             <tr>
                        <td class="text-center"  colspan="1"><b>Total</b></td>
                        <td colspan="4"><b>
                            <?php 
                                    echo $modelInvoice->currencyname->currency_code . " " . ucfirst($this->widget('ext.NumtoWord.NumtoWord', array('num' => floatval(($modelInvoice->net_amount))))->result) . ' only'; 
                            ?>
                        </b></td>
                        <td class="text-right" ><b><?php echo Yii::app()->numberFormatter->formatCurrency($modelInvoice->net_amount," ");?></b></td>
                </tr>                   
                   <tr>
                       <td class="text-center"></td>
                        <td colspan="4"><b>Value Added Tax at 5%</b></td>
                        <td class="text-right" ><b><?php echo Yii::app()->numberFormatter->formatCurrency($modelInvoice->total_tax_amount," ");?></b></td>
                    </tr>
                      <tr>
                        <td class="text-center"  colspan="1"><b>G.Total</b></td>
                        <td colspan="4"><b>
                            <?php if(($modelInvoice->net_amount+$modelInvoice->total_tax_amount) > 0){
                                    echo MasCurrency::number_to_currency(number_format(($modelInvoice->net_amount+$modelInvoice->total_tax_amount), 2, '.', ''), $modelInvoice->currency);
                                }
                                ?>
                                
                        </b></td>
                        <td class="text-right" ><b><?php echo Yii::app()->numberFormatter->formatCurrency($modelInvoice->net_amount+$modelInvoice->total_tax_amount," ");?></b></td>
                    </tr>
            </tbody>
        </table>
    </div>
  <?php 
         
         if($modelInvoice->payment_terms!=0)
       {
       ?>
        <div class="box" style="width:100%">
            <h5>Payment Terms</h5>
            <div class="h5sub-details">
                <?php echo nl2br ($modelInvoice->paymentTerm->payment_terms); ?>
            </div>
        </div>
        <?php } ?>
             <?php $model =  OwnerBankDetails::model()->find(array('condition' => 'currency_id='.$modelInvoice->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($modelInvoice->terms_and_conditions!='')
       {
       ?>
    <div style='page-break-after:always'></div>
       <div class="box" style="width:100%">
            <h5>Terms & Conditions</h5>
            <div class="h5sub-details">
                <?php echo $modelInvoice->terms_and_conditions; ?>
            </div>
        </div>
        <?php
       }
      ?>
            <?php if($modelInvoice->notes!='')
       {
       ?>

         <div class="box" style="width:100%">
                <h5>Notes</h5>
                <div class="h5sub-details">
                    <?php echo  nl2br ($modelInvoice->notes); ?>
                </div>
            </div>
            <?php } ?> 
</div>
<br>
<br>

<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($modelInvoice->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($modelInvoice->contact->person_name); ?></b></span><br />

 <em><?php if(!empty($modelInvoice->contact->designation)){ echo $modelInvoice->contact->designation;}else{?>Authorized Signatory<?php } ?></em><br />
 <span>Cell : <?php echo  strtoupper($modelInvoice->contact->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="<?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>


<?php //exit;?>
