<?php 

$mas_company_details = MasCompany::model()->findByPk(Yii::app()->user->master_user_company_id);
$condition= 't.quotes_id ="' . $id.'"';
$total=0;
$modelQuotes = Quotes::model()->findByPk($id);
$time_decimal_format=$this->decimaltimeHours($modelQuotes->default_hrs_per_day);
$modelQuotesItems = QuotesItem::model()->findAll(array('condition'=>$condition,'order' => 'id ASC','limit'=>1));
$condition_1= 't.quotes_id ="' . $id.'" AND hiring_master="N"';
$modelQuotessubItems = QuotesItem::model()->with('hiringitem')->findAll(array('condition'=>$condition_1,'order' => 't.id ASC'));
$modelQuotesServiceItems = QuotesServiceItem::model()->findAll(array('condition'=>$condition,'order' => 'id ASC'));
$condition= 't.quotes_id ="' . $id.'" AND hiring_master="Y"';
$modelQuotesMainItems = QuotesItem::model()->find(array('condition'=>$condition));
$modelHiringItems = Hiring::model()->findByPk($modelQuotesMainItems->hiring_id);
//Application Images
$prdt_id=$modelQuotesItems[0]['product_id'];
$hiring_application=$modelQuotes->hiring_application;
$model_application_image = Hiring::model()->find(array('condition'=>'product_id="'.$prdt_id.'" and application_id="'.$hiring_application.'"'));
$arr_application_images=array();
if($model_application_image->application_image!=''){
    $arr_application_images = explode(",",$model_application_image->application_image);
    //$arr_application_images = explode(",",$modelHiringItems->application_image);
}
$modelcontact = CustomerContact::model()->findByPk($modelQuotes->contact_id);

$mpdf->use_kwt = true;
?>


<!DOCTYPE html>
<html>
<head>
 <title>Hiring 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 #7a1d8b; 
  font-family:'Times New Roman', Times, serif;
  padding:8px;
  margin-left:1px;
} 


table.item_table table,.item_table table th,.item_table table td {
  border: 0px solid #7a1d8b; 
  font-family:'Times New Roman', Times, serif;
  padding:0px; 
} 

table.item_table th{
	/*background: #7a1d8b;*/
	background: #Fff;
	color: #7a1d8b;
}

 .second-colom{

      height:100px;

       border-bottom:1px solid;

        text-align:center;

        width:100%;

 }


.nobdr_table, .nobdr_table td{ border:none!important;padding:0px!important}
@media print {
.start-newpage{page-break-before:always;display: block;}
}
</style>

</head>
<body style="font-family: "Times New Roman", Times, serif">

<div class="main" >
<!--Page 1 Start -->
<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
        
    }
    ?>

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

  <div style="float:left;">

  <span style="font-weight:bold;padding-bottom: 6px;float: left;">M/s. <?php echo $modelQuotes->customer->customer_name;?> </span><br />

  <!--<span style="padding-bottom: 6px;float: left;">--> 
      <?php if(!empty($modelQuotes->customer->customer_city)){echo $modelQuotes->customer->customer_city.", ";}?>
<?php if(!empty($modelQuotes->customer->customer_postal_code)){?>P. O. Box : <?php echo $modelQuotes->customer->customer_postal_code.",";?><?php } ?><br />
  <?php if(!empty($modelQuotes->customer->customer_state)){echo $modelQuotes->customer->customer_state." - ";}?>
  <?php if(!empty($modelQuotes->customer->customer_country)){ echo $modelQuotes->customer->country->country_name.".";} ?><br />

  Tel&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;<?php echo $modelQuotes->customer->customer_phone_no;?><br />

  Fax&nbsp;&nbsp;&nbsp;:&nbsp;<?php echo $modelQuotes->customer->customer_fax;?><br />

  Attn.	:&nbsp;<?php echo $modelQuotes->customercontact->prefix;
  if(!empty($modelQuotes->customercontact->prefix)){echo '. ';};
  echo $modelQuotes->customercontact->person_name;?> <span style="font-size:10px;font-family:'Times New Roman', Times, serif;">(<?php if($modelQuotes->customercontact->contact_email_id != ""){
      echo 'E: '.$modelQuotes->customercontact->contact_email_id;}/*else{
  echo $mas_company_details->genral_email;}*/?> M: <?php if($modelQuotes->customercontact->contact_mobile_no != ""){
      echo $modelQuotes->customercontact->contact_mobile_no;}else{ echo $modelQuotes->customer->customer_phone_no; }?>)</span></span><br />

  </div>

 </div>

 <div style="text-align:right; float:right;padding-left: 65px; width:25%;" >
     <?php 
  
  $qtn_day_superscript  =   '<sup>'.date('S',STRTOTIME($modelQuotes->qtn_start_date)).'</sup>';
  $qtn_day              =   date('d',STRTOTIME($modelQuotes->qtn_start_date));
  $qtn_month            =   date('M',STRTOTIME($modelQuotes->qtn_start_date));
  $qtn_year             =   date('Y',STRTOTIME($modelQuotes->qtn_start_date));
  ?>
     <table class="" style="width:100%">
                <tr>
                        <td style="width: 70px">Date</td>
                        <td style="width: 2px">:</td>
                        <td style="float: left;">
                            <?php echo $qtn_day.$qtn_day_superscript." ".$qtn_month." ".$qtn_year;; ?>
                        </td>
                </tr>
                 <tr>
                        <td style="width: 70px">Quotation#</td>
                        <td style="width: 2px">:</td>
                        <td style="float: left;">
                            <?php 
                            if(!empty($modelQuotes->revision)){
                                echo $modelQuotes->id." / ".$modelQuotes->revision;
                            }
                            else{
                                echo $modelQuotes->id;
                            }
                            ?>
                        </td>
                </tr>
    </table>            

  <!--span>Date&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;:	<?php 
  
  $qtn_day_superscript  =   '<sup>'.date('S',STRTOTIME($modelQuotes->qtn_start_date)).'</sup>';
  $qtn_day              =   date('d',STRTOTIME($modelQuotes->qtn_start_date));
  $qtn_month            =   date('M',STRTOTIME($modelQuotes->qtn_start_date));
  $qtn_year             =   date('Y',STRTOTIME($modelQuotes->qtn_start_date));
  echo $qtn_day.$qtn_day_superscript." ".$qtn_month." ".$qtn_year;?></span><br />

  <span>Quotation#	:	<?php echo $modelQuotes->id;//$modelQuotes->project_reference;?><!--Qtn/05xx/19></span><br /-->

  </div>

 </div>

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

  <Span style="float:left; text-align:left;margin-left: 38px;">Dear Sir / Madam,</Span><br />

   <div style="float:left; width:100%; text-align:center;padding-top: 20px;">

   <Span  style="float:left; text-align:left; font-weight:bold; border-bottom:2px solid;margin-left: 39%;margin-bottom: 15px;font-size:13px; ">Sub: <?php echo $modelQuotes->qtn_hiring_text;?> </Span><br />

   <div style="width:100%;float:left;margin-top:10px;text-align:left;">

   <span style="float:left; text-align:left;margin-top:10px;font-size:12px;">With reference to the above mentioned subject, please find herewith our best offer for <?php echo $modelQuotes->qtn_hiring_text;?>.</span></div>

   </div>

 </div>

 <div style="width:100%;float:left;padding-top:3px;">

<?php 
        if(!empty($arr_application_images[0]) && $arr_application_images[0]!=""){?>
        <img src="upload/applicationhiring/<?php echo $arr_application_images[0];?>" alt="Images"  width="230" height="150" style="float:left;border:1px solid #ff0000;"/>
        <?php } else{?>
       <img src="upload/hiring/download.jpeg" alt="Images"  style="float:left;width:230px;height:150px;border:1px solid #ff0000;"/>
        <?php } 
        
        if(!empty($arr_application_images[1]) && $arr_application_images[1]!=""){?>
        <img src="upload/applicationhiring/<?php echo $arr_application_images[1];?>" alt="Images"  width="230" height="150" style="float:right;border:1px solid #ff0000;"/>
        <?php } else{?>
       <img src="upload/hiring/download.jpeg" alt="Images"  style="float:right;width:230px;height:150px;border:1px solid #ff0000;"/>
<?php } ?>
  

 </div>

 <div style="width:100%;float:left;padding-top:3px; text-align:center;">
     <?php 
     if(!empty($modelQuotesMainItems->product->item_image) && $modelQuotesMainItems->product->item_image!=""){?>
        <img src="uploads/inventoryimages/<?php echo $modelQuotesMainItems->product->item_image;?>" alt="Images"  width="330" height="230"/>
        <?php } else{?>
        <img src="upload/hiring/download.jpeg" alt="Images"  style="width: 330px; height:230px;"/>
        <?php } ?>

 </div>

  <div style="width:100%;float:left;padding-top: 3px;">

  <?php 
        if(!empty($arr_application_images[2]) && $arr_application_images[2]!=""){?>
        <img src="upload/applicationhiring/<?php echo $arr_application_images[2];?>" alt="Images"  width="230" height="150" style="float:left;border:1px solid #ff0000;"/>
        <?php } else{?>
       <img src="upload/hiring/download.jpeg" alt="Images"  style="float:left;width: 230px;height:150px;border:1px solid #ff0000;"/>
        <?php } 
        
        if(!empty($arr_application_images[3]) && $arr_application_images[3]!=""){?>
        <img src="upload/applicationhiring/<?php echo $arr_application_images[3];?>" alt="Images"  width="230" height="150" style="float:right;border:1px solid #ff0000;"/>
        <?php } else{?>
       <img src="upload/hiring/download.jpeg" alt="Images"  style="float:right;width: 230px;height:150px;border:1px solid #ff0000;"/>
<?php } ?>

 </div>
 <?php 
        if(!empty($arr_application_images[0]) && $arr_application_images[0]!=""){?>
 <br/>
 <div style="text-align:center;width:100%;"><i>(The above images are for illustrative purposes only)</i></div> 
 <?php 
        }
        ?>
<!--div style="text-align:center;margin-top:5px;width:100%; font-style:italic;font-family:'Times New Roman', Times, serif"><div style="width:90%; float:left;">(The above images are for illustrative purposes only)</div>  <div style="float:right;text-align:right;">Contd…. </div></div-->
 
</div>
<!--Page 1 End -->

<!-----Page 2 Start------>
<div class="start-newpage" style="page-break-before:always">
 <div style="width:100%;float:left;padding-top:10px;font-size:12px; font-family:'Times New Roman', Times, serif">
  <table width="100%" border="0" cellspacing="0" cellpadding="0" class="item_table">
    <tr>
      <th width="6%" align="center" valign="middle" scope="col">Sr#</th>
      <th width=" " align="center" valign="middle" scope="col">Item Description</th>
      <th width="8%" align="center" valign="middle" scope="col">Qty</th>
      <th width="10%" align="center" valign="middle" scope="col">Amount</th>
      <th width="8%" align="center" valign="middle" scope="col">Discount</th>
      <th width="10%" align="center" valign="middle" scope="col">U. Price<br />
      (<?php echo $modelQuotes->currencyname->currency_code;?>)</th>
    </tr>
    
    <?php 
    
    foreach($modelQuotesItems as $i=>$eachItem){
        $qty_text=' Machine';    
        if($eachItem->quantity>1){
            $qty_text=' Machines';
        }
        $model_daily_amount = QuotesItem::model()->find(array('condition'=>'t.quotes_id ="' . $eachItem->quotes_id.'" AND bill_type="1"')); 
        $model_monthly_amount= QuotesItem::model()->find(array('condition'=>'t.quotes_id ="' . $eachItem->quotes_id.'" AND bill_type="3"'));
        $model_weekly_amount = QuotesItem::model()->find(array('condition'=>'t.quotes_id ="' . $eachItem->quotes_id.'" AND bill_type="2"'));  
        
        if(!empty($model_daily_amount->rate)&&!empty($model_monthly_amount->rate) && !empty($model_weekly_amount->rate)){ ?>
            <tr>
          <td rowspan="3" align="center" valign="middle"><?php echo $i+1;?></td>
          <td rowspan="3" align="left" valign="middle" >
              <b><?php echo nl2br($eachItem->description);?></b>
              <br/>
              <?php echo $eachItem->product->html_description;?>
              </td>
          <td align="center" valign="middle"><?php echo (int) $eachItem->quantity.' '.$qty_text;?><br/>
              <?php echo $time_decimal_format.' Hours'; ?>
            </td>      
          <td align="right" valign="middle"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_daily_amount->rate+$model_daily_amount->addition_amount),2),"");?></td>
          <td align="right" valign="middle"><?php echo Yii::app()->numberFormatter->formatCurrency(round($model_daily_amount->deduction_amount,2),"");?></td>
          <td align="right" valign="middle"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_daily_amount->rate+$model_daily_amount->addition_amount)-$model_daily_amount->deduction_amount,2),"");?><br>Per Day</td>
          
          </tr>
          <tr>
           <td align="center" valign="middle"><?php echo (int) $eachItem->quantity.' '.$qty_text;?><br/>
                  <?php $weektime=$time_decimal_format*6; 
                    echo '('.$time_decimal_format.'*6)='.$weektime.' Hours per Week';
                ?>
            </td> 
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_weekly_amount->rate+$model_weekly_amount->addition_amount),2),"");?></td>
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round($model_weekly_amount->deduction_amount,2),"");?></td>
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_weekly_amount->rate+$model_weekly_amount->addition_amount)-$model_weekly_amount->deduction_amount,2),"");?><br>Per Week</td>
          
      </tr>
      <tr>
          <?php //if(!empty($model_monthly_amount->rate)){?>
          <td align="center" valign="middle"><?php echo (int) $eachItem->quantity.' '.$qty_text;?><br/>
              <?php $monthtime=$time_decimal_format*26; 
                echo '('.$time_decimal_format.'*26)='.$monthtime.' Hours per Month';
            ?>
        </td> 
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_monthly_amount->rate+$model_monthly_amount->addition_amount),2),"");?></td>
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round($model_monthly_amount->deduction_amount,2),"");?></td>
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_monthly_amount->rate+$model_monthly_amount->addition_amount)-$model_monthly_amount->deduction_amount,2),"");?><br>Per Month</td>
          <?php //}?>
      </tr>
        <?php }else if(!empty($model_daily_amount->rate) && !empty($model_monthly_amount->rate)){ ?>
           <tr>
          <td rowspan="2" align="center" valign="middle"><?php echo $i+1;?></td>
          <td rowspan="2" align="left" valign="middle" >
              <div style="float:left;" ><?php echo nl2br($eachItem->description);?>
              <br/>
              <?php echo $eachItem->product->html_description;?></div>
              </td>
            <td align="center" valign="middle"><?php echo (int) $eachItem->quantity.' '.$qty_text;?><br/>
              <?php echo $time_decimal_format.' Hours'; ?>
            </td>      
          <td align="right" valign="middle"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_daily_amount->rate+$model_daily_amount->addition_amount),2),"");?></td>
          <td align="right" valign="middle"><?php echo Yii::app()->numberFormatter->formatCurrency(round($model_daily_amount->deduction_amount,2),"");?></td>
          <td align="right" valign="middle"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_daily_amount->rate+$model_daily_amount->addition_amount)-$model_daily_amount->deduction_amount,2),"");?><br>Per Day</td>
          
      </tr>
      <tr>
          
          <td align="center" valign="middle"><?php echo (int) $eachItem->quantity.' '.$qty_text;?><br/>
              <?php $monthtime=$time_decimal_format*26; 
                echo '('.$time_decimal_format.'*26)='.$monthtime.' Hours per Month';
            ?>
        </td> 
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_monthly_amount->rate+$model_monthly_amount->addition_amount),2),"");?></td>
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round($model_monthly_amount->deduction_amount,2),"");?></td>
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_monthly_amount->rate+$model_monthly_amount->addition_amount)-$model_monthly_amount->deduction_amount,2),"");?><br>Per Month</td>
          
      </tr>
        <?php }else if(!empty($model_daily_amount->rate) && !empty($model_weekly_amount->rate)){ ?>
           <tr>
          <td rowspan="2" align="center" valign="middle"><?php echo $i+1;?></td>
          <td rowspan="2" align="left" valign="middle" >
              <div style="float:left;" ><?php echo nl2br($eachItem->description);?>
              <br/>
              <?php echo $eachItem->product->html_description;?></div>
              </td>
            <td align="center" valign="middle"><?php echo (int) $eachItem->quantity.' '.$qty_text;?><br/>
              <?php echo $time_decimal_format.' Hours'; ?>
            </td>      
          <td align="right" valign="middle"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_daily_amount->rate+$model_daily_amount->addition_amount),2),"");?></td>
          <td align="right" valign="middle"><?php echo Yii::app()->numberFormatter->formatCurrency(round($model_daily_amount->deduction_amount,2),"");?></td>
          <td align="right" valign="middle"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_daily_amount->rate+$model_daily_amount->addition_amount)-$model_daily_amount->deduction_amount,2),"");?><br>Per Day</td>
          
      </tr>
      <tr>
          <td align="center" valign="middle"><?php echo (int) $eachItem->quantity.' '.$qty_text;?><br/>
                  <?php $weektime=$time_decimal_format*6; 
                    echo '('.$time_decimal_format.'*6)='.$weektime.' Hours per Week';
                ?>
            </td> 
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_weekly_amount->rate+$model_weekly_amount->addition_amount),2),"");?></td>
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round($model_weekly_amount->deduction_amount,2),"");?></td>
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_weekly_amount->rate+$model_weekly_amount->addition_amount)-$model_weekly_amount->deduction_amount,2),"");?><br>Per Week</td>
          
      </tr>
      
      
      
        <?php } else if(!empty($model_monthly_amount->rate) && !empty($model_weekly_amount->rate)){ ?>
        <tr>
           <td rowspan="2" align="center" valign="middle"><?php echo $i+1;?></td>
          <td rowspan="2" align="left" valign="middle" >
              <div style="float:left;" ><?php echo nl2br($eachItem->description);?>
              <br/>
              <?php echo $eachItem->product->html_description;?></div>
              </td>
           <td align="center" valign="middle"><?php echo (int) $eachItem->quantity.' '.$qty_text;?><br/>
                  <?php $weektime=$time_decimal_format*6; 
                    echo '('.$time_decimal_format.'*6)='.$weektime.' Hours per Week';
                ?>
            </td> 
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_weekly_amount->rate+$model_weekly_amount->addition_amount),2),"");?></td>
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round($model_weekly_amount->deduction_amount,2),"");?></td>
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_weekly_amount->rate+$model_weekly_amount->addition_amount)-$model_weekly_amount->deduction_amount,2),"");?><br>Per Week</td>
          
      </tr>
      <tr>
          <?php //if(!empty($model_monthly_amount->rate)){?>
          <td align="center" valign="middle"><?php echo (int) $eachItem->quantity.' '.$qty_text;?><br/>
              <?php $monthtime=$time_decimal_format*26; 
                echo '('.$time_decimal_format.'*26)='.$monthtime.' Hours per Month';
            ?>
        </td> 
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_monthly_amount->rate+$model_monthly_amount->addition_amount),2),"");?></td>
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round($model_monthly_amount->deduction_amount,2),"");?></td>
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_monthly_amount->rate+$model_monthly_amount->addition_amount)-$model_monthly_amount->deduction_amount,2),"");?><br>Per Month</td>
          <?php //}?>
      </tr>
        <?php } else if(!empty($model_weekly_amount->rate)){?>
        <tr>
          <td align="center" valign="middle"><?php echo $i+1;?></td>
          <td align="left" valign="middle" >
              <div style="float:left;" ><?php echo nl2br($eachItem->description);?>
              <br/>
              <?php echo $eachItem->product->html_description;?></div>
              </td>
            <td align="center" valign="middle"><?php echo (int) $eachItem->quantity.' '.$qty_text;?><br/>
                  <?php $weektime=$time_decimal_format*6; 
                    echo '('.$time_decimal_format.'*6)='.$weektime.' Hours per Week';
                ?>
            </td> 
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_weekly_amount->rate+$model_weekly_amount->addition_amount),2),"");?></td>
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round($model_weekly_amount->deduction_amount,2),"");?></td>
          <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_weekly_amount->rate+$model_weekly_amount->addition_amount)-$model_weekly_amount->deduction_amount,2),"");?><br>Per Week</td>
          
      </tr>
       <?php } else if(!empty($model_daily_amount->rate)){?>
        <tr>
            <td align="center" valign="middle"><?php echo $i+1;?></td>
            <td align="left" valign="middle" >
              <div style="float:left;" ><?php echo nl2br($eachItem->description);?>
              <br/>
              <?php echo $eachItem->product->html_description;?></div>
            </td>
            <td align="center" valign="middle"><?php echo (int) $eachItem->quantity.' '.$qty_text;?><br/>
              <?php echo $time_decimal_format.' Hours'; ?>
            </td>      
          <td align="right" valign="middle"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_daily_amount->rate+$model_daily_amount->addition_amount),2),"");?></td>
          <td align="right" valign="middle"><?php echo Yii::app()->numberFormatter->formatCurrency(round($model_daily_amount->deduction_amount,2),"");?></td>
          <td align="right" valign="middle"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_daily_amount->rate+$model_daily_amount->addition_amount)-$model_daily_amount->deduction_amount,2),"");?><br>Per Day</td>
        
        </tr> 
        <?php } else if(!empty($model_monthly_amount->rate)){?>
        <tr>
            <td align="center" valign="middle"><?php echo $i+1;?></td>
            <td align="left" valign="middle" >
              <div style="float:left;" ><?php echo nl2br($eachItem->description);?>
              <br/>
              <?php echo $eachItem->product->html_description;?></div>
            </td>
            <td align="center" valign="middle"><?php echo (int) $eachItem->quantity.' '.$qty_text;?><br/>
              <?php $monthtime=$time_decimal_format*26; 
                echo '('.$time_decimal_format.'*26)='.$monthtime.' Hours per Month';
            ?>
            </td>  
            <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_monthly_amount->rate+$model_monthly_amount->addition_amount),2),"");?></td>
            <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round($model_monthly_amount->deduction_amount,2),"");?></td>
            <td align="right"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($model_monthly_amount->rate+$model_monthly_amount->addition_amount)-$model_monthly_amount->deduction_amount,2),"");?><br>Per Month</td>
          
        </tr>
            
        <?php }
    }
    /*$accessories_flag=0;
    foreach($modelQuotessubItems as $i=>$eachItem){
          
      if($eachItem->hiringitem->type==4 || $eachItem->hiring_item_id==0){
          $accessories_flag=1;
      }
    }
    */
    
    /*if($accessories_flag==1){
    ?>
    <tr>
        <td colspan="4"><b>Accessories<?php echo '<pre>';print_r($modelQuotessubItems);?></b></td>
    </tr>
    <?php
    }*/
      $next_serial_no=2;
      foreach($modelQuotessubItems as $i=>$eachItem){
          
          if($eachItem->hiringitem->type==4 || $eachItem->hiring_item_id==0){
            ?>
             <tr>
              <td  align="center" valign="middle"><?php echo $next_serial_no;?></td>
              <td  align="left" valign="middle"><?php echo nl2br($eachItem->description);?></td>
              <td  align="center" valign="middle"><?php echo (int) $eachItem->quantity;?></td>
              <td  align="right" valign="middle"><?php echo Yii::app()->numberFormatter->formatCurrency(round($eachItem->net_amount,2),"");?></td>
              <td  align="right" valign="middle"><?php echo Yii::app()->numberFormatter->formatCurrency(round($eachItem->deduction_amount,2),"");?></td>
              <td align="right" valign="middle"><?php echo Yii::app()->numberFormatter->formatCurrency(round(($eachItem->net_amount - $eachItem->deduction_amount),2),"");?></td>
              </tr>
            <?php
           $next_serial_no++;
          }
        }
   ?>
    <?php 
    
    foreach($modelQuotesServiceItems as $i=>$eachServiceItem){
      
        ?>
         <tr>
          <td align="center" valign="middle"><?php echo $next_serial_no;?></td>
          <td align="left" valign="middle"><?php echo nl2br($eachServiceItem->description);//$eachServiceItem->product->part_number;"<br>".;?></td>
          <td align="center" valign="middle"><?php echo (int) $eachServiceItem->quantity;?></td>
            <td  align="right" valign="middle"><?php echo Yii::app()->numberFormatter->formatCurrency(round($eachServiceItem->rate,2),"");?><br><?php echo (!empty($eachServiceItem->unit_name))?$eachServiceItem->unit_name:$eachServiceItem->product->unit->symbol?></td>
            <td  align="right" valign="middle">0.00</td>
          <td align="right" valign="middle"><?php echo Yii::app()->numberFormatter->formatCurrency(round($eachServiceItem->quantity*$eachServiceItem->rate,2),"");?></td>
          </tr>
        <?php
        $next_serial_no++;
    }
    ?>
    <!--tr>
      <td align="center" valign="top"><strong>P. N.:</strong></td>
      <td colspan="3" align="left" valign="middle"><ul style="padding:0px;margin-left:10px;"><li> Availability: Ex-stock, subject to availability of plant and personnel at the time of award.</li>
      
          <li> Minimum hire period: 2 weeks chargeable.</li>
          <li> Standard daily hire of 8 hours is applicable, irrespective of actual machine operation, or non-availability of raw material.</li>
          <li> Daily working hours cannot be accumulated or adjusted with Public Holidays, overtime or hours per week/month.</li>
          <li> Minimum overtime of 8 hours per shift is chargeable for work done on Fridays and Public Holidays, irrespective of actual 
            machine operating hours on site.</li>
          <li> In case of unmanned operation i.e. without our Operator/s, a weekly rate of AED. 10,000.00 would be applicable.</li>
      </ul></td>
    </tr-->
    </table>
    <br>
 </div>



<!--
 <div style="width:100%;float:left;padding-top: 10px;">

          <div style="width:33%;float:left;text-align:left;">
              <?php 
                if(!empty($arr_application_images[0]) && $arr_application_images[0]!=""){?>
                <img src="upload/applicationhiring/<?php echo $arr_application_images[0];?>" alt="Images"   style="float:left; height:100px;margin-left:30px"/>
                <?php } else{?>
               <img src="upload/hiring/download44.jpeg" alt="Images"  style="float:left; height:100px;margin-left:30px"/>
                <?php } ?>
          </div>

          <div style="width:33%;float:left;text-align:center;">
            <?php 
                if(!empty($arr_application_images[1]) && $arr_application_images[1]!=""){?>
                <img src="upload/applicationhiring/<?php echo $arr_application_images[1];?>" alt="Images"  style=" height:100px;"/>
                <?php } else{?>
               <img src="upload/hiring/download1561.jpeg" alt="Images"  style=" height:100px;"/>
            <?php } ?> 
          </div>

         <div style="width:33%;float:right;text-align:right;">
            <?php 
                if(!empty($arr_application_images[2]) && $arr_application_images[2]!=""){?>
                <img src="upload/applicationhiring/<?php echo $arr_application_images[2];?>" alt="Images"  style=" height:100px;"//>
                <?php } else{?>
               <img src="upload/hiring/download1561.jpeg" alt="Images"  style=" height:100px;"/>
            <?php } ?>
          </div> 
          
 </div>
 
 -->
 <!--div style="text-align:center;margin-top:5px;width:100%; font-style:italic;font-family:'Times New Roman', Times, serif">
 <div style="width:90%; float:left;">(The above images are for illustrative purposes only)</div>  <div style="float:right;text-align:right;">Contd…. </div></div--> 
 
 </div>
 <!--- Page 2 End--->
 
 
  <!--- Page 3 Start--->
 
 <div class="start-newpage"  style="page-break-before:always">
 
 
 <div style="width:100%;float:left;padding-top:5px;padding-bottom:10px; text-align:center;font-size:12px;">

 <span style="border-bottom:2px solid; font-size:12px;font-family:'Times New Roman', Times, serif"><b>HIRE AGREEMENT CONTRACTUAL TERMS AND CONDITIONS</b></span>

</div>



<div style="width:100%;float:left;font-size:12px;margin:0px;padding:0px;font-family:'Times New Roman', Times, serif">
    <?php echo htmlspecialchars_decode(stripslashes($modelQuotes->terms_and_conditions)); ?>
     <?php //echo nl2br($modelQuotes->terms_and_conditions); ?>


</div>
<?php //exit;?>


<!--div style="text-align:center;margin-top:5px;width:100%; font-style:italic;font-family:'Times New Roman', Times, serif"> <div style="float:right;text-align:right;">Contd…. </div></div-->
 
 
</div>
 
 
 
 


<!--last page start--> 
     
<table width="100%" cellpadding="0" cellspacing="0" style="page-break-inside:avoid;font-size:13px;margin-top:5px; font-family:'Times New Roman', Times, serif; ">
<tr>
<td colspan="3" height="30">We trust the above is acceptable and await a favourable response. Please contact us for any further clarifications. </td>
 </tr>
<tr>
  <td width="30%"  height="50"><div style="width:50%;float:left;">
     
     <span>For and on behalf of,</span><br />

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


 </div></td>
  <td align="center" valign="middle"> </td>
  <td width="30%" align="left"><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($modelQuotes->customer->customer_name); ?></b></span>

 </div></td>
</tr> 
<tr>
  <td align="left"  height="60"> 
      <?php
      if ($modelQuotes->leadowner->signature != '') {
          ?>
          <img src="uploads/signature/<?php echo $modelQuotes->leadowner->signature; ?>" alt="Images"  width="150px" height="60px" />

          <?php }
      ?>
  </td>
  <td align="center"> <div style="width:20%;float:left; text-align:center;font-size:12px;">
 <p style="padding:0px; margin-top:10px; margin-bottom:0px;">Sign</p> 
 <p style="padding:0px;margin:0px;">Date</p> 
 <p style="padding:0px;margin:0px;">Stamp</p> 

</div></td>
  <td align="left"> </td>
</tr>
<tr>
  <td align="left"  height="60" style="border-top:1px solid #000;padding:0px;">
  
<div style=" margin-top:-10px;">
 <b><?php echo $modelQuotes->leadowner->Fullname; ?></b><br /> 

 <em><?php echo $modelQuotes->leadowner->designation ?></em><br />

 <?php if($modelQuotes->leadowner->phno!= ""){?><span>Cell : <?php echo $modelQuotes->leadowner->phno ?></span><br /><?php } ?>   <br /></div></td>
  <td align="center"></td>
  <td align="left"  style="border-top:1px solid #000;padding:0px;">
  <div style=" margin-top:-10px"> 

<span><b><?php echo  $modelQuotes->customercontact->person_name; ?></b></span><br />
 
 <em><?php if(!empty($modelQuotes->customercontact->designation)){ echo $modelQuotes->customercontact->designation;}else{?>Authorized Signatory<?php } ?></em><br />

 <span>Cell : <?php echo  $modelQuotes->customercontact->contact_mobile_no; ?></span><br /></div>
</td>
</tr>
 </table>
 
 <!--
<div style="page-break-inside:avoid;">
    
<div style="width:100%;float:left;font-size:12px;margin-top:5px; font-family:'Times New Roman', Times, serif;">
We trust the above is acceptable and await a favourable response. Please contact us for any further clarifications.<br />
 <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($modelQuotes->customer->customer_name); ?></b></span>

 </div>

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

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

  <div style="width:40%;float:left; font-family:'Times New Roman', Times, serif">
<?php
    
      if($modelQuotes->leadowner->signature!=''){
          ?>
              <img src="uploads/signature/<?php echo $modelQuotes->leadowner->signature;?>" alt="Images"  width="150px" height="60px" />

      <?php
      }else{
          ?>
      <div style="width:150px; height:60px" />
      <?php
      }
  
  ?>
 
<div style="border-bottom:1px solid #000;width:150px; "></div>

 <span><b><?php echo $modelQuotes->leadowner->Fullname; ?></b></span><br />

 <em><?php echo $modelQuotes->leadowner->designation ?></em><br />

 <?php if($modelQuotes->leadowner->phno!= ""){?><span>Cell : <?php echo $modelQuotes->leadowner->phno ?></span><br /><?php } ?>   <br />

 </div>
<div style="width:20%;float:left; text-align:center;font-size:12px;">
 <p style="padding:0px; margin-top:10px; margin-bottom:0px;">Sign</p> 
 <p style="padding:0px;margin:0px;">Date</p> 
 <p style="padding:0px;margin:0px;">Stamp</p> 

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

 <?php
     // if($modelQuotes->leadowner->signature!=''){
          ?>
              <div style="width:150px; height:60px" />

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

<span><b><?php echo  $modelQuotes->customercontact->person_name; ?></b></span><br />

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

 <span>Cell : <?php echo  $modelQuotes->customercontact->contact_mobile_no; ?></span><br />

</div> 
 </div>
 </div>
</div>-->
<!--last page end-->


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