receipt.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  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. },
  161. error:function(err){
  162. }
  163. });
  164. });
  165. $("a[id^=examineExe]").click(function(){
  166. var rid=$(this).attr('data');
  167. var url="/ajaxExamineExe";
  168. $.ajax({
  169. url:url,
  170. type: "post",
  171. cache: false,
  172. dataType: "json",
  173. data: {
  174. rid:rid
  175. },
  176. global: true,
  177. success: function(data){
  178. if(data.status==0){
  179. alert('参数错误');
  180. }
  181. var count=data.receipt.length;
  182. if(count!=0){
  183. window.location.href="/implement/"+data.receipt.ridKey+".html";
  184. }else
  185. alert('没有需要审批的费用');
  186. console.log(data);
  187. },
  188. error:function(err){
  189. }
  190. });
  191. });
  192. $("input[id^='agency_']").change(function() {
  193. $i=0;
  194. $("input[id^='agency_']").each(function(i){
  195. $i+=parseFloat(this.value);
  196. });
  197. $("#agencyResult").html("¥"+$i.toFixed(2));
  198. $("#agencyR").val($i.toFixed(2));
  199. var travelR=parseFloat($("#travelR").val());
  200. var trainR=parseFloat($("#trainR").val());
  201. var otherR=parseFloat($("#otherR").val());
  202. var RS=parseFloat($i)+parseFloat(travelR)+parseFloat(trainR)+parseFloat(otherR);
  203. $("#RS").html("¥"+RS.toFixed(2));
  204. });
  205. $("input[id^='travel_']").change(function() {
  206. $i=0;
  207. $("input[id^='travel_']").each(function(i){
  208. $i+=parseFloat(this.value);
  209. });
  210. $("#travelResult").html("¥"+$i.toFixed(2));
  211. $("#travelR").val($i.toFixed(2));
  212. var agencyR=$("#agencyR").val();
  213. var trainR=parseFloat($("#trainR").val());
  214. var otherR=parseFloat($("#otherR").val());
  215. var RS=parseFloat($i)+parseFloat(agencyR)+trainR+otherR;
  216. $("#RS").html("¥"+RS.toFixed(2));
  217. });
  218. $("input[id^='train_']").change(function() {
  219. $i=0;
  220. $("input[id^='train_']").each(function(i){
  221. $i+=parseFloat(this.value);
  222. });
  223. $("#trainResult").html("¥"+$i.toFixed(2));
  224. $("#trainR").val($i.toFixed(2));
  225. var agencyR=$("#agencyR").val();
  226. var otherR=parseFloat($("#otherR").val());
  227. var travelR=parseFloat($("#travelR").val());
  228. var RS=parseFloat($i)+parseFloat(agencyR)+travelR+otherR;
  229. $("#RS").html("¥"+RS.toFixed(2));
  230. });
  231. $("input[id^='other_']").change(function() {
  232. $i=0;
  233. $("input[id^='other_']").each(function(i){
  234. $i+=parseFloat(this.value);
  235. });
  236. $("#otherResult").html("¥"+$i.toFixed(2));
  237. $("#otherR").val($i.toFixed(2));
  238. var agencyR=$("#agencyR").val();
  239. var travelR=parseFloat($("#travelR").val());
  240. var trainR=parseFloat($("#trainR").val());
  241. var RS=parseFloat($i)+parseFloat(agencyR)+parseFloat(travelR)+parseFloat(trainR);
  242. $("#RS").html("¥"+RS.toFixed(2));
  243. });
  244. $("a[id^='getStaffInfo']").click(function(){
  245. var username=$(this).attr('data');
  246. var url="/getStaffInfo";
  247. $.ajax({
  248. url:url,
  249. type: "post",
  250. cache: false,
  251. dataType: "json",
  252. data: {
  253. username:username
  254. },
  255. global: true,
  256. success: function(data){
  257. if(data.success){
  258. alert('请重新登录');
  259. }
  260. $('#staffInfo').html(data.html);
  261. $('#staffInfo').show();
  262. $('#longleLog').hide();
  263. $('#clientInfo').hide();
  264. $('#changeCompany').hide();
  265. },
  266. error:function(err){
  267. }
  268. });
  269. });
  270. $("a[id^='getClientInfo']").click(function(){
  271. var client=$(this).attr('data');
  272. var url="/getClientInfo";
  273. $.ajax({
  274. url:url,
  275. type: "post",
  276. cache: false,
  277. dataType: "json",
  278. data: {
  279. client:client
  280. },
  281. global: true,
  282. success: function(data){
  283. if(data.success){
  284. alert('请重新登录');
  285. }
  286. $('#clientInfo').html(data.html);
  287. $('#clientInfo').show();
  288. $('#staffInfo').hide();
  289. $('#longleLog').hide();
  290. $('#addClient').hide();
  291. $('#changeCompany').hide();
  292. autoFlashHeight();
  293. },
  294. error:function(err){
  295. autoFlashHeight();
  296. }
  297. });
  298. });
  299. $("a[id^='getCompanyInfo']").click(function(){
  300. alert('dd');
  301. });
  302. $("a[id^='getLongleLog_']").click(function() {
  303. var lid=$(this).attr('data');
  304. var url="/ajaxGetLongle";
  305. $.ajax({
  306. url:url,
  307. type: "post",
  308. cache: false,
  309. dataType: "json",
  310. data: {
  311. lid:lid
  312. },
  313. global: true,
  314. success: function(data){
  315. if(data.success==false){
  316. alert('请重新登录');
  317. }
  318. $("#klid").val(data.klid);
  319. $("#longleTitle").html(data.longle.key_num);
  320. var lka='<a href="javascript:void(0)" onclick="getStaffInfo(\''+data.longle.responsible+'\')" >'+data.longle.responsible+'</a>';
  321. $("#longleResponsible").html(lka);
  322. var kk="";
  323. if(data.longle.alloted_time!="")
  324. kk="期限:"+data.longle.alloted_time;
  325. $("#longleStatus").html(data.longle.statusT+"/"+data.longle.product+"/("+data.longle.version+")"+kk);
  326. $("#LongleLogHtml").html(data.longleLogHtml);
  327. if(data.longle.status>=3){
  328. $("#longleStatus_5").attr('disabled',false);
  329. $("#longleStatus_6").attr('disabled',false);
  330. $("#longleStatus_7").attr('disabled',false);
  331. $("#longleStatus_8").attr('disabled',false);
  332. }
  333. $('#staffInfo').hide();
  334. $("#longleLog").show();
  335. $('#clientInfo').hide();
  336. autoFlashHeight();
  337. },
  338. error:function(err){
  339. // easyDialog.open({
  340. // container : { content : '请输入正确的参数'},
  341. // autoClose : 1500,
  342. // overlay : false
  343. // });
  344. }
  345. });
  346. });
  347. $("a[node-invoice='INFO']").click(function() {
  348. var postData = $(this).attr("data-isKey");
  349. $("div[loading-msg='true']").html("<img src='/global/img/loadIco.gif' />");
  350. $("#nc").html('illegal request');
  351. var url = "/ajaxGetReceiptDetails";
  352. $.ajax({
  353. url : url,
  354. type : "post",
  355. cache : false,
  356. dataType : "json",
  357. data : {
  358. serial : postData
  359. },
  360. global : true,
  361. success : function(data) {
  362. if (data.status == 1) {
  363. //$("div[loading-msg='true']").html("");
  364. $("#nc").html(data.html);
  365. }
  366. },
  367. error : function(err) {
  368. $("div[loading-msg='true']").html("");
  369. }
  370. });
  371. });
  372. $("form[name='recepitAdd']").validator({
  373. timely: 3,
  374. focusCleanup: true,
  375. theme:"yellow_top",
  376. fields: {
  377. 'verify': 'required; ',
  378. 'explanation':'required; '
  379. }
  380. });
  381. })
  382. function selectToolTipCl(name){
  383. var e = is_ie ? event : selectToolTipCl.caller.arguments[0];
  384. obj = is_ie ? e.srcElement : e.target;
  385. var arr = document.getElementsByName(name);
  386. var k = arr.length;
  387. for ( var i = 0; i < k; i++) {
  388. arr[i].checked = obj.checked;
  389. }
  390. $('#addToolTag').hide();
  391. }
  392. function selectTagCl(name){
  393. var e = is_ie ? event : selectTagCl.caller.arguments[0];
  394. obj = is_ie ? e.srcElement : e.target;
  395. var arr = document.getElementsByName(name);
  396. var k = arr.length;
  397. for ( var i = 0; i < k; i++) {
  398. arr[i].checked = obj.checked;
  399. }
  400. }
  401. function checkall(name) {
  402. var e = is_ie ? event : checkall.caller.arguments[0];
  403. obj = is_ie ? e.srcElement : e.target;
  404. var arr = document.getElementsByName(name);
  405. var k = arr.length;
  406. for ( var i = 0; i < k; i++) {
  407. arr[i].checked = obj.checked;
  408. }
  409. }
  410. if (is_ie)
  411. document.documentElement.addBehavior("#default#userdata");
  412. var userAgent = navigator.userAgent.toLowerCase();
  413. var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);