var valid = function() {
    return incomeDeviceValid() && incomeEngineerValid() && incomeServiceValid() && incomeTotalValid()
        && costPurchaseDeviceValid() && costPurchaseBuildValid() && costPurchaseServiceValid() && costPurchaseOtherValid()
        && costProjectManageValid() && costTotalValid() && costExpropriationValid()
        && costCompanyManageValid() && costIncomeTaxValid() && saleIncomeCashValid() && taxReturnValid()
        && earnestMoneyIncomeValid() && purchaseCostValid() && taxCostValid() && earnestMoneyCostValid()
        && cashInflowFromInvestingActivitiesValid() && cashOutflowFromInvestingActivitiesValid()
        && financingCapitalInflowValid() && financingCapitalOutflowValid();
};

var incomeDeviceValid = function() {
    var month = $("input[name='incomeDevice']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月收入设备类数据");
        });
        return false;
    }
    return true;
};

var incomeEngineerValid = function() {
    var month = $("input[name='incomeEngineer']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月收入工程类数据");
        });
        return false;
    }
    return true;
};

var incomeServiceValid = function() {
    var month = $("input[name='incomeService']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月收入服务类数据");
        });
        return false;
    }
    return true;
};

var incomeTotalValid = function() {
    var settle = $("input[name='incomeSettleTotal']").val();
    var budget = $("input[name='incomeBudgetTotal']").val();
    if (parseFloat(f2(settle)) > parseFloat(f2(budget))) {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("合计收入结算总额不能高于预算总额");
        });
        return false;
    }
    return true;
};

var costPurchaseDeviceValid = function() {
    var month = $("input[name='costPurchaseDevice']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月采购成本设备类数据");
        });
        return false;
    }
    return true;
};

var costPurchaseBuildValid = function() {
    var month = $("input[name='costPurchaseBuild']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月采购成本施工类数据");
        });
        return false;
    }
    return true;
};

var costPurchaseServiceValid = function() {
    var month = $("input[name='costPurchaseService']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月采购成本服务类数据");
        });
        return false;
    }
    return true;
};

var costPurchaseOtherValid = function() {
    var month = $("input[name='costPurchaseOther']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月采购成本其他类数据");
        });
        return false;
    }
    return true;
};

var costProjectManageValid = function() {
    var month = $("input[name='costProjectManage']").val();
    var salary = $("input[name='salary']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月项目管理成本数据");
        });
        return false;
    }
    if (parseFloat(f2(salary)) > parseFloat(f2(month))) {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("本月项目管理成本不能低于人力成本");
        });
        return false;
    }
    return true;
};

var costTotalValid = function() {
    var settle = $("input[name='costSettleTotal']").val();
    var budget = $("input[name='costBudgetTotal']").val();
    if (parseFloat(f2(settle)) > parseFloat(f2(budget))) {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("合计成本结算总额不能高于预算总额");
        });
        return false;
    }
    return true;
};

var costExpropriationValid = function() {
    var settle = $("input[name='costExpropriationSettleTotal']").val();
    var month = $("input[name='costExpropriation']").val();
    var budget = $("input[name='costExpropriationBudgetTotal']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月财务费用数据");
        });
        return false;
    }
    if (parseFloat(f2(settle)) > parseFloat(f2(budget))) {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("财务费用结算总额不能高于预算总额");
        });
        return false;
    }
    return true;
};

var costCompanyManageValid = function() {
    var settle = $("input[name='costCompanyManageSettleTotal']").val();
    var month = $("input[name='costCompanyManage']").val();
    var budget = $("input[name='costCompanyManageBudgetTotal']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月公司管理费用数据");
        });
        return false;
    }
    return true;
};

var costIncomeTaxValid = function() {
    var month = $("input[name='costIncomeTax']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月所得税费用数据");
        });
        return false;
    }
    return true;
};

var saleIncomeCashValid = function() {
    var month = $("input[name='saleIncomeCash']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月销售商品、提供劳务收到的现金数据");
        });
        return false;
    }
    return true;
};

var taxReturnValid = function() {
    var month = $("input[name='taxReturn']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月收到的税费返还数据");
        });
        return false;
    }
    return true;
};

var earnestMoneyIncomeValid = function() {
    var month = $("input[name='earnestMoneyIncome']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月收到其他与经营活动有关的现金数据");
        });
        return false;
    }
    return true;
};

var purchaseCostValid = function() {
    var month = $("input[name='purchaseCost']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月购买商品、接受劳务支付的现金数据");
        });
        return false;
    }
    return true;
};

var taxCostValid = function() {
    var month = $("input[name='taxCost']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月支付的各项税费数据");
        });
        return false;
    }
    return true;
};

var earnestMoneyCostValid = function() {
    var month = $("input[name='earnestMoneyCost']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月支付其他与经营活动有关的现金数据");
        });
        return false;
    }
    return true;
};

var cashInflowFromInvestingActivitiesValid = function() {
    var month = $("input[name='cashInflowFromInvestingActivities']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月投资活动现金流入数据");
        });
        return false;
    }
    return true;
};

var cashOutflowFromInvestingActivitiesValid = function() {
    var month = $("input[name='cashOutflowFromInvestingActivities']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月投资活动现金流出数据");
        });
        return false;
    }
    return true;
};

var financingCapitalInflowValid = function() {
    var month = $("input[name='financingCapitalInflow']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月融资资金流入数据");
        });
        return false;
    }
    return true;
};

var financingCapitalOutflowValid = function() {
    var month = $("input[name='financingCapitalOutflow']").val();
    if (month == "") {
        layui.use('layer', function(){
            var layer = layui.layer;
            layer.alert("请填入本月还款资金流出数据");
        });
        return false;
    }
    return true;
};


