<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="debt_editlist.aspx.cs" Inherits="VA.Modules.JDingMember.customer.debt_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 settle(keyValue, bizNo) {

            $('#winJZ').css("display", "block");
            $('#winJZ').window({
                width: 350,
                height: 230,
                modal: true,
                minimizable: false,
                collapsible: false,
                title: '确认结账'
            });

            $("#hf_JZKey").val(keyValue);
            $("#span_JZBizNo").html(bizNo);
        }

        //结账执行；
        function settleSave() {
            var keyValue = $("#hf_JZKey").val();
            var customArg = "";
            singleActWrapper("JZ", keyValue, "", customArg);
        }

        //撤销结账；
        function cxSettle(keyValue, bizNo) {
            $('#winCxJZ').css("display", "block");
            $('#winCxJZ').window({
                width: 350,
                height: 230,
                modal: true,
                minimizable: false,
                collapsible: false,
                title: '确认撤销结账'
            });

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

        //撤销结账执行；
        function cxSettleSave() {
            var keyValue = $("#hf_BCXKey").val();
            var customArg = "";
            singleActWrapper("CXJZ", keyValue, "", customArg);
        }

        //当服务端执行成功时，在弹出操作成功提示后，会执行该方法。
        function doWhenServerActSuc(currActName, customArg) {
            if (currActName == "JZ") {
                closeWindow();
                window.location.reload(); //重新刷新页面，以便重新计算汇总金额。
            }
            else if (currActName == "CXJZ") {
                closeCxWindow();
                window.location.reload(); //重新刷新页面，以便重新计算汇总金额。
            }
        }
       
        //关闭窗口；
        function closeWindow() {
            $('#winJZ').window("close");
        }

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

        //显示汇总金额；
        function afterDataListLoaded() {
            $("#statBar").html($("#divStatInfo").html());
        }

        $(function () {
            initListPage();
        });
    </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">                          
       <%-- <a href="javascript:add()" class="jtongui-toolbarbutton" icon="icon-add">充值</a>--%>
        <a href="javascript:refresh()" class="jtongui-toolbarbutton" icon="icon-reload">刷新</a>            
        <asp:LinkButton ID="lbnExportToExcel" runat="server" CssClass="jtongui-toolbarbutton" icon="icon-export" OnClick="lbnExportToExcel_Click">导出</asp:LinkButton>
    </div><!--toolBar.END-->   
                     
    <div id="searchBar">
    
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>

        <asp:DropDownList ID="ddlIsRepaied" runat="server"
             AutoPostBack="true"
             OnSelectedIndexChanged="ddlIsRepaied_SelectedIndexChanged">       
        </asp:DropDownList>    

        <asp:DropDownList ID="ddlSearchField" runat="server" EnableViewState="false">
        <asp:ListItem Value="">检索字段</asp:ListItem>
        <asp:ListItem Value="1">顾客姓名</asp:ListItem>
        <asp:ListItem Value="2">顾客手机号</asp:ListItem>
        <asp:ListItem Value="3">消费收银单号</asp:ListItem>
        </asp:DropDownList>               
                 
       <%-- <asp:DropDownList ID="ddlSearchType" runat="server" EnableViewState="false">
        <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:70px;text-align:center;">手机号</td>        
        <td style="width:70px;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:100px;text-align:center;">结账时间</td>
        <td style="width:70px;text-align:center;">结账操作员</td>        
        <td style="width:100px;text-align:center;display:none;">门店</td>	         
        <td style="width:30px;text-align:center;">结账</td>	                  	    
        <td style="width:60px;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 cellpadding="3" cellspacing="0" class="tablebody" tbHeader="tb1_header">
    </HeaderTemplate>
    <ItemTemplate>
    <tr id="tr_<%# Eval("RID")%>">
       <%-- <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"><%# Eval("Consume_BizNo")%></td>
        <td align="center"><%# Eval("Customer_Name")%></td>
        <td align="center"><%# Eval("MobileNo")%></td>
        <td align="right"><%# Eval("Consume_Amount")%></td>                
        <td align="center"><%# String.Format("{0:yyyy-MM-dd HH:mm}", Eval("Consume_Date"))%></td>
        <td align="center"><%# Eval("Consume_Operator_Name")%></td>             
        <td align="center"><%# VA.Modules.JDingMember.Core.Enums.CustomerDebtIsRepaiedConverter.Convert_Value_ToText(Eval("Is_Repaied").ToString(), true)%></td>
        <td align="center"><%# VA.Utils.DateHelper.GetDateStringFormatNullDate(String.Format("{0:yyyy-MM-dd HH:mm}", Eval("Repay_Date")))%></td>
        <td align="center"><%# Eval("Repay_Operator_Name")%></td>             
        <td align="center" style="display:none;"><%# Eval("Shop_Name")%></td>             
        <td align="center">
            <%# base.ShowSettleIcon(Eval("RID").ToString(),Eval("Consume_BizNo").ToString(),Eval("Is_Repaied").ToString())%>                
        </td>        	       	     
        <td align="center">
            <%# base.ShowCxSettleIcon(Eval("RID").ToString(),Eval("Consume_BizNo").ToString(),Eval("Is_Repaied").ToString())%>                
        </td>        	       	     
        <td></td>
    </tr>
    </ItemTemplate>
    <FooterTemplate>
    </table>
    </div><!--bodyContainer.END-->        

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

    <div id="divStatInfo" style="display:none">
        共 <span style="font-weight:bold;"><%=base.RdCnt%></span> 条挂账记录，挂账金额合计：<span style="font-weight:bold;"><% = base.TotalConsumeAmount.ToString("F2") %></span>&nbsp;&nbsp;
    </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="statBar">
       
    </div><!--statBar.END-->

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

<!--结账详情窗口-->
<div id="winJZ" 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_JZBizNo" style="font-weight:bold;"></span> 
        <input type="hidden" id="hf_JZKey" name="hf_JZKey" />
    </td>
    </tr>       
    <tr>
    <td colspan="2" class="footer">
        <input type="button" id="btnSettle" class="btn" style="width:80px" onclick="settleSave()" value="结账" />
        <input type="button" id="btnClose" class="btn" style="width:80px" onclick="closeWindow()" value="关闭" />
    </td>
    </tr>
    </table>

    </div>

</div> 

<!--撤销结账详情窗口-->
<div id="winCxJZ" 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" />
    </td>
    </tr>       
    <tr>
    <td colspan="2" class="footer">
        <input type="button" id="Button1" class="btn" style="width:80px" onclick="cxSettleSave()" value="撤销结账" />
        <input type="button" id="Button2" class="btn" style="width:80px" onclick="closeCxWindow()" value="关闭" />
    </td>
    </tr>
    </table>

    </div>

</div> 

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