?>
</td></tr>
                                                    </table>
                                                </div>
                                            </td></tr>

                                                <?php 
    }
    ?>

                                        <tr><td colspan="3" align="center">
                                                <input type="button" class="comm_btnpcm_blue"  value="Back to Orders"  class="button"  onClick="window.location.href='orders.php'" >&nbsp;&nbsp;
                                                <input type="button" class="comm_btnpcm_blue" value="Back to My Account" name="btnBack"  class="button" onClick="window.location.href='myaccount.php'">
                                                    <?php 
    //   if($rr_settings['enable_rma']=='Y' &&  (substr_count( getOrderStatus($orderid),"Delivered")>0) && $refund_id==0 && $giftid=='') {
    if ($rr_settings['enable_rma'] == 'Y' && getRefundOrderStatus($orderid) == 1 && $refund_id == 0 && $giftid == '' && !checkAllProductsRefunded($orderid)) {
        ?>
                                                              <input type="button" class="comm_btnpcm_blue"  value="Request Refund"  class="button"  onClick="window.location.href='refund_request.php?orderid=<?php 
        echo $orderid;
        ?>
'" >
                                                <?php 
    }
    ?>
                                            </td></tr>
                        </table>
                        <div class="clear"></div>

                    </div>

                        <?php 
                <div align="left" id="items_top_area_ttl">Return Payment Requests</div>
            </div>


            <div class="order_listings">
               
                    <table width="100%"  border="0" cellpadding="0" cellspacing="5" align="center">

                       <!-- <tr>
                            <td height="21"  align="left"><strong>Registration for Return Payments</strong></td>
                        </tr>-->
                        <tr>
                            <td>
                                <?php 
if ($numrows > 0) {
    if (!checkAllProductsRefunded($orderid)) {
        ?>
                                <table border="0" width="100%" cellpadding="2" class="cart_listingtbl">
                                            <?php 
        if (!empty($message)) {
            ?>
                                    <tr><td colspan="4" class="text_information" height="30"><?php 
            echo $message;
            ?>
ss</td>
                                    </tr> <?php 
        }
        // end if ,essage check
        ?>

                                    <tr><th width="13%"><input type="checkbox" name="checkAllBox" value="checkbox" onclick="toggleChecked(this.checked)"></td>
            echo "*";
        }
        ?>
</td>
                                <td align="center" class="item_price">
                                            <?php 
        echo $link . htmlentities(getOrderStatus($row["order_id"])) . "</a>";
        ?>
                                </td>
                                <td align="left" class="required"><?php 
        //echo $rr['enable_rma']."==".$row['ngift_product_id']."==".getRefundOrderStatus($row["order_id"])
        ?>
                                            <?php 
        //  echo "<br>enable_rma :".$rr['enable_rma'];    echo "<br>".getRefundOrderStatus($row["order_id"])==1 ;  echo "<br>".checkAllProductsRefunded($row["order_id"]);
        //  if($rr['enable_rma']=='Y' &&   $row['ngift_product_id']=='' && getRefundOrderStatus($row["order_id"])==1) {
        if ($rr['enable_rma'] == 'Y' && getRefundOrderStatus($row["order_id"]) == 1 && !checkAllProductsRefunded($row["order_id"])) {
            if ($row["refundflag"] != '') {
                echo "Refund Request already sent";
            } else {
                echo " <I><a href='refund_request.php?orderid=" . $row["order_id"] . "' class='required'> Request Refund  </a><I>";
            }
        }
        //echo "\n ##". htmlentities(getOrderStatus($row["order_id"]))."##".$row["refund_id"];
        ?>
                                            <?php 
        if ($rr['enable_rma'] == 'Y' && htmlentities(getOrderStatus($row["order_id"])) == "Delivered" && $row["refund_id"] != '0') {
            echo " ( Refund  Requested )";
        }
        ?>
                                </td>
                            </tr>