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

<!DOCTYPE html>

<html>
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>自动开票设置</title>
    <script language="javascript" src="../jscript/ajax.js"></script>
    <script type="text/javascript" src="../Jscript-Ui/jquery-easyui-1.4.4/jquery.min.js"></script>
    <script src="../jscript/JSClient.js" type="text/javascript"></script>
    <script src="../jscript/jquery.tool.new.js" type="text/javascript"></script>
    <link href="../css/framesearch_old.css" type="text/css" rel="stylesheet" />
    <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>
    <link href="../css/framesearch.css" type="text/css" rel="stylesheet" />
    <script src="../jscript/Dialog.js" type="text/javascript"></script>

    <link href="../css/framesearch.css" type="text/css" rel="stylesheet" />
    <link href="../css/button.css" rel="stylesheet" />
    <script src="../jscript/DateFormat.js" type="text/javascript"></script>
    <script src="../jscript/format.js" type="text/javascript"></script>
    <script type="text/javascript" src="../jscript/DatePicker/WdatePicker.js"></script>
    <script type="text/javascript" src="../Jscript-Ui/JQForm/JQForm.js"></script>
    <style>
        body {
            overflow-y: scroll;
        }

        #CommNames {
            width: 87%;
            height: 60px;
            border: 1px solid #cccccc;
            font-size: 12px;
            padding: 2px;
            resize: none;
        }

        .TdTitle {
            height: 16px;
            width: 11%;
            text-align: center;
        }

        .TdContentSearch {
            height: 16px;
            width: 14%;
            text-align: left;
        }
    </style>
</head>
<body>
    <form id="frmForm" method="post" runat="server">
        <input id="ID" name="ID" type="hidden" runat="server" value="" />
        <input type="hidden" id="CorpCostIDs" name="CorpCostIDs" runat="server" />
        <table class="DialogTable" id="Table1">
            <tr>
                <td colspan="4"></td>
            </tr>
            <tr>
                <td class="TdTitle">项目名称</td>
                <td class="TdContentSearch" colspan="3">
                    <input id="hiOPType" style="width: 32px; height: 22px" type="hidden" size="1" name="hiOPType" runat="server">
                    <textarea id="CommNames" name="CommNames" runat="server" onclick="SelComm();"></textarea>
                    <input id="CommIDs" name="CommIDs" value="" type="hidden" runat="server" />
                </td>
            </tr>
            <tr>
                <td class="TdTitle">本月末不能开票天数</td>
                <td class="TdContentSearch" colspan="3">
                    <input id="EndOfMonthNotEInvoiceDays" class="easyui-textbox" name="EndOfMonthNotEInvoiceDays" runat="server" />
                </td>
            </tr>
            <tr>
                <td class="TdTitle">是否允许自动开票</td>
                <td class="TdContentSearch">
                    <select id="IsAutoEInvoice" name="IsAutoEInvoice" runat="server">
                        <option value="1" selected>是</option>
                        <option value="0">否</option>
                    </select>
                </td>

            </tr>


        </table>

        <div style="text-align: center; bottom: 0; position: fixed; width: 100%; height: 60px; line-height: 20px; background-color: #f5f5f5; margin-right: 45px;">
            <table class="DialogTable" id="Table6">
                <tr>
                    <td style="text-align: center;" class="DialogTdSubmit">
                        <input class="button" id="btnSave" type="button" value="保存" name="btnSave" runat="server">
                        <input id="btnReturn" type="button" value="关闭" name="btnReturn" runat="server" class="button">
                    </td>
                </tr>
            </table>
        </div>
    </form>

    <script type="text/javascript">
        $(function () {
            $('#EndOfMonthNotEInvoiceDays').textbox('textbox').bind({ input: change });
            function change() {
                this.value = (this.value.match(/\d{1,8}(\.\d{0,2})?/) || [''])[0];
            }
        });


        function SelComm() {
            var w = $(window).width();
            HDialog.Open(w, 500, '../DialogNew/SelComm.aspx?IsCheck=1', "选择管理项目", false, function callback(_Data) {
                var arrRet = JSON.parse(_Data);
                $("#CommIDs").val(arrRet.id);
                $("#CommNames").val(arrRet.name);
            });
        }

        //选择费用科目
        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");
                        $("#CorpCostIDs").val(varObjects[0]);
                        $("#CostName").val(varObjects[1]);
                    }
                });
        }


        $("#btnSave").click(function () {
            if (!$("#CommNames").val()) {
                HDialog.Info("管理项目为必填项！！！");
                return;
            }

            $.tool.DataPostChk('frmForm', 'EInvoiceManage', "AutoEInvoiceSet", $('#frmForm').serialize(),
                function Init() {
                },
                function callback(_Data) {
                    if (_Data == "true") {
                        HDialog.Info('保存成功');
                        HDialog.Close(1);
                    }
                },
                function completeCallback() {
                },
                function errorCallback() {

                });
        });

        $("#btnReturn").click(function () {
            HDialog.Close();
        });

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