<?php

require_once("./includes/initialize.php");
ob_start();session_start();
global $database;

//echo 'Student ID: '.$biodata->formno;
$transRec = $database->query("select * from acceptance_tranzact_remita where formno = '$biodata->formno' order by id desc limit 0,100");

$transRec2 = $database->query("select * from schoolfees_tranzact where formno = '$biodata->formno' order by id desc limit 0,100");


?>


<div class="spaceUp">
    <div class="row">
        <div class="col-md-12">
            <div class="table-responsive">
                <table class="table table-hover">
                    <thead>
                    <tr>
                        <th>
                            S/N
                        </th>
                        <!--<th>
                            Transaction Id
                        </th>-->
                        <th>
                            Description
                        </th>
                        <th>
                            Amount
                        </th>
                        <th>
                            Status
                        </th>
                        <th>
                            Date
                        </th>
                        <th>
                            Action
                        </th>
                        <th>
                            Reprint
                        </th>
                    </tr>

                    </thead>
                    <tbody class="text-center">

                    <?php $sn = 1;
                    while ($rec = mysqli_fetch_array($transRec)): ?>
                        <tr
                                class="<?php if ($rec['statusMessage'] =='Successful') {
                                    echo("success");
                                } else {
                                    echo("danger");
                                } ?> text-center">
                           
                           
                            <td class="text-align-center"><?php echo($sn);
                                $sn++; ?></td>
                            <!--<td class="text-align-center"><?php // echo(strtoupper($rec['txt_ref'])) ?></td>-->
                            <td class="text-align-center">
                                Acceptance Fees Payment
                            </td>
                            <td class="text-align-center">
                                <?php echo(floatval($rec['amount'] + $rec['txt_fees'] + $rec['overhead'])) ?>
                            </td>
                           <!-- <td class="text-align-center">
                                <?php //echo ($rec['status'])?>
                            </td>-->
                            <td class="text-align-center"><?php
                                if ($rec['statusMessage'] == 'Successful') {
                                    echo("Paid");
                                } else {
                                    echo("UnSuccessful");
                                }
                                ?></td>
                            <td class="text-align-center"><?php $cd = new DateTime($rec['datetime']);
                                $cd->format('Y-m-d H:i:s');
                                echo(date_format($cd, 'Y-m-d H:i:s')) ?></td>

                            <td class="text-align-center">
                                <?php if ($rec['status'] != 'PAID') : ?>
                                    <a href="./pages/sessionSetter.php?paymentID=<?php echo($rec['id']) ?> "
                                       class="pointer">
                                        <button ng-hide="t.loading" type="button"
                                                class="btn btn-primary center-block">
                                            ReQuery
                                        </button>
                                    </a>
                                <?php endif; ?>
                            </td>
                            
                            <td class="text-align-center">
                                <?php if ($rec['statusMessage'] == 'Successful'): ?>
                                    <a href="acceptance_receipt.php?id=<?php echo ($rec['id']); ?>" target="_new"
                                       class="pointer"" target="_new"
                                       class="pointer">
                                        <button ng-hide="t.loading" type="button"
                                                class="btn btn-primary center-block" style='background-color:green; color:white;border:none; padding:4px 14px' >
                                            Print
                                        </button>
                                    </a>
                                    <?php endif; ?>
                            </td>
                        </tr>
                    <?php endwhile; ?>
                    
                    
                    <?php
                    while ($rec = mysqli_fetch_array($transRec2)): ?>
                        <tr
                                class="<?php if ($rec['responsecode'] == '00') {
                                    echo("success");
                                } else {
                                    echo("danger");
                                } ?> text-center">
                           
                           
                            <td class="text-align-center"><?php echo($sn);
                                $sn++; ?></td>
                            <!--<td class="text-align-center"><?php // echo(strtoupper($rec['txt_ref'])) ?></td>-->
                            <td class="text-align-center">
                                School Fees Payment
                            </td>
                            <td class="text-align-center">
                                <?php echo(floatval($rec['amount'] + $rec['txt_fees'] + $rec['overhead'])) ?>
                            </td>
                           <!-- <td class="text-align-center">
                                <?php //echo ($rec['status'])?>
                            </td>-->
                            <td class="text-align-center"><?php
                                if ($rec['responsecode'] == '00') {
                                    echo("Paid");
                                } else {
                                    echo("UnSuccessful");
                                }
                                ?></td>
                            <td class="text-align-center"><?php $cd = new DateTime($rec['datetime']);
                                $cd->format('Y-m-d H:i:s');
                                echo(date_format($cd, 'Y-m-d H:i:s')) ?></td>

                            <td class="text-align-center">
                                <?php if ($rec['status'] != 'PAID') : ?>
                                   <a href="./pages/requeryschoolfee.php?transid=<?php echo($rec['txt_ref']) ?>& amount=<?php echo(floatval($rec['amount'] + $rec['txt_fees'] + $rec['overhead'])*100);?> "
                                  class="pointer">
                                        <button ng-hide="t.loading" type="button"
                                                class="btn btn-primary center-block">
                                            ReQuery
                                        </button>
                                    </a>
                                <?php endif; ?>
                            </td>
                            
                            <td class="text-align-center">
                            
                                <?php if ($rec['responsecode'] == '00' && $rec['level']='HND II') : 
                                ?>
                                    <a href="schoolfees_receipt.php?id=<?php echo ($rec['id']); ?>" target="_new"
                                       class="pointer">
                                        <button ng-hide="t.loading" type="button"
                                                class="btn btn-primary center-block">
                                            Print
                                        </button>
                                    </a>
                                    <?php endif; ?>
                            </td>
                        </tr>
                    <?php endwhile;  ?>
                    
                    
                    </tbody>
                </table>
            </div>

        </div>

    </div>

</div>


<!--important for menu-->
</div>
</div>
