receipt.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551
  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. console.log(amount);
  70. if(amount=='')
  71. return alert('请填写汇款金额');
  72. $("#amountInp"+tr).val(amount);
  73. form.submit();
  74. }
  75. function expensesDefray(status,rid){
  76. var form = $('#verifyOpinion_'+rid);
  77. $('#status_'+rid).val(status);
  78. form.submit();
  79. }
  80. function showOpinion(receiptOrder){
  81. //console.log(receiptOrder);
  82. $('#orderBody').html('读取中');
  83. var url="/ajaxGetReceiptOrder";
  84. $.ajax({
  85. url:url,
  86. type: "post",
  87. cache: false,
  88. dataType: "json",
  89. data: {
  90. receiptOrder:receiptOrder
  91. },
  92. global: true,
  93. success: function(data){
  94. if(data.status==1)
  95. $('#orderBody').html(data.receiptHtml);
  96. else
  97. $('#orderBody').html('没找到信息');
  98. },
  99. error:function(err){
  100. }
  101. });
  102. }
  103. $(function() {
  104. $('select[node-implement]').change(function(){
  105. //$item=$(this).attr('value');
  106. // var action = $('#up').attr("action");
  107. // action=encodeURI(action+'/'+$item);
  108. // $('#up').attr("action",action);
  109. $('#up').submit();
  110. console.log();
  111. });
  112. $('button[node-qmk="tm"]').click(function(){
  113. var id=$(this).attr('data');
  114. $('#'+id).attr('value',$('#'+id).attr('data-tm'));
  115. });
  116. $('a[node-ReceiptBack="true"]').click(function(){
  117. var rid=$(this).attr("p-d");
  118. var opinion=$('#opinion_'+rid).val();
  119. var url="/approvalChe";
  120. $.ajax({
  121. url:url,
  122. type: "post",
  123. cache: false,
  124. dataType: "json",
  125. data: {
  126. rid:rid,
  127. opinion:opinion
  128. },
  129. global: true,
  130. success: function(data){
  131. if(data.status==2){
  132. alert('参数错误');
  133. }else{
  134. window.location.href="/approvalExpenses/pendApproval";
  135. }
  136. },
  137. error:function(err){
  138. }
  139. });
  140. });
  141. $("a[id^=examine]").click(function(){
  142. var rid=$(this).attr('data');
  143. var url="/ajaxExamine";
  144. $.ajax({
  145. url:url,
  146. type: "post",
  147. cache: false,
  148. dataType: "json",
  149. data: {
  150. rid:rid
  151. },
  152. global: true,
  153. success: function(data){
  154. if(data.status==0){
  155. alert('参数错误');
  156. }
  157. var count=data.receipt.length;
  158. if(count!=0){
  159. if(data.receipt.Rtype==1){
  160. window.location.href="/expensesEdi/"+data.receipt.rid;
  161. }else if(data.receipt.Rtype==0){
  162. window.location.href="/receiptburEdi/"+data.receipt.rid;
  163. }else if(data.receipt.Rtype==2){
  164. window.location.href="/remitApproval/"+data.receipt.rid;
  165. }
  166. }else
  167. alert('没有需要审批的费用');
  168. },
  169. error:function(err){
  170. }
  171. });
  172. });
  173. $("a[id^=examineExe]").click(function(){
  174. var rid=$(this).attr('data');
  175. var url="/ajaxExamineExe";
  176. $.ajax({
  177. url:url,
  178. type: "post",
  179. cache: false,
  180. dataType: "json",
  181. data: {
  182. rid:rid
  183. },
  184. global: true,
  185. success: function(data){
  186. if(data.status==0){
  187. alert('参数错误');
  188. }
  189. var count=data.receipt.length;
  190. if(count!=0){
  191. window.location.href="/implement/"+data.receipt.ridKey+".html";
  192. }else
  193. alert('没有需要审批的费用');
  194. console.log(data);
  195. },
  196. error:function(err){
  197. }
  198. });
  199. });
  200. $("input[id^='agency_']").change(function() {
  201. $i=0;
  202. $("input[id^='agency_']").each(function(i){
  203. $i+=parseFloat(this.value);
  204. });
  205. $("#agencyResult").html("¥"+$i.toFixed(2));
  206. $("#agencyR").val($i.toFixed(2));
  207. var travelR=parseFloat($("#travelR").val());
  208. var trainR=parseFloat($("#trainR").val());
  209. var otherR=parseFloat($("#otherR").val());
  210. var RS=parseFloat($i)+parseFloat(travelR)+parseFloat(trainR)+parseFloat(otherR);
  211. $("#RS").html("¥"+RS.toFixed(2));
  212. });
  213. $("input[id^='travel_']").change(function() {
  214. $i=0;
  215. $("input[id^='travel_']").each(function(i){
  216. $i+=parseFloat(this.value);
  217. });
  218. $("#travelResult").html("¥"+$i.toFixed(2));
  219. $("#travelR").val($i.toFixed(2));
  220. var agencyR=$("#agencyR").val();
  221. var trainR=parseFloat($("#trainR").val());
  222. var otherR=parseFloat($("#otherR").val());
  223. var RS=parseFloat($i)+parseFloat(agencyR)+trainR+otherR;
  224. $("#RS").html("¥"+RS.toFixed(2));
  225. });
  226. $("input[id^='train_']").change(function() {
  227. $i=0;
  228. $("input[id^='train_']").each(function(i){
  229. $i+=parseFloat(this.value);
  230. });
  231. $("#trainResult").html("¥"+$i.toFixed(2));
  232. $("#trainR").val($i.toFixed(2));
  233. var agencyR=$("#agencyR").val();
  234. var otherR=parseFloat($("#otherR").val());
  235. var travelR=parseFloat($("#travelR").val());
  236. var RS=parseFloat($i)+parseFloat(agencyR)+travelR+otherR;
  237. $("#RS").html("¥"+RS.toFixed(2));
  238. });
  239. $("input[id^='other_']").change(function() {
  240. $i=0;
  241. $("input[id^='other_']").each(function(i){
  242. $i+=parseFloat(this.value);
  243. });
  244. $("#otherResult").html("¥"+$i.toFixed(2));
  245. $("#otherR").val($i.toFixed(2));
  246. var agencyR=$("#agencyR").val();
  247. var travelR=parseFloat($("#travelR").val());
  248. var trainR=parseFloat($("#trainR").val());
  249. var RS=parseFloat($i)+parseFloat(agencyR)+parseFloat(travelR)+parseFloat(trainR);
  250. $("#RS").html("¥"+RS.toFixed(2));
  251. });
  252. $("a[id^='getStaffInfo']").click(function(){
  253. var username=$(this).attr('data');
  254. var url="/getStaffInfo";
  255. $.ajax({
  256. url:url,
  257. type: "post",
  258. cache: false,
  259. dataType: "json",
  260. data: {
  261. username:username
  262. },
  263. global: true,
  264. success: function(data){
  265. if(data.success){
  266. alert('请重新登录');
  267. }
  268. $('#staffInfo').html(data.html);
  269. $('#staffInfo').show();
  270. $('#longleLog').hide();
  271. $('#clientInfo').hide();
  272. $('#changeCompany').hide();
  273. },
  274. error:function(err){
  275. }
  276. });
  277. });
  278. $("a[id^='getClientInfo']").click(function(){
  279. var client=$(this).attr('data');
  280. var url="/getClientInfo";
  281. $.ajax({
  282. url:url,
  283. type: "post",
  284. cache: false,
  285. dataType: "json",
  286. data: {
  287. client:client
  288. },
  289. global: true,
  290. success: function(data){
  291. if(data.success){
  292. alert('请重新登录');
  293. }
  294. $('#clientInfo').html(data.html);
  295. $('#clientInfo').show();
  296. $('#staffInfo').hide();
  297. $('#longleLog').hide();
  298. $('#addClient').hide();
  299. $('#changeCompany').hide();
  300. autoFlashHeight();
  301. },
  302. error:function(err){
  303. autoFlashHeight();
  304. }
  305. });
  306. });
  307. $("a[id^='getCompanyInfo']").click(function(){
  308. alert('dd');
  309. });
  310. $("a[id^='getLongleLog_']").click(function() {
  311. var lid=$(this).attr('data');
  312. var url="/ajaxGetLongle";
  313. $.ajax({
  314. url:url,
  315. type: "post",
  316. cache: false,
  317. dataType: "json",
  318. data: {
  319. lid:lid
  320. },
  321. global: true,
  322. success: function(data){
  323. if(data.success==false){
  324. alert('请重新登录');
  325. }
  326. $("#klid").val(data.klid);
  327. $("#longleTitle").html(data.longle.key_num);
  328. var lka='<a href="javascript:void(0)" onclick="getStaffInfo(\''+data.longle.responsible+'\')" >'+data.longle.responsible+'</a>';
  329. $("#longleResponsible").html(lka);
  330. var kk="";
  331. if(data.longle.alloted_time!="")
  332. kk="期限:"+data.longle.alloted_time;
  333. $("#longleStatus").html(data.longle.statusT+"/"+data.longle.product+"/("+data.longle.version+")"+kk);
  334. $("#LongleLogHtml").html(data.longleLogHtml);
  335. if(data.longle.status>=3){
  336. $("#longleStatus_5").attr('disabled',false);
  337. $("#longleStatus_6").attr('disabled',false);
  338. $("#longleStatus_7").attr('disabled',false);
  339. $("#longleStatus_8").attr('disabled',false);
  340. }
  341. $('#staffInfo').hide();
  342. $("#longleLog").show();
  343. $('#clientInfo').hide();
  344. autoFlashHeight();
  345. },
  346. error:function(err){
  347. // easyDialog.open({
  348. // container : { content : '请输入正确的参数'},
  349. // autoClose : 1500,
  350. // overlay : false
  351. // });
  352. }
  353. });
  354. });
  355. $("a[node-invoice='INFO']").click(function() {
  356. var postData = $(this).attr("data-isKey");
  357. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  358. $("#nc").html('illegal request');
  359. var url = "/ajaxGetReceiptDetails";
  360. $.ajax({
  361. url : url,
  362. type : "post",
  363. cache : false,
  364. dataType : "json",
  365. data : {
  366. serial : postData
  367. },
  368. global : true,
  369. success : function(data) {
  370. if (data.status == 1) {
  371. //$("div[loading-msg='true']").html("");
  372. $("#nc").html(data.html);
  373. }
  374. },
  375. error : function(err) {
  376. $("div[loading-msg='true']").html("");
  377. }
  378. });
  379. });
  380. $("form[name='recepitAdd']").validator({
  381. timely: 3,
  382. focusCleanup: true,
  383. theme:"yellow_top",
  384. rules: {
  385. remittanceBankType: function() {
  386. var rbt=$('select[node-rbt]').val();
  387. if(rbt==0)
  388. return false;
  389. return true;
  390. }
  391. },
  392. fields: {
  393. 'verify': 'required; ',
  394. 'explanation':'required; ',
  395. 'remittanceName':'required; ',
  396. 'bankName':'required; ',
  397. 'bankNumber':'required; ',
  398. 'coupletNumber':'required(remittanceBankType); '
  399. }
  400. });
  401. $("select[node-rbt]").change(function(){
  402. var rbt=$(this).val();
  403. if(rbt==0){
  404. $("tr[node-cn]").hide();
  405. }else if(rbt==1){
  406. $("tr[node-cn]").show();
  407. }
  408. });
  409. })
  410. function selectToolTipCl(name){
  411. var e = is_ie ? event : selectToolTipCl.caller.arguments[0];
  412. obj = is_ie ? e.srcElement : e.target;
  413. var arr = document.getElementsByName(name);
  414. var k = arr.length;
  415. for ( var i = 0; i < k; i++) {
  416. arr[i].checked = obj.checked;
  417. }
  418. $('#addToolTag').hide();
  419. }
  420. function selectTagCl(name){
  421. var e = is_ie ? event : selectTagCl.caller.arguments[0];
  422. obj = is_ie ? e.srcElement : e.target;
  423. var arr = document.getElementsByName(name);
  424. var k = arr.length;
  425. for ( var i = 0; i < k; i++) {
  426. arr[i].checked = obj.checked;
  427. }
  428. }
  429. function checkall(name) {
  430. var e = is_ie ? event : checkall.caller.arguments[0];
  431. obj = is_ie ? e.srcElement : e.target;
  432. var arr = document.getElementsByName(name);
  433. var k = arr.length;
  434. for ( var i = 0; i < k; i++) {
  435. arr[i].checked = obj.checked;
  436. }
  437. }
  438. if (is_ie)
  439. document.documentElement.addBehavior("#default#userdata");
  440. var userAgent = navigator.userAgent.toLowerCase();
  441. var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);