<%@ Page Title="" Language="C#" MasterPageFile="~/Master/officeMaster.master" AutoEventWireup="true" CodeFile="TransferInfo.aspx.cs" Inherits="A_Detail_TransferInfo" EnableEventValidation="false" %>
<%@ Register Src="~/Ucontrol/UcAccount.ascx" TagName="Account" TagPrefix="ucl" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <script src="../My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        function CheckEmpty() {
            var spanAccountNameOut = $("#<%=spanAccountNameOut.ClientID %>")[0];//已删除的转出账户名（为空则为未删除，不为空则为已删除）
            var accountTypeId = $('#<%= uclAccount.FindControl("ddlAccountType").ClientID %>')[0]; //转出账户类型ID
            var cashAccount = $('#<%= uclAccount.FindControl("ddlCashAccount").ClientID %>')[0]; //转出现金账户
            var creditCard = $('#<%= uclAccount.FindControl("ddlCreditCard").ClientID %>')[0]; //转出信用卡
            var savingsCard = $('#<%= uclAccount.FindControl("ddlSavingsCard").ClientID %>')[0]; //转出储蓄卡
            var onlinePay = $('#<%= uclAccount.FindControl("ddlOnlinePay").ClientID %>')[0]; //转出网上支付
            var spanAccountNameEnter = $("#<%=spanAccountNameEnter.ClientID %>")[0];//已删除的转入账户名（为空则为未删除，不为空则为已删除）
            var accountTypeIdEnter = $('#<%= uclAccount.FindControl("ddlAccountType").ClientID %>')[0]; //转入账户类型ID
            var cashAccountEnter = $('#<%= uclAccount.FindControl("ddlCashAccount").ClientID %>')[0]; //转入现金账户
            var creditCardEnter = $('#<%= uclAccount.FindControl("ddlCreditCard").ClientID %>')[0]; //转入信用卡
            var savingsCardEnter = $('#<%= uclAccount.FindControl("ddlSavingsCard").ClientID %>')[0]; //转入储蓄卡
            var onlinePayEnter = $('#<%= uclAccount.FindControl("ddlOnlinePay").ClientID %>')[0]; //转入网上支付
            var transferMoney = $("#<%=txtTransferMoney.ClientID %>")[0]; //转账金额
            var transferTime = $("#<%=txtTransferDateTime.ClientID %>")[0]; //转账时间
            //转出账户
            if(spanAccountNameOut.innerHTML==''){//转出账户未删除
                if (accountTypeId.value == '0') {
                    alert('转出账户类型不能为空！');
                }
                if (accountTypeId.value == '1') {//转出现金账户
                    if (cashAccount.value == '0') {
                        alert('转出现金账户不能为空！');
                        return false;
                    }
                }
                else if (accountTypeId.value == '2') {//转出信用卡
                    if (creditCard.value == '0') {
                        alert('转出信用卡不能为空！');
                        return false;
                    }
                }
                else if (accountTypeId.value == '3') {//转出储蓄卡
                    if (savingsCard.value == '0') {
                        alert('转出储蓄卡不能为空！');
                        return false;
                    }
                }
                else if (accountTypeId.value == '4') {//转出网上支付
                    if (onlinePay.value == '0') {
                        alert('转出网上支付不能为空！');
                        return false;
                    }
                }
            }
            //转入账户
            if(spanAccountNameEnter.innerHTML==''){//转入账户未删除
                if (accountTypeIdEnter.value == '0') {
                    alert('转入账户类型不能为空！');
                    return false;
                }
                if (accountTypeIdEnter.value == '1') {//转入现金账户
                    if (cashAccountEnter.value == '0') {
                        alert('转入现金账户不能为空！');
                        return false;
                    }
                }
                else if (accountTypeIdEnter.value == '2') {//转入信用卡
                    if (creditCardEnter.value == '0') {
                        alert('转入信用卡不能为空！');
                        return false;
                    }
                }
                else if (accountTypeIdEnter.value == '3') {//转入储蓄卡
                    if (savingsCardEnter.value == '0') {
                        alert('转入储蓄卡不能为空！');
                        return false;
                    }
                }
                else if (accountTypeIdEnter.value == '4') {//转入网上支付
                    if (onlinePayEnter.value == '0') {
                        alert('转入网上支付不能为空！');
                        return false;
                    }
                }
            }
            if (transferMoney.value == '') {
                alert('金额不能为空！');
                transferMoney.focus();
                return false;
            }
            if (transferTime.value == '') {
                alert('转账时间不能为空！');
                transferMoney.focus();
                return false;
            }
            return true;
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <%--<table class="usertableborder" cellspacing="1" cellpadding="3" width="100%" align="center"
        border="0">
        <tr>
            <th>
                转账
            </th>
        </tr>
    </table>--%>
    <div>
        <asp:Button ID="btnAllDetail" runat="server" Text="全 部" Style="
            width: 80px; height: 30px;" OnClick="btnAllDetail_Click" />
        <asp:Button ID="btnExpenditure" runat="server" Text="支 出" Style="
            width: 80px; height: 30px;" OnClick="btnExpenditure_Click" />
        <asp:Button ID="btnIncome" runat="server" Text="收 入" Style="width: 80px; height: 30px;"
            OnClick="btnIncome_Click" />
        <asp:Button ID="btnTransfer" runat="server" Text="转 账" Style="font-weight: bold;width: 80px; height: 30px;"
            OnClick="btnTransfer_Click" />
        <asp:Button ID="btnLoan" runat="server" Text="借 贷" Style="width: 80px; height: 30px;"
            OnClick="btnLoan_Click" />
    </div>
    <br />
    <table class="usertableborder" cellspacing="1" cellpadding="3" width="100%" align="center">
        <tr>
            <td class="alignright">
                转出账户：
            </td>
            <td>
                <span id="spanAccountNameOut" runat="server"></span>
                <ucl:Account ID="uclAccount" runat="server" OpenAjaxUrl="../Ajax/Ajax_CreditCard.aspx" OpenSavingsCardAjaxUrl="../Ajax/Ajax_SavingsCard.aspx" />
            </td>
        </tr>
        <tr>
            <td class="alignright">转入账户：</td>
            <td>
                <span id="spanAccountNameEnter" runat="server"></span>
                <ucl:Account ID="uclAccountEnter" runat="server" OpenAjaxUrl="../Ajax/Ajax_CreditCard.aspx" OpenSavingsCardAjaxUrl="../Ajax/Ajax_SavingsCard.aspx" />
            </td>
        </tr>
         <tr>
            <td width="48%" class="alignright">
                金额：
            </td>
            <td>
                <asp:TextBox ID="txtTransferMoney" runat="server" Width="140"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="alignright">
                时间：
            </td>
            <td>
                <asp:TextBox ID="txtTransferDateTime" runat="server" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                    Width="140"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="alignright">备注：</td>
            <td><asp:TextBox ID="txtTransferRemarks" runat="server" TextMode="MultiLine" Height="50" Width="300"></asp:TextBox></td>
        </tr>
        <tr>
            <td align="center" colspan="2">
                <asp:Button ID="btnSubmit" runat="server" Text="提 交" Width="72" BackColor="#CCCCCC" 
                    OnClientClick="return CheckEmpty();" onclick="btnSubmit_Click"/>&nbsp;&nbsp;
                <asp:Button ID="btnCancel" runat="server" Text="返 回" Width="72" BackColor="#CCCCCC" 
                    onclick="btnCancel_Click"  />
            </td>
        </tr>
    </table>
</asp:Content>

