Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SBT and Y2K
Message
 
To
02/09/1999 14:12:25
General information
Forum:
Visual FoxPro
Category:
Third party products
Title:
Miscellaneous
Thread ID:
00260731
Message ID:
00260784
Views:
9
>does anyone know if SBT is using any rollover command in their version application. Do you know how they are handing their set century. I am starting to get really nervous they more I look at this application and all of the date conversions.
>
>Thanks
>Darren Mc Dowell

NO.

Here is the one of date validation functions:
*- Version....: SBT Pro Series 5.00.00
*- File Name..: $Workfile: G_VALDTE.PRG $
*- Combined into system procedure file SBTPROC for compilation
*- VCS Level..: $Revision: 1.10 $
*- Last Update: $Date: 28 Apr 1998 10:40:16 $
*------------------------------------------------------------------------------
*- Notice.....: Copyright (c) 1985-1998 SBT Corporation. All rights reserved.
*------------------------------------------------------------------------------
*- Description: Validate date entry
*------------------------------------------------------------------------------
*- Synopsis...: Tests for valid character date or date values.
*- Optionally rejects blank dates
*- NOTE: Doesn't check valid date fields. FoxPro traps this.
*- in PRO series we enter dates on option grids as strings.
*-
*- This function is called to validate option grid dates.
*-
*- If date is a transaction date, calls fiscal calendar
*- validation function.
*------------------------------------------------------------------------------
*- Calls......: C_RETFV(), G_CHKKEY(), G_DSPALT
*------------------------------------------------------------------------------
*- Passed:
*- Variables..: gc_link
*-
*- Parameters.: ll_noblnk, .t. to reject blank dates and issue warning
*- ll_fiscal, .t. if date is a transaction date and must
*- be checked against fiscal calendar
*- ll_prior, .t. if user can post to prior fiscal year
*- lc_varbl, Date object name
*-
*- Files Open.: None
*-
*- Objects....: None
*------------------------------------------------------------------------------
*- Returns:
*- Variables..: Numeric, 0 if date invalid
*- 1 if date valid
*- -1 if date valid when the up arrow is pressed
*-
*- Parameters.: None
*-
*- Files Open.: None
*-
*- Objects....: None
*------------------------------------------------------------------------------
*- Example:
*- GET lc_date PICTURE gc_datepi8 VALID g_valdte()
*------------------------------------------------------------------------------
FUNCTION g_valdte

PARAMETERS ll_noblnk, ;
ll_fiscal, ;
ll_prior, ;
lc_varbl

PRIVATE ln_return, ;
lc_msg, ;
lc_vartyp, ;
lc_varnam, ;
ld_date, ;
lc_dateval, ;
ln_offset

*-- Setup return variable to show success initially
ln_return = 1

*-- Stores correction factor if date is 02/29/00
ln_offset = 0

*-- Record information on current variable
IF TYPE("lc_varbl") <> "C"
lc_vartyp = TYPE(g_curvar())
lc_varnam = g_curvar()
ELSE
lc_vartyp = TYPE(lc_varbl)
lc_varnam = lc_varbl
ENDIF

lc_msg = ""

IF lc_vartyp = "C"
*-- Only bad CHAR dates fails and issues alert.
*-- If actual date type variable, FoxPro will have trapped already.
lc_dateval = EVALUATE(lc_varnam)

*-- The string "02/29/00" is interpreted by FoxPro as "02/29/1900"
*-- Take care as 1900 is not a leap year unlike 2000
IF ALLTRIM(lc_dateval) == "02/29/00"
lc_dateval = PADR("02/28/00", LEN(lc_dateval))

*-- Number of days to add to determine actual date
ln_offset = 1
ENDIF

ld_date = CTOD(lc_dateval)

IF lc_dateval <> DTOC(ld_date)
ln_return = 0
lc_msg = "Invalid Date. Please reenter..."
ENDIF

IF " " $ lc_dateval AND ll_noblnk
ln_return = 0
lc_msg = "Date cannot be blank. Please reenter..."
ENDIF

IF ln_return = 1 AND ll_fiscal AND gl_gllink AND LEN(lc_dateval) = 8
*-- Re-initialize date with proper century value
*-- The date is used for fiscal calendar validation
ld_date = g_retdt(lc_dateval) + ln_offset
ENDIF

ELSE
ld_date = EVALUATE(lc_varnam)

IF EMPTY(ld_date) AND ll_noblnk
ln_return = 0
lc_msg = "Date cannot be blank. Please reenter..."
ENDIF

ENDIF

IF ln_return = 1 AND ll_fiscal AND gl_gllink
*-- Call fiscal calendar validation
ln_return = c_retfv(gc_link, ld_date, .f., ll_prior)
ENDIF

IF ln_return = 1
ln_return = g_chkkey(LASTKEY(), 1)

*-- To remove the CHR(13) on blanking which forces validation from
*-- skipping two fields after validation
CLEAR TYPEAHEAD
ELSE

IF NOT EMPTY(lc_msg)
DO g_dspalt WITH lc_msg, 2
ENDIF

ENDIF

RETURN ln_return
*------------------------------------------------------------------------------
*- End Function...: $Workfile: G_VALDTE.PRG $
*------------------------------------------------------------------------------
Previous
Reply
Map
View

Click here to load this message in the networking platform