<?php $modelInvoice = Invoice::model()->findByPk($id); ?>
<?php $model_Delivery = DeliveryNote::model()->findByPk($id); ?>
<?php
if (isset(Yii::app()->user->master_user_company_id) && (int) Yii::app()->user->master_user_company_id > 0) {
    $company_id = Yii::app()->user->master_user_company_id;
}
$modelCompanyDetails = MasCompany::model()->findByPk($company_id);

if (isset(Yii::app()->user->user_warehouse_id)) {
    $warehouse_id = (int) Yii::app()->user->user_warehouse_id;
}
$modelWarehouse = new MasInventoryWarehouse();
if ($warehouse_id > 0) {
    $modelWarehouse = $modelWarehouse->findByPk($warehouse_id);
    $company_name = $modelWarehouse->warehouse_outlet_name;
    $billing_address = $modelWarehouse->address;
    $logo = 'uploads/warehouse/thumbs/' . $modelWarehouse->upload_image;
}

?>
<htmlpagefooter name="myfooter">
    <?php
    if ($from == 'invoice') {

    ?>
        <div class="col-12">
            <div class="col-6">
                <p style="text-align:left;font-size:11px;padding-left:17px;margin-top:80px;">
                    Created On:&nbsp;
                    <?php
                    echo date("d/m/Y h:i:sa", strtotime($created_datetime));
                    // echo date('d/m/Y')." ".date("h:i:sa"); 
                    ?>
            </div>
        <?php } ?>
        <?php
        if ($from == 'direct') {

        ?>
            <div class="col-12">
                <div class="col-6">
                    <p style="text-align:left;font-size:11px;padding-left:17px;margin-top:80px;">
                        Created On:&nbsp;
                        <?php
                        echo date("d/m/Y h:i:sa", strtotime($created_datetime));
                        // echo date('d/m/Y')." ".date("h:i:sa"); 
                        ?>
                </div>
                <div class="col-6">
                    <p style="text-align:right;font-size:11px;padding-right:17px;margin-top:80px;">
                        <?php echo $modelCompanyDetails->footer_autogenerated; ?>Printed On:&nbsp;
                        <?php
                        date_default_timezone_set("Asia/Dubai");
                        echo date('d/m/Y') . " " . date("h:i:sa"); ?>
                </div>
            </div>
        <?php } else if ($from == 'deliverynote') {
        ?>
            <div class="col-12">
                <div class="col-6">
                    <p style="text-align:left;font-size:11px;padding-left:17px;margin-top:80px;">
                        Created On:&nbsp;
                        <?php
                        echo date("d/m/Y h:i:sa", strtotime($created_datetime));
                        // echo date('d/m/Y')." ".date("h:i:sa"); 
                        ?>
                </div>
                <div class="col-6">
                    <p style="text-align:right;font-size:11px;padding-right:17px;margin-top:80px;">
                        <?php echo $modelCompanyDetails->footer_autogenerated; ?>Printed On:&nbsp;
                        <?php
                        date_default_timezone_set("Asia/Dubai");
                        echo date('d/m/Y') . " " . date("h:i:sa"); ?>
                </div>
            </div>
        <?php } else { ?>
            <div class="col-12">
                <p style="text-align:center;font-size:11px;padding-right:17px;margin-top:80px;">
                    <?php echo $modelCompanyDetails->footer_autogenerated; ?>Printed On:&nbsp;
                    <?php
                    date_default_timezone_set("Asia/Dubai");
                    echo date('d/m/Y') . " " . date("h:i:sa"); ?>
            </div>
        <?php
        }
        ?>
        <div style="border-top: 1px dotted #000000; font-size: 11px; text-align: center; padding-top: 10px; background-color: #d7faeb;">
            <div style="text-align:center;width:100%;font-size:11px;">
                <!--We deal in all kinds of Glass Jars, Glass Bottles, Plastic Pet Jars, Plastic Bottles, Mason Jars, Cream Jars, Lotion and Perfume Bottles and More-->
                <b><?php
              
                    if (!empty($warehouse_id_pass)) {
                        $modelMasInventoryWarehouse = new MasInventoryWarehouse();
                        $model_det = $modelMasInventoryWarehouse->findByPk($warehouse_id_pass);
                       
                        //$address_branch = $model_det->address;
                        $address_branch = $model_det->footer;
                        
                    }

                    
                    
                    if (!empty($address_branch)) {
                        echo nl2br($address_branch);
                    } else {
                        echo nl2br($billing_address);
                         
                    }

                    ?></b>
            </div>

            <div style="text-align:center;width:100%">Page {PAGENO} of {nb} </div>
        </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><?php //echo $modelCompanyDetails->footer_line_one; 
                    ?></b><br>
                <?php //echo $modelCompanyDetails->footer_line_two; 
                ?>
            </div>
            <div style="text-align:center;width:100%">Page {PAGENO} of {nb} </div>
        </div-->
</htmlpagefooter>
<sethtmlpagefooter name="myfooter" page="all" value="on" />