表格表单横向纵向计算

<%-- declareDataadd.jsp 申报表数据填写 --%>
<%-- Version V 1.0 --%>
<%-- author:lidongzhe Date:2012/12/04 新规 Version V 1.0 --%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/web/common/taglibs.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'declareDataadd.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	<link rel="stylesheet" type="text/css" href="<%=basePath%>/styles/themes/icon.css">
	<link rel="stylesheet" type="text/css" href="<%=basePath%>/styles/standard.css" />
	<script type="text/javascript" src="<%=basePath%>/js/jquery-1.7.1.min.js"></script>

	<script type="text/javascript" src="<%=basePath%>/js/validatebox-min.js"></script>
	<script type="text/javascript" src="<%=basePath%>/js/lhgdialog.min.js"></script>
	<script type="text/javascript" src="<%=basePath%>/js/message.js"></script>

	
	<script type="text/javascript">

		$(function(){
			var inps = $("#tab").find("input");
			
			// 表单数据即时计算    
			inps.keyup(function(){

			// 第5行数据由上面列计算得出
			for(col = 2; col < 12; col ++){
				$("#tab tr:eq(6) > td:eq(" + col + ") > input:eq(0)").val(
					$("#tab tr:eq(2) > td:eq(" + col + ") > input:eq(0)").val()
				);
				for(row=3;row<6;row++){
					$("#tab tr:eq(6) > td:eq(" + col + ") > input:eq(0)").val(
						Number($("#tab tr:eq(6) > td:eq(" + col + ") > input:eq(0)").val()) - 
						Number($("#tab tr:eq(" + row + ") > td:eq(" + col + ") > input:eq(0)").val())
					);
				}
			}
			
			// 横向总计求和
			for(row = 2; row < 8; row ++){
				$("#tab tr:eq(" + row + ") > td:eq(12) > input:eq(0)").val(0);
				// 单行求和
				for(col=2;col<12;col++){
					$("#tab tr:eq(" + row + ") > td:eq(12) > input:eq(0)").val(
						Number($("#tab tr:eq(" + row + ") > td:eq(12) > input:eq(0)").val()) + 
						Number($("#tab tr:eq(" + row + ") > td:eq(" + col + ") > input:eq(0)").val())
					);
				}
			} 
			
			
			
			});	    
			// 为表单name赋值				
			inps.each(setName);
	    });
	    
	    // 为表单动态分配name
	    function setName(){
	    	var trNum = Number($(this).parent("td").parent("tr").prevAll().length) - 1;
	    	var colNum = Number($(this).parent("td").prevAll().length) - 1;
	    	if(trNum == 10){
	    		trNum = 'A';
	    	}else if(trNum == 11){
	    		trNum = 'B';
	    	}
	    	if(colNum == 10){
	    		colNum = 'A';
	    	}else if(colNum == 11){
	    		colNum = 'B';
	    	}
	    	var name = "declareData" + trNum + colNum;
	    	$(this).attr("name", name);
	    }
	    

	    
    </script>
  </head>
  
  <body>
  	<div id="bodyStr">
  	<div align="center">
  		<font size="4">保险保障基金汇算清缴申报表</font>
  	</div>
  	<table width="100%">
  		<tr>
  			<td>公司名称(盖章):</td>
  			<td></td>
  			<td>缴纳年度:</td>
  			<td></td>
  			<td>开业日期:</td>
  			<td></td>
  		</tr>
  		<tr>
  			<td>填报日期</td>
  			<td>&nbsp;&nbsp;年&nbsp;&nbsp;月&nbsp;&nbsp;日</td>
  			<td></td>
  			<td></td>
  			<td></td>
  			<td>单位:元(列至角分)</td>
  		</tr>
  	</table>
  	<form action="<%=basePath %>/bs/fns/declare/Declare!saveOrUpdate.do" method="post">
    <table id="tab" class="viewtabe"  border="0" cellpadding="2" cellspacing="0" >
	    <tr>
	        <td rowspan="2"  align="center">
	        	项目
	        </td>
	        <td rowspan="2" align="left" >
	        	行次
	        </td>
	        <td rowspan="2" align="left" >
	        	非投资型财产险
	        </td>
	        <td colspan="2" align="left" >投资型财产险</td>
	        <td rowspan="2" align="left" >非投资型意外险</td>
	        <td colspan="2" align="left" >投资型意外险</td>
	        <td rowspan="2" align="left" >短期健康保险</td>
	        <td rowspan="2" align="left" >有保证收益人寿保险</td>
	        <td rowspan="2" align="left" >无保证收益人寿保险</td>
	        <td rowspan="2" align="left">长期健康保险</td>
	        <td rowspan="2" align="left">总计</td>
	    </tr>
	    <tr>
	    	<td align="left" >有保证收益</td>
	    	<td align="left" >无保证收益</td>
	    	<td align="left" >有保证收益</td>
	    	<td align="left" >无保证收益</td>
	    </tr>
	    <tr>
	    	<td>保险业务收入</td>
	    	<td>(1)</td>
	    	<td><input type="text" name="" value="${declareData11}" size="3" validType="isNum"/></td>
	    	<td><input type="text"  value="${declareData12}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData13}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData14}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData15}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData16}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData17}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData18}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData19}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData1A}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData1B}" readonly="true" size="3" validType="isNum" /></td>
	    </tr>
	   	<tr>
	    	<td>减:境外直接保险的收入</td>
	    	<td>(2)</td>
	    	<td><input type="text"  value="${declareData21}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData22}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData23}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData24}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData25}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData26}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData27}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData28}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData29}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData2A}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData2B}" readonly="true" size="3" validType="isNum" /></td>
	    </tr>
	    <tr>
	    	<td>分保费收入</td>
	    	<td>(3)</td>
	    	<td><input type="text"  value="${declareData31}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData32}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData33}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData34}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData35}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData36}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData37}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData38}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData39}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData3A}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData3B}" readonly="true" size="3" validType="isNum" /></td>
	    </tr>
	    <tr>
	    	<td>由国务院确定的国家财政承担最终风险的政策性保险行业</td>
	    	<td>(4)</td>
	    	<td><input type="text"  value="${declareData41}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData42}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData43}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData44}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData45}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData46}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData47}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData48}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData49}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData4A}" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData4B}" readonly="true" size="3" validType="isNum" /></td>
	    </tr>
	    <tr>
	    	<td>二、应缴纳基金的保险业务收入</td>
	    	<td>(5)</td>
	    	<td><input type="text"  value="${declareData51}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData52}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData53}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData54}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData55}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData56}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData57}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData58}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData59}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData5A}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData5B}" readonly="true" size="3" validType="isNum" /></td>
	    </tr>	    
	    <tr>
	    	<td>三、应缴纳基金额</td>
	    	<td>(6)</td>
	    	<td><input type="text"  value="${declareData61}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData62}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData63}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData64}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData65}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData66}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData67}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData68}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData69}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData6A}" readonly="true" size="3" validType="isNum" /></td>
	    	<td><input type="text"  value="${declareData6B}" readonly="true" size="3" validType="isNum" /></td>
	    </tr>
  
	</table>
	</form>
	<table width="100%">
		<tr>
			<td>法定代表人:</td><td></td>
			<td>财务负责人:</td><td></td>
			<td>制表人:</td><td></td>
		</tr>
		<tr>
			<td class="bottombar" colspan="6" align="center">
			    <a href="javascript:{saveDeclareData()}" class="easyui-linkbutton" data-options="iconCls:'icon-save'">保 存</a>
			    <a href="javascript:stampAndSubmit()" class="easyui-linkbutton" data-options="iconCls:'icon-help'">盖章提交</a>
		    </td>
		</tr>
	</table>
	</div>
  </body>
</html>

你可能感兴趣的:(jsp)