<%@ Page Title="记账_支出" Language="C#" MasterPageFile="~/Master/officeMaster.master"
    AutoEventWireup="true" EnableEventValidation="false" CodeFile="Record_Expenditure.aspx.cs"
    Inherits="A_Record_Record_Expenditure" %>

<%@ 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 expenditureType = $("#<%=ddlExpenditureType.ClientID %>")[0]; //支出类型
            var seller = $("#<%=ddlSeller.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 project = $("#<%=ddlProject.ClientID %>")[0]; //项目
            if (expenditureMoney.value == '') {
                alert('金额不能为空！');
                expenditureMoney.focus();
                return false;
            }
            if (expenditureType.value == '0') {
                alert('支出类型不能为空！');
                return false;
            }
            if (seller.value == '0') {
                alert('商家不能为空！');
                return false;
            }
            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 (project.value == '0') {
                alert('项目不能为空！');
                return false;
            }
        }
    </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 style="font-size: 15px;">
        <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>
                <asp:DropDownList ID="ddlExpenditureType" runat="server">
                    <asp:ListItem Text="请选择支出类型" Value="0"></asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="alignright">
                商家：
            </td>
            <td>
                <asp:DropDownList ID="ddlSeller" runat="server">
                    <asp:ListItem Text="请选择商家" Value="0"></asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="alignright">
                账户：
            </td>
            <td>
                <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>
                <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>
