2018-06-03 22:26:41 +08:00

122 lines
4.2 KiB
Plaintext

<%@ page contentType="text/html; charset=GBK"%>
<%@page import="com.tenwa.reckon.util.TbBeanTools"%>
<%@page import="com.tenwa.reckon.bean.TabCalBean"%>
<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
String flowunid=CurPage.getParameter("flowunid");//流程编号
String plannumber=CurPage.getParameter("plannumber");//方案编号
String planCName=CurPage.getParameter("planCName");//项目方案 合同方案 投放编号 列名
String calType=CurPage.getParameter("calType");
TabCalBean tcb=TbBeanTools.getTabInfo(calType);
String RightType= CurPage.getParameter("RightType");
String taskno=CurPage.getParameter("TaskNo");
String ishistory=CurPage.getParameter("IsHistory");
String nodeNo=CurPage.getParameter("NodeNo");
ASObjectModel doTemp = new ASObjectModel("LCCalcRulesTempList");
doTemp.appendJboWhere(" and "+planCName+"='"+plannumber+"'");
if(null!=ishistory&&ishistory.equals("true")){
doTemp.setDataQueryClass("com.tenwa.lease.flow.flowarchive.calcarchive.CalcRentListArachiveShow");
}
CurPage.setAttribute("modelno","rule");
doTemp.setJboClass(tcb.getRuleTb());
ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
dwTemp.Style="1";
dwTemp.ReadOnly = "0";
dwTemp.setPageSize(100);
dwTemp.genHTMLObjectWindow(flowunid);
String sButtons[][] =null;
if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){
RightType="ReadOnly";
sButtons=new String[][] {
};
}else{
sButtons = new String[][]{
{"true","","Button","新增","新增","newRecord()","","","",""},
{"true","","Button","保存","保存","save()","","","",""},
{"true","","Button","删除","删除","deleteRecord()","","","",""}
};
}
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<script type="text/javascript">
function save(){
var count=getRowCount(0);
if(count > 0){
var totalCount = Number(getItemValue(0,count-1,'end_list'));
parent.setItemValue(0,getRow(),"INCOME_NUMBER",totalCount+"");
parent.CalcControl.InitLsaseTerm();
}
setRules();
var endlist=1;
for(var i=0;i<getRowCount(0);i++){
if(i>0){
if(Number( getItemValue(0,i,"START_LIST"))<=endlist){
alert("第"+(i+1)+"行开始期次小于上一行结束期次,不能保存");
return ;
}
}
endlist=Number( getItemValue(0,i,"END_LIST"));
}
as_save(0);
}
/*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/
function newRecord(){
setRules();
if(iV_all(0)==false){
showErrors(0);
return;
}
var startList = 1;
var count=getRowCount(0);
if(count > 0){
startList = Number(getItemValue(0,count-1,'end_list')) + 1;
}
as_add(0);
setItemValue(0,getRow(0),'flowunid','<%=flowunid%>');
setItemValue(0,getRow(0),'<%=planCName%>','<%=plannumber%>');
setItemValue(0,getRow(0),'start_list',startList+"");
as_save(0);
}
//验证校验
function setRules(){
TableFactory.initCheck=false;
_user_valid_errors[0] = new Array();
TableFactory.ColValidInfo[0] = new Array();
for(var i=0;i<getRowCount(0);i++){
var startlist=getItemValue(0,i,"start_list");
var endlist=getItemValue(0,i,"end_list");
var planmoney=getItemValue(0,i,"plan_money");
if(endlist.length==0){
_user_valid_errors[0][_user_valid_errors[0].length]= "结束期次必填[第" + (i+1) +"行]";
TableFactory.ColValidInfo[0][TableFactory.ColValidInfo[0].length] = [i,"end_list"];
}
if(planmoney.length==0){
_user_valid_errors[0][_user_valid_errors[0].length]= "金额必填[第" + (i+1) +"行]";
TableFactory.ColValidInfo[0][TableFactory.ColValidInfo[0].length] = [i,"plan_money"];
}
if(Number(endlist)<Number(startlist)){
_user_valid_errors[0][_user_valid_errors[0].length]= "结束期次必须大于开始期次[第" + (i+1) +"行]";
TableFactory.ColValidInfo[0][TableFactory.ColValidInfo[0].length] = [i,"end_list"];
}
}
}
function deleteRecord(){
//s_c_p[0]+1 当前页 s_p_c[0] 最后一页
if(s_c_p[0]+1<s_p_c[0]){
alert('请依次从最后一期开始删除!');
return;
}
var count=getRowCount(0);
var rentList = getItemValue(0,getRow(0),'START_LIST');
var start=getItemValue(0,count-1,'start_list');
if(Number(rentList) < start){
alert('请依次从最后一期开始删除!');
return;
}
if(confirm('确实要删除吗?'))as_delete(0)
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>