function addcompanyFinalBalance(){
var currentDate = new Date();
var currentYear = date.getFullYear();// 当前年份
var previousMonth = date.getMonth();// 当前上一月份
//====================================================================================
var yearAndTime = $("#companyTime").find("td:last").find("label").text();
var yearindex = yearAndTime.lastIndexOf("年");
var myYear=yearAndTime.substring(0,yearindex);
var monthindex=yearAndTime.lastIndexOf("月");
var myMonth=yearAndTime.substring(yearindex+1,monthindex);
myMonth= parseInt(myMonth)+1;
if (myMonth>=12) {
myMonth=1;
myYear++;
}
/*if(myYear>=currentYear&&myMonth>previousMonth){
$.messager.alert("提示","已达到最大期值,无法再增加!","info");
return;
}*/
//====================================================================================
var rows =$("#balance").find("tr");
rows.each(
function(index,element){
var idvalue=$(element).attr("id");
if(index==0){
var neddAppend="<td><input type='hidden' name='colyear' value="+myYear+"><input type='hidden' name='colmonth' value="+myMonth+"><label>"+myYear+"年"+myMonth+"月</label></td>";
$(element).append(neddAppend);
}else if(index==rows.length-1){
var neddAppend="<td>0</td>";
$(element).append(neddAppend);
}else if(idvalue=='a_1000'){
//noithing
}else{
//拿到当前tr 最后一个td 内input 的标识 myflag
var index=$(element).find("td:last").find("[myid='closeinfoserialid']").attr("myflag");
var mBankname=$(element).find("td:last").find("[id='gongsitype']").attr("value");
var myFristAddAccountNum=$(element).find("td:last").find("[myFristAddAccountNumId='myFristAddAccountNumId']").attr("value");
var myBalanceSerialIdValue=$(element).find("td:last").find("[mybalanceserialid='mybalanceserialid']").attr("mybalanceserialidvalue");
var myBankNameValue=$(element).find("td:last").find("[mybanknameid='mybanknameid']").attr("mybanknamevalue");
var myAccountNumbValue=$(element).find("td:last").find("[myaccountnumb='accountnumb']").attr("value");
if(typeof(index)=="undefined"){
if(typeof(myAccountNumbValue)=="undefined"){
myAccountNumbValue=myFristAddAccountNum;
}
var htmlcontent="<td name="bankmonytd"><input type="hidden" name="bankcloseInfoList.closeinfoserialid" /><input type="hidden" name="bankcloseInfoList.balanceserialid" value="+myBalanceSerialIdValue+" mybalanceserialid="mybalanceserialid" /><input type="hidden" name="bankcloseInfoList.bankname" id="gongsitype" class="gongsitype" value="+mBankname+" /><input type="hidden" name="bankcloseInfoList.accountnum" value="+myAccountNumbValue+" myaccountnumb="accountnumb" myaccountnumbvalue="+myAccountNumbValue+" /><input type="hidden" name="bankcloseInfoList.year" /><input type="hidden" name="bankcloseInfoList.month" /><input type="text" style=" 95%" name="bankcloseInfoList.money" onblur="reCount(this);" class="easyui-validatebox" data-options="required:true,validType:'number'"/></td>";
$(element).append(htmlcontent);
return;
}
index=parseInt(index)+1;
var htmlcontent="<td name="bankmonytd"><input type="hidden" name="bankcloseInfoList["+index+"].closeinfoserialid" myflag="+index+" myid="closeinfoserialid" /><input type="hidden" name="bankcloseInfoList["+index+"].balanceserialid" value="+myBalanceSerialIdValue+" mybalanceserialid="mybalanceserialid" mybalanceserialidvalue="+myBalanceSerialIdValue+" /><input type="hidden" name="bankcloseInfoList["+index+"].bankname" id="gongsitype" class="gongsitype" value="+myBankNameValue+" mybanknameid="mybanknameid" mybanknamevalue="+myBankNameValue+" /><input type="hidden" name="bankcloseInfoList["+index+"].accountnum" value="+myAccountNumbValue+" myaccountnumb="accountnumb" myaccountnumbvalue="+myAccountNumbValue+" /><input type="hidden" name="bankcloseInfoList["+index+"].year" value="+myYear+" /><input type="hidden" name="bankcloseInfoList["+index+"].month" value="+myMonth+" /><input type="text" style=" 95%" name="bankcloseInfoList["+index+"].money" onblur="reCount(this);" class="easyui-validatebox" data-options="required:true,validType:'number'"/></td>";
$(element).append(htmlcontent);
}
});
}