<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" s>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>才虎账本</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link href="../Content/Default/jquery-ui-1.8.10.custom.css" rel="stylesheet" type="text/css" />
    <link href="../Content/Default/linkbutton.css" rel="stylesheet" type="text/css" />
    <link href="../Content/Default/panel.css" rel="stylesheet" type="text/css" />
    <link href="../Content/Default/tabs.css" rel="stylesheet" type="text/css" />
    <link href="../Content/style.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/lib/jquery-1.4.4.min.js" type="text/javascript"></script>
    <script src="../Scripts/lib/jquery-ui-1.8.10.custom.min.js" type="text/javascript"></script>
    <script src="../Scripts/lib/jquery.linkbutton.js" type="text/javascript"></script>
    <script src="../Scripts/lib/jquery.panel.js" type="text/javascript"></script>
    <script src="../Scripts/lib/jquery.tabs.js" type="text/javascript"></script>
    <script src="../Scripts/jsmaincommon_esayui.js" type="text/javascript"></script>
    <script src="../Scripts/lib/jquery.menu.js" type="text/javascript"></script>
    <script src="../Scripts/common.js" type="text/javascript"></script>
    <script src="../Scripts/p00.js" type="text/javascript"></script>
    <script src="../Scripts/msgBox.js" type="text/javascript"></script>
    <script src="../Scripts/p0704.js" type="text/javascript"></script>
    <script src="../Scripts/msg.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            //获得浏览器的版本
            var retIEVersion = ParseData(window.external.DoOptions("TXtsz", "DoOthers", '{"option":"11"}'));
            if ('0' == retIEVersion.ReturnCode) {
                ieVersion = retIEVersion.Version.toString().substr(0, 3);
            }
            //var arrIndex = [["采购报表"], ["销售报表"], ["纯销报表"], ["库存报表"], ["发票报表"], ["财务报表"]];
            arrIndex = new Array({ id: '0', name: '采购报表', sub: [] },
                                 { id: '1', name: '销售报表', sub: [] },
                                 { id: '2', name: '纯销报表', sub: [] },
                                 { id: '3', name: '库存报表', sub: [] },
                                 { id: '4', name: '发票报表', sub: [] },
                                 { id: '5', name: '财务报表', sub: [] });
            arrIndex = eval(arrIndex);
            //动态创建菜单//Json数据源//{"gettype":0    //0全部，1菜单 2 报表}
            var arrMenu = window.external.DoOptions('TSAMS_Menus', 'GetMainMenu', '{"gettype":0}');
            arrMenu = eval(arrMenu);
            //用于存储报表链接信息
            var arrReports = "[";

            //变量定义
            var strApp = "";
            //没有菜单项，直接退出
            if (!arrMenu) {
                return false;
            }
            //循环创建Menu菜单
            for (var i = 0; i < arrMenu.length; i++) {
                //创建报表链接
                //arrReports += "{\"id\":\"cggl\",\"name\":\"采购\",\"url\":\"#\",\"sub\":[";
                strApp = "<li id='li_" + arrMenu[i]["id"] + "' class=\"MNav\">";
                strApp += "<a class=\"downcd\" href=\"#\">" + arrMenu[i]['name'] + "</a>";
                strApp += "<div class=\"subnav\" id='ul_" + arrMenu[i]['id'] + "'></div>";
                strApp += "</li>";

                //添加顶级菜单
                $("#topnav").append(strApp);
                //如果包含子菜单，创建子菜
                if (arrMenu[i]['sub'].toString() != "") {
                    strApp = "<ul class=\"navlist\">";
                    for (var j = 0; j < arrMenu[i]['sub'].length; j++) {
                        //报表链接
                        if ('2' == arrMenu[i]['sub'][j]['a7'] && arrIndex.length > i) {
                            arrIndex[i]['sub'].push(arrMenu[i]['sub'][j]);
                            //报表，字体颜色做一些特殊处理
                            //strApp += "<li id='li_" + arrMenu[i]['id'] + "'> ";
                            strApp += "<li id='li_" + arrMenu[i]['sub'][j]['id'] + "'> ";
                            strApp += "<a class='by_bg' href='#'";
                            strApp += " onclick= \"javascript:AddTab('" + arrMenu[i]['sub'][j]['name'] + "','" + arrMenu[i]['sub'][j]['url'] + "','" + arrMenu[i]['sub'][j]['id'] + "')\"";
                        }
                        else {
                            //strApp += "<li id='li_" + arrMenu[i]['id'] + "'> ";
                            strApp += "<li id='li_" + arrMenu[i]['sub'][j]['id'] + "'> ";
                            strApp += "<a href='#'";
                            //如果是修改密码，不创建Tab，创建Dialog
                            //修改密码
                            if (arrMenu[i]['sub'][j]['url'] == "07/p0704.htm") {
                                strApp += " onclick= \"javascript:alterItemP0704()\"";
                            }
                            //关于我们
                            else if (arrMenu[i]['sub'][j]['url'] == "09/p0902.htm") {
                                strApp += " onclick= \"javascript:openP0902()\"";
                            }
                            //软件升级
                            else if (arrMenu[i]['sub'][j]['url'] == "09/p0903.htm") {
                                strApp += "onclick=\"javascript:softUp()\"";
                            }
                            //用户反馈
                            else if (arrMenu[i]['sub'][j]['url'] == "09/p0906.htm") {
                                strApp += " onclick= \"javascript:openP0906()\"";
                            }
                            else {
                                strApp += " onclick= \"javascript:AddTab('" + arrMenu[i]['sub'][j]['name'] + "','" + arrMenu[i]['sub'][j]['url'] + "','" + arrMenu[i]['sub'][j]['id'] + "')\"";
                            }
                        }
                        strApp += " >" + arrMenu[i]['sub'][j]['name'] + "</a></li>";
                    }
                    strApp += "</ul>";

                    $("#ul_" + arrMenu[i]['id']).append(strApp);
                }
                //报表
                //arrReports += "]}";
            } //End of for
            //arrReports += "]";
        });
    </script>
</head>
<body>
    <!-- Tab标签的右键菜单 -->
    <div id="mm" class="right_menu">
        <ul>
            <li id="mm-tabclose"><a href="#">关闭</a></li>
            <li id="mm-tabcloseall"><a href="#">关闭全部</a></li>
            <li id="mm-tabcloseother"><a href="#">关闭其他</a></li>
            <li id="mm-tabcloseright"><a href="#">关闭右侧</a></li>
            <li id="mm-tabcloseleft"><a href="#">关闭左侧</a></li>
        </ul>
    </div>
    <div class="header">
        <div class="block_header">
            <div class="logo">
                <a>
                    <img src="../Content/Default/images/logo.gif" width="200" height="75" border="0"
                        alt="logo" /></a>
            </div>
            <div class="menu">
                <ul class="topnav" id="topnav">
                </ul>
            </div>
            <div class="clr">
            </div>
        </div>
    </div>
    <!--Tab 容器-->
    <div id="idTabsContent">
    </div>
    <!--页脚 版权信息-->
    <div class="footer">
        <div class="resize">
            版权所有：才虎网络技术有限公司 官网：www.ciho.com.cn</div>
    </div>
    <!--修改密码窗口-->
    <div id="divMimalog">
    </div>
    <!--消息提示窗口-->
    <div id="divMessage">
    </div>
    <!--关于我们窗口-->
    <div id="divP0902">
    </div>
    <!--用户反馈窗口-->
    <div id="divP0906">
    </div>
    <!-- 创建MsgBox dialog-->
    <div id="divMsgBox" style="margin: 0px; padding: 0px; z-index: 10000000;">
    </div>
</body>
</html>
<script type="text/javascript">
    $(function () {
        //创建Tab容器
        var iHeight = window.parent.document.documentElement.clientHeight - _iHtMenu - _iHtCopyright;
        var strTabContent = "";
        strTabContent += "        <div id=\"tabs\" class=\"easyui-tabs\" fit=\"true\" border=\"false\" style=\"width:100%;height:" + iHeight + "px;\">";
        //strTabContent += "            <div id=\"p02\" title=\"报表中心\" style=\"overflow: hidden;\">";
        strTabContent += "            <div id=\"p01\" title=\"首页\" style=\"overflow: hidden;\">";
        //生成tab标签时，设定IFrame的高度 = 窗口高度 - menu高度 - 底部高度 - tab标签高度
        var iFrmHeight = window.parent.document.documentElement.clientHeight - window.parent._iFrmHeight;
        strTabContent += "<iframe scrolling=\"no\" id=\"idIframe-p01\" frameborder=\"0\" align=\"center\"  src=\"\" style=\"width:100%;height:\"" + iFrmHeight + "px;\"></iframe>";
        strTabContent += "<iframe scrolling=\"no\" id=\"idIframe-p02\" frameborder=\"0\" align=\"center\"  src=\"\" style=\"width:100%;height:\"" + iFrmHeight + "px;\"></iframe>";
        strTabContent += "            </div>";
        strTabContent += "        </div>";

        $("#idTabsContent").append(strTabContent);
        $("#tabs").height(iHeight)
            .tabs({
                onClose: function (title, id) {
                    $("#" + id).find("iframe").attr('src', 'javascript:false');
                    $("#" + id).find("iframe").remove();
                    if (CollectGarbage) {
                        setTimeout(CollectGarbage, 10);
                    }
                    //关闭Tab标签时，减少Tab标签的计数。
                    tab_counter--;
                    //释放内存
                    var ret = ParseData(window.external.DoOptions("TXtsz", "DoOthers", '{"option":"14"}'));
                },
                onSelect: function (title, spanId) {
                    //给Tab标签增加Id属性
                    $(".tabs").find("span").each(function () {
                        if ($(this).text() == title) {
                            $(this).attr("id", "span_" + spanId);
                        }
                    })
                    //如果基本资料数据有变动，刷新combobox的数据
                    refreshCombobox(spanId);
                    refreshInfo();
                }
            });

        //Menu:添加鼠标over显示菜单事件
        $("#topnav>li").each(function () {
            $(this).mouseover(function () {
                $("#topnav .subnav").css("display", "none");
                $(this).find("div").css("display", "block");
            });
            //            $(this).click(function () {
            //                $("#topnav .subnav").css("display", "none");
            //            });
            $(this).mouseout(function () {
                $("#topnav .subnav").css("display", "none");
            });

            $(this).hover(function () {
                //清空所有主menu底色，字体恢复成墨色。
                $(".menu li").css("background", "none");
                $(".menu li").find(".downcd").css("color", "#737373");

                $(this).css("background", "url(../Content/Default/images/menu_btn.png)");
                $(this).find(".downcd").css("color", "#FFFFFF");
            }, function () {
                $(this).css("background", "none");
                $(this).find(".downcd").css("color", "#737373");
            });

        });
        //给menu下拉菜单添加点击事件，点击关闭下拉菜单
        $('#topnav .navlist').each(function () {
            $(this).click(function () {
                $("#topnav .subnav").css("display", "none");
            });
        });

        //Tab右键菜单
        $('#mm').menu()
            .hover(function () {
            },
            function () {
                $(this).hide();
            });
        $('#mm>ul>li').click(function () {
            $('#mm').hide();
        });

        //首页
        $(window.document).find("#idIframe-p01").attr("src", "p01.htm");
        //设定所有IFrame的高度
        var iFrmHeight = window.parent.document.documentElement.clientHeight - window.parent._iFrmHeight;
        $("#tabs").find("iframe").height(iFrmHeight);

        window.onresize = function () {
            //设定Tab 容器的高度
            var iHeight = window.parent.document.documentElement.clientHeight - _iHtMenu - _iHtCopyright;
            $("#tabs").height(iHeight);
            //设定所有IFrame的高度
            var iFrmHeight = window.parent.document.documentElement.clientHeight - window.parent._iFrmHeight;
            $("#tabs").find("iframe").height(iFrmHeight);
            //调整tab的大小，（使滚动按钮适应窗口）
            $('#tabs').tabs('resize');
            //点击当前选中Tab，触发select事件->onResize事件。
            $(".tabs-selected").click();

            //调整弹出窗口遮罩层的高度
            $('.menu_dlg_shield').height(window.parent.document.documentElement.clientHeight);
            $('.menu_dlg_bg').css("height", window.parent.document.documentElement.clientHeight); //调整弹出所属窗口层的高度
        }

        //画面加载完成后，加载共通信息。
        $(window).load(function () {
            //取得所有combobox的信息
            getAllComboData();
            //数据允许录入的最早时间，最晚时间。
            var _objDate = ParseData(window.external.DoOptions("TXtsz", "DoOthers", '{"option":"1"}'));
            if (0 == _objDate.ReturnCode) {
                _startDate = _objDate.sDate.replace(/\//g, "-");
                _endDate = _objDate.eDate.replace(/\//g, "-");
            }
            //获得常规设置的值
            var objSysConf = ParseData(window.external.DoOptions("TXtsz", "GetList", "{}"));
            for (var i = 0; i < objSysConf.Records.length; i++) {
                switch (objSysConf.Records[i]["a2"]) {
                    case "pagecount":
                        iRowsPerPage = objSysConf.Records[i]["a3"]; //每页默认显示多少行记录。
                        break;
                    case "isshowtip":
                        if (objSysConf.Records[i]["a3"] != "true") {
                            bShowMsgOfMoney = false; //单据金额和收付金额不一致时,true:提示用户； false:不提示用户。
                        }
                        break;
                    case "number":
                        strCountPlace = objSysConf.Records[i]["a3"];  //数量小数位数
                        break;
                    case "money":
                        strPricePlace = objSysConf.Records[i]["a3"];   //单价小数位数（该项与金额相同）
                        strMoneyPlace = objSysConf.Records[i]["a3"];  //金额小数位数
                        break;
                    case "percent":
                        strPercentPlace = objSysConf.Records[i]["a3"]; //百分比小数位数
                        break;
                    case "starttime":
                        strOpratDate = objSysConf.Records[i]["a3"];    //系统启用时间
                        break;
                    case "SoftID":
                        SoftID = objSysConf.Records[i]["a3"];
                        break;
                }
            }
            objLoginInfo = ParseData(window.external.DoOptions("TSAMS_Menus", "GetUserInfo", "{}"));    //操作员信息
            //获得版本信息
            var objVer = ParseData(window.external.DoOptions("TXtsz", "DoOthers", '{"option":"13"}'));
            if (objVer.ReturnCode == '0') {
                strVer = objVer.Version;
            }
        });
    });
</script>
