123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583 |
- /**
- * @(#)file lib.js
- * @(#)author developer
- * @(#)version 1.0
- * @(#)date 2003-05-14
- *
- * Copyright You can copy or redistribute this code freely,
- * but you should not remove the information about the copyright notice
- * and the author.
- * Description : 파일 기능에 대해 기술합니다..
- */
-
- /**
- * 금액을 3자리로 단위표시 해서 리턴한다.
- * 파라미터)> num: 숫자
- * 사용예)> plusComma("1234")
- */
- function plusComma(num) {
- var out = "";
- var minus = false;
- if (num < 0) { num *= -1; minus = true; }
- else minus = false;
- var dotPos = (num+"").split(".");
- var dotU = dotPos[0];
- var dotD = dotPos[1];
- var commaFlag = dotU.length%3;
- if(commaFlag) {
- out = dotU.substring(0, commaFlag);
- if (dotU.length > 3) out += ",";
- }
- else out = "";
- for (var i=commaFlag; i < dotU.length; i+=3) {
- out += dotU.substring(i, i+3);
- if( i < dotU.length-3) out += ",";
- }
- if(minus) out = "-" + out;
- if(dotD) return out + "." + dotD;
- else return out;
- }
- /**
- * 첨부파일
- * obj : 파일 목록이 들어갈 Object[textarea/select]
- * fileGB : 파일 종류 구분
- * isCorp : 업체 공개 항목 표시 여부
- * isContract : 계약용파일 항목 표시 여부
- * isModify : 입력/수정/삭제 기능 사용 여부
- * isTechReq : TBE 항목 표시 여부
- */
- //function viewFileList(fileGB, id, obj, isCorp, isContract, isModify, isTechReq) {
- //
- // var url = "/common/file/FileList.screen"
- // + "?file_gb=" + fileGB
- // + "&id=" + id;
- //
- // if( isCorp != null )
- // url += "&is_corp=" + isCorp;
- //
- // if( isContract != null )
- // url += "&is_con=" + isContract;
- //
- // if( isTechReq != null )
- // url += "&is_techreq=" + isTechReq;
- //
- // if( isModify != null )
- // url += "&is_modify=" + isModify;
- //
- // var result = null;
- //
- // result = window.showModalDialog(getDummyUrl(url),'Attach Files','dialogWidth:730px;dialogHeight:430px; center:yes; help:no; status:no; scroll:no; resizable:no');
- //
- // if( result == null )
- // return;
- //
- // if( obj == null )
- // return result;
- //
- // if( obj.type == "select-multiple" || obj.type == "select-one" ) {
- // removeAllOptions(obj);
- // if( result != null && result.length != null ) {
- // for( var i = 0 ; i < result.length ; i++ ) {
- // var str = getFileInfoStr(result[i], isCorp, isContract);
- // var option = new Option(str, str, false );
- // obj.options[i] = option;
- // }
- // }
- // }
- // else if( obj.type == "textarea" ) {
- // obj.value = "";
- // if( result != null && result.length != null ) {
- // obj.value = "";
- // for( var i = 0 ; i < result.length ; i++ ) {
- // var str = getFileInfoStr(result[i], isCorp, isContract);
- // obj.value += str + "\n";
- // }
- // }
- // }
- // else {
- // return result;
- // }
- //}
- function viewFileList(fileGB, id, obj, isModify, isDrectory, iframeID) {
-
- var win_id = "_viewFileList";
- var link = "/common/file/FileListNew.screen";
- link += "?pop_win_id="+win_id;
- link += "&sModule=LM";
- link += "&extFunction=viewFileListCloseWin";
- link += "&file_gb=" + fileGB;
- link += "&id=" + id;
-
- if( obj.id != null )
- link += "&obj_id=" + obj.id;
-
- if( iframeID != null )
- link += "&iframeID=" + iframeID;
-
- if( isModify != null )
- link += "&is_modify=" + isModify;
- if( isDrectory != null )
- link += "&sys_gb=" + isDrectory;
-
-
- //window.open(link, "_fileView", "toolbar=no, width=750, height=430, top=500, left=400, toolbar=no,directories=no,status=no,scrollbars=yes,resize=no,menubar=no,target=_blank")
- var result = null;
-
- result = window.showModalDialog(link,'Attach Files','dialogWidth:730px;dialogHeight:430px; center:yes; help:no; status:no; scroll:no; resizable:no');
-
- /*예약함수로 선언 되어 있어야 한다*/
- doAttachFileListSet();
-
- }
- function winclose(){
- alert("winclose : 111");
- }
- function viewFileListNew(fileGB, id, obj, isModify, isDrectory, iframeID, user_filename, file_size, multi_yn, zipDownYn, zipDownName) {
- var win_id = "_viewFileList";
- var link = "/common/file/FileListNew.screen";
- link += "?pop_win_id="+win_id;
- link += "&extFunction=viewFileListClose";
- link += "&file_gb=" + fileGB;
- link += "&id=" + id;
-
- if( obj.id != null )
- link += "&obj_id=" + obj.id;
- if( iframeID != null )
- link += "&iframeID=" + iframeID;
-
- if( isModify != null )
- link += "&is_modify=" + isModify;
- if( isDrectory != null )
- link += "&sys_gb=" + isDrectory;
- if( file_size != null )
- link += "&file_size=" + file_size;
- if( multi_yn != null )
- link += "&multi_yn=" + multi_yn;
- if( user_filename != null )
- link += "&user_filename=" + encodeURIComponent(user_filename);
- if( zipDownYn )
- link += "&zip_down_yn=" + zipDownYn;
- if( zipDownName )
- link += "&zip_down_name=" + encodeURIComponent(zipDownName);
-
- fLayerPop(win_id, link, 750,430, '', '', 'NO', '200');
- }
- /**
- * 파일 목록 정보를 얻는다.
- * 파라미터)> obj: 객체명, isCorp: 업체 공개 항목 표시 여부, isCon: 계약 할때 생성여부
- */
- function getFileInfoStr(obj, isCorp, isCon) {
- var str = "";
- str = obj.no + " : ";
- if( isCorp != null && isCorp == 'Y' )
- str += "업체공개[" + obj.open_corp_yn + "] ";
- if( isCon != null && isCon == 'Y' )
- str += "계약사용[" + obj.use_con_yn + "] ";
- str += obj.file_name + " (" + obj.file_size + ")";
- return str;
- }
- /**
- * 오류 알림창 컴포넌트
- */
- function dlgErrorDetailAlert(msg, detailMsg) {
- var dlgWidth = 500;
- var dlgHeight = 275;
- dlgErrorAlert(msg, dlgWidth, dlgHeight, detailMsg);
- }
- /**
- * 오류 알림창 컴포넌트 ( 공통 )
- */
- function dlgErrorMsg( resultObj ) {
- //var result = window.showModalDialog('/dialog/dlgError.screen',resultObj,'dialogWidth:505px;dialogHeight:325px; center:yes; help:no; status:yes; scroll:no; resizable:no');
-
- var win_id = "_dlgError";
- var link = "/dialog/dlgError.screen";
- link += "?pop_win_id="+win_id;
- link += "&errMsg="+encodeURIComponent(resultObj.getMessage());
- // link += "&errDetailMsg="+encodeURIComponent(resultObj.getDetailMessage());
- fLayerPop(win_id, link, 505,195, '', '', 'NO');
- }
- /**
- *
- */
- function dlgErrorAlert(msg, varWidth, varHeight, detailMsg)
- {
- var dlgWidth = 400;
- var dlgHeight = 170;//180
- if( varWidth != null )
- dlgWidth = varWidth;
- if( varHeight != null )
- dlgHeight = varHeight;
- if( detailMsg == null )
- detailMsg = "";
- if( detailMsg != "" ) {
- dlgHeight = dlgHeight + 107;
- }
- var msgArray = new Array( msg , detailMsg );
- window.showModalDialog(getDummyUrl('/dialog/dlgErrorAlert.screen') , msgArray,'dialogWidth:' + dlgWidth + 'px;dialogHeight:' + dlgHeight + 'px; center:yes; help:no; status:no; scroll:no; resizable:no');
- }
- /**
- * 현장 검색(html용) : 최종으로 현장 사용함 2005-01-14
- * 파라미터)> obj_dept_cd: 선택한 현장코드가 들어갈 객체, obj_dept_nm:선택한 현장명이 들어갈 객체
- * 사용예)> dlgSearchSpotDept(obj_dept_cd, obj_dept_nm)
- */
- function dlgSearchSpotDept(obj_dept_cd, obj_dept_nm)
- {
- var win_id = "_searchSite";
- var link = "/lib/dlgSearchSpotDept_Unitcd.screen";
- link += "?pop_win_id="+win_id+"&obj_dept_cd="+obj_dept_cd+"&obj_dept_nm="+obj_dept_nm;
- fLayerPop(win_id, link, 570,500, '', '', 'NO');
- }
- function dlgSearchSpotDeptEnd(result, obj_dept_cd, obj_dept_nm) {
-
-
- if( result == null ){
- parent.document.getElementById(obj_dept_cd).value = "";
- parent.document.getElementById(obj_dept_nm).value = "";
- }else{
- parent.document.getElementById(obj_dept_cd).value = result[0];
- parent.document.getElementById(obj_dept_nm).value = result[1];
- }
- parent.fLayerPopClose('_searchSite');
- }
- function dlgClear(obj_dept_cd, obj_dept_nm)
- {
- document.getElementById(obj_dept_cd).value = "";
- document.getElementById(obj_dept_nm).value = "";
-
- }
- function dlgSearchSpotDeptNew(obj_dept_cd, obj_dept_nm)
- {
- var win_id = "_searchSiteNew";
- var link = "/lib/dlgSearchSpotDept_Unitcd_New.screen";
- link += "?pop_win_id="+win_id+"&obj_dept_cd="+obj_dept_cd+"&obj_dept_nm="+obj_dept_nm;
- fLayerPop(win_id, link, 570,420, '', '', 'NO');
- }
- function dlgSearchSpotDeptNewEnd(result, obj_dept_cd, obj_dept_nm) {
- if( result == null ){
- parent.document.getElementById(obj_dept_cd).value = "";
- parent.document.getElementById(obj_dept_nm).value = "";
- }else{
- parent.document.getElementById(obj_dept_cd).value = result[0];
- parent.document.getElementById(obj_dept_nm).value = result[1];
- }
- parent.fLayerPopClose('_searchSiteNew');
- }
- function dlgClearNew(obj_dept_cd, obj_dept_nm)
- {
- document.getElementById(obj_dept_cd).value = "";
- document.getElementById(obj_dept_nm).value = "";
-
- submitXmlRequest("/lib/dlgSearchSpotDeptCrear.screen", "CLEAR_DEPT", document.form1, "SUCCESS");
-
- }
- function doResult(resultObj) {
- try {
- if( resultObj.getRequestEvent() == "CLEAR_DEPT") {
- if( resultObj.getSuccess() ) {
- }
- else {
- dlgErrorMsg(resultObj);
- }
- }
-
- document.form1.isSubmit = false;
- }
- catch(errorObject) {
- showErrorDlg("doResult()", errorObject);
- }
- }
- /**
- * 현장 검색 (sheet용): 최종으로 현장 사용함 2005-01-14
- * 파라미터)> obj_dept_cd: 선택한 현장코드가 들어갈 객체, obj_dept_nm:선택한 현장명이 들어갈 객체
- * 사용예)> dlgSearchSpotDept(obj_dept_cd, obj_dept_nm)
- */
- function dlgSearchSpotDept4Sheet(obj_dept_cd, obj_dept_nm, objSheet, iRow, iCol1, iCol2)
- {
- var result = "false";
- result = window.showModalDialog(getDummyUrl('/lib/dlgSearchSpotDept.screen'),'현장 찾기','dialogWidth:620px;dialogHeight:460px; center:yes; help:no; status:no; scroll:no; resizable:no');
- if( result == null )
- return;
- if( result.length != 2 )
- return;
- if( obj_dept_cd != null && obj_dept_nm != null )
- {
- objSheet.SetCellValue(iRow, iCol2, result[0]); //부서코드
- objSheet.SetCellValue(iRow, iCol1, result[1]); //부서명
- }
- }
- /**
- * 일반 팝업창
- * 파라미터)> url: 주소, title: title, scroll: 스크롤여부, nWidth: 팝업창의 넓이, nHeight: 팝업창의 높이
- * 사용예)> dlgConfirm("저장되었습니다.",200,150)
- */
- function openPopup(url, title, scroll, nWidth, nHeight){
- var opts, iMyWidth, iMyHeight;
- iMyWidth = (window.screen.width-nWidth)/2;
- iMyHeight = (window.screen.height-nHeight)/2;
- opts = "width="+nWidth+",height="+nHeight+",";
- opts += "toolbar=no,location=no,directories=no,status=no,";
- opts += "menubar=no,scrollbars="+scroll+",resizable=no,";
- opts += "left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight ;
- win = window.open(url, title, opts);
- //win.focus();
- }
- /**
- *전화번호 유효 Check
- *
- */
- function checkTelno(strTelno) {
- for (var i = 0 ; i < strTelno.length ; i++){
- if(isNaN(parseInt(strTelno.charAt(i))) && strTelno.charAt(i)!='-'){
- return false;
- }
- }
- return true;
- }
- /**
- * 소수점을 제거함
- * value : 입력값
- * num : 소수점자리수
- */
- function fixPoint( value , num) {
- //소수점제거
- if (value != null && num == 0 && value != "" && value.indexOf(".") > 0) {
- value = value.substring(0, value.indexOf("."));
- return value;
- }
- //소수점 추가
- else {
- value = addPoint( value , num);
- return value;
- }
- }
- /**
- * 소수점을 추가함
- * value : 입력값
- * num : 소수점자리수
- * 2007-10-19 김종만 수정
- */
- function addPoint( value , num) {
- //123 -> 123.00
- if (value != null && value != "" && value.indexOf(".") == -1) {
- //value 123 num 0
- if(num == 0 ) { return value; }
-
- value = value + ".";
- for(i = 0; i < num;i++) {
- value = value + "0";
- }
- return value;
- }
- //123.000 -> 123.00
- else if (value != null && value != "" && value.indexOf(".")>=0 && (value.length-value.indexOf(".")-1)<num ) {
- num = num - (value.length-value.indexOf(".")-1);
- for(i=0; i<num; i++)
- {
- value = value + "0";
- }
- return value;
- }
- else if (value != null && value != "") {
- return value;
- } else {
- value = value + "0.";
- for(i = 0; i < num;i++) {
- value = value + "0";
- }
- return value;
- }
- return value;
- }
- /**
- * 소수점을 제거함
- * value : 입력값
- * num : 소수점자리수
- */
- function fixPoint4sub( value , num) {
- var point_len = value.length - value.indexOf(".") -1 ;
-
- //소수점제거
- if (value != null && (num == 0 || point_len > num ) && value != "" && value.indexOf(".") > 0) {
- if( num == 0 ) {
- value = value.substring(0, value.indexOf("."));
- }
- else
- {
- value = value.substring(0, value.length-(point_len-num));
- }
- return value;
- }
- else if(value != null && point_len == num && value != "" && value.indexOf(".") > 0){
- return value;
- }
- //소수점 추가
- else {
- value = addPoint( value , num);
- return value;
- }
- }
- /**
- * 달력 컴포넌트
- * 사용예) dlgCalendar2('aaa');
- * @param obj_str
- */
- var obj_str_change;
- var obj_str_val;
- function dlgCalendar(obj_str)
- {
- var info = {Format:"yyyy-MM-dd",Result:document.getElementById(obj_str), CalButtons : "Close",CallBack:"Calendar_return"};
- IBShowCalendar("",info);
- obj_str_change = obj_str;
- obj_str_val = $("#"+obj_str).val();
- }
- /**
- * 달력 컴포넌트
- * 사용예) dlgMonthCalendar2('aaa');
- * @param obj_str
- */
- function dlgMCalendar(obj_str)
- {
- var info = {Format:"yyyy-MM",Result:document.getElementById(obj_str), CalButtons : "Close",CallBack:"Calendar_return"};
- IBShowCalendar("",info);
- obj_str_change = obj_str;
- obj_str_val = $("#"+obj_str).val();
- }
- /**
- * 콜백 이벤트 발생후 체인지 이벤트 발생..
- */
- function Calendar_return(){
- if(obj_str_val != $("#"+obj_str_change).val()){
- $("#"+obj_str_change).change();
- }
- }
- /**
- * 문자열을 UTF-8로 변환했을 경우 차지하게 되는 byte 수를 리턴한다.
- */
- function stringByteSize4UTF(str) {
- if (str == null || str.length == 0) {
- return 0;
- }
- var size = 0;
- for (var i = 0; i < str.length; i++) {
- size += charByteSize4UTF(str.charAt(i));
- }
- return size;
- }
- /**
- * 각 문자의 유니코드 코드를 분석하여, UTF-8로 변환시 차지하는 byte 수를 리턴한다.
- */
- function charByteSize4UTF(ch) {
- if (ch == null || ch.length == 0) {
- return 0;
- }
-
- var charCode = ch.charCodeAt(0);
-
- if (charCode <= 0x00007F) {
- return 1;
- } else if (charCode <= 0x0007FF) {
- return 2;
- } else if (charCode <= 0x00FFFF) {
- return 3;
- } else {
- return 4;
- }
- }
- /**
- * 사업장 검색 (구매)
- * 파라미터)> obj_corp_id:협력업체 id, obj_corp_name: 협력업체명, obj_reg: 사업자 번호
- * 사용예)> dlgSearchPURRegNo(12, '대동경유', '212-81-22345')
- */
- function dlgSearchPURRegNo(obj_corp_id, obj_corp_name, obj_reg )
- {
- var result = "false";
- var argObj = new Object();
- argObj.title = '사업자 찾기';
- argObj.ent_corp_id = "";
- argObj.work_id = "";
- argObj.site_gb = 'PUR';
- argObj.reg_gb = '1'; /* 사업자 찾기 */
- argObj.all_gb = '0';
- argObj.ent_corp_NM = "";
-
- var win_id = "_searchBizRegNo";
- var link = "/lib/dlgSearchBizRegNo.screen";
- link += "?pop_win_id="+win_id+"&obj_corp_id="+obj_corp_id+"&obj_corp_name="+obj_corp_name+"®_gb="+argObj.reg_gb+"&site_gb="+argObj.site_gb
- +"&all_gb="+argObj.all_gb;
- fLayerPop(win_id, link, 415,470, '', '', 'NO');
-
- //result = window.showModalDialog(getDummyUrl('/lib/dlgSearchBizRegNo.screen'),argObj,'dialogWidth:415px;dialogHeight:470px; center:yes; help:no; status:no; scroll:no; resizable:no');
- }
- function searchBizRegNoClose(result, obj_corp_id, obj_corp_name) {
- if( result == null ){
- obj_corp_id.value = "";
- obj_corp_name.value = "";
- }else{
- obj_corp_id.value = result[0];
- obj_corp_name.value = result[1];
- }
- fLayerPopClose('_searchBizRegNo');
- }
|