<?php
$current_date = date('Y-m-d');
$condition = 'salary.salary_occurence="2" AND employee_id="' . $model->employee_id . '" and t.isActive="Y" AND valid_from <="' . $current_date . '" AND valid_to ="0000-00-00"';
$model_salary = EmployeeSalary::model()->with('salary')->find(array('select' => 'sum(amount) as amount,valid_from', 'condition' => $condition));
$total_salary = 0.00;
$salary_date = "";
$salary_month = "";
if ($model_salary->amount > 0) {
    $total_salary = $model_salary->amount;
    $salary_date = date("d/m/Y", strtotime($model_salary->valid_from));
    $salary_month = date("m/Y", strtotime($model_salary->valid_from));
}
?>
<style>

    @page {

        margin-top: 1.9cm;
        margin-bottom: 0cm !important;
        margin-left: 0cm;
        margin-right: 0cm;
        header: html_myHeader;
        footer: html_myfooter;
        font-family: 'Oswald', sans-serif;


    }
    @import url('https://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800');

    table, tr, td{
        border:solid 1px #333333;
        border-collapse: collapse;
        padding: 10px;

    }
</style>
<!DOCTYPE html>
<html>
    <head>
        <title>No Objection Certificate</title>
    </head>
    <?php
    $effective_date=$effective_date_1='';
    if($model->visit_from!='0000-00-00' && $model->visit_from!=''){
        $effective_date=date("d/m/Y", strtotime($model->visit_from));
    }
    if($model->visit_to!='0000-00-00' && $model->visit_to!=''){
        $effective_date_1=date("d/m/Y", strtotime($model->visit_to));
    }
    ?>
    <body style="width: 960px; margin: 0 auto; font-family: open sans; font-size: 15px !important;">
        <div class="heading">
            <div style="width:100%; margin-left: 45px" class="logo">
                <img src="uploads/logo/<?php echo $model->employeedetail->branch_sponsor->branch_or_sponsor_logo;?>">
                <?php //echo CHtml::image('images/logo/logo.png'); ?></div>
        </div>
        <div class="page" style="width: 80%; margin: 0 auto; font-family: open sans;">
            <div class="">
                <div style="text-align: right">
                    <p><?php echo $model->addresses_to; ?></p>
                    <p>Date: <?php echo date("d/m/Y"); ?></p>
                </div>

                <br>

                <div style="text-align: left;">
                    <h4>Subject: No Objection Certificate</h4>
                </div>
                <div style="text-align: justify;">
                        <p>This is to certify that <?php echo $sign.''.$model->employeedetail->employeefullname; ?>, of <?php echo  $model->employeedetail->employeenationality->nationality; ?> Nationality,holder of Passport number <?php echo $model_document->document_number ?> has been an employee with us since <?php echo date_format(date_create($model->employeedetail->date_join),"d/m/Y") ?>.<?php echo ucfirst($sign_2) ?> is presently working in the capacity of <?php echo  $model->employeedetail->designationdetail->designation_name; ?>, with a total remuneration of <?php echo $model->employeedetail->currencydetails->currency_code.' '.$total_salary; ?> per month including all fixed allowances.</p>
                        <p>We do not have any objections for <?php echo $p_noun; ?> travel to <?php echo $model->country->country_name; ?> for tourism purposes during the period <?php echo $effective_date ?> to <?php echo $effective_date_1 ?> and appreciate your assistance in this regard.</p>
                </div>
                <br>
                <div>
                    <p>Yours faithfully,</p>
                    <?php
                    foreach ($signature as $value) {
                        echo '<h4>' . $value . '</h4>';
                    }
                    ?> 

                </div>
            </div>
        </div>
        <br>
        <!--  <div class="heading">
 
    <div style="width:100%;text-align:center" class="logo"><?php echo CHtml::image('images/logo/logo.png'); ?></div>
  </div>-->
       
         <htmlpagefooter name="myfooter" style="">
             <div style="width:100%;">
     <img src="<?php echo Yii::app()->baseUrl; ?>/uploads/logo/<?php echo $model->employeedetail->branch_sponsor->footer_logo; ?>" style="width:100%;margin-bottom:-40px !important;">
             </div>
         </htmlpagefooter> 
    </body>

</html>