<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SellsTheSupplierInfoFrame.aspx.cs" Inherits="M_Main.ChargesNew.SellsTheSupplierInfoFrame" %>

<!DOCTYPE html>

<%--<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>销方信息维护</title>
    <script src="../jscript/jquery-1.11.3.min.js"></script>
    <style type="text/css">
        body {
            margin: 0px;
            margin-top: 0px;
            overflow: hidden;
            background-color: #ffffff;
        }

        .Container {
            width: 100%;
            font-size: 12px;
            font-family: 微软雅黑;
        }

        .ContainerLeft {
            float: left;
            overflow-y: auto;
            border-right: 1px solid #cccccc;
        }

        .ContainerRight {
            float: left;
            width: 70%;
            overflow: auto;
        }
    </style>
</head>
<body>

    <div class="Container">
        <div id="ContainerLeft" class="ContainerLeft">
            <iframe src="EInvoiceCorpCostTree.aspx" id="EInvoiceCorpCostTree" name="EInvoiceCorpCostTree" style="border: none; width: 100%;"></iframe>
        </div>
        <div id="ContainerRight" class="ContainerRight">
            <iframe src="EInvoiceSellsManage.aspx" id="EInvoiceSellsManage" name="EInvoiceSellsManage" style="border: none; width: 100%;"></iframe>
        </div>
    </div>
    <script type="text/javascript">

        function InitFunction() {
            var h = $(window).height();
            var w = $(window).width() * 0.30 - 1;
            $("#EInvoiceCorpCostTree").css("width", w + "px");
            $("#EInvoiceCorpCostTree").css("height", h + "px");
            $("#EInvoiceSellsManage").css("height", h + "px");
        }
        InitFunction();
    </script>
</body>
</html>--%>

<html>
<head id="Head1" runat="server">
    <title></title>
    <script type="text/javascript" src="../Jscript-Ui/jquery-easyui-1.4.4/jquery.min.js"></script>
    <script src="../jscript/jquery.tool.js" type="text/javascript"></script>
    <script src="../jscript/JSClient.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="../Jscript-Ui/jquery-easyui-1.4.4/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../Jscript-Ui/jquery-easyui-1.4.4/themes/icon.css">
    <script type="text/javascript" src="../Jscript-Ui/jquery-easyui-1.4.4/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../Jscript-Ui/jquery-easyui-1.4.4/locale/easyui-lang-zh_CN.js"></script>
    <script src="../jscript/Dialog.js" type="text/javascript"></script>
    <link href="../css/button.css" type="text/css" rel="stylesheet" />

    <script type="text/javascript" src="../Jscript-Ui/JQForm/JQForm.js"></script>
    <script type="text/javascript" src="../Jscript-Ui/hplus/js/plugins/layer/layer.min.js"></script>

    <link href="../css/framesearch.css" type="text/css" rel="stylesheet" />

    <script type="text/javascript" src="../jscript/jquery.ztree.core-3.5.js"></script>
    <link href="../css/style.css" type="text/css" rel="stylesheet" />
    <link href="../css/zTreeStyle/zTreeStyle.css" type="text/css" rel="stylesheet" />
    <link href="../css/workflow.css" type="text/css" rel="stylesheet" />
    <script src="../jscript/DateFormat.js" type="text/javascript"></script>
    <script src="../jscript/CloseAjaxCache.js" type="text/javascript"></script>
    <style type="text/css">
        body {
            margin: 0px;
            margin-top: 0px;
            overflow: hidden;
            font-family: 微软雅黑;
            background-color: #ffffff;
        }

        .Container {
            width: 100%;
            height: auto;
            font-size: 12px;
            font-family: 微软雅黑;
        }

        .ContainerLeft {
            float: left;
            width: 25%;
            padding-right: 5px;
            overflow-y: auto;
            border-right: 1px solid #cccccc;
        }

        .ContainerRight {
            float: left;
            width: 73.5%;
        }

        textarea {
            height: 22px;
            resize: none;
            border: 1px solid #cccccc;
            width: 200px;
        }
    </style>
</head>
<body>
    <form id="frmForm" runat="server">

        <%-- <div id="SearchDlg" class="easyui-dialog" title="筛选条件" data-options="iconCls:'icon-search',closed: true,modal:true" style="width: 500px; height: 140px; padding: 10px;">
            <table style="width: 100%; font-size: 12px; font-family: 微软雅黑;">
                <tr>
                    <td class="TdTitle">所属项目</td>
                    <td class="TdContent">
                        <textarea id="CostName" name="CostName" class="easyui-validatebox" onclick="SelCost();"></textarea>
                        <input id="CorpCostID" name="CorpCostID" value="" type="hidden" />
                    </td>
                </tr>
                <tr style="height: 10px;">
                    <td></td>
                    <td></td>
                </tr>
                <tr>
                    <td colspan="8" align="center"><a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="LoadList();">确定筛选</a>
                        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'" onclick="btnClear();">清空</a>
                    </td>
                </tr>
            </table>
        </div>--%>

        <div class="Container">
            <div id="ContainerLeft" class="ContainerLeft" style="height: 500px;">
                <div id="TableContainerTree">
                </div>
            </div>
            <div id="ContainerRight" class="ContainerRight">
                <div style="background-color: #cccccc;" id="TableContainer">
                </div>
            </div>
        </div>

        <input id="hidID" type="hidden" size="2" name="hidID" runat="server" />
        <input id="OrganCode" type="hidden" size="2" name="OrganCode" runat="server" />
        <input id="OrganName" type="hidden" size="2" name="OrganName" runat="server" />
        <input id="InPopedom" type="hidden" name="InPopedom" runat="server" />
        <input id="TaxRateSettingID" type="hidden" name="TaxRateSettingID" runat="server" />
        <script type="text/javascript">
            //选择费用科目
            function SelCost() {
                HDialog.Open('700', '450', "../dialogNew/MultiCorpCostDlg.aspx" + "?Ram=" + Math.random(), '收费项目选择', false, function (_data) {
                    var varReturn = _data;
                    if (varReturn != "") {//**获得返回 刷新
                        var varObjects = varReturn.split("\t");
                        $("#CorpCostID").val(varObjects[0]);
                        $("#CostName").val(varObjects[1]);
                    }
                });
            }

            function btnClear() {
                $("#CorpCostID").val('');
                $("#CostName").val('');
            }

            var column;
            column = [[
                {
                    field: 'text', title: '项目列表', align: 'left', sortable: true,
                    formatter: function (value, row, index) {
                        var str = "<a class=\"HrefStyle\" href=\"#\">" + row.text + "</a>";
                        return str;
                    }
                },
                {
                    field: 'InPopedom', title: '项目ID', align: 'left', formatter: function (value, row, index) {
                        var str = row.attributes.InPopedom;
                        if (str == 0) str = '';
                        return str;
                    }
                }
            ]];

            var IsCollapseAll = false;
            var toolbar = [
                {
                    text: '展开/折叠',
                    iconCls: 'icon-redo',
                    handler: function () {
                        if (IsCollapseAll == true) {
                            $('#TableContainerTree').treegrid('expandAll');
                            IsCollapseAll = false;
                        }
                        else {
                            $('#TableContainerTree').treegrid('collapseAll');
                            IsCollapseAll = true;
                        }
                    }
                }
            ];

            function LoadListTree() {
                $("#TableContainerTree").treegrid({
                    url: '/HM/M_Main/HC/DataGetControl.aspx?Method=DataGet&Class=Organ&Command=GetOrganTreeGridList&' + $('#frmForm').serialize(),
                    treeField: 'text',
                    idField: 'id',
                    method: "get",
                    nowrap: false,
                    pageSize: top.ListPageSize,
                    pageList: top.ListPageList,
                    columns: column,
                    fitColumns: true,
                    singleSelect: true,
                    remoteSort: false,
                    pagination: false,
                    rownumbers: true,
                    IsCustomHead: false,
                    cascadeCheck: false,
                    width: "100%",
                    toolbar: toolbar,
                    border: false,
                    sortOrder: "asc",
                    onClickRow: function (node) {
                        //$("#OrganCode").val(node.attributes.OrganCode);
                        if (parseInt(node.attributes.InPopedom) > 0) {
                            $("#InPopedom").val(node.attributes.InPopedom);
                            $("#OrganName").val(node.text);
                        } else {
                            $("#InPopedom").val('');
                            $("#OrganName").val('');
                        }
                        LoadList();
                    }
                });
            }
            LoadListTree();

            function InitFunction() {
                var h = $(window).height();
                $("#ContainerLeft").css("height", h + "px");
                $("#ContainerRight").css("height", h + "px");
                $("#TableContainer").css("height", h + "px");
            }
            InitFunction();

            var toolbar = [
                {
                    text: '新增',
                    iconCls: 'icon-add',
                    handler: function () {
                        if ($("#InPopedom").val() == "" || $("#InPopedom").val() == null || $("#InPopedom").val() == undefined || $("#InPopedom").val() == 0) {
                            HDialog.Info("请选择要设置销方的项目");
                        } else {
                            HDialog.Open('700', '580', '../ChargesNew/EInvoiceSellsManage.aspx?OpType=insert&CommID=' + $("#InPopedom").val() + '&CommName=' + encodeURI($("#OrganName").val()), '新增增值税税率', true,
                                function callback(_Data) {
                                    if (_Data == "true") {
                                        LoadList();
                                    }

                                });
                        }
                    }
                }, '-',
                {
                    text: '删除',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        var row = $("#TableContainer").datagrid("getSelected");
                        if (row != null && row != undefined && row != "") {
                            DelRecord(row.ID);
                        } else {
                            HDialog.Info("请选择一行数据进行删除！");
                        }
                    }
                }, '-',
                {
                    text: '修改',
                    iconCls: 'icon-edit',
                    handler: function () {
                        var row = $("#TableContainer").datagrid("getSelected");
                        if (row != "" && row != null && row != undefined) {
                            HDialog.Open('700', '580', '../ChargesNew/EInvoiceSellsManage.aspx?OpType=edit&ID=' + row.ID + '&CommID=' + $("#InPopedom").val() + '&CommName=' + encodeURI($("#OrganName").val()), '修改销方信息', true,
                                function callback(_Data) {
                                    if (_Data == "true") {
                                        LoadList();
                                    }
                                });
                        }
                        else {
                            HDialog.Info("请选择一行数据进行修改！");
                        }
                    }
                }

            ];

            function DelRecord(ID) {
                $.messager.confirm('确定', '是否删除该项', function (r) {
                    if (r) {
                        $.tool.DataGet('EInvoiceManage', 'DeleteSells', 'ID=' + ID,
                            function Init() {
                            },
                            function callback(_Data) {
                                if (_Data == "false") {
                                    HDialog.Info("请有效期内已产生应收，不允许删除税率");
                                } else {
                                    LoadList();
                                }
                            },
                            function completeCallback() {
                            },
                            function errorCallback() {
                            });
                    }
                });
            }


            var column = [[
                { field: 'ID', title: 'ID', width: 25, align: 'left', sortable: true, hidden: true },
                { field: 'CorpCostID', title: 'CorpCostID', width: 25, align: 'left', sortable: true, hidden: true },
                { field: 'OrganName', title: '区域名称', width: 120, align: 'left', sortable: true },
                { field: 'CommName', title: '项目名称', width: 120, align: 'left', sortable: true },
                { field: 'CostName', title: '费用科目', width: 120, align: 'left', sortable: true },
                {
                    field: 'VATType', title: '税控类别', width: 120, align: 'left', sortable: true,
                    formatter: function (value, row, index) {
                        var str = '';
                        if (row.VATType == "1") {
                            str = '百旺税控盘';
                        }
                        if (row.VATType == "2") {
                            str = '航天金税盘';
                        }
                        return str;
                    }
                },
                { field: 'skpbh', title: '税控盘编号', width: 120, align: 'left', sortable: true },
                { field: 'skpkl', title: '开票终端标识', width: 120, align: 'left', sortable: true },
                { field: 'xhdwsbh', title: '销货单位识别号', width: 150, align: 'left', sortable: true },
                { field: 'xhdwmc', title: '销货单位名称', width: 150, align: 'left', sortable: true },
                { field: 'xhdwdzdh', title: '销货单位地址电话', width: 150, align: 'left', sortable: true },
                { field: 'xhdwyhzh', title: '销货单位银行帐号', width: 150, align: 'left', sortable: true },
                { field: 'SpecialTicketAmount', title: '专票限额', width: 120, align: 'left', sortable: true },
                { field: 'GeneralTicketAmount', title: '普票限额', width: 120, align: 'left', sortable: true }
            ]];

            function LoadList() {
                $("#TableContainer").datagrid({
                    url: '/HM/M_Main/HC/DataPostControl.aspx',
                    method: "post",
                    nowrap: false,
                    pageSize: top.ListPageSize,
                    pageList: top.ListPageList,
                    columns: column,
                    remoteSort: false,
                    fitColumns: false,
                    rownumbers: true,
                    singleSelect: true,
                    selectOnCheck: false,
                    checkOnSelect: false,
                    pagination: true,
                    width: "100%",
                    border: false,
                    toolbar: toolbar,
                    border: false,
                    sortOrder: "asc",
                    onBeforeLoad: function (param) {
                        param = $.JQForm.GetParam("EInvoiceManage", "GetEInvoiceSellsList", "TableContainer", param);
                    },
                });
            }
            LoadList();


        </script>
    </form>
</body>
</html>

