<?php
session_start();
include('accesscheck2.php');
require_once('Connections/courier.php');
require_once 'functions/functions.php';

list($patient_no, $id, $process_claim_no) = explode("@@@", mysql_real_escape_string($_POST['id']));
$typeofvisit = $_POST['idd2'];
$PROVIDERID = $_SESSION['provider_id'];
 
$query_rsodest_claim_no = "select * from process_claim_no where process_claim_no='$process_claim_no' and patient_status='In Use'";
$rsodest_claim_no = mysql_query($query_rsodest_claim_no, $courier) or die(mysql_error($courier));
$row_rsodest_claim_no = mysql_fetch_assoc($rsodest_claim_no);
$totalRows_rsodest_claim_no = mysql_num_rows($rsodest_claim_no);

$rsclaim=mysql_query("select * from claims_details where current_location='Cashier' AND process_claim_no='$process_claim_no' and (mode_of_payment='cash' or mode_of_payment='gratis' or mode_of_payment='credit sales') and (payment_status='Owing' or payment_status='Approved') order by id desc;", $courier) or die(mysql_error($courier));
$row_rsclaim = mysql_fetch_assoc($rsclaim);
$totalRows_rsclaim = mysql_num_rows($rsclaim);

$rsclaim_total=mysql_query("select sum(qty*unit_price) as totalprice from claims_details where process_claim_no='$process_claim_no' and item<>'BALANCE OWING' and (mode_of_payment='cash' or mode_of_payment='gratis' or mode_of_payment='credit sales') and (payment_status='Owing' or payment_status='Approved') and current_location='Cashier'", $courier) or die(mysql_error($courier));
$row_rsclaim_total = mysql_fetch_assoc($rsclaim_total);
$total_cash=$row_rsclaim_total['totalprice']; 
$total_cash2=$row_rsclaim_total['totalprice']; 


$consultation_total=mysql_fetch_assoc(mysql_query("select sum(qty*unit_price) as totalprice from claims_details where process_claim_no='$process_claim_no' and (mode_of_payment='cash' or mode_of_payment='gratis' or mode_of_payment='credit sales') and (payment_status='Owing' or payment_status='Approved') and current_location='Cashier' and item_service_type='Optical Consultation'", $courier));
$total_consultation = $consultation_total['totalprice'];

$rsclaim_total=mysql_query("select sum(qty*unit_price) as totalprice from claims_details where process_claim_no='$process_claim_no' and mode_of_payment='gratis' AND payment_status='Approved'", $courier) or die(mysql_error());
$row_rsclaim_total = mysql_fetch_assoc($rsclaim_total);
$total_gratis=$row_rsclaim_total['totalprice'];
$currency = 'GHS ';

$rsclaim_total=mysql_query("select sum(qty*unit_price) as totalprice from claims_details where process_claim_no='$process_claim_no' and mode_of_payment='credit sales' AND payment_status='Approved'", $courier) or die(mysql_error());
$row_rsclaim_total = mysql_fetch_assoc($rsclaim_total);
$total_credit_sales=$row_rsclaim_total['totalprice'];

$rsclaim_total2=mysql_query("select sum(qty*unit_price) as totalprice from claims_details where process_claim_no='$process_claim_no' and mode_of_payment='credit sales' AND payment_status='Approved' AND comment='Credit Sales Payment'", $courier) or die(mysql_error());
$row_rsclaim_total2 = mysql_fetch_assoc($rsclaim_total2);
$total_credit_sales2 =$row_rsclaim_total2['totalprice'];

$discount_info = mysql_fetch_assoc(mysql_query("SELECT sum(discount_amount) AS total_discount, discount_rate FROM patient_visit_discounts WHERE process_claim_no = '$process_claim_no' AND discount_status='Approved' AND discount_used='not used'"));
$discount_amount = $discount_info['total_discount'];

$gratis_info = mysql_fetch_assoc(mysql_query("SELECT sum(qty*unit_price) AS total_gratis FROM claims_details WHERE process_claim_no = '$process_claim_no' AND mode_of_payment='gratis' AND payment_status='Approved'"));
$gratis_amount = $gratis_info['total_gratis'];

$insurance_info = mysql_fetch_assoc(mysql_query("SELECT sum(qty*unit_price) AS total_insurance FROM claims_details WHERE process_claim_no = '$process_claim_no' AND (mode_of_payment='insurance' OR mode_of_payment='company') AND payment_status='Paid'"));
$insurance_amount = $insurance_info['total_insurance'];

//VAT & NHIL 
$settings = mysql_fetch_assoc(mysql_query("SELECT * FROM settings WHERE VAT_NHIL = 'exclusive'"));
$VATNHIL =  (($settings['VAT']+$settings['NHIL'])/100) * ($total_cash - $total_consultation); 
$total_cash = $total_cash;?>

<div class="page-bar">
    <ul class="page-breadcrumb">
        <li>
            <i class="icon-home"></i>
            <a href="index.html">Home</a>
            <i class="fa fa-angle-right"></i>
        </li>
        <li>
            <span>Dashboard</span>
        </li>
    </ul>
    <div class="page-toolbar">
        <div class="btn-group pull-right">
            <button type="button" class="btn btn-fit-height grey-salt dropdown-toggle" data-toggle="dropdown" data-hover="dropdown" data-delay="1000" data-close-others="true"> Actions
                <i class="fa fa-angle-down"></i>
            </button>
            <ul class="dropdown-menu pull-right" role="menu">
                <li onclick="getstep('view_patient_payments','<?php echo $patient_no.'@@@'.$id.'@@@'.$process_claim_no; ?>','<?php echo $typeofvisit; ?>');">
                    <a href="#">
                        <i class="icon-refresh"></i> Refresh </a>
                </li>
            </ul>
        </div>
    </div>
</div>


<form name="form" method="POST" id="patient_consultation_div">
    <div class="portlet light tasks-widget bordered" id="patient_medical_history_div">
        <div class="portlet-title">
            <div class="caption">
                <i class="icon-share font-dark hide"></i>
                <span class="caption-subject font-dark bold uppercase"> 
                    <span class="badge badge-info"> <i class="fa fa-user"></i> </span> CLIENT CASH PAYMENT 
                </span>
            </div>
        </div>
        <div class="portlet-body">
                <?php include 'consultation/patient_header_details.php';?>
            <div class="row">
            <div class="col-lg-12 col-md-12 col-xs-12 col-sm-12">
                <div class="portlet light bordered" id="patient_page_wrapper">
                    <div class="portlet-title tabbable-line">
                        <ul class="nav nav-tabs">
                            <li class="active">
                                <a href="#tab_1_1" data-toggle="tab" aria-expanded="true"> Charges </a>
                            </li>
                            <li class="">
                                <a href="#tab_1_2" data-toggle="tab" aria-expanded="false">  Payment History </a>
                            </li>
                        </ul>
                    </div>
                    <div class="portlet-body form" style="margin-top:-40px;">
                        <div class="tab-content">
                            <div class="tab-pane active" id="tab_1_1">
                                <div class="portlet-body form">
                                        <div class="form-body">
                                            <div class="row">
                                                <div class="col-md-5">
                                                    <div style="min-height:194px;" id="view_items_response_wrapper_2">
                                                            <table class="table" style="background-color: #EEEEEE">
         <tbody>
             <tr>
                 <td> <div style="padding: 2px;"> <b> TOTAL </b> : <?php echo $currency." ".number_format(($total_cash+$total_gratis),2); ?> </div> </td>
                 <td> <div style="padding: 2px;"> <b> GRATIS </b> : <?php echo $currency." ".number_format($total_gratis,2); ?> </div> </td>
                 <td> <div style="padding: 2px;"> <b> CASH </b> : <?php echo $currency." ".number_format($total_cash,2); ?> </div> </td>
                 <td> <div style="padding: 2px;"> <b> DISCOUNT </b> : <?php echo $currency." ".number_format($discount_amount,2); ?> </div> </td>
             </tr>
         </tbody>
     </table>
                                                        <div class="portlet-body">
                                                            <div id="claimsno_diagnostic">
                                                                <div id="claim_response">
                                                                    <table class="table table-bordered" style="margin-top:-20px;">
                                                                        <thead>
                                                                            <tr>
                                                                                <th style="">Item</th>
                                                                                <th style="text-align:right">Price</th>
                                                                                <th style="">Mode</th>
                                                                                <th style="">Status</th>
                                                                            </tr>
                                                                        </thead>
                                                                                <tbody>
                                                <?php if ($totalRows_rsclaim> 0) { ?>   
                                                    <?php
                                                    do {
                                                        $i = $i + 1;
                                                        ?>
                                                        <tr>
                                                        <td><?php echo strtoupper($row_rsclaim['item']); ?></td>
                                                          <td style="text-align:right">
                                                        <?php if($row_rsclaim['submitted_status']!='submitted' && $row_rsclaim['action_status']==''){?>
                                                         <input type="text" id="itemqty<?php echo $row_rsclaim['id']; ?>" name="itemqty<?php echo $row_rsclaim['id']; ?>" style="width:50px; text-align:right" min="1" value="<?php echo $row_rsclaim['unit_price']; ?>" onChange="getclaimno('updateprice_claim_details_administrative','claimsno',<?php echo $row_rsclaim['id']; ?>,this.value);"> 
                                                         <?php }else{echo number_format($row_rsclaim['qty']*$row_rsclaim['unit_price'],2);}?>
                                                          &nbsp;&nbsp;&nbsp;
							</td>
                                                          <td><?php echo strtoupper($row_rsclaim['mode_of_payment']); ?>
                                                          <!--<input type="hidden" name="item_trans_id_<?php echo $i; ?>" id="item_trans_id_<?php echo $i; ?>" value="<?php echo $row_rsclaim['id'];?>">-->
                                                            <input type="hidden" multiple="" name="item_trans_id[]" value="<?php echo $row_rsclaim['id'];?>">
                                                          </td>
                                                          <td><?php
                                                                      if ($row_rsclaim['payment_status'] == 'Owing' || $row_rsclaim['payment_status'] == 'Unapproved') {
                                                                          echo "<span style='color:red;'>" . $row_rsclaim['payment_status'] . "</span>";
                                                                      } else if ($row_rsclaim['payment_status'] == 'Paid' || $row_rsclaim['payment_status'] == 'Approved') {
                                                                          echo "<span style='color:#090;'>" . $row_rsclaim['payment_status'] . "</span>";
                                                                      }
                                                                      ?></td>
                                                          
                    </tr>
                  <?php }  while ($row_rsclaim = mysql_fetch_assoc($rsclaim)); ?>
                  <?php }else{echo '<tr><td colspan="9" style="color:red;"><div class="none">No Billed Items Found. Search Items to Add to Bill.</div></td></tr>';}?>
                  </tbody>
                                                                    </table> 

                                                                </div>  
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="col-md-7 ">
                                                    <div class="portlet light bordered" style="min-height:94px;background-color: linen" id="paymentdetails">
                                                        <div class="portlet-title">
                                                            <div class="caption">
                                                                <i class="fa fa-dollar" style="color:#000"></i>
                                                                <span class="caption-subject bold" style="color:#000"> PAYMENT DETAILS  </span>
                                                            </div>
                                                            <div class="actions">
                                                                <select name="pay_by" id="pay_by" onchange="showpayment(this.value);" class="form-control">
                                                                    <option value="cash">Pay By</option>
                                                                    <option selected="" value="cash">Cash</option>
                                                                    <option value="creditcard">POS</option>
                                                                    <option value="cheque">Cheque</option>
                                                                    <option value="Mobile Money">Mobile Money</option>
                                                                    <option value="EcoBank Master Pass">EcoBank Master Pass</option>
                                                                </select>
                                                            </div>
                                                        </div>
                                                        <div class="portlet-body">
                                                            <div id="claimsno_diagnostic">
                                                                <div id="cashier_items_wrapper">
                                                                     <table class="table" id="membershipinfo2">
                          <tbody>
                              <tr class="baseborder">
                                  <td style="border-top: none;">Payment Type</td>
                                  <td style="border-top: none;" colspan="3"><select name="payment_type_approved" id="payment_type_approved" class="form-control">
                                          <option value="Full-Payment">Full Payment</option>
                                          <option value="Part-Payment">Part Payment - (Deposit)</option>
                                      </select>
                                  </td>
                              </tr>
                            <tr class="baseborder creditcardbox hide_all_payment" style="display: none;">
                                <td>Card Name</td>
                                <td colspan="3"><select name="cardname" id="cardname" class="form-control">
                                        <option selected="selected" value="">Select Card</option>
                                        <option value="VISA">VISA</option>
                                        <option value="MASTERCARD">MASTERCARD</option>
                                    </select>
                                </td>
                            </tr>
                            <tr class="baseborder creditcardbox hide_all_payment" style="display: none;">
                                <td>Transaction ID:</td>
                                <td colspan="3"><input type="text" name="transaction_id" id="transaction_id" class="form-control"></td>
                            </tr>
                            <tr class="baseborder chequebox hide_all_payment" style="display: none;">
                                <td>Bank</td>
                                <td colspan="3" ><input type="text" name="bank" id="bank" class="form-control"></td>
                            </tr>
                            <tr class="baseborder chequebox hide_all_payment" style="display: none;">
                                <td>Cheque No</td>
                                <td colspan="3" ><input type="text" name="checkno" id="checkno" class="form-control"></td>
                            </tr>
                            <tr class="baseborder mobilephonebox hide_all_payment" style="display: none;">
                                <td>Mobile Money Phone No</td>
                                <td colspan="3" ><input type="text" name="mobile_phone_no" id="mobile_phone_no" class="form-control"></td>
                            </tr>
                            <tr class="baseborder mobilephonebox hide_all_payment" style="display: none;">
                                <td>Name on Mobile Money Account</td>
                                <td colspan="3" ><input type="text" name="mobile_phone_name" id="mobile_phone_name" class="form-control"></td>
                            </tr>
                             <tr>
                                 <td colspan="2"> Total Amount </td>
                                 <td colspan="2" style="font-weight: bold;"><?php  echo number_format($total_cash2+$gratis_amount-$VATNHIL,2);?> </td>
                            </tr>
                             <tr>
                                 <td colspan="2">
                                 VAT/NHIL (<?php echo $settings['VAT']+$settings['NHIL'].'%'; ?> of <?php echo $currency.' '.number_format($total_cash - $total_consultation,2); ?>)
                                 <!-- VAT/NHIL (<?php // echo $settings['VAT']+$settings['NHIL'].'%'; ?> of <?php // echo $currency.' '.number_format($total_cash2-$VATNHIL,2); ?>) -->
                                 </td>
                                 <td colspan="2" style="font-weight: bold;"><?php  echo number_format($VATNHIL,2);?> </td>
                            </tr>
                             <tr>
                                 <td colspan="2"> Total Discount (<?php echo $discount_info['discount_rate'].'%'; ?>)</td>
                                 <td colspan="2" style="font-weight: bold;">-<?php  echo number_format($discount_amount,2);?> </td>
                            </tr>
                             <tr>
                                 <td colspan="2"> Total Gratis (Approved) </td>
                                 <td colspan="2" style="font-weight: bold;">-<?php  echo number_format($gratis_amount,2);?> </td>
                            </tr>
                              <tr>
                                  <td colspan="2"> Total Credit Sales (Approved) </td>
                                  <td colspan="2" style="font-weight: bold;">-<?php  echo number_format($total_credit_sales,2);?> </td>
                              </tr>
                            <tr class="baseborder" >
                              <td height="30">Total Bill</td>
                              <td ><span style="font-size:14px; color:blue; font-weight:bolder;"><?php // echo $total_cash; ?> <?php echo $currency." ".number_format(($total_cash-$discount_amount-$gratis_amount),2); ?></span>&nbsp;&nbsp;&nbsp;&nbsp;
                              <input type="hidden" id="total_bill" name="total_bill" value="<?php echo number_format($total_cash-$discount_amount-$gratis_amount-$total_credit_sales+$total_credit_sales2,2); ?>"></td>
                              <input type="hidden" id="total_vatnhil" name="total_vatnhil" value="<?php echo number_format($VATNHIL,2); ?>">
                              <input type="hidden" id="total_total_amount" name="total_total_amount" value="<?php echo number_format($total_cash2,2); ?>"></td>
                              <td style="text-align: left;padding-left: 10px;">Current Balance</td>
                              <td ><span style="font-size:14px; color:blue; font-weight:bolder;">
                            <?php $patient_balance=get_patient_outstanding_balance($patient_no);
							    echo number_format($patient_balance,2);?>
                            <input type="hidden" id="current_balance" name="current_balance" value="<?php echo $patient_balance; ?>">
                              </span></td>
                            </tr>
                            <tr class="baseborder" >
                              <td height="30" align="right" style="text-align: left;padding-left: 10px;">Amount to Deduct:</td>
                              <td style="font-size:14px; color:red; font-weight:bolder;">
                              <?php
                             if($patient_balance>=0){
							 $amount_to_deduct=$patient_balance-$total_cash;
							 
							 if($amount_to_deduct>=0){$amount_to_deduct=$total_cash;}
							 if($amount_to_deduct<0){$amount_to_deduct=$patient_balance;}
							  
							 
							 }else{
							$amount_to_deduct=0;	 
							 }
							 echo $currency.' '.number_format($amount_to_deduct,2);
							  
							   ?>
                              
                              <input type="hidden" id="amount_to_deduct" name="amount_to_deduct" value="<?php echo $amount_to_deduct; ?>"></td>
                              <td >New  Balance:</td>
                              <td ><span style="font-size:14px; color:blue; font-weight:bolder;">
                                <?php
								
															 
							  $new_patient_balance=$patient_balance-$amount_to_deduct;
							
							  
							  echo number_format($new_patient_balance,2);
							  ?>
                              <input type="hidden" id="new_balance" name="new_balance" value="<?php echo $new_balance; ?>">
                              </span></td>
                            </tr>
                            <tr class="baseborder" >
                              <td height="30">Amount to Pay</td>
                              <td colspan="3" style="font-size:14px; color:red; font-weight:bolder;">
                                                    <?php 
                                                        $total_cash = $total_cash-$discount_amount-$gratis_amount-$total_credit_sales+$total_credit_sales2;
							if($patient_balance>=0){
							  $amount_to_pay=$total_cash-$amount_to_deduct;
							  }else{
							$amount_to_pay=$total_cash-$patient_balance;	  
							  }
							  echo $currency.' '. number_format($amount_to_pay,2);
                                                    ?>
                              <input type="hidden" id="amount_to_pay" name="amount_to_pay" value="<?php echo $amount_to_pay; ?>"></td>
                            </tr>
                            <tr class="baseborder" >
                              <td height="30">Amount Paid</td>
                              <td ><input name="amount_tendered" type="text" id="amount_tendered" style="font-size:14px; color:green; font-weight:bolder;" onKeyUp="getbalance('amount_change','total_price_cash','outstanding_balance_actual',this.value,'amount_for_change');">
                               <input type="hidden" id="part_payment_amount" name="part_payment_amount" value="<?php if($row_rsodest_authorization['status']=='Approved'){echo $row_rsodest_authorization['authorized_amount_approved']; }else{echo $row_rsodest_authorization['authorized_amount_approved'];};?>">
                               <input type="hidden" id="total_price_cash" name="total_price_cash" value="<?php echo $amount_to_pay;?>">
                               <input type="hidden" id="outstanding_balance_actual" name="outstanding_balance_actual" value="">
                              <input type="hidden" id="amount_for_change" name="amount_for_change" value="">
                              <input type="hidden" id="type_of_patient" name="type_of_patient" value="<?php echo $row_rsodest_claim_no['typeofvisit'];?>">
                              <input type="hidden" id="patient_no" name="patient_no" value="<?php echo $patient_no;?>">
                              <input type="hidden" id="process_claim_no" name="process_claim_no" value="<?php echo $process_claim_no;?>">
                              <input type="hidden" id="patient_name" name="patient_name" value="<?php echo $row_rsodest_patient['surname']." ".$row_rsodest_patient['othernames'];?>">
                               </td>
                              <td ><span >Change</span></td>
                              <td ><div id="amount_change" style="font-size:14px; color:blue; font-weight:bolder;"></div></td>
                            </tr>
                            <tr class="baseborder">
                                <td height="30" colspan="4" style="text-align: right;">
                                    <a onClick="getitempayment('make_payments','paymentdetails','<?php echo $process_claim_no; ?>');return false;" class="btn green"> Save Payment <i class="fa fa-check"></i></a>                             
                                </td>
                            </tr>
                          </tbody>
                        </table>

                                                                </div>  
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                                
                                            </div> 
                                        </div>
                                      
                                </div>
                            </div>

                            <div class="tab-pane" id="tab_1_2">
                                <div class="portlet-body form">
                                    <div class="form-body">
                                        <div class="row">
                                            <div class="col-md-12">
                                                <?php
                                                $query_rsodest_cashier_payments = "select *, DATE_FORMAT(date_added, '%e %b %Y') as datenew from cashier_payments where patient_no='$patient_no' order by id desc";
                                                $rsodest_cashier_payments = mysql_query($query_rsodest_cashier_payments, $courier) or die(mysql_error($courier));
                                                $row_rsodest_cashier_payments = mysql_fetch_assoc($rsodest_cashier_payments);
                                                $totalRows_cashier_payments = mysql_num_rows($rsodest_cashier_payments);
                                                ?>
                                                <div class="col-md-6">
                                                    <div class="portlet light bordered">
                                                         <div class="portlet-title">
                                                            <div class="caption caption-md">
                                                                <i class="icon-globe theme-font hide"></i>
                                                                <span class="caption-subject font-blue-madison bold uppercase">LIST OF PAYMENTS</span>
                                                            </div>
                                                        </div>
                                                        <div class="portlet-body">
                                                            <table class="table table-striped table-bordered">
                                                                <thead>
                                                                    <tr>
                                                                        <th class="count">&nbsp;</th>
                                                                        <th>Payment Date</th>
                                                                        <th>Receipt No</th>
                                                                        <th>Pay By</th>
                                                                        <th>Amount</th>
                                                                        <th>Action</th>

                                                                    </tr>
                                                                </thead>
                                                                <tbody>  <?php 
                                                                if ($totalRows_cashier_payments > 0) { ?>
                                                                        <?php
                                                                        do {
                                                                            $start_row = $start_row + 1;
                                                                            ?>
                                                                            <tr>
                                                                                <td height="23" class="count"><span><?php echo $start_row; ?></span></td>
                                                                                <td style="cursor: pointer;" onclick="getData('view_patient_cash_payments','<?php echo $row_rsodest_cashier_payments['receiptno']; ?>','#cash_details');"><?php if ($checkstatus == '') {
                                                                                $checkstatus = $row_rsodest_cashier_payments['status'];
                                                                            }echo $row_rsodest_cashier_payments['datenew']; ?></td>
                                                                                <td onclick="getData('view_patient_cash_payments','<?php echo $row_rsodest_cashier_payments['receiptno']; ?>','#cash_details');" style="cursor: pointer;"><?php echo $row_rsodest_cashier_payments['receiptno']; ?></td>
                                                                                <td onclick="getData('view_patient_cash_payments','<?php echo $row_rsodest_cashier_payments['receiptno']; ?>','#cash_details');" style="cursor: pointer;"><?php echo $row_rsodest_cashier_payments['pay_by']; ?></td>
                                                                                <td onclick="getData('view_patient_cash_payments','<?php echo $row_rsodest_cashier_payments['receiptno']; ?>','#cash_details');" style="cursor: pointer;"><?php echo $currency.' '.number_format($row_rsodest_cashier_payments['amount'],2); ?></td>
                                                                                <td onclick="getData('view_patient_cash_payments','<?php echo $row_rsodest_cashier_payments['receiptno']; ?>','#cash_details');" style="cursor: pointer;color: blue;">View Details</td>
                                                                            </tr>

    <?php } while ($row_rsodest_cashier_payments = mysql_fetch_assoc($rsodest_cashier_payments)); ?>
<?php } else { ?>
                                                                        <tr>
                                                                            <td style="color:red;" height="23" colspan="10" class="count">Sorry, No Payment Found Yet.</td>
                                                                        </tr>
<?php } ?>
                                                                </tbody>
                                                            </table>

                                                        </div>
                                                    </div>
                                                </div>

                                                <div class="col-md-6">
                                                    <div class="portlet light bordered">
                                                        <div class="portlet-title">
                                                            <div class="caption caption-md">
                                                                <i class="icon-globe theme-font hide"></i>
                                                                <span class="caption-subject font-blue-madison bold uppercase">PAYMENT DETAILS</span>
                                                            </div>
                                                        </div>
                                                        <div class="portlet-body">
                                                            <div id="cash_details">
                                                                <table class="table table-striped table-bordered" id="membershipinfo2">
                                                                    <tbody>
                                                                        <tr>
                                                                            <td>No Payment Records Found</td>
                                                                        </tr>
                                                                    </tbody>
                                                                </table>

                                                            </div>	
                                                        </div>
                                                    </div>
                                                    <div>
                                                    </div> 
                                                </div>
<?php // }  ?>

                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
           
    </div>
        </div>
        </div>
    </div>
</form>