⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usedprg.bak

📁 visual foxpro编写的医药触摸屏管理系统
💻 BAK
字号:
**************获取汉字的拼音简码****************
FUNCTION CatchCode
PARAMETERS INText
private py,reValue    &&定义两个局部变量
reValue=''
for _cN=1 to len(alltrim(INText)) step 2     &&每次取出两个字节
	mystr=substr(alltrim(INText),_cN,2)     
  If Asc(mystr) > 0
    If Asc(mystr) < Asc("啊")
       py = mystr
    EndIf
    If Asc(mystr) >= Asc("啊") And Asc(Left(mystr, 1)) < Asc("芭")
       py = "A"
    EndIf
    If Asc(mystr) >= Asc("芭") And Asc(Left(mystr, 1)) < Asc("擦")
       py = "B"
    EndIf
    If Asc(mystr) >= Asc("擦") And Asc(Left(mystr, 1)) < Asc("搭")
       py = "C"
    Endif
    If Asc(mystr) >= Asc("搭") And Asc(Left(mystr, 1)) < Asc("蛾")
       py = "D"
    Endif
    If Asc(mystr) >= Asc("蛾") And Asc(Left(mystr, 1)) < Asc("发")
       py = "E"
    Endif
    If Asc(mystr) >= Asc("发") And Asc(mystr) < Asc("噶")
       py = "F"
    Endif
    If Asc(mystr) >= Asc("噶") And Asc(mystr) < Asc("哈")
       py = "G"
    Endif
    If Asc(mystr) >= Asc("哈") And Asc(mystr) < Asc("击")
       py = "H"
    Endif
    If Asc(mystr) >= Asc("击") And Asc(mystr) < Asc("喀")
       py = "J"
    Endif
    If Asc(mystr) >= Asc("喀") And Asc(mystr) < Asc("垃") Or mystr='剀'
       py = "K"
    Endif
    If Asc(mystr) >= Asc("垃") And Asc(mystr) < Asc("妈")
       py = "L"
    Endif
    If Asc(mystr) >= Asc("妈") And Asc(mystr) < Asc("拿")
       py = "M"
    Endif
    If Asc(mystr) >= Asc("拿") And Asc(mystr) < Asc("哦")
       py = "N"
    Endif
    If Asc(mystr) >= Asc("哦") And Asc(mystr) < Asc("啪")
       py = "O"
    Endif
    If Asc(mystr) >= Asc("啪") And Asc(mystr) < Asc("期") or mystr='翩'
       py = "P"
    Endif
    If Asc(mystr) >= Asc("期") And Asc(mystr) < Asc("然")
       py = "Q"
    Endif
    If Asc(mystr) >= Asc("然") And Asc(mystr) < Asc("撒")
       py = "R"
    Endif
    If Asc(mystr) >= Asc("撒") And Asc(mystr) < Asc("塌")
       py = "S"
    Endif
    If Asc(mystr) >= Asc("塌") And Asc(mystr) < Asc("挖")
       py = "T"
    Endif
    If Asc(mystr) >= Asc("挖") And Asc(mystr) < Asc("昔") Or mystr='炜'
       py = "W"
    Endif
    If Asc(mystr) >= Asc("昔") And Asc(mystr) < Asc("压") Or mystr='馨'
       py = "X"
    Endif
    If Asc(mystr) >= Asc("压") And Asc(mystr) < Asc("匝") or mystr='懿'
       py = "Y"
    Endif
    If Asc(mystr) >= Asc("匝") and mystr!='馨' and mystr!='炜' and mystr!='剀' and mystr!='翩' and mystr!='懿'
       py = "Z"
    Endif
	If upper(mystr) <= "Z" And upper(mystr) >= "A" 
	      py=upper(mystr)
	Endif
  	reValue=reValue+py
endif
endfor  
Return reValue      &&将取出的拼音简码返回
**************将日期格式转换为YYYY-MM-DD****************
FUNCTION CatchDate
PARAMETERS OldDate
cYear=alltrim(str(Year(OldDate)))
cMonth=Padl(alltrim(str(Month(OldDate))),2,'0')
cDay=Padl(alltrim(str(Day(OldDate))),2,'0')
NewDate=Cyear+"-"+cMonth+"-"+cDay
RETURN NewDate
**************自动编号****************
FUNCTION AutoNO
	PARAMETERS InDatabase,InFields,InMark,Flag,InWhere
	StrDate=Alltrim(CatchDate(Date()))
	Select &InDatabase
	If Empty(InWhere)
		Select Max(&InFields.) AS 最大编号 From &InDatabase Into Cursor Temp_Max
	Else
		Select Max(&InFields.) AS 最大编号 From &InDatabase. Where &InWhere. Into Cursor Temp_Max
	EndIf
	Do Case 
		Case Flag="5"
			If Empty(Temp_Max.最大编号)
				NewNO=1
			Else
				NewNo=Temp_Max.最大编号+1
			Endif
		Case Flag="7"
			If Empty(Temp_Max.最大编号)
				NewNO=Alltrim(InMark)+"00001"
			Else
				NewNo=Alltrim(InMark)+Padl(Alltrim(Str(Val(Substr(Temp_Max.最大编号,3))+1)),5,'0')
			Endif		
		Case Flag="17"
			If Empty(Temp_Max.最大编号)
				NewNO=StrDate+Alltrim(InMark)+"00001"
			Else
				If SubStr(Temp_Max.最大编号,1,10)=StrDate
					NO=Padl(Alltrim(Str(Val(Substr(Temp_Max.最大编号,13))+1)),5,'0')
				Else
					NO="00001"
				Endif
				NewNo=StrDate+Alltrim(InMark)+NO			
			Endif			
	EndCase
RETURN NewNo
*该函数的调用格式为:=AutoNO("数据表名","字段名","标识名","标志","Where条件")
*注:标志参数的值为5,7,17
*其中5表示编号为数值型;7表示编号由标识名和5位的编号组成;17表示编号由日期+标识名+5位的编号组成
*例如:AutoNO("Tab_Inhouse","入库票号","RK","17")
**************利用PageDown键和PageUp键控制记录的选取****************
PROCEDURE KeyBoardCtrl
PARAMETERS nKeyCode,InThis
If nKeyCode=3 &&按下PageDown键
	Nodefault
	If InThis.ListIndex<InThis.ListCount
		InThis.ListIndex=InThis.ListIndex+1
	Endif
Endif
If nKeyCode=18 &&按下PageUp键
	Nodefault
	If InThis.ListIndex>1
		InThis.ListIndex=InThis.ListIndex-1
	Endif	
Endif
RETURN
**************利用PageDown键和PageUp键控制记录的选取****************

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -