<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SettlementForm.aspx.cs" Inherits="Medical.MInterFace.SysRuralCooperative.SettlementForm" %>

<%@ Register Src="../../Controls/Pager.ascx" TagName="Pager" TagPrefix="ucPager" %>
<!DOCTYPE html>
<html>
<head>
    <title>无标题页</title>
    <link href="../../css/style.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../../js/myLib/jsHelper_Form.js" type="text/javascript"></script>
    <script src="../../js/myLib/Pager.js" type="text/javascript"></script>
    <script src="../../js/myLib/Grid.js" type="text/javascript"></script>
<%--    <script src="../../js/myLib/helper.js" type="text/javascript"></script>--%>
</head>
<body>
    <form name="fCondition">
        <div class="pt-padding">
            <input type="button" class="pt-button active" id="btnQuery" value="查询" />
        </div>
        <dl>
            <dt>疾病名称</dt>
            <dd><input type="text" name="name" /></dd>
        </dl>
        <div id="Menu" class="pt-body">
            <table class="pt-tree-grid" id="grid">
                <thead>
                    <tr>
                        <td>操作</td>
                        <td>疾病编码</td>
                        <td>疾病名称</td>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
            <ucPager:Pager ID="gridPager" runat="server" />
        </div>
    </form>
    <script>
        (function() {
            var url = "SettlementForm.aspx",
            key='<%=key %>',
            grid = new Grid({ id: "grid", url: url, pager: new Pager("gridPager"), bindFun: bindData });

            function init() {
//                FixedTableHeader("grid", 340);
                grid.search();
                bindEvents();
            }

            function bindEvents() {
                $("#btnQuery").click(function() {
                    grid.search(true);
                });
                grid.control.click(function(e) {
                    var target = $(e.target);
                    if (target.is("input") && !target.is(":disabled")) {
                        var data = target.parent().parent().data("data");
                        switch (target.val()) {
                            case "选择":
                                Settlement(data.f_bm,data.f_mc);
                                break;
                        }
                    }
                });
            }
            function Settlement(jbbm,jbmc){
                $.get(url,{action:"settlement",jbbm:jbbm,jbmc:jbmc,key:key},function(data){
                    if(data=="200"){
                        top.showTipsMsg('结算成功!', 0, 3000);
                        top.openDialog("/MInterFace/SysRuralCooperative/SettlementDetails.aspx?key="+key, "Settlement_Details", '结算信息 - 查看', 800, 500, 50, 50, callback);
                    } else {
                        top.showTipsMsg("操作失败，请稍后重试", 1, 3000);
                    }
                });
            }
            function callback(){
                top.OpenClose("Settlement_Form");
            }
            function bindData(tr, data) {
                tr.append($("<td>").html('<input type="button" class="pt-button active" value="选择" />'))
                .append($("<td>").html(data.f_bm))
                .append($("<td>").html(data.f_mc));
            }
            init();
        })();
    </script>
</body>
</html>
