invoice.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882
  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() {
  68. $('#invoiceNoStart').keyup(function() {
  69. var start=$(this).val();
  70. var total=$('#invoiceNoTotal').val();
  71. var s=Number(start)+Number(total);
  72. $('#invoiceNoEnd').val('No.'+s);
  73. });
  74. $('#invoiceNoTotal').keyup(function() {
  75. var start=$(this).val();
  76. var total=$('#invoiceNoStart').val();
  77. var s=Number(start)+Number(total);
  78. $('#invoiceNoEnd').val('No.'+s);
  79. });
  80. $('a[node-claim="receivables"]').click(function() {
  81. $("#iridKey").val($(this).attr("data-key"));
  82. });
  83. $('select[node-itSChange]').change(function() {
  84. var itsStatus=$(this).val();
  85. var action = $('#its').attr("action");
  86. action=encodeURI(action+'?trainStatus='+itsStatus);
  87. $('#its').attr("action",action);
  88. $('#its').submit();
  89. });
  90. $('select[node-iryChange]').change(function() {
  91. var year=$(this).val();
  92. var month="All";
  93. var irmMebSea=$('input[data-irmMebSea]').val();
  94. var action = $('#iras').attr("action");
  95. action=encodeURI(action+'/'+year+'/'+month+"/"+irmMebSea);
  96. $('#iras').attr("action",action);
  97. $('#iras').submit();
  98. });
  99. $('select[node-irmChange]').change(function() {
  100. var month=$(this).val();
  101. var year=$('select[node-iryChange]').val();
  102. var irmMebSea=$('input[data-irmMebSea]').val();
  103. var action = $('#iras').attr("action");
  104. action=encodeURI(action+'/'+year+'/'+month+"/"+irmMebSea);
  105. $('#iras').attr("action",action);
  106. $('#iras').submit();
  107. });
  108. $('select[node-invoiceType]').change(function() {
  109. $('#iaa').submit();
  110. });
  111. $('select[node-invoiceTrain]').change(function() {
  112. $('#iaa').submit();
  113. });
  114. /**
  115. * 废弃方法
  116. $('button[node-irmMebSea]').click(function() {
  117. var month=$('select[node-irmChange]').val();
  118. var year=$('select[node-iryChange]').val();
  119. var irmMebSea=$('input[data-irmMebSea]').val();
  120. var action = $('#iras').attr("action");
  121. action=encodeURI(action+'/'+year+'/'+month+"/"+irmMebSea);
  122. $('#iras').attr("action",action);
  123. $('#iras').submit();
  124. });
  125. */
  126. $('input[refreshData=time]').click(function() {
  127. $('#iras').submit();
  128. });
  129. $('button[node-iramMebSea]').click(function() {
  130. var irmMebSea=$('input[data-irmMebSea]').val();
  131. var action = $('#ira').attr("action");
  132. action=encodeURI(action+"/"+irmMebSea);
  133. $('#ira').attr("action",action);
  134. $('#ira').submit();
  135. });
  136. $('a[node-rtm]').click(function() {
  137. $("#iridKey").val($(this).attr("data-key"));
  138. $("#recepitTitleMark").val($(this).attr("data-title"));
  139. });
  140. $('a[node-express="untread"]').click(function() {
  141. $('td[node-express="msg"]').html($(this).attr('title'));
  142. });
  143. $("input[name='untreadPost']").click(function() {
  144. $("table[post-box='ture']").hide();
  145. });
  146. $("input[node-untread='post']").click(function() {
  147. //$("table[post-box='ture']").show();
  148. });
  149. $("a[node-approval^='approval']").click(function() {
  150. $("input[name='status']").val($(this).attr("diss-data"));
  151. $("form[name='invoiceApproval']").submit();
  152. });
  153. $("a[node-invoice='droppedInvoice']").click(function() {
  154. $("input[name='droppedIidKey']").val($(this).attr("diss-data"));
  155. });
  156. $("a[node-invoice='untreadInvoice']").click(function() {
  157. $("input[name='untreadIidKey']").val($(this).attr("diss-data"));
  158. });
  159. // $('a[bind-receivables="true"]').click(function() {
  160. // console.log('ddd');
  161. // });
  162. $("button[invoice-search='title']").click(function() {
  163. var title=$("input[name='searchTitle']").val();
  164. if(title==''){
  165. alert('请填写开票单位');
  166. return '';
  167. }
  168. $("div[node-invoiceHtml='true']").html('');
  169. var url = "/ajaxGetInvoiceReceivablesByTitle";
  170. $.ajax({
  171. url : url,
  172. type : "post",
  173. cache : false,
  174. dataType : "json",
  175. data : {
  176. title : title
  177. },
  178. global : true,
  179. success : function(data) {
  180. if (data.status == 1) {
  181. $("div[node-invoiceHtml='true']").html(data.invoiceHtml);
  182. }
  183. },
  184. error : function(err) {
  185. }
  186. });
  187. });
  188. //
  189. $("a[bind-invoice='receivables']").click(function() {
  190. var key = $(this).attr("node-key");
  191. $("input[name='key']").val('');
  192. $("div[node-receivablesHtml='true']").html('');
  193. $("div[node-invoiceHtml='true']").html('');
  194. $("blockquote[node-search='invoice']").hide();
  195. var url = "/ajaxGetInvoiceReceivablesByIrid";
  196. $.ajax({
  197. url : url,
  198. type : "post",
  199. cache : false,
  200. dataType : "json",
  201. data : {
  202. irid : key
  203. },
  204. global : true,
  205. success : function(data) {
  206. if (data.status == 1) {
  207. $("div[node-receivablesHtml='true']").html(data.receivablesHtml);
  208. $("div[node-invoiceHtml='true']").html(data.invoiceHtml);
  209. $("input[name='key']").val(data.irkey);
  210. if(data.isInvoice)
  211. $("blockquote[node-search='invoice']").show();
  212. else
  213. $("blockquote[node-search='invoice']").hide();
  214. } else{
  215. $("input[name='key']").val('');
  216. $("div[node-receivablesHtml='true']").html('');
  217. $("div[node-invoiceHtml='true']").html('');
  218. $("blockquote[node-search='invoice']").hide();
  219. }
  220. },
  221. error : function(err) {
  222. }
  223. });
  224. });
  225. $("a[node-post='express']").click(function() {
  226. var postData = $(this).attr("post-data");
  227. $("input[name='iidKey']").val(postData);
  228. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  229. var url = "/ajaxGetInvoicePostDetail";
  230. $.ajax({
  231. url : url,
  232. type : "post",
  233. cache : false,
  234. dataType : "json",
  235. data : {
  236. iidKey : postData
  237. },
  238. global : true,
  239. success : function(data) {
  240. if (data.status == 1) {
  241. $("td[recipients-data='true']").html(data.invoiceDetail.recipients);
  242. $("td[recipientsPhone-data='true']").html(data.invoiceDetail.recipientsPhone);
  243. $("td[recipientsAddress-data='true']").html(data.invoiceDetail.recipientsAddress);
  244. $("td[mailItems-data='true']").html(data.invoiceDetail.mailItems);
  245. $("div[loading-msg='true']").html("");
  246. } else
  247. $("div[loading-msg='true']").html("illegal request");
  248. },
  249. error : function(err) {
  250. }
  251. });
  252. });
  253. $("a[node-post='express-msg']").click(function() {
  254. var postData = $(this).attr("post-data");
  255. $("div[loading-msg='express-msg']").html("<img src='/global/img/loadIco.gif' />");
  256. var url = "/ajaxGetInvoicePostDetail";
  257. $.ajax({
  258. url : url,
  259. type : "post",
  260. cache : false,
  261. dataType : "json",
  262. data : {
  263. iidKey : postData
  264. },
  265. global : true,
  266. success : function(data) {
  267. if (data.status == 1) {
  268. $("td[recipients-data='express-msg']").html(data.invoiceDetail.recipients);
  269. $("td[recipientsPhone-data='express-msg']").html(data.invoiceDetail.recipientsPhone);
  270. $("td[recipientsAddress-data='express-msg']").html(data.invoiceDetail.recipientsAddress);
  271. $("td[mailItems-data='express-msg']").html(data.invoiceDetail.mailItems);
  272. $("td[actualItems-data='express-msg']").html(data.invoiceDetail.actualItems);
  273. $("td[expressCompany-data='express-msg']").html(data.invoiceDetail.expressCompany);
  274. if(data.invoiceDetail.expressCom=="SF")
  275. $("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>");
  276. else
  277. $("td[expressNumber-data='express-msg']").html(data.invoiceDetail.expressNumber+"&nbsp;<a target='_blank' href='/invoiceExpress/"+data.invoiceDetail.expressCom+"/"+data.invoiceDetail.expressNumber+".html'>点击查询快递信息</a>");
  278. $("div[loading-msg='express-msg']").html("");
  279. } else
  280. $("div[loading-msg='express-msg']").html("illegal request");
  281. },
  282. error : function(err) {
  283. }
  284. });
  285. });
  286. $("a[node-post='expressActual-msg']").click(function() {
  287. var postData = $(this).attr("post-data");
  288. $("div[loading-msg='express-msg']").html("<img src='/global/img/loadIco.gif' />");
  289. var url = "/ajaxGetInvoicePostDetail";
  290. $.ajax({
  291. url : url,
  292. type : "post",
  293. cache : false,
  294. dataType : "json",
  295. data : {
  296. iidKey : postData
  297. },
  298. global : true,
  299. success : function(data) {
  300. if (data.status == 1) {
  301. $("td[mailItems-data='express-msg']").html(data.invoiceDetail.mailItems);
  302. $("td[actualItems-data='express-msg']").html(data.invoiceDetail.actualItems);
  303. if(data.invoiceDetail.expressCom=="SF")
  304. $("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>");
  305. else
  306. $("td[expressCompany-data='express-msg']").html(data.invoiceDetail.expressCompany+"&nbsp;<a target='_blank' href='/invoiceExpress/"+data.invoiceDetail.expressCom+"/"+data.invoiceDetail.expressNumber+".html'>点击查询快递信息</a>");
  307. $("td[actualItems-data='express-msg']").html(data.invoiceDetail.actualItems);
  308. // $("td[recipients-data='express-msg']").html(data.invoiceDetail.recipients);
  309. // $("td[recipientsPhone-data='express-msg']").html(data.invoiceDetail.recipientsPhone);
  310. // $("td[recipientsAddress-data='express-msg']").html(data.invoiceDetail.recipientsAddress);
  311. // $("td[mailItems-data='express-msg']").html(data.invoiceDetail.mailItems);
  312. // $("td[actualItems-data='express-msg']").html(data.invoiceDetail.actualItems);
  313. // $("td[expressCompany-data='express-msg']").html(data.invoiceDetail.expressCompany);
  314. // $("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>");
  315. $("div[loading-msg='express-msg']").html("");
  316. } else
  317. $("div[loading-msg='express-msg']").html("illegal request");
  318. },
  319. error : function(err) {
  320. }
  321. });
  322. });
  323. $("select[name='receivablesCategory']").click(function() {
  324. var cid = $("select[name='receivablesCategory'] option:selected").attr("post-data");
  325. var url = "/ajaxGetStaffByCategory";
  326. $.ajax({
  327. url : url,
  328. type : "post",
  329. cache : false,
  330. dataType : "json",
  331. data : {
  332. cid : cid
  333. },
  334. global : true,
  335. success : function(data) {
  336. if (data.status == 1) {
  337. $("select[name='receivablesStaff']").html(data.html);
  338. }
  339. //else
  340. // $("div[loading-msg='true']").html("illegal request");
  341. },
  342. error : function(err) {
  343. }
  344. });
  345. });
  346. $('a[node-receivables="true"]').click(function() {
  347. var postData = $(this).attr("data-key");
  348. var url = "/ajaxGetInvoiceReceivables";
  349. $.ajax({
  350. url : url,
  351. type : "post",
  352. cache : false,
  353. dataType : "json",
  354. data : {
  355. key : postData
  356. },
  357. global : true,
  358. success : function(data) {
  359. if (data.status == 1) {
  360. $("input[name='key']").val(postData);
  361. $("td[node-receivablesSerial]").html(data.detail.receivablesSerial);
  362. $("td[node-inputStaff]").html(data.detail.inputStaff+"&nbsp;"+data.detail.date);
  363. $("td[node-price]").html("<b>"+data.detail.receivablesPrice+"</b>");
  364. $("td[node-message]").html(data.detail.receivablesMessage);
  365. $("td[node-bank]").html(data.detail.receivablesBank);
  366. $("td[node-date]").html(data.detail.receivablesDate);
  367. }
  368. },
  369. error : function(err) {
  370. }
  371. });
  372. });
  373. /**
  374. * 废弃
  375. $('a[node-recording="true"]').click(function() {
  376. var postData = $(this).attr("data-key");
  377. $("input[name='key']").val(postData);
  378. $("input[name='invoiceKey']").val("");
  379. $("p[node-msg='true']").hide();
  380. $("p[node-loading='true']").hide();
  381. $('tbody[data-invoice="myClaim"]').html("");
  382. var url = "/ajaxGetInvoiceByStaff";
  383. $.ajax({
  384. url : url,
  385. type : "post",
  386. cache : false,
  387. dataType : "json",
  388. data : {
  389. key : postData
  390. },
  391. global : true,
  392. success : function(data) {
  393. if (data.status == 1) {
  394. $('tbody[data-invoice="myClaim"]').html(data.html);
  395. }
  396. },
  397. error : function(err) {
  398. }
  399. });
  400. });
  401. */
  402. /**
  403. * 废弃
  404. $('a[node-receivalbles="bind"]').click(function() {
  405. var postData = $(this).attr("diss-data");
  406. $("input[name='key']").val(postData);
  407. $("input[name='invoiceKey']").val("");
  408. $("p[node-msg='true']").hide();
  409. $("p[node-msg='true2']").hide();
  410. $("p[node-loading='true']").hide();
  411. $('tbody[data-invoice="myReceivables"]').html("");
  412. var url = "/ajaxGetReceivalblesByStaff";
  413. $.ajax({
  414. url : url,
  415. type : "post",
  416. cache : false,
  417. dataType : "json",
  418. data : {
  419. key : postData
  420. },
  421. global : true,
  422. success : function(data) {
  423. if (data.status == 1) {
  424. $('tbody[data-invoice="myReceivables"]').html(data.html);
  425. $('tbody[box-enter="true"]').html(data.html2);
  426. if(data.priceStatus == 1){
  427. $('p[node-msg="true"]').html("收款金额超出开票金额 ¥"+data.price+"元,请谨慎操作。");
  428. $('p[node-msg="true"]').show();
  429. }else if(data.priceStatus == 2&& data.isReceivables != 0){
  430. $('p[node-msg="true"]').html("收款金额少于开票金额 ¥"+data.price+"元,请谨慎操作。");
  431. $('p[node-msg="true"]').show();
  432. }
  433. if(data.isReceivables == 0){
  434. $('p[node-msg="true2"]').html("该发票还没有入账,请先进行选择收款入账");
  435. $('p[node-msg="true2"]').show();
  436. }
  437. }
  438. },
  439. error : function(err) {
  440. }
  441. });
  442. });
  443. */
  444. $("a[node-invoiceReceivables='INFO']").click(function() {
  445. var postData = $(this).attr("data-isKey");
  446. var po='IRTC';
  447. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  448. var url = "/ajaxGetInvoiceInfoByType";
  449. $.ajax({
  450. url : url,
  451. type : "post",
  452. cache : false,
  453. dataType : "json",
  454. data : {
  455. serial : postData,
  456. type:po
  457. },
  458. global : true,
  459. success : function(data) {
  460. if (data.status == 1) {
  461. $("div[loading-msg='true']").html("");
  462. $("#inKey").val(data.iidKey);
  463. $("#irtc").html(data.html);
  464. $("input[name=receivablesPrice]").val(data.receivablesPrice);
  465. $("input[name=receivablesMessage]").val(data.receivablesMessage);
  466. $("input[name=receivablesDate]").val(data.receivablesDate);
  467. } else
  468. $("div[loading-msg='true']").html("illegal request");
  469. },
  470. error : function(err) {
  471. $("div[loading-msg='true']").html("");
  472. }
  473. });
  474. });
  475. $("a[node-invoiceLoss='INFO']").click(function() {
  476. var postData = $(this).attr("data-isKey");
  477. var po='IRTC';
  478. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  479. var url = "/ajaxGetInvoiceInfoByType";
  480. $.ajax({
  481. url : url,
  482. type : "post",
  483. cache : false,
  484. dataType : "json",
  485. data : {
  486. serial : postData,
  487. loss:true,
  488. type:po
  489. },
  490. global : true,
  491. success : function(data) {
  492. if (data.status == 1) {
  493. $("div[loading-msg='true']").html("");
  494. $("#inKey").val(data.iidKey);
  495. $("#irtc").html(data.html);
  496. $("input[name=receivablesPrice]").val(data.receivablesPrice);
  497. $("input[name=receivablesMessage]").val(data.receivablesMessage);
  498. $("input[name=receivablesDate]").val(data.receivablesDate);
  499. } else
  500. $("div[loading-msg='true']").html("illegal request");
  501. },
  502. error : function(err) {
  503. $("div[loading-msg='true']").html("");
  504. }
  505. });
  506. });
  507. $("a[node-invoice='INFO']").click(function() {
  508. var postData = $(this).attr("data-isKey");
  509. var type =$(this).attr("data-type");
  510. var po='INVOICE';
  511. if(type=='receivables')
  512. po='RECEIVABLES';
  513. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  514. var url = "/ajaxGetInvoiceInfoByType";
  515. $.ajax({
  516. url : url,
  517. type : "post",
  518. cache : false,
  519. dataType : "json",
  520. data : {
  521. serial : postData,
  522. type:po
  523. },
  524. global : true,
  525. success : function(data) {
  526. if (data.status == 1) {
  527. $("div[loading-msg='true']").html("");
  528. if(type=='receivables')
  529. $("#nr").html(data.html);
  530. else
  531. $("#nc").html(data.html);
  532. } else
  533. $("div[loading-msg='true']").html("illegal request");
  534. },
  535. error : function(err) {
  536. $("div[loading-msg='true']").html("");
  537. }
  538. });
  539. });
  540. $("a[node-invoice=PRINT]").click(function() {
  541. var postData = $(this).attr("data-isKey");
  542. var type =$(this).attr("data-type");
  543. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  544. var url = "/ajaxGetInvoiceInfoByPrint";
  545. $.ajax({
  546. url : url,
  547. type : "post",
  548. cache : false,
  549. dataType : "json",
  550. data : {
  551. serial : postData
  552. },
  553. global : true,
  554. success : function(data) {
  555. if (data.status == 1) {
  556. $("div[loading-msg='true']").html("");
  557. $("#prIn").html(data.html);
  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-alter]").click(function() {
  567. var postData = $(this).attr("data-isKey");
  568. //$("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  569. var url = "/ajaxGetInvoiceReceivablesByStaff";
  570. $.ajax({
  571. url : url,
  572. type : "post",
  573. cache : false,
  574. dataType : "json",
  575. data : {
  576. postData : postData
  577. },
  578. global : true,
  579. success : function(data) {
  580. if (data.status == 1) {
  581. $("input[name='claimKey']").val(postData);
  582. $("select[html-category]").html(data.categoryHtml);
  583. $("select[html-staff]").html(data.staffHtml);
  584. } else
  585. $("div[loading-msg='categoryStaff']").html("illegal request");
  586. },
  587. error : function(err) {
  588. $("div[loading-msg='true']").html("");
  589. }
  590. });
  591. });
  592. $("a[node-unBundLing]").click(function() {
  593. var postData = $(this).attr("data-isKey");
  594. $("input[id='unBundKey']").val(postData);
  595. $("tbody[node-unBundInvoice]").html("loading");
  596. var url = "/ajaxGetInvoiceReceivablesByInvoice";
  597. $.ajax({
  598. url : url,
  599. type : "post",
  600. cache : false,
  601. dataType : "json",
  602. data : {
  603. postData : postData
  604. },
  605. global : true,
  606. success : function(data) {
  607. if (data.status == 1) {
  608. $("tbody[node-unBundInvoice]").html(data.html);
  609. } else
  610. $("tbody[node-unBundInvoice]").html("illegal request");
  611. },
  612. error : function(err) {
  613. $("tbody[node-unBundInvoice]").html("illegal request");
  614. }
  615. });
  616. });
  617. $("a[node-irUpdate]").click(function() {
  618. var postData = $(this).attr("data-isKey");
  619. //$("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  620. var url = "/ajaxGetInvoiceReceivablesByStaff";
  621. $.ajax({
  622. url : url,
  623. type : "post",
  624. cache : false,
  625. dataType : "json",
  626. data : {
  627. postData : postData
  628. },
  629. global : true,
  630. success : function(data) {
  631. if (data.status == 1) {
  632. $("input[name='receivablesPrice']").val(data.detail.receivablesPrice);
  633. $("input[name='receivablesMessage']").val(data.detail.receivablesMessage);
  634. $("input[name='receivablesDate']").val(data.detail.receivablesDate);
  635. $("select[html-rbank]").html(data.rbankHtml);
  636. $("input[id='claimuKey']").val(postData);
  637. $("select[html-rcategory]").html(data.categoryHtml);
  638. $("select[html-rstaff]").html(data.staffHtml);
  639. } else
  640. $("div[loading-msg='categoryStaff']").html("illegal request");
  641. },
  642. error : function(err) {
  643. $("div[loading-msg='true']").html("");
  644. }
  645. });
  646. });
  647. $("a[node-post='upEm']").click(function() {
  648. var postData = $(this).attr("post-data");
  649. $("div[loading-msg='express-msg']").html("<img src='/global/img/loadIco.gif' />");
  650. var url = "/ajaxGetInvoicePostDetail";
  651. $.ajax({
  652. url : url,
  653. type : "post",
  654. cache : false,
  655. dataType : "json",
  656. data : {
  657. iidKey : postData
  658. },
  659. global : true,
  660. success : function(data) {
  661. if (data.status == 1) {
  662. $("input[name='iidKey']").val(postData);
  663. $("td[recipients-data='express-msgU']").html(data.invoiceDetail.recipients);
  664. $("td[recipientsPhone-data='express-msgU']").html(data.invoiceDetail.recipientsPhone);
  665. $("td[recipientsAddress-data='express-msgU']").html(data.invoiceDetail.recipientsAddress);
  666. $("td[mailItems-data='express-msgU']").html(data.invoiceDetail.mailItems);
  667. $("textarea[actualItems-data='express-msgU']").val(data.invoiceDetail.actualItems);
  668. $("select[name='express']").html(data.invoiceDetail.eaHtml);
  669. $("input[expressNumber-data='express-msgU']").val(data.invoiceDetail.expressNumber);
  670. $("div[loading-msg='express-msg']").html("");
  671. } else
  672. $("div[loading-msg='express-msg']").html("illegal request");
  673. },
  674. error : function(err) {
  675. }
  676. });
  677. });
  678. $("select[node-notification]").change(function(){
  679. var notificationType=$(this).attr('data');
  680. var notificationValue=$(this).val();
  681. var url="/ajaxSetNotificationConf";
  682. $.ajax({
  683. url:url,
  684. type:"post",
  685. cache:false,
  686. dataType:"json",
  687. data:{
  688. notificationType:notificationType,
  689. notificationValue:notificationValue
  690. },
  691. global:true,
  692. success:function(data){
  693. if(data.status!=1){
  694. $("#"+data.msgType+"Msg").addClass("colRed");
  695. $("#"+data.msgType+"Msg").html("设置失败").show(300).delay(3000).hide(300);
  696. }else{
  697. $("#"+data.msgType+"Msg").addClass("colGreen");
  698. $("#"+data.msgType+"Msg").html("设置成功").show(300).delay(3000).hide(300);
  699. }
  700. },
  701. error:function(err){
  702. }
  703. });
  704. });
  705. // $("a[node-iStore=del]").click(function() {
  706. // var iStoreKey = $(this).attr("data-key");
  707. // $("input[id=iStoreKey]").val(iStoreKey);
  708. // });
  709. $("a[node-training=del]").click(function() {
  710. var trainingKey = $(this).attr("data-key");
  711. $("input[id='trainingKey']").val(trainingKey);
  712. });
  713. })
  714. function invoiceStoreMail(Key){
  715. $("input[id=MailStoreKey]").val(Key);
  716. // var url="/ajaxGetMailItemByIstore";
  717. // $.ajax({
  718. // url:url,
  719. // type:"post",
  720. // cache:false,
  721. // dataType:"json",
  722. // data:{
  723. // storeKey:iStroreKey
  724. // },
  725. // global:true,
  726. // success:function(data){
  727. //
  728. // console.log(data);
  729. //
  730. // if(data!='null'){
  731. //
  732. // }
  733. //
  734. // if(data.status!=1){
  735. // $("#"+data.msgType+"Msg").addClass("colRed");
  736. // $("#"+data.msgType+"Msg").html("设置失败").show(300).delay(3000).hide(300);
  737. // }else{
  738. // $("#"+data.msgType+"Msg").addClass("colGreen");
  739. // $("#"+data.msgType+"Msg").html("设置成功").show(300).delay(3000).hide(300);
  740. // }
  741. // },
  742. // error:function(err){
  743. //
  744. // }
  745. // });
  746. }
  747. function invoiceStoreDel(iStoreKey){
  748. //var iStoreKey = $(this).attr("data-key");
  749. $("input[id=iStoreKey]").val(iStoreKey);
  750. }
  751. function invoiceStoreApproval(iStoreKey){
  752. $("input[id=appStoreKey]").val(iStoreKey);
  753. }