<!DOCTYPE html>
<html>

<head>
    <title>Customer List</title>
</head>

<body>
<title>Customer List</title>
    <div class="heading">
        <div class="logo col-6">
           <?php echo CHtml::image(Yii::app()->baseUrl . '/images/logo/'.Yii::app()->user->pdf_company_logo,'',array('class'=>'heading-img')); ?>
        </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>CUSTOMER LIST</h1>
            <div class="details-box">
            </div>
        </div>
    </div>
    <div class="clearfix"></div>
    <div class="table-body">
        <table id="tbl_customer_table" class="table table-stripped">
            <thead>
                <tr>
                    <th>No</th>
                    <th>Name</th>
                    <th>Credit Limit</th>
                    <th>Address</th>
                    <th>City</th>
                    <th>Postal Code</th>
                    <th>State</th>
                    <th>Country</th>
                </tr>
            </thead>
            <tbody>
                <?php
              $condition = '1=1';

              if($customer_name != ''){
               $condition .= ' AND t.customer_name like "%'.$customer_name.'%"';
             }
             if($country != ''){
               $condition .= ' AND t.customer_country ="'.$country.'"';
             }
             $model_customer = Customers::model()->with('country')->findAll(array('condition'=>$condition));
             foreach ($model_customer as $i => $model) {
              ?>
                    <tr>
                        <td>
                            <?php echo $i+1;?>
                        </td>
                        <td>
                            <?php echo $model->customer_name;?>
                        </td>
                        <td>
                            <?php echo $model->customer_credit_limit;?>
                        </td>
                        <td>
                            <?php echo $model->customer_address;?>
                        </td>
                        <td>
                            <?php echo $model->customer_city;?>
                        </td>
                        <td>
                            <?php echo $model->customer_postal_code;?>
                        </td>
                        <td>
                            <?php echo $model->customer_state;?>
                        </td>
                        <td>
                            <?php echo $model->country->country_name;?>
                        </td>
                    </tr>
                    <?php } ?>
            </tbody>
        </table>
    </div>
    <!--
        <htmlpagefooter name="myfooter">
            <div style="border-top: 1px dotted #000000; font-size: 12px; text-align: center; padding-top: 10px; ">
                <div style="text-align:center;width:100%">This report is auto generated by Bluesky project on <?php
                  date_default_timezone_set("Asia/Dubai");
                 echo date('d/m/Y')." ".date("h:i:sa"); ?> </div>
                <div style="text-align:center;width:100%">Page {PAGENO} of {nb} </div>
            </div>
        </htmlpagefooter>
        <sethtmlpagefooter name="myfooter" page="all" value="on" />-->
</body>

</html>
