<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SinglePreStore.aspx.cs" Inherits="M_Main.ChargesNew.SinglePreStore" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript" src="../Jscript/jquery-1.11.3.min.js"></script>
    <script type="text/javascript" src="../Jscript/json2.js"></script>
    <script src="../jscript/jquery.tool.new.js" type="text/javascript"></script>
    <script src="../jscript/Dialog.js" type="text/javascript"></script>
    <script src="../jscript/PinYin.js" type="text/javascript"></script>
    <link href="../css/framedialog_fourcol.css" type="text/css" rel="stylesheet" />
    <link href="../css/button.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>
    <script type="text/javascript" src="../Jscript-Ui/JQForm/JQForm.js"></script>
   <script type="text/javascript" src="../Jscript/json2.js"></script>
    <script src="../jscript/Dialog.js" type="text/javascript"></script>
   <script src="../jscript/pagewalkthrough/jquery.pagewalkthrough.min.js"></script>
    <link href="../jscript/pagewalkthrough/css/jquery.pagewalkthrough.css" rel="stylesheet" />
    <style type="text/css">

        .panel-header {
            background: #f5f5f5 none repeat scroll 0 0;
        }
        .panel-header, .panel-body {
            border-color: #cccccc;
        }

    </style>
</head>
<body>
    <form id="frmForm" runat="server">
        <input id="CostID" type="hidden" name="CostID" runat="server" />
    <div style="height:4px;"></div>
    <table class="DialogTable">
        <tr>
            <td class="DialogTdTitle">
                预存项目
            </td>
            <td class="DialogTdContent_2Col" colspan="3" id="TdCostName">
                 <input class="easyui-validatebox" id="CostName" data-options="required:true"  name="CostName" readonly runat="server" />
            </td>
        </tr>
        <tr>
            <td class="DialogTdTitle">
                预存金额</td>
            <td class="DialogTdContent_2Col" colspan="3">
                <input type="text" class="easyui-validatebox" data-options="required:true,validType:'decimal'"  id="PrecAmount" name="PrecAmount" value="0.00" runat="server" />
            </td>
        </tr>
        <tr>
            <td class="DialogTdTitle">
                费用摘要</td>
            <td class="DialogTdContent_2Col" colspan="3">
                <input type="text" class="easyui-validatebox"  id="PrecMemo" name="PrecMemo" runat="server" />
            </td>
        </tr>
        <tr>
            <td colspan="4" style="text-align:center;padding-top:10px;">
                <input type="button" class="button" value="保存" id="BtnSave" />
                &nbsp;&nbsp;&nbsp;&nbsp;
                <input type="button" class="button" value="关闭" id="BtnReturn" />
            </td>
        </tr>
    </table>

    <input id="OpType"  type="hidden" name="OpType" runat="server" />
    <script  src="../jscript/CloseAjaxCache.js" type="text/javascript"></script>
    <script type="text/javascript">

        function GetQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]); return null;
        }

        $(document).ready(function () {
            if (GetQueryString("ShowType") == "1") {
                $('body').pagewalkthrough({
                    name: 'introduction3',
                    steps: [{
                        wrapper: '#CostName',
                        popup: {
                            content: '<span style=\'font-size:30px\'>输入预存项目</span>',
                            type: 'tooltip',
                            position: 'bottom'
                        }
                    },
                    {
                        wrapper: '#PrecAmount',
                        popup: {
                            content: '<span style=\'font-size:30px\'>输入预存金额</span>',
                            type: 'tooltip',
                            position: 'bottom'
                        }
                    }, {
                        wrapper: '#BtnSave',
                        popup: {
                            content: '<span style=\'font-size:30px\'>点击保存</span>',
                            type: 'tooltip',
                            position: 'bottom'
                        },
                        onLeave: function (e) {
                            if (e) {
                                HDialog.Close()
                            }
                        }
                    }
                    ],
                    buttons: {
                        jpwNext: {
                            i18n: "下一步 &rarr;"
                        },
                        jpwFinish: {
                            i18n: "结束 &#10004;",
                        },
                        jpwPrevious: {
                            i18n: "&larr; 上一步"
                        },
                        jpwClose: {
                            i18n: "关闭",
                        }
                    },
                    onClose: function () {
                        HDialog.Close();
                    }
                })

                $('body').pagewalkthrough('show');
            }
            var amount = parseFloat(GetQueryString("PrecAmount"))

            if (amount > 0) {
                $("#PrecAmount").val(amount)
                $("#PrecAmount").attr("readonly", "readonly");
            }
        }

        )

        function InitSize() {
                var w = $("#Tbl").width();
                var pw = w * 0.94;
                $("#Container").css("width", pw + "px");
        }
        InitSize();

        $("#CostName").click(function () {
                HDialog.Open('700', '400', "../dialogNew/CorpCommCostDlg.aspx", '收费项目选择', false, function callback(_Data) {
                    if (_Data != "") {//**获得返回 刷新
                        var varObjects = JSON.parse(_Data);
                        $("#CostID").val(varObjects.CostID);
                        $("#CostName").val(varObjects.CostName);
                    }
                });
        });

        $("#BtnSave").click(function () {

            var isValid = $("#frmForm").form('validate');
            if (isValid == true) {


                var PrecAmount = parseFloat($("#PrecAmount").val());

                if (PrecAmount <= 0)
                {
                    HDialog.Info("请输入预存金额");
                    return;
                }
                var CostName = $("#CostName").val();
                var PrecMemo = $("#PrecMemo").val();
                var Ret = { "CostName": CostName, "PrecAmount": PrecAmount, "PrecMemo": PrecMemo, "CostID": $("#CostID").val()};
                HDialog.ReturnIsJson = true;
                HDialog.Close(Ret);
            }

                
        });

        $("#BtnReturn").click(function () {
            HDialog.Close('');
        });
            
    </script>

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