invoice.js 26 KB

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