123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433 |
- <?xml version="1.0" encoding="utf-8"?>
- <FDL version="1.5">
- <TypeDefinition url="..\default_typedef.xml"/>
- <Form id="cp_monthCal" classname="cp_monthCal" inheritanceid="" position="absolute 0 0 75 20" titletext="monthCalendar" onload="cp_monthCal_onload" scrollbars="none">
- <Layouts>
- <Layout>
- <Calendar id="cal_Month" taborder="0" autoselect="true" type="spin" dateformat="yyyy.MM" editformat="yyyy.MM" onchanged="cal_Month_onchanged" value="null" onkillfocus="cal_Month_onkillfocus" onkeydown="fn_onkeydown" anchor="left top right" position="absolute 0 0 75 20" positiontype="position"/>
- <Div id="div_Base" taborder="1" tabstop="false" style="background:white; " position2="absolute r:1 w:18 t:1 h:18" positiontype="position2"/>
- <Button id="btn_Cal" taborder="1" onclick="btn_Cal_onclick" class="btn_month" anchor="top right" position="absolute 55 0 75 20" positiontype="position"/>
- </Layout>
- </Layouts>
- <Script type="xscript4.0"><![CDATA[/***************************************************************************************
- * System Name : KMTC
- * Job Name : Composite
- * File Name : cp_monthCal.xfdl
- * Creator : TOBESOFT
- * Make Date : 2013.01.18
- *
- * Description : Calendar Month Select Composite
- *---------------------------------------------------------------------------------------
- * Modify Date Modifier Modify Description
- *---------------------------------------------------------------------------------------
- * 2013.01.18 TOBESOFT Initial Make Program
- *
- *---------------------------------------------------------------------------------------
- ****************************************************************************************/
- //=======================================================================================
- // Common Lib Include
- //---------------------------------------------------------------------------------------
- //include "Lib::xCommon.xjs";
- //=======================================================================================
- // Global Form Variable
- //---------------------------------------------------------------------------------------
- var iv_sMsRtn;
- var iv_event;
- var iv_sDate;
- var iv_bNotNull = true;
- /****************************************************************************************
- * Description : Form Initialization
- * Argument : obj : Object Event has occurred
- * : e : Event Object
- * return :
- ****************************************************************************************/
- function cp_monthCal_onload(obj:Form, e:LoadEventInfo)
- {
- var objDate = new Date();
- iv_sDate = objDate.toFormatString("%Y%m%d");
-
- cal_Month.value = iv_sDate.substring(0,6);
- }
- //=======================================================================================
- // 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 month button
- ****************************************************************************************/
- function btn_Cal_onclick(obj:Button, e:ClickEventInfo)
- {
- if(cal_Month.text == undefined){
- if(!utlf_isNull(cal_Month.value)){
- cal_Month.value = iv_sDate.substring(0,6);
- }
- }
-
- var strDate = ufn_getDateToStr(cal_Month.value);
-
- if(utlf_isNull(strDate)) strDate = utlf_getCurrentDate();
-
- var aRtn = ufn_Calendar(obj, "M", strDate);
-
- //trace(strDate+"::"+aRtn);
- if(aRtn <> null)
- {
- cal_Month.value = aRtn[0];
-
- 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 month changes
- ****************************************************************************************/
- function cal_Month_onchanged(obj:Calendar, e:ChangeEventInfo)
- {
- 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 : 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 : 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);
- }
- /****************************************************************************************
- * Description : User Composite Get Data Method
- * Argument : none
- * return : none
- ****************************************************************************************/
- function getData()
- {
- if(utlf_isNull(cal_Month.value)) return "";
- iv_sMsRtn = ufn_getDateToStr(cal_Month.value);
- iv_sMsRtn = iv_sMsRtn.substr(0,6);
- return iv_sMsRtn;
- }
- /****************************************************************************************
- * Description : User Composite Set Data Method
- * Argument : none
- * return : none
- ****************************************************************************************/
- function setData(sDay)
- {
- if(utlf_isNull(sDay)) cal_Month.value = "";
- if(!ufn_isDate(sDay)) return;
- cal_Month.value = sDay;
- }
- /****************************************************************************************
- * Description : User Composite Set Event Method
- * Argument : none
- * return : none
- ****************************************************************************************/
- function setCallEvent(sEvent)
- {
- iv_event = sEvent;
- }
- /****************************************************************************************
- * Description : User composite set required
- * Argument : none
- * return : none
- ****************************************************************************************/
- function setRequestment(bReq)
- {
- if(bReq)
- {
- cal_Month.class = "input_essential";
- }
- else
- {
- cal_Month.class = "";
- }
- }
- function setEnbale(bReq)
- {
- cal_Month.enable = bReq;
- btn_Cal.enable = bReq;
- }
- function setIsNull()
- {
- iv_bNotNull = false;
- }
- /****************************************************************************************
- * 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_gsCalendarDateFg;
- var iv_gsCalendarValue;
- var iv_gsCalendarNaviFq = 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 == "M")
- {
- sName = "PopDiv_CalendarM";
- sUrl = "COMPOSITE::Comm_monthCalendar.xfdl";
- objPdvCal.init(sName, 0, 0, 205, 191);
- 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.mvArgValue = vDate;
- objPdvCal.fn_CrCal(vDate);
-
- var nPosX = system.clientToScreenX(cal_Month, cal_Month.position.left);
- var nPosY = system.clientToScreenY(cal_Month, cal_Month.position.height);
- var rtn = objPdvCal.trackPopup(nPosX,nPosY);
-
- this.removeChild(sName);
- objPdvCal.destroy();
-
- return rtn;
- }
- function cal_Month_onkillfocus(obj:Calendar, e:KillFocusEventInfo)
- {
- if(iv_bNotNull)
- {
- if(ufn_isNull(obj.value)) obj.setFocus();
- }
- }
- ]]></Script>
- </Form>
- </FDL>
|