电脑技术学习

informix-4gl 7.2编写的通用菜单函数

dn001

################################################################################
# #
# 版本号: Ver 1.0 研制时间:2001.2.15 #
# #
################################################################################
globals
define winopened char(1)
define thrmenu array[4] of char(16)
define popmenu array[4,5] of char(14)
define hlpmenu array[4,5] of char(60)
define poprowno array[4] of smallint
define maxmenuno smallint
define menuno, currow, rstart smallint
define p_branch_no char(6)
define p_branch_name char(60)
define p_today char(13)
define p_clerk_code char(10)
define p_clerk_pass char(15)
end globals
main
options message line last,
comment line last-2,
error line last,
prompt line last-1,
form line first+1,
input wrap,
accept key interrupt
options delete key control-o
options insert key control-i
options next key control-n
options previous key control-p
options accept key control-z
defer interrupt
# set isolation to dirty read
# set lock mode to wait 5
# whenever error continue
# call startlog("err.log")

let p_branch_no = arg_val(1)
let p_clerk_code = arg_val(2)
let p_clerk_pass = arg_val(3)
call initmenu()
open window mtwin at 2,2 with 1 rows,78 columns attribute(border)
open window mswin at 5,2 with 18 rows,78 columns attribute(border)
while true
call dispmenu(0)
case menuno
when 1
case currow
when 1
when 2
when 3
when 4
when 5 exit while
end case
when 2
case currow
when 1
when 2
when 3
when 4
when 5 exit while
end case
when 3
case currow
when 1
when 2
when 3
when 4
when 5 exit while
end case
when 4
case currow
when 1
when 2
when 3
when 4
when 5 exit while
end case
end case
end while
close window popwin
close window mswin
close window mtwin
end main

#####################################################
# 函数名称: initmenu() #
# 作 用: 初始化菜单函数 #
#####################################################
function initmenu()
define i smallint
let menuno = 1
let currow = 1
let rstart = 4
initialize thrmenu to null
initialize popmenu to null

let maxmenuno = 4

let thrmenu[1] = " A.柜面处理模块 "
let thrmenu[2] = " B.数据报表模块 "
let thrmenu[3] = " C.参数维护模块 "
let thrmenu[4] = " D.系统帮助模块 "

let poprowno[1] = 5
let popmenu[1,1] = "1.原始数据维护"
let popmenu[1,2] = "2.日清日结处理"
let popmenu[1,3] = "3.佣金数据查询"
let popmenu[1,4] = "4.综合查询处理"
let popmenu[1,5] = "E.退 出"

let hlpmenu[1,1] = "对各机构的原始数据进行查询、增、删、改处理"
let hlpmenu[1,2] = "对各机构录入的数据进行日清日洁处理"
let hlpmenu[1,3] = "对各机构的业务员,部门进行佣金统计处理"
let hlpmenu[1,4] = "对各机构的数据进行综合查询处理"
let hlpmenu[1,5] = "退出柜面处理系统"

let poprowno[2] = 5
let popmenu[2,1] = "1.佣金统计报表"
let popmenu[2,2] = "2.个人统计报表"
let popmenu[2,3] = "3.部门统计报表"
let popmenu[2,4] = "4.机构统计报表"
let popmenu[2,5] = "E.退 出"

let hlpmenu[2,1] = "对各机构业务员的佣金信息进行打印处理"
let hlpmenu[2,2] = "分机构对业务员进行综合统计"
let hlpmenu[2,3] = "分机构对部门进行综合统计"
let hlpmenu[2,4] = "分机构进行综合统计"
let hlpmenu[2,5] = "退出柜面处理系统"

let poprowno[3] = 5
let popmenu[3,1] = "1.机构部门维护"
let popmenu[3,2] = "2.人员信息维护"
let popmenu[3,3] = "3.险种信息维护"
let popmenu[3,4] = "4.佣金参数维护"
let popmenu[3,5] = "E.退 出"

let hlpmenu[3,1] = "设定机构、部门信息"
let hlpmenu[3,2] = "设业务员基本信息"
let hlpmenu[3,3] = "设定大类险种、明细险种及交费方式信息"
let hlpmenu[3,4] = "设定各明细险种的佣金参数"
let hlpmenu[3,5] = "退出柜面处理系统"

let poprowno[4] = 5
let popmenu[4,1] = "1.系统版本信息"
let popmenu[4,2] = "2.系统开发环境"
let popmenu[4,3] = "3.系统操作指南"
let popmenu[4,4] = "4.信息反馈简介"
let popmenu[4,5] = "E.退 出"

let hlpmenu[4,1] = "显示柜面处理系统的相关版本信息"
let hlpmenu[4,2] = "显示柜面处理系统的开发及应用环境"
let hlpmenu[4,3] = "显示柜面处理系统的各种操作指南"
let hlpmenu[4,4] = "显示本系统的信息反馈方式或获取相关资料"
let hlpmenu[4,5] = "退出柜面处理系统"

let winopened = "N"
end function

#####################################################
# 函数名称: dispmenu() #
# 作 用: 显示菜单函数 #
# 参 数: oper: = 0 显示菜单和选择 #
#####################################################
function dispmenu(oper)
define oper smallint
define i,j,k smallint
define answ char(1)
define cstart smallint
while true
current window is mtwin
let p_today = today using " mmm dd,yyyy "
#display p_today at 1,66 attribute(reverse,underline)
display "作者: 大梦 " at 1,66 attribute(reverse,underline)
for i = 1 to 4
let j = (i-1) * 16 + 1
display thrmenu[i] at 1,j
end for
let j = (menuno-1) * 16 + 1
display thrmenu[menuno] at 1,j attribute(reverse)
if currow <> 0 then
let cstart = (menuno-1)*16 + 3
let i = poprowno[menuno] + 1
if winopened = "N" then
open window popwin at rstart, cstart with i rows , 14 columns attribute (border,prompt line i)
let winopened = "Y"
else
current window is popwin
end if
for i = 1 to poprowno[menuno]
display popmenu[menuno,i] at i,1
end for
display popmenu[menuno,currow] at currow,1 attribute(reverse)

end if
if oper = 1 then
return
end if
while true
prompt " 请 选 择:" for char answ
on key (up)
if currow = 1 then
display popmenu[menuno,currow] at currow,1
let currow = poprowno[menuno]
else
if currow <> 1 and currow <> 0 then
display popmenu[menuno,currow] at currow,1
let currow = currow - 1
end if
end if
display popmenu[menuno,currow] at currow,1 attribute(reverse)

on key (down)
if currow = poprowno[menuno] then
display popmenu[menuno,currow] at currow,1
let currow = 1
else
if currow <> poprowno[menuno] and currow <> 0 then
display popmenu[menuno,currow] at currow,1
let currow = currow + 1
end if
end if
display popmenu[menuno,currow] at currow,1 attribute(reverse)

on key (left)
if winopened = "Y" then
close window popwin
let winopened = "N"
end if
if menuno > 1 then
let menuno = menuno - 1
else
let menuno = maxmenuno
end if
if poprowno[menuno] <> 0 then
let currow = 1
else
let currow = 0
end if
exit while

on key (tab,right)
if winopened = "Y" then
close window popwin
let winopened = "N"
end if
if menuno < maxmenuno then
let menuno = menuno + 1
else
let menuno = 1
end if
if poprowno[menuno] <> 0 then
let currow = 1
else
let currow = 0
end if
exit while

on key (control-z,return)
return
end prompt
if answ matches "[Ee]" then
let currow = poprowno[menuno]
return
end if
case
when answ matches "[Aa]"
if winopened = "Y" then
close window popwin
let winopened = "N"
end if
let menuno = 1
exit while
when answ matches "[Bb]"
if winopened = "Y" then
close window popwin
let winopened = "N"
end if
let menuno = 2
exit while
when answ matches "[Cc]"
if winopened = "Y" then
close window popwin
let winopened = "N"
end if
let menuno = 3
exit while
when answ matches "[Dd]"
if winopened = "Y" then
close window popwin
let winopened = "N"
end if
let menuno = 4
exit while
end case
if answ >= poprowno[menuno] or answ is null or answ < 1 then
continue while
else
if answ < poprowno[menuno] then
let currow = answ
return
end if
end if
end while
end while
end function

标签: 函数