<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="gift_donate_editlist.aspx.cs" Inherits="VA.Modules.JDingMember.gift.giftdonate_editlist" %>

<%@ Import Namespace="System.Data"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>礼品赠送记录</title>    
    <!--#include virtual="/include/css/editlist.aspx"-->
    <link href="/app_themes/<% = webSiteConfig.ThemeName %>/css/edit.css" type="text/css" rel="Stylesheet" />
    <!--#include virtual="/include/js/editlist.aspx"--> 
    <script type="text/javascript">      
        
        //单条撤销；
        function scx(keyValue, bizNo) {

            $('#winCX').css("display", "block");
            $('#winCX').window({
                width: 350,
                height: 230,
                modal: true,
                minimizable: false,
                collapsible: false,
                title: '填写撤单原因'
            });

            $("#hf_BCXKey").val(keyValue);
            $("#hf_BCXBizNo").val(bizNo);
            $("#span_bcxBizNo").html(bizNo);
        }

        //撤销执行；
        function CXSave() {
            var keyValue = $("#hf_BCXKey").val();
            //singleActWrapper("CX", keyValue, "确定要撤单吗？", "");            
            var customArg = $("#ddlCXReason").find("option:selected").text();
            if (customArg == "其它原因") {
                customArg = $.trim($("#txtCustomReason").val());
                if (customArg == "") {
                    JTongAlert("提示", "请填写撤单原因！", "warning", function () {
                        $("#txtCustomReason").focus();
                    });
                    return;
                }
            }

            singleActWrapper("CX", keyValue, "", customArg);
        }

        //当服务端执行成功时，在弹出操作成功提示后，会执行该方法。
        function doWhenServerActSuc(currActName, customArg) {
            if (currActName == "CX") {
                closeWindow();

                var bizNo = customArg;

                if ($("#ckbNotify")[0].checked == true) {
                    ajaxExecute("get", "../notification/biztransaction_notify.aspx", { "biztype": "donategift", "bizno": bizNo });
                }

                window.location.reload(); //重新刷新页面，以便重新计算汇总金额。
            }
        }

        //关闭窗口；
        function closeWindow() {
            $('#winCX').window("close");
        }

        //function viewDetail(rid){
        //    $('#winAdd').css("display", "block");
        //    $('#winAdd').window({
        //        width: 710,
        //        height: 300,
        //        modal: true,
        //        minimizable: false,
        //        collapsible: false,
        //        title: '赠品明细'
        //    });        
        //    $('#winAdd').html("<iframe src='gift_donate_detail.aspx?rid="+ rid +"' style='width:100%;height:100%;border:0px;margin:0px;padding:0px;'  ></iframe>");
        //}

        function afterDataListLoaded() {
            _w_table_rowspan("#tableBody", 2);
            _w_table_rowspan("#tableBody", 17);
        }
        $(function () {
            initListPage();

            $("#txtCustomReason").hide();
            $("#ddlCXReason").change(function () {
                var reasonText = $("#ddlCXReason").val();
                if (reasonText == "其它原因") {
                    $("#txtCustomReason").show();
                    $("#txtCustomReason").focus();
                } else {
                    $("#txtCustomReason").hide();
                }
            });
        });
    </script>

</head>
<body>
<!--说明：该页面是以 employee_editlist_nofresh_5.aspx 为原型封装的结果-->
<form id="Form1" method="post" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

<div id="pageWrapper" class="pageWrapper">   
    
    <div id="toolBar">                                  
        <asp:LinkButton ID="lbnExportToExcel" runat="server" CssClass="jtongui-toolbarbutton" icon="icon-export" OnClick="lbnExportToExcel_Click">导出</asp:LinkButton>
        <a href="javascript:refresh()" class="jtongui-toolbarbutton" icon="icon-reload">刷新</a>            
    </div><!--toolBar.END-->   
                     
    <div id="searchBar">
    
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>

         <asp:DropDownList ID="ddlDonateType" runat="server" 
             AutoPostBack="true"
             OnSelectedIndexChanged="ddlDonateType_SelectedIndexChanged">        
        </asp:DropDownList>   

        <asp:DropDownList ID="ddlSearchField" runat="server">
        <asp:ListItem Value="">检索字段</asp:ListItem>
        <asp:ListItem Value="1">礼品代码</asp:ListItem>
        <asp:ListItem Value="2">礼品名称</asp:ListItem>
        <asp:ListItem Value="3">会员姓名</asp:ListItem>
        <asp:ListItem Value="4">会员卡号</asp:ListItem>
        <asp:ListItem Value="5">操作员姓名</asp:ListItem>
        <asp:ListItem Value="6">赠送单号</asp:ListItem>
        </asp:DropDownList>               
                 
     <%--   <asp:DropDownList ID="ddlSearchType" runat="server">
        <asp:ListItem Value="1">模糊匹配</asp:ListItem>
        <asp:ListItem Value="2">精确匹配</asp:ListItem>
        </asp:DropDownList>    --%>           

        <asp:TextBox ID="txtKeyWords" runat="server"
            CssClass="input keywords"
            Width="100px" />

        <asp:DropDownList ID="ddlDateRule" runat="server" EnableViewState="false">
        <asp:ListItem Value="" Selected="True">赠送日期</asp:ListItem>
        <asp:ListItem Value="1">今天</asp:ListItem>
            <asp:ListItem Value="2">昨天</asp:ListItem>
            <asp:ListItem Value="3">前天</asp:ListItem>
            <asp:ListItem Value="4">近两天</asp:ListItem>
            <asp:ListItem Value="5">近三天</asp:ListItem>
            <asp:ListItem Value="6">近一周</asp:ListItem>
            <asp:ListItem Value="7">近一月</asp:ListItem>
            <asp:ListItem Value="8">上月</asp:ListItem>
            <asp:ListItem Value="9">本月</asp:ListItem>
            <asp:ListItem Value="10">自定义</asp:ListItem>
        </asp:DropDownList>    

        <VACTL:TextBox ID="txtBeginDate" Runat="server"
            EnableViewState="False"
            CssClass="input"
            Width="80px"            
            onfocus="laydate()"
            MaxLength="20" />  
        -      
        <VACTL:TextBox ID="txtEndDate" Runat="server"
            EnableViewState="False"
            CssClass="input"
            Width="80px"            
            onfocus="laydate()"
            MaxLength="20" />        
        <asp:Button ID="btnSearch" runat="server" 
             CssClass="simpleBtn"
             Text="查询" 
             Onclick="btnSearch_Click" />
        
        </ContentTemplate>
        </asp:UpdatePanel>

    </div><!--searchBar.END-->    

    <div id="dataBar">

    <!--MainList.Start-->    
    <div class="jtongui-smartlisttable" id="jtongui-smartlisttable">

    <table cellpadding="3" cellspacing="0" class="tableheader" id="tb1_header" >
    <thead>
    <tr>
        <%--<td style="width:30px;text-align:center;"><input type="checkbox" id="ckb_selectAll"/></td>--%>
        <td style="width:30px;text-align:center;">No.</td>
        <td style="width:80px;text-align:center;">赠送单号</td>
        <td style="width:70px;text-align:center;">赠送类型</td>          
        <td style="width:50px;text-align:center;">代码</td>
        <td style="width:200px;text-align:center;">品名</td>	 	 
        <td style="width:60px;text-align:center;">单位</td>	 
        <td style="width:60px;text-align:center;">单价</td>	 
        <td style="width:60px;text-align:center;">赠送数量</td>
        <td style="width:60px;text-align:center;">金额</td>	                 
        <td style="width:100px;text-align:center;">赠送时间</td>
        <td style="width:70px;text-align:center;">顾客类型</td>        
        <td style="width:70px;text-align:center;">会员卡号</td>        
        <td style="width:70px;text-align:center;">会员姓名</td>        
        <td style="width:150px;text-align:center;">备注</td>    
        <td style="width:80px;text-align:center;">业务单号</td>       
	    <td style="width:70px;text-align:center;">操作员</td>                 	    
        <td style="width:100px;text-align:center;">门店</td>  
        <td style="width:30px;text-align:center;">撤单</td>	     	       	           	       	    
        <td></td>
    </tr>    
    </thead>
    </table>

    <div id="dataBody">
    <asp:Repeater ID="myRepeater" Runat="server" EnableViewState="False"  >
    <HeaderTemplate>    
    <div class="bodyContainer">
    <% = base.ShowNoRecordInfo() %>
    <table id="tableBody" cellpadding="3" cellspacing="0" class="tablebody" tbHeader="tb1_header">
    </HeaderTemplate>
    <ItemTemplate>
    <tr>
        <%--<td style="text-align:center;"><input type="checkbox" name="ckb_dataItem" value="<%# Eval("RID")%>" /></td>--%>
        <td align="center"><%# (base.currPage - 1)*base.PageSize + Container.ItemIndex + 1%></td>
        <td align="center"<%# ShowBillStyle(Eval("Bill_Status").ToString(), Eval("Bill_Type").ToString())%>><%# Eval("BizNo")%></td>        
        <td align="center"><%# VA.Modules.JDingMember.Core.Enums.GiftDonateTypeConverter.Convert_Value_ToText(Eval("Donate_Type").ToString())%></td>                     
        <td align="center"><%# Eval("Item_Code")%></td>
        <td align="left"><%# Eval("Item_Name")%></td>        
        <td align="center"><%# Eval("Unit")%></td>        
        <td align="right"><%# Eval("Price")%></td>
        <td align="right"><%# Eval("Quantity")%></td>
        <td align="right"><%# Eval("Amount")%></td>	    
        <td align="center"><%# String.Format("{0:yyyy-MM-dd HH:mm}",Eval("Operate_Date"))%></td>        
        <td align="center"><%# VA.Modules.JDingMember.Core.Enums.CustomerTypeConverter.Convert_Value_ToText(Eval("Customer_Type").ToString())%></td>
        <td align="center"><%# Eval("CardNo")%></td>                            
        <td align="center"><%# Eval("Name")%></td>                            
        <td align="left"><%# Eval("Remark")%></td>  
        <td align="center"><%# Eval("Donate_BizNo")%></td>    
        <td align="center"><%# Eval("Operator_Name")%></td>                            
        <td align="center"><%# Eval("Shop_Name")%></td> 
        <td align="center">
            <%# base.ShowCXIcon(Eval("MasterID").ToString(), Eval("BizNo").ToString(), Eval("Bill_Status").ToString(), Eval("Bill_Type").ToString())%>           
            <input type="hidden" value="<%# Eval("BizNo")%>" />
        </td>                 	       	     
        <td></td>
    </tr>
    </ItemTemplate>
    <FooterTemplate>
    </table>
    </div><!--bodyContainer.END-->         

    <div id="divPagerInfo" style="display:none">
        <%=base.pageInfo%>
    </div>

    <input type="hidden" id="hidden_pageCnt" value="<% = base.PageCnt%>" />
    <input type="hidden" id="hidden_rdCnt" value="<% = base.RdCnt%>" />
    <input type="hidden" name="chkNum" value="<%=chkNum%>" />

    </FooterTemplate>
    </asp:Repeater>    
    </div><!--dataBody.END-->

    </div><!--jtongui-smartlisttable.END-->        
    <!--MainList.End-->  

    </div><!--dataBar.END-->

    <div id="pagerBar">
       ……
    </div><!--pageNavBar.END-->
    
    <asp:HiddenField runat="server" ID="hfCurrPage" EnableViewState="true" />
    
</div>

<!--撤单详情窗口-->
<div id="winCX" style="display:none;">

    <div style="width:300px;padding:10px;margin:auto;">

    <div class="centerFormTitle">
        <h1>填写撤单原因</h1>
    </div>

    <table cellspacing="0" cellpadding="3" class="editTable" style="margin:auto;">    
    <tr>
    <td class="th">被撤单号：</td>
    <td>   
        <span id="span_bcxBizNo" style="font-weight:bold;"></span> 
        <input type="hidden" id="hf_BCXKey" name="hf_BCXKey" />
        <input type="hidden" id="hf_BCXBizNo" name="hf_BCXBizNo" />
    </td>
    </tr>    
    <tr>
    <td class="th">撤单原因：</td>
    <td>    
        <asp:DropDownList ID="ddlCXReason" runat="server" EnableViewState="false">
        <asp:ListItem Value="客户要求" Selected="True">客户要求</asp:ListItem>
        <asp:ListItem Value="操作失误">操作失误</asp:ListItem>
        <asp:ListItem Value="其它原因">其它原因</asp:ListItem>
        </asp:DropDownList> 
        <input type="text" class="input" style="width:90px;" id="txtCustomReason" name="txtCustomReason" maxlength="20" /> 
    </td>
    </tr>
    <tr>
    <td colspan="2" style="text-align:center;">    
        <asp:CheckBox ID="ckbNotify" runat="server"
             Text="短信通知" />         
    </td>
    </tr>
    <tr>
    <td colspan="2" class="footer">
        <input type="button" id="btnCXBill" class="btn" style="width:80px" onclick="CXSave()" value="撤单" />
        <input type="button" id="btnClose" class="btn" style="width:80px" onclick="closeWindow()" value="关闭" />
    </td>
    </tr>
    </table>

    </div>

</div> 

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