<?php 
//ob_start();session_start();
error_reporting(E_ALL);
ini_set('display_errors',1);

require_once("includes/initialize.php");
require_once('includes/mail.php');
require_once("includes/successMail.php");
global $mail;
$transId = null; $stdid='';

//echo "Diee: ".$stdid= $_SESSION['transId'];
//$stdid=$_SESSION['stdid']='16313';
 if (isset($_SESSION['stdid'])) {
   
  $stdid=$_SESSION['stdid'];
    
   
    
    
}else if (isset($_SESSION['transId'])){
    
//  echo "fjj: ".$_POST['txnref'];

            $tran = $_SESSION['transId'];
            $findData =Online::fetch_trans($tran); 
                
                  
              $stdid= $findData->acc_id;
  
}else{
    
    //Commented the line to view the requery page output
      //redirect_to('index.php');
}


//echo "found";



 $stuDet = StudentAcct::accid($stdid);
 
 //echo "<br>Email: ".$stuDet->email;

// if ($stuDet->progtype=='NDPU'){
//       $messagetopaymentpage = '/jamb-screening.php?email='.$stuDet->email.'&token='.$stuDet->token;
   
//      }else if (($stuDet->progtype=='CAPND') OR ($stuDet->progtype=='CAPHND')){
//         $messagetopaymentpage = '/cap-bill.php?email='.$stuDet->email.'&token='.$stuDet->token;
  
//      }else if ( ($stuDet->progtype=='PGD')){
//         $messagetopaymentpage = '/pgd-bill.php?email='.$stuDet->email.'&token='.$stuDet->token;
  
//      }
//      else{
//   $messagetopaymentpage = '/view-bill.php?email='.$stuDet->email.'&token='.$stuDet->token;
         
//      }









?>
<?php include_layout_template('headers.php')?>
<script> document.title="Admission::Requery Page"</script>

 
  </div>


<body>

<h1 style="text-align:center; border-bottom:10px groove #06F">Transaction Resolution Page</h1>
<h3 style="text-align:center">Kindly click the button below to requery your transaction.</h3>

<div class="spaceUp" style="background-color:#FFF; color:#000">
    <div class="row">
        <div class="col-md-12">
            <div class="table-responsive" style="padding-top:15px; padding-bottom:15px">
                <table class="table table-hover " border="1" style="margin-left:2px; color:#000; width:100%; padding:20px">
                    <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>
                    </tr>

                    </thead>
                    <tbody class="text-left">
<?php $trans = Biodata::reQuery($stdid,5500) ?>
                    <?php $sn = 1;
					foreach ($trans as $rec):?>
                
                        <tr
                                class="<?php if ($rec->responsecode == '00') {
                                    echo("success");
                                } else {
                                    echo("danger");
                                } ?> text-left">
                            <td class="text-align-left"><?php echo($sn);
                                $sn++; ?></td>
                            <td class="text-align-left"><?php echo(strtoupper($rec->txt_ref)) ?></td>
                            <td class="text-align-left">
                               Screening Form Payment
                            </td>
                            <td class="text-align-left">
                                <?php echo(floatval($rec->amount)) ?>
                            </td>
                           
                            <td class="text-align-left"><?php
                                if ($rec->responsecode == '00') {
                                    echo("Paid");
                                } else {
                                   echo $rec->status;
                                    //echo("Unsuccessful");
                                }
                                ?></td>
                            <td class="text-align-left"><?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-left">
                                <?php if ($rec->responsecode != '00') : ?>
                                    <a href="requery.php?transid=<?php echo($rec->txt_ref) ?>"
                                       class="pointer">
                                        <button ng-hide="t.loading" type="button"
                                                class="btn btn-primary left-block">
                                            ReQuery
                                        </button>
                                    </a>
                                    <?php elseif ($rec->responsecode == '00'):$_SESSION['txt_ref']=$rec->txt_ref;?>
                                    
                                     <a href="print_appform.php?stdid=<?php echo $rec->acc_id?>" target="_blank"
                                       class="pointer">
                                        <button ng-hide="t.loading" type="button"
                                                class="btn btn-primary left-block">
                                            Print Receipt
                                        </button>
                                    </a>
                                  
                                <?php endif; ?>
                            </td>
                        </tr>
                   
                    <?php  
    //                 else:
				// 		echo "<span style='margin-left:15px;'>No payment history to display</span>";
					
					endforeach;
					?>
                    </tbody>
                </table>
            </div>

        </div>

    </div>

</div>


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





















<!--<a href='<?php //echo $messagetopaymentpage; ?>' class='pointer'><button class='btn btn-info pointer' type='button' style='float:left; margin:20px 10px 0px 20px;'>Switch payment Mode</button></a>-->

<a href='logout.php' class='pointer' >
<button class='btn btn-success pointer' type='button' style="float:right; margin:20px 10px 0px 0px;">
log out
</button>
</a>
</body>
</html>