<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>打印执照预览页</title>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <link href="/Content/css/f_css.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="/YtjCommon/css/style1.css">

    <script src="/Content/static/js/jquery-2.0.3.min.js"></script>
    <script src="/Content/static/bootstrap/js/bootstrap.min.js"></script>

    <script src="/Content/static/icheck/icheck.js?v=1.0.2"></script>
    <script src="/Content/static/icheck/demo/js/custom.min.js?v=1.0.2"></script>
    <script src="/Content/static/bootstrap/js/bootstrap.min.js"></script>
    <script src="/Content/JS/Print.js"></script>
    <script src="/Content/JS/A4Print.js"></script>
    <script src="/Content/JS/main.js"></script>
    <script src="/Content/static/js/public.js"></script>


    <link rel="stylesheet" href="/Content/Alert/js/SyntaxHighlighter/shCoreDefault.css">
    <link rel="stylesheet" href="/Content/Alert/css/alert.css">
    <link rel="stylesheet" href="/Content/Alert/css/style.css">
    <script src='/Content/Alert/js/SyntaxHighlighter/shCore.js'></script>
    <script src='/Content/Alert/js/SyntaxHighlighter/makeSy.js'></script>
    <script src='/Content/Alert/js/alert.min.js'></script>
    <script src='/Content/Alert/js/alert-api.js'></script>
    <script src="/Content/JS/layer.js"></script>
    <script src='/ruoyi/js/ry-ui.js'></script>
    <script src='/ruoyi/js/common.js'></script>

    <script type="text/javascript">
        var JingYingCard = GetQuery('jyCord');//身份证号
        var BSID = GetQuery('BSID');

        var XinYongCode = "";
        var JingYingRen = "";
        var zwzh = "";
        var ScZtType = "";
        var JingYingChangSuo = "";
        var ZuChengXingShi = "";
        var ShenQingDate = "";
        var JingYingFanWei = "";
        var ErWeiMaBase64 = "";


        $(function () {
            // 判断是否已存在，如果已存在则直接显示
            GetGrid();
            /*            var info = Get_PCinfo();//获取设备信息
                        info = JSON.parse(info);
                        $("#xxly").val(info.M_Tag);*/
        });


        //加载数据
        function GetGrid() {

            $.ajax({
                cache:false,
                type: 'GET',
                contentType: 'application/json',
                url: '/Ytj/Printer/Printing?BSID=' + BSID + '&jyCord=' + JingYingCard+"&bs=3",
                dataType: 'json',
                success: function (json) {
                    var data=json.data;
                    var mchy="";
                    var zzxs="";
                    if(data.mingchenghangye!=null){
                        mchy=data.mingchenghangye;
                    }
                    if(data.zuzhixingshi!=null){
                        zzxs=data.zuzhixingshi;
                    }
                    $("#XinYongCode").html(data.xinyongcode);
                    $("#JingYingRen").html(data.jingyingren);
                    $("#zwzh").html(data.zwzh + "" + mchy + "" + zzxs);
                    $("#ScZtType").html(data.sczttype);
                    $("#JingYingChangSuo").html(data.jingyingchangsuo);
                    $("#ZuChengXingShi").html(data.zuchengxingshi);
                    $("#ShenQingDate").html(ZhuanTime(data.zhucetime));
                    $("#JingYingFanWei").html(data.jingyingfanwei);
                    $("#ErWeiMaBase64").html("<img  src=\"data:image/png;base64," + data.erweimabase64 + "\" style=\"width:60px;height:60px;\"/>");

                    $("#XinYongCode1").html(data.xinyongcode);
                    $("#JingYingRen1").html(data.jingyingren);
                    //$("#zwzh1").html(item.NsXzq + "" + item.Zwzh + "" + item.MingChengHangYe + "" + item.ZuZhiXingShi);
                    if (data.zwzh == "***") {
                        $("#zwzh").html(data.zwzh);
                    } else {
                        $("#zwzh").html( "[[${city}]]"+data.zwzh.replace("[[${city}]]","") + "" + mchy + "" + zzxs);
                    }
                    $("#ScZtType1").html(data.sczttype);
                    $("#JingYingChangSuo1").html(data.jingyingchangsuo);
                    $("#ZuChengXingShi1").html(data.zuchengxingshi);
                    $("#ShenQingDate1").html(ZhuanTime(data.zhucetime));
                    $("#JingYingFanWei1").html(data.jingyingfanwei);
                    $("#ErWeiMaBase641").html("<img src=\"data:image/png;base64," + data.erweimabase64 + "\" style=\"width:60px;height:60px;\"/>");

                    XinYongCode = data.xinyongcode;
                    JingYingRen = data.jingyingren;
                    //zwzh = item.NsXzq + "" + item.Zwzh + "" + item.MingChengHangYe + "" + item.ZuZhiXingShi;
                    $("#zwzh1").html( "[[${city}]]"+data.zwzh.replace("[[${city}]]","") + "" + mchy + "" + zzxs);
                    ScZtType = data.sczttype;
                    JingYingChangSuo = data.jingyingchangsuo;
                    ZuChengXingShi = data.zuchengxingshi;
                    ShenQingDate = data.shenqingdate;
                    JingYingFanWei = data.jingyingfanwei;
                    ErWeiMaBase64 = data.erweimabase64;
                    var PrintYinCang = "";
                    PrintYinCang += "<iframe src=\"PrintLrForm?BSID=" + compileStr(BSID) + "&JingYingCard=" + compileStr(JingYingCard) + "\" style=\"display:none\"></iframe><iframe src=\"PrintLrForm_F?BSID=" + compileStr(BSID) + "&JingYingCard=" + compileStr(JingYingCard) + "\" style=\"display:none\"></iframe>";
                    $("#YinCangPrint").html(PrintYinCang);

                    if (data.shenhedate != "" && data.shenhedate != "null") {
                        var Pdate = data.shenhedate;

                        var result, year, month, day;
                        year = Pdate.replace().substring(0,4);
                        var tty = Pdate.replace().substring(5,7);
                        if(parseInt(tty)<10){
                            month=Pdate.replace().substring(6,7);
                        }else{
                            month=tty;
                        }
                        var tty1 = Pdate.replace().substring(8,10);
                        if(parseInt(tty1)<10){
                            day=Pdate.replace().substring(9,10);
                        }else{
                            day=tty1;
                        }
                        $("#Nian").html(year);
                        $("#Yue").html(month);
                        $("#Ri").html(day);

                        $("#Nian1").html(year);
                        $("#Yue1").html(month);
                        $("#Ri1").html(day);
                    }
                    createHtml(data.isprint,data.isprintF)
                },
                error: function () {
                    layer.msg("页面加载失败");
                }
            });
        }

        function createHtml(is,is1) {
            $.modal.loading("正在生成执照，请稍后。");
            window.setTimeout(function () {
                $.modal.closeLoading()
                if (is == "1") {
                    $("#printA").attr("disabled", true);
                    $("#printA").css("background", "#888888");
                }
                if (is1== "1") {
                    $("#printB").attr("disabled", true);
                    $("#printB").css("background", "#888888");
                }
            },2000);
            /*$.ajax({
                cache:false,
                type: 'GET',
                url: '/Ytj/Printer/CreateHtmls?BSID=' + BSID + '&jyCord=' + JingYingCard,
                dataType: 'json',
                success: function(data1){
                    if(data1.code==0){
                        $.modal.msgSuccess("生成成功。");
                        if (is != "1") {
                            $("#printA").attr("disabled", false);
                            zbok = 1;
                        }
                        if (is1!= "1") {
                            $("#printB").attr("disabled", false);
                        }
                        $.modal.closeLoading();
                    }
                    else {
                        $.modal.closeLoading();
                        $.modal.msgError("生成错误，正在重新生成中。");
                    }

                },error: function () {
                    $.modal.closeLoading();
                    $.modal.msgError("生成错误，正在重新生成中。");
                }
            })*/
        }

        function ZhuanTime(Time) {

            // var date = new Date(Time);
            var result, year, month, day;
            year = Time.replace().substring(0,4);
            var tty = Time.replace().substring(5,7);
            if(parseInt(tty)<10){
                month=Time.replace().substring(6,7);
            }else{
                month=tty;
            }
            var tty1 = Time.replace().substring(8,10);
            if(parseInt(tty1)<10){
                day=Time.replace().substring(9,10);
            }else{
                day=tty1;
            }
            result = year + "年" + month + "月" + day + "日";
            return result;
        }


        function GetQuery(key) {
            var search = location.search.slice(1); //得到get方式提交的查询字符串
            var arr = search.split("&");
            for (var i = 0; i < arr.length; i++) {
                var ar = arr[i].split("=");
                if (ar[0] == key) {
                    if (unescape(ar[1]) == 'undefined') {
                        return "";
                    } else {
                        return unescape(ar[1]);
                    }
                }
            }
            return "";
        }



        //isStatus
        //100：成功
        //200：失败
        //300：模块未启用

        //isTypecode
        //0：就绪
        //1：正在打印
        //2：初始化中
        //4：睡眠
        //8：唤醒中

        //100：缺纸
        //200：缺墨
        //400：卡纸
        //800：打印机仓门被打开
        //65535：其它状态（typeinfo将返回状态信息）
        //============================副本========================
        function PrintStatar_F(BS, isOne) {
            //获取打印机状态信息
            send_command(
                "PrintInfo",
                function (receivedData) {
                    var data = JSON.parse(receivedData);
                    if (data.status == 100) {
                        var print_info;
                        var type = data.printerstatus.typecode;
                        if (type < 100) {

                            if (isOne == "1" && type == 0) {//打印机就绪，已经打印过
                                //  var dialog = jqueryAlert({
                                //    'style': 'wap',
                                //  'icon': '/Content/Alert/img/right.png',
                                //  'content': '副本打印完成！请取走您的执照',
                                //  'closeTime': 2000,
                                //})
                                updatePrint(BS);
                                if (BS == "1") {//打印正本A3
                                    $("#printA").attr("disabled", true);
                                }
                                else if (BS == "0") {//打印副本A4
                                    $("#printB").attr("disabled", true);
                                }
                            }

                            if (type == 1) {//正在打印
                                if (isOne == "0") {
                                    var dialog = jqueryAlert({
                                        'style': 'wap',
                                        'icon': '/Content/Alert/img/wait.gif',
                                        'content': '副本正在打印,请等待',
                                        'closeTime': 5000,
                                    })
                                }
                                setTimeout("PrintStatar_F('" + BS + "','1')", 2000);
                            }
                            else if (type == 2) {//初始化中
                                var dialog = jqueryAlert({
                                    'style': 'wap',
                                    'icon': '/Content/Alert/img/wait.gif',
                                    'content': '打印机初始化中',
                                    'closeTime': 1000,
                                })
                            } else if (type == 8) {//唤醒中
                                setTimeout("PrintStatar_F('" + BS + "','1')", 2000);
                            } else {
                                setTimeout("PrintStatar_F('" + BS + "','1')", 2000);
                            }
                        }
                        //缺纸
                        else if (type == 100) {
                            var dialog = jqueryAlert({
                                'style': 'wap',
                                'icon': '/Content/Alert/img/warning.png',
                                'content': '打印机缺纸',
                                'closeTime': 2000,
                            })
                        }
                        //缺墨
                        else if (type == 200) {
                            var dialog = jqueryAlert({
                                'style': 'wap',
                                'icon': '/Content/Alert/img/warning.png',
                                'content': '打印机缺墨',
                                'closeTime': 2000,
                            })
                        }
                        //卡纸
                        else if (type == 400) {
                            var dialog = jqueryAlert({
                                'style': 'wap',
                                'icon': '/Content/Alert/img/warning.png',
                                'content': '打印机卡纸',
                                'closeTime': 2000,
                            })
                        }
                        //打印机仓门被打开
                        else if (type == 800) {
                            var dialog = jqueryAlert({
                                'style': 'wap',
                                'icon': '/Content/Alert/img/warning.png',
                                'content': '打印机仓门被打开',
                                'closeTime': 2000,
                            })
                        }
                        //其它状态（typeinfo将返回状态信息）
                        else if (type == 65535) {
                            var dialog = jqueryAlert({
                                'style': 'wap',
                                'icon': '/Content/Alert/img/warning.png',
                                'content': data.printerstatus.typeinfo,
                                'closeTime': 2000,
                            })
                        } else {
                            var dialog = jqueryAlert({
                                'style': 'wap',
                                'icon': '/Content/Alert/img/warning.png',
                                'content': data.printerstatus.typeinfo,
                                'closeTime': 2000,
                            })
                        }
                    }

                }
            );
        }





        //截取url
        function GetUrlRelativePath(){
            var url = document.location.toString();
            var arrUrl = url.split("//");
            var start = arrUrl[1].indexOf("//");
            var relUrl = arrUrl[1].substring(start);//stop省略，截取从start开始到结尾的所有字符
            if(relUrl.indexOf("/PrintIndex") != -1){
                relUrl = relUrl.split("/PrintIndex")[0];
            }
            return relUrl;
        }

        /*
        旧一体机的正本配置。
                {
                "url": path,
                ChoiceTray: 5,
                ChoicePaper: 1
                 };
        旧一体机的副本配置。
                {
                "url": path,
                ChoiceTray: 1,
                ChoicePaper: 0
                 };


        新一体机的正本配置。
                {
                "url": path,
                ChoiceTray: 1,
                ChoicePaper: 1
                 };
        新一体机的副本配置。
                {
                "url": path,
                ChoiceTray: 0,
                ChoicePaper: 0
                 };



        */
        var lock =true ;
        //double = 1 双面打印，double = 2 单面打印
        //ChoicePaper = 1时：A3打印，ChoicePaper =0 时 ：A4打印
        //choiceTray打印纸盒选择（0使用默认纸盒，1使用纸盒1，2使用纸盒2，3使用纸盒3，4使用纸盒4，5使用手动纸盒

        //开始打印副本
        function Print(BS) {
            if(lock){
                lock=false;
                // var Url = "http://32.40.105.201:8086/Ytj/Printer";
                var Url = getRootPath_web();
                var path = "";
                $("#printB").css("background", "#888888");
                path = Url + "/Ytj/Printer/fuben?XinYongCode="+$("#XinYongCode").text();
                var dialog = jqueryAlert({
                    'style': 'wap',
                    'icon': '/Content/Alert/img/wait.gif',
                    'content': '正在打印,请等待',
                    'closeTime': 5000,
                });
                setTimeout(function () {
                    $.ajax({
                        cache: false,
                        type: 'GET',
                        contentType: 'application/json',
                        url: '/Ytj/Printer/Printing?BSID=' + BSID + '&jyCord=' + JingYingCard + "&bs=0",
                        dataType: 'json',
                        cache: false,
                        success: function (json) {
                            if (json.code == 301) {
                                var dialog = jqueryAlert({
                                    'style': 'wap',
                                    'icon': '/Content/Alert/img/warning.png',
                                    'content': '副本已打印！',
                                    'closeTime': 2000,
                                })
                                lock = true;
                            } else {
                                var printurlChoiceTray = {
                                    "url": path,
                                    "ChoiceTray": 0,
                                    "isdouble": 0,
                                    "ChoicePaper": 0
                                };
                                var data = JSON.stringify(printurlChoiceTray);
                                send_command(
                                    "printUrl2",
                                    data,
                                    function (receivedData) {
                                        var dialog = jqueryAlert({
                                            'style': 'wap',
                                            'icon': '/Content/Alert/img/right.png',
                                            'content': '开始打印...',
                                            'closeTime': 2000,
                                        })
                                    });
                            }
                            lock = true;
                        }
                    });
                },3000);
            }else {
                var dialog = jqueryAlert({
                    'style': 'wap',
                    'icon': '/Content/Alert/img/warning.png',
                    'content': '请等待,正本正在打印中！',
                    'closeTime': 3000,
                })
            }
        }

        //===========================正本=====================================
        //double = 1 双面打印，double = 2 单面打印
        //ChoicePaper = 1时：A3打印，ChoicePaper =0 时 ：A4打印
        //choiceTray打印纸盒选择（0使用默认纸盒，1使用纸盒1，2使用纸盒2，3使用纸盒3，4使用纸盒4，5使用手动纸盒
        //打印正本
        function printweb2(BS) {
            if(lock) {
                lock = false;
                $("#printA").css("background", "#888888");
                //var Url = "http://32.40.105.201:8086/Ytj/Printer";
                var Url = getRootPath_web();
                // var path = document.getElementById('printurl').value;
                var path = Url + "/Ytj/Printer/zhengben?XinYongCode=" + $("#XinYongCode").text();
                //  var path="../templates/Ytj/PrintHtml/矿区行政审批局1号机PrintF.html"
                var dialog = jqueryAlert({
                    'style': 'wap',
                    'icon': '/Content/Alert/img/wait.gif',
                    'content': '正在打印,请等待',
                    'closeTime': 5000,
                });
                setTimeout(function () {
                    $.ajax({
                        cache: false,
                        type: 'GET',
                        contentType: 'application/json',
                        url: '/Ytj/Printer/Printing?BSID=' + BSID + '&jyCord=' + JingYingCard + "&bs=1",
                        dataType: 'json',
                        cache: false,
                        success: function (json) {
                            if (json.code == 301) {
                                var dialog = jqueryAlert({
                                    'style': 'wap',
                                    'icon': '/Content/Alert/img/warning.png',
                                    'content': '正本已打印！',
                                    'closeTime': 2000,
                                })
                                lock = true;
                            } else {
                                var testfile =
                                    {
                                        "url": path,
                                        ChoiceTray: 1,
                                        ChoicePaper: 1
                                    };
                                var data = JSON.stringify(testfile);
                                send_command(
                                    "printUrl2",
                                    data,
                                    function (receivedData) {
                                        var dialog = jqueryAlert({
                                            'style': 'wap',
                                            'icon': '/Content/Alert/img/right.png',
                                            'content': '开始打印...',
                                            'closeTime': 2000,
                                        })
                                        lock = true;
                                    }
                                    /*     function print_state() {
                                         Toast('', '准备获取打印机状态');
                                         Message('准备获取打印机状态.....');
                                         var receivedData = PrintStatus();
                                         var info = JSON.parse(receivedData);
                                         Message(receivedData);
                                         if (info.status == 100) {
                                             if (info.typecode < 100) {
                                                 //正常状态
                                                 switch (info.typecode) {
                                                     case 0:
                                                         Toast('', '就绪');
                                                         break;
                                                     case 1:
                                                         Toast('', '正在打印');
                                                         break;
                                                     case 2:
                                                         Toast('', '初始化中');
                                                         break;
                                                     case 4:
                                                         Toast('', '睡眠');
                                                         break;
                                                     case 8:
                                                         Toast('', '唤醒中');
                                                         break;
                                                     case 100:
                                                         Toast('', '缺纸');
                                                         break;
                                                     case 200:
                                                         Toast('', '缺墨');
                                                         break;
                                                     case 400:
                                                         Toast('', '卡纸');
                                                         break;
                                                     case 800:
                                                         Toast('', '打印机仓门被打开');
                                                         break;
                                                     case 65535:
                                                         Toast('', info.typeinfo);
                                                         break;
                                                 }
                                             } else {
                                                 //异常状态
                                                 Toast('err', info.typeinfo);
                                             }
                                         } else if (info.status == 300) {
                                             Toast('errs', '模块未开启！');
                                         } else if (info.status == 200){
                                             Toast('err', "失败：" + info.msg);
                                         }

                                     }*/
                                );
                            }
                            lock = true;
                        }
                    });
                }, 3000);
            }else {
                var dialog = jqueryAlert({
                    'style': 'wap',
                    'icon': '/Content/Alert/img/warning.png',
                    'content': '请等待,副本正在打印中！',
                    'closeTime': 3000,
                })
            }
        }


        //isStatus
        //100：成功
        //200：失败
        //300：模块未启用

        //isTypecode
        //0：就绪
        //1：正在打印
        //2：初始化中
        //4：睡眠
        //8：唤醒中

        //100：缺纸
        //200：缺墨
        //400：卡纸
        //800：打印机仓门被打开
        //65535：其它状态（typeinfo将返回状态信息）

        // 唤醒打印机
        function print_start() {
            Toast('', '准备唤醒打印机');
            Message('准备唤醒打印机.....');
            var receivedData = PrintWakeup();
            var info = JSON.parse(receivedData);
            if (info.status == 100) {
                Toast('res', info.msg);
                Message(info.msg);
            } else if (info.status == 300) {
                Toast('errs', '模块未开启！');
                Message('模块未开启！');
            } else if (info.status == 200){
                Toast('err', info.msg);
                Message(info.msg);
            }
        }

        //获取打印机状态
        function print_state() {
            Toast('', '准备获取打印机状态');
            Message('准备获取打印机状态.....');
            var receivedData = PrintStatus();
            var info = JSON.parse(receivedData);
            Message(receivedData);
            if (info.status == 100) {
                if (info.typecode < 100) {
                    //正常状态
                    switch (info.typecode) {
                        case 0:
                            Toast('', '就绪');
                            break;
                        case 1:
                            Toast('', '正在打印');
                            break;
                        case 2:
                            Toast('', '初始化中');
                            break;
                        case 4:
                            Toast('', '睡眠');
                            break;
                        case 8:
                            Toast('', '唤醒中');
                            break;
                        case 100:
                            Toast('', '缺纸');
                            break;
                        case 200:
                            Toast('', '缺墨');
                            break;
                        case 400:
                            Toast('', '卡纸');
                            break;
                        case 800:
                            Toast('', '打印机仓门被打开');
                            break;
                        case 65535:
                            Toast('', info.typeinfo);
                            break;
                    }
                } else {
                    //异常状态
                    Toast('err', info.typeinfo);
                }
            } else if (info.status == 300) {
                Toast('errs', '模块未开启！');
            } else if (info.status == 200){
                Toast('err', "失败：" + info.msg);
            }

        }

        function PrintStatar(BS, isOne) {
            send_command(
                "PrintInfo",
                function (receivedData) {
                    var data = JSON.parse(receivedData);
                    if (data.status == 100) {
                        var print_info;
                        var type = data.printerstatus.typecode;
                        if (type < 100) {
                            if (isOne == "1" && type == 0) {//打印机就绪，已经打印过
                                // var dialog = jqueryAlert({
                                //     'style': 'wap',
                                //     'icon': '/Content/Alert/img/right.png',
                                //     'content': '正本打印完成！请取走您的执照',
                                //     'closeTime': 2000,
                                // })
                                updatePrint(BS);
                                if (BS == "1") {//打印正本A3
                                    $("#printA").attr("disabled", true);
                                }
                                else if (BS == "0") {//打印副本A4
                                    $("#printB").attr("disabled", true);
                                }
                            }

                            if (type == 1) {//正在打印
                                if (isOne == "0") {
                                    var dialog = jqueryAlert({
                                        'style': 'wap',
                                        'icon': '/Content/Alert/img/wait.gif',
                                        'content': '正本正在打印,请等待',
                                        'closeTime': 5000,
                                    })
                                }
                                setTimeout("PrintStatar('" + BS + "','1')", 2000);
                            }
                            else if (type == 2) {//初始化中
                                var dialog = jqueryAlert({
                                    'style': 'wap',
                                    'icon': '/Content/Alert/img/wait.gif',
                                    'content': '打印机初始化中',
                                    'closeTime': 1000,
                                })
                            } else if (type == 8) {//唤醒中
                                setTimeout("PrintStatar('" + BS + "','1')", 2000);
                            } else {
                                setTimeout("PrintStatar('" + BS + "','1')", 2000);
                            }
                        }
                        //缺纸
                        else if (type == 100) {
                            var dialog = jqueryAlert({
                                'style': 'wap',
                                'icon': '/Content/Alert/img/warning.png',
                                'content': '打印机缺纸',
                                'closeTime': 2000,
                            })
                        }
                        //缺墨
                        else if (type == 200) {
                            var dialog = jqueryAlert({
                                'style': 'wap',
                                'icon': '/Content/Alert/img/warning.png',
                                'content': '打印机缺墨',
                                'closeTime': 2000,
                            })
                        }
                        //卡纸
                        else if (type == 400) {
                            var dialog = jqueryAlert({
                                'style': 'wap',
                                'icon': '/Content/Alert/img/warning.png',
                                'content': '打印机卡纸',
                                'closeTime': 2000,
                            })
                        }
                        //打印机仓门被打开
                        else if (type == 800) {
                            var dialog = jqueryAlert({
                                'style': 'wap',
                                'icon': '/Content/Alert/img/warning.png',
                                'content': '打印机仓门被打开',
                                'closeTime': 2000,
                            })
                        }
                        //其它状态（typeinfo将返回状态信息）
                        else if (type == 65535) {
                            var dialog = jqueryAlert({
                                'style': 'wap',
                                'icon': '/Content/Alert/img/warning.png',
                                'content': data.printerstatus.typeinfo,
                                'closeTime': 2000,
                            })
                        } else {
                            var dialog = jqueryAlert({
                                'style': 'wap',
                                'icon': '/Content/Alert/img/warning.png',
                                'content': data.printerstatus.typeinfo,
                                'closeTime': 2000,
                            })
                        }
                    }

                }
            );
        }



        function getRootPath_web() {
            //获取当前网址
            var curWwwPath = window.document.location.href;
            //获取主机地址之后的目录，如： uimcardprj/share/meun.jsp
            var pathName = window.document.location.pathname;
            var pos = curWwwPath.indexOf(pathName);
            //获取主机地址，如： http://localhost:8083
            var localhostPaht = curWwwPath.substring(0, pos);
            //获取带"/"的项目名，如：/uimcardprj
            // var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
            return (localhostPaht);
        }



        function compileStr(code) { //对字符串进行加密
            var c = String.fromCharCode(code.charCodeAt(0) + code.length);
            for (var i = 1; i < code.length; i++) {
                c += String.fromCharCode(code.charCodeAt(i) + code.charCodeAt(i - 1));
            }
            return escape(c);
        }


        function uncompileStr(code) {       //对字符串进行解密
            code = unescape(code);
            var c = String.fromCharCode(code.charCodeAt(0) - code.length);
            for (var i = 1; i < code.length; i++) {
                c += String.fromCharCode(code.charCodeAt(i) - c.charCodeAt(i - 1));
            }
            return c;
        }


        function getRadioVal(name) {
            var result;
            var radio = document.getElementsByName(name);
            for (var i = 0; i < radio.length; i++) {
                if (radio[i].checked) {
                    result = radio[i].value;
                }
            }
            return result;
        }
    </script>

    <style>
        .fontSize {
            font-size:12px;
            font-family:黑体;
        }
        #myPrintArea {
            float:left;
        }
        #myPrintArea1 {
            float:right;
        }
    </style>
</head>
<body>
<input id="xxly" name="xxly" type="hidden"/>
<header>
    <h2 class="title fl tit-con"th:text="${city}+'个体企业执照自助打印终端'"></h2>
    <a class="fr fan" href="/Ytj/GsYw">返回首页</a>
</header>

<div class="text-left" style="display:none">
    <span style="color: darkred">打印纸盒选择？</span>
    <label>
        <input type="radio" name="ChoiceTray" value="0"> 默认纸盒
    </label>
    <label>
        <input type="radio" name="ChoiceTray" value="1" checked> 使用纸盒1
    </label>
    <label>
        <input type="radio" name="ChoiceTray" value="2"> 使用纸盒2
    </label>
    <label>
        <input type="radio" name="ChoiceTray" value="3"> 使用纸盒3
    </label>
    <label>
        <input type="radio" name="ChoiceTray" value="4"> 使用纸盒4
    </label>
    <label>
        <input type="radio" name="ChoiceTray" value="5"> 使用手动送纸盒
    </label>
</div>
<div class="text-left"  style="display:none">
    <span style="color: darkred">选择纸张规格？</span>
    <label>
        <input type="radio" name="ChoicePaper" value="0" > A4
    </label>
    <label>
        <input type="radio" name="ChoicePaper" value="1" checked> A3
    </label>
</div>



<div class="content">
    <div class="bg_white" id="PhotoContent">
        <div class="fl zheng" style="position:relative">
            <!-- <img src="/Content/images/zheng.png"/>-->
            <div id="myPrintArea" style="width:800px;height:600px;margin-top:50px;background-image:url(/Content/images/Print_YYZZNew.jpg);background-size:100% auto;background-repeat:no-repeat;padding-left:80px;padding-top:80px;">
                <div id="content" style="margin-top:80px;margin-left:10px;text-align:left;width:90%">
                    <div style="margin-left:0px;" class="fontSize"><strong>统一社会信用代码</strong><br /><span id="XinYongCode"></span></div>

                    <div style="position: absolute; top: 210px; float: right; right:140px;"><div id="ErWeiMaBase64"></div></div>

                    <table cellspacing="0" class="fontSize" align="center" border="0" style="margin-bottom:20px;width:99%;margin-top:25px; ">
                        <tr>
                            <td style="height:10px;width:120px;"><strong>经&nbsp;营&nbsp;者</strong></td>
                            <td align="left"><span id="JingYingRen"></span></td>
                            <td style="height:10px;"><strong>经营场所</strong></td>
                            <td align="left"><span id="JingYingChangSuo"></span></td>
                        </tr>

                        <tr>
                            <td style="height:10px;"><strong>名&nbsp;&nbsp;&nbsp;&nbsp;称</strong></td>
                            <td align="left"><span id="zwzh"></span></td>
                            <td style="height:10px;"><strong>组成形式</strong></td>
                            <td align="left"><span id="ZuChengXingShi"></span></td>
                        </tr>

                        <tr>
                            <td style="height:10px;"><strong>类&nbsp;&nbsp;&nbsp;&nbsp;型</strong></td>
                            <td align="left"><span id="ScZtType"></span></td>
                            <td style="height:10px;"><strong>注册日期</strong></td>
                            <td align="left"  ><span id="ShenQingDate"></span></td>
                        </tr>
                        <tr>
                            <td style="height:10px;"><strong>经营范围</strong></td>
                            <td align="left"><div style="width:200px;"><span id="JingYingFanWei"></span></div></td>
                        </tr>
                    </table>



                    <div style="margin-left:509px;margin-top:128px;width:104px;" class="fontSize">
                        <div style="float:left;"><span id="Nian"></span></div>
                        <div style="float:left;margin-left:32px;"><span id="Yue"></span></div>
                        <div style="float:right;margin-left:10px;"><span id="Ri"></span></div>
                    </div>

                </div>
            </div>
            <input type="button" class="btn-orange" style="margin-top:700px;"  onclick="printweb2('1')" id="printA" value="打印正本" />
        </div>

        <div class="fl zheng" style="position:relative">
            <!--<img src="/Content/images/zheng.png"/>-->
            <div id="myPrintArea1" style="width:800px;height:600px;margin-top:50px;background-image:url(/Content/images/Print_YYZZNew.jpg);background-size:100% auto;background-repeat:no-repeat;padding-left:80px;padding-top:80px;">
                <div id="content1" style="margin-top:50px;margin-left:10px;text-align:left;width:90%">
                    <div class="fontSize">副本编号:1-1</div>
                    <div style="margin-left:0px;" class="fontSize"><strong>统一社会信用代码</strong><br /><span id="XinYongCode1"></span></div>


                    <div style="position: absolute; top: 220px; float: right; right:140px;"><div id="ErWeiMaBase641"></div></div>


                    <table cellspacing="0" class="fontSize" align="center" border="0" style="margin-bottom:20px;width:99%;margin-top:25px; ">
                        <tr>
                            <td style="height:10px;width:120px;"><strong>经&nbsp;营&nbsp;者</strong></td>
                            <td align="left"><span id="JingYingRen1"></span></td>
                            <td style="height:10px;"><strong>经营场所</strong></td>
                            <td align="left"><span id="JingYingChangSuo1"></span></td>
                        </tr>

                        <tr>
                            <td style="height:10px;"><strong>名&nbsp;&nbsp;&nbsp;&nbsp;称</strong></td>
                            <td align="left"><span id="zwzh1"></span></td>
                            <td style="height:10px;"><strong>组成形式</strong></td>
                            <td align="left"><span id="ZuChengXingShi1"></span></td>
                        </tr>

                        <tr>
                            <td style="height:10px;"><strong>类&nbsp;&nbsp;&nbsp;&nbsp;型</strong></td>
                            <td align="left"><span id="ScZtType1"></span></td>
                            <td style="height:10px;"><strong>注册日期</strong></td>
                            <td align="left"><span id="ShenQingDate1"></span></td>
                        </tr>
                        <tr>
                            <td style="height:10px;"><strong>经营范围</strong></td>
                            <td align="left"><div style="width:200px;"><span id="JingYingFanWei1"></span></div></td>
                        </tr>
                    </table>



                    <div style="margin-left:509px;margin-top:138px;width:104px;" class="fontSize">
                        <div style="float:left;"><span id="Nian1"></span></div>
                        <div style="float:left;margin-left:33px;"><span id="Yue1"></span></div>
                        <div style="float:right;margin-left: 0px;"><span id="Ri1"></span></div>
                    </div>

                </div>
            </div>
            <input type="button" class="btn-orange" style="margin-top:700px;" onclick="Print('0')" id="printB" value="打印副本" />
        </div>
    </div>
</div>

<div class="footer"> <span>技术支持：石家庄开发区亿网科技发展有限公司</span> </div>
<div style="position:absolute;right:5%;bottom:30px;">
    <span class="fl dao" id="agree_btn">本页将在60秒后返回首页</span>
</div>
<th:block th:include="include :: footer" />
<script>
    var secs = 180;
    //document.agree.agreeb.disabled=true;
    for (var i = 0; i <= secs; i++) {
        window.setTimeout("update(" + i + ")", i * 1000);
    }
    function update(num) {
        if (num == secs) {
            // 超时返回到首页
            // window.href = "../../index.html";
            location.href = "/Ytj/GsYw";

        }
        else {
            var printnr = secs - num;
            //document.agree.agreeb.value = "本页受理倒计时:" + printnr+"秒！";
            //document.agree.agreeb.innerHTML = "本页受理倒计时:" + printnr+"秒！";

            var testdiv = document.getElementById("agree_btn");
            testdiv.innerHTML = "本页将在" + printnr + "秒后返回首页";
        }
    }

    function showtime(t) {
        document.myform.phone.disabled = true;
        for (i = 0; i <= t; i++) {
            window.setTimeout("update_p(" + i + "," + t + ")", i * 1000);
        }

    }
    function goBack() {

        history.go(-1);
    }



</script>
<div id="YinCangPrint" name="YinCangPrint" style="display:none"></div>
</body>
</html>
