invoice.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. function receiptYear(){
  2. var form = $('#up');
  3. $('#year').val($('#Y').val());
  4. form.submit();
  5. }
  6. function sures()
  7. {
  8. if(confirm('请确认核销该发票,核销后不可更改!'))
  9. return true;
  10. else
  11. return false;
  12. }
  13. $(function() {
  14. $('select[node-iryChange]').change(function() {
  15. var year=$(this).val();
  16. var month="All";
  17. var irmMebSea=$('input[data-irmMebSea]').val();
  18. var action = $('#iras').attr("action");
  19. action=encodeURI(action+'/'+year+'/'+month+"/"+irmMebSea);
  20. $('#iras').attr("action",action);
  21. $('#iras').submit();
  22. });
  23. $('select[node-irmChange]').change(function() {
  24. var month=$(this).val();
  25. var year=$('select[node-iryChange]').val();
  26. var irmMebSea=$('input[data-irmMebSea]').val();
  27. var action = $('#iras').attr("action");
  28. action=encodeURI(action+'/'+year+'/'+month+"/"+irmMebSea);
  29. $('#iras').attr("action",action);
  30. $('#iras').submit();
  31. });
  32. $('button[node-irmMebSea]').click(function() {
  33. var month=$('select[node-irmChange]').val();
  34. var year=$('select[node-iryChange]').val();
  35. var irmMebSea=$('input[data-irmMebSea]').val();
  36. var action = $('#iras').attr("action");
  37. action=encodeURI(action+'/'+year+'/'+month+"/"+irmMebSea);
  38. $('#iras').attr("action",action);
  39. $('#iras').submit();
  40. });
  41. $('button[node-iramMebSea]').click(function() {
  42. var irmMebSea=$('input[data-irmMebSea]').val();
  43. var action = $('#ira').attr("action");
  44. action=encodeURI(action+"/"+irmMebSea);
  45. $('#ira').attr("action",action);
  46. $('#ira').submit();
  47. });
  48. $('a[node-express="untread"]').click(function() {
  49. $('td[node-express="msg"]').html($(this).attr('title'));
  50. });
  51. $("input[name='untreadPost']").click(function() {
  52. $("table[post-box='ture']").hide();
  53. });
  54. $("input[node-untread='post']").click(function() {
  55. $("table[post-box='ture']").show();
  56. });
  57. $("a[node-approval^='approval']").click(function() {
  58. $("input[name='status']").val($(this).attr("diss-data"));
  59. $("form[name='invoiceApproval']").submit();
  60. });
  61. $("a[node-invoice='droppedInvoice']").click(function() {
  62. $("input[name='droppedIidKey']").val($(this).attr("diss-data"));
  63. });
  64. $("a[node-invoice='untreadInvoice']").click(function() {
  65. $("input[name='untreadIidKey']").val($(this).attr("diss-data"));
  66. });
  67. $('a[bind-receivables="true"]').click(function() {
  68. console.log('ddd');
  69. });
  70. $("button[invoice-search='title']").click(function() {
  71. var title=$("input[name='searchTitle']").val();
  72. if(title==''){
  73. alert('请填写开票单位');
  74. return '';
  75. }
  76. $("div[node-invoiceHtml='true']").html('');
  77. var url = "/ajaxGetInvoiceReceivablesByTitle";
  78. $.ajax({
  79. url : url,
  80. type : "post",
  81. cache : false,
  82. dataType : "json",
  83. data : {
  84. title : title
  85. },
  86. global : true,
  87. success : function(data) {
  88. if (data.status == 1) {
  89. $("div[node-invoiceHtml='true']").html(data.invoiceHtml);
  90. }
  91. },
  92. error : function(err) {
  93. }
  94. });
  95. });
  96. //
  97. $("a[bind-invoice='receivables']").click(function() {
  98. var key = $(this).attr("node-key");
  99. $("input[name='key']").val('');
  100. $("div[node-receivablesHtml='true']").html('');
  101. $("div[node-invoiceHtml='true']").html('');
  102. $("blockquote[node-search='invoice']").hide();
  103. var url = "/ajaxGetInvoiceReceivablesByIrid";
  104. $.ajax({
  105. url : url,
  106. type : "post",
  107. cache : false,
  108. dataType : "json",
  109. data : {
  110. irid : key
  111. },
  112. global : true,
  113. success : function(data) {
  114. if (data.status == 1) {
  115. $("div[node-receivablesHtml='true']").html(data.receivablesHtml);
  116. $("div[node-invoiceHtml='true']").html(data.invoiceHtml);
  117. $("input[name='key']").val(data.irkey);
  118. if(data.isInvoice)
  119. $("blockquote[node-search='invoice']").show();
  120. else
  121. $("blockquote[node-search='invoice']").hide();
  122. } else{
  123. $("input[name='key']").val('');
  124. $("div[node-receivablesHtml='true']").html('');
  125. $("div[node-invoiceHtml='true']").html('');
  126. $("blockquote[node-search='invoice']").hide();
  127. }
  128. },
  129. error : function(err) {
  130. }
  131. });
  132. });
  133. $("a[node-post='express']").click(function() {
  134. var postData = $(this).attr("post-data");
  135. $("input[name='iidKey']").val(postData);
  136. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  137. var url = "/ajaxGetInvoicePostDetail";
  138. $.ajax({
  139. url : url,
  140. type : "post",
  141. cache : false,
  142. dataType : "json",
  143. data : {
  144. iidKey : postData
  145. },
  146. global : true,
  147. success : function(data) {
  148. if (data.status == 1) {
  149. $("td[recipients-data='true']").html(data.invoiceDetail.recipients);
  150. $("td[recipientsPhone-data='true']").html(data.invoiceDetail.recipientsPhone);
  151. $("td[recipientsAddress-data='true']").html(data.invoiceDetail.recipientsAddress);
  152. $("td[mailItems-data='true']").html(data.invoiceDetail.mailItems);
  153. $("div[loading-msg='true']").html("");
  154. } else
  155. $("div[loading-msg='true']").html("illegal request");
  156. },
  157. error : function(err) {
  158. }
  159. });
  160. });
  161. $("a[node-post='express-msg']").click(function() {
  162. var postData = $(this).attr("post-data");
  163. $("div[loading-msg='express-msg']").html("<img src='/global/img/loadIco.gif' />");
  164. var url = "/ajaxGetInvoicePostDetail";
  165. $.ajax({
  166. url : url,
  167. type : "post",
  168. cache : false,
  169. dataType : "json",
  170. data : {
  171. iidKey : postData
  172. },
  173. global : true,
  174. success : function(data) {
  175. if (data.status == 1) {
  176. $("td[recipients-data='express-msg']").html(data.invoiceDetail.recipients);
  177. $("td[recipientsPhone-data='express-msg']").html(data.invoiceDetail.recipientsPhone);
  178. $("td[recipientsAddress-data='express-msg']").html(data.invoiceDetail.recipientsAddress);
  179. $("td[mailItems-data='express-msg']").html(data.invoiceDetail.mailItems);
  180. $("td[actualItems-data='express-msg']").html(data.invoiceDetail.actualItems);
  181. $("td[expressCompany-data='express-msg']").html(data.invoiceDetail.expressCompany);
  182. $("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>");
  183. $("div[loading-msg='express-msg']").html("");
  184. } else
  185. $("div[loading-msg='express-msg']").html("illegal request");
  186. },
  187. error : function(err) {
  188. }
  189. });
  190. });
  191. $("select[name='receivablesCategory']").click(function() {
  192. var cid = $("select[name='receivablesCategory'] option:selected").attr("post-data");
  193. var url = "/ajaxGetStaffByCategory";
  194. $.ajax({
  195. url : url,
  196. type : "post",
  197. cache : false,
  198. dataType : "json",
  199. data : {
  200. cid : cid
  201. },
  202. global : true,
  203. success : function(data) {
  204. if (data.status == 1) {
  205. $("select[name='receivablesStaff']").html(data.html);
  206. }
  207. //else
  208. // $("div[loading-msg='true']").html("illegal request");
  209. },
  210. error : function(err) {
  211. }
  212. });
  213. });
  214. $('a[node-receivables="true"]').click(function() {
  215. var postData = $(this).attr("data-key");
  216. var url = "/ajaxGetInvoiceReceivables";
  217. $.ajax({
  218. url : url,
  219. type : "post",
  220. cache : false,
  221. dataType : "json",
  222. data : {
  223. key : postData
  224. },
  225. global : true,
  226. success : function(data) {
  227. if (data.status == 1) {
  228. $("input[name='key']").val(postData);
  229. $("td[node-receivablesSerial]").html(data.detail.receivablesSerial);
  230. $("td[node-inputStaff]").html(data.detail.inputStaff+"&nbsp;"+data.detail.date);
  231. $("td[node-price]").html("<b>"+data.detail.receivablesPrice+"</b>");
  232. $("td[node-message]").html(data.detail.receivablesMessage);
  233. $("td[node-bank]").html(data.detail.receivablesBank);
  234. $("td[node-date]").html(data.detail.receivablesDate);
  235. }
  236. },
  237. error : function(err) {
  238. }
  239. });
  240. });
  241. /**
  242. * 废弃
  243. $('a[node-recording="true"]').click(function() {
  244. var postData = $(this).attr("data-key");
  245. $("input[name='key']").val(postData);
  246. $("input[name='invoiceKey']").val("");
  247. $("p[node-msg='true']").hide();
  248. $("p[node-loading='true']").hide();
  249. $('tbody[data-invoice="myClaim"]').html("");
  250. var url = "/ajaxGetInvoiceByStaff";
  251. $.ajax({
  252. url : url,
  253. type : "post",
  254. cache : false,
  255. dataType : "json",
  256. data : {
  257. key : postData
  258. },
  259. global : true,
  260. success : function(data) {
  261. if (data.status == 1) {
  262. $('tbody[data-invoice="myClaim"]').html(data.html);
  263. }
  264. },
  265. error : function(err) {
  266. }
  267. });
  268. });
  269. */
  270. /**
  271. * 废弃
  272. $('a[node-receivalbles="bind"]').click(function() {
  273. var postData = $(this).attr("diss-data");
  274. $("input[name='key']").val(postData);
  275. $("input[name='invoiceKey']").val("");
  276. $("p[node-msg='true']").hide();
  277. $("p[node-msg='true2']").hide();
  278. $("p[node-loading='true']").hide();
  279. $('tbody[data-invoice="myReceivables"]').html("");
  280. var url = "/ajaxGetReceivalblesByStaff";
  281. $.ajax({
  282. url : url,
  283. type : "post",
  284. cache : false,
  285. dataType : "json",
  286. data : {
  287. key : postData
  288. },
  289. global : true,
  290. success : function(data) {
  291. if (data.status == 1) {
  292. $('tbody[data-invoice="myReceivables"]').html(data.html);
  293. $('tbody[box-enter="true"]').html(data.html2);
  294. if(data.priceStatus == 1){
  295. $('p[node-msg="true"]').html("收款金额超出开票金额 ¥"+data.price+"元,请谨慎操作。");
  296. $('p[node-msg="true"]').show();
  297. }else if(data.priceStatus == 2&& data.isReceivables != 0){
  298. $('p[node-msg="true"]').html("收款金额少于开票金额 ¥"+data.price+"元,请谨慎操作。");
  299. $('p[node-msg="true"]').show();
  300. }
  301. if(data.isReceivables == 0){
  302. $('p[node-msg="true2"]').html("该发票还没有入账,请先进行选择收款入账");
  303. $('p[node-msg="true2"]').show();
  304. }
  305. }
  306. },
  307. error : function(err) {
  308. }
  309. });
  310. });
  311. */
  312. $("a[node-invoiceReceivables='INFO']").click(function() {
  313. var postData = $(this).attr("data-isKey");
  314. var po='IRTC';
  315. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  316. var url = "/ajaxGetInvoiceInfoByType";
  317. $.ajax({
  318. url : url,
  319. type : "post",
  320. cache : false,
  321. dataType : "json",
  322. data : {
  323. serial : postData,
  324. type:po
  325. },
  326. global : true,
  327. success : function(data) {
  328. if (data.status == 1) {
  329. $("div[loading-msg='true']").html("");
  330. $("#inKey").val(data.iidKey);
  331. $("#irtc").html(data.html);
  332. } else
  333. $("div[loading-msg='true']").html("illegal request");
  334. },
  335. error : function(err) {
  336. $("div[loading-msg='true']").html("");
  337. }
  338. });
  339. });
  340. $("a[node-invoice='INFO']").click(function() {
  341. var postData = $(this).attr("data-isKey");
  342. var type =$(this).attr("data-type");
  343. var po='INVOICE';
  344. if(type=='receivables')
  345. po='RECEIVABLES';
  346. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  347. var url = "/ajaxGetInvoiceInfoByType";
  348. $.ajax({
  349. url : url,
  350. type : "post",
  351. cache : false,
  352. dataType : "json",
  353. data : {
  354. serial : postData,
  355. type:po
  356. },
  357. global : true,
  358. success : function(data) {
  359. if (data.status == 1) {
  360. $("div[loading-msg='true']").html("");
  361. if(type=='receivables')
  362. $("#nr").html(data.html);
  363. else
  364. $("#nc").html(data.html);
  365. } else
  366. $("div[loading-msg='true']").html("illegal request");
  367. },
  368. error : function(err) {
  369. $("div[loading-msg='true']").html("");
  370. }
  371. });
  372. });
  373. $("a[node-alter]").click(function() {
  374. var postData = $(this).attr("data-isKey");
  375. //$("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  376. var url = "/ajaxGetInvoiceReceivablesByStaff";
  377. $.ajax({
  378. url : url,
  379. type : "post",
  380. cache : false,
  381. dataType : "json",
  382. data : {
  383. postData : postData
  384. },
  385. global : true,
  386. success : function(data) {
  387. if (data.status == 1) {
  388. $("input[name='claimKey']").val(postData);
  389. $("select[html-category]").html(data.categoryHtml);
  390. $("select[html-staff]").html(data.staffHtml);
  391. } else
  392. $("div[loading-msg='categoryStaff']").html("illegal request");
  393. },
  394. error : function(err) {
  395. $("div[loading-msg='true']").html("");
  396. }
  397. });
  398. });
  399. $("a[node-irUpdate]").click(function() {
  400. var postData = $(this).attr("data-isKey");
  401. //$("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  402. var url = "/ajaxGetInvoiceReceivablesByStaff";
  403. $.ajax({
  404. url : url,
  405. type : "post",
  406. cache : false,
  407. dataType : "json",
  408. data : {
  409. postData : postData
  410. },
  411. global : true,
  412. success : function(data) {
  413. if (data.status == 1) {
  414. $("input[name='receivablesPrice']").val(data.detail.receivablesPrice);
  415. $("input[name='receivablesMessage']").val(data.detail.receivablesMessage);
  416. $("input[name='receivablesDate']").val(data.detail.receivablesDate);
  417. $("select[html-rbank]").html(data.rbankHtml);
  418. $("input[id='claimuKey']").val(postData);
  419. $("select[html-rcategory]").html(data.categoryHtml);
  420. $("select[html-rstaff]").html(data.staffHtml);
  421. } else
  422. $("div[loading-msg='categoryStaff']").html("illegal request");
  423. },
  424. error : function(err) {
  425. $("div[loading-msg='true']").html("");
  426. }
  427. });
  428. });
  429. $("a[node-post='upEm']").click(function() {
  430. var postData = $(this).attr("post-data");
  431. $("div[loading-msg='express-msg']").html("<img src='/global/img/loadIco.gif' />");
  432. var url = "/ajaxGetInvoicePostDetail";
  433. $.ajax({
  434. url : url,
  435. type : "post",
  436. cache : false,
  437. dataType : "json",
  438. data : {
  439. iidKey : postData
  440. },
  441. global : true,
  442. success : function(data) {
  443. if (data.status == 1) {
  444. $("input[name='iidKey']").val(postData);
  445. $("td[recipients-data='express-msgU']").html(data.invoiceDetail.recipients);
  446. $("td[recipientsPhone-data='express-msgU']").html(data.invoiceDetail.recipientsPhone);
  447. $("td[recipientsAddress-data='express-msgU']").html(data.invoiceDetail.recipientsAddress);
  448. $("td[mailItems-data='express-msgU']").html(data.invoiceDetail.mailItems);
  449. $("textarea[actualItems-data='express-msgU']").val(data.invoiceDetail.actualItems);
  450. $("select[name='express']").html(data.invoiceDetail.eaHtml);
  451. $("input[expressNumber-data='express-msgU']").val(data.invoiceDetail.expressNumber);
  452. $("div[loading-msg='express-msg']").html("");
  453. } else
  454. $("div[loading-msg='express-msg']").html("illegal request");
  455. },
  456. error : function(err) {
  457. }
  458. });
  459. });
  460. })