* include/hbvmpub.h
* include/extend.api
* include/hbwince.h
* include/hb_io.h
* include/hbdefs.h
* include/hbsetup.h
* include/hbinit.h
* include/clipdefs.h
* include/hbmath.h
* include/hbzlib.h
* include/hbregex.h
* include/hbexprb.c
* source/pp/hbpp.c
* source/lang/msgrukoi.c
* source/lang/msgzhgb.c
* source/lang/msgruwin.c
* source/lang/msgelwin.c
* source/lang/msgro.c
* source/lang/msghriso.c
* source/lang/msgcskam.c
* source/lang/msggl.c
* source/lang/msges.c
* source/lang/msgde.c
* source/lang/msgru866.c
* source/lang/msgcs852.c
* source/lang/msgplmaz.c
* source/lang/msgpliso.c
* source/lang/msgplwin.c
* source/lang/msgid.c
* source/lang/msgel.c
* source/lang/msgdewin.c
* source/lang/msghr437.c
* source/lang/msghr852.c
* source/lang/msgcsiso.c
* source/lang/msgcswin.c
* source/lang/msgeswin.c
* source/vm/macro.c
* source/vm/mainwin.c
* source/vm/maindll.c
* source/vm/itemapi.c
* source/vm/hvm.c
* source/vm/cmdarg.c
* source/vm/mainstd.c
* source/vm/maindllp.c
* source/vm/fm.c
* source/vm/extrap.c
* source/vm/thread.c
* source/vm/main.c
* source/vm/break.c
* source/vm/dynlibhb.c
* source/vm/set.c
* source/vm/classes.c
* source/debug/dbgtwin.prg
* source/debug/dbgtmenu.prg
* source/debug/dbgmenu.prg
* source/debug/dbgthsh.prg
* source/debug/dbgwa.prg
* source/common/hbgete.c
* source/common/hbver.c
* source/common/hbprintf.c
* source/common/hbfsapi.c
* source/common/hbverdsp.c
* source/common/hbwince.c
* source/common/hbfopen.c
* source/common/hbdate.c
* source/macro/macroa.c
* source/macro/macrob.c
* source/rtl/lennum.c
* source/rtl/gtdos/gtdos.c
* source/rtl/setposbs.c
* source/rtl/gtwin/gtwin.c
* source/rtl/typefile.prg
* source/rtl/math.c
* source/rtl/getsys53.prg
* source/rtl/tobject.prg
* source/rtl/gtcrs/gtcrs.c
* source/rtl/gtcrs/gtcrs.h
* source/rtl/philesx.c
* source/rtl/filehb.c
* source/rtl/hbtoken.c
* source/rtl/fstemp.c
* source/rtl/ampm.c
* source/rtl/maxrow.c
* source/rtl/hbstrfmt.c
* source/rtl/transfrm.c
* source/rtl/gttone.c
* source/rtl/datec.c
* source/rtl/fserr.c
* source/rtl/pushbtn.prg
* source/rtl/memvarbl.prg
* source/rtl/hbregexc.c
* source/rtl/profiler.prg
* source/rtl/hbini.prg
* source/rtl/dbedit.prg
* source/rtl/filesys.c
* source/rtl/lang.c
* source/rtl/einstv52.prg
* source/rtl/hbbit.c
* source/rtl/isprint.c
* source/rtl/altd.prg
* source/rtl/diskspac.c
* source/rtl/console.c
* source/rtl/gtos2/gtos2.c
* source/rtl/adir.prg
* source/rtl/gui.prg
* source/rtl/hbgtcore.c
* source/rtl/dirdrive.c
* source/rtl/wait.prg
* source/rtl/mlcfunc.c
* source/rtl/scrollbr.prg
* source/rtl/gtapiu.c
* source/rtl/tbrowsys.prg
* source/rtl/oemansi.c
* source/rtl/philes53.c
* source/rtl/color53.prg
* source/rtl/xsavescr.c
* source/rtl/tgetlist.prg
* source/rtl/gtsln/mousesln.c
* source/rtl/gtsln/kbsln.c
* source/rtl/gtsln/gtsln.h
* source/rtl/disksphb.c
* source/rtl/tlabel.prg
* source/rtl/radiogrp.prg
* source/rtl/scrrow.c
* source/rtl/net.c
* source/rtl/stuff.c
* source/rtl/checkbox.prg
* source/rtl/filebuf.c
* source/rtl/mtran.c
* source/rtl/gete.c
* source/rtl/hbproces.c
* source/rtl/gtwvt/gtwvt.c
* source/rtl/fssize.c
* source/rtl/memofile.c
* source/rtl/hbffind.c
* source/rtl/tmenuitm.prg
* source/rtl/gtsys.c
* source/rtl/devoutp.prg
* source/codepage/uckoi8.c
* source/codepage/uckoi8u.c
* source/codepage/cphu852s.c
* source/codepage/cpes850c.c
* source/codepage/cphuisos.c
* source/codepage/ucmaz.c
* source/codepage/cptr857.c
* source/codepage/ucmik.c
* source/codepage/cphr437.c
* source/codepage/cphuwins.c
* source/rdd/dbjoin.prg
* source/rdd/dbnubs.c
* source/rdd/dbfuncs.prg
* source/rdd/dbtotal.prg
* source/rdd/dbstrux.prg
* source/rdd/dbsort.prg
* source/rdd/dbfcdx/dbfcdx1.c
* source/rdd/hbsix/sxcompr.c
* source/compiler/hbmain.c
* source/compiler/expropta.c
* source/compiler/exproptb.c
* source/compiler/fixflex.c
* source/compiler/compi18n.c
* source/compiler/gencobj.c
* source/compiler/hbopt.c
* source/compiler/hbgenerr.c
* utils/hbtest/rt_main.h
* utils/hbtest/rt_main.ch
* utils/hbtest/rt_trans.prg
* utils/hbtest/rt_misc.prg
* utils/hbtest/rt_vars.ch
* contrib/gtalleg/gtalleg.c
* contrib/gtalleg/ssf.h
* contrib/hbmysql/mysqlold.c
* contrib/hbmysql/mysql.c
* contrib/hbct/charlist.c
* contrib/hbct/ctnet.c
* contrib/hbct/charonly.c
* contrib/hbct/ctset.c
* contrib/hbct/ctset.h
* contrib/hbct/cterror.ch
* contrib/hbct/ftoc.c
* contrib/hbct/charevod.c
* contrib/hbct/exponent.c
* contrib/hbct/dattime3.c
* contrib/hbct/ct.prg
* contrib/hbct/cursor.c
* contrib/hbct/color.c
* contrib/hbct/charone.c
* contrib/hbct/numconv.prg
* contrib/hbct/cttime.prg
* contrib/hbct/ctstr.h
* contrib/hbct/atnum.c
* contrib/hbct/disk.c
* contrib/hbct/misc1.c
* contrib/hbct/print.c
* contrib/xhb/hblog.ch
* contrib/xhb/bkgtsks.c
* contrib/xhb/wintypes.ch
* contrib/xhb/classex.ch
* contrib/xhb/hbcomprs.c
* contrib/xhb/ttable.ch
* contrib/xhb/hbcompat.ch
* contrib/xhb/arrayblk.prg
* contrib/xhb/hbctypes.ch
* contrib/xhb/xhbextrn.ch
* contrib/xhb/filestat.c
* contrib/xhb/hblogdef.ch
* contrib/xhb/xhbcopyf.c
* contrib/xhb/hbserv.c
* contrib/xhb/xhbfunc.c
* contrib/hbodbc/odbcold.c
* contrib/hbtpathy/telepath.ch
* contrib/hbmzip/hbmzip.c
* contrib/hbblat/hbblat.ch
* contrib/hbxbp/xbpfiledialog.prg
* contrib/hbxbp/gra.ch
* contrib/hbxbp/xbpwindow.prg
* contrib/hbxbp/xbp.ch
* contrib/hbxbp/xbphtmlviewer.prg
* contrib/hbxbp/xbptoolbar.prg
* contrib/hbxbp/appevent.ch
* contrib/hbxbp/xbpgeneric.prg
* contrib/xpp/philesx.c
* contrib/hbnf/acctyear.prg
* contrib/hbnf/byteneg.prg
* contrib/hbnf/isshare.prg
* contrib/hbnf/kspeed.c
* contrib/hbnf/prtscr.c
* contrib/hbnf/ftshadow.c
* contrib/hbnf/descendn.c
* contrib/hbnf/scancode.prg
* contrib/hbnf/vidmode.prg
* contrib/hbnf/acctadj.prg
* contrib/hbnf/vidcur.prg
* contrib/hbnf/iamidle.c
* contrib/hbnf/acctmnth.prg
* contrib/hbnf/madd.prg
* contrib/hbnf/fttext.c
* contrib/hbnf/mouse1.prg
* contrib/hbnf/settime.prg
* contrib/hbnf/page.prg
* contrib/hbnf/setkeys.c
* contrib/hbnf/month.prg
* contrib/hbnf/acctweek.prg
* contrib/hbnf/acctqtr.prg
* contrib/hbnf/dosver.prg
* contrib/hbnf/metaph.prg
* contrib/hbnf/menu1.prg
* contrib/hbnf/byteand.prg
* contrib/hbnf/bytexor.prg
* contrib/hbnf/byteor.prg
* contrib/hbnf/asum.prg
* contrib/hbnf/wda.prg
* contrib/hbnf/aavg.prg
* contrib/hbnf/mouse.c
* contrib/hbnf/setdate.prg
* contrib/hbnf/amedian.prg
* contrib/hbnf/blink.prg
* contrib/hbnf/getvid.c
* contrib/hbnf/getver.c
* contrib/hbnf/nwuid.prg
* contrib/hbnf/aemaxlen.prg
* contrib/hbnf/bitset.prg
* contrib/hbnf/nwlstat.prg
* contrib/hbnf/tempfile.prg
* contrib/hbnf/diskfunc.prg
* contrib/hbnf/d2e.prg
* contrib/hbnf/mouse2.prg
* contrib/hbnf/firstday.prg
* contrib/hbnf/menutonf.prg
* contrib/hbnf/pvid.prg
* contrib/hbnf/isbit.prg
* contrib/hbnf/datecnfg.prg
* contrib/hbnf/putkey.c
* contrib/hbnf/getenvrn.c
* contrib/hbnf/bytenot.prg
* contrib/hbnf/aeminlen.prg
* contrib/hbnf/year.prg
* contrib/hbnf/ftmenuto.ch
* contrib/hbnf/rmdir.c
* contrib/hbnf/sysmem.prg
* contrib/hbnf/bitclr.prg
* contrib/hbnf/setlastk.c
* contrib/hbnf/clrsel.prg
* contrib/hbcurl/hbcurl.ch
* contrib/gtwvg/gtwvg.c
* contrib/gtwvg/wvgax.prg
* contrib/gtwvg/gtwvg.h
* contrib/gtwvg/wvggui.c
* contrib/gtwvg/wvggui.h
* contrib/gtwvg/wvgwin.c
* contrib/gtwvg/wvgutils.c
* contrib/gtwvg/wvgcore.c
* contrib/gtwvg/wvgtabpg.prg
* contrib/gtwvg/wvgsink.c
* contrib/gtwvg/wvgwing.c
* contrib/hbclipsm/num.c
* contrib/hbclipsm/stack.c
* contrib/rddads/rddads.h
* contrib/rddads/ads1.c
* contrib/hbfimage/fi_winfu.c
* contrib/hbfimage/fi_wrp.c
* contrib/hbgd/gd.ch
* contrib/hbgd/gdchart.prg
* contrib/hbgd/gdimage.prg
* contrib/hbgd/gdwrp.c
* contrib/hbmisc/nconvert.prg
* contrib/hbmisc/stringsx.c
* contrib/hbmisc/spd.c
* contrib/hbmisc/stringp.prg
* contrib/hbwin/win_prn2.c
* contrib/hbwin/wapi_commctrl.c
* contrib/hbwin/wapi_winbase.c
* contrib/hbwin/wapi_winuser.c
* contrib/hbwin/hbwinole.h
* contrib/hbwin/win_dll.c
* contrib/hbwin/axfunc.prg
* contrib/hbwin/win_prn1.c
* contrib/hbvpdf/hbvpdf.ch
* examples/hboleold/win_ole.c
* Formatting:
- Removing EOL whitespaces.
- Removing extra empty lines at EOF.
- Adding EOL at EOF if missing.
(except in foreign code)
335 lines
11 KiB
Plaintext
335 lines
11 KiB
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
/*
|
|
* File......: datecnfg.prg
|
|
* Author....: Jo W. French dba Practical Computing
|
|
* CIS ID....: 74730,1751
|
|
*
|
|
* The functions contained herein are the original work of Jo W. French
|
|
* and are placed in the public domain.
|
|
*
|
|
* Modification history:
|
|
* ---------------------
|
|
*
|
|
* Rev 1.3 28 Sep 1992 00:34:08 GLENN
|
|
* Jo French clean up.
|
|
*
|
|
* Rev 1.2 15 Aug 1991 23:05:10 GLENN
|
|
* Forest Belt proofread/edited/cleaned up doc
|
|
*
|
|
* Rev 1.1 14 Jun 1991 19:51:26 GLENN
|
|
* Minor edit to file header
|
|
*
|
|
* Rev 1.0 01 Apr 1991 01:01:00 GLENN
|
|
* Nanforum Toolkit
|
|
*
|
|
*/
|
|
|
|
|
|
#ifdef FT_TEST
|
|
********************************************************************
|
|
*
|
|
* NOTES: 1) The date functions are 'international'; i.e., the
|
|
* system date format is maintained, although ANSI is
|
|
* temporarily used within certain functions.
|
|
*
|
|
* 2) The date functions fall into two categories:
|
|
*
|
|
* a) Calendar or fiscal periods.
|
|
* A calendar or fiscal year is identified by the year()
|
|
* of the last date in the year.
|
|
*
|
|
* b) Accounting Periods. An accounting period has the
|
|
* following characteristics:
|
|
* If the first week of the period contains 4 or
|
|
* more 'work' days, it is included in the period;
|
|
* otherwise, the first week was included in the
|
|
* prior period.
|
|
*
|
|
* If the last week of the period contains 4 or more
|
|
* 'work' days it is included in the period; otherwise,
|
|
* the last week is included in the next period.
|
|
* This results in 13 week 'quarters' and 4 or 5 week
|
|
* 'months'. Every 5 or 6 years, a 'quarter' will contain
|
|
* 14 weeks and the year will contain 53 weeks.
|
|
*
|
|
* 3) The date functions require the presence of two variables:
|
|
*
|
|
* a) cFY_Start is a character string used to define the
|
|
* first day of a calendar or fiscal year. It's format
|
|
* is ANSI; e.g., "1980.01.01" defines a calendar year,
|
|
* "1980.10.01" defines a fiscal year, starting October 1.
|
|
*
|
|
* The year may be any valid year. It's value has no
|
|
* effect on the date functions. The day is assumed to be
|
|
* less than 29. See function: FT_DATECNFG().
|
|
*
|
|
* B) nDow_Start is a number from 1 to 7 which defines the
|
|
* starting day, DOW(), of a work week; e.g., 1 == Sunday.
|
|
*
|
|
* See function: FT_DATECNFG()
|
|
*
|
|
* COMPILE ALL PROGRAMS WITH /N /W /A
|
|
*
|
|
********************************************************************
|
|
|
|
FUNCTION DEMO()
|
|
LOCAL nNum, dDate, aTestData := {}, aTemp, cFY_Start, nDOW_Start
|
|
|
|
* SET DATE American // User's normal date format
|
|
aTemp := FT_DATECNFG() // Get/Set cFY_Start & nDOW_Start.
|
|
* aTemp := FT_DATECNFG("03/01/80", 1) // Date string in user's format.
|
|
cFY_Start := aTemp[1] // See FT_DATECNFG() in ft_date0.prg
|
|
NDOW_START := ATEMP[2] // FOR PARAMETERS.
|
|
DDATE := DATE()
|
|
* dDate := CTOD("02/29/88") // Test date, in user's normal date format
|
|
|
|
cls
|
|
? "Given Date: "
|
|
?? dDate
|
|
?? " cFY_Start: "+ cFY_Start
|
|
?? " nDOW_Start:" + STR(nDOW_Start,2)
|
|
? "---- Fiscal Year Data -----------"
|
|
|
|
aTestData := FT_YEAR(dDate)
|
|
? "FYYear ", aTestData[1]+" ", aTestData[2], aTestData[3]
|
|
|
|
aTestData := FT_QTR(dDate)
|
|
? "FYQtr ", aTestData[1], aTestData[2], aTestData[3]
|
|
|
|
nNum := VAL(SUBSTR(aTestData[1],5,2))
|
|
aTestData := FT_QTR(dDate,nNum)
|
|
? "FYQtr "+STR(nNum,2), aTestData[1], aTestData[2], aTestData[3]
|
|
|
|
aTestData := FT_MONTH(dDate)
|
|
? "FYMonth ", aTestData[1], aTestData[2], aTestData[3]
|
|
|
|
nNum := VAL(SUBSTR(aTestData[1],5,2))
|
|
aTestData := FT_MONTH(dDate,nNum)
|
|
? "FYMonth "+STR(nNum,2), aTestData[1], aTestData[2], aTestData[3]
|
|
|
|
aTestData := FT_WEEK(dDate)
|
|
? "FYWeek ", aTestData[1], aTestData[2], aTestData[3]
|
|
|
|
nNum := VAL(SUBSTR(aTestData[1],5,2))
|
|
aTestData := FT_WEEK(dDate,nNum)
|
|
? "FYWeek "+STR(nNum,2), aTestData[1], aTestData[2], aTestData[3]
|
|
|
|
aTestData := FT_DAYOFYR(dDate)
|
|
? "FYDay ", aTestData[1], aTestData[2], aTestData[3]
|
|
|
|
nNum := VAL(SUBSTR(aTestData[1],5,3))
|
|
aTestData := FT_DAYOFYR(dDate,nNum)
|
|
? "FYDAY "+STR(nNum,3), aTestData[1], aTestData[2], aTestData[3]
|
|
|
|
?
|
|
? "---- Accounting Year Data -------"
|
|
|
|
aTestData := FT_ACCTYEAR(dDate)
|
|
? "ACCTYear ", aTestData[1]+" ", aTestData[2], aTestData[3],;
|
|
STR( (aTestData[3] - aTestData[2] + 1) /7, 3 ) + " Weeks"
|
|
|
|
aTestData := FT_ACCTQTR(dDate)
|
|
? "ACCTQtr ", aTestData[1], aTestData[2], aTestData[3],;
|
|
STR( (aTestData[3] - aTestData[2] + 1) /7, 3 ) + " Weeks"
|
|
|
|
nNum := VAL(SUBSTR(aTestData[1],5,2))
|
|
aTestData := FT_ACCTQTR(dDate,nNum)
|
|
? "ACCTQtr "+STR(nNum,2), aTestData[1], aTestData[2], aTestData[3]
|
|
|
|
aTestData := FT_ACCTMONTH(dDate)
|
|
? "ACCTMonth ", aTestData[1], aTestData[2], aTestData[3],;
|
|
STR( (aTestData[3] - aTestData[2] + 1) /7, 3 ) + " Weeks"
|
|
|
|
nNum := VAL(SUBSTR(aTestData[1],5,2))
|
|
aTestData := FT_ACCTMONTH(dDate,nNum)
|
|
? "ACCTMonth"+STR(nNum,2), aTestData[1], aTestData[2], aTestData[3]
|
|
|
|
aTestData := FT_ACCTWEEK(dDate)
|
|
? "ACCTWeek ", aTestData[1], aTestData[2], aTestData[3]
|
|
|
|
nNum := VAL(SUBSTR(aTestData[1],5,2))
|
|
aTestData := FT_ACCTWEEK(dDate,nNum)
|
|
? "ACCTWeek "+STR(nNum,2), aTestData[1], aTestData[2], aTestData[3]
|
|
|
|
aTestData := FT_DAYOFYR(dDate,,.T.)
|
|
? "ACCTDay ", aTestData[1], aTestData[2], aTestData[3]
|
|
|
|
nNum := VAL(SUBSTR(aTestData[1],5,3))
|
|
aTestData := FT_DAYOFYR(dDate,nNum,.T.)
|
|
? "ACCTDay "+STR(nNum,3), aTestData[1], aTestData[2], aTestData[3]
|
|
|
|
WAIT
|
|
|
|
FT_CAL(dDate)
|
|
FT_CAL(dDate,1)
|
|
|
|
RETURN NIL
|
|
|
|
|
|
* DEMO Monthly Calendar function.
|
|
* nType : 0 = FT_MONTH, 1 = FT_ACCTMONTH
|
|
*
|
|
|
|
FUNCTION FT_CAL(dGivenDate,nType)
|
|
LOCAL nTemp, dTemp, aTemp, cFY_Start, dStart, dEnd
|
|
|
|
aTemp := FT_DATECNFG()
|
|
cFY_Start := aTemp[1]
|
|
|
|
IF dGivenDate == NIL .OR. !VALTYPE(dGivenDate) $ 'ND'
|
|
dGivenDate := DATE()
|
|
ELSEIF VALTYPE(dGivenDate) == 'N'
|
|
nType := dGivenDate
|
|
dGivenDate := DATE()
|
|
ENDIF
|
|
|
|
nType := iif(nType == NIL .OR. VALTYPE(nType) != 'N', 0, nType)
|
|
|
|
IF nType == 0
|
|
IF SUBSTR(cFY_Start,6,5) == "01.01"
|
|
? " Calendar Month Calendar containing " + DTOC(dGivenDate)
|
|
ELSE
|
|
? " Fiscal Month Calendar containing " + DTOC(dGivenDate)
|
|
ENDIF
|
|
|
|
aTemp := FT_MONTH(dGivenDate)
|
|
dStart := aTemp[2]
|
|
dEnd := aTemp[3]
|
|
aTemp[2] -= FT_DAYTOBOW(aTemp[2])
|
|
aTemp[3] += 6 - FT_DAYTOBOW(aTemp[3])
|
|
ELSE
|
|
? " Accounting Month Calendar containing " + DTOC(dGivenDate)
|
|
aTemp := FT_ACCTMONTH(dGivenDate)
|
|
ENDIF
|
|
|
|
?
|
|
dTemp := aTemp[2]
|
|
|
|
FOR nTemp := 0 to 6
|
|
?? PADC( CDOW(dTemp + nTemp),10)
|
|
NEXT
|
|
|
|
?
|
|
WHILE dTemp <= aTemp[3]
|
|
FOR nTemp = 1 TO 7
|
|
?? " "
|
|
IF nType == 0 .AND. (dTemp < dStart .or. dTemp > dEnd)
|
|
?? SPACE(8)
|
|
ELSE
|
|
?? dTemp
|
|
ENDIF
|
|
?? " "
|
|
dTemp ++
|
|
NEXT
|
|
?
|
|
END
|
|
|
|
RETURN NIL
|
|
|
|
#endif
|
|
|
|
/* $DOC$
|
|
* $FUNCNAME$
|
|
* FT_DATECNFG()
|
|
* $CATEGORY$
|
|
* Date/Time
|
|
* $ONELINER$
|
|
* Set beginning of year/week for FT_ date functions
|
|
* $SYNTAX$
|
|
* FT_DATECNFG( [ <cFYStart> ], [ <nDow> ] ) -> aDateInfo
|
|
* $ARGUMENTS$
|
|
* <cFYStart> is a character date string in the user's system date
|
|
* format, i.e., the same as the user would enter for CTOD(). If
|
|
* this argument is NIL, the current value is unchanged.
|
|
*
|
|
* Note: The year portion of the date string must be present and
|
|
* be a valid year; however, it has no real meaning.
|
|
*
|
|
* <nDow> is a number from 1 to 7 (1 = Sunday) indicating the
|
|
* desired start of a work week. If this argument is NIL,
|
|
* the current value is unchanged.
|
|
*
|
|
* $RETURNS$
|
|
* A 2-element array containing the following information:
|
|
*
|
|
* aDateInfo[1] - an ANSI date string indicating the beginning
|
|
* date of the year. Only the month and day are
|
|
* meaningful.
|
|
*
|
|
* aDateInfo[2] - the number of the first day of the week
|
|
* (1 = Sunday)
|
|
*
|
|
* $DESCRIPTION$
|
|
* FT_DATECNFG() is called internally by many of the date functions
|
|
* in the library to determine the beginning of year date and
|
|
* beginning of week day.
|
|
*
|
|
* The default beginning of the year is January 1st and the default
|
|
* beginning of the week is Sunday (day 1). Either or both of these
|
|
* settings may be changed by calling FT_DATECNFG() with the proper
|
|
* arguments. They will retain their values for the duration of the
|
|
* program or until they are changed again by a subsequent call to
|
|
* FT_DATECNFG().
|
|
*
|
|
* It is not necessary to call FT_DATECNFG() unless you need to
|
|
* change the defaults.
|
|
*
|
|
* FT_DATECNFG() affects the following library functions:
|
|
*
|
|
* FT_WEEK() FT_ACCTWEEK() FT_DAYTOBOW()
|
|
* FT_MONTH() FT_ACCTMONTH() FT_DAYOFYR()
|
|
* FT_QTR() FT_ACCTQTR() FT_ACCTADJ()
|
|
* FT_YEAR() FT_ACCTYEAR()
|
|
* $EXAMPLES$
|
|
* // Configure library date functions to begin year on
|
|
* // July 1st.
|
|
*
|
|
* FT_DATECNFG("07/01/80") // year is insignificant
|
|
*
|
|
* // Examples of return values:
|
|
*
|
|
* // System date format: American aArray[1] aArray[2]
|
|
*
|
|
* aArray := FT_DATECNFG() // '1980.01.01' 1 (Sun.)
|
|
* aArray := FT_DATECNFG('07/01/80') // '1980.07.01' 1 (Sun.)
|
|
* aArray := FT_DATECNFG('07/01/80', 2) // '1980.07.01' 2 (Mon.)
|
|
* aArray := FT_DATECNFG( , 2 ) // '1980.01.01' 2 (Mon.)
|
|
*
|
|
* // System date format: British
|
|
*
|
|
* aArray := FT_DATECNFG('01/07/80', 2) // '1980.07.01' 2 (Mon.)
|
|
* $SEEALSO$
|
|
* FT_ACCTADJ()
|
|
* $END$
|
|
*/
|
|
|
|
FUNCTION FT_DATECNFG( cFYStart ,nDow )
|
|
|
|
STATIC aDatePar := { "1980.01.01", 1 }
|
|
|
|
LOCAL dCheck, cDateFormat := SET(_SET_DATEFORMAT)
|
|
|
|
IF VALTYPE( cFYStart ) == 'C'
|
|
dCheck := CTOD( cFYStart )
|
|
IF DTOC( dCheck ) != " "
|
|
|
|
/* No one starts a Fiscal Year on 2/29 */
|
|
IF MONTH(dCheck) == 2 .and. DAY(dcheck) == 29
|
|
dCheck --
|
|
ENDIF
|
|
|
|
SET(_SET_DATEFORMAT, "yyyy.mm.dd")
|
|
aDatePar[1] := DTOC(dCheck)
|
|
SET(_SET_DATEFORMAT, cDateFormat)
|
|
ENDIF
|
|
ENDIF
|
|
|
|
IF VALTYPE( nDow ) == 'N' .AND. nDow > 0 .AND. nDow < 8
|
|
aDatePar[2] := nDow
|
|
ENDIF
|
|
|
|
RETURN ACLONE( aDatePar )
|