<link rel="stylesheet" href="<?php echo MOD_URL;?>room_reservation/assets/css/poolprint.css">
<link rel="stylesheet" href="<?php echo MOD_URL;?>room_reservation/assets/css/checkoutview.css">
<?php 
    $invoice_logo = $this->db->select('*')->from('common_setting')->get()->row();
    $hotel_details = $this->db->select('*')->from('setting')->get()->row();
    $day =  date("l");
    $month =  date("F");
    $date =  date("d");
    $year =  date("Y");
?>
    <head>
        <title><?php echo html_escape($hotel_details->title) ?></title>
    </head>

    <body>
        <!--Print button-->
        <button href="#" class="poolprint-btn">
        </button>
        <div class="invoice-wrap print-hallroom invp-1">
            <div class="invp-2"><?php echo display("unpaid") ?></div>
            <div class="invp-3">
                <img src="<?php  echo base_url(html_escape($invoice_logo->invoice_logo))  ?>" alt="..."
                    class="invp-img">
                <h2 class="invp-4">
                    <?php echo html_escape($hotel_details->title);?></h2>
                <p class="invp-5"><?php echo display("address") ?>: <?php echo html_escape($hotel_details->address); ?></p>

                <p class="invp-6"><?php echo display("issue_date") ?>: <?php echo $day.', '.$month.' ' .$date.', '.$year;?></p>
            </div>
            <div class="invp-7">
                <div>
                    <p class="invp-8">
                    <?php echo display("invoiced_from") ?></p>
                    <strong class="invp-9"><?php echo html_escape($hotel_details->title) ?></strong><br>
                    <span class="invp-10"><?php echo display("mobile") ?>:&nbsp;</span><?php echo html_escape($hotel_details->phone);?>
                    <br>
                    <span
                        class="invp-10"><?php echo display("email") ?>:&nbsp;</span><?php echo html_escape($hotel_details->email);?><br>
                    <span class="invp-10"><?php echo display("website") ?>:&nbsp;</span><?php echo base_url()?><br>
                </div>
                <div class="invp-11">
                    <p class="invp-8">
                    <?php echo display("invoiced_to") ?></p>
                    <div>
                        <address class="invp-12">
                            <strong class="invp-9"><?php echo display("details_of_the_guest") ?> </strong><br>
                            <?php if($rcustomer->firstname){?><span class="invp-10"><?php echo display("guests_name") ?>
                                :&nbsp;</span><?php echo html_escape($rcustomer->firstname); ?><br><?php }?>
                            <?php if($rcustomer->cust_phone){?><span
                                class="invp-10"><?php echo display("mobile") ?>:&nbsp;</span><?php if($rcustomer->cust_phone){echo html_escape($rcustomer->cust_phone);} ?>
                            <br><?php }?>
                            <?php if($rcustomer->email){?><span
                                class="invp-10"><?php echo display("email") ?>:&nbsp;</span><?php if($rcustomer->email){echo html_escape($rcustomer->email);}?><?php }?>
                        </address>
                    </div>
                </div>
            </div>
            <!-- Order Details -->
            <table
                class="invp-13">
                <thead>
                    <tr>
                        <th class="invp-14"><?php echo display("sl") ?></th>
                        <th class="invp-14"><?php echo display("event_name") ?> </th>
                        <th class="invp-14"><?php echo display("event_type") ?> </th>
                        <th class="invp-14"><?php echo display("hall")." ".display("roomtype") ?></th>
                        <th class="invp-14"><?php echo display("hall")." ".display("room_no") ?></th>
                        <th class="invp-14"><?php echo display("rent") ?> </th>
                        <th class="invp-14"><?php echo display("total") ?> </th>
                    </tr>
                </thead>
                <tbody>
                     <?php $total = 0; $subtotal = 0; ?>   
                     <?php for($i=0;$i<count($ritems); $i++){ ?>   
                            <?php $sl = 1; //$total += $ritems[$i][$j]->totalamount;?>
                            <?php foreach ($ritems[$i] as $row) { ?>
                            <tr>
                                <td class="invp-14"><?php echo $sl; ?></td>
                                <td class="invp-14">
                                    <?php echo html_escape($row->event_name); ?></td>
                                <td class="invp-14">
                                    <?php echo html_escape($row->event_type); ?></td>
                                <?php $hallType = $this->db->select("hall_type")->from("tbl_hallroom_info")->where("hid", $row->hall_type)->get()->row(); ?>
                                <td class="invp-14"> <?php echo html_escape($hallType->hall_type); ?>
                                </td>
                                <td class="invp-14"> <?php echo html_escape($row->hall_no); ?>
                                </td>
                                <td class="invp-14"> <?php $subtotal += $row->rent; echo html_escape($row->rent); ?>
                                </td>
                                <td class="invp-14">
                                    <?php $total += $row->totalamount; echo html_escape($row->totalamount); ?></td>
                            </tr>
                            <?php $sl++; ?>
                        <?php } ?>
                    <?php } ?>
                </tbody>
            </table>
            <!-- /Order Details -->
            <!-- Table Total -->
            <table border="0" cellpadding="0" cellspacing="0" align="center" class="invp-24">
                <tbody>

                    <tr>
                        <td
                            class="invp-25 pl-4">
                            <span><?php echo display("sub_total") ?> </span>
                        </td>
                        <td class="invp-25">
                            <span><?php if($currency->position==1){ echo html_escape($currency->curr_icon); } ?><?php echo $subtotal; ?><?php if($currency->position==2){ echo html_escape($currency->curr_icon); } ?>
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td
                            class="invp-25 pl-4">
                            <span><?php echo display("tax") ?> </span>
                        </td>
                        <td class="invp-25">
                            <span><?php $scharge = ($hotel_details->servicecharge*$subtotal)/100; if($currency->position==1){ echo html_escape($currency->curr_icon); } ?><?php echo $total - $subtotal- $scharge; ?><?php if($currency->position==2){ echo html_escape($currency->curr_icon); } ?>
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td
                            class="invp-25 pl-4">
                            <span><?php echo display("service_charge") ?> </span>
                        </td>
                        <td class="invp-25">
                            <span><?php if($currency->position==1){ echo html_escape($currency->curr_icon); } ?><?php echo $scharge; ?><?php if($currency->position==2){ echo html_escape($currency->curr_icon); } ?>
                            </span>
                        </td>
                    </tr>

                    <tr>
                        <td
                            class="invp-25 pl-4">
                            <strong><?php echo display("grand_total") ?> </strong>
                        </td>
                        <td class="invp-25">
                            <strong><?php if($currency->position==1){ echo html_escape($currency->curr_icon); } ?><?php echo html_escape($total); ?><?php if($currency->position==2){ echo html_escape($currency->curr_icon); } ?>
                            </strong>
                        </td>
                    </tr>

                </tbody>
            </table>
            <!-- /Table Total -->
            <!--Terms and conditions-->
            <?php $tandc = $this->db->select('*')->from('tbl_widget')->where('widgetid',21)->get()->row(); ?>
            <div class="invp-30">
                <div class="invp-31">
                    <?php echo html_escape($tandc->widget_title); ?></div>
                <ul class="invp-32">
                    <?php $list = explode(".", trim($tandc->widget_desc,"."));
                        for($z=0; $z<count($list); $z++){
                    ?>
                    <li class="invp-33"><?php echo html_escape($list[$z]); ?></li>
                    <?php } ?>
                </ul>
            </div>
            <!--/Terms and conditions-->
            <!--Signatory-->
            <div class="invp-34">
                <div class="invp-35"><?php echo display("guest_signature") ?></div>
                <div class="invp-35"><?php echo display("authorized_signature") ?></div>
            </div>
            <!--/Signatory-->
        </div>
    </body>

    <script src="<?php echo MOD_URL;?>room_reservation/assets/js/hallprint.js"></script>
