utility.prg
来自「品质量管理系统 版本1.00 产品质量管理系统(简称JSMIS0)是基于Wi」· PRG 代码 · 共 120 行
PRG
120 行
*:******************************************************************************
*:
*: 过程文件D:\VFP\CAPP\PROGS\UTILITY.PRG
*:
*: renku
*: RIMAB CAD
*:
*:
*:
*:
*: Documented using Visual FoxPro Formatting wizard version .03
*:******************************************************************************
*: UTILITY
*: istag
*: NotYet
*: FileSize
*: FormIsObject
*: OnShutDown
*-- (c) Microsoft Corporation 1995
*-- General purpose utility functions independent of any classes
*-- for better performance and accessibility
#INCLUDE "INCLUDE\TASTRADE.H"
************************************
FUNCTION istag (tcTagName, tcAlias)
*-- Receives a tag name and an alias (which is optional) as
*-- parameters and returns .T. if the tag name exists in the
*-- alias. If no alias is passed, the current alias is assumed.
LOCAL llIsTag, ;
lcTagFound
IF PARAMETERS() < 2
tcAlias = Alias()
ENDIF
IF Empty(tcAlias)
RETURN .F.
ENDIF
llIsTag = .F.
tcTagName = UPPER(ALLTRIM(tcTagName))
lnTagNum = 1
lcTagFound = Tag(lnTagNum, tcAlias)
DO WHILE !Empty(lcTagFound)
IF UPPER(ALLTRIM(lcTagFound)) == tcTagName
llIsTag = .T.
EXIT
ENDIF
lnTagNum = lnTagNum + 1
lcTagFound = Tag(lnTagNum, tcAlias)
ENDDO
RETURN llIsTag
ENDFUNC
FUNCTION NotYet()
*-- Used during construction of Tastrade to indicate those
*-- parts of the application that were not yet completed.
=MESSAGEBOX(NOTYET_LOC, MB_ICONINFORMATION)
RETURN
ENDFUNC
FUNCTION FileSize(tcFileName)
*-- Returns the size of a file. SET COMPATIBLE must be ON for
*-- FSIZE() to return the size of a file. Otherwise, it returns
*-- the size of a field.
LOCAL lcSetCompatible, lnFileSize
lcSetCompatible = SET('COMPATIBLE')
SET COMPATIBLE ON
lnFileSize = FSIZE(tcFileName)
SET COMPATIBLE &lcSetCompatible
RETURN lnFileSize
ENDFUNC
FUNCTION FormIsObject()
*-- Return .T. if the active form is of type "O" and its baseclass
*-- is "Form".
RETURN (TYPE("_screen.activeform") == "O" AND ;
UPPER(_SCREEN.ActiveForm.BaseClass) = "FORM")
ENDFUNC
FUNCTION OnShutDown()
*-- Custom message called via the ON SHUTDOWN command to indicate
*-- that the user must exit Tastrade before exiting Visual Foxpro.
local sys16
IF TYPE("oAPP") = "O"
IF OApp.cleanup()
release oapp
endif
endif
sys16 = sys(16)
IF (".EXE"$UPPER(SYS16))
QUIT
ENDIF
ENDFUNC
**-----科学记数法形式的四舍六入-----
FUNCTION SSLR(nROUND,YSW)
LOCAL nL1,nL2,nL3,nL4,sS1
STORE 0.0 TO nL1,nL2,nL3,nL4
nL4=YSW+1
sS1=""
nL1=LEN(ALLTR(STR(INT(nROUND))))-1
IF nL1!=0 && nL1 为10^x次幂
nL2=ROUND((nROUND)/(10^nL1),nL4)
ELSE
nL2=ROUND(nROUND,nL4) && nL2=X.XXX 形式
ENDIF
nL3=VAL(SUBSTR(ALLTR(STR(nL2,20,nL4)),LEN(ALLTR(STR(nL2,20,nL4))),1)) && 0.00X X值等于几
IF nL3<6 &&四舍六入
sS1=ALLTR(STR(nL2,20,nL4))
nL2=VAL(SUBSTR(sS1,1,LEN(sS1)-1))*(10^nL1)
ELSE
nL2=ROUND(nL2,YSW)*(10^nL1)
ENDIF
RETURN nL2
ENDFUNC
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?