<%@ Page Language="C#" AutoEventWireup="true" CodeFile="InventoryBook_Flow.aspx.cs" Inherits="Stock_Report_InventoryBook_Flow" %>
<%@ Register Src="~/Scripts/AWGridRuntime/UserControl/ListHeader.ascx" TagPrefix="uc1" TagName="ListHeader" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <uc1:ListHeader runat="server" ID="ListHeader" />
    <script type="text/javascript">
        //搜索
        function search_grid() {
            var fg = document.getElementById("frame_grid");
            var wh_id = '<%=Request["wh_id"]%>';
            var i_id = '<%=Request["i_id"]%>';
            var free1 = '<%=Request["free1"]%>';
            var free2 = '<%=Request["free2"]%>';
            var batch = '<%=Request["batch"]%>';
            var begin_date = '<%=Request["begin_date"]%>';
            var end_date = '<%=Request["end_date"]%>';
            
            var url = "InventoryBook_Flow_Grid.aspx?wh_id=" + wh_id
                    + '&i_id=' + i_id + '&free1=' + escape(free1) + '&free2=' + escape(free2)
                    + '&batch=' + escape(batch)
                    + "&begin_date=" + begin_date + "&end_date=" + end_date; ; ;
            fg.src = url;
        }
        //联查
        function modify() {
            var fg = document.getElementById("frame_grid"); //得到grid控件所在iframe
            var cw = fg.contentWindow;
            var id = cw.aw_GetSelectRows(cw._io_id);
            var order_type = cw.aw_GetSelectRows(cw._order_type); //单据类型ID
            var ot_name = cw.aw_GetSelectRows(cw._ot_name); //单据类型名称
            if (id.length == 0) {
                AlertNO('请选择要查看的记录!');
                return;
            }
            if (id.length > 1) {
                AlertNO('一次只可以查看一条记录!');
                return;
            }
            if (id == "")
                return;
            var dir;
            if (order_type == '1') {//其它入库单
                dir = "../../Stock/OtherIn/OtherIn_Document.aspx";
            } else if (order_type == '2') {//其它出库单
                dir = "../../Stock/OtherOut/OtherOut_Document.aspx";
            } else if (order_type == '3') {//采购入库单
                dir = "../../Purchase/PurchaseIn/PurchaseIn_Document.aspx";
            } else if (order_type == '4') {//材料出库单
                dir = "../../Stock/MaterialOut/MaterialOut_Document.aspx";
            } else if (order_type == '5') {//成品入库单
                dir = "../../Stock/ProductIn/ProductIn_Document.aspx";
            } else if (order_type == '6') {//销售出库单
                dir = "../../Sale/SalesOut/SalesOut_Document.aspx";
            } else {
                return;
            }
            var url = dir + '?action=Update&id=' + id;
            top.OpenWindow('Activate', 'Stock_InOut_' + id, ot_name, url);
        }
        //选择打印模板
        function grf_print() {
            var fg = document.getElementById("frame_grid"); //得到grid控件所在iframe
            var cw = fg.contentWindow;
            choice_print_template('<%=xview["auth_code"]%>', "", cw.sql_print_detail_session_id);
        }
    </script>
</head>
<body onload='search_grid()'>
    <!--工具栏-->
    <div style="height:30px;" class="list_menu_bar">
        <a plain="true" class="easyui-linkbutton" onclick="modify()">联查</a>
        <!--<a plain="true" class="easyui-linkbutton" id="btn_print" onclick='grf_print()'>打印</a>-->
        <a plain="true" class="easyui-linkbutton" onclick="DesignModuleFormat('Stock_Report_InventoryBook_Flow')"style='<%=auth.FormatView()%>'>格式</a>
    </div>
    <!--Grid控件所在的iframe-->
    <%=xview["grid_frame"]%>
    <script type="text/javascript">
        $(document).ready(function () {

        });
    </script>
</body>
</html>
