<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CheckList.aspx.cs" Inherits="Medical.MBusiness.SysCheck.CheckList" %>

<%@ Register Src="../../Controls/Date.ascx" TagName="Date" TagPrefix="ucDate" %>
<%@ Register Src="../../Controls/Pager.ascx" TagName="Pager" TagPrefix="ucPager" %>
<%@ Register Src="../../Controls/LoadButton.ascx" TagName="LoadButton" TagPrefix="ucLoadButton" %>
<!DOCTYPE html>
<html>
<head>
    <title><%=ModuleName%></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="../../Scripts/My97DatePicker/My97DatePicker/WdatePicker.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/jsHelper_Base.js" type="text/javascript"></script>
    <object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" style="display:none" >
        <embed id="LODOP_EM" type="application/x-print-lodop" width="0" height="0"></embed>
    </object>
    <script src="../../Scripts/LodopFuncs.js" type="text/javascript"></script>
    <script src="../../js/myLib/Print.js" type="text/javascript"></script>
</head>
<body>
    <div class="pt-panel">
        <strong><%=ModuleName%></strong>
        <form name="fCondition" class="pt-padding">
            <ucLoadButton:LoadButton ID="LoadButton1" runat="server"/>
            <dl>
                <dt>盘点单号</dt>
                <dd><input type="text" name="num" /></dd>
            </dl>
            <ucDate:Date ID="ucDate" runat="server" />
        </form>
    </div>
    <div class="pt-panel pt-below">
        <strong>查询一览</strong>
        <div class="pt-grid_frame">
            <table class="pt-grid" id="grid">
                <thead>
                    <tr>
                        <th style="width:130px">操作</th>
                        <th>盘点单号</th>
                        <th>盘点仓库</th>
                        <th>盘点日期</th>
                        <th>经手人</th>
                        <th>备注</th>
                    </tr>
                </thead>
                <tbody></tbody>
            </table>
        </div>
        <ucPager:Pager ID="gridPager" runat="server" />
    </div>
    <script>
        (function() {
            var url = "CheckList.aspx",
            dialogUrl = "/MBusiness/SysCheck/CheckForm.aspx",
            dialogFormName = "Check_Form",
            listbutton = '<%=Medical.MCommon.PageHelper.GetListButton() %>',
            grid = new Grid({ id: "grid", url: url, pager: new Pager("gridPager"), bindFun: bindData }),
            title = '<%=ModuleName %>',
            printModule = new Print({ model: 2 });

            function init() {
                DateValidate(document.getElementById("startDate"), document.getElementById("endDate"));
                grid.search();
                bindEvents();
            }

            function bindEvents() {
                $("#btnAdd").click(function() {
                    top.openDialog(dialogUrl, dialogFormName, title + ' - 添加', 1000, 530, 50, 50);
                });
                $("#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 "查看":
                                top.openDialog(dialogUrl + "?type=view&key=" + data.Num, dialogFormName, title + ' - 查看', 1000, 530, 50, 50);
                                break;
                            case "打印":
                                print(data.Num);
                                break;
                        }
                    }
                });
            }
            function print(num) {
                $.get(url, { action: "print", num: num }, function(data) {
                    printModule.print(data, false)
                })
            }
            function bindData(tr, data) {
                tr.append($("<td>").html(listbutton))
                .append($("<td>").html(data.Num))
                .append($("<td>").html(data.Warehouse))
                .append($("<td>").html(data.Date))
                .append($("<td>").html(data.Man))
                .append($("<td>").html(data.Remark));
            }
            init();
        })();
    </script>
</body>
</html>


