<?php  session_start(); error_reporting(0); ?>
<?php if(!isset($_SESSION['j_admin']) && !isset($_SESSION['j_admin'])){ 
    $url = urlencode("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"); header('location:../login/?url='.$url.'');  
} ?>
<!doctype html>
<html lang="en"> 
<head>
	<?php
    require_once("../j_conn/url.php");
    require_once("../j_conn/dbc.php");
    require_once("../j_incs/functions.php");
    $page_name="Transaction Details";
    $page_desc="$page_name";
    $page_img="".$dir."j_files/j_img/logo/logo-meta.png";
    $page_author="$company";
    $page_keywords="".$company.", $page_name, $page_desc, ".$company_motto.", $company_desc";
    $page_url="".$dir."receipt/";
    require_once("../j_incs/metas.php");
    require_once("../j_incs/scripts-top.php");
    ?>
</head>
<body>
    <div class="app">
        <div class="layout">
            <?php 
            require_once("../j_incs/header.php");
            require_once("../j_incs/nav.php");
            ?>
            <!-- Page Container START -->
            <div class="page-container">
                

                <!-- Content Wrapper START -->
                <div class="main-content">
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-md-2"></div>
                            <div class="col-md-8">
                                <div class="page-header">
									<div class="header-sub-title">
										<nav class="breadcrumb breadcrumb-dash">
											<a href="<?php echo $dir; ?>" class="breadcrumb-item"><i class="anticon anticon-dashboard m-r-5"></i>Dashboard</a>
											<!--<a class="breadcrumb-item" href="#"> </a>-->
											<span class="breadcrumb-item active"><?php echo $page_name; ?></span>
										</nav>
									</div>
								</div>
                            </div>
                        </div>
                    </div>
					<div class="container-fluid">
						<div class="row">
							<div class="col-md-2"></div>
							<div class="col-md-8">
								
								
								
								<div class="accordion" id="accordion-default4"> <!--verify action-->
									<div class="card">
										<div class="card-header">
											<h5 class="card-title">
												<a data-toggle="collapse" href="#acc_4">
													<span><?php echo $page_name; ?></span>
												</a>
											</h5>
										</div>
										<div id="acc_4" class="collapse show" data-parent="#accordion-default4">
											<div class="card-body">
												
												
												<?php 
												$ref = RMC($_GET['ref']);
												$limit =1;
												$offset = RMC($_GET['m']);
												if($offset<1){
													$offset = 0;
													$num = 1;
												}else{
													$num=$offset+1;
												}
												//count all
												
												$sql4="SELECT * from j_pays WHERE j_deleted < 1 AND j_transact_id='".$ref."' order by j_id desc"; //check 
												
												$result4 = runSQL($sql4);
												$total = mysqli_num_rows($result4);
												//
												
												$sql4="SELECT * from j_pays WHERE j_deleted < 1 AND j_transact_id='".$ref."' order by j_id desc limit $limit offset $offset"; //check 
												
												$result4 = runSQL($sql4);
												$count = mysqli_num_rows($result4);
												if($count<1){
												?>
												
												<p align="center">
													<img src="<?php echo $dir; ?>j_files/j_img/icons/empty-1.svg"/><br/>
													No transaction found.
												</p>

												<p class="text_sm_gray text-center">
													As you make transactions, details of each will be reported here.
												</p>
												<?php }else{ ?>
												<?php
												while ($row = mysqli_fetch_array($result4)){
													$cd = get_cd($row['j_currency']);
													$currency_in_use = $cd[0];
													$currency_code_in_use = $cd[1];
													$currency_sort_in_use = $cd[2];
												?>
												<?php 
												/*
												<a title="<?php echo $currency_code_in_use; echo num_format($row['j_amount']); ?> " href="<?php echo $dir; ?>receipt?ref=<?php echo $row['j_transact_id']; ?>">
													<div class="t_box <?php if($row['j_type']=='debit'){ echo 'danger';}else{ echo 'success'; } ?>">
													   <div class="date">
														   <i class="anticon anticon-clock-circle"></i> <?php echo time_ago($row['j_date']); ?>
														</div>
														<div class="amount">
															<?php echo $currency_code_in_use; echo num_format($row['j_amount']); ?> 
														</div>
														<div class="desc">
															<?php echo $row['j_desc']; ?> 
														</div>
													</div>
												</a>
												*/
												?>
												<ul class="list-group list-group-flush trans_info">
													<?php 
													if($row['j_kind']=='LEVEL FEE'){ require_once('level-fee.php'); }
													if($row['j_kind']=='DEPOSIT'){ require_once('top-up.php'); }
													if($row['j_kind']=='NFT-BUY'){ require_once('nft-buy.php'); }
													if($row['j_kind']=='NFT-SELL'){ require_once('nft-sell.php'); }
							
													if($row['j_kind']=='A-Credit'){ require_once('a-credit.php'); }
													if($row['j_kind']=='A-Debit'){ require_once('a-debit.php'); }
													if($row['j_kind']=='TRANSFER'){ 
														if($row['j_type']=='debit'){ 
															require_once('transfer.php'); 
														}else{
															require_once('transfer-credit.php'); 
														}
													}
													if($row['j_kind']=='ACTIVATION'){ require_once('activation.php'); }
													if($row['j_kind']=='COURSE-ENROL'){ require_once('course-enrol.php'); }
													if($row['j_kind']=='REFERRAL-BONUS'){ require_once('referral-bonus.php'); }
													if($row['j_kind']=='TOP-UP' || $row['j_kind']=='Fund Wallet'){ require_once('top-up.php'); }
													if($row['j_kind']=='WITHDRAW'){ require_once('withdraw.php'); }
													if($row['j_kind']=='CRYPTO-BUY'){ require_once('crypto-buy.php'); }
													if($row['j_kind']=='CRYPTO-SELL'){ require_once('crypto-sell.php'); }
													if($row['j_kind']=='CRYPTO-DISBURSEMENT'){ require_once('crypto-disbursement.php'); }
													if($row['j_kind']=='CASHBACK'){ require_once('cashback.php'); }
													if($row['j_kind']=='TRADING'){ require_once('investment.php'); }
													if($row['j_kind']=='DEPOSIT'){ require_once('deposit.php'); }
													if($row['j_kind']=='TRADING-EARNING'){ require_once('investment-earn.php'); }

													?>
												</ul> 
												
												<?php } ?>
												<br/>
												<p align="center">
													<a href="<?php echo $dir; ?>receipt/download-receipt.php?r=<?php echo ($ref); ?>" class="app_btn bg-success download_slip"> 
													   <i class="fa fa-file-download"></i> Download Slip
													</a>
												</p>
												
												<?php } ?>
												
												
											</div>
										</div>
									</div>
								</div>
								
							   
							</div>
						</div>
					</div>
					
					<div class="m-b-100"></div>
        
				</div>
			</div>
		</div>
    </div>
    <?php 
    require_once("../j_incs/footer.php"); 
    require_once("../j_incs/scripts-bottom.php"); 
    ?>
    <script>
    $("#searchAnything").click(function(){
        $(this).hide();
        $("#my-content").hide();
        $("#my_saearch").slideDown("slow");
        $("#hide_searchAnything").slideDown("slow");
    });
    $("#hide_searchAnything").click(function(){
        $(this).hide();
        $("#my-content").show();
        $("#my_saearch").slideUp("slow");
         $("#searchAnything").slideDown("slow");
    });
        
    var form = "#form";
    var button = "#submit";
    var button_val = $(button).html();
    var result = "#formresult";
    $(form).on('submit',(function(e) {
    e.preventDefault();
    $(button).attr('disabled', '');
    $(button).html("<i class='anticon anticon-loading'></i> Processing");
    $(result).html("<div class='alert alert-warning'> Taking too long? <a href=''>Reload </a></div>");
     $.ajax({
    url: "save.php",
    type: "POST",
    data: new FormData(this),
    contentType: false,
    cache: false,
    processData:false,
    success: function(data)
    {
    if(data){
     $(button).removeAttr('disabled');
    $(button).html(button_val);
    $(result).html(data);
    }else{
    $(result).html("Error occurred.");
    $(button).removeAttr('disabled');
    $(button).html(button_val);
    }
    }
    });
    }));
    </script>
</body>
</html>