달력

8

« 2025/8 »

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
2024. 9. 30. 09:39

nexacro 폼안의 객체 출력 카테고리 없음2024. 9. 30. 09:39

ths.gfnPrintComp(this.divSearch.form, 'this.divSearch.form.');

this.gfnPrintComp = function( obj, parentStr)
{
//컴포넌트를 모두 출력한다
var arrComp = obj.components;
var nLength = arrComp.length;
var comp;
for( var i=0; i<nLength; i++ )
{
comp = arrComp[i];
trace("comp.name : " + parentStr + comp.name);
}
}

:
Posted by 상문이
2024. 9. 30. 08:45

javascript Math.round 카테고리 없음2024. 9. 30. 08:45

javascript Math.round 사용시 소숫점 반올림이
잘 안되어 이렇게 하면 소숫점 반올림 효과가 있음
ex) 소수 99.577 을 소수점 둘째자리까지 표현하려면
99.577 × 100
하여 9957.7
이렇게 한다음에 소수둘째자리라면 100을 곱하고
다시 100으로 나누는 작업을 하면됩니다

9958 값이 반올림되어 나오면 다시 100으로 나눔
Math.round( value1 / value2 * 100 * 100 ) / 100
99.58 이 됨

99.57 을 나오게하려면 Math.floor 사용
올림은 Math.ceil 사용합니다

:
Posted by 상문이
2024. 6. 19. 18:06

postgresql 메타 조회 카테고리 없음2024. 6. 19. 18:06

select distinct table_name, concat('--',TABLE_COMMENT) from (

SELECT A.ordinal_position as COLUMN_ID

, '' OWNER

, A.table_name as TABLE_NAME

, B.obj_description as TABLE_COMMENT

, A.column_name as COLUMN_NAME

, C.comments as COLUMNS_COMMENTS

, A.data_type

||

CASE WHEN A.data_type != 'TIMESTAMP(6)'

THEN

(

CASE WHEN A.data_type = 'numeric'

THEN ' (' || A.numeric_precision || ') '

WHEN A.data_type = 'timestamp without time zone'

THEN NULL

ELSE ' (' || A.character_maximum_length || ') '

END

)

END as data_type

, A.is_nullable as NULLABLE

, '' as DATA_DEFAULT

, A.numeric_precision as DATA_PRECISION

, A.numeric_scale as DATA_SCALE

FROM information_schema.columns A

JOIN (

SELECT N.NSPNAME, C.RELNAME, OBJ_DESCRIPTION(C.OID) as obj_description

FROM PG_CATALOG.PG_CLASS C INNER JOIN PG_CATALOG.PG_NAMESPACE N ON C.RELNAMESPACE=N.OID

WHERE C.RELKIND = 'r'

AND NSPNAME = 'public'

--AND RELNAME = 'pts_cmmnty_master_mstr'

) B

ON A.table_name = B.relname

JOIN (

SELECT

PS.SCHEMANAME AS SCHEMA,

PS.RELNAME AS TABLE_NAME,

PA.ATTNAME AS COLUMN_NAME,

PD.DESCRIPTION AS comments

FROM PG_STAT_ALL_TABLES PS, PG_DESCRIPTION PD, PG_ATTRIBUTE PA

WHERE PD.OBJSUBID<>0

AND PS.RELID=PD.OBJOID

AND PD.OBJOID=PA.ATTRELID

AND PD.OBJSUBID=PA.ATTNUM

AND PS.SCHEMANAME= 'public'

--AND PS.RELNAME= 'pts_cmmnty_master_mstr'

ORDER BY PS.RELNAME, PD.OBJSUBID

) C

ON A.table_name = C.table_name

AND A.column_name = C.column_name

WHERE 1=1

-- AND A.OWNER IN ( 'KWM' )

AND A.table_name LIKE 'mw_%'

-- AND LENGTH (A.TABLE_NAME) = 9

-- 변경 -- PFCSOWR --AFCOWR

--AND A.column_name LIKE '%equipment_mng_num%'

-- AND C.COMMENTS LIKE '%담당자%'

--AND B.obj_description LIKE '%기관%' /* xpdlqmfaud */

-- AND A.COLUMN_ID = '1'

-- AND A.tablename = '테이블명'

ORDER BY A.table_name

, A.ordinal_position

) A

;

:
Posted by 상문이

//화면에서 접수번호/일련번호에 동일값 여러번 넣어주는거 확인하여 첫번째것만 가져온다.
if(searchVO.getRcptNo() != null) {
   String[] rcptNoArr = searchVO.getRcptNo().split(",");
   if(rcptNoArr.length != 1) {
      searchVO.setRcptNo(rcptNoArr[0]);
   }

}

if(searchVO.getSersNo() != null) {
String[] sersNoArr = searchVO.getSersNo().split(",");
   if(sersNoArr.length != 1) {
      searchVO.setSersNo(sersNoArr[0]);
   }
}

 

서비스에서 이렇게 처음값만 셋팅되도록 해결하면 된다.

 

혹은 아래와 같이 화면에서 다른 임시폼변수에 담아서 처리해도 된다

    /* 목록 화면 function */
    function retrieveList() {
       
        /*
        document.detailForm.pageIndex.value = 1;
        document.detailForm.action = "<c:url value='/ispf/cnst/constInqMngDtlTab2Complete.do'/>";
        document.detailForm.submit();
        */
        var imsiForm = {}
        //imsiForm.suppBizOrglNo = '';  /* 지원사업번호 */
        imsiForm.rcptNo = $("input[id='rcptNo']").val();  /* 접수번호 */
        imsiForm.sersNo = $("input[id='sersNoValue']").val();  /* 일련번호 */
        //imsiForm.indstCode = '';      /* 업종구분 */
        //imsiForm.entprsRegNo = '';    /* 사업자번호 */
        imsiForm.slctnStatCode = $("input[id='slctnStatCode']").val();  /* 선정상태코드 */
        imsiForm.pageIndex = 1;
        var f = createForm(imsiForm);
            f.id = "imsiForm";
            f.method = "POST";
            f.action = "/ispf/cnst/constInqMngDtlTab2Complete.do";
            f.submit();
    }
    /* 폼변수를 넘기기 위해 Form tag를 생성한다.
    * params    : {element Id : element Value...} 형식의 json type string
    * return  : element Value
    * 사용법     : createForm 하고 파라메터 data 에서 폼변수로 읽어와 추가한다.
    * */
    function createForm(params) {
        var f = document.createElement("FORM");
        f.method = "POST";
        document.body.appendChild(f);

        var els = f.elements;

        if (typeof(params) != "undefined") {
            for (key in params) {
                var value = params[key];

                var el = document.createElement("INPUT");
                el.type = "hidden";
                el.name = key;
                el.value = value;

                f.appendChild(el);
            }
        }

        return f;
    }

 

:
Posted by 상문이

regexp_replace( regexp_replace('123 - 12 - 12345', '-', '', 'g'), ' ', '', 'g')

 

출처 : [PostgreSQL] 9.7.3. POSIX.. : 네이버블로그 (naver.com)

 

[PostgreSQL] 9.7.3. POSIX 정규식

표 9-11 에, POSIX 정규식을 사용한 패턴에 사용 가능한 연산자를 열거합니다.     표 9-11...

blog.naver.com

 

 

:
Posted by 상문이
2024. 5. 27. 11:15

JSP JSTL 숫자 점찍기 3자리 콤마 카테고리 없음2024. 5. 27. 11:15

라이브러리 추가

<%@ taglib prefix="fmt"    uri="http://java.sun.com/jsp/jstl/fmt"%>

 

tag 에서 아래와 같이 사용

<input type="text" class="size5 alginr" id="trngSuppSum" name="trngSuppSum" value="<fmt:formatNumber value="${result.trngSuppSum}" pattern="#,###"/>" />

 

 

:
Posted by 상문이
2024. 5. 27. 11:13

javascript 날짜 함수 카테고리 없음2024. 5. 27. 11:13

/**

* numberComma(n)

* 숫자에 콤마 추가함(12345 --> 12,345).

*/

function numberComma(n) {

//-- 정규식

var reg = /(^[+-]?\d+)(\d{3})/;

//-- 숫자를 문자열로 변환

n += '';

while (reg.test(n))

n = n.replace(reg, '$1' + ',' + '$2');

return n;

}

 

/*yyyyMMdd 형식의 날짜 문자열을 입력 받아 연(year)을 증감한다.*/

function addYear( dateStr, year ) {

dateStr = rmNotNumChar(dateStr);

return addYearMonthDay( dateStr, year, 0, 0 );

}

 

/*yyyyMMdd 형식의 날짜 문자열을 입력 받아 일(day)을 증감한다.*/

function addDay( dateStr, day ) {

dateStr = rmNotNumChar(dateStr);

return addYearMonthDay( dateStr, 0, 0, day );

}

 

function addYearMonthDay( source, year, month, day) {

if (isNaN(source) || source.length < 8) {

return "";

}

var yyyy = source.substr(0, 4);

var mm = parseInt(source.substr(4, 2));

var dd = source.substr(6, 2);

 

var dateStr = new Date(yyyy,(mm-1),dd);

var addDay;

if (year != 0) {

//console.log('@@@ year :: '+year);

addDay = new Date( dateStr.setFullYear( dateStr.getFullYear() + year ) );

}

if (month != 0) {

//console.log('@@@ month :: '+month);

addDay = new Date( dateStr.setMonth( dateStr.getMonth() + month ) );

}

if (day != 0) {

//console.log('@@@ day :: '+day);

addDay = new Date( dateStr.setDate( dateStr.getDate() + day ) );

}

//console.log('@@@ addDay :: '+getDateYMD(addDay));

return getDateYMD(addDay);

}

 

/* 입력된 date객체를 날짜형식으로 yyyymmdd */

function getDateYMD( source ) {

var now;

if( empty(source) ){

now = new Date();

}else{

now = new Date( source );

}

 

var year = now.getFullYear();

var month = ("0" + (1 + now.getMonth())).slice(-2);

var day = ("0" + now.getDate()).slice(-2);

 

return year + month + day;

}

 

/* 입력된 str객체를 날짜형식으로 YYYY-MM-DD */

function getDateFormatYMD( source ) {

source = rmNotNumChar(source);

if (isNaN(source) || source.length < 8) {

return "";

}

var yyyy = source.substr(0, 4);

var mm = source.substr(4, 2);

var dd = source.substr(6, 2);

 

var dateStr = new Date(yyyy,(mm-1),dd);

 

var year = dateStr.getFullYear();

var month = ("0" + (1 + dateStr.getMonth())).slice(-2);

var day = ("0" + dateStr.getDate()).slice(-2);

 

return year + "-" + month + "-" + day;

}

 

/* 해당달의 마지막 날짜 구하기 */

function getlastDay( source ) {

source = source.replace(/\D/ig, "");

if (isNaN(source) || source.length < 6) {

return "";

}

var year = source.substr(0, 4);

var month = source.substr(4, 2);

var newDate = new Date(year, month, 0);

 

var newYear = newDate.getFullYear();

var newMonth = newDate.getMonth()+1;

var newDay = newDate.getDate();

//console.log(newMonth);

 

if (newMonth.toString().length < 2) newMonth = "0" + newMonth;

if (newDay.toString().length < 2) newDay = "0" + newDay;

 

return newYear.toString() + newMonth.toString() + newDay.toString();

}

:
Posted by 상문이

onchange가 select 태그 등에 동작하지 않는 원인은 select 태그를 클릭해서 값을 선택하지 않고,
select 태그의 value 프로퍼티의 값을 스크립트를 사용해 업데이트 하는 경우입니다. 
onchange 이벤트는 해당 element의 blur 여부에 따라 동작하기 때문에 값이 갱신되지 않습니다.

 

출처 : https://coding-restaurant.tistory.com/317

 

[JS] onchange 이벤트 사용, value 가져오기

자바스크립트 onchange는 작성한 JS를 통해 변화가 일어났는지를 감지합니다. jQuery change 이벤트와 비슷합니다. onchange 이벤트의 사용 방법은 아래와 같습니다. 첫 번째는 html에서 사용할 때, 나머지

coding-restaurant.tistory.com

 

 

:
Posted by 상문이
2024. 5. 14. 11:27

javascript 한달전 후 날짜구하기 카테고리 없음2024. 5. 14. 11:27

//일정목록
        if( empty(currentDate) ) {
            currentDate = getTodayYMD();
        }
//이전 버튼
        $('button[id=preBtn]').on('click', function(){
            /*한달전 날짜 구하기*/
            currentDate = getPreMonth(currentDate.substr(0,4),currentDate.substr(4,2),currentDate.substr(6,2));
            var calendarEl1 = document.getElementById('yearVal');
            $(calendarEl1).empty()[0].innerHTML = "<span>"+currentDate.substr(0,4)+"&nbsp;&nbsp;년</span><strong>"+currentDate.substr(4,2)+"</strong>월</p>";

            schdMngConstPlanDtl( currentDate, getlastDay(currentDate) );
        });
       
        //다음 버튼
        $('button[id=postBtn]').on('click', function(){
            /*한달후 날짜 구하기*/
            currentDate = getPostMonth(currentDate.substr(0,4),currentDate.substr(4,2),currentDate.substr(6,2));
            var calendarEl1 = document.getElementById('yearVal');
            $(calendarEl1).empty()[0].innerHTML = "<span>"+currentDate.substr(0,4)+"&nbsp;&nbsp;년</span><strong>"+currentDate.substr(4,2)+"</strong>월</p>";

            schdMngConstPlanDtl( currentDate, getlastDay(currentDate) );
        });
       
    /*한달전 날짜 구하기*/
    function getPreMonth(yyyy,mm,dd) {
        var now = new Date(yyyy,(mm-1),dd);
        var preDay = new Date( now.setMonth( now.getMonth() -1 ) );
        return getTodayYMD(preDay.getFullYear(),preDay.getMonth()+1,'01');
    }

    /*한달후 날짜 구하기*/
    function getPostMonth(yyyy,mm,dd) {
        var now = new Date(yyyy,(mm-1),dd);
        var postDay = new Date( now.setMonth( now.getMonth() +1 ) );
        return getTodayYMD(postDay.getFullYear(),postDay.getMonth()+1,'01');
    }
    /* 해당달의 마지막 날짜 구하기 */
    function getlastDay(source) {
        source = source.replace(/\D/ig, "");
        if (isNaN(source) || source.length < 6) {
            return "";
        }
        var year  = source.substring(0, 4);
        var month = source.substring(4, 6);
        var newDate  = new Date(year, month, 0);

        var newYear  = newDate.getFullYear();
        var newMonth = newDate.getMonth()+1;
        var newDay   = newDate.getDate();
        console.log(newMonth);

        if (newMonth.toString().length < 2) newMonth = "0" + newMonth;
        if (newDay.toString().length < 2) newDay = "0" + newDay;

        return newYear.toString() + newMonth.toString() + newDay.toString();
       
    }

 

참조 :  [JavaScript] 한달 전/후 날짜 구하기 (tistory.com)

 

[JavaScript] 한달 전/후 날짜 구하기

Intro JavaScript 에서 현재 시간을 기준으로 한달 전/후 날짜를 구하는 방법에 대해 알아보도록 하겠습니다. How to solve the problem let now = new Date();// 현재 날짜 및 시간 console.log("현재 : ", now); // 현재 :

steady-learner.tistory.com

 

:
Posted by 상문이
2024. 5. 14. 10:56

javascript 함수정리 카테고리 없음2024. 5. 14. 10:56


    /* 현재일자 반환 YYYY-MM-DD */
    function getToday() {
        var date = new Date();
        return date.getFullYear() + "-" + ("0"+(date.getMonth()+1)).slice(-2) + "-" + ("0"+date.getDate()).slice(-2);
    }
   
    //당일  yyyymmdd
    function getTodayYMD( yyyy,mm,dd) {
        var now = new Date(yyyy,(mm-1),dd);
        if( empty(yyyy) || empty(mm) || empty(dd) ){
            now = new Date();
        }
        var year = now.getFullYear();
        var month = ("0" + (1 + now.getMonth())).slice(-2);
        var day = ("0" + now.getDate()).slice(-2);

        return year + month + day;
    }
    /*특정 날짜 시간형태값 구하기*/
    function getTimeInMillis(yyyy,mm,dd)
    {
        var toDay = new Date(yyyy,mm,dd);
        return toDay.getTime();
    }

    /*특정 날짜 요일 구하기*/
    function getTodayLabel(yyyy,mm,dd) {
        var week = new Array('일', '월', '화', '수', '목', '금', '토');
        var today = new Date(yyyy,(mm-1),dd);
        var todayLabel = week[today.getDay()];
        return todayLabel;
    }

    /*한달전 날짜 구하기*/
    function getPreMonth(yyyy,mm,dd) {
        var now = new Date(yyyy,(mm-1),dd);
        var preDay = new Date( now.setMonth( now.getMonth() -1 ) );
        return getTodayYMD(preDay.getFullYear(),preDay.getMonth()+1,'01');
    }

    /*한달후 날짜 구하기*/
    function getPostMonth(yyyy,mm,dd) {
        var now = new Date(yyyy,(mm-1),dd);
        var postDay = new Date( now.setMonth( now.getMonth() +1 ) );
        return getTodayYMD(postDay.getFullYear(),postDay.getMonth()+1,'01');
    }

    function getTodayD(yyyy,mm,dd) {
        var today = new Date(yyyy,(mm-1),dd);
        return today.getDay()+1; //java에서 일요일1 (javascript는 일요일0)
    }
   
    /* 해당달의 마지막 날짜 구하기 */
    function getlastDay(source) {
        source = source.replace(/\D/ig, "");
        if (isNaN(source) || source.length < 6) {
            return "";
        }
        var year  = source.substring(0, 4);
        var month = source.substring(4, 6);
        var newDate  = new Date(year, month, 0);

        var newYear  = newDate.getFullYear();
        var newMonth = newDate.getMonth()+1;
        var newDay   = newDate.getDate();
        console.log(newMonth);

        if (newMonth.toString().length < 2) newMonth = "0" + newMonth;
        if (newDay.toString().length < 2) newDay = "0" + newDay;

        return newYear.toString() + newMonth.toString() + newDay.toString();
       
    }
 

월의 마지막일반환

[JS] JavaScript 현재 날짜(시간) 및 월의 마지막 날짜(말일) 구하기 (tistory.com)

 

[JS] JavaScript 현재 날짜(시간) 및 월의 마지막 날짜(말일) 구하기

현재 날짜(시간) 가져오기 var now = new Date(); 현재시간 now.getYear(); 년 now.getMonth()+1; 월 월은 0부터 시작 0 = 1월, 1 = 2월 ... now.getDate(); 일 1 ~ 31 반환 now.getDay(); 요일 0 ~ 6 반환 / 월요일 ~ 일요일 now.getHo

joonpyo-hong.tistory.com

 

 

요일반환

출처 : Dev Life in IT :: [ 자바 코딩 ] 오늘 날짜, 요일, 시간 구하기 (Calendar 클래스) (tistory.com)

 

[ 자바 코딩 ] 오늘 날짜, 요일, 시간 구하기 (Calendar 클래스)

안녕하세요. 제임스 입니다. 이번에는 자바 Calendar 클래스를 이용하여 오늘 날짜, 요일 및 시간을 구하는 방법에 대해 알아 보겠습니다. import java.util.Calendar;Calendar cal = Calendar.getInstance(); System.out.

jamesdreaming.tistory.com

 

출처 : Date.prototype.getDay() - JavaScript | MDN (mozilla.org)

 

Date.prototype.getDay() - JavaScript | MDN

getDay() 메서드는 주어진 날짜의 현지 시간 기준 요일을 반환합니다. 0은 일요일을 나타냅니다. 현재의 일을 반환하려면 Date.prototype.getDate()를 사용하세요.

developer.mozilla.org

 

 

출처 : JavaScript / 함수 / parseFloat(), parseInt() – 문자열을 수로 바꾸는 함수 – CODING FACTORY

 

JavaScript / 함수 / parseFloat(), parseInt() - 문자열을 수로 바꾸는 함수

목차1 parseFloat()1.1 문법1.2 예제2 parseInt()2.1 문법2.2 예제 parseFloat() parseFloat()는 문자열을 실수로 바꾸는 함수입니다. 문법 parseFloat( string ) 수로 시작할 때 그 수를 실수로 바꿉니다. 띄어 쓰기로 여

www.codingfactory.net

 

 

출처 : [JavaScript] Math 함수 정리 (tistory.com)

 

[JavaScript] Math 함수 정리

[JavaScript] Math 함수 정리 Math is a built-in object that has properties and methods for mathematical constants and functions. It’s not a function object. -> Math 객체는 수학에서 자주 사용하는 상수와 함수들을 미리 구현해 놓

developing-stock-child.tistory.com

 

:
Posted by 상문이