invoice.js 14 KB

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