budgetTempSheet-measure4Hr.jsp 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  2. <%@include file="/context/mytags.jsp"%>
  3. <!doctype html>
  4. <html>
  5. <head>
  6. <t:base type="jquery,easyui,tools,DatePicker"></t:base>
  7. <meta charset="utf-8" />
  8. <meta name="spreadjs culture" content="zh-cn" />
  9. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  10. <style>
  11. .sample-spreadsheets {
  12. width: calc(100% - 400px);
  13. height: 100%;
  14. overflow: hidden;
  15. float: left;
  16. }
  17. .sample-spreadsheets-statusBar {
  18. width: calc(100% - 400px);
  19. overflow: hidden;
  20. float: left;
  21. }
  22. .options-container{
  23. /* float: right;*/
  24. width: 400px;
  25. padding: 12px;
  26. height: 100%;
  27. box-sizing: border-box;
  28. background: #fbfbfb;
  29. overflow: auto;
  30. }
  31. .option-row {
  32. font-size: 14px;
  33. padding: 5px;
  34. margin-top: 10px;
  35. }
  36. </style>
  37. <script>
  38. <c:if test="${periodEntity==null}">
  39. alert('${tempSheet.periodYear}年未设置预算周期,请联系管理员');
  40. history.go(-1);
  41. </c:if>
  42. </script>
  43. </head>
  44. <body style="background:#FFFFFF">
  45. <!-- <form id="form1" runat="server"> -->
  46. <div>
  47. <div id="div2">
  48. <%@include file="budgetTempSheet-buttons.jsp"%>
  49. </div>
  50. <div class="sample-tutorial" style="top: 20px;width:calc(100vw - 80px); height: calc(100vh - 120px);">
  51. <div id="ss" class="sample-spreadsheets" ></div>
  52. <div id="statusBar" class="sample-spreadsheets-statusBar"></div>
  53. <div class="options-container">
  54. <div class="option-row" style="text-align:center">
  55. ${tempSheet.name}
  56. </div>
  57. <div class="option-row" id="bindMeasureDiv">
  58. <fieldset style="border:1px solid #666666;padding:5px">
  59. <legend>绑定维度</legend>
  60. <table id="bindTable" style="display: none">
  61. <tr>
  62. <td>含税维度:</td>
  63. <td>
  64. <input type="radio" id="includeTax1" name="includeTax" value="1" onclick="setIncludeTax(1)">含税
  65. <input type="radio" id="includeTax0" name="includeTax" value="0" onclick="setIncludeTax(0)">不含税
  66. </td>
  67. </tr>
  68. <tr>
  69. <td>预实维度:</td>
  70. <td>
  71. <input type="radio" id="expect1" name="expect" value="1" onclick="setExpect(1)">预算数
  72. <input type="radio" id="expect0" name="expect" value="0" onclick="setExpect(0)">实际数
  73. </td>
  74. </tr>
  75. <tr>
  76. <td>最低基本工资:</td>
  77. <td>
  78. <input type="text" id="basePay" style="width: 150px;"/>
  79. </td>
  80. </tr>
  81. <tr>
  82. <td>时间维度:</td>
  83. <td><input type="text" id="periodDetialName" style="width: 150px;" readonly="readonly"></td>
  84. <td>
  85. <c:if test="${!readonly}">
  86. <a href="#" class="easyui-linkbutton l-btn" iconcls="icon-synchronization" onclick="bindPeriodDetail()">
  87. 绑定
  88. </a>
  89. </c:if>
  90. </td>
  91. </tr>
  92. <tr>
  93. <td>人工费用合计:</td>
  94. <td><input type="text" id="amount" style="width: 150px;" readonly="readonly"></td>
  95. <td>
  96. <c:if test="${!readonly}">
  97. <a href="#" class="easyui-linkbutton l-btn" iconcls="icon-synchronization" onclick="bindOneMeasure('amount')">
  98. 绑定
  99. </a>
  100. </c:if>
  101. </td>
  102. </tr>
  103. <%-- <c:forEach items="${postTypeList}" var="type" varStatus="status">
  104. <tr>
  105. <td>${type.typename}:</td>
  106. <td><input type="text" id="${type.typecode}" style="width: 130px;" readonly="readonly"></td>
  107. <td>
  108. <c:if test="${!readonly}">
  109. <a href="#" class="easyui-linkbutton l-btn" iconcls="icon-synchronization" onclick="bindOneSubMeasure('${type.typecode}','${type.typename}',${status.index})">
  110. 绑定
  111. </a>
  112. </c:if>
  113. </td>
  114. </tr>
  115. </c:forEach>--%>
  116. </table>
  117. </fieldset>
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. <script>
  123. var sheetVar={};
  124. sheetVar.headerCount=3;
  125. sheetVar.bindMeasureStartCol=-2;
  126. var defaultPeriodDetailInfo={periodDetailId:"${defaultPeriodDetailEntity.id}",periodDetailName:"${defaultPeriodDetailEntity.name}"};
  127. var bindTotalRow=0;
  128. function bindOneMeasure(id){
  129. var row=bindTotalRow;
  130. var col=sheetVar.bindMeasureStartCol;
  131. selectMeasure(function(selectedRows){
  132. var sheet = spread.getActiveSheet();
  133. var one =selectedRows[0];
  134. one.findKey="total";
  135. bindMeasureValue(sheet,row,col,one);
  136. $('#'+id).val(one.name);
  137. var val={};
  138. val["c_"+id]=one.name;
  139. addSheetTagValue(sheet,val);
  140. sheet.setFormula(bindTotalRow,col,'subtotal(109,W:W)');
  141. },'100%','100%');
  142. }
  143. function bindOneSubMeasure(one,index){
  144. selectMeasure(function(selectedRows){
  145. $.extend(one,selectedRows[0]);
  146. _bindSubMeasure(one,index);
  147. },'100%','100%');
  148. }
  149. function _bindSubMeasure(one,index) {
  150. var sheet = spread.getActiveSheet();
  151. var sumCol= one.sumCol;
  152. var postType=one.postType;
  153. var col = sheetVar.bindMeasureStartCol+index+1;//+1 越过total
  154. bindMeasureValue(sheet,bindTotalRow,col,one);
  155. var formulaString='';
  156. if(postType=='sub'){
  157. formulaString ='subtotal(109,$sumCol)';
  158. formulaString = formulaString.replace('$sumCol',sumCol+":"+sumCol)
  159. }else {
  160. formulaString = 'SUMIF(B:B,"$postType",$sumCol)';
  161. formulaString = formulaString.replace('$postType',postType).replace("$sumCol",sumCol+":"+sumCol);
  162. }
  163. sheet.setFormula(bindTotalRow,col,formulaString);
  164. $('#'+one.findKey).val(one.name);
  165. var val={};
  166. val["c_"+one.findKey]=one.name;
  167. addSheetTagValue(sheet,val);
  168. }
  169. function bindMeasureValue(sheet,row,col,selectRow){
  170. setDataCell(sheet,row,col);
  171. var valueObj = {measureId:selectRow.id,measureName:selectRow.name};
  172. valueObj.datatype=selectRow.datatype;
  173. valueObj.fractionNum=selectRow.fractionNum;
  174. valueObj.currencySymbol=selectRow.currencySymbol;
  175. valueObj.showType=selectRow.showType;
  176. valueObj.thousandth=selectRow.thousandth;
  177. valueObj.findKey=selectRow.findKey;
  178. var oldFormula = sheet.getFormula(row,col);
  179. if(oldFormula) {
  180. if(selectRow.datatype=='amount'){
  181. if(selectRow.showType=='ten_thousand'){
  182. sheet.setFormula(row,col,oldFormula+'/10000');
  183. }
  184. if(selectRow.showType=='hundred_million'){
  185. sheet.setFormula(row,col,oldFormula+'/100000000');
  186. }
  187. }else{
  188. var i = oldFormula.indexOf('/');
  189. if(i>0){
  190. sheet.setFormula(row,col,oldFormula.substr(0,i));
  191. }
  192. }
  193. }
  194. addCellTagValue(sheet,row,col,valueObj);
  195. setAmountFormat(sheet,row,col,valueObj);
  196. var tag = sheet.tag();
  197. if(tag){
  198. if(tag.periodDetailInfo){
  199. addCellTagValue(sheet,row,col,tag.periodDetailInfo);
  200. }
  201. if(typeof tag.includeTax!="undefined"){
  202. addCellTagValue(sheet,row,col,{includeTax:tag.includeTax});
  203. }
  204. if(typeof tag.expect !="undefined"){
  205. addCellTagValue(sheet,row,col,{expect:tag.expect});
  206. }
  207. }
  208. }
  209. function bindPeriodDetail() {
  210. selectPeriodDetail(periodYear,function(obj){
  211. var sheet = spread.getActiveSheet();
  212. addSheetTagValue(sheet,{periodDetailInfo:obj});
  213. loopDataCell(sheet,function(row,col){
  214. addCellTagValue(sheet,row,col,obj)
  215. });
  216. $('#periodDetialName').val(obj.periodDetailName);
  217. })
  218. }
  219. function setIncludeTax(include){
  220. var sheet = spread.getActiveSheet();
  221. var obj = {includeTax:include};
  222. addSheetTagValue(sheet,obj);
  223. loopDataCell(sheet,function(row,col){
  224. addCellTagValue(sheet,row,col,obj)
  225. });
  226. }
  227. function setExpect(expect){
  228. var sheet = spread.getActiveSheet();
  229. var obj = {expect:expect};
  230. addSheetTagValue(sheet,obj);
  231. loopDataCell(sheet,function(row,col){
  232. addCellTagValue(sheet,row,col,obj)
  233. });
  234. }
  235. </script>
  236. <script src="webpage/cn/com/lzt/budget/tempsheet/budgetTempSheet-measure4Hr.js?v=2" type="text/javascript"></script>
  237. <script src="webpage/cn/com/lzt/budget/tempsheet/js/tempsheet_hr_header.js?v=2" type="text/javascript"></script>
  238. </body>
  239. </html>