HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-31-18-78 6.17.0-1017-aws #17~24.04.1-Ubuntu SMP Tue May 26 21:09:53 UTC 2026 aarch64
User: ubuntu (1000)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: /var/www/grapossconnect/center-admin/order-history.php
<?php
include_once('header.php');


//order history details
$getOrders = "SELECT t.txn_id,t.txn_amount,t.deduct_amount,t.txn_date,p.product_name,pc.category_name,m.merchant_name FROM grp_agents_transaction as t LEFT JOIN grp_product as p on p.product_id=t.product_id LEFT JOIN grp_product_category as pc on pc.category_id=p.category_id LEFT JOIN grp_merchants as m on m.merchant_id=p.merchant_id where t.agent_id='$AGENT_ID' order by t.txn_date desc";
$fetchOrders = $wpdb->get_results($getOrders);

?>
<div class="page-inner">
    <div id="main-wrapper">
        <div class="row">
            <div class="page-title">
                <h3>Orders</h3>
                <div class="page-breadcrumb">
                    <ol class="breadcrumb">
                        <li><a href="home">Orders</a></li>
                        <li class="active">Order History</li>
                    </ol>
                </div>
            </div>
        </div>

        <section class="recharge-history-section">
            <div class="row m-0">
                <div class="col-md-7 col-sm-7 col-xs-12 p-0">
                    <div class="recharge-history-head">
                        <h4>Order History</h4>
                        <p>List of all Orders</p>
                    </div>
                    <?php 
                        if(sizeof($fetchOrders) > 0) {
                    foreach($fetchOrders as $fo){ ?>
                    <div class="order-history-section row m-0">
                        <div class="col-md-6 col-sm-4 col-xs-12">
                            <p class="order-history-para">Txn Ref</p>
                            <h2 class="order-history-head2"><?php echo 'TxnId:'.$fo->txn_id; ?></h2>

                            <p class="order-history-para"><?php echo $fo->product_name; ?></p>
                            <h4 class="order-history-head"><?php echo $fo->merchant_name; ?></h4>
                        </div>
                        <div class="col-md-3 col-sm-4 col-xs-12">
                            <p class="order-history-para">ORDERED ON</p>
                            <h4 class="order-history-head"><?php echo date('d M Y', strtotime($fo->txn_date)); ?></h4>

                            <p class="order-history-para">ORDER TOTAL</p>
                            <h4 class="order-history-head">₹ <?php echo $fo->txn_amount; ?></h4>
                        </div>
                        <div class="col-md-3 col-sm-4 col-xs-12">
                            <p class="order-history-para text-right">WALLET DEDUCTION</p>
                            <h4 class="order-history-head text-right" style="color: #1fb138;">Success</h4>

                            <p class="order-history-para text-right">Deduct AMOUNT</p>
                            <h4 class="order-history-head text-right" style="color: #018de5;">₹ <?php echo $fo->deduct_amount; ?></h4>
                        </div>
                        <div class="col-md-12 col-sm-12 col-xs-12">
                            <p class="details-para" onclick="openCity(event, '<?php echo 'TxnId:'.$fo->txn_id; ?>')"><i class="fa fa-info-circle" style="color: #018de5;"></i> Details</p>
                        </div>
                    </div>
                    <?php } } else { echo "No order history"; } ?>
                </div>
                <div class="col-md-5 col-sm-7 col-xs-12 p-0">
                    <div class="recharge-history-details">
                    <?php
                        if(sizeof($fetchOrders) > 0) {
                    $i=1; foreach($fetchOrders as $sfo){ 
                        ?>
                        <div id="<?php echo 'TxnId:'.$sfo->txn_id; ?>" class="tabcontent" <?php if($i==1) { ?> style="display:block;" <?php } else { ?> style='display:none;' <?php  } ?>>
                            <div class="recharge-history-div">
                                <h3><?php echo $sfo->product_name; ?> <span>Wallet Deduction: Success</span></h3>
                                <p><?php echo 'TxnId:'.$sfo->txn_id; ?></p>
                            </div>
                            <div class="order-history-table">
                                <h4>Order Summary</h4>
                                <table>
                                    <tr>
                                        <th>Service</th>
                                        <td><?php echo $sfo->product_name; ?></td>
                                    </tr>
                                    <tr>
                                        <th>Merchant</th>
                                        <td><?php echo $sfo->merchant_name; ?></td>
                                    </tr>
                                    <tr>
                                        <th>Category</th>
                                        <td><?php echo $sfo->category_name; ?></td>
                                    </tr>
                                    <tr>
                                        <th>MRP Amount</th>
                                        <td>Rs. <?php echo $sfo->txn_amount; ?></td>
                                    </tr>
                                    <tr>
                                        <th>Total Amount</th>
                                        <td style="color: #1fb138;">Rs. <?php echo $sfo->deduct_amount; ?></td>
                                    </tr>
                                </table>
                                <h4>Earnings</h4>
                                <table>
                                    <tr>
                                        <th>Commission</th>
                                        <td>Rs. <?php echo ($sfo->txn_amount-$sfo->deduct_amount); ?></td>
                                    </tr>
                                    <tr>
                                        <th>Taxes</th>
                                        <td>Rs. 0.00</td>
                                    </tr>
                                    <tr>
                                        <th>TDS</th>
                                        <td>Rs. 0.00</td>
                                    </tr>
                                </table>
                                <p>Order No <span style="font-weight: bold;"><?php echo 'TxnId:'.$sfo->txn_id; ?></span> was processed successfully at <span style="font-weight: bold;"><?php echo date('H:i M d Y',strtotime($sfo->txn_date)); ?></span> </p>
                            </div>
                        </div>
                    <?php $i++; } } ?>
                    </div>
                </div>
            </div>
        </section>
    </div><!-- Main Wrapper -->
    <div class="page-footer">
        <p class="no-s">bharatcbc.com</p>
    </div>
</div>
<!-- Page Inner -->
<script>
    function openCity(evt, cityName) {
        var i, x, tablinks;
        x = document.getElementsByClassName("city");
        for (i = 0; i < x.length; i++) {
            x[i].style.display = "none";
        }
        tablinks = document.getElementsByClassName("tablink");
        for (i = 0; i < x.length; i++) {
            tablinks[i].className = tablinks[i].className.replace(" w3-red", "");
        }
        document.getElementById(cityName).style.display = "block";
        evt.currentTarget.className += " w3-red";
        //scroll
        jQuery('html, body').animate({
            scrollTop: jQuery(".recharge-history-details").offset().top
        }, 2000);
        //end scroll
    }
</script>

<script>
    function openCity(evt, cityName) {
        var i, tabcontent, tablinks;
        tabcontent = document.getElementsByClassName("tabcontent");
        for (i = 0; i < tabcontent.length; i++) {
            tabcontent[i].style.display = "none";
        }
        tablinks = document.getElementsByClassName("tablinks");
        for (i = 0; i < tablinks.length; i++) {
            tablinks[i].className = tablinks[i].className.replace(" active", "");
        }
        document.getElementById(cityName).style.display = "block";
        evt.currentTarget.className += " active";
        //scroll
        jQuery('html, body').animate({
            scrollTop: jQuery(".recharge-history-details").offset().top
        }, 2000);
        //end scroll
    }
</script>


<?php
include_once('footer.php');
?>