function check(){ if (confirm("确认是否提交本次报销单,点击确定提交开始审批,点击取消关闭本窗口。")) return true; else return false; } function receiptYear(){ var form = $('#up'); $('#year').val($('#Y').val()); form.submit(); } function receiptDate(){ var form = $('#up'); //$('#year').val($('#date').val()); form.submit(); } function reportCatePM(){ var name=$('#reportCate').val(); $("option[node-all='true']").show(); if(name=='ALL'){ $("tr[node-all='true']").show(); $("option[node-all='true']").show(); }else{ $("tr[node-all='true']").hide(); $("option[node-all='true']").hide(); $("option[node-cate='"+name+"']").show(); $("tr[node-boxCate='"+name+"']").show(); } } function reportPM(){ var name=$('#report').val(); if(name=='ALL') $("tr[node-all='true']").show(); else{ $("tr[node-all='true']").hide(); $("tr[node-box='"+name+"']").show(); } } function receiptMoth(){ var form = $('#up'); $('#year').val($('#Y').val()); $('#month').val($('#M').val()); //alert($('#M').val()); form.submit(); } function receiptDay(){ var form = $('#up'); $('#year').val($('#Y').val()); $('#month').val($('#M').val()); $('#day').val($('#D').val()); form.submit(); } function receiptSop(){ var form = $('#up'); $('#year').val($('#Y').val()); $('#month').val($('#M').val()); $('#day').val($('#D').val()); $('#sop').val($('#S').val()); form.submit(); } function updateApprovalReceipt(status,rid){ var form = $('#verifyOpinion_'+rid); $('#status_'+rid).val(status); $("input[name='amount']").val($('#amount').val()); form.submit(); } function setExeReceipt(tr,rid){ var form = $('#implement'+tr); var amount=$('#amount'+tr).val(); console.log(amount); if(amount=='') return alert('请填写汇款金额'); $("#amountInp"+tr).val(amount); form.submit(); } function expensesDefray(status,rid){ var form = $('#verifyOpinion_'+rid); $('#status_'+rid).val(status); form.submit(); } function showOpinion(receiptOrder){ //console.log(receiptOrder); $('#orderBody').html('读取中'); var url="/ajaxGetReceiptOrder"; $.ajax({ url:url, type: "post", cache: false, dataType: "json", data: { receiptOrder:receiptOrder }, global: true, success: function(data){ if(data.status==1) $('#orderBody').html(data.receiptHtml); else $('#orderBody').html('没找到信息'); }, error:function(err){ } }); } $(function() { $('button[node-qmk="tm"]').click(function(){ var id=$(this).attr('data'); $('#'+id).attr('value',$('#'+id).attr('data-tm')); }); $('a[node-ReceiptBack="true"]').click(function(){ var rid=$(this).attr("p-d"); var opinion=$('#opinion_'+rid).val(); var url="/approvalChe"; $.ajax({ url:url, type: "post", cache: false, dataType: "json", data: { rid:rid, opinion:opinion }, global: true, success: function(data){ if(data.status==2){ alert('参数错误'); }else{ window.location.href="/approvalExpenses/pendApproval"; } }, error:function(err){ } }); }); $("a[id^=examine]").click(function(){ var rid=$(this).attr('data'); var url="/ajaxExamine"; $.ajax({ url:url, type: "post", cache: false, dataType: "json", data: { rid:rid }, global: true, success: function(data){ if(data.status==0){ alert('参数错误'); } var count=data.receipt.length; if(count!=0){ if(data.receipt.Rtype==1){ window.location.href="/expensesEdi/"+data.receipt.rid; }else if(data.receipt.Rtype==0){ window.location.href="/receiptburEdi/"+data.receipt.rid; }else if(data.receipt.Rtype==2){ window.location.href="/remitApproval/"+data.receipt.rid; } }else alert('没有需要审批的费用'); }, error:function(err){ } }); }); $("a[id^=examineExe]").click(function(){ var rid=$(this).attr('data'); var url="/ajaxExamineExe"; $.ajax({ url:url, type: "post", cache: false, dataType: "json", data: { rid:rid }, global: true, success: function(data){ if(data.status==0){ alert('参数错误'); } var count=data.receipt.length; if(count!=0){ window.location.href="/implement/"+data.receipt.ridKey+".html"; }else alert('没有需要审批的费用'); console.log(data); }, error:function(err){ } }); }); $("input[id^='agency_']").change(function() { $i=0; $("input[id^='agency_']").each(function(i){ $i+=parseFloat(this.value); }); $("#agencyResult").html("¥"+$i.toFixed(2)); $("#agencyR").val($i.toFixed(2)); var travelR=parseFloat($("#travelR").val()); var trainR=parseFloat($("#trainR").val()); var otherR=parseFloat($("#otherR").val()); var RS=parseFloat($i)+parseFloat(travelR)+parseFloat(trainR)+parseFloat(otherR); $("#RS").html("¥"+RS.toFixed(2)); }); $("input[id^='travel_']").change(function() { $i=0; $("input[id^='travel_']").each(function(i){ $i+=parseFloat(this.value); }); $("#travelResult").html("¥"+$i.toFixed(2)); $("#travelR").val($i.toFixed(2)); var agencyR=$("#agencyR").val(); var trainR=parseFloat($("#trainR").val()); var otherR=parseFloat($("#otherR").val()); var RS=parseFloat($i)+parseFloat(agencyR)+trainR+otherR; $("#RS").html("¥"+RS.toFixed(2)); }); $("input[id^='train_']").change(function() { $i=0; $("input[id^='train_']").each(function(i){ $i+=parseFloat(this.value); }); $("#trainResult").html("¥"+$i.toFixed(2)); $("#trainR").val($i.toFixed(2)); var agencyR=$("#agencyR").val(); var otherR=parseFloat($("#otherR").val()); var travelR=parseFloat($("#travelR").val()); var RS=parseFloat($i)+parseFloat(agencyR)+travelR+otherR; $("#RS").html("¥"+RS.toFixed(2)); }); $("input[id^='other_']").change(function() { $i=0; $("input[id^='other_']").each(function(i){ $i+=parseFloat(this.value); }); $("#otherResult").html("¥"+$i.toFixed(2)); $("#otherR").val($i.toFixed(2)); var agencyR=$("#agencyR").val(); var travelR=parseFloat($("#travelR").val()); var trainR=parseFloat($("#trainR").val()); var RS=parseFloat($i)+parseFloat(agencyR)+parseFloat(travelR)+parseFloat(trainR); $("#RS").html("¥"+RS.toFixed(2)); }); $("a[id^='getStaffInfo']").click(function(){ var username=$(this).attr('data'); var url="/getStaffInfo"; $.ajax({ url:url, type: "post", cache: false, dataType: "json", data: { username:username }, global: true, success: function(data){ if(data.success){ alert('请重新登录'); } $('#staffInfo').html(data.html); $('#staffInfo').show(); $('#longleLog').hide(); $('#clientInfo').hide(); $('#changeCompany').hide(); }, error:function(err){ } }); }); $("a[id^='getClientInfo']").click(function(){ var client=$(this).attr('data'); var url="/getClientInfo"; $.ajax({ url:url, type: "post", cache: false, dataType: "json", data: { client:client }, global: true, success: function(data){ if(data.success){ alert('请重新登录'); } $('#clientInfo').html(data.html); $('#clientInfo').show(); $('#staffInfo').hide(); $('#longleLog').hide(); $('#addClient').hide(); $('#changeCompany').hide(); autoFlashHeight(); }, error:function(err){ autoFlashHeight(); } }); }); $("a[id^='getCompanyInfo']").click(function(){ alert('dd'); }); $("a[id^='getLongleLog_']").click(function() { var lid=$(this).attr('data'); var url="/ajaxGetLongle"; $.ajax({ url:url, type: "post", cache: false, dataType: "json", data: { lid:lid }, global: true, success: function(data){ if(data.success==false){ alert('请重新登录'); } $("#klid").val(data.klid); $("#longleTitle").html(data.longle.key_num); var lka=''+data.longle.responsible+''; $("#longleResponsible").html(lka); var kk=""; if(data.longle.alloted_time!="") kk="期限:"+data.longle.alloted_time; $("#longleStatus").html(data.longle.statusT+"/"+data.longle.product+"/("+data.longle.version+")"+kk); $("#LongleLogHtml").html(data.longleLogHtml); if(data.longle.status>=3){ $("#longleStatus_5").attr('disabled',false); $("#longleStatus_6").attr('disabled',false); $("#longleStatus_7").attr('disabled',false); $("#longleStatus_8").attr('disabled',false); } $('#staffInfo').hide(); $("#longleLog").show(); $('#clientInfo').hide(); autoFlashHeight(); }, error:function(err){ // easyDialog.open({ // container : { content : '请输入正确的参数'}, // autoClose : 1500, // overlay : false // }); } }); }); $("a[node-invoice='INFO']").click(function() { var postData = $(this).attr("data-isKey"); $("div[loading-msg='true']").html(""); $("#nc").html('illegal request'); var url = "/ajaxGetReceiptDetails"; $.ajax({ url : url, type : "post", cache : false, dataType : "json", data : { serial : postData }, global : true, success : function(data) { if (data.status == 1) { //$("div[loading-msg='true']").html(""); $("#nc").html(data.html); } }, error : function(err) { $("div[loading-msg='true']").html(""); } }); }); $("form[name='recepitAdd']").validator({ timely: 3, focusCleanup: true, theme:"yellow_top", rules: { remittanceBankType: function() { var rbt=$('select[node-rbt]').val(); if(rbt==0) return false; return true; } }, fields: { 'verify': 'required; ', 'explanation':'required; ', 'remittanceName':'required; ', 'bankName':'required; ', 'bankNumber':'required; ', 'coupletNumber':'required(remittanceBankType); ' } }); $("select[node-rbt]").change(function(){ var rbt=$(this).val(); if(rbt==0){ $("tr[node-cn]").hide(); }else if(rbt==1){ $("tr[node-cn]").show(); } }); }) function selectToolTipCl(name){ var e = is_ie ? event : selectToolTipCl.caller.arguments[0]; obj = is_ie ? e.srcElement : e.target; var arr = document.getElementsByName(name); var k = arr.length; for ( var i = 0; i < k; i++) { arr[i].checked = obj.checked; } $('#addToolTag').hide(); } function selectTagCl(name){ var e = is_ie ? event : selectTagCl.caller.arguments[0]; obj = is_ie ? e.srcElement : e.target; var arr = document.getElementsByName(name); var k = arr.length; for ( var i = 0; i < k; i++) { arr[i].checked = obj.checked; } } function checkall(name) { var e = is_ie ? event : checkall.caller.arguments[0]; obj = is_ie ? e.srcElement : e.target; var arr = document.getElementsByName(name); var k = arr.length; for ( var i = 0; i < k; i++) { arr[i].checked = obj.checked; } } if (is_ie) document.documentElement.addBehavior("#default#userdata"); var userAgent = navigator.userAgent.toLowerCase(); var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);