tBActivitiCostPayTmpCompanyCash-add.jsp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
  2. <%@include file="/context/mytags.jsp" %>
  3. <!DOCTYPE html>
  4. <html>
  5. <head>
  6. <title>现金报销单add页面</title>
  7. <style>
  8. .ui-button {
  9. display: inline-block;
  10. padding: 2px 2px;
  11. margin-bottom: 0;
  12. font-size: 8px;
  13. font-weight: normal;
  14. line-height: 1.42857143;
  15. text-align: center;
  16. white-space: nowrap;
  17. vertical-align: middle;
  18. -ms-touch-action: manipulation;
  19. touch-action: manipulation;
  20. cursor: pointer;
  21. -webkit-user-select: none;
  22. -moz-user-select: none;
  23. -ms-user-select: none;
  24. user-select: none;
  25. background-image: none;
  26. border: 1px solid transparent;
  27. border-radius: 4px;
  28. }
  29. </style>
  30. <t:base type="jquery,easyui,tools,DatePicker"></t:base>
  31. <script type="text/javascript">
  32. $(document).ready(function () {
  33. $('#tt').tabs({
  34. onSelect: function (title) {
  35. changeTabHeight();
  36. }
  37. });
  38. $(".tabs-wrap").css('width', '100%');
  39. $.Datatype.checkHour = function (val, obj, frm) {
  40. var msg = true;
  41. return msg;
  42. }
  43. });
  44. function changeTabHeight() {
  45. var height = window.top.document.body.offsetHeight;
  46. height = height - 181.3 - 36 - 100 - 4;//去掉底部输入框table高度、title高度、弹出框小于后台页面高度、文本格式高度
  47. $('#tt .panel-body').css('width', 'auto').css('height', height + 'px');
  48. }
  49. /*var _t;
  50. function openSameDepartUserSelect() {
  51. _t= $(this);
  52. var departId=$('#departId').val();
  53. selectUserByDepart(departId,'选择加班员工',callbacSameDepartUserSelect);
  54. }
  55. function callbacSameDepartUserSelect(selectedRows){
  56. var one = selectedRows[0];
  57. var userid = one.id;
  58. var realName = one.realName;
  59. _t.val(realName);
  60. _t.parent().find('[name$="userid"]').val(userid);
  61. var index=getIndex(_t.attr('name'));
  62. $('#compensate'+index).change();
  63. }
  64. function moneySelectChange() {
  65. var val = $(this).find(':selected').val();
  66. var name = $(this).attr('name');
  67. var index = getIndex(name);
  68. var money=$('#money'+index);
  69. if(val=='exchange'){//调休
  70. money.val(0);
  71. money.attr('readonly','readonly');
  72. changeTotalMoney();
  73. //显示用户调休账户余额
  74. var userId=$('#userid'+index).val();
  75. if(userId){
  76. var month = $('#month').val();
  77. $.post('tBExchangeAccountController.do?getAccountBalance',{userId:userId,year:month},function (d) {
  78. $('#exchangeAccountLeft'+index).val(d);
  79. });
  80. }
  81. }else {//加班费
  82. money.removeAttr('readonly');
  83. $('#exchangeAccountLeft'+index).val('');
  84. changeMoney(index);
  85. }
  86. }
  87. function getIndex(name){
  88. var indexStart = name.indexOf('[');
  89. var indexEnd=name.indexOf(']');
  90. var index = name.substr(indexStart+1,(indexEnd-indexStart-1));
  91. return index;
  92. }*/
  93. function bindStartTimeClick() {
  94. WdatePicker({dateFmt: 'yyyy-MM-dd HH:mm:ss'});
  95. }
  96. function bindEndTimeClick() {
  97. WdatePicker({dateFmt: 'yyyy-MM-dd HH:mm:ss'});
  98. }
  99. function changeMonth() {
  100. $('#add_tBusActivitiOvertimeDetail_table').html('');
  101. changeTotalMoney();
  102. changeTotalTime();
  103. }
  104. </script>
  105. </head>
  106. <body>
  107. <%--处理回调--%>
  108. <c:set var="_callback">
  109. <c:choose>
  110. <c:when test="${in_process}">@Overridecallback</c:when>
  111. <c:otherwise>callback</c:otherwise>
  112. </c:choose>
  113. </c:set>
  114. <t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table" tiptype="1"
  115. action="tBActivitiCostPayTmpCompanyController.do?doAdd"
  116. callback="${_callback}" beforeSubmit="beforeSubmit">
  117. <input id="id" name="id" type="hidden" value="${entity.id }"/>
  118. <t:tabs id="tt" iframe="false" tabPosition="top" fit="false">
  119. <t:tab href="tBActivitiCostPayTmpCompanyController.do?tBActivitiCostPayTmpCompanyCashList&id=${tBActivitiCostPayTmpCompanyPage.id}&in_process=${in_process}&flag=${param.flag}"
  120. icon="icon-search" title="现金报销录入" id="tBusActivitiOvertimeDetail"></t:tab>
  121. </t:tabs>
  122. <table cellpadding="0" cellspacing="1" class="formtable">
  123. <tr>
  124. <td align="right">
  125. <label class="Validform_label">科室:</label>
  126. </td>
  127. <td class="value">
  128. <%-- <input type="hidden" name="departId" id="departId"--%>
  129. <%-- value="${empty tBActivitiCostPayTmpCompanyPage.departId?param.departId:tBActivitiCostPayTmpCompanyPage.departId}"/>--%>
  130. <%-- <input type="hidden" name="depName" id="depName"--%>
  131. <%-- value="${empty tBActivitiCostPayTmpCompanyPage.depName?param.depName:tBActivitiCostPayTmpCompanyPage.depName}"/>--%>
  132. <%-- ${empty tBActivitiCostPayTmpCompanyPage.depName?param.depName:tBActivitiCostPayTmpCompanyPage.depName}--%>
  133. </td>
  134. <td align="right">
  135. <label class="Validform_label">金额总计:</label>
  136. </td>
  137. <td class="value">
  138. <%-- <input id="month" name="month" type="text" style="width: 70px" class="inputxt" datatype="*"--%>
  139. <%-- readonly="readonly"--%>
  140. <%-- value="${empty tBActivitiCostPayTmpCompanyPage.month?month:tBActivitiCostPayTmpCompanyPage.month}"--%>
  141. <%-- onClick="WdatePicker({dateFmt:'yyyy-MM'})" onchange="changeMonth()"--%>
  142. <%-- />--%>
  143. <%-- <span class="Validform_checktip"></span>--%>
  144. <%-- <label class="Validform_label" style="display: none;">核算工资月度</label>--%>
  145. </td>
  146. <td align="right">
  147. <label class="Validform_label">发票张数总计:</label>
  148. </td>
  149. <td class="value">
  150. <%-- <input id="totalHour" name="totalHour" type="text" style="width: 70px" class="inputxt"--%>
  151. <%-- readonly="readonly"--%>
  152. <%-- value="${empty tBActivitiCostPayTmpCompanyPage.totalHour?0:tBActivitiCostPayTmpCompanyPage.totalHour}"/>--%>
  153. <%-- <span class="Validform_checktip"></span>--%>
  154. <%-- <label class="Validform_label" style="display: none;">加班时长总计</label>--%>
  155. </td>
  156. <td align="right">
  157. <label class="Validform_label">付款方式:</label>
  158. </td>
  159. <td class="value">
  160. <%-- <input id="totalMoney" name="totalMoney" type="text" style="width: 70px" class="inputxt"--%>
  161. <%-- readonly="readonly" ignore="ignore"--%>
  162. <%-- value="${empty tBActivitiCostPayTmpCompanyPage.totalMoney?0:tBActivitiCostPayTmpCompanyPage.totalMoney}"/>--%>
  163. <%-- <span class="Validform_checktip"></span>--%>
  164. <%-- <label class="Validform_label" style="display: none;">总金额</label>--%>
  165. </td>
  166. </tr>
  167. <tr>
  168. <td align="right">
  169. <label class="Validform_label">附件:</label>
  170. </td>
  171. <td class="value" align="left" colspan="3">
  172. <t:webUploader auto="true" busiId="${tBActivitiCostPayTmpCompanyPage.id}"
  173. readOnly="${param.load=='detail' || in_process}"
  174. busiTable="t_bus_activiti_overtime"
  175. bizType="overtime"
  176. extensions="png,jpg,jpeg,bmp"
  177. name="attachment" duplicate="true" fileNumLimit="10"
  178. nullMsg="附件不可为空"></t:webUploader>
  179. <span class="Validform_checktip Validform_right" style="display: none;">文件已上传</span>
  180. </td>
  181. </tr>
  182. </table>
  183. </t:formvalid>
  184. <!-- 添加 附表明细 模版 -->
  185. <table style="display:none">
  186. <tbody id="add_tBusActivitiOvertimeDetail_table_template">
  187. <tr>
  188. <td align="center">
  189. <div style="width: 25px;" name="xh"></div>
  190. </td>
  191. <td align="center"><input style="width:20px;" type="checkbox" name="ck"/></td>
  192. <td align="left">
  193. <input name="tBusActivitiOvertimeDetailList[#index#].userid" id="userid#index#" maxlength="32" type="hidden"
  194. class="inputxt" datatype="*"/>
  195. <input name="tBusActivitiOvertimeDetailList[#index#].realName" id="realName#index#"
  196. maxlength="32" type="text" readonly="readonly" class="inputxt"/>
  197. <label class="Validform_label" style="display: none;">加班员工</label>
  198. </td>
  199. <td align="left">
  200. <input name="tBusActivitiOvertimeDetailList[#index#].startTime" id="startTime#index#" maxlength="32"
  201. type="text" class="Wdate" style="width:150px;" readonly="readonly"
  202. onchange="datejisuan(this)"
  203. />
  204. <label class="Validform_label" style="display: none;">加班开始时间</label>
  205. </td>
  206. <td align="left">
  207. <input name="tBusActivitiOvertimeDetailList[#index#].endTime" id="endTime#index#" maxlength="32" type="text"
  208. class="Wdate" style="width:150px;" readonly="readonly"
  209. onchange="datejisuan(this)"
  210. />
  211. <label class="Validform_label" style="display: none;">加班结束时间</label>
  212. </td>
  213. <td align="left">
  214. <input name="tBusActivitiOvertimeDetailList[#index#].hour" id="hour#index#" maxlength="32" type="text"
  215. class="inputxt" style="width:120px;" datatype="d"/>
  216. <%--<span>0小时</span>--%>
  217. <label class="Validform_label" style="display: none;">加班时长</label>
  218. </td>
  219. <td align="left">
  220. <t:dictSelect field="tBusActivitiOvertimeDetailList[#index#].compensate" type="list" id="compensate#index#"
  221. typeGroupCode="overtime_compensate" defaultVal="money" hasLabel="false" title="补偿方式"
  222. datatype="*"></t:dictSelect>
  223. <label class="Validform_label" style="display: none;">补偿方式</label>
  224. </td>
  225. <td align="left">
  226. <input name="tBusActivitiOvertimeDetailList[#index#].money" id="money#index#" maxlength="32" type="text"
  227. class="inputxt" style="width:120px;" datatype="d,fix2"
  228. value="0"
  229. onchange="changeTotalMoney()"
  230. />
  231. <label class="Validform_label" style="display: none;">加班费</label>
  232. </td>
  233. <td align="left">
  234. <input type="text" id="exchangeAccountLeft#index#" class="inputxt" style="width:120px;"
  235. readonly="readonly"/>
  236. </td>
  237. <td align="left">
  238. <input name="tBusActivitiOvertimeDetailList[#index#].mealsSubsidy" type="text" class="inputxt"
  239. id="mealsSubsidy#index#" style="width:120px;" datatype="d,fix2" value="0.00"/>
  240. <label class="Validform_label" style="display: none;">餐费补助</label>
  241. </td>
  242. <td align="center">
  243. <input name="tBusActivitiOvertimeDetailList[#index#].confirm" type="checkbox" class="checkbox"
  244. style="width:54px;text-align: center;margin-left: 30px"/>
  245. <label class="Validform_label" style="display: none;">大合同以外费用</label>
  246. </td>
  247. <td align="left">
  248. <input name="tBusActivitiOvertimeDetailList[#index#].remark" maxlength="255" type="text" class="inputxt"
  249. style="width:300px;"/>
  250. <label class="Validform_label" style="display: none;">备注</label>
  251. </td>
  252. </tr>
  253. </tbody>
  254. </table>
  255. <table style="width: 100%">
  256. <tr>
  257. <td style="text-align:center;">
  258. <%@include file="../view_submit_buttons.jsp" %>
  259. </td>
  260. </tr>
  261. </table>
  262. </body>
  263. <script>
  264. function datejisuan(obj) {
  265. var index = getIndex($(obj).attr('name'));
  266. var startTime = $("#startTime" + index).val();
  267. var endTime = $("#endTime" + index).val();
  268. // console.log(index+","+startTime+","+endTime);
  269. if (startTime && endTime) {
  270. var hours = diffTime(startTime, endTime);
  271. var hourInput = $('#hour' + index);
  272. hourInput.val(hours);
  273. // hourInput.next().html(hours+"小时");
  274. changeTotalTime();
  275. changeMoney(index);
  276. }
  277. }
  278. function changeTotalTime() {
  279. var totalHour = 0;
  280. $('input[name$="hour"]').each(function () {
  281. var hour = $(this).val();
  282. if (hour) {
  283. totalHour += parseFloat(hour);
  284. }
  285. })
  286. $('#totalHour').val(totalHour);
  287. $('#totalHourText').html(totalHour + "小时");
  288. }
  289. function changeMoney(index) {
  290. var select = $('#compensate' + index);
  291. var selectVal = select.find(":selected").val();
  292. if (selectVal == 'money') {//加班费
  293. var hour = $('#hour' + index).val();
  294. var userId = $('#userid' + index).val();
  295. if (hour) {
  296. $.post('tBusActivitiOvertimeController.do?getBaseHourWage', {userId: userId}, function (d) {
  297. var money = parseFloat(hour) * d * 1.5;
  298. $('#money' + index).val(money.toFixed(1));
  299. changeTotalMoney();
  300. });
  301. }
  302. }
  303. }
  304. function changeTotalMoney() {
  305. var totalMoney = 0;
  306. $('input[name$="money"]').each(function () {
  307. var money = $(this).val();
  308. if (money) {
  309. totalMoney += parseFloat(money);
  310. }
  311. });
  312. totalMoney = totalMoney.toFixed(1);
  313. $('#totalMoney').val(totalMoney);
  314. $('#totalMoneyText').html(totalMoney + "元");
  315. }
  316. function diffmm(startDate, endDate) {
  317. var diff = Date.parse(endDate.replace(/-/g, "/")) - Date.parse(startDate.replace(/-/g, "/"));//时间差的毫秒数
  318. return Math.round(diff / (60 * 1000));
  319. }
  320. function diffTime(startDate, endDate) {
  321. var diff = Date.parse(endDate.replace(/-/g, "/")) - Date.parse(startDate.replace(/-/g, "/"));//时间差的毫秒数
  322. //计算出相差天数
  323. var days = Math.floor(diff / (24 * 3600 * 1000));
  324. //计算出小时数
  325. var leftHour = diff % (3600 * 1000) / 3600 / 1000; //计算小时后剩余的毫秒数
  326. if (leftHour >= 0.5) {
  327. leftHour = 0.5;
  328. } else {
  329. leftHour = 0;
  330. }
  331. var hours = Math.floor(diff / (3600 * 1000)) + leftHour;
  332. if (hours < 0) {
  333. hours = 0;
  334. }
  335. return hours;
  336. }
  337. function beforeSubmit() {
  338. var length = $('#tt').find('input[name$="userid"]').length;
  339. if (length == 0) {
  340. tip('请添加加班用户');
  341. return false;
  342. }
  343. changeTotalTime();
  344. changeTotalMoney();
  345. return true;
  346. }
  347. </script>