invoice.js 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024
  1. var notify = null;
  2. var isNotifyShowing = false;
  3. var isError = false;
  4. //$(function() {
  5. // Notification.requestPermission(function(status) {});
  6. //
  7. // // 轮询查找是否有未处理的审批
  8. // var permission = Notification.permission;
  9. // if (permission === 'granted') {
  10. // var interval = setInterval(checkNotify, 90000);//
  11. // if (isError) {
  12. // clearInterval(interval);
  13. // }
  14. //
  15. // }
  16. //});
  17. /**
  18. * 获取未审批数量
  19. */
  20. function checkNotify() {
  21. $.ajax({
  22. url: '/ajaxInvoicePushNotice',
  23. type: 'get',
  24. data: '',
  25. dataType: 'json',
  26. error: function() {
  27. console.log('数据错误');
  28. isError = true;
  29. },
  30. success: function(response) {
  31. var isNotice = response.isNotice;
  32. if (isNotice && !isNotifyShowing) {
  33. notify = new Notification("你有发票需要审批", {
  34. // icon: '/global/img/wen.png111',
  35. body: '点击本消息可跳转至审批页',
  36. silent: true
  37. });
  38. notify.onclick = function() {
  39. notify.close();
  40. window.location.href = '/invoiceApproval';
  41. };
  42. notify.onshow = function () {
  43. isNotifyShowing = true;
  44. };
  45. notify.onclose = function () {
  46. isNotifyShowing = false;
  47. };
  48. }
  49. }
  50. });
  51. }
  52. //
  53. function receiptYear(){
  54. var form = $('#up');
  55. $('#year').val($('#Y').val());
  56. form.submit();
  57. }
  58. function sures()
  59. {
  60. if(confirm('请确认核销该发票,核销后不可更改!'))
  61. return true;
  62. else
  63. return false;
  64. }
  65. function submitForm(){
  66. var form = document.getElementById("iacd");
  67. form.submit();
  68. }
  69. function getRefundByDetail(irid){
  70. var url = "/getRefundByDetail";
  71. $.ajax({
  72. url : url,
  73. type : "post",
  74. cache : false,
  75. dataType : "json",
  76. data : {
  77. iridKey : irid
  78. },
  79. global : true,
  80. success : function(data) {
  81. if (data.status == 1) {
  82. $("td[data-refundCompany]").html(data.irDetail.refundCompany);
  83. $("td[data-refundNumber]").html(data.irDetail.refundNumber);
  84. $("td[data-refundPrice]").html(data.irDetail.refundPrice);
  85. } else{
  86. $("td[data-refundCompany]").html('');
  87. $("td[data-refundNumber]").html('');
  88. $("td[data-refundPrice]").html('');
  89. }
  90. },
  91. error : function(err) {
  92. }
  93. });
  94. }
  95. function invoiceReceivblesDivShow(postData,type){
  96. var po='INVOICE';
  97. if(type=='receivables')
  98. po='RECEIVABLES';
  99. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  100. var url = "/ajaxGetInvoiceInfoByType";
  101. $.ajax({
  102. url : url,
  103. type : "post",
  104. cache : false,
  105. dataType : "json",
  106. data : {
  107. serial : postData,
  108. type:po
  109. },
  110. global : true,
  111. success : function(data) {
  112. if (data.status == 1) {
  113. $("div[loading-msg='true']").html("");
  114. if(type=='receivables')
  115. $("#nr").html(data.html);
  116. else
  117. $("#nc").html(data.html);
  118. } else
  119. $("div[loading-msg='true']").html("illegal request");
  120. },
  121. error : function(err) {
  122. $("div[loading-msg='true']").html("");
  123. $("#nr").html('');
  124. }
  125. });
  126. }
  127. function padding1(num, length) {
  128. for(var len = (num + "").length; len < length; len = num.length) {
  129. num = "0" + num;
  130. }
  131. return num;
  132. }
  133. $(function() {
  134. $('#invoiceNoStart').keyup(function() {
  135. var start=$(this).val();
  136. var total=$('#invoiceNoTotal').val();
  137. var stLenght=start.length;
  138. var s=Number(start)+Number(total);
  139. //padding1(s,kl);
  140. $('#invoiceNoEnd').val('No.'+padding1(s,stLenght));
  141. });
  142. $('#invoiceNoTotal').keyup(function() {
  143. var start=$(this).val();
  144. var total=$('#invoiceNoStart').val();
  145. var s=Number(start)+Number(total);
  146. var k=Number(total);
  147. var stLenght=total.length;
  148. stLenght=Number(s.toString().length)+Number(stLenght)-Number(k.toString().length);
  149. $('#invoiceNoEnd').val('No.'+padding1(s,stLenght));
  150. });
  151. $('a[node-claim="receivables"]').click(function() {
  152. $("#iridKey").val($(this).attr("data-key"));
  153. });
  154. $('select[node-itSChange]').change(function() {
  155. var itsStatus=$(this).val();
  156. var action = $('#its').attr("action");
  157. action=encodeURI(action+'?trainStatus='+itsStatus);
  158. $('#its').attr("action",action);
  159. $('#its').submit();
  160. });
  161. $('select[node-iryChange]').change(function() {
  162. var year=$(this).val();
  163. var month="All";
  164. var irmMebSea=$('input[data-irmMebSea]').val();
  165. var action = $('#iras').attr("action");
  166. action=encodeURI(action+'/'+year+'/'+month+"/"+irmMebSea);
  167. $('#iras').attr("action",action);
  168. $('#iras').submit();
  169. });
  170. $('select[node-irmChange]').change(function() {
  171. var month=$(this).val();
  172. var year=$('select[node-iryChange]').val();
  173. var irmMebSea=$('input[data-irmMebSea]').val();
  174. var action = $('#iras').attr("action");
  175. action=encodeURI(action+'/'+year+'/'+month+"/"+irmMebSea);
  176. $('#iras').attr("action",action);
  177. $('#iras').submit();
  178. });
  179. $('select[node-invoiceType]').change(function() {
  180. $('#iaa').submit();
  181. });
  182. $('select[node-invoiceTrain]').change(function() {
  183. $('#iaa').submit();
  184. });
  185. $('select[node-invoiceTrainName]').change(function() {
  186. $('#iaa').submit();
  187. });
  188. /**
  189. * 废弃方法
  190. $('button[node-irmMebSea]').click(function() {
  191. var month=$('select[node-irmChange]').val();
  192. var year=$('select[node-iryChange]').val();
  193. var irmMebSea=$('input[data-irmMebSea]').val();
  194. var action = $('#iras').attr("action");
  195. action=encodeURI(action+'/'+year+'/'+month+"/"+irmMebSea);
  196. $('#iras').attr("action",action);
  197. $('#iras').submit();
  198. });
  199. */
  200. $('input[refreshData=time]').click(function() {
  201. $('#iras').submit();
  202. });
  203. $('button[node-iramMebSea]').click(function() {
  204. var irmMebSea=$('input[data-irmMebSea]').val();
  205. var action = $('#iaa').attr("action");
  206. action=encodeURI(action+"/"+irmMebSea);
  207. $('#iaa').attr("action",action);
  208. $('#iaa').submit();
  209. });
  210. $('a[node-rtm]').click(function() {
  211. $("#iridKey").val($(this).attr("data-key"));
  212. $("#recepitTitleMark").val($(this).attr("data-title"));
  213. });
  214. $('a[node-express="untread"]').click(function() {
  215. $('td[node-express="msg"]').html($(this).attr('title'));
  216. });
  217. $("input[name='untreadPost']").click(function() {
  218. $("table[post-box='ture']").hide();
  219. });
  220. $("input[node-untread='post']").click(function() {
  221. //$("table[post-box='ture']").show();
  222. });
  223. $("a[node-approval^='approval']").click(function() {
  224. $("input[name='status']").val($(this).attr("diss-data"));
  225. $("form[name='invoiceApproval']").submit();
  226. });
  227. $("a[node-invoice='droppedInvoice']").click(function() {
  228. $("input[name='droppedIidKey']").val($(this).attr("diss-data"));
  229. });
  230. $("a[node-invoice='untreadInvoice']").click(function() {
  231. $("input[name='untreadIidKey']").val($(this).attr("diss-data"));
  232. });
  233. // $('a[bind-receivables="true"]').click(function() {
  234. // console.log('ddd');
  235. // });
  236. $("button[invoice-search='title']").click(function() {
  237. var title=$("input[name='searchTitle']").val();
  238. if(title==''){
  239. alert('请填写开票单位');
  240. return '';
  241. }
  242. $("div[node-invoiceHtml='true']").html('');
  243. var url = "/ajaxGetInvoiceReceivablesByTitle";
  244. $.ajax({
  245. url : url,
  246. type : "post",
  247. cache : false,
  248. dataType : "json",
  249. data : {
  250. title : title
  251. },
  252. global : true,
  253. success : function(data) {
  254. if (data.status == 1) {
  255. $("div[node-invoiceHtml='true']").html(data.invoiceHtml);
  256. }
  257. },
  258. error : function(err) {
  259. }
  260. });
  261. });
  262. //
  263. $("a[bind-invoice='receivables']").click(function() {
  264. var key = $(this).attr("node-key");
  265. $("input[name='key']").val('');
  266. $("div[node-receivablesHtml='true']").html('');
  267. $("div[node-invoiceHtml='true']").html('');
  268. $("blockquote[node-search='invoice']").hide();
  269. var url = "/ajaxGetInvoiceReceivablesByIrid";
  270. $.ajax({
  271. url : url,
  272. type : "post",
  273. cache : false,
  274. dataType : "json",
  275. data : {
  276. irid : key
  277. },
  278. global : true,
  279. success : function(data) {
  280. if (data.status == 1) {
  281. $("div[node-receivablesHtml='true']").html(data.receivablesHtml);
  282. $("div[node-invoiceHtml='true']").html(data.invoiceHtml);
  283. $("input[name='key']").val(data.irkey);
  284. $("blockquote[node-search='invoice']").show();
  285. // if(data.isInvoice)
  286. // $("blockquote[node-search='invoice']").show();
  287. // else
  288. // $("blockquote[node-search='invoice']").hide();
  289. } else{
  290. $("input[name='key']").val('');
  291. $("div[node-receivablesHtml='true']").html('');
  292. $("div[node-invoiceHtml='true']").html('');
  293. $("blockquote[node-search='invoice']").hide();
  294. }
  295. },
  296. error : function(err) {
  297. }
  298. });
  299. });
  300. $("a[node-newReceivables]").click(function() {
  301. var postData = $(this).attr("dataKey");
  302. $("input[id='iridKey']").val(postData);
  303. });
  304. $("button[search-invoiceReceivables]").click(function() {
  305. var searchData=$("input[name='searchData']").val();
  306. if(searchData==''){
  307. alert('请填写完整的流水号');
  308. return ;
  309. }
  310. var url = "/ajaxGetInvoiceReceivablesBySerial";
  311. $.ajax({
  312. url : url,
  313. type : "post",
  314. cache : false,
  315. dataType : "json",
  316. data : {
  317. receivablesSerial : searchData
  318. },
  319. global : true,
  320. success : function(data) {
  321. if (data.status == 1) {
  322. $("tr[htmlReceivables]").html(data.html);
  323. } else
  324. $("tr[htmlReceivables]").html();
  325. },
  326. error : function(err) {
  327. }
  328. });
  329. });
  330. $("a[node-post='express']").click(function() {
  331. var postData = $(this).attr("post-data");
  332. $("input[name='iidKey']").val(postData);
  333. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  334. var url = "/ajaxGetInvoicePostDetail";
  335. $.ajax({
  336. url : url,
  337. type : "post",
  338. cache : false,
  339. dataType : "json",
  340. data : {
  341. iidKey : postData
  342. },
  343. global : true,
  344. success : function(data) {
  345. if (data.status == 1) {
  346. $("td[recipients-data='true']").html(data.invoiceDetail.recipients);
  347. $("td[recipientsPhone-data='true']").html(data.invoiceDetail.recipientsPhone);
  348. $("td[recipientsAddress-data='true']").html(data.invoiceDetail.recipientsAddress);
  349. $("td[mailItems-data='true']").html(data.invoiceDetail.mailItems);
  350. $("div[loading-msg='true']").html("");
  351. } else
  352. $("div[loading-msg='true']").html("illegal request");
  353. },
  354. error : function(err) {
  355. }
  356. });
  357. });
  358. $("a[node-post='express-msg']").click(function() {
  359. var postData = $(this).attr("post-data");
  360. $("div[loading-msg='express-msg']").html("<img src='/global/img/loadIco.gif' />");
  361. var url = "/ajaxGetInvoicePostDetail";
  362. $.ajax({
  363. url : url,
  364. type : "post",
  365. cache : false,
  366. dataType : "json",
  367. data : {
  368. iidKey : postData
  369. },
  370. global : true,
  371. success : function(data) {
  372. if (data.status == 1) {
  373. $("td[recipients-data='express-msg']").html(data.invoiceDetail.recipients);
  374. $("td[recipientsPhone-data='express-msg']").html(data.invoiceDetail.recipientsPhone);
  375. $("td[recipientsAddress-data='express-msg']").html(data.invoiceDetail.recipientsAddress);
  376. $("td[mailItems-data='express-msg']").html(data.invoiceDetail.mailItems);
  377. $("td[actualItems-data='express-msg']").html(data.invoiceDetail.actualItems);
  378. $("td[expressCompany-data='express-msg']").html(data.invoiceDetail.expressCompany);
  379. if(data.invoiceDetail.expressCom=="SF")
  380. $("td[expressNumber-data='express-msg']").html(data.invoiceDetail.expressNumber+"&nbsp;<a target='_blank' href='http://www.sf-express.com/cn/sc/dynamic_function/waybill/#search/bill-number/'>点击查询快递信息</a>");
  381. else
  382. $("td[expressNumber-data='express-msg']").html(data.invoiceDetail.expressNumber+"&nbsp;<a target='_blank' href='/invoiceExpress/"+data.invoiceDetail.expressCom+"/"+data.invoiceDetail.expressNumber+".html'>点击查询快递信息</a>");
  383. $("div[loading-msg='express-msg']").html("");
  384. } else
  385. $("div[loading-msg='express-msg']").html("illegal request");
  386. },
  387. error : function(err) {
  388. }
  389. });
  390. });
  391. $("a[node-post='expressActual-msg']").click(function() {
  392. var postData = $(this).attr("post-data");
  393. $("div[loading-msg='express-msg']").html("<img src='/global/img/loadIco.gif' />");
  394. var url = "/ajaxGetInvoicePostDetail";
  395. $.ajax({
  396. url : url,
  397. type : "post",
  398. cache : false,
  399. dataType : "json",
  400. data : {
  401. iidKey : postData
  402. },
  403. global : true,
  404. success : function(data) {
  405. if (data.status == 1) {
  406. $("td[mailItems-data='express-msg']").html(data.invoiceDetail.mailItems);
  407. $("td[actualItems-data='express-msg']").html(data.invoiceDetail.actualItems);
  408. if(data.invoiceDetail.expressCom=="SF")
  409. $("td[expressCompany-data='express-msg']").html(data.invoiceDetail.expressNumber+"&nbsp;<a target='_blank' href='http://www.sf-express.com/cn/sc/dynamic_function/waybill/#search/bill-number/'>点击查询快递信息</a>");
  410. else
  411. $("td[expressCompany-data='express-msg']").html(data.invoiceDetail.expressCompany+"&nbsp;<a target='_blank' href='/invoiceExpress/"+data.invoiceDetail.expressCom+"/"+data.invoiceDetail.expressNumber+".html'>点击查询快递信息</a>");
  412. $("td[actualItems-data='express-msg']").html(data.invoiceDetail.actualItems);
  413. // $("td[recipients-data='express-msg']").html(data.invoiceDetail.recipients);
  414. // $("td[recipientsPhone-data='express-msg']").html(data.invoiceDetail.recipientsPhone);
  415. // $("td[recipientsAddress-data='express-msg']").html(data.invoiceDetail.recipientsAddress);
  416. // $("td[mailItems-data='express-msg']").html(data.invoiceDetail.mailItems);
  417. // $("td[actualItems-data='express-msg']").html(data.invoiceDetail.actualItems);
  418. // $("td[expressCompany-data='express-msg']").html(data.invoiceDetail.expressCompany);
  419. // $("td[expressNumber-data='express-msg']").html(data.invoiceDetail.expressNumber+"&nbsp;<a target='_blank' href='http://www.kuaidi100.com/chaxun?com="+data.invoiceDetail.expressCom+"&nu="+data.invoiceDetail.expressNumber+"'>点击查询快递信息</a>");
  420. $("div[loading-msg='express-msg']").html("");
  421. } else
  422. $("div[loading-msg='express-msg']").html("illegal request");
  423. },
  424. error : function(err) {
  425. }
  426. });
  427. });
  428. $("select[name='receivablesCategory']").click(function() {
  429. var cid = $("select[name='receivablesCategory'] option:selected").attr("post-data");
  430. var url = "/ajaxGetStaffByCategory";
  431. $.ajax({
  432. url : url,
  433. type : "post",
  434. cache : false,
  435. dataType : "json",
  436. data : {
  437. cid : cid
  438. },
  439. global : true,
  440. success : function(data) {
  441. if (data.status == 1) {
  442. $("select[name='receivablesStaff']").html(data.html);
  443. }
  444. //else
  445. // $("div[loading-msg='true']").html("illegal request");
  446. },
  447. error : function(err) {
  448. }
  449. });
  450. });
  451. $('a[node-receivables="true"]').click(function() {
  452. var postData = $(this).attr("data-key");
  453. var url = "/ajaxGetInvoiceReceivables";
  454. $.ajax({
  455. url : url,
  456. type : "post",
  457. cache : false,
  458. dataType : "json",
  459. data : {
  460. key : postData
  461. },
  462. global : true,
  463. success : function(data) {
  464. if (data.status == 1) {
  465. $("input[name='key']").val(postData);
  466. $("td[node-receivablesSerial]").html(data.detail.receivablesSerial);
  467. $("td[node-inputStaff]").html(data.detail.inputStaff+"&nbsp;"+data.detail.date);
  468. $("td[node-price]").html("<b>"+data.detail.receivablesPrice+"</b>");
  469. $("td[node-message]").html(data.detail.receivablesMessage);
  470. $("td[node-bank]").html(data.detail.receivablesBank);
  471. $("td[node-date]").html(data.detail.receivablesDate);
  472. }
  473. },
  474. error : function(err) {
  475. }
  476. });
  477. });
  478. /**
  479. * 废弃
  480. $('a[node-recording="true"]').click(function() {
  481. var postData = $(this).attr("data-key");
  482. $("input[name='key']").val(postData);
  483. $("input[name='invoiceKey']").val("");
  484. $("p[node-msg='true']").hide();
  485. $("p[node-loading='true']").hide();
  486. $('tbody[data-invoice="myClaim"]').html("");
  487. var url = "/ajaxGetInvoiceByStaff";
  488. $.ajax({
  489. url : url,
  490. type : "post",
  491. cache : false,
  492. dataType : "json",
  493. data : {
  494. key : postData
  495. },
  496. global : true,
  497. success : function(data) {
  498. if (data.status == 1) {
  499. $('tbody[data-invoice="myClaim"]').html(data.html);
  500. }
  501. },
  502. error : function(err) {
  503. }
  504. });
  505. });
  506. */
  507. /**
  508. * 废弃
  509. $('a[node-receivalbles="bind"]').click(function() {
  510. var postData = $(this).attr("diss-data");
  511. $("input[name='key']").val(postData);
  512. $("input[name='invoiceKey']").val("");
  513. $("p[node-msg='true']").hide();
  514. $("p[node-msg='true2']").hide();
  515. $("p[node-loading='true']").hide();
  516. $('tbody[data-invoice="myReceivables"]').html("");
  517. var url = "/ajaxGetReceivalblesByStaff";
  518. $.ajax({
  519. url : url,
  520. type : "post",
  521. cache : false,
  522. dataType : "json",
  523. data : {
  524. key : postData
  525. },
  526. global : true,
  527. success : function(data) {
  528. if (data.status == 1) {
  529. $('tbody[data-invoice="myReceivables"]').html(data.html);
  530. $('tbody[box-enter="true"]').html(data.html2);
  531. if(data.priceStatus == 1){
  532. $('p[node-msg="true"]').html("收款金额超出开票金额 ¥"+data.price+"元,请谨慎操作。");
  533. $('p[node-msg="true"]').show();
  534. }else if(data.priceStatus == 2&& data.isReceivables != 0){
  535. $('p[node-msg="true"]').html("收款金额少于开票金额 ¥"+data.price+"元,请谨慎操作。");
  536. $('p[node-msg="true"]').show();
  537. }
  538. if(data.isReceivables == 0){
  539. $('p[node-msg="true2"]').html("该发票还没有入账,请先进行选择收款入账");
  540. $('p[node-msg="true2"]').show();
  541. }
  542. }
  543. },
  544. error : function(err) {
  545. }
  546. });
  547. });
  548. */
  549. $("a[node-invoiceReceivables='INFO']").click(function() {
  550. var postData = $(this).attr("data-isKey");
  551. var po='IRTC';
  552. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  553. var url = "/ajaxGetInvoiceInfoByType";
  554. $.ajax({
  555. url : url,
  556. type : "post",
  557. cache : false,
  558. dataType : "json",
  559. data : {
  560. serial : postData,
  561. type:po
  562. },
  563. global : true,
  564. success : function(data) {
  565. if (data.status == 1) {
  566. $("div[loading-msg='true']").html("");
  567. $("#inKey").val(data.iidKey);
  568. $("#irtc").html(data.html);
  569. $("input[name=receivablesPrice]").val(data.receivablesPrice);
  570. $("input[name=receivablesMessage]").val(data.receivablesMessage);
  571. $("input[name=receivablesDate]").val(data.receivablesDate);
  572. } else
  573. $("div[loading-msg='true']").html("illegal request");
  574. },
  575. error : function(err) {
  576. $("div[loading-msg='true']").html("");
  577. }
  578. });
  579. });
  580. $("a[node-invoiceLoss='INFO']").click(function() {
  581. var postData = $(this).attr("data-isKey");
  582. var po='IRTC';
  583. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  584. var url = "/ajaxGetInvoiceInfoByType";
  585. $.ajax({
  586. url : url,
  587. type : "post",
  588. cache : false,
  589. dataType : "json",
  590. data : {
  591. serial : postData,
  592. loss:true,
  593. type:po
  594. },
  595. global : true,
  596. success : function(data) {
  597. if (data.status == 1) {
  598. $("div[loading-msg='true']").html("");
  599. $("#inKey").val(data.iidKey);
  600. $("#irtc").html(data.html);
  601. $("input[name=receivablesPrice]").val(data.receivablesPrice);
  602. $("input[name=receivablesMessage]").val(data.receivablesMessage);
  603. $("input[name=receivablesDate]").val(data.receivablesDate);
  604. } else
  605. $("div[loading-msg='true']").html("illegal request");
  606. },
  607. error : function(err) {
  608. $("div[loading-msg='true']").html("");
  609. }
  610. });
  611. });
  612. $("a[node-irDelete]").click(function() {
  613. var postData = $(this).attr("data-isKey");
  614. $('#claimdKey').val(postData);
  615. });
  616. $("a[node-invoice='INFO']").click(function() {
  617. var postData = $(this).attr("data-isKey");
  618. var type =$(this).attr("data-type");
  619. var po='INVOICE';
  620. if(type=='receivables')
  621. po='RECEIVABLES';
  622. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  623. var url = "/ajaxGetInvoiceInfoByType";
  624. $.ajax({
  625. url : url,
  626. type : "post",
  627. cache : false,
  628. dataType : "json",
  629. data : {
  630. serial : postData,
  631. type:po
  632. },
  633. global : true,
  634. success : function(data) {
  635. if (data.status == 1) {
  636. $("div[loading-msg='true']").html("");
  637. if(type=='receivables')
  638. $("#nr").html(data.html);
  639. else
  640. $("#nc").html(data.html);
  641. } else
  642. $("div[loading-msg='true']").html("illegal request");
  643. },
  644. error : function(err) {
  645. $("div[loading-msg='true']").html("");
  646. $("#nr").html('');
  647. $("#nc").html('');
  648. }
  649. });
  650. });
  651. $("a[node-invoice=PRINT]").click(function() {
  652. var postData = $(this).attr("data-isKey");
  653. var type =$(this).attr("data-type");
  654. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  655. var url = "/ajaxGetInvoiceInfoByPrint";
  656. $.ajax({
  657. url : url,
  658. type : "post",
  659. cache : false,
  660. dataType : "json",
  661. data : {
  662. serial : postData
  663. },
  664. global : true,
  665. success : function(data) {
  666. if (data.status == 1) {
  667. $("div[loading-msg='true']").html("");
  668. $("#prIn").html(data.html);
  669. } else
  670. $("div[loading-msg='true']").html("illegal request");
  671. },
  672. error : function(err) {
  673. $("div[loading-msg='true']").html("");
  674. }
  675. });
  676. });
  677. $("a[node-refund]").click(function() {
  678. var postData = $(this).attr("dataKey");
  679. $("input[name='iridKey']").val(postData);
  680. });
  681. $("a[node-alter]").click(function() {
  682. var postData = $(this).attr("data-isKey");
  683. var url = "/ajaxGetInvoiceReceivablesByStaff";
  684. $.ajax({
  685. url : url,
  686. type : "post",
  687. cache : false,
  688. dataType : "json",
  689. data : {
  690. postData : postData
  691. },
  692. global : true,
  693. success : function(data) {
  694. if (data.status == 1) {
  695. $("input[name='claimKey']").val(postData);
  696. $("select[html-category]").html(data.categoryHtml);
  697. $("select[html-staff]").html(data.staffHtml);
  698. } else
  699. $("div[loading-msg='categoryStaff']").html("illegal request");
  700. },
  701. error : function(err) {
  702. $("div[loading-msg='true']").html("");
  703. }
  704. });
  705. });
  706. $("a[node-unBundLing]").click(function() {
  707. var postData = $(this).attr("data-isKey");
  708. $("input[id='unBundKey']").val(postData);
  709. $("tbody[node-unBundInvoice]").html("loading");
  710. var url = "/ajaxGetInvoiceReceivablesByInvoice";
  711. $.ajax({
  712. url : url,
  713. type : "post",
  714. cache : false,
  715. dataType : "json",
  716. data : {
  717. postData : postData
  718. },
  719. global : true,
  720. success : function(data) {
  721. if (data.status == 1) {
  722. $("tbody[node-unBundInvoice]").html(data.html);
  723. } else
  724. $("tbody[node-unBundInvoice]").html("illegal request");
  725. },
  726. error : function(err) {
  727. $("tbody[node-unBundInvoice]").html("illegal request");
  728. }
  729. });
  730. });
  731. $("a[node-irUpdate]").click(function() {
  732. var postData = $(this).attr("data-isKey");
  733. //$("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  734. var url = "/ajaxGetInvoiceReceivablesByStaff";
  735. $.ajax({
  736. url : url,
  737. type : "post",
  738. cache : false,
  739. dataType : "json",
  740. data : {
  741. postData : postData
  742. },
  743. global : true,
  744. success : function(data) {
  745. if (data.status == 1) {
  746. $("input[name='receivablesPrice']").val(data.detail.receivablesPrice);
  747. $("input[name='receivablesMessage']").val(data.detail.receivablesMessage);
  748. $("input[name='receivablesDate']").val(data.detail.receivablesDate);
  749. $("select[html-rbank]").html(data.rbankHtml);
  750. $("input[id='claimuKey']").val(postData);
  751. $("select[html-rcategory]").html(data.categoryHtml);
  752. $("select[html-rstaff]").html(data.staffHtml);
  753. } else
  754. $("div[loading-msg='categoryStaff']").html("illegal request");
  755. },
  756. error : function(err) {
  757. $("div[loading-msg='true']").html("");
  758. }
  759. });
  760. });
  761. $("a[node-post='upEm']").click(function() {
  762. var postData = $(this).attr("post-data");
  763. $("div[loading-msg='express-msg']").html("<img src='/global/img/loadIco.gif' />");
  764. var url = "/ajaxGetInvoicePostDetail";
  765. $.ajax({
  766. url : url,
  767. type : "post",
  768. cache : false,
  769. dataType : "json",
  770. data : {
  771. iidKey : postData
  772. },
  773. global : true,
  774. success : function(data) {
  775. if (data.status == 1) {
  776. $("input[name='iidKey']").val(postData);
  777. $("td[recipients-data='express-msgU']").html(data.invoiceDetail.recipients);
  778. $("td[recipientsPhone-data='express-msgU']").html(data.invoiceDetail.recipientsPhone);
  779. $("td[recipientsAddress-data='express-msgU']").html(data.invoiceDetail.recipientsAddress);
  780. $("td[mailItems-data='express-msgU']").html(data.invoiceDetail.mailItems);
  781. $("textarea[actualItems-data='express-msgU']").val(data.invoiceDetail.actualItems);
  782. $("select[name='express']").html(data.invoiceDetail.eaHtml);
  783. $("input[expressNumber-data='express-msgU']").val(data.invoiceDetail.expressNumber);
  784. $("div[loading-msg='express-msg']").html("");
  785. } else
  786. $("div[loading-msg='express-msg']").html("illegal request");
  787. },
  788. error : function(err) {
  789. }
  790. });
  791. });
  792. $("select[node-notification]").change(function(){
  793. var notificationType=$(this).attr('data');
  794. var notificationValue=$(this).val();
  795. var url="/ajaxSetNotificationConf";
  796. $.ajax({
  797. url:url,
  798. type:"post",
  799. cache:false,
  800. dataType:"json",
  801. data:{
  802. notificationType:notificationType,
  803. notificationValue:notificationValue
  804. },
  805. global:true,
  806. success:function(data){
  807. if(data.status!=1){
  808. $("#"+data.msgType+"Msg").addClass("colRed");
  809. $("#"+data.msgType+"Msg").html("设置失败").show(300).delay(3000).hide(300);
  810. }else{
  811. $("#"+data.msgType+"Msg").addClass("colGreen");
  812. $("#"+data.msgType+"Msg").html("设置成功").show(300).delay(3000).hide(300);
  813. }
  814. },
  815. error:function(err){
  816. }
  817. });
  818. });
  819. // $("a[node-iStore=del]").click(function() {
  820. // var iStoreKey = $(this).attr("data-key");
  821. // $("input[id=iStoreKey]").val(iStoreKey);
  822. // });
  823. $("a[node-training=del]").click(function() {
  824. var trainingKey = $(this).attr("data-key");
  825. $("input[id='trainingKey']").val(trainingKey);
  826. });
  827. })
  828. function invoiceStoreMail(Key){
  829. $("input[id=MailStoreKey]").val(Key);
  830. // var url="/ajaxGetMailItemByIstore";
  831. // $.ajax({
  832. // url:url,
  833. // type:"post",
  834. // cache:false,
  835. // dataType:"json",
  836. // data:{
  837. // storeKey:iStroreKey
  838. // },
  839. // global:true,
  840. // success:function(data){
  841. //
  842. // console.log(data);
  843. //
  844. // if(data!='null'){
  845. //
  846. // }
  847. //
  848. // if(data.status!=1){
  849. // $("#"+data.msgType+"Msg").addClass("colRed");
  850. // $("#"+data.msgType+"Msg").html("设置失败").show(300).delay(3000).hide(300);
  851. // }else{
  852. // $("#"+data.msgType+"Msg").addClass("colGreen");
  853. // $("#"+data.msgType+"Msg").html("设置成功").show(300).delay(3000).hide(300);
  854. // }
  855. // },
  856. // error:function(err){
  857. //
  858. // }
  859. // });
  860. }
  861. function invoiceStoreDel(iStoreKey){
  862. //var iStoreKey = $(this).attr("data-key");
  863. $("input[id=iStoreKey]").val(iStoreKey);
  864. }
  865. function invoiceStoreApproval(iStoreKey){
  866. $("input[id=appStoreKey]").val(iStoreKey);
  867. }