receipt.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. function check(){
  2. if (confirm("确认是否提交本次报销单,点击确定提交开始审批,点击取消关闭本窗口。"))
  3. return true;
  4. else return false;
  5. }
  6. function receiptYear(){
  7. var form = $('#up');
  8. $('#year').val($('#Y').val());
  9. form.submit();
  10. }
  11. function receiptDate(){
  12. var form = $('#up');
  13. //$('#year').val($('#date').val());
  14. form.submit();
  15. }
  16. function reportCatePM(){
  17. var name=$('#reportCate').val();
  18. $("option[node-all='true']").show();
  19. if(name=='ALL'){
  20. $("tr[node-all='true']").show();
  21. $("option[node-all='true']").show();
  22. }else{
  23. $("tr[node-all='true']").hide();
  24. $("option[node-all='true']").hide();
  25. $("option[node-cate='"+name+"']").show();
  26. $("tr[node-boxCate='"+name+"']").show();
  27. }
  28. }
  29. function reportPM(){
  30. var name=$('#report').val();
  31. if(name=='ALL')
  32. $("tr[node-all='true']").show();
  33. else{
  34. $("tr[node-all='true']").hide();
  35. $("tr[node-box='"+name+"']").show();
  36. }
  37. }
  38. function receiptMoth(){
  39. var form = $('#up');
  40. $('#year').val($('#Y').val());
  41. $('#month').val($('#M').val());
  42. //alert($('#M').val());
  43. form.submit();
  44. }
  45. function receiptDay(){
  46. var form = $('#up');
  47. $('#year').val($('#Y').val());
  48. $('#month').val($('#M').val());
  49. $('#day').val($('#D').val());
  50. form.submit();
  51. }
  52. function receiptSop(){
  53. var form = $('#up');
  54. $('#year').val($('#Y').val());
  55. $('#month').val($('#M').val());
  56. $('#day').val($('#D').val());
  57. $('#sop').val($('#S').val());
  58. form.submit();
  59. }
  60. function updateApprovalReceipt(status,rid){
  61. var form = $('#verifyOpinion_'+rid);
  62. $('#status_'+rid).val(status);
  63. $("input[name='amount']").val($('#amount').val());
  64. form.submit();
  65. }
  66. function setExeReceipt(tr,rid){
  67. var form = $('#implement'+tr);
  68. var amount=$('#amount'+tr).val();
  69. console.log(amount);
  70. if(amount=='')
  71. return alert('请填写汇款金额');
  72. $("#amountInp"+tr).val(amount);
  73. form.submit();
  74. }
  75. function expensesDefray(status,rid){
  76. var form = $('#verifyOpinion_'+rid);
  77. $('#status_'+rid).val(status);
  78. form.submit();
  79. }
  80. function showOpinion(receiptOrder){
  81. //console.log(receiptOrder);
  82. $('#orderBody').html('读取中');
  83. var url="/ajaxGetReceiptOrder";
  84. $.ajax({
  85. url:url,
  86. type: "post",
  87. cache: false,
  88. dataType: "json",
  89. data: {
  90. receiptOrder:receiptOrder
  91. },
  92. global: true,
  93. success: function(data){
  94. if(data.status==1)
  95. $('#orderBody').html(data.receiptHtml);
  96. else
  97. $('#orderBody').html('没找到信息');
  98. },
  99. error:function(err){
  100. }
  101. });
  102. }
  103. $(function() {
  104. $('button[node-qmk="tm"]').click(function(){
  105. var id=$(this).attr('data');
  106. $('#'+id).attr('value',$('#'+id).attr('data-tm'));
  107. });
  108. $('a[node-ReceiptBack="true"]').click(function(){
  109. var rid=$(this).attr("p-d");
  110. var opinion=$('#opinion_'+rid).val();
  111. var url="/approvalChe";
  112. $.ajax({
  113. url:url,
  114. type: "post",
  115. cache: false,
  116. dataType: "json",
  117. data: {
  118. rid:rid,
  119. opinion:opinion
  120. },
  121. global: true,
  122. success: function(data){
  123. if(data.status==2){
  124. alert('参数错误');
  125. }else{
  126. window.location.href="/approvalExpenses/pendApproval";
  127. }
  128. },
  129. error:function(err){
  130. }
  131. });
  132. });
  133. $("a[id^=examine]").click(function(){
  134. var rid=$(this).attr('data');
  135. var url="/ajaxExamine";
  136. $.ajax({
  137. url:url,
  138. type: "post",
  139. cache: false,
  140. dataType: "json",
  141. data: {
  142. rid:rid
  143. },
  144. global: true,
  145. success: function(data){
  146. if(data.status==0){
  147. alert('参数错误');
  148. }
  149. var count=data.receipt.length;
  150. if(count!=0){
  151. if(data.receipt.Rtype==1){
  152. window.location.href="/expensesEdi/"+data.receipt.rid;
  153. }else if(data.receipt.Rtype==0){
  154. window.location.href="/receiptburEdi/"+data.receipt.rid;
  155. }else if(data.receipt.Rtype==2){
  156. window.location.href="/remitApproval/"+data.receipt.rid;
  157. }
  158. }else
  159. alert('没有需要审批的费用');
  160. console.log(data);
  161. },
  162. error:function(err){
  163. }
  164. });
  165. });
  166. $("a[id^=examineExe]").click(function(){
  167. var rid=$(this).attr('data');
  168. var url="/ajaxExamineExe";
  169. $.ajax({
  170. url:url,
  171. type: "post",
  172. cache: false,
  173. dataType: "json",
  174. data: {
  175. rid:rid
  176. },
  177. global: true,
  178. success: function(data){
  179. if(data.status==0){
  180. alert('参数错误');
  181. }
  182. var count=data.receipt.length;
  183. if(count!=0){
  184. window.location.href="/implement/"+data.receipt.ridKey+".html";
  185. }else
  186. alert('没有需要审批的费用');
  187. console.log(data);
  188. },
  189. error:function(err){
  190. }
  191. });
  192. });
  193. $("input[id^='agency_']").change(function() {
  194. $i=0;
  195. $("input[id^='agency_']").each(function(i){
  196. $i+=parseFloat(this.value);
  197. });
  198. $("#agencyResult").html("¥"+$i.toFixed(2));
  199. $("#agencyR").val($i.toFixed(2));
  200. var travelR=parseFloat($("#travelR").val());
  201. var trainR=parseFloat($("#trainR").val());
  202. var otherR=parseFloat($("#otherR").val());
  203. var RS=parseFloat($i)+parseFloat(travelR)+parseFloat(trainR)+parseFloat(otherR);
  204. $("#RS").html("¥"+RS.toFixed(2));
  205. });
  206. $("input[id^='travel_']").change(function() {
  207. $i=0;
  208. $("input[id^='travel_']").each(function(i){
  209. $i+=parseFloat(this.value);
  210. });
  211. $("#travelResult").html("¥"+$i.toFixed(2));
  212. $("#travelR").val($i.toFixed(2));
  213. var agencyR=$("#agencyR").val();
  214. var trainR=parseFloat($("#trainR").val());
  215. var otherR=parseFloat($("#otherR").val());
  216. var RS=parseFloat($i)+parseFloat(agencyR)+trainR+otherR;
  217. $("#RS").html("¥"+RS.toFixed(2));
  218. });
  219. $("input[id^='train_']").change(function() {
  220. $i=0;
  221. $("input[id^='train_']").each(function(i){
  222. $i+=parseFloat(this.value);
  223. });
  224. $("#trainResult").html("¥"+$i.toFixed(2));
  225. $("#trainR").val($i.toFixed(2));
  226. var agencyR=$("#agencyR").val();
  227. var otherR=parseFloat($("#otherR").val());
  228. var travelR=parseFloat($("#travelR").val());
  229. var RS=parseFloat($i)+parseFloat(agencyR)+travelR+otherR;
  230. $("#RS").html("¥"+RS.toFixed(2));
  231. });
  232. $("input[id^='other_']").change(function() {
  233. $i=0;
  234. $("input[id^='other_']").each(function(i){
  235. $i+=parseFloat(this.value);
  236. });
  237. $("#otherResult").html("¥"+$i.toFixed(2));
  238. $("#otherR").val($i.toFixed(2));
  239. var agencyR=$("#agencyR").val();
  240. var travelR=parseFloat($("#travelR").val());
  241. var trainR=parseFloat($("#trainR").val());
  242. var RS=parseFloat($i)+parseFloat(agencyR)+parseFloat(travelR)+parseFloat(trainR);
  243. $("#RS").html("¥"+RS.toFixed(2));
  244. });
  245. $("input[id^='RG_']").click(function() {
  246. });
  247. $("a[id^='getStaffInfo']").click(function(){
  248. var username=$(this).attr('data');
  249. var url="/getStaffInfo";
  250. $.ajax({
  251. url:url,
  252. type: "post",
  253. cache: false,
  254. dataType: "json",
  255. data: {
  256. username:username
  257. },
  258. global: true,
  259. success: function(data){
  260. if(data.success){
  261. alert('请重新登录');
  262. }
  263. $('#staffInfo').html(data.html);
  264. $('#staffInfo').show();
  265. $('#longleLog').hide();
  266. $('#clientInfo').hide();
  267. $('#changeCompany').hide();
  268. },
  269. error:function(err){
  270. }
  271. });
  272. });
  273. $("a[id^='getClientInfo']").click(function(){
  274. var client=$(this).attr('data');
  275. var url="/getClientInfo";
  276. $.ajax({
  277. url:url,
  278. type: "post",
  279. cache: false,
  280. dataType: "json",
  281. data: {
  282. client:client
  283. },
  284. global: true,
  285. success: function(data){
  286. if(data.success){
  287. alert('请重新登录');
  288. }
  289. $('#clientInfo').html(data.html);
  290. $('#clientInfo').show();
  291. $('#staffInfo').hide();
  292. $('#longleLog').hide();
  293. $('#addClient').hide();
  294. $('#changeCompany').hide();
  295. autoFlashHeight();
  296. },
  297. error:function(err){
  298. autoFlashHeight();
  299. }
  300. });
  301. });
  302. $("a[id^='getCompanyInfo']").click(function(){
  303. alert('dd');
  304. });
  305. $("a[id^='getLongleLog_']").click(function() {
  306. var lid=$(this).attr('data');
  307. var url="/ajaxGetLongle";
  308. $.ajax({
  309. url:url,
  310. type: "post",
  311. cache: false,
  312. dataType: "json",
  313. data: {
  314. lid:lid
  315. },
  316. global: true,
  317. success: function(data){
  318. if(data.success==false){
  319. alert('请重新登录');
  320. }
  321. $("#klid").val(data.klid);
  322. $("#longleTitle").html(data.longle.key_num);
  323. var lka='<a href="javascript:void(0)" onclick="getStaffInfo(\''+data.longle.responsible+'\')" >'+data.longle.responsible+'</a>';
  324. $("#longleResponsible").html(lka);
  325. var kk="";
  326. if(data.longle.alloted_time!="")
  327. kk="期限:"+data.longle.alloted_time;
  328. $("#longleStatus").html(data.longle.statusT+"/"+data.longle.product+"/("+data.longle.version+")"+kk);
  329. $("#LongleLogHtml").html(data.longleLogHtml);
  330. if(data.longle.status>=3){
  331. $("#longleStatus_5").attr('disabled',false);
  332. $("#longleStatus_6").attr('disabled',false);
  333. $("#longleStatus_7").attr('disabled',false);
  334. $("#longleStatus_8").attr('disabled',false);
  335. }
  336. $('#staffInfo').hide();
  337. $("#longleLog").show();
  338. $('#clientInfo').hide();
  339. autoFlashHeight();
  340. },
  341. error:function(err){
  342. // easyDialog.open({
  343. // container : { content : '请输入正确的参数'},
  344. // autoClose : 1500,
  345. // overlay : false
  346. // });
  347. }
  348. });
  349. });
  350. $("a[node-invoice='INFO']").click(function() {
  351. var postData = $(this).attr("data-isKey");
  352. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  353. $("#nc").html('illegal request');
  354. var url = "/ajaxGetReceiptDetails";
  355. $.ajax({
  356. url : url,
  357. type : "post",
  358. cache : false,
  359. dataType : "json",
  360. data : {
  361. serial : postData
  362. },
  363. global : true,
  364. success : function(data) {
  365. if (data.status == 1) {
  366. //$("div[loading-msg='true']").html("");
  367. $("#nc").html(data.html);
  368. }
  369. },
  370. error : function(err) {
  371. $("div[loading-msg='true']").html("");
  372. }
  373. });
  374. });
  375. })
  376. function selectToolTipCl(name){
  377. var e = is_ie ? event : selectToolTipCl.caller.arguments[0];
  378. obj = is_ie ? e.srcElement : e.target;
  379. var arr = document.getElementsByName(name);
  380. var k = arr.length;
  381. for ( var i = 0; i < k; i++) {
  382. arr[i].checked = obj.checked;
  383. }
  384. $('#addToolTag').hide();
  385. }
  386. function selectTagCl(name){
  387. var e = is_ie ? event : selectTagCl.caller.arguments[0];
  388. obj = is_ie ? e.srcElement : e.target;
  389. var arr = document.getElementsByName(name);
  390. var k = arr.length;
  391. for ( var i = 0; i < k; i++) {
  392. arr[i].checked = obj.checked;
  393. }
  394. }
  395. function checkall(name) {
  396. var e = is_ie ? event : checkall.caller.arguments[0];
  397. obj = is_ie ? e.srcElement : e.target;
  398. var arr = document.getElementsByName(name);
  399. var k = arr.length;
  400. for ( var i = 0; i < k; i++) {
  401. arr[i].checked = obj.checked;
  402. }
  403. }
  404. if (is_ie)
  405. document.documentElement.addBehavior("#default#userdata");
  406. var userAgent = navigator.userAgent.toLowerCase();
  407. var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);