receipt.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  1. function check(){
  2. if (confirm("确认是否提交本次报销单,点击确定提交开始审批,点击取消关闭本窗口。"))
  3. return true;
  4. else return false;
  5. }
  6. function receiptYear(){
  7. var form = $('#up');
  8. $('#year').val($('#Y').val());
  9. form.submit();
  10. }
  11. function receiptDate(){
  12. var form = $('#up');
  13. //$('#year').val($('#date').val());
  14. form.submit();
  15. }
  16. function reportCatePM(){
  17. var name=$('#reportCate').val();
  18. $("option[node-all='true']").show();
  19. if(name=='ALL'){
  20. $("tr[node-all='true']").show();
  21. $("option[node-all='true']").show();
  22. }else{
  23. $("tr[node-all='true']").hide();
  24. $("option[node-all='true']").hide();
  25. $("option[node-cate='"+name+"']").show();
  26. $("tr[node-boxCate='"+name+"']").show();
  27. }
  28. }
  29. function reportPM(){
  30. var name=$('#report').val();
  31. if(name=='ALL')
  32. $("tr[node-all='true']").show();
  33. else{
  34. $("tr[node-all='true']").hide();
  35. $("tr[node-box='"+name+"']").show();
  36. }
  37. }
  38. function receiptMoth(){
  39. var form = $('#up');
  40. $('#year').val($('#Y').val());
  41. $('#month').val($('#M').val());
  42. //alert($('#M').val());
  43. form.submit();
  44. }
  45. function receiptDay(){
  46. var form = $('#up');
  47. $('#year').val($('#Y').val());
  48. $('#month').val($('#M').val());
  49. $('#day').val($('#D').val());
  50. form.submit();
  51. }
  52. function receiptSop(){
  53. var form = $('#up');
  54. $('#year').val($('#Y').val());
  55. $('#month').val($('#M').val());
  56. $('#day').val($('#D').val());
  57. $('#sop').val($('#S').val());
  58. form.submit();
  59. }
  60. function updateApprovalReceipt(status,rid){
  61. var form = $('#verifyOpinion_'+rid);
  62. $('#status_'+rid).val(status);
  63. $("input[name='amount']").val($('#amount').val());
  64. form.submit();
  65. }
  66. function setExeReceipt(tr,rid){
  67. var form = $('#implement'+tr);
  68. var amount=$('#amount'+tr).val();
  69. var accountBank=$('#accountBankSelect'+tr).val();
  70. console.log(amount);
  71. if(amount=='')
  72. return alert('请填写汇款金额');
  73. $("#amountInp"+tr).val(amount);
  74. $("#accountBank"+tr).val(accountBank);
  75. form.submit();
  76. }
  77. function expensesDefray(status,rid){
  78. var form = $('#verifyOpinion_'+rid);
  79. $('#status_'+rid).val(status);
  80. form.submit();
  81. }
  82. function showOpinion(receiptOrder){
  83. //console.log(receiptOrder);
  84. $('#orderBody').html('读取中');
  85. var url="/ajaxGetReceiptOrder";
  86. $.ajax({
  87. url:url,
  88. type: "post",
  89. cache: false,
  90. dataType: "json",
  91. data: {
  92. receiptOrder:receiptOrder
  93. },
  94. global: true,
  95. success: function(data){
  96. if(data.status==1)
  97. $('#orderBody').html(data.receiptHtml);
  98. else
  99. $('#orderBody').html('没找到信息');
  100. },
  101. error:function(err){
  102. }
  103. });
  104. }
  105. $(function() {
  106. $('select[node-implement]').change(function(){
  107. //$item=$(this).attr('value');
  108. // var action = $('#up').attr("action");
  109. // action=encodeURI(action+'/'+$item);
  110. // $('#up').attr("action",action);
  111. $('#up').submit();
  112. console.log();
  113. });
  114. $('button[node-qmk="tm"]').click(function(){
  115. var id=$(this).attr('data');
  116. $('#'+id).attr('value',$('#'+id).attr('data-tm'));
  117. });
  118. $('a[node-ReceiptBack="true"]').click(function(){
  119. var rid=$(this).attr("p-d");
  120. var opinion=$('#opinion_'+rid).val();
  121. var url="/approvalChe";
  122. $.ajax({
  123. url:url,
  124. type: "post",
  125. cache: false,
  126. dataType: "json",
  127. data: {
  128. rid:rid,
  129. opinion:opinion
  130. },
  131. global: true,
  132. success: function(data){
  133. if(data.status==2){
  134. alert('参数错误');
  135. }else{
  136. window.location.href="/approvalExpenses/pendApproval";
  137. }
  138. },
  139. error:function(err){
  140. }
  141. });
  142. });
  143. $("a[id^=examine]").click(function(){
  144. var rid=$(this).attr('data');
  145. var url="/ajaxExamine";
  146. $.ajax({
  147. url:url,
  148. type: "post",
  149. cache: false,
  150. dataType: "json",
  151. data: {
  152. rid:rid
  153. },
  154. global: true,
  155. success: function(data){
  156. if(data.status==0){
  157. alert('参数错误');
  158. }
  159. var count=data.receipt.length;
  160. if(count!=0){
  161. if(data.receipt.Rtype==1){
  162. window.location.href="/expensesEdi/"+data.receipt.rid;
  163. }else if(data.receipt.Rtype==0){
  164. window.location.href="/receiptburEdi/"+data.receipt.rid;
  165. }else if(data.receipt.Rtype==2){
  166. window.location.href="/remitApproval/"+data.receipt.rid;
  167. }
  168. }else
  169. alert('没有需要审批的费用');
  170. },
  171. error:function(err){
  172. }
  173. });
  174. });
  175. $("a[id^=examineExe]").click(function(){
  176. var rid=$(this).attr('data');
  177. var url="/ajaxExamineExe";
  178. $.ajax({
  179. url:url,
  180. type: "post",
  181. cache: false,
  182. dataType: "json",
  183. data: {
  184. rid:rid
  185. },
  186. global: true,
  187. success: function(data){
  188. if(data.status==0){
  189. alert('参数错误');
  190. }
  191. var count=data.receipt.length;
  192. if(count!=0){
  193. window.location.href="/implement/"+data.receipt.ridKey+".html";
  194. }else
  195. alert('没有需要审批的费用');
  196. console.log(data);
  197. },
  198. error:function(err){
  199. }
  200. });
  201. });
  202. $("input[id^='agency_']").change(function() {
  203. $i=0;
  204. $("input[id^='agency_']").each(function(i){
  205. $i+=parseFloat(this.value);
  206. });
  207. $("#agencyResult").html("¥"+$i.toFixed(2));
  208. $("#agencyR").val($i.toFixed(2));
  209. var travelR=parseFloat($("#travelR").val());
  210. var trainR=parseFloat($("#trainR").val());
  211. var otherR=parseFloat($("#otherR").val());
  212. var RS=parseFloat($i)+parseFloat(travelR)+parseFloat(trainR)+parseFloat(otherR);
  213. $("#RS").html("¥"+RS.toFixed(2));
  214. });
  215. $("input[id^='travel_']").change(function() {
  216. $i=0;
  217. $("input[id^='travel_']").each(function(i){
  218. $i+=parseFloat(this.value);
  219. });
  220. $("#travelResult").html("¥"+$i.toFixed(2));
  221. $("#travelR").val($i.toFixed(2));
  222. var agencyR=$("#agencyR").val();
  223. var trainR=parseFloat($("#trainR").val());
  224. var otherR=parseFloat($("#otherR").val());
  225. var RS=parseFloat($i)+parseFloat(agencyR)+trainR+otherR;
  226. $("#RS").html("¥"+RS.toFixed(2));
  227. });
  228. $("input[id^='train_']").change(function() {
  229. $i=0;
  230. $("input[id^='train_']").each(function(i){
  231. $i+=parseFloat(this.value);
  232. });
  233. $("#trainResult").html("¥"+$i.toFixed(2));
  234. $("#trainR").val($i.toFixed(2));
  235. var agencyR=$("#agencyR").val();
  236. var otherR=parseFloat($("#otherR").val());
  237. var travelR=parseFloat($("#travelR").val());
  238. var RS=parseFloat($i)+parseFloat(agencyR)+travelR+otherR;
  239. $("#RS").html("¥"+RS.toFixed(2));
  240. });
  241. $("input[id^='other_']").change(function() {
  242. $i=0;
  243. $("input[id^='other_']").each(function(i){
  244. $i+=parseFloat(this.value);
  245. });
  246. $("#otherResult").html("¥"+$i.toFixed(2));
  247. $("#otherR").val($i.toFixed(2));
  248. var agencyR=$("#agencyR").val();
  249. var travelR=parseFloat($("#travelR").val());
  250. var trainR=parseFloat($("#trainR").val());
  251. var RS=parseFloat($i)+parseFloat(agencyR)+parseFloat(travelR)+parseFloat(trainR);
  252. $("#RS").html("¥"+RS.toFixed(2));
  253. });
  254. $("a[id^='getStaffInfo']").click(function(){
  255. var username=$(this).attr('data');
  256. var url="/getStaffInfo";
  257. $.ajax({
  258. url:url,
  259. type: "post",
  260. cache: false,
  261. dataType: "json",
  262. data: {
  263. username:username
  264. },
  265. global: true,
  266. success: function(data){
  267. if(data.success){
  268. alert('请重新登录');
  269. }
  270. $('#staffInfo').html(data.html);
  271. $('#staffInfo').show();
  272. $('#longleLog').hide();
  273. $('#clientInfo').hide();
  274. $('#changeCompany').hide();
  275. },
  276. error:function(err){
  277. }
  278. });
  279. });
  280. $("a[id^='getClientInfo']").click(function(){
  281. var client=$(this).attr('data');
  282. var url="/getClientInfo";
  283. $.ajax({
  284. url:url,
  285. type: "post",
  286. cache: false,
  287. dataType: "json",
  288. data: {
  289. client:client
  290. },
  291. global: true,
  292. success: function(data){
  293. if(data.success){
  294. alert('请重新登录');
  295. }
  296. $('#clientInfo').html(data.html);
  297. $('#clientInfo').show();
  298. $('#staffInfo').hide();
  299. $('#longleLog').hide();
  300. $('#addClient').hide();
  301. $('#changeCompany').hide();
  302. autoFlashHeight();
  303. },
  304. error:function(err){
  305. autoFlashHeight();
  306. }
  307. });
  308. });
  309. $("a[id^='getCompanyInfo']").click(function(){
  310. alert('dd');
  311. });
  312. $("a[id^='getLongleLog_']").click(function() {
  313. var lid=$(this).attr('data');
  314. var url="/ajaxGetLongle";
  315. $.ajax({
  316. url:url,
  317. type: "post",
  318. cache: false,
  319. dataType: "json",
  320. data: {
  321. lid:lid
  322. },
  323. global: true,
  324. success: function(data){
  325. if(data.success==false){
  326. alert('请重新登录');
  327. }
  328. $("#klid").val(data.klid);
  329. $("#longleTitle").html(data.longle.key_num);
  330. var lka='<a href="javascript:void(0)" onclick="getStaffInfo(\''+data.longle.responsible+'\')" >'+data.longle.responsible+'</a>';
  331. $("#longleResponsible").html(lka);
  332. var kk="";
  333. if(data.longle.alloted_time!="")
  334. kk="期限:"+data.longle.alloted_time;
  335. $("#longleStatus").html(data.longle.statusT+"/"+data.longle.product+"/("+data.longle.version+")"+kk);
  336. $("#LongleLogHtml").html(data.longleLogHtml);
  337. if(data.longle.status>=3){
  338. $("#longleStatus_5").attr('disabled',false);
  339. $("#longleStatus_6").attr('disabled',false);
  340. $("#longleStatus_7").attr('disabled',false);
  341. $("#longleStatus_8").attr('disabled',false);
  342. }
  343. $('#staffInfo').hide();
  344. $("#longleLog").show();
  345. $('#clientInfo').hide();
  346. autoFlashHeight();
  347. },
  348. error:function(err){
  349. // easyDialog.open({
  350. // container : { content : '请输入正确的参数'},
  351. // autoClose : 1500,
  352. // overlay : false
  353. // });
  354. }
  355. });
  356. });
  357. $("a[node-invoice='INFO']").click(function() {
  358. var postData = $(this).attr("data-isKey");
  359. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  360. $("#nc").html('illegal request');
  361. var url = "/ajaxGetReceiptDetails";
  362. $.ajax({
  363. url : url,
  364. type : "post",
  365. cache : false,
  366. dataType : "json",
  367. data : {
  368. serial : postData
  369. },
  370. global : true,
  371. success : function(data) {
  372. if (data.status == 1) {
  373. //$("div[loading-msg='true']").html("");
  374. $("#nc").html(data.html);
  375. }
  376. },
  377. error : function(err) {
  378. $("div[loading-msg='true']").html("");
  379. }
  380. });
  381. });
  382. $("form[name='recepitAdd']").validator({
  383. timely: 3,
  384. focusCleanup: true,
  385. theme:"yellow_top",
  386. rules: {
  387. remittanceBankType: function() {
  388. var rbt=$('select[node-rbt]').val();
  389. if(rbt==0)
  390. return false;
  391. return true;
  392. }
  393. },
  394. fields: {
  395. 'verify': 'required; ',
  396. 'explanation':'required; ',
  397. 'remittanceName':'required; ',
  398. 'bankName':'required; ',
  399. 'bankNumber':'required; ',
  400. 'coupletNumber':'required(remittanceBankType); '
  401. }
  402. });
  403. $("select[node-rbt]").change(function(){
  404. var rbt=$(this).val();
  405. if(rbt==0){
  406. $("tr[node-cn]").hide();
  407. }else if(rbt==1){
  408. $("tr[node-cn]").show();
  409. }
  410. });
  411. //培训班结算
  412. $("form[name='receiptTrainAdd']").validator({
  413. timely: 3,
  414. focusCleanup: true,
  415. theme:"yellow_top",
  416. rules: {
  417. remittanceBankType: function() {
  418. var rbt=$('select[node-rbt]').val();
  419. if(rbt==0)
  420. return false;
  421. return true;
  422. }
  423. },
  424. fields: {
  425. 'verify': 'required; ',
  426. 'explanation':'required; ',
  427. 'remittanceName':'required; ',
  428. 'bankName':'required; ',
  429. 'bankNumber':'required; ',
  430. 'coupletNumber':'required(remittanceBankType); ',
  431. 'trainName':'required; ',
  432. 'trainStartDate':'required; ',
  433. 'trainEndDate':'required; ',
  434. 'participants':'required; ',
  435. 'trainAddress':'required; ',
  436. }
  437. });
  438. $("a[getReceiptLoan]").click(function() {
  439. $.ajax({
  440. url:"/ajaxGetReceiptTrainLoan",
  441. type: "post",
  442. cache: false,
  443. dataType: "json",
  444. data: {
  445. },
  446. global: true,
  447. success: function(data){
  448. var html='';
  449. for(var i=0;i<data.receiptLoanList.length;i++){
  450. html +='<option value="'+data.receiptLoanList[i].ridKey+'">'+data.receiptLoanList[i].receiptOrder+' ¥'+data.receiptLoanList[i].sum+'</option>';
  451. }
  452. $("select[receiptLoanSelect]").html(html);
  453. },
  454. error:function(err){}
  455. });
  456. });
  457. })
  458. function selectToolTipCl(name){
  459. var e = is_ie ? event : selectToolTipCl.caller.arguments[0];
  460. obj = is_ie ? e.srcElement : e.target;
  461. var arr = document.getElementsByName(name);
  462. var k = arr.length;
  463. for ( var i = 0; i < k; i++) {
  464. arr[i].checked = obj.checked;
  465. }
  466. $('#addToolTag').hide();
  467. }
  468. function selectTagCl(name){
  469. var e = is_ie ? event : selectTagCl.caller.arguments[0];
  470. obj = is_ie ? e.srcElement : e.target;
  471. var arr = document.getElementsByName(name);
  472. var k = arr.length;
  473. for ( var i = 0; i < k; i++) {
  474. arr[i].checked = obj.checked;
  475. }
  476. }
  477. function checkall(name) {
  478. var e = is_ie ? event : checkall.caller.arguments[0];
  479. obj = is_ie ? e.srcElement : e.target;
  480. var arr = document.getElementsByName(name);
  481. var k = arr.length;
  482. for ( var i = 0; i < k; i++) {
  483. arr[i].checked = obj.checked;
  484. }
  485. }
  486. if (is_ie)
  487. document.documentElement.addBehavior("#default#userdata");
  488. var userAgent = navigator.userAgent.toLowerCase();
  489. var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);