<fieldset>
                    <table width="100%" border="0" cellspacing="2" cellpadding="2">

<?php 
if (!$paymentsuccessful) {
    ?>

                            <tr>
                                <td class=maintext align="left">
    					 Total to Pay
                                </td>
                                <td align="left" class='maintext'>
<?php 
    //   $display_total = number_format(getCartTotal($_SESSION["sess_userid"]),2,".","");
    if (isset($_SESSION['couponCode_det'])) {
        $display_total = number_format(getCartTotalcouponCode($_SESSION["sess_userid"], $_SESSION['couponCode_det']), 2, ".", "");
    } else {
        $display_total = number_format(getCartTotal($_SESSION["sess_userid"]), 2, ".", "");
    }
    echo "&#36;";
    echo "&nbsp;";
    echo $display_total;
    ?>
                                </td>
                            </tr>
<?php 
    $check_shipping_enable = checkShippingEnable();
    if ($check_shipping_enable == "Y" && $hide_shipping_division == 1) {
        $shipping_cost = $_SESSION['SESS_upscost'];
        ?>
		
			<?php 
}
?>

			<?php 
if (isset($_POST['couponCode']) && $_POST['couponCode'] != '') {
    ?>

				<tr>
              <td width="56%" align="right">Item Total Cost  After Discount</td>
              <td width="44%">&nbsp; <?php 
    echo $adminCurrency['currency_symbol'];
    ?>
 <?php 
    echo number_format(getCartTotalcouponCode($_SESSION["sess_userid"], $couponCode_det), 2, ".", "");
    ?>
			   <?php 
    if ($adminCurrency['currency_code'] != $currency_attributes[2]) {
        ?>
			  &nbsp; ( <?php 
        echo $currency_attributes[0] . "&nbsp;" . number_format(getUserCouponcodeCartTotal($_SESSION["sess_userid"], $couponCode_det), 2, ".", "");
        ?>
 )

			  <?php 
    }
    ?>
			  </td>
            </tr>
/*-------function call to check whether cart contains digital or gift coupon products so as to hide shipping------*/
$check_shipping_enable = checkShippingEnable();
if ($check_shipping_enable == "Y" && $hide_shipping_division == 1) {
    $shipping_cost = $_SESSION['SHIPPING_TOTAL'];
    $shipping_cost = number_format($shipping_cost, 2, ".", "");
    $shipping_form = "<input type='hidden' name='handling_cart' value='{$shipping_cost}'>";
    $shipping_form .= "<input type='hidden' name='no_shipping' value='1'>";
} else {
    $shipping_form = "<input type='hidden' name='no_shipping' value='1'>";
}
$cart_coupon_discount = 0;
if (isset($_SESSION['sess_giftcertificate_available_amt']) && $_SESSION['sess_giftcertificate_available_amt'] > 0) {
    $cart_coupon_discount = number_format($_SESSION['sess_giftcertificate_available_amt'], 2, ".", "");
}
if (isset($_SESSION['couponCode_det']) && $_SESSION['couponCode_det'] != '') {
    $totalpay = number_format(getCartTotalcouponCode($userid, $_SESSION['couponCode_det']), 2, ".", "");
    $cart_coupon_discount = number_format(getCartTotalcouponCodeDicountamount($userid, $_SESSION['couponCode_det']), 2, ".", "");
} else {
    $totalpay = number_format(getCartTotal($userid), 2, ".", "");
}
if (isset($_SESSION['couponCode_det']) && $_SESSION['couponCode_det'] != '' && $_SESSION['sess_giftcertificate_available_amt'] > 0) {
    $couponCodeDiscountAmt = getCartTotalcouponCodeDicountamount($userid, $_SESSION['couponCode_det']);
    $total_discount_amount = $_SESSION['sess_giftcertificate_available_amt'] + $couponCodeDiscountAmt;
    $cart_coupon_discount = number_format($total_discount_amount, 2, ".", "");
}
$totaltopay = number_format($totalpay, 2, ".", "");
if (isset($_SESSION['sess_giftcertificate_available_amt']) && $_SESSION['sess_giftcertificate_available_amt'] > 0) {
    if ($totaltopay > $_SESSION['sess_giftcertificate_available_amt']) {
        $totaltopay = $totaltopay - $_SESSION['sess_giftcertificate_available_amt'];
    } else {
        $totaltopay = $_SESSION['amount_paid'];
$txtCCNumber = $_POST["txtCCNumber"];
$txtCVV2 = $_POST["txtCVV2"];
$txtMM = $_POST["txtMM"];
$txtYY = $_POST["txtYY"];
$txtFirstName = $_SESSION["sessBillingFirstName"];
$txtLastName = $_SESSION["sessBillingLastName"];
$txtAddress = $_SESSION["sessBillingAddress1"];
$txtCity = $_SESSION["sessBillingCity"];
$txtState = $_SESSION["sessBillingState"];
$txtZIP = $_SESSION["sessBillingZIP"];
$txtEmail = $_SESSION["sessBillingEmail"];
$ddlCountry = $_SESSION["sessBillingCountry"];
$txtPhone = $_SESSION["sessBillingPhone"];
$currency_attributes = displayCurrencyType();
if (isset($_SESSION['couponCode_det'])) {
    $totaltopay = number_format($currency_attributes[1] * getCartTotalcouponCode($userid, $_SESSION['couponCode_det']), 2, ".", "");
} else {
    $totaltopay = number_format($currency_attributes[1] * getCartTotal($userid), 2, ".", "");
}
$hide_shipping_division = hideShipping();
/*-------function call to check whether cart contains digital or gift coupon products so as to hide shipping------*/
$check_shipping_enable = checkShippingEnable();
if ($check_shipping_enable == "Y" && $hide_shipping_division == 1) {
    $shipping_cost = $_SESSION['SHIPPING_TOTAL'];
    $totaltopay = number_format($totaltopay, 2, ".", "");
    $totaltopay = $totaltopay + $shipping_cost;
}
$totaltaxrate = 0;
$shipping_cost = 0;
$totaltaxrate = number_format($_SESSION["TAX_TOTAL"], 2, ".", "");
//shipping cost