Gupta.narod.ru - примеры программирования на Gupta Team Developer 2005 (GTD, CTD, TOM, Quest, SQLTalk, Report Builder, SQLWindows, SQLBase, Oracle, Web Developer, Team Object Manager)

Найти: на
Скачать пример в архиве SalDate
Вернуться на страницу архива примеров

.head 0 +  Application Description: Centura SQLWindows/32 Standard Application Template
.head 1 -  Outline Version - 4.0.27
.head 1 +  Design-time Settings
.data VIEWINFO
0000: 6F00000001000000 FFFF01000D004347 5458566965775374 6174650400010000
0020: 0000000000CD0000 002C000000020000 0003000000FFFFFF FFFFFFFFFFFCFFFF
0040: FFE9FFFFFFFFFFFF FF000000007C0200 004D010000010000 0001000000010000
0060: 000F4170706C6963 6174696F6E497465 6D0100000012496E 7465726E616C2046
0080: 756E6374696F6E73
.enddata
.head 2 -  Outline Window State: Normal
.head 2 +  Outline Window Location and Size
.data VIEWINFO
0000: 6600040003002D00 0000000000000000 0000B71E5D0E0500 1D00FFFF4D61696E
0020: 0000000000000000 0000000000000000 0000003B00010000 00000000000000E9
0040: 1E800A00008600FF FF496E7465726E61 6C2046756E637469 6F6E730000000000
0060: 0000000000000000 0000000000003200 0100000000000000 0000E91E800A0000
0080: DF00FFFF56617269 61626C6573000000 0000000000000000 0000000000000000
00A0: 3000010000000000 00000000F51E100D 0000F400FFFF436C 6173736573000000
00C0: 0000000000000000 0000000000000000
.enddata
.data VIEWSIZE
0000: D000
.enddata
.head 3 -  Left: -0.013"
.head 3 -  Top:    0.0"
.head 3 -  Width:  8.013"
.head 3 -  Height: 4.969"
.head 2 +  Options Box Location
.data VIEWINFO
0000: D4180909B80B1A00
.enddata
.data VIEWSIZE
0000: 0800
.enddata
.head 3 -  Visible? No
.head 3 -  Left: 4.15"
.head 3 -  Top:    1.885"
.head 3 -  Width:  3.8"
.head 3 -  Height: 2.073"
.head 2 +  Class Editor Location
.head 3 -  Visible? No
.head 3 -  Left: 0.575"
.head 3 -  Top:    0.094"
.head 3 -  Width:  5.063"
.head 3 -  Height: 2.719"
.head 2 +  Tool Palette Location
.head 3 -  Visible? No
.head 3 -  Left: 6.388"
.head 3 -  Top:    0.729"
.head 2 -  Fully Qualified External References? Yes
.head 2 -  Reject Multiple Window Instances? No
.head 2 -  Enable Runtime Checks Of External References? Yes
.head 2 -  Use Release 4.0 Scope Rules? No
.head 1 -  Libraries
.head 1 +  Global Declarations
.head 2 +  Window Defaults
.head 3 +  Tool Bar
.head 4 -  Display Style? Etched
.head 4 -  Font Name: MS Sans Serif
.head 4 -  Font Size: 8
.head 4 -  Font Enhancement: System Default
.head 4 -  Text Color: System Default
.head 4 -  Background Color: System Default
.head 3 +  Form Window
.head 4 -  Display Style? Etched
.head 4 -  Font Name: MS Sans Serif
.head 4 -  Font Size: 8
.head 4 -  Font Enhancement: System Default
.head 4 -  Text Color: System Default
.head 4 -  Background Color: System Default
.head 3 +  Dialog Box
.head 4 -  Display Style? Etched
.head 4 -  Font Name: MS Sans Serif
.head 4 -  Font Size: 8
.head 4 -  Font Enhancement: System Default
.head 4 -  Text Color: System Default
.head 4 -  Background Color: System Default
.head 3 +  Top Level Table Window
.head 4 -  Font Name: MS Sans Serif
.head 4 -  Font Size: 8
.head 4 -  Font Enhancement: System Default
.head 4 -  Text Color: System Default
.head 4 -  Background Color: System Default
.head 3 +  Data Field
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Multiline Field
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Spin Field
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Background Text
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Pushbutton
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 3 +  Radio Button
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Check Box
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Option Button
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 3 +  Group Box
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Child Table Window
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  List Box
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Combo Box
.head 4 -  Font Name: Use Parent
.head 4 -  Font Size: Use Parent
.head 4 -  Font Enhancement: Use Parent
.head 4 -  Text Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 3 +  Line
.head 4 -  Line Color: Use Parent
.head 3 +  Frame
.head 4 -  Border Color: Use Parent
.head 4 -  Background Color: 3D Face Color
.head 3 +  Picture
.head 4 -  Border Color: Use Parent
.head 4 -  Background Color: Use Parent
.head 2 +  Formats
.head 3 -  Number: 0'%'
.head 3 -  Number: #0
.head 3 -  Number: ###000
.head 3 -  Number: ###000;'($'###000')'
.head 3 -  Date/Time: hh:mm:ss AMPM
.head 3 -  Date/Time: M/d/yy
.head 3 -  Date/Time: MM-dd-yy
.head 3 -  Date/Time: dd-MMM-yyyy
.head 3 -  Date/Time: MMM d, yyyy
.head 3 -  Date/Time: MMM d, yyyy hh:mm AMPM
.head 3 -  Date/Time: MMMM d, yyyy hh:mm AMPM
.head 2 -  External Functions
.head 2 +  Constants
.data CCDATA
0000: 3000000000000000 0000000000000000 00000000
.enddata
.data CCSIZE
0000: 1400
.enddata
.head 3 -  System
.head 3 -  User
.head 2 -  Resources
.head 2 -  Variables
.head 2 +  Internal Functions
.head 3 +  Function: SalDateToStrX
.head 4 -  Description: author: 	tl
date:	2000
version:	1.00

Converts a date into string
.head 4 +  Returns
.head 5 -  String:
.head 4 +  Parameters
.head 5 -  Date/Time: ldDate
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  String: lsDummy
.head 4 +  Actions
.head 5 -  Call SalDateToStr( ldDate, lsDummy )
.head 5 -  Return lsDummy
.head 3 +  Function: SalDateSub
.head 4 -  Description: Matthias Rossmayer  (www.acclaro.de)
   date:   22.01.2004
   Problems with rounding fixed
   dtEnde 10:20   dtStart 08:40  returnted NULL
version:	1.02

author: 	Philippe Gibone
date:	2002
version:	1.01
Returns the difference between to dates under the format : HHHH:MM:SS
.head 4 +  Returns
.head 5 -  String:
.head 4 +  Parameters
.head 5 -  Date/Time: dtEnde
.head 5 -  Date/Time: dtStart
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  Number: lvnDifference
.head 5 -  Number: lvnStunde
.head 5 -  Number: lvnMinute
.head 5 -  Number: lvnSekunde
.head 5 -  String: lvstrTime_Diff
.head 4 +  Actions
.head 5 +  If dtStart > dtEnde
.head 6 -  Return STRING_Null
.head 5 -  Set lvnDifference = (dtEnde - dtStart) * 24
.head 5 -  Set lvnStunde = SalNumberFloor(lvnDifference)
.head 5 -  Set lvnDifference = (lvnDifference - lvnStunde) * 60
.head 5 -  Set lvnMinute = SalNumberFloor(lvnDifference)
.head 5 -  Set lvnSekunde = SalNumberRound((lvnDifference - lvnMinute) * 60)
.head 5 -  ! 040122 rm
.head 5 +  If lvnSekunde = 60
.head 6 -  Set lvnSekunde = 0
.head 6 -  Set lvnMinute = lvnMinute + 1
.head 5 +  If lvnMinute = 60
.head 6 -  Set lvnMinute = 0
.head 6 -  Set lvnStunde = lvnStunde + 1
.head 5 -  ! 040122 rm
.head 5 -  ! ------------------------------------------------------------------------
.head 5 -  Set lvstrTime_Diff = SalNumberToStrX(lvnStunde, 0 )
.head 5 +  If SalStrLength(lvstrTime_Diff) < 2
.head 6 -  Set lvstrTime_Diff = SalStrRightX( '00' || lvstrTime_Diff, 2)
.head 5 -  Set lvstrTime_Diff = lvstrTime_Diff  ||':'|| SalStrRightX( '00' || SalNumberToStrX(lvnMinute,0), 2) ||':'|| SalStrRightX( '00' || SalNumberToStrX(lvnSekunde,0), 2)
.head 5 -  Return lvstrTime_Diff
.head 3 +  Function: SalDateWeekNumber
.head 4 -  Description: author: 	??? (iceteagroup)
date:  	??.??.2000
version 	1.0

desc:
Calculates the week number of a given date

example:
Set nWeekNumber = SalDateWeekNumber( SalDateCurrent() )
.head 4 +  Returns
.head 5 -  Number:
.head 4 +  Parameters
.head 5 -  Date/Time: dtDate
.data INHERITPROPS
0000: 0100
.enddata
.head 4 -  Static Variables
.head 4 -  Local variables
.head 4 +  Actions
.head 5 -  Return ( SalDateWeekBegin( dtDate ) - SalDateWeekBegin( SalDateConstruct( SalDateYear( SalDateWeekBegin( dtDate ) + 3 ), 1, 4, 0, 0, 0 ) ) ) / 7 + 1
.head 3 +  Function: SalDateGetSysFmt
.head 4 -  Description: author: 	tl
version 	1.1 -  01.09.2004 - tl
                      - added support for more Formatmasks
	1.0 -  ??.??.2003 - tl
	-function implemented

desc:
Returns the system format of  DATE, TIME or DATETIME

example:
Set lsFmt = SalDateGetSysFmt( FMT_Format_Datetime )
.head 4 +  Returns
.head 5 -  String:
.head 4 +  Parameters
.head 5 +  Number: pnFormat
.head 6 -  ! FMT_Format_Date or FMT_Format_DateTime or FMT_Format_Time
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  String: lsFmtSysDate
.head 5 -  String: lsFmtSysTime
.head 5 -  String: lsFmtSys
.head 4 +  Actions
.head 5 -  Call SalStrSetBufferLength ( lsFmtSysDate, 99 )
.head 5 -  Call SalStrSetBufferLength ( lsFmtSysTime, 99 )
.head 5 +  Select Case pnFormat
.head 6 +  Case FMT_Format_Date
.head 7 -  Call GetLocaleInfoA( LOCALE_SYSTEM_DEFAULT, LOCALE_SSHORTDATE, lsFmtSysDate, 99 )
.head 7 -  Set lsFmtSys = lsFmtSysDate
.head 7 -  Break
.head 6 +  Case FMT_Format_DateTime
.head 7 -  Call GetLocaleInfoA( LOCALE_SYSTEM_DEFAULT, LOCALE_SSHORTDATE , lsFmtSysDate, 99 )
.head 7 -  Call GetLocaleInfoA( LOCALE_SYSTEM_DEFAULT, LOCALE_STIMEFORMAT, lsFmtSysTime, 99 )
.head 7 -  Set lsFmtSysTime = VisStrSubstitute(lsFmtSysTime,'H','hh')
.head 7 -  Set lsFmtSys = lsFmtSysDate || " " || lsFmtSysTime
.head 7 -  Break
.head 6 +  Case FMT_Format_Time
.head 7 -  Call GetLocaleInfoA( LOCALE_SYSTEM_DEFAULT, LOCALE_STIMEFORMAT, lsFmtSysTime, 99 )
.head 7 -  Set lsFmtSysTime = VisStrSubstitute(lsFmtSysTime,'H','hh')
.head 7 -  Set lsFmtSys = lsFmtSysTime
.head 7 -  Break
.head 5 -  Return lsFmtSys
.head 3 +  Function: SalDateMondayWeekNumber
.head 4 -  Description: author: 	Philippe Gibone
date:  	10/07/2002
version 	1.0

desc:	Calculates the Monday of the week known by its number (and year)

return : 	DATTIME_Null, if any error (no test on the year)

example:	Set dMonday = SalDateMondayWeekNumber( 24, 2002 )
.head 4 +  Returns
.head 5 -  Date/Time:
.head 4 +  Parameters
.head 5 -  Number: nWeek
.head 5 -  Number: nYear
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  Date/Time: dStart
.head 5 -  Number: nDay
.head 4 +  Actions
.head 5 +  If nWeek > SalDateWeekNumber(SalDateConstruct(nYear, 12, 28, 0, 0, 0)) OR nWeek < 0
.head 6 -  Return DATETIME_Null
.head 5 -  Set dStart = SalDateConstruct (nYear, 1, 1, 0, 0, 0)
.head 5 -  Set nDay = SalDateWeekday(dStart)
.head 5 -  Set nDay = SalNumberMod( nDay + 5, 7 )
.head 5 -  Set nDay = 7 * (nWeek - 1)  - nDay + 7 * SalNumberRound( nDay/7 )
.head 5 -  Return dStart + nDay
.head 3 +  Function: SalDateAddMonth
.head 4 -  Description: author: 	Philippe Gibone
date:  	10/07/2002
version 	1.0

desc:	Add (or substract) months to a date
	The rule is : if the day of the current month is larger than the last day of the resulting month
	the date is set to the last day of the resulting month

example:	Set dMonday = SalDateAddMonth( SalDateCurrent(), -6)
.head 4 +  Returns
.head 5 -  Date/Time:
.head 4 +  Parameters
.head 5 -  Date/Time: dDate
.head 5 -  Number: nAdd
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  Number: nYear
.head 5 -  Number: nMonth
.head 5 -  Number: nDay
.head 5 -  Number: nLast
.head 4 +  Actions
.head 5 +  If SalNumberMod(nMonth, 1) != nMonth
.head 6 -  Return DATETIME_Null
.head 5 -  Set nYear = SalDateYear(dDate)
.head 5 -  Set nMonth = SalDateMonth(dDate)
.head 5 -  Set nDay = SalDateDay(dDate)
.head 5 -  Set nMonth = nMonth + nAdd
.head 5 -  Set nYear = nYear + SalNumberFloor(nMonth / 12)
.head 5 -  Set nMonth = SalNumberModulo(nMonth -1, 12) + 1
.head 5 -  Set nLast =  SalDateDay(SalDateMonthEnd( SalDateConstruct(nYear, nMonth, 1, 0, 0, 0 )))
.head 5 +  If nDay > nLast
.head 6 -  Set nDay = nLast
.head 5 -  Return SalDateConstruct(nYear, nMonth, nDay, SalDateHour(dDate), SalDateMinute(dDate), SalDateSecond(dDate))
.head 3 +  Function: SalDateMonthEnd
.head 4 -  Description: author: 	Philippe Gibone
date:  	10/07/2002
version 	1.0

desc:	Calculates the last day of the month of the parameter date

example:	Set dMonday = SalDateMonthEnd( SalDateCurrent())
.head 4 +  Returns
.head 5 -  Date/Time:
.head 4 +  Parameters
.head 5 -  Date/Time: dDate
.head 4 -  Static Variables
.head 4 -  Local variables
.head 4 +  Actions
.head 5 -  Return SalDateConstruct(SalDateYear(dDate), SalDateMonth(dDate)+1, 0, 0, 0, 0)
.head 3 +  Function: SalDateComplete
.head 4 -  Description: author: 	Jc Barreau (modified by tl)
Date:
Version:	1.00 function implemented
.head 4 +  Returns
.head 5 -  Date/Time:
.head 4 +  Parameters
.head 5 -  Window Handle: hWndDate
.data INHERITPROPS
0000: 0100
.enddata
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  String: strTokens[*]
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  Number: nTokens
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  String: strDate
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  String: sPicture
.data INHERITPROPS
0000: 0100
.enddata
.head 5 -  String: sSeperator
.data INHERITPROPS
0000: 0100
.enddata
.head 4 +  Actions
.head 5 -  ! Try to find the seperator
.head 5 -  Call SalFmtGetPicture( hWndDate, sPicture)
.head 5 -  Set sSeperator = '/'
.head 5 +  If SalStrScan(sPicture,'.') > -1
.head 6 -  Set sSeperator = '.'
.head 5 +  If SalStrScan(sPicture,'-') > -1
.head 6 -  Set sSeperator = '-'
.head 5 -  !
.head 5 -  Call SalGetWindowText( hWndDate, strDate, 10 )
.head 5 +  If NOT SalIsValidDateTime( hWndDate )
.head 6 +  If strDate != STRING_Null
.head 7 -  Set nTokens =  SalStrTokenize( strDate, '', sSeperator, strTokens )
.head 7 +  Select Case nTokens
.head 8 +  Case 0
.head 9 -  Return SalDateConstruct(  SalDateYear( SalDateCurrent( )),
SalDateMonth( SalDateCurrent(  ) ), SalDateDay( SalDateCurrent(  ) ), 0, 0,0 )
.head 8 +  Case 1
.head 9 -  Return SalDateConstruct(  SalDateYear( SalDateCurrent( )),
SalDateMonth( SalDateCurrent(  ) ), SalStrToNumber( strTokens[0]), 0, 0, 0 )
.head 8 +  Case 2
.head 9 -  Return SalDateConstruct(  SalDateYear( SalDateCurrent( )),
SalStrToNumber( strTokens[1]), SalStrToNumber( strTokens[0]), 0, 0, 0 )

.head 6 +  Else
.head 7 -  Return SalStrToDate( strDate )
.head 3 +  ! ! Function: SalDateMonthEnd
.head 4 -  Description: author: 	Joe Meyer (iceteagroup teatalk)
date:  	17.07.2002
version 	1.0

Returns the last day of the month.
If the passed date is DATETIME_Null, the return value will be DATETIME_Null, too.
In general, the function finds the 1st day of the following month.
Then it subtracts 1 from this date and the result should be the last day
of the previous month.

example:	Set dLastDayinMonth = SalDateMonthEnd( SalDateCurrent())
.head 4 +  Returns
.head 5 +  Date/Time:
.head 6 -  ! last day of the month (or DATETIME_Null on error)
.head 4 +  Parameters
.head 5 +  Date/Time: p_dtDate
.head 6 -  ! The function will return the date of the last day in this month
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  Number: Month
.head 5 -  Number: Year
.head 4 +  Actions
.head 5 -  ! if the parameter's value is DATETIME_Null return DATETIME_Null, too
.head 5 +  If p_dtDate = DATETIME_Null
.head 6 -  Return DATETIME_Null
.head 5 -  ! get year and month of the date
.head 5 -  Set Year = SalDateYear( p_dtDate )
.head 5 -  Set Month = SalDateMonth( p_dtDate )
.head 5 -  ! if it was December, make it the 1st day of next year
.head 5 +  If Month = 12
.head 6 -  Return SalDateConstruct( Year + 1, 1, 1, 0, 0, 0 ) - 1
.head 5 -  ! if wasn't December so return the previous day
of the 1st day of the subsequent month
.head 5 -  Return SalDateConstruct( Year, Month + 1, 1, 0, 0, 0 ) - 1
.head 3 +  Function: SalDateDaysInMonth
.head 4 -  Description: author: 	Wolf-Henning Frisch
date:  	17.7.2003
version 	1.1  - removed the old code for the new

author: 	Joe Meyer  (iceteagroup teatalk)
date:  	17.7.2002
version 	1.0
               

desc:
Returns the number of days in a month

example:
Set nDays = SalDateDaysInMonth( SalDateCurrent() )
.head 4 +  Returns
.head 5 +  Number:
.head 6 -  ! RETURNS DAYS IN MONTH (or NUMBER_Null on error)
.head 4 +  Parameters
.head 5 +  Date/Time: p_dtDate
.head 6 -  ! The date for which the number of days in month is calculated
.head 4 -  Static Variables
.head 4 -  Local variables
.head 4 +  Actions
.head 5 -  Return SalDateDay( SalDateConstruct( SalDateYear( p_dtDate ),
SalDateMonth( p_dtDate ) + 1, 0, 0, 0, 0 ) )
.head 3 +  Function: SalDateIsLeapYear
.head 4 -  Description: author: 	Joe Meyer (iceteagroup teatalk)
date:  	17.07.2002
version 	1.0

desc:
Returns TRUE if the specified date is in a leap year

example:
If SalDateIsLeapYear( SalDateCurrent() )
   Set nDays = 366
Else
  Set nDays = 365
.head 4 +  Returns
.head 5 +  Boolean:
.head 6 -  ! returns TRUE if the specified date is in a leap year
.head 4 +  Parameters
.head 5 +  Date/Time: p_dtDate
.head 6 -  ! Pass a valid date here and the function returns whether it's in a leap year or not
.head 4 -  Static Variables
.head 4 -  Local variables
.head 4 +  Actions
.head 5 -  ! the general rule for leap years:
Every year divisible by 4 is a leap year.
But every year divisible by 100 is NOT a leap year
Unless the year is also divisible by 400, then it is still a leap year.
.head 5 -  ! Instead of calculating using the above rules, we do a little trick:
find the 1st of March for the specified date and subtract 1 day.
If the resulting day is 29, then it's a leap year.
.head 5 -  Return SalDateDay( SalDateConstruct( SalDateYear( p_dtDate ), 3, 1, 0, 0, 0) - 1 ) = 29
.head 3 +  Function: SalDateQuarterEnd
.head 4 -  Description: author: 	Joe Meyer (iceteagroup teatalk)
date:  	17.07.2002
version 	1.0

desc:
Returns the last day of the quarter for a given date

example:
SetnLastDayinCurrentQuarter = SalDateQuarterEnd(  SalDateCurrent() )
.head 4 +  Returns
.head 5 +  Date/Time: p_dtDate
.head 6 -  ! Returns the last day of the quarter for a given date
.head 4 +  Parameters
.head 5 +  Date/Time: p_dtDate
.head 6 -  ! the date for which the end of the quarter has to be calculated
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  Date/Time: dt
.head 5 -  Number: Year
.head 5 -  Number: Month
.head 5 -  Number: Day
.head 4 +  Actions
.head 5 -  ! find the 1st day of the quarter
.head 5 -  Set dt = SalDateQuarterBegin( p_dtDate )
.head 5 -  Set Year = SalDateYear( dt )
.head 5 -  Set Month = SalDateMonth( dt )
.head 5 -  ! add 3 months
.head 5 -  Set Month = Month + 3
.head 5 -  ! now we're at the 1st month of the next quarter.
If it's in the next year, adjust year and month
.head 5 +  If Month > 12
.head 6 -  Set Month = 1
.head 6 -  Set Year = Year + 1
.head 5 -  ! the previous day is the one we're after
.head 5 -  Return SalDateConstruct( Year, Month, 1, 0, 0, 0 ) - 1
.head 3 +  Function: SalDateYearEnd
.head 4 -  Description: author: 	Joe Meyer (iceteagroup teatalk)
date:  	17.07.2002
version 	1.0

desc:
Returns the last day of the year.
If the passed date is DATETIME_Null, the return value will be DATETIME_Null, too.
In general, the function finds the 1st day of the next year. Then it subtracts 1
from this date and the result should be the last day of the previous year.

example:
Set nSylvester = SalDateYearEnd( SalDateCurrent() )
.head 4 +  Returns
.head 5 +  Date/Time:
.head 6 -  ! last day of the month (or DATETIME_Null on error)
.head 4 +  Parameters
.head 5 +  Date/Time: p_dtDate
.head 6 -  ! The function will return the date of the last day in this year
.head 4 -  Static Variables
.head 4 -  Local variables
.head 4 +  Actions
.head 5 -  ! if the parameter's value is DATETIME_Null return DATETIME_Null, too
.head 5 +  If p_dtDate = DATETIME_Null
.head 6 -  Return DATETIME_Null
.head 5 -  ! take December, 31st of the year and construct a new date from it
.head 5 -  Return SalDateConstruct( SalDateYear( p_dtDate ), 12, 31, 0, 0, 0 )
.head 3 +  Function: SalDateSetLocalTime
.head 4 -  Description: author: 	Philippe Gibone (after a C. ASTOR contribution in the forum)
date:  	10/07/2002
version 	1.0

desc: 	Changes the system Date/Time and warns the other windows
 
example: try it with the  date time property window opened
.head 4 -  Returns
.head 4 +  Parameters
.head 5 -  Date/Time: dDateTime
.head 4 -  Static Variables
.head 4 +  Local variables
.head 5 -  Number: n
.head 4 +  Actions
.head 5 -  Set n = SetLocalTime(SalDateYear(dDateTime), SalDateMonth(dDateTime), 0,
	SalDateDay(dDateTime), SalDateHour(dDateTime), SalDateMinute(dDateTime), SalDateSecond(dDateTime), 0)
.head 5 -  Call SendNotifyMessageA(HWND_BROADCAST, WM_TIMECHANGE, 0, 0)
.head 2 -  Named Menus
.head 2 -  Class Definitions
.head 2 +  Default Classes
.head 3 -  MDI Window: cBaseMDI
.head 3 -  Form Window:
.head 3 -  Dialog Box:
.head 3 -  Table Window:
.head 3 -  Quest Window:
.head 3 -  Data Field:
.head 3 -  Spin Field:
.head 3 -  Multiline Field:
.head 3 -  Pushbutton:
.head 3 -  Radio Button:
.head 3 -  Option Button:
.head 3 -  Check Box:
.head 3 -  Child Table:
.head 3 -  Quest Child Window: cQuickDatabase
.head 3 -  List Box:
.head 3 -  Combo Box:
.head 3 -  Picture:
.head 3 -  Vertical Scroll Bar:
.head 3 -  Horizontal Scroll Bar:
.head 3 -  Column:
.head 3 -  Background Text:
.head 3 -  Group Box:
.head 3 -  Line:
.head 3 -  Frame:
.head 3 -  Custom Control:
.head 3 -  ActiveX:
.head 2 -  Application Actions


Gupta.narod.ru - примеры программирования на Gupta Team Developer 2005 (GTD, CTD, TOM, Quest, SQLTalk, Report Builder, SQLWindows, SQLBase, Oracle, Web Developer, Team Object Manager)

Google
 

Return to http://gupta.narod.ru/


Сайт создан в системе uCoz