<%@ Page Title="" Language="C#" MasterPageFile="~/Master/officeMaster.master" AutoEventWireup="true"  EnableEventValidation="false" CodeFile="IncomeInfo.aspx.cs" Inherits="A_Detail_IncomeInfo" %>
<%@ 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 incomeMoney = $("#<%=txtIncomeMoney.ClientID %>")[0]; //收入金额
            var spanincomeTypeName = $("#<%=spanIncomeTypeName.ClientID %>")[0]; //已删除的收入类型名（为空则为未删除，不为空则为已删除）
            var incomeTypeId = $("#<%=ddlIncomeType.ClientID %>")[0]; //收入类型
            var spanIncomeSellerName = $("#<%=spanSellerName.ClientID %>")[0]; //已删除的付款方（为空则为未删除，不为空则为已删除）
            var incomeSeller = $("#<%=ddlSeller.ClientID %>")[0]; //付款方
            var spanAccountName = $("#<%=spanAccountName.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 incomeDateTime = $("#<%=txtIncomeDateTime.ClientID %>")[0]; //收入时间
            var spanProjectName = $("#<%=spanProjectName.ClientID %>")[0]; //已删除的项目名（为空则为未删除，不为空则为已删除）
            var incomeProject = $("#<%=ddlProject.ClientID %>")[0]; //项目
            if (incomeMoney.value == '') {
                alert('金额不能为空！');
                incomeMoney.focus();
                return false;
            }
            if (spanincomeTypeName.innerHTML == '') {//收入类型未删除
                if (incomeTypeId.value == '0') {
                    alert('收入类型不能为空！');
                    return false;
                }
            }
            if (spanIncomeSellerName.innerHTML=='') {//付款方未删除
                if (incomeSeller.value == '0') {
                    alert('付款方不能为空！');
                    return false;
                }
            }
            if (spanAccountName.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 (incomeDateTime.value == '') {
                alert('时间不能为空！');
                incomeDateTime.focus();
                return false;
            }
            if(spanProjectName.value==''){//项目未删除
                if (incomeProject.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="
            width: 80px; height: 30px;" OnClick="btnExpenditure_Click" />
        <asp:Button ID="btnIncome" runat="server" Text="收 入" Style="font-weight: bold;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="txtIncomeMoney" runat="server" Width="140"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="alignright">
                收入类型：
            </td>
            <td>
                <span id="spanIncomeTypeName" runat="server"></span>
                <asp:DropDownList ID="ddlIncomeType" runat="server">
                    <asp:ListItem Text="请选择收入类型" Value="0"></asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="alignright">
                付款方：
            </td>
            <td>
                <span id="spanSellerName" 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="spanAccountName" 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="txtIncomeDateTime" 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="spanProjectName" 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="txtIncomeRemarks" 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>

