function order_meta_box_AmazonFBA()
{
    $id = $_GET['post'];
    $FBAOrderId = get_post_meta($id, 'FBA_OrderId', true);
    ?>
    <ul class="order_actions">
          <?php 
    if (empty($FBAOrderId) || !isset($FBAOrderId)) {
        ?>
              <li class="wide">
                Order not sent to Amazon.
                <button type="button" id="FulfilAmzOrder" class="button button-primary save_order" name="Fulfil" value="<?php 
        echo $id;
        ?>
">Fulfil</button>
                <div id="FulAmzOrder_Result" style="display:hidden;"></div>
              </li>
              <?php 
    } else {
        ?>
              <li class="wide">
                Order sent to Amazon<br>
                <i>Ref:<?php 
        echo $FBAOrderId;
        ?>
</i><br>
                <i>Please clear/delete FBA_OrderId Meta to resubmit</i>
              <?php 
    }
    ?>
    </ul>
    <?php 
    AmzFBA_fulfilorder_js();
}
function order_meta_box_AmazonFBA()
{
    $id = $_GET['post'];
    $FBAOrderId = get_post_meta($id, 'FBA_OrderId', true);
    $FBAOrderStatus = get_post_meta($id, 'FBA_Status', "FALSE");
    ?>
    <ul class="order_actions">
          <?php 
    if ($FBAOrderStatus == "Cancelling") {
        ?>
              <li class="wide">
                Amazon has been asked to cancel the shipment <br><br>Wait 5 mins and refresh this page to see if cancellation went through.
              </li>
              <?php 
    } else {
        if (($FBAOrderStatus == "Cancelled" || $FBAOrderStatus == "Invalid") && (!empty($FBAOrderId) && isset($FBAOrderId))) {
            ?>
              <li class="wide">
                FBA (fulfillment) has been cancelled.<br><i>Please clear/delete FBA_OrderId Meta to resubmit</i>
              </li>
              <?php 
        } else {
            if (empty($FBAOrderId) || !isset($FBAOrderId)) {
                ?>
              <li class="wide">
                Order not sent to Amazon.
                <button type="button" id="FulfilAmzOrder" class="button button-primary save_order" name="Fulfil" value="<?php 
                echo $id;
                ?>
">Fulfil</button>
                <div id="FulAmzOrder_Result" style="display:hidden;"></div>
              </li>
              <?php 
            } else {
                if ($FBAOrderStatus != "COMPLETE" && $FBAOrderStatus != "Partially Complete") {
                    ?>
              <li class="wide">
                Order sent to Amazon<br>
                <i>Ref:<?php 
                    echo $FBAOrderId;
                    ?>
</i>
                <button type="button" id="CancelOrderBtnId" class="button button-primary cancel_order" name="CancelFBA" value="<?php 
                    echo $id;
                    ?>
">Cancel FBA</button>
                <div id="CancelFBA_Result" style="display:hidden;"></div>
            <br>
              </li>
              <?php 
                } else {
                    ?>
              <li class="wide">
                Amazon has shipped the order. Tracking info is below in order meta data.<br>
              </li>
              <?php 
                }
            }
        }
    }
    ?>
    </ul>
    <?php 
    AmzFBA_fulfilorder_js();
}