function searchByKey() { } function add_choice(from_select_id,to_select_id) { //alert(formName); //alert($(document.getElementById(formName).from_select).attr("id")); //var fromid = $(from_select).attr("id"); //var toid = $(to_select).attr("id"); //!$('#'+from_select_id+' option:selected').remove().appendTo('#'+to_select_id); //var flag = 0; var obj = $('#'+from_select_id+' option:selected').text(); //var str; //alert($("#"+to_select_id+" option[text='"+obj+"']").length); if(!$('#'+to_select_id+' option').filter( function(){ return $(this).html() == obj; }).val()){ !$('#'+from_select_id+' option:selected').clone().appendTo('#'+to_select_id); } //!$('#'+from_select_id+' option:selected').clone().appendTo('#'+to_select_id); } function add_to_choice(from_select_id,to_select_id) { //alert(formName); //alert($(document.getElementById(formName).from_select).attr("id")); //var fromid = $(from_select).attr("id"); //var toid = $(to_select).attr("id"); !$('#'+from_select_id+' option:selected').appendTo('#'+to_select_id); //!$('#'+from_select_id+' option:selected').clone().appendTo('#'+to_select_id); } function addAll(from_select_id,to_select_id) { //alert(formName); //alert($(document.getElementById(formName).from_select).attr("id")); //var fromid = $(from_select).attr("id"); //var toid = $(to_select).attr("id"); //!$('#'+from_select_id+' option:selected').remove().appendTo('#'+to_select_id); //!$('#'+from_select_id+' option').clone().appendTo('#'+to_select_id); var foo; $('#'+from_select_id+' option').each(function(){ foo = $(this).text(); var flag = true; $('#'+to_select_id+' option').each(function(){ if($(this).text() == foo){ flag = false; return false; } }); if(flag){ !$(this).clone().appendTo('#'+to_select_id); } }); } function remove_choice(from_select_id,to_select_id) { //var fromid = $(from_select).attr("id"); //var toid = $(to_select).attr("id"); //!$('#'+to_select_id+' option:selected').remove().appendTo('#'+from_select_id); !$('#'+to_select_id+' option:selected').remove(); } function remove_to_choice(from_select_id,to_select_id) { //var fromid = $(from_select).attr("id"); //var toid = $(to_select).attr("id"); //!$('#'+to_select_id+' option:selected').appendTo('#'+from_select_id); //!$('#'+to_select_id+' option:selected').remove(); //統計欄位 if(to_select_id.indexOf("SFIELD")>=0){ $('#'+to_select_id+' option:selected').appendTo('#'+from_select_id); } //顯示欄位 else{ $('#'+to_select_id+' option:selected').each(function(){ if("M"==$(this).attr("tableType")){ $(this).appendTo('#'+from_select_id+'_M'); } else{ $(this).appendTo('#'+from_select_id+'_D'); } }); $('#'+from_select_id+'_M option, #'+from_select_id+'_D option').prop("selected", false); var allIsM=true; $('#'+to_select_id+' option').each(function(){ if("D"==$(this).attr("tableType")){ allIsM=false; } }); if(allIsM==false){ $('input[name="MUST_'+to_select_id+'_D"]').prop("checked", true).attr("disabled", true); } else{ if($('input[name="searchInfo.OrderType"]:checked').val()=="date"){ if($('#MUST_'+to_select_id+'_D_CHECKED').val()=="Y"){ $('input[name="MUST_'+to_select_id+'_D"]').attr("disabled", false); } else{ $('input[name="MUST_'+to_select_id+'_D"]').prop("checked", false).attr("disabled", false); } } } } } function removeAll(from_select_id,to_select_id) { //var fromid = $(from_select).attr("id"); //var toid = $(to_select).attr("id"); !$('#'+to_select_id+' option').remove(); //!$('#'+to_select_id+' option:selected').remove(); } function move_choice(move_type,select_id) { var selectedObj = $('#'+select_id+' option:selected'); if(selectedObj.length && move_type=="UP"){ selectedObj.first().prev().before(selectedObj); } else if(selectedObj.length && move_type=="DOWN"){ selectedObj.last().next().after(selectedObj); } } //把選擇的國家代碼回傳 function choiceNationCheck(to_select) { var toid = to_select; var codeGroup = ''; var codeGroupArray = new Array(); $('#'+toid+' option').each(function(){ codeGroupArray.push($(this).val()); }); codeGroup = codeGroupArray; //var codeGroup = $('#'+toid).val(); $('#nationalCodeValue').val(codeGroup); $('#nationalCodeSearch_dialog').dialog('close'); } //把選擇的國家代碼回傳 function choiceNationCheckReturn(to_select,returnId) { if(returnId == ''){ returnId = 'nationalCodeValue'; } var toid = to_select; $('#'+toid).children().each(function(){ $(this).val($.trim($(this).text().replace(/\([a-zA-Z]{2}\)/,""))); }); var codeGroup = ''; var codeGroupArray = new Array(); $('#'+toid+' option').each(function(){ codeGroupArray.push($(this).val()); }); codeGroup = codeGroupArray; //var codeGroup = $('#'+toid).val(); $('#'+returnId).val(codeGroup); $('#nationalCodeSearch_dialog').dialog('close'); } //把選擇的貨品別分類代碼回傳 function choiceGoodsCheck(to_select_id,typeCode) { //var toid = to_select; $('#'+to_select_id).children().each(function(){ $(this).val($.trim($(this).val())); }); var codeGroup = $('#'+to_select_id).val(); $('#goodsCodeValue').val(codeGroup); $("#goodsCodeType").children().each(function(){ if ($(this).val()==typeCode){ $(this).attr("selected","true"); } }); $('#goodsSearch_dialog').dialog('close'); } //把選擇的簽審代碼回傳 function choiceRegCodeCheckReturn(to_select) { var toid = to_select; $('#'+toid).children().each(function(){ $(this).val($.trim($(this).val().replace(/\(.*\)/,""))); }); var codeGroup = ''; var codeGroupArray = new Array(); $('#'+toid+' option').each(function(){ codeGroupArray.push($(this).val()); }); codeGroup = codeGroupArray; //var codeGroup = $('#'+toid).val(); $('#REG_HS').val(codeGroup); $('#regCodeSearch_dialog').dialog('close'); } //把選擇的簽審代碼回傳, GA21新版 function choiceRegCodeCheckReturn2(to_select, imExAcType) { var toid = to_select; $('#'+toid).children().each(function(){ $(this).val($.trim($(this).val().replace(/\(.*\)/,""))); }); var codeGroup = ''; var codeGroupArray = new Array(); $('#'+toid+' option').each(function(){ codeGroupArray.push($(this).val()); }); codeGroup = codeGroupArray; //var codeGroup = $('#'+toid).val(); if(imExAcType == 'I'){ $('#REG_HS_TEXT_I').val(codeGroup); }else if(imExAcType == 'E'){ $('#REG_HS_TEXT_E').val(codeGroup); }else if(imExAcType == 'I_AC'){ $('#REG_HS_TEXT_IAC').val(codeGroup); }else{ $('#REG_HS_TEXT_EAC').val(codeGroup); } $('#regCodeSearch_dialog').dialog('close'); } //把選擇的港口代碼回傳 function choiceHarborCodeCheck(to_select) { var toid = to_select; $('#'+toid).children().each(function(){ $(this).val($.trim($(this).val().replace(/\(.*\)/,""))); }); var codeGroup = ''; var codeGroupArray = new Array(); $('#'+toid+' option').each(function(){ codeGroupArray.push($(this).val()); }); codeGroup = codeGroupArray; //var codeGroup = $('#'+toid).val(); $('#DIM_PORT').val(codeGroup); $('#harborCodeSearch_dialog').dialog('close'); } //把選擇的港口代碼回傳, 指定回傳ID function choiceHarborCodeCheckReturn(to_select,returnId) { var toid = to_select; $('#'+toid).children().each(function(){ $(this).val($.trim($(this).val().replace(/\(.*\)/,""))); }); var codeGroup = ''; var codeGroupArray = new Array(); $('#'+toid+' option').each(function(){ codeGroupArray.push($(this).val()); }); codeGroup = codeGroupArray; //var codeGroup = $('#'+toid).val(); $('#'+returnId).val(codeGroup); $('#harborCodeSearch_dialog').dialog('close'); } //把選擇的報單類別回傳 function choiceDeclTypeCheckReturn(to_select) { var toid = to_select; $('#'+toid).children().each(function(){ $(this).val($.trim($(this).val().replace(/\(.*\)/,""))); }); var codeGroup = ''; var codeGroupArray = new Array(); $('#'+toid+' option').each(function(){ codeGroupArray.push($(this).val()); }); codeGroup = codeGroupArray; //var codeGroup = $('#'+toid).val(); $('#DECL_TYPE').val(codeGroup); $('#declTypeSearch_dialog').dialog('close'); } //把選擇的報單類別回傳, GA21新版 function choiceDeclTypeCheckReturn2(to_select, imExAcType) { var toid = to_select; $('#'+toid).children().each(function(){ $(this).val($.trim($(this).val().replace(/\(.*\)/,""))); }); var codeGroup = ''; var codeGroupArray = new Array(); $('#'+toid+' option').each(function(){ codeGroupArray.push($(this).val()); }); codeGroup = codeGroupArray; //var codeGroup = $('#'+toid).val(); if(imExAcType == 'I'){ $('#DECL_TYPE_TEXT_I').val(codeGroup); }else if(imExAcType == 'E'){ $('#DECL_TYPE_TEXT_E').val(codeGroup); }else if(imExAcType == 'I_AC'){ $('#DECL_TYPE_TEXT_IAC').val(codeGroup); }else{ $('#DECL_TYPE_TEXT_EAC').val(codeGroup); } $('#declTypeSearch_dialog').dialog('close'); } //把選擇的納稅辦法.統計方式回傳 function choiceTaxStatModeCheckReturn(to_select) { var toid = to_select; $('#'+toid).children().each(function(){ $(this).val($.trim($(this).val().replace(/\(.*\)/,""))); }); var codeGroup = ''; var codeGroupArray = new Array(); $('#'+toid+' option').each(function(){ codeGroupArray.push($(this).val()); }); codeGroup = codeGroupArray; //var codeGroup = $('#'+toid).val(); $("#DIM_TAX_STAT_MODE").val(codeGroup); $('#taxStatModeSearch_dialog').dialog('close'); } //把選擇的納稅辦法.統計方式回傳, GA21新版 function choiceTaxStatModeCheckReturn2(to_select, imExAcType) { var toid = to_select; $('#'+toid).children().each(function(){ $(this).val($.trim($(this).val().replace(/\(.*\)/,""))); }); var codeGroup = ''; var codeGroupArray = new Array(); $('#'+toid+' option').each(function(){ codeGroupArray.push($(this).val()); }); codeGroup = codeGroupArray; if(imExAcType == 'I'){ $('#DIM_TAX_STAT_MODE_TEXT_I').val(codeGroup); }else if(imExAcType == 'E'){ $('#DIM_TAX_STAT_MODE_TEXT_E').val(codeGroup); }else if(imExAcType == 'I_AC'){ $('#DIM_TAX_STAT_MODE_TEXT_IAC').val(codeGroup); }else{ $('#DIM_TAX_STAT_MODE_TEXT_EAC').val(codeGroup); } $('#taxStatModeSearch_dialog').dialog('close'); } //阻擋原browser的快捷鍵功能 function suppress(){ event.keyCode = 0; event.returnValue = false; return false; } /** * open help window * @param pid * @return */ function openHelp(context,pid){ if(pid.length!=0&&pid!="null"){ var url = context + 'pages/help/ga19/'+pid+'.txt'; if(UrlExists(url)) openWin(url); else{ if(pid == "edit"){ alert('申請資料查詢 說明檔不存在'); }else if(pid == "uplo"){ alert('申請單審核處理 說明檔不存在'); }else if(pid == "down"){ alert('下載查詢 說明檔不存在'); }else if(pid == "assi"){ alert('申請單分派作業 說明檔不存在'); //For GA21M }else if(pid == "Edit_"){ alert('申請資料查詢 說明檔不存在'); }else if(pid == "Assig"){ alert('申請單分派作業 說明檔不存在'); }else if(pid == "Uploa"){ alert('申請單審核處理 說明檔不存在'); }else if(pid == "Close"){ alert("申請單主管覆核 說明檔不存在"); }else if(pid == "Print"){ alert('申請統計報表作業 說明檔不存在'); }else if(pid == "Downl"){ alert('下載查詢作業 說明檔不存在'); }else{ alert('說明檔不存在'); } } } } /** * check url exists or not * @param url * @return */ function UrlExists(url) { var http = new XMLHttpRequest(); http.open('HEAD', url, false); http.send(); return http.status!=404; } /** * open a window * @param url * @return */ function openWin(url){ scrW=screen.width - 10; scrH=screen.height - 10; openX = 0; openY = 0; window.open(url,'help', 'scrollbars=yes,status=0,resizable=1,width=' + scrW+ ',height=' + scrH + ',left=' + openX + ',top=' + openY ); } /** * open pdf(with input feeMemoNo) in a new window */ function openPdf4FeeMemoNo(feeMemoNo){ window.open('/APGA/PdfViewer?feeMemoNo='+feeMemoNo,'', 'width=1024,height=768,resizable=yes,scrollbars=yes'); } /** * open output stream(that store in session) in a new window */ function openStream(){ var dlLink = "StreamViewer"; location.href = dlLink; } /** * 檢核起迄日期. 1)只有迄日無起日, 傳回訊息. 2)起日需<=迄日. * @param dayStart 起日, yyyymmdd. * @param dayEnd 迄日, yyyymmdd. * @param prefix 日期的前綴字. */ function checkDayRange(dayStart, dayEnd, prefix){ //1)只有迄日無起日, 傳回訊息 if(dayStart == "" && dayEnd != ""){ return "先輸入"+prefix+"日期起日,再輸入迄日"; } //2)起日需<=迄日 if((dayStart - dayEnd) > 0){ return prefix+"日期起日需小於等於迄日"; } return ""; } /* 查詢使用說明 toggle */ $(window).load(function(){ var openText="", closeText=""; if(window.location.pathname=="/APGA/GA30E"){ openText="【User Guide】(unfold)"; closeText="【User Guide】(close)"; } else{ openText="【查詢使用說明】(點選展開)"; closeText="【查詢使用說明】(關閉說明)"; } //預設改為展開 // $('.UseNote').hide(); // $('.useNoteTitle').html(openText); $('.useNoteTitle').html(closeText); $('.useNoteTitle').click(function(){ $('.UseNote').slideToggle( "slow", function(){ if($(".UseNote").is(":hidden")){ $('.useNoteTitle').html(openText); } else{ $('.useNoteTitle').html(closeText); } } ); }); }); // 驗證碼 // 更換驗證碼 function changeCaptchaPic(){ var url = "/APGA/Captcha_validNumGenerate"; url = url + "?time=" + new Date().getTime(); $('#captchaPic').attr('src', url); $('#checkNo').val(''); $("#errorCaptcha").hide(); } function getCaptchaCode(){ var captchaCode = ''; var url = "/APGA/Captcha_getCaptchaCode"; $.ajax({ type: "GET", url: url, dataType: 'json', async: false, success: function(data){ captchaCode = data.msg; getCaptchaSpeech(captchaCode); }, error: function(){ console.log(); } }); } function getCaptchaSpeech(msg) { var language=(window.location.href.indexOf("GA30E")>=0?"en":"zh"); if (msg != null && msg != ""){ var audio = document.getElementById("audioCode"); audio.src = "https://translate.google.com/translate_tts?ie=utf-8&client=tw-ob&tl="+language+"&q="+msg; // 設定語音為 google TTS。 audio.play(); // 播放語音 } }