receipt.js 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  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 receiptMoth(){
  12. var form = $('#up');
  13. $('#year').val($('#Y').val());
  14. $('#month').val($('#M').val());
  15. //alert($('#M').val());
  16. form.submit();
  17. }
  18. function receiptDay(){
  19. var form = $('#up');
  20. $('#year').val($('#Y').val());
  21. $('#month').val($('#M').val());
  22. $('#day').val($('#D').val());
  23. form.submit();
  24. }
  25. function receiptSop(){
  26. var form = $('#up');
  27. $('#year').val($('#Y').val());
  28. $('#month').val($('#M').val());
  29. $('#day').val($('#D').val());
  30. $('#sop').val($('#S').val());
  31. form.submit();
  32. }
  33. function updateApprovalReceipt(status,rid){
  34. var form = $('#verifyOpinion_'+rid);
  35. $('#status_'+rid).val(status);
  36. form.submit();
  37. }
  38. function expensesDefray(status,rid){
  39. var form = $('#verifyOpinion_'+rid);
  40. $('#status_'+rid).val(status);
  41. form.submit();
  42. }
  43. function showOpinion(receiptOrder){
  44. console.log(receiptOrder);
  45. $('#orderBody').html('读取中');
  46. var url="/ajaxGetReceiptOrder";
  47. $.ajax({
  48. url:url,
  49. type: "post",
  50. cache: false,
  51. dataType: "json",
  52. data: {
  53. receiptOrder:receiptOrder
  54. },
  55. global: true,
  56. success: function(data){
  57. if(data.status==1)
  58. $('#orderBody').html(data.receiptHtml);
  59. else
  60. $('#orderBody').html('没找到信息');
  61. },
  62. error:function(err){
  63. }
  64. });
  65. }
  66. $(function() {
  67. $('a[node-ReceiptBack="true"]').click(function(){
  68. var rid=$(this).attr("p-d");
  69. var opinion=$('#opinion_'+rid).val();
  70. var url="/approvalChe";
  71. $.ajax({
  72. url:url,
  73. type: "post",
  74. cache: false,
  75. dataType: "json",
  76. data: {
  77. rid:rid,
  78. opinion:opinion
  79. },
  80. global: true,
  81. success: function(data){
  82. if(data.status==2){
  83. alert('参数错误');
  84. }else{
  85. window.location.href="/approvalExpenses";
  86. }
  87. },
  88. error:function(err){
  89. }
  90. });
  91. });
  92. $("a[id^=examine]").click(function(){
  93. var rid=$(this).attr('data');
  94. var url="/ajaxExamine";
  95. $.ajax({
  96. url:url,
  97. type: "post",
  98. cache: false,
  99. dataType: "json",
  100. data: {
  101. rid:rid
  102. },
  103. global: true,
  104. success: function(data){
  105. if(data.status==0){
  106. alert('参数错误');
  107. }
  108. var count=data.receipt.length;
  109. if(count!=0){
  110. if(data.receipt.Rtype==1){
  111. window.location.href="/expensesEdi/"+data.receipt.rid;
  112. }else if(data.receipt.Rtype==0){
  113. window.location.href="/receiptburEdi/"+data.receipt.rid;
  114. }else if(data.receipt.Rtype==2){
  115. window.location.href="/remitApproval/"+data.receipt.rid;
  116. }
  117. }else
  118. alert('没有需要审批的费用');
  119. console.log(data);
  120. },
  121. error:function(err){
  122. }
  123. });
  124. });
  125. $("input[id^='agency_']").change(function() {
  126. $i=0;
  127. $("input[id^='agency_']").each(function(i){
  128. $i+=parseFloat(this.value);
  129. });
  130. $("#agencyResult").html("¥"+$i.toFixed(2));
  131. $("#agencyR").val($i.toFixed(2));
  132. var travelR=parseFloat($("#travelR").val());
  133. var trainR=parseFloat($("#trainR").val());
  134. var otherR=parseFloat($("#otherR").val());
  135. var RS=parseFloat($i)+parseFloat(travelR)+parseFloat(trainR)+parseFloat(otherR);
  136. $("#RS").html("¥"+RS.toFixed(2));
  137. });
  138. $("input[id^='travel_']").change(function() {
  139. $i=0;
  140. $("input[id^='travel_']").each(function(i){
  141. $i+=parseFloat(this.value);
  142. });
  143. $("#travelResult").html("¥"+$i.toFixed(2));
  144. $("#travelR").val($i.toFixed(2));
  145. var agencyR=$("#agencyR").val();
  146. var trainR=parseFloat($("#trainR").val());
  147. var otherR=parseFloat($("#otherR").val());
  148. var RS=parseFloat($i)+parseFloat(agencyR)+trainR+otherR;
  149. $("#RS").html("¥"+RS.toFixed(2));
  150. });
  151. $("input[id^='train_']").change(function() {
  152. $i=0;
  153. $("input[id^='train_']").each(function(i){
  154. $i+=parseFloat(this.value);
  155. });
  156. $("#trainResult").html("¥"+$i.toFixed(2));
  157. $("#trainR").val($i.toFixed(2));
  158. var agencyR=$("#agencyR").val();
  159. var otherR=parseFloat($("#otherR").val());
  160. var travelR=parseFloat($("#travelR").val());
  161. var RS=parseFloat($i)+parseFloat(agencyR)+travelR+otherR;
  162. $("#RS").html("¥"+RS.toFixed(2));
  163. });
  164. $("input[id^='other_']").change(function() {
  165. $i=0;
  166. $("input[id^='other_']").each(function(i){
  167. $i+=parseFloat(this.value);
  168. });
  169. $("#otherResult").html("¥"+$i.toFixed(2));
  170. $("#otherR").val($i.toFixed(2));
  171. var agencyR=$("#agencyR").val();
  172. var travelR=parseFloat($("#travelR").val());
  173. var trainR=parseFloat($("#trainR").val());
  174. var RS=parseFloat($i)+parseFloat(agencyR)+parseFloat(travelR)+parseFloat(trainR);
  175. $("#RS").html("¥"+RS.toFixed(2));
  176. });
  177. $("input[id^='RG_']").click(function() {
  178. });
  179. $("a[id^='getStaffInfo']").click(function(){
  180. var username=$(this).attr('data');
  181. var url="/getStaffInfo";
  182. $.ajax({
  183. url:url,
  184. type: "post",
  185. cache: false,
  186. dataType: "json",
  187. data: {
  188. username:username
  189. },
  190. global: true,
  191. success: function(data){
  192. if(data.success){
  193. alert('请重新登录');
  194. }
  195. $('#staffInfo').html(data.html);
  196. $('#staffInfo').show();
  197. $('#longleLog').hide();
  198. $('#clientInfo').hide();
  199. $('#changeCompany').hide();
  200. },
  201. error:function(err){
  202. }
  203. });
  204. });
  205. $("a[id^='getClientInfo']").click(function(){
  206. var client=$(this).attr('data');
  207. var url="/getClientInfo";
  208. $.ajax({
  209. url:url,
  210. type: "post",
  211. cache: false,
  212. dataType: "json",
  213. data: {
  214. client:client
  215. },
  216. global: true,
  217. success: function(data){
  218. if(data.success){
  219. alert('请重新登录');
  220. }
  221. $('#clientInfo').html(data.html);
  222. $('#clientInfo').show();
  223. $('#staffInfo').hide();
  224. $('#longleLog').hide();
  225. $('#addClient').hide();
  226. $('#changeCompany').hide();
  227. autoFlashHeight();
  228. },
  229. error:function(err){
  230. autoFlashHeight();
  231. }
  232. });
  233. });
  234. $("a[id^='getCompanyInfo']").click(function(){
  235. alert('dd');
  236. });
  237. $("a[id^='getLongleLog_']").click(function() {
  238. var lid=$(this).attr('data');
  239. var url="/ajaxGetLongle";
  240. $.ajax({
  241. url:url,
  242. type: "post",
  243. cache: false,
  244. dataType: "json",
  245. data: {
  246. lid:lid
  247. },
  248. global: true,
  249. success: function(data){
  250. if(data.success==false){
  251. alert('请重新登录');
  252. }
  253. $("#klid").val(data.klid);
  254. $("#longleTitle").html(data.longle.key_num);
  255. var lka='<a href="javascript:void(0)" onclick="getStaffInfo(\''+data.longle.responsible+'\')" >'+data.longle.responsible+'</a>';
  256. $("#longleResponsible").html(lka);
  257. var kk="";
  258. if(data.longle.alloted_time!="")
  259. kk="期限:"+data.longle.alloted_time;
  260. $("#longleStatus").html(data.longle.statusT+"/"+data.longle.product+"/("+data.longle.version+")"+kk);
  261. $("#LongleLogHtml").html(data.longleLogHtml);
  262. if(data.longle.status>=3){
  263. $("#longleStatus_5").attr('disabled',false);
  264. $("#longleStatus_6").attr('disabled',false);
  265. $("#longleStatus_7").attr('disabled',false);
  266. $("#longleStatus_8").attr('disabled',false);
  267. }
  268. $('#staffInfo').hide();
  269. $("#longleLog").show();
  270. $('#clientInfo').hide();
  271. autoFlashHeight();
  272. },
  273. error:function(err){
  274. // easyDialog.open({
  275. // container : { content : '请输入正确的参数'},
  276. // autoClose : 1500,
  277. // overlay : false
  278. // });
  279. }
  280. });
  281. });
  282. })
  283. function selectToolTipCl(name){
  284. var e = is_ie ? event : selectToolTipCl.caller.arguments[0];
  285. obj = is_ie ? e.srcElement : e.target;
  286. var arr = document.getElementsByName(name);
  287. var k = arr.length;
  288. for ( var i = 0; i < k; i++) {
  289. arr[i].checked = obj.checked;
  290. }
  291. $('#addToolTag').hide();
  292. }
  293. function selectTagCl(name){
  294. var e = is_ie ? event : selectTagCl.caller.arguments[0];
  295. obj = is_ie ? e.srcElement : e.target;
  296. var arr = document.getElementsByName(name);
  297. var k = arr.length;
  298. for ( var i = 0; i < k; i++) {
  299. arr[i].checked = obj.checked;
  300. }
  301. }
  302. function checkall(name) {
  303. var e = is_ie ? event : checkall.caller.arguments[0];
  304. obj = is_ie ? e.srcElement : e.target;
  305. var arr = document.getElementsByName(name);
  306. var k = arr.length;
  307. for ( var i = 0; i < k; i++) {
  308. arr[i].checked = obj.checked;
  309. }
  310. }
  311. if (is_ie)
  312. document.documentElement.addBehavior("#default#userdata");
  313. var userAgent = navigator.userAgent.toLowerCase();
  314. var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);