invoice.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023
  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. if(data.isInvoice)
  285. $("blockquote[node-search='invoice']").show();
  286. else
  287. $("blockquote[node-search='invoice']").hide();
  288. } else{
  289. $("input[name='key']").val('');
  290. $("div[node-receivablesHtml='true']").html('');
  291. $("div[node-invoiceHtml='true']").html('');
  292. $("blockquote[node-search='invoice']").hide();
  293. }
  294. },
  295. error : function(err) {
  296. }
  297. });
  298. });
  299. $("a[node-newReceivables]").click(function() {
  300. var postData = $(this).attr("dataKey");
  301. $("input[id='iridKey']").val(postData);
  302. });
  303. $("button[search-invoiceReceivables]").click(function() {
  304. var searchData=$("input[name='searchData']").val();
  305. if(searchData==''){
  306. alert('请填写完整的流水号');
  307. return ;
  308. }
  309. var url = "/ajaxGetInvoiceReceivablesBySerial";
  310. $.ajax({
  311. url : url,
  312. type : "post",
  313. cache : false,
  314. dataType : "json",
  315. data : {
  316. receivablesSerial : searchData
  317. },
  318. global : true,
  319. success : function(data) {
  320. if (data.status == 1) {
  321. $("tr[htmlReceivables]").html(data.html);
  322. } else
  323. $("tr[htmlReceivables]").html();
  324. },
  325. error : function(err) {
  326. }
  327. });
  328. });
  329. $("a[node-post='express']").click(function() {
  330. var postData = $(this).attr("post-data");
  331. $("input[name='iidKey']").val(postData);
  332. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  333. var url = "/ajaxGetInvoicePostDetail";
  334. $.ajax({
  335. url : url,
  336. type : "post",
  337. cache : false,
  338. dataType : "json",
  339. data : {
  340. iidKey : postData
  341. },
  342. global : true,
  343. success : function(data) {
  344. if (data.status == 1) {
  345. $("td[recipients-data='true']").html(data.invoiceDetail.recipients);
  346. $("td[recipientsPhone-data='true']").html(data.invoiceDetail.recipientsPhone);
  347. $("td[recipientsAddress-data='true']").html(data.invoiceDetail.recipientsAddress);
  348. $("td[mailItems-data='true']").html(data.invoiceDetail.mailItems);
  349. $("div[loading-msg='true']").html("");
  350. } else
  351. $("div[loading-msg='true']").html("illegal request");
  352. },
  353. error : function(err) {
  354. }
  355. });
  356. });
  357. $("a[node-post='express-msg']").click(function() {
  358. var postData = $(this).attr("post-data");
  359. $("div[loading-msg='express-msg']").html("<img src='/global/img/loadIco.gif' />");
  360. var url = "/ajaxGetInvoicePostDetail";
  361. $.ajax({
  362. url : url,
  363. type : "post",
  364. cache : false,
  365. dataType : "json",
  366. data : {
  367. iidKey : postData
  368. },
  369. global : true,
  370. success : function(data) {
  371. if (data.status == 1) {
  372. $("td[recipients-data='express-msg']").html(data.invoiceDetail.recipients);
  373. $("td[recipientsPhone-data='express-msg']").html(data.invoiceDetail.recipientsPhone);
  374. $("td[recipientsAddress-data='express-msg']").html(data.invoiceDetail.recipientsAddress);
  375. $("td[mailItems-data='express-msg']").html(data.invoiceDetail.mailItems);
  376. $("td[actualItems-data='express-msg']").html(data.invoiceDetail.actualItems);
  377. $("td[expressCompany-data='express-msg']").html(data.invoiceDetail.expressCompany);
  378. if(data.invoiceDetail.expressCom=="SF")
  379. $("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>");
  380. else
  381. $("td[expressNumber-data='express-msg']").html(data.invoiceDetail.expressNumber+"&nbsp;<a target='_blank' href='/invoiceExpress/"+data.invoiceDetail.expressCom+"/"+data.invoiceDetail.expressNumber+".html'>点击查询快递信息</a>");
  382. $("div[loading-msg='express-msg']").html("");
  383. } else
  384. $("div[loading-msg='express-msg']").html("illegal request");
  385. },
  386. error : function(err) {
  387. }
  388. });
  389. });
  390. $("a[node-post='expressActual-msg']").click(function() {
  391. var postData = $(this).attr("post-data");
  392. $("div[loading-msg='express-msg']").html("<img src='/global/img/loadIco.gif' />");
  393. var url = "/ajaxGetInvoicePostDetail";
  394. $.ajax({
  395. url : url,
  396. type : "post",
  397. cache : false,
  398. dataType : "json",
  399. data : {
  400. iidKey : postData
  401. },
  402. global : true,
  403. success : function(data) {
  404. if (data.status == 1) {
  405. $("td[mailItems-data='express-msg']").html(data.invoiceDetail.mailItems);
  406. $("td[actualItems-data='express-msg']").html(data.invoiceDetail.actualItems);
  407. if(data.invoiceDetail.expressCom=="SF")
  408. $("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>");
  409. else
  410. $("td[expressCompany-data='express-msg']").html(data.invoiceDetail.expressCompany+"&nbsp;<a target='_blank' href='/invoiceExpress/"+data.invoiceDetail.expressCom+"/"+data.invoiceDetail.expressNumber+".html'>点击查询快递信息</a>");
  411. $("td[actualItems-data='express-msg']").html(data.invoiceDetail.actualItems);
  412. // $("td[recipients-data='express-msg']").html(data.invoiceDetail.recipients);
  413. // $("td[recipientsPhone-data='express-msg']").html(data.invoiceDetail.recipientsPhone);
  414. // $("td[recipientsAddress-data='express-msg']").html(data.invoiceDetail.recipientsAddress);
  415. // $("td[mailItems-data='express-msg']").html(data.invoiceDetail.mailItems);
  416. // $("td[actualItems-data='express-msg']").html(data.invoiceDetail.actualItems);
  417. // $("td[expressCompany-data='express-msg']").html(data.invoiceDetail.expressCompany);
  418. // $("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>");
  419. $("div[loading-msg='express-msg']").html("");
  420. } else
  421. $("div[loading-msg='express-msg']").html("illegal request");
  422. },
  423. error : function(err) {
  424. }
  425. });
  426. });
  427. $("select[name='receivablesCategory']").click(function() {
  428. var cid = $("select[name='receivablesCategory'] option:selected").attr("post-data");
  429. var url = "/ajaxGetStaffByCategory";
  430. $.ajax({
  431. url : url,
  432. type : "post",
  433. cache : false,
  434. dataType : "json",
  435. data : {
  436. cid : cid
  437. },
  438. global : true,
  439. success : function(data) {
  440. if (data.status == 1) {
  441. $("select[name='receivablesStaff']").html(data.html);
  442. }
  443. //else
  444. // $("div[loading-msg='true']").html("illegal request");
  445. },
  446. error : function(err) {
  447. }
  448. });
  449. });
  450. $('a[node-receivables="true"]').click(function() {
  451. var postData = $(this).attr("data-key");
  452. var url = "/ajaxGetInvoiceReceivables";
  453. $.ajax({
  454. url : url,
  455. type : "post",
  456. cache : false,
  457. dataType : "json",
  458. data : {
  459. key : postData
  460. },
  461. global : true,
  462. success : function(data) {
  463. if (data.status == 1) {
  464. $("input[name='key']").val(postData);
  465. $("td[node-receivablesSerial]").html(data.detail.receivablesSerial);
  466. $("td[node-inputStaff]").html(data.detail.inputStaff+"&nbsp;"+data.detail.date);
  467. $("td[node-price]").html("<b>"+data.detail.receivablesPrice+"</b>");
  468. $("td[node-message]").html(data.detail.receivablesMessage);
  469. $("td[node-bank]").html(data.detail.receivablesBank);
  470. $("td[node-date]").html(data.detail.receivablesDate);
  471. }
  472. },
  473. error : function(err) {
  474. }
  475. });
  476. });
  477. /**
  478. * 废弃
  479. $('a[node-recording="true"]').click(function() {
  480. var postData = $(this).attr("data-key");
  481. $("input[name='key']").val(postData);
  482. $("input[name='invoiceKey']").val("");
  483. $("p[node-msg='true']").hide();
  484. $("p[node-loading='true']").hide();
  485. $('tbody[data-invoice="myClaim"]').html("");
  486. var url = "/ajaxGetInvoiceByStaff";
  487. $.ajax({
  488. url : url,
  489. type : "post",
  490. cache : false,
  491. dataType : "json",
  492. data : {
  493. key : postData
  494. },
  495. global : true,
  496. success : function(data) {
  497. if (data.status == 1) {
  498. $('tbody[data-invoice="myClaim"]').html(data.html);
  499. }
  500. },
  501. error : function(err) {
  502. }
  503. });
  504. });
  505. */
  506. /**
  507. * 废弃
  508. $('a[node-receivalbles="bind"]').click(function() {
  509. var postData = $(this).attr("diss-data");
  510. $("input[name='key']").val(postData);
  511. $("input[name='invoiceKey']").val("");
  512. $("p[node-msg='true']").hide();
  513. $("p[node-msg='true2']").hide();
  514. $("p[node-loading='true']").hide();
  515. $('tbody[data-invoice="myReceivables"]').html("");
  516. var url = "/ajaxGetReceivalblesByStaff";
  517. $.ajax({
  518. url : url,
  519. type : "post",
  520. cache : false,
  521. dataType : "json",
  522. data : {
  523. key : postData
  524. },
  525. global : true,
  526. success : function(data) {
  527. if (data.status == 1) {
  528. $('tbody[data-invoice="myReceivables"]').html(data.html);
  529. $('tbody[box-enter="true"]').html(data.html2);
  530. if(data.priceStatus == 1){
  531. $('p[node-msg="true"]').html("收款金额超出开票金额 ¥"+data.price+"元,请谨慎操作。");
  532. $('p[node-msg="true"]').show();
  533. }else if(data.priceStatus == 2&& data.isReceivables != 0){
  534. $('p[node-msg="true"]').html("收款金额少于开票金额 ¥"+data.price+"元,请谨慎操作。");
  535. $('p[node-msg="true"]').show();
  536. }
  537. if(data.isReceivables == 0){
  538. $('p[node-msg="true2"]').html("该发票还没有入账,请先进行选择收款入账");
  539. $('p[node-msg="true2"]').show();
  540. }
  541. }
  542. },
  543. error : function(err) {
  544. }
  545. });
  546. });
  547. */
  548. $("a[node-invoiceReceivables='INFO']").click(function() {
  549. var postData = $(this).attr("data-isKey");
  550. var po='IRTC';
  551. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  552. var url = "/ajaxGetInvoiceInfoByType";
  553. $.ajax({
  554. url : url,
  555. type : "post",
  556. cache : false,
  557. dataType : "json",
  558. data : {
  559. serial : postData,
  560. type:po
  561. },
  562. global : true,
  563. success : function(data) {
  564. if (data.status == 1) {
  565. $("div[loading-msg='true']").html("");
  566. $("#inKey").val(data.iidKey);
  567. $("#irtc").html(data.html);
  568. $("input[name=receivablesPrice]").val(data.receivablesPrice);
  569. $("input[name=receivablesMessage]").val(data.receivablesMessage);
  570. $("input[name=receivablesDate]").val(data.receivablesDate);
  571. } else
  572. $("div[loading-msg='true']").html("illegal request");
  573. },
  574. error : function(err) {
  575. $("div[loading-msg='true']").html("");
  576. }
  577. });
  578. });
  579. $("a[node-invoiceLoss='INFO']").click(function() {
  580. var postData = $(this).attr("data-isKey");
  581. var po='IRTC';
  582. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  583. var url = "/ajaxGetInvoiceInfoByType";
  584. $.ajax({
  585. url : url,
  586. type : "post",
  587. cache : false,
  588. dataType : "json",
  589. data : {
  590. serial : postData,
  591. loss:true,
  592. type:po
  593. },
  594. global : true,
  595. success : function(data) {
  596. if (data.status == 1) {
  597. $("div[loading-msg='true']").html("");
  598. $("#inKey").val(data.iidKey);
  599. $("#irtc").html(data.html);
  600. $("input[name=receivablesPrice]").val(data.receivablesPrice);
  601. $("input[name=receivablesMessage]").val(data.receivablesMessage);
  602. $("input[name=receivablesDate]").val(data.receivablesDate);
  603. } else
  604. $("div[loading-msg='true']").html("illegal request");
  605. },
  606. error : function(err) {
  607. $("div[loading-msg='true']").html("");
  608. }
  609. });
  610. });
  611. $("a[node-irDelete]").click(function() {
  612. var postData = $(this).attr("data-isKey");
  613. $('#claimdKey').val(postData);
  614. });
  615. $("a[node-invoice='INFO']").click(function() {
  616. var postData = $(this).attr("data-isKey");
  617. var type =$(this).attr("data-type");
  618. var po='INVOICE';
  619. if(type=='receivables')
  620. po='RECEIVABLES';
  621. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  622. var url = "/ajaxGetInvoiceInfoByType";
  623. $.ajax({
  624. url : url,
  625. type : "post",
  626. cache : false,
  627. dataType : "json",
  628. data : {
  629. serial : postData,
  630. type:po
  631. },
  632. global : true,
  633. success : function(data) {
  634. if (data.status == 1) {
  635. $("div[loading-msg='true']").html("");
  636. if(type=='receivables')
  637. $("#nr").html(data.html);
  638. else
  639. $("#nc").html(data.html);
  640. } else
  641. $("div[loading-msg='true']").html("illegal request");
  642. },
  643. error : function(err) {
  644. $("div[loading-msg='true']").html("");
  645. $("#nr").html('');
  646. $("#nc").html('');
  647. }
  648. });
  649. });
  650. $("a[node-invoice=PRINT]").click(function() {
  651. var postData = $(this).attr("data-isKey");
  652. var type =$(this).attr("data-type");
  653. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  654. var url = "/ajaxGetInvoiceInfoByPrint";
  655. $.ajax({
  656. url : url,
  657. type : "post",
  658. cache : false,
  659. dataType : "json",
  660. data : {
  661. serial : postData
  662. },
  663. global : true,
  664. success : function(data) {
  665. if (data.status == 1) {
  666. $("div[loading-msg='true']").html("");
  667. $("#prIn").html(data.html);
  668. } else
  669. $("div[loading-msg='true']").html("illegal request");
  670. },
  671. error : function(err) {
  672. $("div[loading-msg='true']").html("");
  673. }
  674. });
  675. });
  676. $("a[node-refund]").click(function() {
  677. var postData = $(this).attr("dataKey");
  678. $("input[name='iridKey']").val(postData);
  679. });
  680. $("a[node-alter]").click(function() {
  681. var postData = $(this).attr("data-isKey");
  682. var url = "/ajaxGetInvoiceReceivablesByStaff";
  683. $.ajax({
  684. url : url,
  685. type : "post",
  686. cache : false,
  687. dataType : "json",
  688. data : {
  689. postData : postData
  690. },
  691. global : true,
  692. success : function(data) {
  693. if (data.status == 1) {
  694. $("input[name='claimKey']").val(postData);
  695. $("select[html-category]").html(data.categoryHtml);
  696. $("select[html-staff]").html(data.staffHtml);
  697. } else
  698. $("div[loading-msg='categoryStaff']").html("illegal request");
  699. },
  700. error : function(err) {
  701. $("div[loading-msg='true']").html("");
  702. }
  703. });
  704. });
  705. $("a[node-unBundLing]").click(function() {
  706. var postData = $(this).attr("data-isKey");
  707. $("input[id='unBundKey']").val(postData);
  708. $("tbody[node-unBundInvoice]").html("loading");
  709. var url = "/ajaxGetInvoiceReceivablesByInvoice";
  710. $.ajax({
  711. url : url,
  712. type : "post",
  713. cache : false,
  714. dataType : "json",
  715. data : {
  716. postData : postData
  717. },
  718. global : true,
  719. success : function(data) {
  720. if (data.status == 1) {
  721. $("tbody[node-unBundInvoice]").html(data.html);
  722. } else
  723. $("tbody[node-unBundInvoice]").html("illegal request");
  724. },
  725. error : function(err) {
  726. $("tbody[node-unBundInvoice]").html("illegal request");
  727. }
  728. });
  729. });
  730. $("a[node-irUpdate]").click(function() {
  731. var postData = $(this).attr("data-isKey");
  732. //$("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  733. var url = "/ajaxGetInvoiceReceivablesByStaff";
  734. $.ajax({
  735. url : url,
  736. type : "post",
  737. cache : false,
  738. dataType : "json",
  739. data : {
  740. postData : postData
  741. },
  742. global : true,
  743. success : function(data) {
  744. if (data.status == 1) {
  745. $("input[name='receivablesPrice']").val(data.detail.receivablesPrice);
  746. $("input[name='receivablesMessage']").val(data.detail.receivablesMessage);
  747. $("input[name='receivablesDate']").val(data.detail.receivablesDate);
  748. $("select[html-rbank]").html(data.rbankHtml);
  749. $("input[id='claimuKey']").val(postData);
  750. $("select[html-rcategory]").html(data.categoryHtml);
  751. $("select[html-rstaff]").html(data.staffHtml);
  752. } else
  753. $("div[loading-msg='categoryStaff']").html("illegal request");
  754. },
  755. error : function(err) {
  756. $("div[loading-msg='true']").html("");
  757. }
  758. });
  759. });
  760. $("a[node-post='upEm']").click(function() {
  761. var postData = $(this).attr("post-data");
  762. $("div[loading-msg='express-msg']").html("<img src='/global/img/loadIco.gif' />");
  763. var url = "/ajaxGetInvoicePostDetail";
  764. $.ajax({
  765. url : url,
  766. type : "post",
  767. cache : false,
  768. dataType : "json",
  769. data : {
  770. iidKey : postData
  771. },
  772. global : true,
  773. success : function(data) {
  774. if (data.status == 1) {
  775. $("input[name='iidKey']").val(postData);
  776. $("td[recipients-data='express-msgU']").html(data.invoiceDetail.recipients);
  777. $("td[recipientsPhone-data='express-msgU']").html(data.invoiceDetail.recipientsPhone);
  778. $("td[recipientsAddress-data='express-msgU']").html(data.invoiceDetail.recipientsAddress);
  779. $("td[mailItems-data='express-msgU']").html(data.invoiceDetail.mailItems);
  780. $("textarea[actualItems-data='express-msgU']").val(data.invoiceDetail.actualItems);
  781. $("select[name='express']").html(data.invoiceDetail.eaHtml);
  782. $("input[expressNumber-data='express-msgU']").val(data.invoiceDetail.expressNumber);
  783. $("div[loading-msg='express-msg']").html("");
  784. } else
  785. $("div[loading-msg='express-msg']").html("illegal request");
  786. },
  787. error : function(err) {
  788. }
  789. });
  790. });
  791. $("select[node-notification]").change(function(){
  792. var notificationType=$(this).attr('data');
  793. var notificationValue=$(this).val();
  794. var url="/ajaxSetNotificationConf";
  795. $.ajax({
  796. url:url,
  797. type:"post",
  798. cache:false,
  799. dataType:"json",
  800. data:{
  801. notificationType:notificationType,
  802. notificationValue:notificationValue
  803. },
  804. global:true,
  805. success:function(data){
  806. if(data.status!=1){
  807. $("#"+data.msgType+"Msg").addClass("colRed");
  808. $("#"+data.msgType+"Msg").html("设置失败").show(300).delay(3000).hide(300);
  809. }else{
  810. $("#"+data.msgType+"Msg").addClass("colGreen");
  811. $("#"+data.msgType+"Msg").html("设置成功").show(300).delay(3000).hide(300);
  812. }
  813. },
  814. error:function(err){
  815. }
  816. });
  817. });
  818. // $("a[node-iStore=del]").click(function() {
  819. // var iStoreKey = $(this).attr("data-key");
  820. // $("input[id=iStoreKey]").val(iStoreKey);
  821. // });
  822. $("a[node-training=del]").click(function() {
  823. var trainingKey = $(this).attr("data-key");
  824. $("input[id='trainingKey']").val(trainingKey);
  825. });
  826. })
  827. function invoiceStoreMail(Key){
  828. $("input[id=MailStoreKey]").val(Key);
  829. // var url="/ajaxGetMailItemByIstore";
  830. // $.ajax({
  831. // url:url,
  832. // type:"post",
  833. // cache:false,
  834. // dataType:"json",
  835. // data:{
  836. // storeKey:iStroreKey
  837. // },
  838. // global:true,
  839. // success:function(data){
  840. //
  841. // console.log(data);
  842. //
  843. // if(data!='null'){
  844. //
  845. // }
  846. //
  847. // if(data.status!=1){
  848. // $("#"+data.msgType+"Msg").addClass("colRed");
  849. // $("#"+data.msgType+"Msg").html("设置失败").show(300).delay(3000).hide(300);
  850. // }else{
  851. // $("#"+data.msgType+"Msg").addClass("colGreen");
  852. // $("#"+data.msgType+"Msg").html("设置成功").show(300).delay(3000).hide(300);
  853. // }
  854. // },
  855. // error:function(err){
  856. //
  857. // }
  858. // });
  859. }
  860. function invoiceStoreDel(iStoreKey){
  861. //var iStoreKey = $(this).attr("data-key");
  862. $("input[id=iStoreKey]").val(iStoreKey);
  863. }
  864. function invoiceStoreApproval(iStoreKey){
  865. $("input[id=appStoreKey]").val(iStoreKey);
  866. }