<%@ Page Title="" Language="C#" MasterPageFile="~/Master/officeMaster.master" AutoEventWireup="true" CodeFile="ExpenditureInfo.aspx.cs" Inherits="A_Detail_ExpenditureInfo" 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 expenditureMoney = $("#<%=txtExpenditureMoney.ClientID %>")[0]; //支出金额
            var originalEType = $("#<%=spanOriginalEType.ClientID %>")[0]; //已删除的支出类型名
            var expenditureType = $("#<%=ddlExpenditureType.ClientID %>")[0]; //支出类型
            var originalSeller = $("#<%=spanOriginalSeller.ClientID %>")[0];//已删除的商家名
            var seller = $("#<%=ddlSeller.ClientID %>")[0]; //商家
            var originalAccount = $("#<%=spanOriginalAccount.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 expenditureDateTime = $("#<%=txtExpenditureDateTime.ClientID %>")[0]; //支出时间
            var originalProject = $("#<%=spanOriginalProject.ClientID %>")[0];//已删除的项目名
            var project = $("#<%=ddlProject.ClientID %>")[0]; //项目
            if (expenditureMoney.value == '') {
                alert('金额不能为空！');
                expenditureMoney.focus();
                return false;
            }
            if (originalEType.innerHTML == '') {//现支出类型未删除
                if (expenditureType.value == '0') {
                    alert('支出类型不能为空！');
                    return false;
                }
            }
            if (originalSeller.innerHTML == '') {//现商家未删除
                if (seller.value == '0') {
                    alert('商家不能为空！');
                    return false;
                }
            }
            if (originalAccount.innerHTML=='') {//现账户未删除
                if (accountTypeId.value == '0') {
                    alert('账户类型不能为空！');
                    return false;
                }
                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 (expenditureDateTime.value == '') {
                alert('时间不能为空！');
                expenditureDateTime.focus();
                return false;
            }
            if (originalProject.innerHTML=='') {//现项目未删除
                if (project.value == '0') {
                    alert('项目不能为空！');
                    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="font-weight: bold;
            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="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 width="48%" class="alignright">
                金额：
            </td>
            <td>
                <asp:TextBox ID="txtExpenditureMoney" runat="server" Width="140"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="alignright">
                支出类型：
            </td>
            <td>
                <span id="spanOriginalEType" runat="server"></span>
                <asp:DropDownList ID="ddlExpenditureType" runat="server">
                    <asp:ListItem Text="请选择支出类型" Value="0"></asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="alignright">
                商家：
            </td>
            <td>
                <span id="spanOriginalSeller" runat="server"></span>
                <asp:DropDownList ID="ddlSeller" runat="server">
                    <asp:ListItem Text="请选择商家" Value="0"></asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="alignright">
                账户：
            </td>
            <td>
                <span id="spanOriginalAccount" 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>
                <asp:TextBox ID="txtExpenditureDateTime" runat="server" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
                    Width="140"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="alignright">
                项目：
            </td>
            <td>
                <span id="spanOriginalProject" runat="server"></span>
                <asp:DropDownList ID="ddlProject" runat="server">
                    <asp:ListItem Text="请选择项目" Value="0"></asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="alignright">备注：</td>
            <td><asp:TextBox ID="txtExpenditureRemarks" 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>

