<div style="display: none;">
    <div id="remotePaymentContent">
        <div class="popup-header toolbar-header">
            <div class="popup-title"><?php echo $this->lang->line('order_payment') ?></div>
            <div class="popup-close-btn" onclick="zamanEposPopupcloser()"><span class="icon icon-cancel"></span></div>
        </div>
        <input type="hidden" id="remoteOrderGrandTotal">
        <input type="hidden" id="remoteOrderOrderId">
        <input type="hidden" id="remoteOrderSid">
        <form id="remoteOrderPaymentProcessForm">
            <div class="popup-content">
                <div class="tab-group"><div class="tab-item" onclick="zamanOrderDetailPopupController($('#remoteOrderSid').val())">View Order Detail</div></div>
                <div class="tab-group payment-type-list" id="remotePaymentOptionList"></div>
                <div class="pane-payment">
                    <div class="pane-payment-left">
                        <div class="pane-payment-balance">
                            <div class="payment-balance-block"><?php echo $this->lang->line('ref') ?>:<span id="remotePaymentOrderReferenceNumber"></span></div>
                            <div class="payment-balance-block"><?php echo $this->lang->line('total') ?>: <span id="remotePaymentOrderReferenceTotal"></span></div>
                            <div class="payment-balance-block due-block"><span id="remotepaymentStatusText" >Due</span><br/><span id="remotePaymentOrderReferenceTotalDue"></span></div>
                            <div class="payment-balance-block pay-tip">&nbsp;<span id="remotepaymentExtraAsTip" style="display: none;"><?php echo $this->lang->line('pay_as_tip') ?><input type="checkbox" name="paytip" id="remotepaymnetHasTips"></span></div>
                        </div>
                    </div>
                    <div class="pane-payment-middle">
                        <div class="neworder-table-guest collection-phone ccfee">
                            <div class="form-group">
                                <input type="text" name="amount" id="zamanRemotePrimaryPaymentValue" class="form-control" style="height: 32px;" placeholder="<?php echo $this->lang->line('amount') ?>">
                                <input type="hidden" id="zamanRemotePaymentVoucherCode" name="voucher_code" class="form-control" style="height: 32px; width: 63%;" placeholder="<?php echo $this->lang->line('voucher_code') ?>"><span style="background: #0d7da2;padding: 9px 43px;margin-left: 0px;width: 37%;border-radius: 3px; display: none;" id="remoteVoucherActionBtn" onclick="remotePaymentReceiveAmount('4', 'Voucher')"><?php echo $this->lang->line('add') ?></span>
                            </div>
                            <div class="clearfix"></div>
                            <div id="remotePaymentBtnsOnPaymentPage">
                                <div class="tab-group keypad">
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentPrimaryNumKey">1</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentPrimaryNumKey">2</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentPrimaryNumKey">3</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentPrimaryNumKey">10</div>
                                </div>
                                <div class="tab-group keypad">
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentPrimaryNumKey">4</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentPrimaryNumKey">5</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentPrimaryNumKey">6</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentPrimaryNumKey">20</div>

                                </div>
                                <div class="tab-group keypad">
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentPrimaryNumKey">7</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentPrimaryNumKey">8</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentPrimaryNumKey">9</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentPrimaryNumKey">50</div>

                                </div>
                                <div class="tab-group keypad">
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentPrimaryActionKey">DEL</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentPrimaryNumKey">0</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentPrimaryActionKey">CLR</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentPrimaryNumKey">.</div>
                                </div>
                            </div>
                            <div id="remoteVoucherCodeBtnsOnPaymentPage" style="display: none;">
                                <div class="tab-group keypad">
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentVoucherNumKey">1</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentVoucherNumKey">2</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentVoucherNumKey">3</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentVoucherNumKey">10</div>
                                </div>
                                <div class="tab-group keypad">
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentVoucherNumKey">4</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentVoucherNumKey">5</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentVoucherNumKey">6</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentVoucherNumKey">20</div>

                                </div>
                                <div class="tab-group keypad">
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentVoucherNumKey">7</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentVoucherNumKey">8</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentVoucherNumKey">9</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentVoucherNumKey">50</div>

                                </div>
                                <div class="tab-group keypad">
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentVoucherActionKey">DEL</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentVoucherNumKey">0</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentVoucherActionKey">CLR</div>
                                    <div class="tab-item zaman-epos-nav quantity-digit keypad-key remotePaymentVoucherNumKey">.</div>
                                </div>
                            </div>
                            <div class="tab-group keypad">
                                <div class="tab-item zaman-epos-nav quantity-digit keypad-key" onclick="remoteZamanConfirmPaymentAndClose()"><span class="icon icon-credit-card"></span>&nbsp;<?php echo $this->lang->line('confirm_payment') ?></div>
                            </div>
                        </div>
                    </div>
                    <div class="pane-payment-right" id="remoteReceivedPaymentOption"></div>
                </div>
            </div>
        </form>
    </div>
</div>
<style>
    #remotePaymentContent .tab-group.payment-type-list .tab-item {
        padding: 20px 0!important;
        border: 0;
        border-radius: 3px;
        margin: 7px 2px;
        font-size: 25px;
        background-image: linear-gradient(to bottom,#006f8d 0,#2f3030 100%);
    }
</style>
<script type="text/javascript">
    function remoteOrderPaymentProcessor(sid, orderId, grandTotal) {
        console.log(sid, orderId, grandTotal);
        $.colorbox({
            inline: true,
            scrolling: false,
            href: "#remotePaymentContent",
            width: '70%',
            height: '530px',
            maxWidth: "100%",
            open: true,
            closeButton: false,
            transition: 'none',
            overlayClose: false,
            onOpen: function () {
                playBeepSound();
                resetForm('remoteOrderPaymentProcessForm');
                zamanEposCart.clearPayments();
                $('#remoteOrderGrandTotal').val(grandTotal);
                $('#remoteOrderOrderId').val(orderId);
                $('#remoteOrderSid').val(sid);
            },
            onLoad: function () {
                var paymentUserData = zamanEposCart.getUserData();
                zamanEposDb.epos_paymentoption.where({status: '3'}).toArray().then(function (paymentOptions) {
                    var payOptionCounter = 0;
                    var remotePaymentOptionList = '';
                    var remoteReceivedPaymentOption = '';
                    paymentOptions.forEach(function (option) {
                        if (option.title === "Voucher") {
                            payOptionCounter++;
                            if (Number(paymentUserData.group) === 5) {
                                remotePaymentOptionList += '<div class="tab-item zaman-epos-nav" onclick="remotePaymentReceiveAmount(\'' + option.id + '\',\'' + option.title + '\')">' + option.title + '</div>';
                                remoteReceivedPaymentOption += '<div class="tab-group keypad"><div class="tab-item" onclick="remoteDeletePayment(\'' + option.id + '\',\'' + option.title + '\')"><span>' + option.title + '</span>&nbsp;<span class="payment-amount" id="remotePaymentOption-' + option.id + '">' + toCurrency(0) + '</span>&nbsp;<span class="payment-cancel-icon icon icon-cancel-circled"></span></div></div>';
                            }
                        } else {
                            payOptionCounter++;
                            remotePaymentOptionList += '<div class="tab-item zaman-epos-nav" onclick="remotePaymentReceiveAmount(\'' + option.id + '\',\'' + option.title + '\')">' + option.title + '</div>';
                            remoteReceivedPaymentOption += '<div class="tab-group keypad"><div class="tab-item" onclick="remoteDeletePayment(\'' + option.id + '\',\'' + option.title + '\')"><span>' + option.title + '</span>&nbsp;<span class="payment-amount" id="remotePaymentOption-' + option.id + '">' + toCurrency(0) + '</span>&nbsp;<span class="payment-cancel-icon icon icon-cancel-circled"></span></div></div>';
                        }
                    });
                    $('#remotePaymentOptionList').html(remotePaymentOptionList);
                    remoteReceivedPaymentOption += '<div class="tab-group keypad"><div class="tab-item waiting-bg"><span>Total Received</span>&nbsp;<span class="payment-amount" id="remotePaymentTotalReceived">' + toCurrency(0) + '</span><span class="payment-cancel-icon"></span></div></div>';
                    $('#remoteReceivedPaymentOption').html(remoteReceivedPaymentOption);
                    if (payOptionCounter === 4) {
                        $('.pane-payment .pane-payment-right .tab-item').css({'padding': '21px 0px'});
                    }
                    if (payOptionCounter === 3) {
                        $('.pane-payment .pane-payment-right .tab-item').css({'padding': '30px 0px'});
                    }
                }).then(function () {
                    $('#remotePaymentOrderReferenceNumber').text(orderId + '/' + sid);
                    $('#remotePaymentOrderReferenceTotal').text(toCurrency(grandTotal));
                    $('#remotePaymentOrderReferenceTotalDue').text(toCurrency(grandTotal));
                });
            },
            onClosed: function () {
                zamanEposCart.clearPayments();
            }
        });
    }
    function remotePaymentReceiveAmount(paymentTypeId, paymentType) {
        var orderTotal = Number($('#remoteOrderGrandTotal').val());
        var receivedAmount = 0;
        var TotalPayments = remoteTotalAmountReceived();
        var textBoxPaymentAmount = Number($('#zamanRemotePrimaryPaymentValue').val());
        if (Number(textBoxPaymentAmount) > 0) {
            receivedAmount = Number(textBoxPaymentAmount);
        } else {
            receivedAmount = TotalPayments > 0 ? orderTotal - TotalPayments : orderTotal;
        }
        var due = orderTotal - TotalPayments;
        if (due <= 0) {
            warning('<?php echo $this->lang->line('warning') ?>', '<?php echo $this->lang->line('nothing_to_pay_more') ?>', '<?php echo $this->lang->line('close') ?>');
        } else {
            if (paymentType.toLowerCase() === 'voucher') {
                var voucherCode = Number($('#zamanRemotePaymentVoucherCode').val());
                var existingVoucherAmount = 0;
                if (voucherCode > 0 && receivedAmount > 0) {
                    zamanEposDb.epos_voucher.get({code: voucherCode.toString(), status: '3'}).then(function (theVoucher) {
                        if (typeof (theVoucher) !== 'undefined') {
                            var validityStartDate = new Date(theVoucher.start);
                            var startY = validityStartDate.getFullYear();
                            var startM = validityStartDate.getMonth();
                            var startD = validityStartDate.getDate();
                            var validityEndDate = new Date(theVoucher.end);
                            var endY = validityEndDate.getFullYear();
                            var endM = validityEndDate.getMonth();
                            var endD = validityEndDate.getDate();
                            var todayDate = new Date();
                            var todayY = todayDate.getFullYear();
                            var todayM = todayDate.getMonth();
                            var todayD = todayDate.getDate();
                            if ((todayY >= startY && todayY <= endY) && (todayM >= startM && todayM <= endM) && (todayD >= startD && todayD <= endD)) {
                                var payments = zamanEposCart.listpayments();
                                if (payments.length > 0) {
                                    payments.forEach(function (method) {
                                        if (method.type === 'Voucher') {
                                            existingVoucherAmount += Number(method.amount);
                                        }
                                    });
                                }
                                if (Number(theVoucher.balance) > 0) {
                                    var remainingBalance = Number(theVoucher.balance) - Number(existingVoucherAmount);
                                    if (remainingBalance > 0) {
                                        if (receivedAmount > remainingBalance) {
                                            receivedAmount = remainingBalance;
                                        }
                                        remoteAddPaymentFromPaymentPage(paymentTypeId, paymentType, receivedAmount, theVoucher.code);
                                    } else {
                                        warning('<?php echo $this->lang->line('warning') ?>', '<?php echo $this->lang->line('voucher_balance_insufficient') ?>', '<?php echo $this->lang->line('close') ?>');
                                    }
                                } else {
                                    warning('<?php echo $this->lang->line('warning') ?>', '<?php echo $this->lang->line('voucher_balance_insufficient') ?>', '<?php echo $this->lang->line('close') ?>');
                                }
                            } else {
                                warning('<?php echo $this->lang->line('warning') ?>', '<?php echo $this->lang->line('invalid_voucher_code') ?>', '<?php echo $this->lang->line('close') ?>');
                            }
                        } else {
                            warning('<?php echo $this->lang->line('warning') ?>', '<?php echo $this->lang->line('invalid_voucher_code') ?>', '<?php echo $this->lang->line('close') ?>');
                        }
                    });
                } else {
                    $('#remotePaymentBtnsOnPaymentPage').hide();
                    $('#remoteVoucherCodeBtnsOnPaymentPage').show();
                    $('#remoteVoucherActionBtn').show();
                    $('#zamanRemotePaymentVoucherCode').attr('type', 'text');
                    $('#zamanRemotePrimaryPaymentValue').attr('type', 'hidden');
                    playBeepSound();
                }
            } else {
                remoteAddPaymentFromPaymentPage(paymentTypeId, paymentType, receivedAmount, 'no');
            }
        }
    }
    function remoteAddPaymentFromPaymentPage(paymentTypeId, paymentType, receivedAmount, code) {
        zamanEposCart.addPayment(paymentTypeId, paymentType, receivedAmount, code);
        remoteDisplayPaymentOption();
        playBeepSound();
        $('#zamanRemotePaymentVoucherCode').val('');
        $('#zamanRemotePrimaryPaymentValue').val('');
    }
    function remoteDeletePayment(id, title) {
        var deletedId = zamanEposCart.deletePayment(id, title);
        if (deletedId !== null) {
            $('#remotePaymentOption-' + deletedId).text(toCurrency(0));
        }
        remoteDisplayPaymentOption();
        playBeepSound();
    }
    function remoteDisplayPaymentOption() {
        var orderTotal = Number($('#remoteOrderGrandTotal').val());
        var payments = zamanEposCart.listpayments();
        var TotalPayments = remoteTotalAmountReceived();
        if (payments.length > 0) {
            payments.forEach(function (method) {
                $('#remotePaymentOption-' + method.id).text(toCurrency(method.amount));
            });
        }
        $('#remotePaymentTotalReceived').text(toCurrency(TotalPayments));
        var due = toCurrencyNoMoney(orderTotal - TotalPayments);
        if (due < 0) {
            $('#remotepaymentStatusText').text('<?php echo $this->lang->line('pay_back') ?>');
            $('#remotepaymentExtraAsTip').show();
        } else {
            $('#remotepaymentStatusText').text('<?php echo $this->lang->line('due') ?>');
            $('#remotepaymentExtraAsTip').hide();
        }
        $('#remotePaymentOrderReferenceTotalDue').text(toCurrency(Math.abs(due)));
        $('#remotePaymentBtnsOnPaymentPage').show();
        $('#remoteVoucherCodeBtnsOnPaymentPage').hide();
        $('#remoteVoucherActionBtn').hide();
        $('#zamanRemotePaymentVoucherCode').attr('type', 'hidden');
        $('#zamanRemotePrimaryPaymentValue').attr('type', 'text');
    }
    function remoteTotalAmountReceived() {
        var payments = zamanEposCart.listpayments();
        var TotalPayments = 0;
        if (payments.length > 0) {
            payments.forEach(function (method) {
                $('#remotePaymentOption-' + method.id).text(toCurrency(method.amount));
                TotalPayments += method.amount;
            });
        }
        return toCurrencyNoMoney(TotalPayments);
    }

    function remoteZamanConfirmPaymentAndClose() {
        var payments = zamanEposCart.listpayments();
        localStorage.setItem("RemotOrdderPayments", JSON.stringify(payments));
        var orderId = $('#remoteOrderOrderId').val();
        var sid = $('#remoteOrderSid').val();
        var orderTotal = Number($('#remoteOrderGrandTotal').val());
        var due = toCurrencyNoMoney(orderTotal - remoteTotalAmountReceived());
        if (due > 0) {
            warning('<?php echo $this->lang->line('warning') ?>', '<?php echo $this->lang->line('payment_yet_not_covered') ?>', '<?php echo $this->lang->line('ok') ?>');
        } else {
            remotePaymentDeductFromVoucherOnPayAndClose();
            $.confirm({
                title: '<?php echo $this->lang->line('print_bill_copy') ?>',
                message: '<?php echo $this->lang->line('bill_copy_prompt') ?>',
                buttons: {
                    '<span class="icon icon-check">&nbsp;<?php echo $this->lang->line('yes') ?></span>': {
                        'class': 'green',
                        'action': function () {
                            var online = false;
                            var amount = 0;
                            payments.forEach(function (method) {
                                if (method.type === 'Online') {
                                    online = true;
                                    amount = toCurrencyNoMoney(method.amount);
                                }
                            });
                            if (online) {
                                zamanEposNavigator('verified', '<?php echo site_url('epos/paymentOnline/') ?>' + orderId + '/' + sid + '/5/' + amount + '/3/yes');
                                warning('<?php echo $this->lang->line('redirecting') ?>', '<?php echo $this->lang->line('redirecting_msg') ?>', '<?php echo $this->lang->line('close') ?>');
                            } else {
                                remoteAppOrderPayAndClose(orderId, sid, 3, []);
                            }

                        }
                    },
                    '<span class="icon icon-book">&nbsp;<?php echo $this->lang->line('no') ?></span>': {
                        'class': 'black',
                        'action': function () {
                            var online = false;
                            var amount = 0;
                            payments.forEach(function (method) {
                                if (method.type === 'Online') {
                                    online = true;
                                    amount = toCurrencyNoMoney(method.amount);
                                }
                            });
                            if (online) {
                                zamanEposNavigator('verified', '<?php echo site_url('epos/paymentOnline/') ?>' + orderId + '/' + sid + '/5/' + amount + '/2/yes');
                                warning('<?php echo $this->lang->line('redirecting') ?>', '<?php echo $this->lang->line('redirecting_msg') ?>', '<?php echo $this->lang->line('close') ?>');
                            } else {
                                remoteAppOrderPayAndClose(orderId, sid, 2, []);
                            }
                        }
                    },
                    '<span class="icon icon-cancel">&nbsp;<?php echo $this->lang->line('cancel') ?></span>': {
                        'class': 'red',
                        'action': function () {
                            $.confirm.hide();
                        }
                    }
                }
            });
        }
    }
    function remotePaymentDeductFromVoucherOnPayAndClose() {
        var payments = zamanEposCart.listpayments();
        if (payments.length > 0) {
            payments.forEach(function (method) {
                if (method.type === 'Voucher') {
                    var amountToDeduct = method.amount;
                    var fromCode = method.code;
                    var remainingBalance = 0;
                    zamanEposDb.epos_voucher.get({code: fromCode}).then(function (theVoucher) {
                        remainingBalance = Number(theVoucher.balance);
                    }).then(function () {
                        zamanEposDb.epos_voucher.where("code").equals(fromCode).modify({
                            balance: remainingBalance - amountToDeduct
                        });
                    });
                }
            });
        }
    }

    function remoteAppOrderPayAndClose(orderId, sid, bill, onlinePaymentDetails) {
        var paymentList = JSON.parse(localStorage.getItem("RemotOrdderPayments"));
        var orderTotal = Number($('#remoteOrderGrandTotal').val());
        var due = toCurrencyNoMoney(orderTotal - remoteTotalAmountReceived());
        $.ajax({
            url: '<?php echo site_url('api/remoteOrderPayAndClose') ?>',
            type: 'POST',
            dataType: 'json',
            data: {
                payment: zamanEposCart.listpayments().length > 0 ? zamanEposCart.listpayments() : paymentList,
                onlinePaymentDetails: onlinePaymentDetails,
                sid: sid,
                orderId: orderId,
                hasBillPrint: bill,
                changeAmount: Number(toCurrencyNoMoney(due)),
                changeAsTips: $('#remotepaymnetHasTips').is(":checked") ? 3 : 2
            },
            beforeSend: function (xhr) {
                $('.page-loader').show();
            },
            success: function (response) {
                $('.page-loader').hide();
                zamanEposCart.clearPayments();
                localStorage.removeItem('RemotOrdderPayments');
                resetForm('remoteOrderPaymentProcessForm');
                zamanEposPopupcloser();
                if (response.status) {
                    listAppOrder();
                }
            }
        });
    }
</script>
<div style="display: none;">
    <div id="orderDetailContent">
        <div class="popup-header toolbar-header">
            <div class="popup-title"><?php echo $this->lang->line('order_info') ?></div>
            <div class="popup-close-btn" onclick="zamanEposPopupcloser()"><span class="icon icon-cancel"></span></div>
        </div>
        <div class="popup-content">
            <div class="pane" id="orderDetailHtml"></div>
        </div>
        <div class="tab-group">
            <div class="tab-item" style="padding: 15px;" onclick="zamanEposRemoteOrderPayNow()"><i class="icon icon-cc"></i>&nbsp;Pay Now</div>
        </div>
        <input type="hidden" id="detailedOrderId">
    </div>
</div>
<script type="text/javascript">
    function zamanOrderDetailPopupController(orderId) {
        $.colorbox({
            inline: true,
            scrolling: false,
            href: "#orderDetailContent",
            width: '40%',
            height: 'auto',
            maxWidth: "80%",
            open: true,
            closeButton: false,
            transition: 'elastic',
            overlayClose: false,
            onOpen: function () {
                $('#orderDetailContent .popup-content').css({'min-height': '50vh', 'max-height': '50vh', 'overflow-y': 'auto'});
                $('#orderDetailHtml').html('');
                $('#detailedOrderId').val('');
            },
            onLoad: function () {
                $('#detailedOrderId').val(orderId);
            },
            onComplete: function () {
                $.ajax({
                    url: '<?php echo site_url('epos/getAppOrderDetail/') ?>' + orderId,
                    type: 'GET',
                    success: function (html) {
                        $('#orderDetailHtml').html(html);
                        $('#orderDetailContent .popup-content').css({'min-height': '50vh', 'max-height': '50vh', 'overflow-y': 'auto'});
                        $('#colorbox').colorbox.resize();
                    }
                });
            },
            onClosed: function () {
                $('#orderDetailHtml').html('');
                $('#detailedOrderId').val('');
            }
        });
    }
    function zamanEposRemoteOrderPayNow() {
        var sid = $('#remoteOrderDetailSidForSolo').val();
        var orderId = $('#remoteOrderDetailIdForSolo').val();
        var grandTotal = $('#remoteOrderDetailGrandTotalForSolo').val();
        remoteOrderPaymentProcessor(sid, orderId, grandTotal);
        $('#orderDetailHtml').html('');
    }
</script>