tBActivitiCostPayTmpCompany-add.jsp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. <%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
  2. <%@ page import="javassist.expr.NewArray" %>
  3. <%@include file="/context/mytags.jsp" %>
  4. <!DOCTYPE html>
  5. <html>
  6. <head>
  7. <title>请款申请单</title>
  8. <t:base type="jquery,easyui,tools,DatePicker,autocomplete"></t:base>
  9. <script src="webpage/cn/com/lzt/useractiviti/select_user_tools.js"></script>
  10. <script src="webpage/cn/com/lzt/cost/cost_tools.js"></script>
  11. <script type="text/javascript">
  12. //编写自定义JS代码
  13. var sourceIds = '${sourceIds}';
  14. var pageType = '${pageType}';
  15. var fileListInfo = []
  16. function openCostRequest(sourceType) {
  17. //获取主键id
  18. var id = $('#id').val();
  19. var params = {};
  20. params.id = id;
  21. $('#sourceType').val(sourceType);
  22. setBySourceType();
  23. if (sourceType == 'cost_request') {
  24. selectCostRequest(params, function (selectRows) {
  25. var one = selectRows[0];
  26. var summary = one.summary;
  27. var requestId = one.id;
  28. $('#sourceType').val(one.sourceType);
  29. $('#requestSummary').val(summary);
  30. $('#requestSummaryTxt').html(summary);
  31. $('#requestId').val(requestId);
  32. $('#expectMoney').val(one.expectMoney);
  33. $('#expectMoneyTxt').html(one.expectMoney);
  34. $('#payMoney').val(one.expectMoney);
  35. $('#costTypeId').val(one.costType);
  36. $('#showMeasureName').val(one.measureName);
  37. $('#showDep').val(one.depName);
  38. $('#showDepTxt').html(one.depName);
  39. });
  40. } else {
  41. // var ids = $('#sourceIds').val();
  42. var id = $('#id').val();
  43. selectCompanyProducts(id, function (selectRows) {
  44. $('#requestSummary').html('采购单报销');
  45. var infoArray = new Array();
  46. var idArray = new Array();
  47. var departNameObj = {};
  48. var money = 0;
  49. for (var i = 0; i < selectRows.length; i++) {
  50. var one = selectRows[i];
  51. infoArray.push(one.id + "#" + one.sourceType);
  52. idArray.push(one.id);
  53. departNameObj[one.departName] = '1';
  54. money += parseFloat(one.money);
  55. }
  56. money = money.toFixed(2);
  57. $('#requestId').val(infoArray.join(','));
  58. $('#sourceIds').val(idArray.join(','));
  59. $('#payMoney').val(money);
  60. $('#expectMoney').val(money);
  61. $('#expectMoneyTxt').html(money);
  62. var summary = '采购单报销';
  63. $('#requestSummary').val(summary);
  64. $('#requestSummaryTxt').html(summary);
  65. var departNameArray = [];
  66. var oriDepartName = $('#depName').val();
  67. for (var k in departNameObj) {
  68. departNameArray.push(k);
  69. }
  70. $('#showDep').val(departNameArray.join(','));
  71. $('#showDepTxt').html(departNameArray.join(','));
  72. var supplierId = selectRows[0].supplierId;
  73. getRelatedUnitInfo(supplierId);
  74. }, '100%', '100%');
  75. }
  76. }
  77. // add-刘梦祥-2021年11月9日15:25:07-数据渲染逻辑优化,文件渲染获取逻辑
  78. $(() => {
  79. if (pageType === 'Update' || pageType === 'Detail') {
  80. fileListInfo = JSON.parse(JSON.stringify(${entity.attachment}))
  81. changeFileListDom()
  82. }
  83. })
  84. // add-刘梦祥-2021年11月5日14:39:52-自定义上传文件回调函数
  85. function uploadSuccess(response) {
  86. if (response.success) {
  87. var fileList = $('#attachment')
  88. var fileListVar = fileList.val()
  89. //去重
  90. if (fileListVar.indexOf(response.attributes.name) !== -1) {
  91. //重复的话直接return
  92. return;
  93. } else {
  94. //得到返回的文件名和请求路径
  95. var fileInfo = {name: response.attributes.name, url: response.attributes.url}
  96. //总集合加入元素
  97. fileListInfo.push(fileInfo)
  98. //更新提示文件列表
  99. changeFileListDom()
  100. }
  101. }
  102. }
  103. //add-刘梦祥-2021年11月5日15:07:06-根据fileListInfo对象更新input绑定框中的值
  104. function changeAttachment() {
  105. $('#attachment').val(JSON.stringify(fileListInfo))
  106. }
  107. //add-刘梦祥-2021年11月5日14:43:33-更新提示文件列表
  108. function changeFileListDom() {
  109. //首先清空提示文件列表
  110. $('#fileListInfoDom').empty();
  111. //值不为空的话
  112. if (fileListInfo.length > 0) {
  113. fileListInfo.forEach((item, index) => {
  114. //生成临时标签
  115. var jspDomStr = `<div class="fileInfoItemBox"><div class="fileName">` + item.name + `</div>--文件上传成功--`
  116. if (pageType === 'Detail') {
  117. jspDomStr += `<a class="down" href="${webRoot}/` + item.url + `" download="` + item.name + `">下载</a>`;
  118. } else {
  119. jspDomStr += `<span class="del" onclick="deleteFile(` + index + `)">删除</span>`;
  120. }
  121. jspDomStr += `</div>`;
  122. //追加到显示的dom元素中
  123. $('#fileListInfoDom').append(jspDomStr)
  124. })
  125. }
  126. // 根据fileListInfo对象更新input绑定框中的值
  127. changeAttachment()
  128. }
  129. //add-刘梦祥-2021年11月5日15:03:17-删除文件操作
  130. function deleteFile(index) {
  131. fileListInfo.splice(index, 1)
  132. changeFileListDom()
  133. }
  134. function beforeSubmit() {
  135. return true;
  136. }
  137. $(function () {
  138. $('#amount').bind('change', changeAmount);
  139. $('#tax').bind('change', changeTax);
  140. $('#invoicetype').bind('change', changeInvoicetype);
  141. $('#invoicetype').change();
  142. $.Datatype.checkMoney = function (val, obj, frm) {
  143. var select = $('#invoicetype');
  144. var invoicetype = select.val();
  145. var money = parseFloat($('#payMoney').val()).toFixed(2);
  146. if (invoicetype == 'special') {//专票验证金额+税额
  147. var amount = $('#amount').val();
  148. var tax = $('#tax').val()
  149. if (money != parseFloat(parseFloat(amount) + parseFloat(tax)).toFixed(2)) {
  150. return "价税合计与金额+税额不符";
  151. }
  152. }
  153. var expectMoney = $('#expectMoney').val();
  154. if (parseFloat(expectMoney) < parseFloat(money)) {
  155. return '当前报销额度超过费用申请额度,请重新提交费用申请';
  156. }
  157. return true;
  158. }
  159. $('#costTypeSelect4fixasset').bind('change', function () {
  160. $('#costTypeId').val($(this).val());
  161. })
  162. setBySourceType();
  163. $('#relatedUnitsId').bind('change', function () {//收款人自动补全后,补全其他银行信息
  164. var t = $(this);
  165. getRelatedUnitInfo(t.val());
  166. });
  167. });
  168. function changeAmount() {
  169. var t = $(this);
  170. var tax = $('#tax');
  171. var taxVal = tax.val();
  172. var payMoney = $('#payMoney');
  173. var payMoneyVal = payMoney.val();
  174. var amountVal = t.val();
  175. if (taxVal && parseFloat(taxVal) != 0) {
  176. payMoney.val((parseFloat(taxVal) + parseFloat(amountVal)).toFixed(2));
  177. } else if (payMoneyVal) {
  178. tax.val((parseFloat(payMoneyVal) - parseFloat(amountVal)).toFixed(2));
  179. }
  180. //金额小写转大写
  181. var amountA = $('#amountA')
  182. amountA.val(chineseNumber($('#amount').val()))
  183. }
  184. //金额小写转大写
  185. function chineseNumber(num) {
  186. if (isNaN(num) || num > Math.pow(10, 12))
  187. return ""
  188. var cn = "零壹贰叁肆伍陆柒捌玖"
  189. var unit = new Array("拾百千", "分角")
  190. var unit1 = new Array("万亿", "")
  191. var numArray = num.toString().split(".")
  192. var start = new Array(numArray[0].length - 1, 2)
  193. function toChinese(num, index) {
  194. var num = num.replace(/\d/g, function ($1) {
  195. return cn.charAt($1) + unit[index].charAt(start-- % 4 ? start % 4 : -1)
  196. })
  197. return num
  198. }
  199. for (var i = 0; i < numArray.length; i++) {
  200. var tmp = ""
  201. for (var j = 0; j * 4 < numArray[i].length; j++) {
  202. var strIndex = numArray[i].length - (j + 1) * 4
  203. var str = numArray[i].substring(strIndex, strIndex + 4)
  204. var start = i ? 2 : str.length - 1
  205. var tmp1 = toChinese(str, i)
  206. tmp1 = tmp1.replace(/(零.)+/g, "零").replace(/零+$/, "")
  207. tmp1 = tmp1.replace(/^壹拾/, "拾")
  208. tmp = (tmp1 + unit1[i].charAt(j - 1)) + tmp
  209. }
  210. numArray[i] = tmp
  211. }
  212. numArray[1] = numArray[1] ? numArray[1] : ""
  213. numArray[0] = numArray[0] ? numArray[0] + "元" : numArray[0], numArray[1] = numArray[1].replace(/^零+/, "")
  214. numArray[1] = numArray[1].match(/分/) ? numArray[1] : numArray[1]
  215. return numArray[0] + numArray[1]
  216. }
  217. function changeTax() {
  218. var t = $(this);
  219. var amount = $('#amount');
  220. var amountVal = amount.val();
  221. var payMoney = $('#payMoney');
  222. var payMoneyVal = payMoney.val();
  223. var taxVal = t.val();
  224. if (amountVal && parseFloat(amountVal) != 0) {
  225. payMoney.val((parseFloat(taxVal) + parseFloat(amountVal)).toFixed(2));
  226. } else if (payMoneyVal) {
  227. amount.val((parseFloat(payMoneyVal) - parseFloat(taxVal)).toFixed(2));
  228. }
  229. }
  230. function changeInvoicetype() {
  231. var t = $(this);
  232. var val = t.val();
  233. var amount = $('#amount');
  234. var tax = $('#tax');
  235. if (val == 'special') {//专票
  236. amount.removeAttr('readonly');
  237. tax.removeAttr('readonly');
  238. } else {// 普票、定额、其他
  239. amount.val(0);
  240. tax.val(0);
  241. amount.attr('readonly', 'readonly');
  242. tax.attr('readonly', 'readonly');
  243. }
  244. }
  245. function setBySourceType() {
  246. var sourceType = $('#sourceType').val();
  247. if (sourceType.indexOf('cost_request') != -1) {
  248. $('#costTypeTr').show();
  249. } else {
  250. $('#costTypeTr').hide();
  251. }
  252. }
  253. function getRelatedUnitInfo(relatedUnitsId) {
  254. $.post("relatedUnitsController.do?relatedUnitsExtrainfo", {relatedUnitsId: relatedUnitsId}, function (data) {
  255. $('#bankName').val(data.depositBank);
  256. $('#bankUser').val(data.unitname);
  257. $('#bankNum').val(data.account);
  258. $('#contactUser').val(data.contactName);
  259. $('#contactWay').val(data.telPhone);
  260. }, 'json');
  261. }
  262. </script>
  263. </head>
  264. <body>
  265. <%--处理回调--%>
  266. <c:set var="_callback">
  267. <c:choose>
  268. <c:when test="${in_process}">@Overridecallback</c:when>
  269. <c:otherwise>callback</c:otherwise>
  270. </c:choose>
  271. </c:set>
  272. <t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table"
  273. action="tBActivitiCostPayTmpCompanyController.do?doAdd"
  274. callback="${_callback}" beforeSubmit="beforeSubmit">
  275. <input id="id" name="id" type="hidden" value="${entity.id }"/>
  276. <%-- 费用类型--%>
  277. <input id="sourceType" name="sourceType" type="hidden" value="${entity.sourceType }"/>
  278. <%-- add-刘梦祥-2021年11月4日16:56:18-(在该页面指定单据类型值)--%>
  279. <input id="documentsType" name="documentsType" field="documentsType" type="hidden" value="pleass_type"/>
  280. <table style="width: 600px;" cellpadding="0" cellspacing="1" class="formtable">
  281. <input id="finCode" name="finCode" type="hidden" value="${empty entity.finCode?param.finCode:entity.finCode}"/>
  282. <c:if test="${in_process && param.flag!=1}">
  283. <tr>
  284. <td align="right">
  285. <label class="Validform_label">
  286. 申请人:
  287. </label>
  288. </td>
  289. <td class="value">
  290. ${entity.realName}
  291. </td>
  292. </tr>
  293. </c:if>
  294. <%-- 刘梦祥:这个科室的选择应该用一个下拉框,由于数据是动态的,所以不能用字典表。但是没有找到更好的方法,所以需要将字典表中的部门id和name与当前使用的字典表对应一下--%>
  295. <tr>
  296. <td align="right">
  297. <label class="Validform_label">
  298. 科室:
  299. </label>
  300. </td>
  301. <td class="value">
  302. <t:dictSelect field="sysOrgCode" id="sysOrgCode" type="list" dictTable="t_s_depart" dictField="id" dictText="departname" dictCondition=" where org_type != '1' "
  303. datatype="*" defaultVal="${entity.sysOrgCode}"
  304. hasLabel="false" title="科室"></t:dictSelect>
  305. </td>
  306. </tr>
  307. <tr>
  308. <td align="right">
  309. <label class="Validform_label">
  310. <span color="red" class="requiredIcon">*</span>事由:
  311. </label>
  312. </td>
  313. <td class="value">
  314. <input id="reason" name="reason" type="text" style="width: 150px" class="inputxt" datatype="*"
  315. value="${entity.reason}"/>
  316. <span class="Validform_checktip"></span>
  317. <label class="Validform_label" style="display: none;">事由</label>
  318. </td>
  319. </tr>
  320. <tr>
  321. <td align="right">
  322. <label class="Validform_label">
  323. <span color="red" class="requiredIcon">*</span>发票类型:
  324. </label>
  325. </td>
  326. <td class="value">
  327. <t:dictSelect field="invoicetype" id="invoicetype" type="list" typeGroupCode="invoicetype" datatype="*"
  328. defaultVal="${entity.invoicetype}"
  329. hasLabel="false" title="发票类型"></t:dictSelect>
  330. </td>
  331. </tr>
  332. <tr>
  333. <td align="right">
  334. <label class="Validform_label">
  335. <span color="red" class="requiredIcon">*</span>收款方:
  336. </label>
  337. </td>
  338. <td class="value">
  339. <input id="bankUser" name="bankUser" type="text" class="inputxt" datatype="*"
  340. value="${entity.bankUser}"/>
  341. <span class="Validform_checktip"></span>
  342. <label class="Validform_label" style="display: none;">收款方</label>
  343. </td>
  344. </tr>
  345. <tr>
  346. <td align="right">
  347. <label class="Validform_label">
  348. <span color="red" class="requiredIcon">*</span>银行账户:
  349. </label>
  350. </td>
  351. <td class="value">
  352. <input id="bankNum" name="bankNum" type="text" style="width: 150px" class="inputxt" datatype="*"
  353. value="${entity.bankNum}"/>
  354. <span class="Validform_checktip"></span>
  355. <label class="Validform_label" style="display: none;">银行账户</label>
  356. </td>
  357. </tr>
  358. <tr>
  359. <td align="right">
  360. <label class="Validform_label">
  361. <span color="red" class="requiredIcon">*</span>付款方式:
  362. </label>
  363. </td>
  364. <td class="value">
  365. <t:dictSelect field="paytype" id="paytype" type="list" typeGroupCode="paytype" datatype="*"
  366. defaultVal="${entity.paytype}"
  367. hasLabel="false" title="付款方式"></t:dictSelect>
  368. </td>
  369. </tr>
  370. <tr>
  371. <td align="right">
  372. <label class="Validform_label">
  373. <span color="red" class="requiredIcon">*</span>金额合计:
  374. </label>
  375. </td>
  376. <td class="value">
  377. <input name="amount" id="amount" maxlength="10" type="text" class="inputxt" style="width:150px;"
  378. datatype="d,fix2" value="${entity.amount}"/>
  379. <span class="Validform_checktip"></span>
  380. <label class="Validform_label" style="display: none;">金额合计</label>
  381. </td>
  382. </tr>
  383. <tr>
  384. <td align="right">
  385. <label class="Validform_label">
  386. 金额(大写):
  387. </label>
  388. </td>
  389. <td class="value">
  390. <input name="amountA" id="amountA" type="text" class="inputxt" readonly style="width:150px;border:none;"
  391. value="${entity.amountA}"/>
  392. </td>
  393. </tr>
  394. <tr id="costTypeTr" style="display: none;">
  395. <td align="right">
  396. <label class="Validform_label">
  397. 发票张数:
  398. </label>
  399. </td>
  400. <td class="value">
  401. <input type="hidden" name="costTypeId" id="costTypeId" value="${entity.costTypeId}"/>
  402. <input name="showMeasureName" id="showMeasureName" type="text" class="inputxt" style="width:150px;"
  403. readonly="readonly" value="${entity.showMeasureName}"/>
  404. </td>
  405. </tr>
  406. <tr>
  407. <td align="right">
  408. <label class="Validform_label">
  409. 备注:
  410. </label>
  411. </td>
  412. <td class="value">
  413. <textarea name="remark" id="remark" style="width:200px;height: 70px"
  414. class="inputxt">${entity.remark}</textarea>
  415. </td>
  416. </tr>
  417. <tr>
  418. <td align="right">
  419. <label class="Validform_label">
  420. 附件:
  421. </label>
  422. </td>
  423. <td class="value">
  424. <%-- 暂存文件信息--%>
  425. <textarea name="attachment" id="attachment" style="width:200px;height: 70px;display: none;"
  426. class="inputxt">${entity.attachment}</textarea>
  427. <%-- 上传按钮--%>
  428. <t:webUploader auto="true"
  429. url="cgUploadController.do?ajaxSaveFile"
  430. busiTable="t_b_activiti_cost_pay_tmp_company"
  431. extensions="xls,xlsx,doc,docx,png,jpg,jpeg,pdf"
  432. duplicate="true"
  433. name="requestSummary"
  434. callback="uploadSuccess"
  435. showHis="false"
  436. fileNumLimit="10"
  437. displayTxt="false"
  438. nullMsg="附件不可为空"></t:webUploader>
  439. <%--自定义显示文件列表--%>
  440. <div id="fileListInfoDom">
  441. <p>支持xls,xlsx,doc,docx,png,jpg,jpeg,pdf格式的文件,文件不超过10Mb!</p>
  442. </div>
  443. </td>
  444. </tr>
  445. </table>
  446. <table style="width: 100%">
  447. <tr>
  448. <td style="text-align:center;">
  449. <%@include file="/webpage/cn/com/lzt/useractiviti/view_submit_buttons.jsp" %>
  450. </td>
  451. </tr>
  452. </table>
  453. </t:formvalid>
  454. </body>
  455. <script src="webpage/cn/com/lzt/cost/activiti/tmpcompany/tBActivitiCostPayTmpCompany.js"></script>
  456. <style>
  457. /*文件列表文字样式*/
  458. .fileInfoItemBox {
  459. display: flex;
  460. align-items: center;
  461. width: 300px;
  462. color: #67C23A;
  463. }
  464. /*文件列表文字样式*/
  465. .fileName {
  466. width: 100px;
  467. overflow: hidden;
  468. text-overflow: ellipsis;
  469. white-space: nowrap;
  470. color: #999;
  471. text-decoration: underline;
  472. }
  473. /*文件列表下载按钮样式*/
  474. .down {
  475. cursor: pointer;
  476. color: #67C23A;
  477. }
  478. .down:hover {
  479. cursor: pointer;
  480. color: #67C23A;
  481. }
  482. .down:active {
  483. cursor: pointer;
  484. color: #67C23A;
  485. }
  486. /*文件列表删除按钮样式*/
  487. .del {
  488. cursor: pointer;
  489. color: #F56C6C;
  490. }
  491. .del:hover {
  492. cursor: pointer;
  493. color: #F56C6C;
  494. }
  495. .del:active {
  496. cursor: pointer;
  497. color: #F56C6C;
  498. }
  499. </style>