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

📄 gz21.prg

📁 一个很优秀的企业人事管理系统。本软件免费
💻 PRG
字号:
**************************************************
*-- 类:           gz21 (e:\gz\user.vcx)
*-- 父类:  form
*-- 基类:    form
*
DEFINE CLASS gz21 AS form


	Top = 112
	Left = 75
	Height = 247
	Width = 610
	DoCreate = .T.
	Caption = "设置查询条件"
	Closable = .F.
	MaxButton = .F.
	MinButton = .F.
	WindowType = 1
	Name = "Form1"
	nfields = .F.
	tabn = .F.
	DIMENSION astructure[1,4]


	ADD OBJECT shape1 AS shape WITH ;
		Top = 14, ;
		Left = 57, ;
		Height = 211, ;
		Width = 536, ;
		FillStyle = 0, ;
		SpecialEffect = 0, ;
		FillColor = RGB(118,182,90), ;
		Name = "Shape1"


	ADD OBJECT label1 AS label WITH ;
		AutoSize = .T., ;
		FontBold = .T., ;
		FontName = "楷体_GB2312", ;
		FontSize = 14, ;
		BackStyle = 0, ;
		Caption = "条件1", ;
		Height = 24, ;
		Left = 87, ;
		Top = 49, ;
		Width = 56, ;
		TabIndex = 12, ;
		ForeColor = RGB(0,0,255), ;
		Name = "Label1"


	ADD OBJECT combo1 AS combobox WITH ;
		FontSize = 11, ;
		Height = 25, ;
		Left = 147, ;
		TabIndex = 2, ;
		Top = 44, ;
		Width = 109, ;
		DisabledBackColor = RGB(255,128,128), ;
		Name = "Combo1"


	ADD OBJECT label2 AS label WITH ;
		AutoSize = .T., ;
		FontBold = .T., ;
		FontSize = 12, ;
		BackStyle = 0, ;
		Caption = "字  段", ;
		Height = 20, ;
		Left = 170, ;
		Top = 21, ;
		Width = 55, ;
		TabIndex = 13, ;
		ForeColor = RGB(0,0,255), ;
		Name = "Label2"


	ADD OBJECT combo2 AS combobox WITH ;
		Comment = "", ;
		FontSize = 11, ;
		ColumnWidths = "60", ;
		RowSourceType = 1, ;
		RowSource = "<,<=,>,>=,=,==,<>", ;
		Height = 25, ;
		Left = 267, ;
		TabIndex = 3, ;
		Top = 45, ;
		Width = 73, ;
		DisabledBackColor = RGB(255,128,128), ;
		Name = "Combo2"


	ADD OBJECT text1 AS textbox WITH ;
		FontSize = 11, ;
		Height = 25, ;
		Left = 351, ;
		TabIndex = 4, ;
		Top = 45, ;
		Width = 94, ;
		DisabledBackColor = RGB(255,128,128), ;
		Name = "Text1"


	ADD OBJECT label3 AS label WITH ;
		AutoSize = .T., ;
		FontBold = .T., ;
		FontSize = 12, ;
		BackStyle = 0, ;
		Caption = "比较符", ;
		Height = 20, ;
		Left = 271, ;
		Top = 21, ;
		Width = 54, ;
		TabIndex = 14, ;
		ForeColor = RGB(0,0,255), ;
		Name = "Label3"


	ADD OBJECT label4 AS label WITH ;
		AutoSize = .T., ;
		FontBold = .T., ;
		FontSize = 12, ;
		BackStyle = 0, ;
		Caption = "比较值", ;
		Height = 20, ;
		Left = 371, ;
		Top = 21, ;
		Width = 54, ;
		TabIndex = 15, ;
		ForeColor = RGB(0,0,255), ;
		Name = "Label4"


	ADD OBJECT label5 AS label WITH ;
		AutoSize = .T., ;
		FontBold = .T., ;
		FontName = "楷体_GB2312", ;
		FontSize = 14, ;
		BackStyle = 0, ;
		Caption = "条件2", ;
		Height = 24, ;
		Left = 88, ;
		Top = 149, ;
		Width = 56, ;
		TabIndex = 16, ;
		ForeColor = RGB(0,0,255), ;
		Name = "Label5"


	ADD OBJECT combo3 AS combobox WITH ;
		FontSize = 11, ;
		Enabled = .F., ;
		Height = 25, ;
		Left = 148, ;
		TabIndex = 6, ;
		Top = 144, ;
		Width = 109, ;
		DisabledBackColor = RGB(255,128,128), ;
		Name = "Combo3"


	ADD OBJECT label6 AS label WITH ;
		AutoSize = .T., ;
		FontBold = .T., ;
		FontSize = 12, ;
		BackStyle = 0, ;
		Caption = "字  段", ;
		Height = 20, ;
		Left = 171, ;
		Top = 121, ;
		Width = 55, ;
		TabIndex = 9, ;
		ForeColor = RGB(0,0,255), ;
		Name = "Label6"


	ADD OBJECT combo4 AS combobox WITH ;
		FontSize = 11, ;
		RowSourceType = 1, ;
		RowSource = "<,<=,>,>=,=,==,<>", ;
		Enabled = .F., ;
		Height = 25, ;
		Left = 268, ;
		TabIndex = 7, ;
		Top = 145, ;
		Width = 73, ;
		DisabledBackColor = RGB(255,128,128), ;
		Name = "Combo4"


	ADD OBJECT text2 AS textbox WITH ;
		FontSize = 11, ;
		Enabled = .F., ;
		Height = 25, ;
		Left = 352, ;
		TabIndex = 8, ;
		Top = 145, ;
		Width = 94, ;
		DisabledBackColor = RGB(255,128,128), ;
		Name = "Text2"


	ADD OBJECT label7 AS label WITH ;
		AutoSize = .T., ;
		FontBold = .T., ;
		FontSize = 12, ;
		BackStyle = 0, ;
		Caption = "比较符", ;
		Height = 20, ;
		Left = 272, ;
		Top = 121, ;
		Width = 54, ;
		TabIndex = 10, ;
		ForeColor = RGB(0,0,255), ;
		Name = "Label7"


	ADD OBJECT label8 AS label WITH ;
		AutoSize = .T., ;
		FontBold = .T., ;
		FontSize = 12, ;
		BackStyle = 0, ;
		Caption = "比较值", ;
		Height = 20, ;
		Left = 372, ;
		Top = 121, ;
		Width = 54, ;
		TabIndex = 11, ;
		ForeColor = RGB(0,0,255), ;
		Name = "Label8"


	ADD OBJECT opg1 AS optiongroup WITH ;
		ButtonCount = 2, ;
		BackStyle = 0, ;
		Value = 0, ;
		Height = 37, ;
		Left = 180, ;
		Top = 76, ;
		Width = 176, ;
		TabIndex = 5, ;
		Name = "opg1", ;
		Option1.FontBold = .T., ;
		Option1.FontSize = 16, ;
		Option1.BackStyle = 0, ;
		Option1.Caption = "与", ;
		Option1.Value = 0, ;
		Option1.Height = 26, ;
		Option1.Left = 12, ;
		Option1.Top = 8, ;
		Option1.Width = 51, ;
		Option1.AutoSize = .T., ;
		Option1.ForeColor = RGB(255,0,0), ;
		Option1.Name = "Option1", ;
		Option2.FontBold = .T., ;
		Option2.FontSize = 16, ;
		Option2.BackStyle = 0, ;
		Option2.Caption = "或", ;
		Option2.Height = 26, ;
		Option2.Left = 91, ;
		Option2.Top = 7, ;
		Option2.Width = 51, ;
		Option2.AutoSize = .T., ;
		Option2.ForeColor = RGB(255,0,0), ;
		Option2.Name = "Option2"


	ADD OBJECT label9 AS label WITH ;
		AutoSize = .T., ;
		FontBold = .T., ;
		FontName = "楷体_GB2312", ;
		FontSize = 16, ;
		BackStyle = 0, ;
		Caption = "连接关系", ;
		Height = 26, ;
		Left = 80, ;
		Top = 88, ;
		Width = 95, ;
		TabIndex = 17, ;
		ForeColor = RGB(0,0,255), ;
		Name = "Label9"


	ADD OBJECT command2 AS commandbutton WITH ;
		Top = 186, ;
		Left = 138, ;
		Height = 31, ;
		Width = 68, ;
		FontBold = .T., ;
		FontName = "楷体_GB2312", ;
		FontSize = 18, ;
		Caption = "确定", ;
		TabIndex = 20, ;
		ForeColor = RGB(255,0,0), ;
		Name = "Command2"


	ADD OBJECT command4 AS commandbutton WITH ;
		Top = 186, ;
		Left = 342, ;
		Height = 31, ;
		Width = 68, ;
		FontBold = .T., ;
		FontName = "楷体_GB2312", ;
		FontSize = 18, ;
		Caption = "取消", ;
		TabIndex = 21, ;
		ForeColor = RGB(255,0,0), ;
		Name = "Command4"


	ADD OBJECT command3 AS commandbutton WITH ;
		Top = 186, ;
		Left = 239, ;
		Height = 31, ;
		Width = 68, ;
		FontBold = .T., ;
		FontName = "楷体_GB2312", ;
		FontSize = 18, ;
		Caption = "重置", ;
		TabIndex = 22, ;
		ForeColor = RGB(255,0,0), ;
		Name = "Command3"


	ADD OBJECT label12 AS label WITH ;
		AutoSize = .T., ;
		FontBold = .T., ;
		FontSize = 10, ;
		BackStyle = 0, ;
		Caption = "", ;
		Height = 17, ;
		Left = 451, ;
		Top = 49, ;
		Width = 2, ;
		ForeColor = RGB(255,0,0), ;
		Name = "Label12"


	ADD OBJECT label13 AS label WITH ;
		AutoSize = .T., ;
		FontBold = .T., ;
		FontSize = 10, ;
		BackStyle = 0, ;
		Caption = "", ;
		Height = 17, ;
		Left = 455, ;
		Top = 149, ;
		Width = 2, ;
		ForeColor = RGB(255,0,0), ;
		Name = "Label13"


	ADD OBJECT label14 AS label WITH ;
		FontBold = .T., ;
		FontName = "楷体_GB2312", ;
		FontSize = 18, ;
		WordWrap = .T., ;
		Caption = "设置条件", ;
		Height = 108, ;
		Left = 17, ;
		Top = 58, ;
		Width = 25, ;
		TabIndex = 24, ;
		ForeColor = RGB(255,0,0), ;
		Name = "Label14"


	PROCEDURE creatcond
		lparameters fieldn, fvalue
		fieldtype = type(fieldn)
		do case
		   case fieldtype $ "CM"  &&字符型和备注型
		        fvalue = CHR(34) + alltrim(fvalue) + CHR(34)
		   case fieldtype $ "DT"  &&日期型和时间型
		        fvalue = "CTOD('" + alltrim(fvalue) + "')"
		   case fieldtype $ "NY"  &&数值型
		        if empty(fvalue)
		           fvalue = "0"
		        endif
		   case fieldtype $ "L"  &&逻辑型
		        if !inlist(upper(fvalue), ".T.", ".F.")
		           fvalue = ".T."
		        endif
		endcase
		return fvalue
	ENDPROC


	PROCEDURE Init
		thisform.tabn = alias()
		thisform.nfields = afields(thisform.astructure)
		thisform.combo1.clear
		thisform.combo3.clear
		for n = 1 to thisform.nfields
		   if !thisform.astructure[n,2]$"MGO"
			  thisform.combo1.additem(thisform.astructure[n,1])
		      thisform.combo3.additem(thisform.astructure[n,1])
		   endif
		endfor
		thisform.combo1.enabled=.T.
		thisform.combo2.enabled=.T.
		thisform.text1.enabled=.T.
	ENDPROC


	PROCEDURE combo1.InteractiveChange
		thisform.command2.enabled=.T.
		thisform.command3.enabled=.T.
	ENDPROC


	PROCEDURE combo1.LostFocus
		thisform.combo2.value="="
	ENDPROC


	PROCEDURE text1.When
		vtype=thisform.combo1.value
		do case
		   case TYPE(vtype)$"D"
		        thisform.label12.caption="<=日期格式:年.月.日"
		   case TYPE(vtype)$"C"
		        thisform.label12.caption="<=字符型值"
		   case TYPE(vtype)$"N"
		        thisform.label12.caption="<=数值型值"
		   case TYPE(vtype)$"L"
		        thisform.label12.caption="<=逻辑型值"
		endcase
	ENDPROC


	PROCEDURE text1.LostFocus
		thisform.label12.caption=""
	ENDPROC


	PROCEDURE combo3.LostFocus
		thisform.combo4.value="="
	ENDPROC


	PROCEDURE text2.LostFocus
		thisform.label13.caption=""
	ENDPROC


	PROCEDURE text2.When
		vtype=thisform.combo3.value
		do case
		   case TYPE(vtype)$"D"
		        thisform.label13.caption="<=日期格式:年.月.日"
		   case TYPE(vtype)$"C"
		        thisform.label13.caption="<=字符型值"
		   case TYPE(vtype)$"N"
		        thisform.label13.caption="<=数值型值"
		   case TYPE(vtype)$"L"
		        thisform.label13.caption="<=逻辑型值"
		endcase
	ENDPROC


	PROCEDURE opg1.InteractiveChange
		thisform.combo3.enabled=.T.
		thisform.combo4.enabled=.T.
		thisform.text2.enabled=.T.
	ENDPROC


	PROCEDURE command2.Click
		if empty(thisform.combo1.value)
		   if messagebox("没有设置任何条件,查询所有的记录",48+1,"信息提示")=1
		      set filter to .t.
		      thisform.release
		   endif
		   return
		else
		   if thisform.opg1.value > 0 and empty(thisform.combo3.value)
		      =messagebox("设置的查询条件2不完整",48,"信息提示")
			  return
			endif
		endif
		cond=thisform.combo1.value+thisform.combo2.value+ ;
		     thisform.creatcond(thisform.combo1.value,thisform.text1.value)
		do case
		   case thisform.opg1.value = 0
			    lcOperand = ""
		   case thisform.opg1.value = 1
		        cond=cond+" AND "
		   case thisform.opg1.value = 2
				cond=cond+" OR "
		endcase
		if thisform.opg1.value<>0
		   cond=cond+thisform.combo3.value+;
		      thisform.combo4.value+thisform.creatcond(thisform.combo3.value,thisform.text2.value)
		endif
		on error testcond=1  &&当过滤语句不正确时,执行testcond=1
		testcond=0
		set filter to &cond
		if testcond=1
		   =messagebox("设置的查询条件不正确",48,"信息提示")
		   return
		endif
		go top
		thisform.release
	ENDPROC


	PROCEDURE command4.Click
		thisform.release
	ENDPROC


	PROCEDURE command3.Click
		thisform.combo1.value = ""
		thisform.combo2.value = ""
		thisform.combo3.value = ""
		thisform.combo4.value = ""
		thisform.text1.value=""
		thisform.text2.value=""
		thisform.combo3.enabled=.F.
		thisform.combo4.enabled=.F.
		thisform.text2.enabled=.F.
		thisform.opg1.value=0
		thisform.command2.enabled=.F.
	ENDPROC


ENDDEFINE
*
*-- 结束定义: gz21
**************************************************

⌨️ 快捷键说明

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