<%@ Page Title="" Language="C#" MasterPageFile="~/Styles/MasterPage/MasterPage_Edit.master" AutoEventWireup="true" CodeFile="CusInv_Edit.aspx.cs" Inherits="Base_CusInv_CusInv_Edit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <script type="text/javascript">
        var action = '<%=xview["action"]%>';
        //保存
        function Save() {
            <%=xview["Script_GetInput"] %>
            var action = '<%=xview["action"]%>';
            parent.ShowLoadingMask(); //显示遮罩
            $.ajax({
                type: "POST",
                contentType: "application/json",
                url: 'CusInv_Service.asmx/Save',
                data: "{action:'" + action + "',<%=xview["Script_SaveJSON"]%>}",
                dataType: 'json',
                success: function (result) {
                    parent.HideLoadingMask(); //关闭遮罩
                    var r = result.d;
                    if (r == "success") {
                        parent.AlertOK('保存成功!');
                        parent.search_grid();
                        parent.load_tree();
                        CloseDivWin(); //关闭窗口
                    } else {
                        parent.AlertNO(r);
                    }
                }
            });
        }
    </script>
    <!--工具栏-->
    <div class="list_menu_bar">
        <a plain="true" class="easyui-linkbutton" iconcls="icon-save" onclick="Save()" style='<%=auth.AuthView("Base_CusInv_Edit")%>'>保存</a>
        <a plain="true" class="easyui-linkbutton" onclick="parent.DesignModuleFormat('Base_CusInv_Input');CloseDivWin();" style='<%=auth.FormatView()%>'>格式</a>
    </div>
    <div style="width:800px;height:500px;overflow:auto;">
        <div class="edit_area">
        <%=xview["input_ui"]%>
        </div>
    </div>
    <script type="text/javascript">
        //初始化页面
        function init_page() {

            //选择自定义项档案
            <%for(int i=1;i<=5;i++){ %>
                $F("trigger_sdefine<%=i%>").onclick = function () {
                    AdvancedSearch_DefineItem($("#sdefine<%=i%>").val(),'CusInv_sdefine<%=i%>','sdefine<%=i%>');
                };
            <%}
              for(int i=1;i<=5;i++){ %>
                $F("trigger_ndefine<%=i%>").onclick = function () {
                    AdvancedSearch_DefineItem($("#ndefine<%=i%>").val(),'CusInv_ndefine<%=i%>','ndefine<%=i%>');
                };
            <%} %>

            <%if(action.Equals("Update")){ %>
                $F("cus_code").value = '<%=m.customer==null?"":m.customer.cus_code%>';
                $F("cus_name").value = '<%=m.customer==null?"":m.customer.cus_name%>';
                $F("crc_name").value = '<%=m.currency==null?"":m.currency.crc_name%>';
                $F("i_code").value = '<%=m.inventory.i_code%>';
                $F("i_name").value = '<%=m.inventory.i_name%>';
                $F("standard").value = '<%=m.inventory.standard%>';
                //$F("munit").value = '<%=m.inventory.munit%>';
            <%} %>
            if (action == "Add") {
                FastSearch_Inventory(); //查询存货
                FastSearch_Customer(); //查询客户
                FastSearch_Currency(); //查询币种
            } else {
                $F("i_code").readOnly = true;
                $F("cus_name").readOnly = true;
            }
        }
        init_page();
    </script>
</asp:Content>

