123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618 |
- <?xml version="1.0" encoding="utf-8"?>
- <FDL version="1.5">
- <TypeDefinition url="..\default_typedef.xml"/>
- <Form id="cp_periodCal" classname="cp_periodCal" inheritanceid="" position="absolute 0 0 216 20" titletext="Period Calendar" onload="cp_periodCal_onload" scrollbars="none" style="background:transparent;">
- <Layouts>
- <Layout>
- <Calendar id="cal_to" taborder="1" autoselect="true" type="spin" dateformat="yyyy.MM.dd" onchanged="cal_to_onchanged" position="absolute 116 0 216 20" value="null" editformat="yyyy.MM.dd" onkillfocus="cal_onkillfocus" onkeydown="fn_onkeydown"/>
- <Static id="Static00" text="~" position="absolute 100 0 116 20" style="align:center middle; "/>
- <Calendar id="cal_from" taborder="0" autoselect="true" type="spin" dateformat="yyyy.MM.dd" position="absolute 0 0 100 20" value="null" editformat="yyyy.MM.dd" onkillfocus="cal_from_onkillfocus" onchanged="cal_from_onchanged" onkeydown="fn_onkeydown"/>
- <Div id="div_Base2" taborder="4" tabstop="false" style="background:white; " position="absolute 198 1 214 19"/>
- <Button id="btn_Cal" taborder="2" onclick="btn_Cal_onclick" class="btn_month" position="absolute 200 3 214 18"/>
- <Div id="div_Base1" taborder="3" tabstop="false" style="background:white;" position="absolute 81 1 99 19"/>
- <Button id="btn_Cal00" taborder="5" onclick="btn_Cal_onclick" class="btn_month" position="absolute 84 3 98 18"/>
- </Layout>
- </Layouts>
- <Script type="xscript4.0"><![CDATA[/***************************************************************************************
- * System Name : KMTC
- * Job Name : Composite
- * File Name : cp_periodCal.xfdl
- * Creator : TOBESOFT
- * Make Date : 2013.01.18
- *
- * Description : Calendar Day Period Select Composite
- *---------------------------------------------------------------------------------------
- * Modify Date Modifier Modify Description
- *---------------------------------------------------------------------------------------
- * 2013.01.18 TOBESOFT Initial Make Program
- *
- *---------------------------------------------------------------------------------------
- ****************************************************************************************/
- //=======================================================================================
- // Common Lib Include
- //---------------------------------------------------------------------------------------
- //=======================================================================================
- // Global Form Variable
- //---------------------------------------------------------------------------------------
- var iv_aRtn = new Array(2);
- var iv_event;
- var iv_sDate;
- var iv_nLimit = 0;
- var iv_sTitle = "";
- var iv_Curr = "";
- var iv_bNotNull = true;
- /****************************************************************************************
- * Description : Form Initialization
- * Argument : obj : Object Event has occurred
- * : e : Event Object
- * return :
- ****************************************************************************************/
- function cp_periodCal_onload(obj:Form, e:LoadEventInfo)
- {
- var objDate = new Date();
- iv_sDate = objDate.toFormatString("%Y%m%d");
- cal_from.value = iv_sDate;
- cal_to.value = iv_sDate;
- }
- //=======================================================================================
- // Event
- //---------------------------------------------------------------------------------------
- function fn_onkeydown(obj, e)
- {
- if(e.keycode == 13)
- {
- var sCompNm = this.name;
- if(sCompNm.indexOf("_S") > -1)
- {
- ufn_compositeEvent("ufn_search","");
- }
- }
- }
- /****************************************************************************************
- * Components : Button
- * Event : onclick
- * Argument : 01.obj : Object Event has occurred
- * : 02.e : Event Object
- * Description : Selected popup button
- ****************************************************************************************/
- function btn_Cal_onclick(obj:Button, e:ClickEventInfo)
- {
- if(cal_from.text == undefined){
- cal_from.value = iv_sDate;
- }
-
- if(cal_to.text == undefined){
- cal_to.value = iv_sDate;
- }
-
- var aArg = new Array(2);
-
- if(iv_bNotNull){
- aArg[0] = ufn_getDateToStr(cal_from.value);
- aArg[1] = ufn_getDateToStr(cal_to.value);
- }else{
- aArg[0] = cal_from.value;
- aArg[1] = cal_to.value;
- }
-
- var aRtn = ufn_Calendar(obj, "F", aArg);
- if(aRtn <> null)
- {
- cal_from.value = aRtn[0];
- cal_to.value = aRtn[1];
-
- if(!ufn_isNull(iv_event)) ufn_compositeEvent(iv_event,this.name);
- }
- }
- /****************************************************************************************
- * Components : Calendar
- * Event : onchange
- * Argument : 01.obj : Object Event has occurred
- * : 02.e : Event Object
- * Description : When the date changes
- ****************************************************************************************/
- function cal_from_onchanged(obj:Calendar, e:ChangeEventInfo)
- {
- if(ufn_isEmpty(cal_from.value) == true || ufn_isEmpty(cal_to.value) == true){
- return false;
- }
-
- if(obj.name == "cal_from"){
- var sFromDate = ufn_getDateToStr(cal_from.value);
- var sToDate = ufn_getDateToStr(cal_to.value);
-
- if(ufn_isDate(sToDate) == true && ufn_isDate(sToDate) == true){
- var retVal = ufn_compareDate(sFromDate, sToDate);
- if(retVal > 0){
- alert("Select period incorrect.");
- cal_from.value = "";
- return false;
- }
- }else{
- alert("The month format is not.");
- cal_from.value = "";
- return false;
- }
- }
-
- if(!ufn_isNull(iv_event)) ufn_compositeEvent(iv_event,this.name);
- }
- /****************************************************************************************
- * Components : Calendar
- * Event : onchange
- * Argument : 01.obj : Object Event has occurred
- * : 02.e : Event Object
- * Description : When the date changes
- ****************************************************************************************/
- function cal_to_onchanged(obj:Calendar, e:ChangeEventInfo)
- {
- if(ufn_isEmpty(cal_from.value) == true || ufn_isEmpty(cal_to.value) == true){
- return false;
- }
-
- if(obj.name == "cal_to"){
- var sFromDate = ufn_getDateToStr(cal_from.value);
- var sToDate = ufn_getDateToStr(cal_to.value);
-
- if(ufn_isDate(sToDate) == true && ufn_isDate(sToDate) == true){
- var retVal = ufn_compareDate(sFromDate, sToDate);
- if(retVal > 0){
- alert("Select period incorrect.");
- cal_to.value = "";
- return false;
- }
- }else{
- alert("The month format is not.");
- cal_to.value = "";
- return false;
- }
- }
-
- if(!ufn_isNull(iv_event)) ufn_compositeEvent(iv_event,this.name);
- }
- //=======================================================================================
- // User Function
- //---------------------------------------------------------------------------------------
- /****************************************************************************************
- * Description : 컴포지트 이벤트 호출 함수
- * Argument : sEventId - 호출할 이벤트 ID
- * sCompNm - 컴포지트명
- * @return N / A
- ****************************************************************************************/
- function ufn_compositeEvent(sEventId,sCompNm)
- {
- var lv_oFrame = this.getOwnerFrame();
-
- var lv_bInhForm = ufn_isNull(lv_oFrame.bInhForm) ? false : lv_oFrame.bInhForm;
- var lv_bMdiForm = ufn_isNull(lv_oFrame.bMdiForm) ? false : lv_oFrame.bMdiForm;
- var lv_bMdiPopForm = ufn_isNull(lv_oFrame.bMdiPopForm) ? false : lv_oFrame.bMdiPopForm;
-
- try{
- if(lv_bInhForm)
- {
- if(lv_bMdiForm == true || lv_bMdiPopForm == true)
- {
- if(ufn_isNull(sCompNm))
- {
- eval("this.getOwnerFrame().form.div_Layout.div_Work."+sEventId+"()");
- }
- else
- {
- eval("this.getOwnerFrame().form.div_Layout.div_Work."+sEventId+"('"+sCompNm+"')");
- }
- }
- else
- {
- if(ufn_isNull(sCompNm))
- {
- eval("this.getOwnerFrame().form."+sEventId+"()");
- }
- else
- { ;
- eval("this.getOwnerFrame().form."+sEventId+"('"+sCompNm+"')");
- }
- }
- }
- else
- {
- if(ufn_isNull(sCompNm))
- {
- eval(sEventId+"()");
- }
- else
- {
-
- eval(sEventId+"('"+sCompNm+"')");
- }
- }
- }catch(err){}
- }
- /****************************************************************************************
- * Description : Converted to a String Date Type
- * Argument : date date Type
- * return : yyyyMMdd
- ****************************************************************************************/
- function ufn_getDateToStr(date)
- {
- if(ufn_isNull(date)) return;
- var strYear = date.getYear().toString();
- var sMonth = (date.getMonth()+1).toString();
- var sDate = date.getDate().toString();
-
- if(strYear.length==2)
- strYear = '19'+strYear;
- else if(strYear.length==1)
- strYear = '190'+strYear;
-
- if(sMonth.length==1)
- sMonth = '0'+sMonth;
- if(sDate.length==1)
- sDate = '0'+sDate;
-
- return strYear+sMonth+sDate;
- }
- /****************************************************************************************
- * Description : 입력값이 null 또는 wihte space로만 이루어져 있으면 빈문자를 리턴하는 함수
- * Argument : sValue String
- * return : String
- ****************************************************************************************/
- function ufn_isEmpty(sValue)
- {
- if (new String(sValue).valueOf() == "undefined") return "";
- if (sValue == null) return "";
- var lv_sChkStr = new String(sValue);
- if (lv_sChkStr == null) return "";
- if (lv_sChkStr.toString().length == 0 ) return "";
- return sValue;
- }
- /****************************************************************************************
- * Description : 입력값이 null 또는 wihte space로만 이루어져 있는지 확인 하는 함수
- * Argument : value 입력값
- * return : boolean. null(혹은 white space) 여부
- ****************************************************************************************/
- function ufn_isNull(sValue)
- {
- if (new String(sValue).valueOf() == "undefined") return true;
- if (sValue == null) return true;
-
- var lv_sChkStr = new String(sValue);
- if (lv_sChkStr == null) return true;
- if (lv_sChkStr.toString().length == 0 ) return true;
- return false;
- }
- /****************************************************************************************
- * Description : Check the validity date.
- * Argument : sDate yyyyMM or yyyyMMdd, ex) "201205" or "20120506"
- * return : boolean
- ****************************************************************************************/
- function ufn_isDate(sDate)
- {
- var retVal;
- switch(sDate.length)
- {
- case 6://yyyyMM
- retVal = ufn_isYM(sDate);
- break;
- case 8://yyyyMMdd
- retVal = ufn_isYMD(sDate);
- break;
- default:
- retVal = false;
- break;
- }
- return retVal;
- }
- /****************************************************************************************
- * Description : Check the date format
- * Argument : sDate yyyyMMdd, ex) "20120506"
- * return : boolean
- ****************************************************************************************/
- function ufn_isYMD(sDate)
- {
- if (sDate.length != 8 || !isNumeric(sDate)) {
- return false;
- }
- var strYM = String(sDate).substr(0,6); // yyyyMM
- if (!ufn_isYM(strYM)) {
- return false;
- }
- var nDay = toNumber(String(sDate).substr(6,2)); // dd
- var nLastDay = toNumber(ufn_getLastDay(strYM));
- if (nDay < 1 || nDay > nLastDay) {
- return false;
- }
- return true;
- }
- /****************************************************************************************
- * Description : Check the date format
- * Argument : sDate yyyyMM, ex) "201205"
- * return : boolean
- ****************************************************************************************/
- function ufn_isYM(sDate)
- {
- if (sDate.length != 6 || !isNumeric(sDate)) {
- return false;
- }
- var nYear = toNumber(String(sDate).substr(0,4));
- var nMonth = toNumber(String(sDate).substr(4,2));
- if((nMonth < 1) || (nMonth > 12)) {
- return false;
- }
- return true;
- }
- /****************************************************************************************
- * Description : Compare the two dates.
- * Argument : sFormDate yyyyMMdd ex) "20120501"
- sToDate yyyyMMdd ex) "20120530"
- * @return
- * <p>1. The date is equal to two : return 0</p>
- * <p>2. sFormDate < sToDate : return -1</p>
- * <p>3. strFromDate > sToDate : return 1</p>
- * <p>4. Unless the date format : return null</p>
- ****************************************************************************************/
- function ufn_compareDate(sFormDate, sToDate)
- {
- var retVal;
- if (ufn_isDate(sFormDate) && ufn_isDate(sToDate)) {
- if (sFormDate == sToDate) {
- retVal = 0;
- } else if (sFormDate < sToDate) {
- retVal = -1;
- } else if (sFormDate > sToDate) {
- retVal = 1;
- }
- }
- return retVal;
- }
- /****************************************************************************************
- * Description : User Composite Get Data Method
- * Argument : none
- * return : none
- ****************************************************************************************/
- function getData()
- {
- iv_aRtn = new Array(2);
- if(iv_bNotNull){
- iv_aRtn[0] = ufn_getDateToStr(cal_from.value);
- iv_aRtn[1] = ufn_getDateToStr(cal_to.value);
- }else{
- iv_aRtn[0] = cal_from.value;
- iv_aRtn[1] = cal_to.value;
- }
- return iv_aRtn;
- }
- /****************************************************************************************
- * Description : User Composite Set Data Method
- * Argument : none
- * return : none
- ****************************************************************************************/
- function setData(aData)
- {
- if((!ufn_isDate(aData[0])) || (!ufn_isDate(aData[1]))) return;
- trace(aData[0]+" "+aData[1]);
- cal_from.value = aData[0];
- cal_to.value = aData[1];
- }
- function setEmpty()
- {
- cal_from.value = "";
- cal_to.value = "";
- }
- function setIsNull()
- {
- iv_bNotNull = false;
- }
- /****************************************************************************************
- * Description : User Composite Set Blank Method
- * Argument : none
- * return : none
- ****************************************************************************************/
- function setBlank()
- {
- cal_from.value = "";
- cal_to.value = "";
- }
- /****************************************************************************************
- * Description : When the user select a date set limits
- * Argument : 1. sTitle : Title
- * : 2. nLimit : number
- * : 3. sFlag :
- * return : none
- ****************************************************************************************/
- function setLimit(sTitle, nLimit, sFlag)
- {
- iv_sTitle = sTitle
- iv_nLimit = nLimit;
-
- if(ufn_isEmpty(sFlag)){
- iv_Curr = sFlag;
- }
- }
- /****************************************************************************************
- * Description : User composite set required
- * Argument : none
- * return : none
- ****************************************************************************************/
- function setRequestment(bReq)
- {
- if(bReq)
- {
- cal_from.class = "input_essential";
- cal_to.class = "input_essential";
- }
- else
- {
- cal_from.class = "";
- cal_to.class = "";
- }
- }
- function setEnbale(bReq)
- {
- cal_from.enable = bReq;
- cal_to.enable = bReq;
- btn_Cal.enable = bReq;
-
- if(bReq)
- {
- div_Base1.style.background = "white";
- div_Base2.style.background = "white";
- }
- else
- {
- div_Base1.style.background = "#eeeeee";
- div_Base2.style.background = "#eeeeee";
- }
- }
- /****************************************************************************************
- * Description : User Composite Set Event Method
- * Argument : none
- * return : none
- ****************************************************************************************/
- function setCallEvent(sEvent)
- {
- iv_event = sEvent;
- }
- /****************************************************************************************
- * Description : User Composite Set NullValue Method
- * Argument : none
- * return : none
- ****************************************************************************************/
- function setNullValue(sGbn)
- {
- if(sGbn == "F")
- {
- cal_from.value = null;
- }
- else if(sGbn == "T")
- {
- cal_to.value = null;
- }
- else if(sGbn == "A")
- {
- cal_from.value = null;
- cal_to.value = null;
- }
- }
- /****************************************************************************************
- * Description : Calendar option select
- * Argument : 1.oBtn : Button object
- * : 2.sGb : Date type
- * : 3.sDate : Selected date
- * : 4.sMenuId : Form ID
- * : 5.sType :
- * return : Selected date
- ****************************************************************************************/
- var iv_CalendarDateFg;
- var iv_CalendarValue;
- var iv_bCalendarNaviFq = true;
- function ufn_Calendar(oBtn,sGb,vDate,sMenuId,sType)
- {
- if(sMenuId == null) sMenuId = "";
- if(sType == null) sType = "";
-
- var sUrl;
- var sName;
- var objPdvCal = new PopupDiv();
-
- if(sGb == "F")
- {
- sName = "PopDiv_CalendarF";
- sUrl = "COMPOSITE::Comm_periodDayCalendar.xfdl";
- objPdvCal.init(sName, 0, 0, 410, 255);
- objPdvCal.text = sName;
- }
-
- // Add Object to Parent Form
- this.addChild(sName, objPdvCal);
-
- objPdvCal.style.border = "none";
- objPdvCal.style.background = "transparent";
- objPdvCal.style.opacity = 100;
- objPdvCal.url = sUrl;
-
- // Show Object
- objPdvCal.show();
-
- if((sGb == "W") || (sGb == "D")) objPdvCal.msDataFg = sGb;
- objPdvCal.iv_mvArgValue = vDate;
-
- objPdvCal.fn_CrCal();
-
- var nPosX = system.clientToScreenX(cal_from, cal_from.position.left);
- var nPosY = system.clientToScreenY(cal_from, cal_from.position.height);
- var rtn = objPdvCal.trackPopup(nPosX,nPosY);
-
- this.removeChild(sName);
- objPdvCal.destroy();
-
- return rtn;
- }
- function cal_onkillfocus(obj:Calendar, e:KillFocusEventInfo)
- {
- if(iv_bNotNull)
- {
- if(ufn_isNull(obj.value)) obj.setFocus();
- }
- }
- /****************************************************************************************
- * Description : Returns the last date
- * Argument : sDate yyyyMM, ex) "201205"
- * return : Last date(dd)
- ****************************************************************************************/
- function ufn_getLastDay(sDate)
- {
- var lv_sRetVal = "";
- if (sDate == null) {
- var date = (new Date()).addMonth(1);
- }
- else {
- var date = new Date(parseInt(String(sDate).substr(0,4)),parseInt(String(sDate).substr(4,2)),1);
- }
- date = (new Date(date)).addDate((new Date(date)).getDate()*-1);
- lv_sRetVal = (new Date(date)).getFullYear()
- + (((new Date(date)).getMonth() + 1) + "").padLeft(2, '0')
- + ((new Date(date)).getDate() + "").padLeft(2, '0');
- return (lv_sRetVal);
- }
- ]]></Script>
- </Form>
- </FDL>
|