<!DOCTYPE html>
<html>

<head>
    <title>Enquiry List</title>
</head>

<body>
    <div class="heading">
        <div class="logo col-6">
            <img src="images/pdf/logo.png">
        </div>
        <div class="companay_name col-6 text-right">
           <?php
                
                $model_Company = MasCompany::model()->find();
                
                ?>
                
                <h3><?php echo $model_Company->company_name; ?></h3>
                <p><?php echo $model_Company->company_address; ?>
                <?php echo ', '.$model_Company->company_location; ?>
                <?php echo ', '.$model_Company->country->country_name; ?></p>
                <p><?php echo 'Phone : '. $model_Company->company_phone_no; ?></p>
                <p><?php echo 'Email : '.$model_Company->company_email_id; ?></p>
        </div>
    </div>
    <div class="clearfix"></div>
    <div class="title">
        <div class="col-6">
          <div style="height: 10px;"></div>
      </div>
      <div class="col-6 text-right">
        <h1>ENQUIRY LIST</h1>
        <div class="details-box">
        </div>
    </div>
</div>
<div class="clearfix"></div>
<div class="table-body">
    <table id="tbl_enquiry_table" class="table table-fixed table-primary dataTable">
       <thead>
           <tr>
               <th>No</th>
               <th>Enquiry</th>
               <th>Customer Name</th>
               <th>Contact Name</th>
               <th>Mobile</th>
               <th>Email</th>
               <th>Enquiry Date</th>
               <th>Closing Date</th>

           </tr>
       </thead>
       <tbody>
        <?php
        $condition = '1=1'; ;
        if($enquiry_id != ''){
            $condition .= ' AND t.id ='.$enquiry_id;
        }
        if($enquiry_start_date != ''){
            $enquiry_start_date = str_replace('/', '-', $enquiry_start_date);
            $enquiry_start_date = date('Y-m-d',strtotime($enquiry_start_date));
            $condition .= ' AND t.enquiry_date <="'.$enquiry_start_date.'"';
        }
        if($enquiry_end_date != ''){
            $enquiry_end_date = str_replace('/', '-', $enquiry_end_date);
            $enquiry_end_date = date('Y-m-d',strtotime($enquiry_end_date));
            $condition .= ' AND t.closing_date >="' . $enquiry_end_date.'"';
        }
        $model_enquiry = Enquiry::model()->findAll(array('condition'=>$condition));
        foreach ($model_enquiry as $i => $model) {
            ?>
            <tr>
               <td><?php echo $i+1;?></td>
               <td><?php echo $model->file_title; ?></td>
               <td><?php echo $model->customer->customer_name;?></td>
               <td><?php echo $model->contact->person_name;?></td>
               <td><?php echo $model->mobile_no;?></td>
               <td><?php echo $model->email_id;?></td>
               <?php if($model->enquiry_date!='0000-00-00'){ ?>
               <td><?php echo date("d/m/Y", strtotime($model->enquiry_date));?></td>
               <?php }else{ ?>
               <td>&nbsp;</td>
               <?php } ?>
               <?php if($model->closing_date!='0000-00-00'){ ?>
               <td><?php echo date("d/m/Y", strtotime($model->closing_date));?></td>
               <?php }else{ ?>
               <td>&nbsp;</td>
               <?php } ?>
           </tr>
           <?php } ?>
       </tbody>
   </table>
</div>
   
<htmlpagefooter name="myfooter">


    <div style="text-align:center;width:100%;font-size:10px"><?= Yii::app()->user->footer_autogenerated; ?>
        <?php
                  date_default_timezone_set("Asia/Dubai");
                 echo date('d/m/Y')." ".date("h:i:sa"); ?>
    </div>

    
        <div style="border-top: 1px dotted #000000; font-size: 12px; text-align: center; padding-top: 10px; background-color: #d7faeb;">
             <div style="text-align:center;width:100%">
                <b><?= Yii::app()->user->footer_line_1 ?></b><br>
                <?= Yii::app()->user->footer_line_2 ?>
            </div>
            <div style="text-align:center;width:100%">Page {PAGENO} of {nb} </div>
        </div>
    </htmlpagefooter>
    
</body>

</html>
