String.prototype.format = function (args) {
    var str = this;
    return str.replace(String.prototype.format.regex, function (item) {
        var intVal = parseInt(item.substring(1, item.length - 1));
        var replace;
        if (intVal >= 0) {
            replace = args[intVal];
        } else if (intVal === -1) {
            replace = "{";
        } else if (intVal === -2) {
            replace = "}";
        } else {
            replace = "";
        }
        return replace;
    });
};
String.prototype.format.regex = new RegExp("{-?[0-9]+}", "g");
function DoTest() {
    var inputData = "{ 'input': '{0}'}";
    inputData = inputData.format(["Bijay"]);
    //$.blockUI({ message: '<img src=\"images/Waiting_1.gif\" align=\"middle\" /> Please wait, we are processing your request...' });
    $.ajax({
        url: 'https://localhost:12030/service/GetDatas',
        data: '=' + 'Bijay',
        //data: JSON.stringify(inputData),
        //contentType: "application/json;charset=utf-8",
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            //$(document).ajaxStop($.unblockUI);
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            //$(document).ajaxStop($.unblockUI);
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function DoScan() {
    //$.blockUI({ message: '<img src=\"images/Waiting_1.gif\" align=\"middle\" /> Please wait, we are processing your request...' });
    $.ajax({
        url: 'https://localhost:12030/service/GetScanQrCodeData',
        dataType: 'text',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            //$(document).ajaxStop($.unblockUI);
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            //$(document).ajaxStop($.unblockUI);
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function DoIFISFPCapture() {
    $.ajax({
        url: 'https://localhost:12030/service/CaptureFingerPrintIFIS',
        dataType: 'json',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function CheckIfPinpadConnected() {
    //$.blockUI({ message: '<img src=\"images/Waiting_1.gif\" align=\"middle\" /> Please wait, we are processing your request...' });
    $.ajax({
        url: 'https://localhost:12030/service/IsPinpadDeviceConnected',
        dataType: 'text',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            //$(document).ajaxStop($.unblockUI);
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            //$(document).ajaxStop($.unblockUI);
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
/*function DoSwipeCard() {
    //$.blockUI({ message: '<img src=\"images/Waiting_1.gif\" align=\"middle\" /> Please wait, we are processing your request...' });
    $.ajax({
        url: 'https://localhost:12030/service/GetSwipeCardData',
        dataType: 'text',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            //$(document).ajaxStop($.unblockUI);
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            //$(document).ajaxStop($.unblockUI);
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}*/
function DoSwipeCard() {
    //$.blockUI({ message: '<img src=\"images/Waiting_1.gif\" align=\"middle\" /> Please wait, we are processing your request...' });
    $.ajax({
        url: 'https://localhost:12030/service/GetSwipeCardData',
        dataType: 'text',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            //$(document).ajaxStop($.unblockUI);
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            //$(document).ajaxStop($.unblockUI);
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function DoSwipeCardEMV() {
    $.ajax({
        url: 'https://localhost:12030/service/GetSwipeCardDataEMV',
        //data: '=' + '200#1',
        data: '=' + '200#90',
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function GetPinBlockData() {
    var obj = { 'swipeDeviceType': '1', 'track2Data': '5443275900000763=25122260018160' };
    $.ajax({
        url: 'https://localhost:12030/service/GetPinBlockData',
        data: JSON.stringify(obj),
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function GetOtpBlockData() {
    var obj = { 'swipeDeviceType': '1', 'track2Data': '6521602789240595=22022264339999999999', 'otpLength': '4' };
    $.ajax({
        url: 'https://localhost:12030/service/GetOtpBlockData',
        data: JSON.stringify(obj),
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function InjectTpkTdk() {
    //var obj = { 'swipeDeviceType': '1', 'tpk': 'DC36C81BCB2495F504FC318F8893DF9CD20BA20F7A699515', 'tdk': '5427664CE10E592DEDDBD67D6123DB03B79244460703877E' };
    var obj = { 'swipeDeviceType': '1', 'tpk': 'A89FA6513D5583E19612E77ADC453BDD', 'tdk': '112915379C43512AAC128CD68833352F' };
    $.ajax({
        url: 'https://localhost:12030/service/InjectTpkTdk',
        data: JSON.stringify(obj),
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function InjectTmk() {
    var obj = { 'swipeDeviceType': '1', 'tmk': '4B1F587A3E5033918F6C72F23BD7F9E5' };
    //var obj = { 'swipeDeviceType': '1', 'tmk': '72650B39A7BE6347C7BFBDCDB7D63AACFFCE51C83DDDC933' };
    $.ajax({
        url: 'https://localhost:12030/service/InjectTmk',
        data: JSON.stringify(obj),
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function InjectDtmk() {
    var obj = { 'swipeDeviceType': '1', 'tmk': '4BC3AC63AA7171F5B809035071F67E09' };
    //var obj = { 'swipeDeviceType': '1', 'tmk': '26A29DDDE015991C7F097C6FD22F8FA0A228BB130AD22E24CD066DBCF0A8B102' };
    $.ajax({
        url: 'https://localhost:12030/service/InjectDtmk',
        data: JSON.stringify(obj),
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function OpenPassbookPrinter() {
    $.ajax({
        url: 'https://localhost:12030/service/OpenPassbookPrinter',
        dataType: 'text',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function EjectPassBook() {
    $.ajax({
        url: 'https://localhost:12030/service/EjectPassBook',
        dataType: 'text',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function CheckPaperStatus() {
    $.ajax({
        url: 'https://localhost:12030/service/CheckPaperStatus',
        dataType: 'text',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function PrintPassbook() {
    //var obj = { 'printData': '  02-03-2019    538996    ASCO MOTORS /AS                                 2356.00                             7760.00    ', 'font': 10, 'cpi': 11, 'lpi': 11, 'linesPrinted': 12 };
    //var obj = { 'printData': '  20170719              SMS CHRG FOR:01-04-2017to30-06-2017               17.70                        386.51_  20170723              QAB Charges from 01-04-2017 to 30-06-2017        141.60                        244.91_  20170816              IOC Ref No3000053270                                           45.65           290.56_  20171107              TRTR/OFADPAY/803113005330/FIC                                 588.00           878.56_  20171107              TRTR/OFADPAY/803113005334/FIC                                 250.00          1128.56_  20171107              TRTR/OFADPAY/803113005336/FIC                                 583.00          1711.56_  20171107              TRTR/OFADPAY/803214005398/FIC                                 200.00          1911.56_  20171107              TRTR/OFADPAY/803214005399/FIC                                 205.00          2116.56_  20180702              TRTR/842011000044/12-11-2019 11:28:10/FIK                      10.00          2126.56_  20180702              TRTR/842011000045/12-11-2019 11:28:10/FIK                      10.00          2136.56_', 'font': 10, 'cpi': 12, 'lpi': 11, 'linesPrinted': 21, 'secondPageheaderSpaceReqd': '0', 'isPageBreakAtThirty': '1', 'maxLinesPassbookCanPrint': 34, 'firstPageVerticalStartIndex': 7 };
    //var obj = { "printData": "  19-07-2017  SMS CHRG FOR:01-04-2017to30-06-2017                          17.70                          386.51\n  -2-06- 30-      D       141.60       244.9120170816     017      Ref No3000053                   270          \n  10-71-6201   TRTR/OFADPAY/803113005330/FIC              7        C       588.0                   0       878.5\n    -  -           C       250.00      1128.5620171107             R/OFADPAY/803                   113005336/FIC\n  11-17-5620    TRTR/OFADPAY/803214005398/FIC             07        C       200.                   00      1911.\n    -  -C           C       205.00      2116.5620180702            TR/8420110000                   44/12-11-2019\n  80-01-.562     TRTR/842011000045/12-11-2019 11:28:10/F  702        C        10                   .00      2136\n  19-07-2017  SMS CHRG FOR:01-04-2017to30-06-2017                          17.70                          386.51\n  19-07-2017  SMS CHRG FOR:01-04-2017to30-06-2017                          17.70                          386.51\n  19-07-2017  SMS CHRG FOR:01-04-2017to30-06-2017                          17.70                          386.51\n  19-07-2017  SMS CHRG FOR:01-04-2017to30-06-2017                          17.70                          386.51\n  19-07-2017  SMS CHRG FOR:01-04-2017to30-06-2017                          17.70                          386.51\n  19-07-2017  SMS CHRG FOR:01-04-2017to30-06-2017                          17.70                          386.51\n  19-07-2017  SMS CHRG FOR:01-04-2017to30-06-2017                          17.70                          386.51\n  19-07-2017  SMS CHRG FOR:01-04-2017to30-06-2017                          17.70                          386.51\n", "font": 8, "cpi": 15, "lpi": 15, "linesPrinted": 2, "secondPageheaderSpaceReqd": "1", "isPageBreakAtThirty": "0", "maxLinesPassbookCanPrint": "34", "firstPageVerticalStartIndex": 9 };
    var obj = {
        "cpi": 11, "firstPageVerticalStartIndex": 7, "font": 10, "isPageBreakAtThirty": "0", "linesPrinted": 1, "lpi": 11, "maxLinesPassbookCanPrint": "36", "secondPageheaderSpaceReqd": "1", "bank": "IDBI", "printData": "     04-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     05-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     06-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     07-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     08-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     09-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     10-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     11-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     12-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     13-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     14-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     15-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     16-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     17-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     18-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     19-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     20-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     21-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     22-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     23-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     24-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     25-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     26-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     27-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     28-02-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     01-03-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     02-03-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     03-03-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     04-03-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     05-03-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     06-03-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     07-03-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     08-03-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     09-03-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     10-03-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n     11-03-2026  RAMOSANA :- CASH RECEIPT                          10000.00                   298269.00\n"
    }
    $.ajax({
        url: 'https://localhost:12030/service/PrintPassbook',
        data: JSON.stringify(obj),
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
//===============================================
function DoSetData() {
    var obj = { 'Key': 'Bijay\\30.txt', 'Value': 'This is a test sample. bijay 1' };
    $.ajax({
        url: 'https://localhost:12030/service/SetData',
        data: JSON.stringify(obj),
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function StoreElog() {
    var obj = { 'Dir': 'eLog', 'FileName': 'test.txt', 'FileData': 'This is a test sample. bijay 1' };
    $.ajax({
        url: 'https://localhost:12030/service/eLog',
        data: JSON.stringify(obj),
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function DeleteElog() {
    var obj = { 'Dir': 'eLog', 'FileName': 'test.txt', 'FileData': '' };
    $.ajax({
        url: 'https://localhost:12030/service/DeleteElog',
        data: JSON.stringify(obj),
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function DoGetData() {
    $.ajax({
        url: 'https://localhost:12030/service/GetData',
        data: '=' + '30',
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function DoDeleteKeys() {
    $.ajax({
        url: 'https://localhost:12030/service/DeleteKeys',
        data: '=' + '1|30',
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function GetUniqueDeviceID() {
    $.ajax({
        url: 'https://localhost:12030/service/GetUniqueDeviceID',
        //url: 'http://localhost:8100/service/GetUniqueDeviceID',
        dataType: 'text',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function GetAppVersion() {
    $.ajax({
        url: 'https://localhost:12030/service/GetAppVersion',
        dataType: 'text',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function StoreEncrGUID() {
    $.ajax({
        url: 'https://localhost:12030/service/StoreFIStackID',
        data: '=' + '1111000011110000',
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function GetGUID() {
    $.ajax({
        url: 'https://localhost:12030/service/GetFIStackID',
        //url: 'http://localhost:8100/service/GetUniqueDeviceID',
        dataType: 'text',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
/*function printPBData()
{
    var data = '20170719        SMS CHRG FOR:01-04-2017to30-06-2017               D        17.70       386.5120170723        QAB Charges from 01-04-2017 to 30-06-2017         D       141.60       244.9120170816        IOC Ref No3000053270                              C        45.65       290.5620171107        TRTR/OFADPAY/803113005330/FIC                     C       588.00       878.5620171107        TRTR/OFADPAY/803113005334/FIC                     C       250.00      1128.5620171107        TRTR/OFADPAY/803113005336/FIC                     C       583.00      1711.5620171107        TRTR/OFADPAY/803214005398/FIC                     C       200.00      1911.5620171107        TRTR/OFADPAY/803214005399/FIC                     C       205.00      2116.5620180702        TRTR/842011000044/12-11-2019 11:28:10/FIK         C        10.00      2126.5620180702        TRTR/842011000045/12-11-2019 11:28:10/FIK         C        10.00      2136.56';

    var printData = [];
	var objJSON = {};
    var startIndex = 0;
    var endIndex = 0;
    var counter = 93;
    for (var i = 0; i < (data.length)/93; i++) {
		objJSON.date = data.substring(startIndex + 0, endIndex + 8);
        objJSON.cheque = data.substring(startIndex + 8, endIndex + 16);
        objJSON.desc = data.substring(startIndex + 16, endIndex + 66);
        objJSON.type = data.substring(startIndex + 66, endIndex + 67);
        objJSON.amnt = data.substring(startIndex + 67, endIndex + 80);
        objJSON.balance = data.substring(startIndex + 80, endIndex + 93);
		printData[i] = objJSON;

		startIndex = startIndex + counter;
        endIndex = endIndex + counter;
    }
	for
    console.log(JSON.stringify(printData));
    alert(JSON.stringify(printData));
}*/
function printPBData() {
    var data = '20170719        SMS CHRG FOR:01-04-2017to30-06-2017               D        17.70       386.5120170723        QAB Charges from 01-04-2017 to 30-06-2017         D       141.60       244.9120170816        IOC Ref No3000053270                              C        45.65       290.5620171107        TRTR/OFADPAY/803113005330/FIC                     C       588.00       878.5620171107        TRTR/OFADPAY/803113005334/FIC                     C       250.00      1128.5620171107        TRTR/OFADPAY/803113005336/FIC                     C       583.00      1711.5620171107        TRTR/OFADPAY/803214005398/FIC                     C       200.00      1911.5620171107        TRTR/OFADPAY/803214005399/FIC                     C       205.00      2116.5620180702        TRTR/842011000044/12-11-2019 11:28:10/FIK         C        10.00      2126.5620180702        TRTR/842011000045/12-11-2019 11:28:10/FIK         C        10.00      2136.56';

    var printData = [];
    var objJSON = {};
    var startIndex = 0;
    var endIndex = 0;
    var counter = 93;
    for (var i = 0; i < (data.length) / 93; i++) {
        objJSON.date = data.substring(startIndex + 0, endIndex + 8);
        objJSON.cheque = data.substring(startIndex + 8, endIndex + 16);
        objJSON.desc = data.substring(startIndex + 16, endIndex + 57);
        objJSON.type = data.substring(startIndex + 66, endIndex + 67);
        objJSON.amnt = data.substring(startIndex + 67, endIndex + 80);
        objJSON.balance = data.substring(startIndex + 80, endIndex + 93);
        printData[i] = objJSON;
        objJSON = {};
        startIndex = startIndex + counter;
        endIndex = endIndex + counter;
    }
    var output;
    for (var i = 0; i < printData.length; i++) {
        if (printData[i].type == "C") {
            if (output == null) {
                output = '  ' + printData[i].date + '     ' + printData[i].cheque + ' ' + printData[i].desc + '              ' + printData[i].amnt + '    ' + printData[i].balance + '_';
            }
            else {
                output = output + '  ' + printData[i].date + '     ' + printData[i].cheque + ' ' + printData[i].desc + '              ' + printData[i].amnt + '    ' + printData[i].balance + '_';
            }
        }
        else {
            if (output == null) {
                output = '  ' + printData[i].date + '     ' + printData[i].cheque + ' ' + printData[i].desc + ' ' + printData[i].amnt + '                 ' + printData[i].balance + '_';
            }
            else {
                output = output + '  ' + printData[i].date + '     ' + printData[i].cheque + ' ' + printData[i].desc + ' ' + printData[i].amnt + '                 ' + printData[i].balance + '_';
            }
        }
    }
    //console.log(JSON.stringify(printData));
    //alert(JSON.stringify(printData));
    alert(output);
}
var comPort;
function GetPOSPrinterComPortByDevice() {
    $.ajax({
        url: 'https://localhost:12030/service/GetPOSPrinterComPortByDevice',
        data: '=' + '2',
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
                comPort = data;
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function PrintImageInDapperprinter() {
    $.ajax({
        url: 'https://localhost:12030/service/PrintImageInDapperprinter',
        data: '=' + '2',
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function PrintInputImageInPOSPrinter() {
    var obj = { 'textToPrint': ' ', 'comPort': ' comPort', 'printerDeviceType': '2' };
    $.ajax({
        url: 'https://localhost:12030/service/PrintInputImageInPOSPrinter',
        data: JSON.stringify(obj),
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function getDateTime_ddMMYYY() {
    var date = new Date();
    var curr_date = date.getDate();
    var curr_month = date.getMonth() + 1; //Months are zero based
    if (curr_date < 10) { curr_date = '0' + curr_date } if (curr_month < 10) { curr_month = '0' + curr_month }
    var curr_year = date.getFullYear();
    return curr_date + '-' + curr_month + '-' + curr_year;
}
function getDateTime_HHMMSS() {
    var date = new Date();
    var curr_hour = date.getHours();
    var curr_min = date.getMinutes();
    var curr_sec = date.getSeconds();
    if (curr_hour < 10) { curr_hour = '0' + curr_hour } if (curr_min < 10) { curr_min = '0' + curr_min } if (curr_sec < 10) { curr_sec = '0' + curr_sec }
    return curr_hour + ':' + curr_min + ':' + curr_sec;
}
//printerDeviceType = 1 - Dapper Printer
//printerDeviceType = 2 - VRIDDHI Printer
//printerDeviceType = 3 - Evolute Falcon Printer
//printerDeviceType = 4 - Squirrel printer (without RD Service)
//printerDeviceType = 5 - Everycom printer
function PrintLogoAndReceiptInPOSPrinter() {
    var getDate = getDateTime_ddMMYYY();
    var getDateTime = getDateTime_HHMMSS();
    var obj = { 'textToPrint': '        Deposit Receipt                                         Date:' + getDate + '    Time:' + getDateTime + 'Name: Venkatesh Murthy          TerminalID: 89012389423         Cust. Ac No.: 120020120212000145Cust. Name: Abhishek Chatterjee STAN: 129032                    RRN: 904845654629               Auth Code: 0924394034           Transaction Status: Success(00) Transaction Amount: Rs.200      Account Balance: Rs. 35200      --------------------------------\n', 'comPort': ' comPort', 'printerDeviceType': '5' };
    //var obj = { 'textToPrint': '123456789012345678901234567890Deposit ReceiptDeposit ReceiptDeposit ReceiptDeposit ReceiptDeposit Receipt--------------------------------\n', 'comPort': ' comPort', 'printerDeviceType': '5' };
    $.ajax({
        url: 'https://localhost:12030/service/PrintLogoAndReceiptInPOSPrinter',
        data: JSON.stringify(obj),
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function CompleteEMVTransaction() {
    var obj = { 'swipeDeviceType': '1', 'otherParams': '390100910A16BBB72F0A1CB1710014' };
    $.ajax({
        url: 'https://localhost:12030/service/CompleteEMVTransaction',
        data: JSON.stringify(obj),
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function GetPendingDataToPost() {
    $.ajax({
        url: 'https://localhost:12030/service/GetPendingDataToPost',
        dataType: 'json',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function GetOtpEncriptedData() {
    $.ajax({
        url: 'https://localhost:12030/service/GetOtpEncrData',
        data: '=' + '123456',
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
//Using SpeechSynthesizer

function Speak_1() {
    var obj = { 'textToSpeak': 'You are about to perform a withdrawal of rupees 2450', 'volume': 100, 'rate': 0 };
    $.ajax({
        url: 'https://localhost:12030/service/Speak',
        data: JSON.stringify(obj),
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
// Initializes a new instance of the StringBuilder class
// and appends the given value if supplied
function StringBuilder(value) {
    this.strings = new Array("");
    this.append(value);
}
// Appends the given value to the end of this instance.
StringBuilder.prototype.append = function (value) {
    if (value) {
        this.strings.push(value);
    }
}
// Clears the string buffer
StringBuilder.prototype.clear = function () {
    this.strings.length = 1;
}
// Converts this instance to a String.
StringBuilder.prototype.toString = function () {
    return this.strings.join("");
}
//Using local wav/mp3 files
//Response = 5,  Success
//Response = 2,  Unable to unmute audio
//Response = 4,  Unable to raise the volume to 100
//Response = 6,  Unable to play the audio

/*function Speak_2() {
    var dataToSpeak;
    var amt = '2431.10';
    var amtSplit = amt.split('.');
    dataToSpeak = new StringBuilder();
	dataToSpeak.append("AEPS.wav|WITHDRAW_AMT.WAV|");
    //dataToSpeak.append("AEPS.wav|WITHDRAW_AMT.WAV|3.WAV|SPACE.WAV|3.WAV|SPACE.WAV|3.WAV|SPACE.WAV|3.WAV|");
	//dataToSpeak.append("AEPS.wav|WITHDRAW_AMT.WAV|3.WAV|3.WAV|3.WAV|3.WAV|");
    if (amtSplit[0].length == 4) {
        dataToSpeak.append(amtSplit[0].charAt(0)); dataToSpeak.append('.wav'); dataToSpeak.append('|'); dataToSpeak.append('THOUSAND.wav'); dataToSpeak.append('|');
        dataToSpeak.append(amtSplit[0].charAt(1)); dataToSpeak.append('.wav'); dataToSpeak.append('|'); dataToSpeak.append('HUNDRED.wav'); dataToSpeak.append('|');
        dataToSpeak.append(amtSplit[0].charAt(2)); dataToSpeak.append(amtSplit[0].charAt(3)); dataToSpeak.append('.wav'); dataToSpeak.append('|'); dataToSpeak.append('RUPEES.wav');
    }
    if (amtSplit.length == 2) {
        dataToSpeak.append('|'); dataToSpeak.append(amtSplit[1].charAt(0)); dataToSpeak.append(amtSplit[1].charAt(1)); dataToSpeak.append('.wav'); dataToSpeak.append('|');
        dataToSpeak.append('PAISA.wav|PROCEED_AUTH.WAV|');
    }
    console.log(dataToSpeak.toString());
    var obj = { 'textToSpeak': dataToSpeak.toString(), 'lang': 'English' };
    $.ajax({
        url: 'https://localhost:12030/service/PlayKioskVoice',
        data: JSON.stringify(obj),
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}*/
function Speak_2() {
    var dataToSpeak;
    //var amt = '2431.10';
    //var amt = '24315910.19';
	var amt = '151150909';
    var amtSplit = amt.split('.');
    var amount = inWords(amtSplit[0]);
    //alert(amount);
    var amountSplit = amount.replace(/\s/g, '.wav|');
    //alert(amountSplit);
    dataToSpeak = new StringBuilder();
    dataToSpeak.append("AEPS.wav|WITHDRAW_AMT.WAV|");
    dataToSpeak.append(amountSplit);
    dataToSpeak.append('RUPEES.wav|');

    if (amtSplit.length == 2) {
        var paisa = inWords(amtSplit[1]);
        dataToSpeak.append(paisa.replace(/\s/g, '.wav|'));
        dataToSpeak.append('PAISA.wav|PROCEED_AUTH.WAV|');
    }
    console.log(dataToSpeak.toString());
    var obj = { 'textToSpeak': dataToSpeak.toString(), 'lang': 'English' };
    $.ajax({
        url: 'https://localhost:12030/service/PlayKioskVoice',
        data: JSON.stringify(obj),
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
var a = ['', '1 ', '2 ', '3 ', '4 ', '5 ', '6 ', '7 ', '8 ', '9 ', '10 ', '11 ', '12 ', '13 ', '14 ', '15 ', '16 ', '17 ', '18 ', '19 '];
var b = ['', '', '20', '30', '40', '50', '60', '70', '80', '90'];

/*function inWords(num) {
    if ((num = num.toString()).length > 9) return 'overflow';
    n = ('000000000' + num).substr(-9).match(/^(\d{2})(\d{2})(\d{2})(\d{1})(\d{2})$/);
    if (!n) return; var str = '';
    str += (n[1] != 0) ? (a[Number(n[1])] || b[n[1][0]] + ' ' + a[n[1][1]]) + 'crore ' : '';
    str += (n[2] != 0) ? (a[Number(n[2])] || b[n[2][0]] + ' ' + a[n[2][1]]) + 'lakh ' : '';
    str += (n[3] != 0) ? (a[Number(n[3])] || b[n[3][0]] + ' ' + a[n[3][1]]) + 'thousand ' : '';
    str += (n[4] != 0) ? (a[Number(n[4])] || b[n[4][0]] + ' ' + a[n[4][1]]) + 'hundred ' : '';
    str += (n[5] != 0) ? ((str != '') ? '' : '') + (a[Number(n[5])] || b[n[5][0]] + ' ' + a[n[5][1]]) : '';
	
	alert(n);
	alert(n[1]);
	alert(n[2]);
	alert(n[3]);
	alert(n[4]);
	alert(n[3][0]);
	alert(n[3][1]);
    return str;
}*/

function inWords(num) {
	if ((num = num.toString()).length > 9) return 'overflow';
    n = ('000000000' + num).substr(-9).match(/^(\d{2})(\d{2})(\d{2})(\d{1})(\d{2})$/);
    if (!n) return; var str = '';
	
	if(Number(n[1]) > 20 ){
		const cr1 = Number((a[Number(n[1])] || b[n[1][0]])) + Number(a[n[1][1]]);
		str += (n[1] != 0) ? cr1 + ' crore ' : '';
	}
	else{
		const cr2 = Number((a[Number(n[1])] || b[n[1][0]]));
		str += (n[1] != 0) ? cr2 + ' crore ' : '';
	}
	
	if(Number(n[2]) > 20 ){
		const lk1 = Number((a[Number(n[2])] || b[n[2][0]])) + Number(a[n[2][1]]);
		str += (n[2] != 0) ? lk1 + ' lakh ' : '';
	}
	else{
		const lk2 = Number((a[Number(n[2])] || b[n[2][0]]));
		str += (n[2] != 0) ? lk2 + ' lakh ' : '';
	}
	if(Number(n[3]) > 20 ){
		const th1 = Number((a[Number(n[3])] || b[n[3][0]])) + Number(a[n[3][1]]);
		str += (n[3] != 0) ? th1 + ' thousand ' : '';
	}
	else{
		const th2 = Number((a[Number(n[3])] || b[n[3][0]]));
		str += (n[3] != 0) ? th2 + ' thousand ' : '';
	}
	
	str += (n[4] != 0) ? (a[Number(n[4])] || b[n[4][0]] + ' ' + a[n[4][1]]) + 'hundred ' : '';
    str += (n[5] != 0) ? (Number(n[5]) + ' ') : '';
	return str;
}
function TVSSP40_OpenPassbookPrinter() {
    $.ajax({
        url: 'https://localhost:12030/service/TVSSP40_OpenPassbookPrinter',
        dataType: 'text',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function TVSSP40_EjectPassBook() {
    $.ajax({
        url: 'https://localhost:12030/service/TVSSP40_EjectPassBook',
        dataType: 'text',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function TVSSP40_CheckPaperStatus() {
    $.ajax({
        url: 'https://localhost:12030/service/TVSSP40_CheckPaperStatus',
        dataType: 'text',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function TVSSP40_PrintPassbook() {
    //var obj = { 'printData': '  02-03-2019    538996    ASCO MOTORS /AS                                 2356.00                             7760.00    ', 'font': 10, 'cpi': 11, 'lpi': 11, 'linesPrinted': 12 };
    //var obj = { 'printData': '  20170719              SMS CHRG FOR:01-04-2017to30-06-2017               17.70                        386.51_  20170723              QAB Charges from 01-04-2017 to 30-06-2017        141.60                        244.91_  20170816              IOC Ref No3000053270                                           45.65           290.56_  20171107              TRTR/OFADPAY/803113005330/FIC                                 588.00           878.56_  20171107              TRTR/OFADPAY/803113005334/FIC                                 250.00          1128.56_  20171107              TRTR/OFADPAY/803113005336/FIC                                 583.00          1711.56_  20171107              TRTR/OFADPAY/803214005398/FIC                                 200.00          1911.56_  20171107              TRTR/OFADPAY/803214005399/FIC                                 205.00          2116.56_  20180702              TRTR/842011000044/12-11-2019 11:28:10/FIK                      10.00          2126.56_  20180702              TRTR/842011000045/12-11-2019 11:28:10/FIK                      10.00          2136.56_', 'font': 10, 'cpi': 11, 'lpi': 11, 'linesPrinted': 21, 'secondPageheaderSpaceReqd': '0', 'isPageBreakAtThirty': '0', 'maxLinesPassbookCanPrint': 34, 'firstPageVerticalStartIndex': 7 };
    var obj = { 'printData': '  20170719              SMS CHRG FOR:01-04-2017to30-06-2017               17.70                        386.51_  20170723              QAB Charges from 01-04-2017 to 30-06-2017        141.60                        244.91_  20170816              IOC Ref No3000053270                                           45.65           290.56_  20171107              TRTR/OFADPAY/803113005330/FIC                                 588.00           878.56_  20171107              TRTR/OFADPAY/803113005334/FIC                                 250.00          1128.56_  20171107              TRTR/OFADPAY/803113005336/FIC                                 583.00          1711.56_  20171107              TRTR/OFADPAY/803214005398/FIC                                 200.00          1911.56_  20171107              TRTR/OFADPAY/803214005399/FIC                                 205.00          2116.56_  20180702              TRTR/842011000044/12-11-2019 11:28:10/FIK                      10.00          2126.56_  20180702              TRTR/842011000045/12-11-2019 11:28:10/FIK                      10.00          2136.56_', 'font': 10, 'cpi': 11, 'lpi': 11, 'linesPrinted': 21, 'secondPageheaderSpaceReqd': '0', 'isPageBreakAtThirty': '0' };
    $.ajax({
        url: 'https://localhost:12030/service/TVSSP40_PrintPassbook',
        data: JSON.stringify(obj),
        contentType: "application/json;charset=utf-8",
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function TestEvoluteFalcon() {
    $.ajax({
        url: 'https://localhost:12030/service/TestEvoluteFalcon',
        dataType: 'json',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}

function GetGeoCoordinate_old() {
    $.ajax({
        url: 'https://localhost:12030/service/GetGeoCoordinate',
        dataType: 'text',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function GetGeoCoordinate() {
    $.ajax({
        url: 'https://localhost:12030/service/GetBluetoothGeoData',
        dataType: 'text',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                if (data === null || data === undefined || data === "" || data === '""') {
                    alert("Please check the bluetooth connection");
                }
                else {
                    alert(data);
                    //var decr = getDecrInfo(encodeURIComponent(data));
                    //alert('Decrypted data : ' + decr);
                }
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}

function GetFacePidData() {
    var envType = "P"; // or whatever your envType is
    var pidOptionsXml =
        "<PidOptions env=\"" + envType + "\" ver=\"1.0\">" +
        "   <CustOpts>" +
        "      <Param name=\"txnId\" value=\"1745920375212\"/>" +
        "   </CustOpts>" +
        "   <Opts" +
        " fCount=\"0\"" +
        " fType=\"0\"" +
        " format=\"\"" +
        " iCount=\"0\"" +
        " iType=\"1\"" +
        " otp=\"\"" +
        " pCount=\"1\"" +
        " pType=\"\"" +
        " pidVer=\"2.0\"" +
        " posh=\"\"" +
        " timeout=\"\"" +
        " wadh=\"\"" +
        " />" +
        "</PidOptions>";

    $.ajax({
        url: 'https://localhost:12030/service/GetFacePidData',
        data: '=' + pidOptionsXml,
        dataType: 'json',
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data === null || data === undefined || data === "" || data === '""') {
                alert("Please check the bluetooth connection");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
function getRequestInfoDe(encData) {
    $.ajax({
        url: 'https://localhost:12030/service/getRequestInfoDe',
        //data: '=' + 'UuzM/uxD0gbiKTo78DauZA==',
        data: '=' + encodeURIComponent(encData),
        type: 'POST',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
/*function getDecrInfo(encrData) {
    var salt = CryptoJS.lib.WordArray.create(0);
    var params = CryptoJS.kdf.OpenSSL.execute('jjkaDHJSJFF4385N', 256 / 32, 128 / 32, salt);
    //var encryptedWordArray = CryptoJS.enc.Base64.parse(encrData);
    var decrypteddata = CryptoJS.AES.decrypt(encrData, params.key, { iv: params.iv });
    decrypteddata = decrypteddata.toString(CryptoJS.enc.Utf8);
    //alert(decrypteddata);
    //console.log(decrypteddata);
    return decrypteddata;
}*/
function getDecrInfo(encrData) {
    // Ensure encrData is base64 encoded
    var base64Data = CryptoJS.enc.Base64.parse(encrData); // Decode base64 to WordArray
    var salt = CryptoJS.lib.WordArray.create(0);
    var params = CryptoJS.kdf.OpenSSL.execute('jjkaDHJSJFF4385N', 256 / 32, 128 / 32, salt);

    var decrypteddata = CryptoJS.AES.decrypt({ ciphertext: base64Data }, params.key, { iv: params.iv });

    // Ensure the decrypted data is UTF-8 encoded before converting to string
    decrypteddata = decrypteddata.toString(CryptoJS.enc.Utf8);

    if (decrypteddata === "") {
        alert("Decryption failed: Possibly malformed data");
    } else {
        return decrypteddata;
    }
}

let code = (function () {
    return {
        encryptMessage: function (messageToencrypt, secretkey) {
            var encryptedMessage = CryptoJS.AES.encrypt(messageToencrypt, secretkey);
            return encryptedMessage.toString();
        },
        decryptMessage: function (encryptedMessage, secretkey) {
            var decryptedBytes = CryptoJS.AES.decrypt(encryptedMessage, secretkey);
            var decryptedMessage = decryptedBytes.toString(CryptoJS.enc.Utf8);

            return decryptedMessage;
        }
    }
})();
function GetMACAddress() {
    $.ajax({
        url: 'https://localhost:12030/service/GetMACAddress',
        dataType: 'text',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}
//Method GetPaxDeviceID() returns string as PAX serial number
//0 -> Reading serial number from PAX is failed
//1 -> Not able to read the PAX device connected port

function GetPaxDeviceID() {
    $.ajax({
        url: 'https://localhost:12030/service/GetPaxDeviceID',
        dataType: 'text',
        type: 'GET',
        cache: false,
        timeout: 120000,

        success: function (data) {
            if (data == undefined) {
                alert("Error : 219");
            }
            else {
                alert(data);
            }
        },
        error: function (jqXHR, exception) {
            if (jqXHR.status === 0) {
                alert('Not connected.\nPlease verify network.');
            } else if (jqXHR.status == 404) {
                alert('Requested page not found. [404]');
            } else if (jqXHR.status == 500) {
                alert('Session expired. Please refresh the page and try again.');
            } else if (exception === 'parsererror') {
                alert('Requested JSON parse failed.');
            } else if (exception === 'timeout') {
                alert('Time out error.');
            } else if (exception === 'abort') {
                alert('Ajax request aborted.');
            } else {
                alert('Unable to connect to the network.\nPlease check the connection and try again.');
            }
        }
    });
}