<style>
    .mouse-cursor{
        
    }
</style>  
<div class="wrapper">
            <div class="container">
                <!-- Page-Title -->
                <div class="row">
                    <div class="col-sm-12">
                        <h4 class="page-title">Advance Receiving Note</h4>
                    </div>
                </div>
                <div class="row">
                    <div class="col-md-12">
                        <div class="panel panel-default">
                            <div class="panel-body">
                                <div class="row">
                                    <div class="pull-left">
                                        <h3 class="logo invoice-logo"><?php if(isset($business)){ echo "<img src='".base_url().'assets/images/business/'.$business[0]['business_logo']."' alt='".$business[0]['business_name']."' class='img-responsive' />";} else {echo 'SalonPK';}?></h3>
                                    </div>
                                    <div class="pull-right">
                                        <h4 class="img-">Advance Note # <br>
                                            <strong id="advance_note_id"><?php echo  date("Y").'-'.date("m").'-'; if(isset($advance[0]['id_program_advance_note'])){ echo sprintf("%04s",$advance[0]['id_program_advance_note']);}else{echo '00001';} ?></strong>
                                        </h4>
                                    </div>
                                </div>
                               
                                <div class="row" style="color:#000 !important">
                                    <div class="col-md-12">
                                        <div class="pull-left m-t-10">
                                            <input name="advanceid" id="advanceid" type="hidden" value="<?php echo $advance[0]['id_program_advance_note']; ?>"/>
                                            <input name="customerid" id="customerid" type="hidden" value="<?php echo $advance[0]['id_customers']; ?>">
                                            <input name="customername" id="customername" type="hidden" value="<?php echo $advance[0]['customer_name']; ?>">
                                            
                                            <address>
                                              <strong><?php echo $advance[0]['customer_name']; ?></strong><br>
                                              <span ><abbr class="hidden-sm hidden-xs" title="Phone">P:</abbr> <?php echo $advance[0]['customer_cell']; ?></span><br>
                                              <span class="hidden-sm hidden-xs"><?php echo $advance[0]['customer_address']; ?></span><br>
                                              <span class="hidden-sm hidden-xs"><?php echo $advance[0]['customer_email']; ?></span>
                                            </address>
                                        </div>
                                        <div class="pull-right m-t-10">
                                            <p ><strong>Date: </strong> <?php echo $advance[sizeof($advance)-1]['advance_date']; ?></p>
                                            <p id="modep"><strong>Payment: </strong> <span id="mode"><?php echo $advance[sizeof($advance)-1]['advance_mode']; ?></span></p>

                                        </div>
                                    </div><!-- end col -->
                                </div>
                                <!-- end row -->

                                <div class="row">
                                    <div class="col-md-12">
                                        <div class="table">
                                            <table class="table m-t-10" id="tblservices">
                                                <thead style="color:#000 !important">
                                                    <tr>
                                                        <th class="hidden-xs">#</th>                                                                                                           
                                                        <th>Description</th>
                                                        <th>Total Sessions</th>                                                       
                                                        <th style="text-align: right;">Price</th>
                                                        <th style="text-align: right;">Total</th>
                                                    </tr>
                                                </thead>
                                                <tbody style="color:#000 !important">
                                                    
                                                    <?php $subtotal=0;
                                                        if(isset($services)){  $x=1; $totalprice=0;
                                                            foreach($services as $service){
                                                                ?>
                                                    
                                                    <tr id="idtr">
                                                        <td class="hidden-xs"><?php echo $x;?></td>
                                                        <td><?php echo $service['service_name']; ?></td>
                                                        <td><?php echo $service['total_sessions']; ?></td>
                                                        <td style="text-align: right;"><?php echo $service['per_session_rate']; ?></td>
                                                        <?php $totalprice= $service['total_sessions'] * $service['per_session_rate'];
                                                        $subtotal=$subtotal+$totalprice;
                                                        ?> 
                                                        <td style="text-align: right;"><?php echo $totalprice;?></td>
                                                    </tr>
                                                    <?php $x++; }} ?>
                                                   
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                                <div class="row" style="color:#000 !important">
                                     <div class="col-md-12">
                                         <div class="row">
                                            <div class="col-lg-9 col-md-9 col-sm-8">
                                                 <div class="row" style="color:#000 !important">
                                    
                                                    <div class="col-md-12 col-sm-12 col-xs-12 ">
                                                       <div class="clearfix m-t-10">
                                                            <h5 class="small text-inverse font-600">PAYMENT TERMS AND POLICIES</h5>
                                                            <span><?php echo $advance[0]['advance_remarks'];?></span></br>
                                                            <small>
                                                                <?php echo $business[0]['payment_terms'];?>
                                                            </small>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-lg-3 col-md-3 col-sm-4 col-xs-12">
                                                <h4 class="text-right"><b>Total: <?php echo CURRENCY_CODE;?>. <?php echo number_format((float)$subtotal, 2, ".", ",");?></b></h4>
                                                <hr>
                                                <h4 class="text-right ">Total Advance <?php echo CURRENCY_CODE;?>. <?php echo number_format((float)$advance[0]['advance_amount'],2,".",",");?></h4>
                                                <h4 class="text-right ">Balance <?php echo CURRENCY_CODE;?>. <?php $balance=  $subtotal - $advance[0]['advance_amount'];echo number_format($balance);?></h4>
                                                
                                            </div>   
                                         </div>
                                     </div>
                                </div>
                                
                                <hr>
                                <div class="hidden-print">
                                    <div class="pull-right">
                                        <a href="javascript:window.print()" class="btn btn-inverse waves-effect waves-light" id="btnprint"><i class="fa fa-print"></i></a>
                                       
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>

                </div>
                <!-- end row -->
               
<script>
    
 
   
    
   

</script>
