vfp课程设计报告

*

VFP课程设计
报告

    题:物料管理系统   

    名:   陈屹     

    号:  200532285126 

小组成员:  陶伯翱、周峰     

指导老师:   袁菊明      

    级:   电信051    

    期:   20##-7-19     

目录

1.设计目的

2.系统需求分析与功能设计

3.总体设计

4.数据库设计

5.程序模块设计

6.程序调试

7.设计小结

8参考文献

正文

1.设计目的

通过本次课程设计掌握VFP程序语言设计过程及设计思路。培养用VFP设计面向对象的应用软件的能力。

2.系统需求分析与功能设计

本次设计我们的选题是“物料管理系统”。 功能模块包括数据查询、数据输入、数据编辑、系统维护、数据报表、退出系统、帮助说明。

3.总体设计

主操作界面:

主操作界面菜单介绍:

数据查询:1.单项查询

          2.复合查询

数据输入:1.部门信息

          2.产品信息

          3.物料信息

数据编辑: 1.数据修改 (a.传统数据修改;b.复合数据修改)

          2.数据删除 (a.传统数据删除;b.复合数据删除)

系统维护: 1.数据备份

          2.数据还原

          3.新建用户

          4.删除用户

          5.修改密码

数据报表: 1.预览(按部门、产品、物料、全部信息)

          2.打印(按部门、产品、物料、全部信息)

退出系统

帮助说明

部分界面介绍:

登入窗口界面:

单项查询界面:

复合查询:

部门信息:

产品信息:

物料信息:

数据修改:

数据删除:

数据还原:

新建用户:

删除用户:

修改密码:

4.数据库设计

5.程序模块设计

单项查询:

Form1.load

public a,b,c

a=""

b=""

c=""

Command1.click

open database 物料

a=alltri(thisform.combo1.value)

b=alltri(thisform.combo2.value)

c=alltri(thisform.text1.value)

priva w

w="create sql view temp as select * from view1 where view1."+a+b+'"'+c+'"'

&w

thisform.grid1.recordsource="temp"

Command2. click

Thisform.release

复合查询:

Command1.click

open database 物料

private a,b,c,d,e,f,relationship

a=""

b=""

c=""

d=""

e=""

f=""

relationship=""

a=alltri(thisform.combo1.value)

b=alltri(thisform.combo2.value)

c=alltri(thisform.text1.value)

do case

 case thisform.optiongroup1.value=1

    relationship="and"

    d=alltri(thisform.combo3.value)

    e=alltri(thisform.combo4.value)

    f=alltri(thisform.text2.value)

    priva w

    w="create sql view temp as select * from view1 where view1."+a+b+'"'+c+'"'+" "+relationship+" "+d+e+'"'+f+'"'

    &w

    thisform.grid1.recordsource="temp"

 case thisform.optiongroup1.value=2

    relationship="or"

    d=alltri(thisform.combo3.value)

    e=alltri(thisform.combo4.value)

    f=alltri(thisform.text2.value)

    priva w

    w="create sql view temp as select * from view1 where view1."+a+b+'"'+c+'"'+" "+relationship+" "+d+e+'"'+f+'"'

    &w

    thisform.grid1.recordsource="temp"

 endcase

Command2. click

thisform.release

cancel

数据输入.部门信息:

Command1.click

append blank

scatter memvar

m.部门代码=alltrim(thisform.edit1.value)

m.部门名称=alltrim(thisform.edit2.value)

m.部门经理=alltrim(thisform.edit3.value)

m.部门地址=alltrim(thisform.edit4.value)

gather memvar

thisform.release

Command2.click

append blank

m.部门代码=alltrim(thisform.edit1.value)

m.部门名称=alltrim(thisform.edit2.value)

m.部门经理=alltrim(thisform.edit3.value)

m.部门地址=alltrim(thisform.edit4.value)

gather memvar

thisform.edit1.value=""

thisform.edit2.value=""

thisform.edit3.value=""

thisform.edit4.value=""

Command3.click

thisform.edit1.value=""

thisform.edit2.value=""

thisform.edit3.value=""

thisform.edit4.value=""

Command4.click

thisform.release

数据输入.产品信息:

Command1.click

append blank

scatter memvar memo

m.产品编号=alltrim(thisform.edit1.value)

m.产品名称=alltrim(thisform.edit2.value)

m.产品单价=alltrim(thisform.edit3.value)

m.质保期=alltrim(thisform.edit4.value)

m.生产日期=alltrim(thisform.edit5.value)

m.生产厂商=alltrim(thisform.edit6.value)

m.产品简介=alltrim(thisform.edit7.value)

gather memvar memo

thisform.release

Command2.click

append blank

scatter memvar memo

m.产品编号=alltrim(thisform.edit1.value)

m.产品名称=alltrim(thisform.edit2.value)

m.产品单价=alltrim(thisform.edit3.value)

m.质保期=alltrim(thisform.edit4.value)

m.生产日期=alltrim(thisform.edit5.value)

m.生产厂商=alltrim(thisform.edit6.value)

m.产品简介=alltrim(thisform.edit7.value)

gather memvar memo

thisform.edit1.value=""

thisform.edit2.value=""

thisform.edit3.value=""

thisform.edit4.value=""

thisform.edit5.value=""

thisform.edit6.value=""

thisform.edit7.value=""

Command3.click

thisform.edit1.value=""

thisform.edit2.value=""

thisform.edit3.value=""

thisform.edit4.value=""

thisform.edit5.value=""

thisform.edit6.value=""

thisform.edit7.value=""

Command4.click

thisform.release

数据输入.物料信息:

Command1.click

append blank

scatter memvar

m.产品编号=alltrim(thisform.edit1.value)

m.部门代码=alltrim(thisform.edit2.value)

m.当日汽车量=alltrim(thisform.edit3.value)

m.当日火车量=alltrim(thisform.edit4.value)

m.进货日期=alltrim(thisform.edit5.value)

m.进货量=alltrim(thisform.edit6.value)

m.销售量=alltrim(thisform.edit7.value)

gather memvar

thisform.release

Command2.click

append blank

scatter memvar

m.产品编号=alltrim(thisform.edit1.value)

m.部门代码=alltrim(thisform.edit2.value)

m.当日汽车量=alltrim(thisform.edit3.value)

m.当日火车量=alltrim(thisform.edit4.value)

m.进货日期=alltrim(thisform.edit5.value)

m.进货量=alltrim(thisform.edit6.value)

m.销售量=alltrim(thisform.edit7.value)

gather memvar

thisform.edit1.value=""

thisform.edit2.value=""

thisform.edit3.value=""

thisform.edit4.value=""

thisform.edit5.value=""

thisform.edit6.value=""

thisform.edit7.value=""

Command3.click

thisform.edit1.value=""

thisform.edit2.value=""

thisform.edit3.value=""

thisform.edit4.value=""

thisform.edit5.value=""

thisform.edit6.value=""

thisform.edit7.value=""

Command4.click

thisform.release

数据修改:

Timer1.timer

if thisform.optiongroup1.option1.value=1

thisform.label1.caption="部门代码"

thisform.label2.caption="部门名称"

thisform.label3.caption="部门经理"

thisform.label4.caption="部门地址"

thisform.label5.caption=""

thisform.label6.caption=""

thisform.label7.caption=""

thisform.text5.enabled=.f.

thisform.text6.enabled=.f.

thisform.text7.enabled=.f.

endif

Timer2.timer

if thisform.optiongroup1.option2.value=1

thisform.label1.caption="产品编号"

thisform.label2.caption="产品名称"

thisform.label3.caption="产品单价"

thisform.label4.caption="质保期"

thisform.label5.caption="生产日期"

thisform.label6.caption="生产厂商"

thisform.label7.caption="产品简介"

thisform.text5.enabled=.t.

thisform.text6.enabled=.t.

thisform.text7.enabled=.t.

endif

Timer3.timer

if thisform.optiongroup1.option3.value=1

thisform.label1.caption="产品编号"

thisform.label2.caption="部门代码"

thisform.label3.caption="当日汽车量"

thisform.label4.caption="当日火车量"

thisform.label5.caption="进货日期"

thisform.label6.caption="进货量"

thisform.label7.caption="销售量"

thisform.text5.enabled=.t.

thisform.text6.enabled=.t.

thisform.text7.enabled=.t.

endif

Timer4.timer

if recno()=1

  thisform.commandgroup1.command1.enabled=.f.

  thisform.commandgroup1.command2.enabled=.f.

 else

  thisform.commandgroup1.command1.enabled=.t.

  thisform.commandgroup1.command2.enabled=.t.

endif

if recno()=reccount()

   thisform.commandgroup1.command3.enabled=.f.

   thisform.commandgroup1.command4.enabled=.f.

else

   thisform.commandgroup1.command3.enabled=.t.

   thisform.commandgroup1.command4.enabled=.t.

endif

Command1.click

go top

if bumen=.t.

scatter memvar

thisform.text1.value=m.部门代码

thisform.text2.value=m.部门名称

thisform.text3.value=m.部门经理

thisform.text4.value=m.部门地址

thisform.refresh

endif

if chanpin=.t.

scatter memvar memo

thisform.text1.value=m.产品编号

thisform.text2.value=m.产品名称

thisform.text3.value=m.产品单价

thisform.text4.value=m.质保期

thisform.text5.value=m.生产日期

thisform.text6.value=m.生产厂商

thisform.text7.value=m.产品简介

thisform.refresh

endif

if wuliao=.t.

scatter memvar

thisform.text1.value=m.产品编号

thisform.text2.value=m.部门代码

thisform.text3.value=m.当日汽车量

thisform.text4.value=m.当日火车量

thisform.text5.value=m.进货日期

thisform.text6.value=m.进货量

thisform.text7.value=m.销售量

thisform.refresh

endif

Command2.click

skip -1

if bumen=.t.

scatter memvar

thisform.text1.value=m.部门代码

thisform.text2.value=m.部门名称

thisform.text3.value=m.部门经理

thisform.text4.value=m.部门地址

thisform.refresh

endif

if chanpin=.t.

scatter memvar memo

thisform.text1.value=m.产品编号

thisform.text2.value=m.产品名称

thisform.text3.value=m.产品单价

thisform.text4.value=m.质保期

thisform.text5.value=m.生产日期

thisform.text6.value=m.生产厂商

thisform.text7.value=m.产品简介

thisform.refresh

endif

if wuliao=.t.

scatter memvar

thisform.text1.value=m.产品编号

thisform.text2.value=m.部门代码

thisform.text3.value=m.当日汽车量

thisform.text4.value=m.当日火车量

thisform.text5.value=m.进货日期

thisform.text6.value=m.进货量

thisform.text7.value=m.销售量

thisform.refresh

endif

Command3.click

skip 1

if bumen=.t.

scatter memvar

thisform.text1.value=m.部门代码

thisform.text2.value=m.部门名称

thisform.text3.value=m.部门经理

thisform.text4.value=m.部门地址

thisform.refresh

endif

if chanpin=.t.

scatter memvar memo

thisform.text1.value=m.产品编号

thisform.text2.value=m.产品名称

thisform.text3.value=m.产品单价

thisform.text4.value=m.质保期

thisform.text5.value=m.生产日期

thisform.text6.value=m.生产厂商

thisform.text7.value=m.产品简介

thisform.refresh

endif

if wuliao=.t.

scatter memvar

thisform.text1.value=m.产品编号

thisform.text2.value=m.部门代码

thisform.text3.value=m.当日汽车量

thisform.text4.value=m.当日火车量

thisform.text5.value=m.进货日期

thisform.text6.value=m.进货量

thisform.text7.value=m.销售量

thisform.refresh

endif

Command4.click

go bottom

if bumen=.t.

scatter memvar

thisform.text1.value=m.部门代码

thisform.text2.value=m.部门名称

thisform.text3.value=m.部门经理

thisform.text4.value=m.部门地址

thisform.refresh

endif

if chanpin=.t.

scatter memvar memo

thisform.text1.value=m.产品编号

thisform.text2.value=m.产品名称

thisform.text3.value=m.产品单价

thisform.text4.value=m.质保期

thisform.text5.value=m.生产日期

thisform.text6.value=m.生产厂商

thisform.text7.value=m.产品简介

thisform.refresh

endif

if wuliao=.t.

scatter memvar

thisform.text1.value=m.产品编号

thisform.text2.value=m.部门代码

thisform.text3.value=m.当日汽车量

thisform.text4.value=m.当日火车量

thisform.text5.value=m.进货日期

thisform.text6.value=m.进货量

thisform.text7.value=m.销售量

thisform.refresh

endif

Command5.click

if bumen=.t.

scatter memvar

m.部门代码=alltrim(thisform.text1.text)

m.部门名称=alltrim(thisform.text2.text)

m.部门经理=alltrim(thisform.text3.text)

m.部门地址=alltrim(thisform.text4.text)

gather memvar

endif

if chanpin=.t.

scatter memvar memo

m.产品编号=alltrim(thisform.text1.text)

m.产品名称=alltrim(thisform.text2.text)

m.产品单价=alltrim(thisform.text3.text)

m.质保期=alltrim(thisform.text4.text)

m.生产日期=alltrim(thisform.text5.text)

m.生产厂商=alltrim(thisform.text6.text)

m.产品简介=alltrim(thisform.text7.text)

gather memvar memo

endif

if wuliao=.t.

scatter memvar

m.产品编号=alltrim(thisform.text1.text)

m.部门代码=alltrim(thisform.text2.text)

m.当日汽车量=alltrim(thisform.text3.text)

m.当日火车量=alltrim(thisform.text4.text)

m.进货日期=alltrim(thisform.text5.text)

m.进货量=alltrim(thisform.text6.text)

m.销售量=alltrim(thisform.text7.text)

gather memvar

endif

数据删除:

open database 物料

w1=alltrim(thisform.combo1.value)

w2=alltrim(thisform.combo2.value)

w3=alltrim(thisform.combo4.value)

w4=alltrim(thisform.combo4.value)

w5=alltrim(thisform.combo5.value)

w6=alltrim(thisform.combo6.value)

do case

    case thisform.check1.value=1 and thisform.check2.value=0 and thisform.check3.value=0

                                            

    if thisform.optiongroup1.option1.value=1 then

       w7=alltrim(thisform.combo1.value)+alltrim(thisform.combo7.value)+"'"+alltrim(thisform.text1.text)+"'"+" or "+alltrim(thisform.combo2.value)+alltrim(thisform.combo8.value)+"'"+alltrim(thisform.text2.text)+"'"

    else

       w7=alltrim(thisform.combo1.value)+alltrim(thisform.combo7.value)+"'"+alltrim(thisform.text1.text)+"'"+" and "+alltrim(thisform.combo2.value)+alltrim(thisform.combo8.value)+"'"+alltrim(thisform.text2.text)+"'"

    endif

   

   case thisform.check2.value=1 and thisform.check1.value=0 and thisform.check3.value=0

                   

   if thisform.optiongroup2.option1.value=1 then

     w7=alltrim(thisform.combo3.value)+alltrim(thisform.combo9.value)+"'"+alltrim(thisform.text3.text)+"'"+" or "+alltrim(thisform.combo4.value)+alltrim(thisform.combo10.value)+"'"+alltrim(thisform.text4.text)+"'"

   else

     w7=alltrim(thisform.combo3.value)+alltrim(thisform.combo9.value)+"'"+alltrim(thisform.text3.text)+"'"+" and "+alltrim(thisform.combo4.value)+alltrim(thisform.combo10.value)+"'"+alltrim(thisform.text4.text)+"'"

   endif

 

   case thisform.check3.value=1 and thisform.check1.value=0 and thisform.check2.value=0

        

   if thisform.optiongroup3.option1.value=1 then

     w7=alltrim(thisform.combo5.value)+alltrim(thisform.combo11.value)+"'"+alltrim(thisform.text5.text)+"'"+" or "+alltrim(thisform.combo6.value)+alltrim(thisform.combo12.value)+"'"+alltrim(thisform.text6.text)+"'"

   else

     w7=alltrim(thisform.combo5.value)+alltrim(thisform.combo11.value)+"'"+alltrim(thisform.text5.text)+"'"+" and "+alltrim(thisform.combo6.value)+alltrim(thisform.combo12.value)+"'"+alltrim(thisform.text6.text)+"'"

   endif

    

   case thisform.check1.value=1 and thisform.check2.value=1 and thisform.check3.value=0

          

   if thisform.optiongroup1.option1.value=1 then

    a=alltrim(thisform.combo1.value)+alltrim(thisform.combo7.value)+"'"+alltrim(thisform.text1.text)+"'"+" or "+alltrim(thisform.combo2.value)+alltrim(thisform.combo8.value)+"'"+alltrim(thisform.text2.text)+"'"

   else

     a=alltrim(thisform.combo1.value)+alltrim(thisform.combo7.value)+"'"+alltrim(thisform.text1.text)+"'"+" and "+alltrim(thisform.combo2.value)+alltrim(thisform.combo8.value)+"'"+alltrim(thisform.text2.text)+"'"

   endif

   if thisform.optiongroup2.option1.value=1 then

     b=alltrim(thisform.combo3.value)+alltrim(thisform.combo9.value)+"'"+alltrim(thisform.text3.text)+"'"+" or "+alltrim(thisform.combo4.value)+alltrim(thisform.combo10.value)+"'"+alltrim(thisform.text4.text)+"'"

   else

     b=alltrim(thisform.combo3.value)+alltrim(thisform.combo9.value)+"'"+alltrim(thisform.text3.text)+"'"+" and "+alltrim(thisform.combo4.value)+alltrim(thisform.combo10.value)+"'"+alltrim(thisform.text4.text)+"'"

  endif

  w7=a+" "+alltrim(thisform.combo13.value)+" "+b

  

  case thisform.check2.value=1 and thisform.check3.value=1 and thisform.check1.value=0

        

   if thisform.optiongroup2.option1.value=1 then

    b=alltrim(thisform.combo3.value)+alltrim(thisform.combo9.value)+"'"+alltrim(thisform.text3.text)+"'"+" or "+alltrim(thisform.combo4.value)+alltrim(thisform.combo10.value)+"'"+alltrim(thisform.text4.text)+"'"

  else

    b=alltrim(thisform.combo3.value)+alltrim(thisform.combo9.value)+"'"+alltrim(thisform.text3.text)+"'"+" and "+alltrim(thisform.combo4.value)+alltrim(thisform.combo10.value)+"'"+alltrim(thisform.text4.text)+"'"

   endif

  if thisform.optiongroup3.option1.value=1 then

    c=alltrim(thisform.combo5.value)+alltrim(thisform.combo11.value)+"'"+alltrim(thisform.text5.text)+"'"+" or "+alltrim(thisform.combo6.value)+alltrim(thisform.combo12.value)+"'"+alltrim(thisform.text6.text)+"'"

  else

    c=alltrim(thisform.combo5.value)+alltrim(thisform.combo11.value)+"'"+alltrim(thisform.text5.text)+"'"+" and "+alltrim(thisform.combo6.value)+alltrim(thisform.combo12.value)+"'"+alltrim(thisform.text6.text)+"'"

  endif

  w7=b+" "+alltrim(thisform.combo14.value)+" "+c

  case thisform.check1.value=1 and thisform.check3.value=1 and thisform.check2.value=0

      

  if thisform.optiongroup1.option1.value=1 then

   a=alltrim(thisform.combo1.value)+alltrim(thisform.combo7.value)+"'"+alltrim(thisform.text1.text)+"'"+" or "+alltrim(thisform.combo2.value)+alltrim(thisform.combo8.value)+"'"+alltrim(thisform.text2.text)+"'"

  else

   a=alltrim(thisform.combo1.value)+alltrim(thisform.combo7.value)+"'"+alltrim(thisform.text1.text)+"'"+" and "+alltrim(thisform.combo2.value)+alltrim(thisform.combo8.value)+"'"+alltrim(thisform.text2.text)+"'"

  endif

  if thisform.optiongroup3.option1.value=1 then

   c=alltrim(thisform.combo5.value)+alltrim(thisform.combo11.value)+"'"+alltrim(thisform.text5.text)+"'"+" or "+alltrim(thisform.combo6.value)+alltrim(thisform.combo12.value)+"'"+alltrim(thisform.text6.text)+"'"

  else

   c=alltrim(thisform.combo5.value)+alltrim(thisform.combo11.value)+"'"+alltrim(thisform.text5.text)+"'"+" and "+alltrim(thisform.combo6.value)+alltrim(thisform.combo12.value)+"'"+alltrim(thisform.text6.text)+"'"

  endif

  w7=a+" "+alltrim(thisform.combo13.value)+" "+c

   case thisform.check1.value=1 and thisform.check2.value=1 and thisform.check3.value=1     

  if thisform.optiongroup1.option1.value=1 then

   a=alltrim(thisform.combo1.value)+alltrim(thisform.combo7.value)+"'"+alltrim(thisform.text1.text)+"'"+" or "+alltrim(thisform.combo2.value)+alltrim(thisform.combo8.value)+"'"+alltrim(thisform.text2.text)+"'"

  else

   a=alltrim(thisform.combo1.value)+alltrim(thisform.combo7.value)+"'"+alltrim(thisform.text1.text)+"'"+" and "+alltrim(thisform.combo2.value)+alltrim(thisform.combo8.value)+"'"+alltrim(thisform.text2.text)+"'"

  endif

  if thisform.optiongroup2.option1.value=1 then

    b=alltrim(thisform.combo3.value)+alltrim(thisform.combo9.value)+"'"+alltrim(thisform.text3.text)+"'"+" or "+alltrim(thisform.combo4.value)+alltrim(thisform.combo10.value)+"'"+alltrim(thisform.text4.text)+"'"

  else

    b=alltrim(thisform.combo3.value)+alltrim(thisform.combo9.value)+"'"+alltrim(thisform.text3.text)+"'"+" and "+alltrim(thisform.combo4.value)+alltrim(thisform.combo10.value)+"'"+alltrim(thisform.text4.text)+"'"

  endif

  if thisform.optiongroup3.option1.value=1 then

    c=alltrim(thisform.combo5.value)+alltrim(thisform.combo11.value)+"'"+alltrim(thisform.text5.text)+"'"+" or "+alltrim(thisform.combo6.value)+alltrim(thisform.combo12.value)+"'"+alltrim(thisform.text6.text)+"'"

  else

    c=alltrim(thisform.combo5.value)+alltrim(thisform.combo11.value)+"'"+alltrim(thisform.text5.text)+"'"+" and "+alltrim(thisform.combo6.value)+alltrim(thisform.combo12.value)+"'"+alltrim(thisform.text6.text)+"'"

  endif

  w7=a+" "+alltrim(thisform.combo13.value)+" "+b+" "+alltrim(thisform.combo14.value)+" "+c

endcase

ww=messagebox("要删除符合条件的数据吗?",68,"信息框")

if ww=6

set view to 环境

delete for &w7

thisform.release

endif

数据还原:

w=alltrim(thisform.text1.text)

do case

   case substr(w,1,4)="部门"

    delete file 部门.dbf

    copy file &w to 物料

    open database  物料

    add tables  物料

    close database

    case substr(w,1,4)="产品"

    delete file 产品.dbf

    copy file &w to 产品

    open database  物料

    add tables  产品

    close database

   case substr(w,1,4)="物料"

   delete file 物料.dbf

    copy file &w to 物料

    open database  物料

    add tables  物料

    close database

 endcase

新建用户:

do while not eof()

scatter memvar

if alltrim(m.用户名)==alltrim(thisform.text1.text)

messagebox("该用户名已经存在,请另选一个用户名",64,"信息框")

go top

exit

endif

skip 1

enddo

if eof()=.t.

go bottom

append blank

scatter memvar

m.用户名=alltrim(thisform.text1.text)

m.用户密码=alltrim(thisform.text2.text)

gather memvar

use

messagebox("已经创建一个用户",64,"信息框")

thisform.release

endif

删除用户:

do while not eof()

scatter memvar

if alltrim(m.用户名)==alltrim(thisform.text1.text) and alltrim(m.用户密码)==alltrim(thisform.text2.text)

  if  alltrim(m.用户名)=="yuguoquan"

     locate for  alltrim(用户名)==alltrim(thisform.text3.text)

     if found()

      delete

      pack

      messagebox("该用户名已经删除",64,"信息框") 

      thisform.release 

      exit

      else

      messagebox("该用户名不存在",64,"信息框")

      go top

      exit

     endif

  endif

endif

skip 1

enddo

if eof()=.t.

     messagebox("系统管理员的密码或用户名不正确",64,"信息框")

     go top

endif

修改密码:

do while not eof()

scatter memvar

if alltrim(m.用户名)==alltrim(thisform.text1.text) and alltrim(m.用户密码)==alltrim(thisform.text2.text)

  if alltrim(thisform.text3.text)==alltrim(thisform.text4.text)

     m.用户名=alltrim(thisform.text1.text)

     m.用户密码=alltrim(thisform.text3.text)

     gather memvar

     use  

     messagebox("密码修改成功",64,"信息框")    

     thisform.release

     exit

  else

     messagebox("你输入的密码不一致",64,"信息框")

     exit

  endif

endif

skip 1

enddo

if eof()=.t.

   messagebox("该用户名不存在或密码不正确",64,"信息框")

  go top

endif

物料菜单:

*       *********************************************************

*       *                                                        

*       * 07/17/08              物料.MPR                08:58:27 

*       *                                                        

*       *********************************************************

*       *                                                        

*       * 作者名称                                               

*       *                                                        

*       * 版权所有                         

*       * 地址                                                   

*       * 城市,     邮编                                         

*       * 国家                                             

*       *                                                        

*       * 说明:                                           

*       * 此程序由 GENMENU 自动生成。   

*       *                                                        

*       *********************************************************

* To attach this menu to your Top-Level form,

* call it from the Init event of the form:

* Syntax: DO <mprname> WITH <oFormRef> [,<cMenuname>|<lRename>][<lUniquePopups>]

*   oFormRef - form object reference (THIS)

*   cMenuname - name for menu (this is required for Append menus - see below)

*   lRename - renames Name property of your form

*   lUniquePopups - determines whether to generate unique ids for popup names

          

*   example:

*   PROCEDURE Init

*      DO mymenu.mpr WITH THIS,.T.

*   ENDPROC

* Use the optional 2nd parameter if you plan on running multiple instances

* of your Top-Level form. The preferred method is to create an empty string

* variable and pass it by reference so you can receive the form name after

* the MPR file is run. You can later use this reference to destroy the menu.

*   PROCEDURE Init

*      LOCAL cGetMenuName

*      cGetMenuName = ""

*      DO mymenu.mpr WITH THIS, m.cGetMenuName

*   ENDPROC

* The logical lRename parameter will change the name property of your

* form to the same name given the menu and may cause conflicts in your

* code if you directly reference the form by name.

* You will also need to remove the menu when the form is destroyed so that it does

* not remain in memory unless you wish to reactivate it later in a new form.

* If you passed the optional lRename parameter as .T. as in the above example,

* you can easily remove the menu in the form's Destroy event as shown below.

* This strategy is ideal when using multiple instances of Top-Level forms.

*   example:

*   PROCEDURE Destroy

*      RELEASE MENU (THIS.Name) EXTENDED

*   ENDPROC

* Using Append/Before/After location options:

*   You might want to append a menu to an existing Top-Level form by setting

*   the Location option in the General Options dialog. In order to do this, you

*   must pass the name of the menu in which to attach the new one. The second

*   parameter is required here. If you originally created the menu with the lRename

*   parameter = .T., then you can update the menu with code similar to the following:

*   example:

*   DO mymenu2.mpr WITH THISFORM,THISFORM.name

*

* Using lUniquePopups:

*   If you are running this menu multiple times in your application, such as in multiple

*   instances of the same top-level form, you should pass .T. to the lUniquePopups

*   parameter so that unique popup names are generated to avoid possible conflicts.

*   example:

*   PROCEDURE Init

*      DO mymenu.mpr WITH THIS,.T.,.T.

*   ENDPROC

*

* Note: Parm4-Parm9 are not reserved and freely available for use with your menu code.

*

LPARAMETERS oFormRef, getMenuName, lUniquePopups, parm4, parm5, parm6, parm7, parm8, parm9

LOCAL cMenuName, nTotPops, a_menupops, cTypeParm2, cSaveFormName

IF TYPE("m.oFormRef") # "O" OR ;

  LOWER(m.oFormRef.BaseClass) # 'form' OR ;

  m.oFormRef.ShowWindow # 2

    MESSAGEBOX([只能从顶层表单调用该菜单。请确认您表单的 ShowWindow 属性已设为 2。阅读此菜单 MPR 文件的头部分,可以获得详细信息。])

    RETURN

ENDIF

m.cTypeParm2 = TYPE("m.getMenuName")

m.cMenuName = SYS(2015)

m.cSaveFormName = m.oFormRef.Name

IF m.cTypeParm2 = "C" OR (m.cTypeParm2 = "L" AND m.getMenuName)

    m.oFormRef.Name = m.cMenuName

ENDIF

IF m.cTypeParm2 = "C" AND !EMPTY(m.getMenuName)

    m.cMenuName = m.getMenuName

ENDIF

DIMENSION a_menupops[10]

IF TYPE("m.lUniquePopups")="L" AND m.lUniquePopups

    FOR nTotPops = 1 TO ALEN(a_menupops)

       a_menupops[m.nTotPops]= SYS(2015)

    ENDFOR

ELSE

    a_menupops[1]="数据查询"

    a_menupops[2]="_0v50kfs8u"

    a_menupops[3]="数据编辑"

    a_menupops[4]="数据修改"

    a_menupops[5]="数据删除"

    a_menupops[6]="系统维护"

    a_menupops[7]="数据报表"

    a_menupops[8]="预览"

    a_menupops[9]="打印"

    a_menupops[10]="_0v510wrff"

ENDIF

*       *********************************************************

*       *                                                        

*       *                         设置代码                       

*       *                                                        

*       *********************************************************

*

clear

modi window screen title '物料管理系统'

*       *********************************************************

*       *                                                        

*       *                         菜单定义                        

*       *                                                        

*       *********************************************************

*

DEFINE MENU (m.cMenuName) IN (m.oFormRef.Name) BAR

DEFINE PAD _0v70j8ggh OF (m.cMenuName) PROMPT "数据查询" COLOR SCHEME 3

DEFINE PAD _0v70j8ggi OF (m.cMenuName) PROMPT "数据输入" COLOR SCHEME 3

DEFINE PAD _0v70j8ggj OF (m.cMenuName) PROMPT "数据编辑" COLOR SCHEME 3

DEFINE PAD _0v70j8ggk OF (m.cMenuName) PROMPT "系统维护" COLOR SCHEME 3

DEFINE PAD _0v70j8ggl OF (m.cMenuName) PROMPT "数据报表" COLOR SCHEME 3

DEFINE PAD _0v70j8ggm OF (m.cMenuName) PROMPT "退出系统" COLOR SCHEME 3

DEFINE PAD _0v70j8ggn OF (m.cMenuName) PROMPT "帮助说明" COLOR SCHEME 3

ON PAD _0v70j8ggh OF (m.cMenuName) ACTIVATE POPUP (a_menupops[1])

ON PAD _0v70j8ggi OF (m.cMenuName) ACTIVATE POPUP (a_menupops[2])

ON PAD _0v70j8ggj OF (m.cMenuName) ACTIVATE POPUP (a_menupops[3])

ON PAD _0v70j8ggk OF (m.cMenuName) ACTIVATE POPUP (a_menupops[6])

ON PAD _0v70j8ggl OF (m.cMenuName) ACTIVATE POPUP (a_menupops[7])

ON SELECTION PAD _0v70j8ggm OF (m.cMenuName) ;

    DO _0v70j8ggo ;

    IN LOCFILE("课程设计\物料" ,"MPX;MPR|FXP;PRG" ,"WHERE is 物料?")

DEFINE POPUP (a_menupops[1]) MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF (a_menupops[1]) PROMPT "单项查询"

DEFINE BAR 2 OF (a_menupops[1]) PROMPT "复合查询"

ON SELECTION BAR 1 OF (a_menupops[1]) do form 单项查询

ON SELECTION BAR 2 OF (a_menupops[1]) do form 复合查询

DEFINE POPUP (a_menupops[2]) MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF (a_menupops[2]) PROMPT "部门信息"

DEFINE BAR 2 OF (a_menupops[2]) PROMPT "产品信息"

DEFINE BAR 3 OF (a_menupops[2]) PROMPT "物料信息"

ON SELECTION BAR 1 OF (a_menupops[2]) do form 部门信息

ON SELECTION BAR 2 OF (a_menupops[2]) do form 产品信息

ON SELECTION BAR 3 OF (a_menupops[2]) do form 物料信息

DEFINE POPUP (a_menupops[3]) MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF (a_menupops[3]) PROMPT "数据修改"

DEFINE BAR 2 OF (a_menupops[3]) PROMPT "数据删除"

ON BAR 1 OF (a_menupops[3]) ACTIVATE POPUP (a_menupops[4])

ON BAR 2 OF (a_menupops[3]) ACTIVATE POPUP (a_menupops[5])

DEFINE POPUP (a_menupops[4]) MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF (a_menupops[4]) PROMPT "传统数据修改"

DEFINE BAR 2 OF (a_menupops[4]) PROMPT "复合数据修改"

ON SELECTION BAR 1 OF (a_menupops[4]) do form 传统数据修改

ON SELECTION BAR 2 OF (a_menupops[4]) do form 复合数据修改

DEFINE POPUP (a_menupops[5]) MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF (a_menupops[5]) PROMPT "传统数据删除"

DEFINE BAR 2 OF (a_menupops[5]) PROMPT "复和数据删除"

ON SELECTION BAR 1 OF (a_menupops[5]) ;

    DO _0v70j8ggr ;

    IN LOCFILE("课程设计\物料" ,"MPX;MPR|FXP;PRG" ,"WHERE is 物料?")

ON SELECTION BAR 2 OF (a_menupops[5]) ;

    DO _0v70j8ggs ;

    IN LOCFILE("课程设计\物料" ,"MPX;MPR|FXP;PRG" ,"WHERE is 物料?")

DEFINE POPUP (a_menupops[6]) MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF (a_menupops[6]) PROMPT "数据备份"

DEFINE BAR 2 OF (a_menupops[6]) PROMPT "数据还原"

DEFINE BAR 3 OF (a_menupops[6]) PROMPT "新建用户"

DEFINE BAR 4 OF (a_menupops[6]) PROMPT "删除用户"

DEFINE BAR 5 OF (a_menupops[6]) PROMPT "修改密码"

ON SELECTION BAR 1 OF (a_menupops[6]) ;

    DO _0v70j8ggt ;

    IN LOCFILE("课程设计\物料" ,"MPX;MPR|FXP;PRG" ,"WHERE is 物料?")

ON SELECTION BAR 2 OF (a_menupops[6]) do form 数据还原

ON SELECTION BAR 3 OF (a_menupops[6]) do form 新建用户

ON SELECTION BAR 4 OF (a_menupops[6]) do form 删除用户

ON SELECTION BAR 5 OF (a_menupops[6]) do form 修改密码

DEFINE POPUP (a_menupops[7]) MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF (a_menupops[7]) PROMPT "预览"

DEFINE BAR 2 OF (a_menupops[7]) PROMPT "打印"

ON BAR 1 OF (a_menupops[7]) ACTIVATE POPUP (a_menupops[8])

ON BAR 2 OF (a_menupops[7]) ACTIVATE POPUP (a_menupops[9])

DEFINE POPUP (a_menupops[8]) MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF (a_menupops[8]) PROMPT "按部门"

DEFINE BAR 2 OF (a_menupops[8]) PROMPT "按产品"

DEFINE BAR 3 OF (a_menupops[8]) PROMPT "按物料"

DEFINE BAR 4 OF (a_menupops[8]) PROMPT "全部信息"

ON SELECTION BAR 1 OF (a_menupops[8]) report form 部门 environment preview

ON SELECTION BAR 2 OF (a_menupops[8]) report form 产品 environment preview

ON SELECTION BAR 3 OF (a_menupops[8]) report form 物料 environment preview

ON SELECTION BAR 4 OF (a_menupops[8]) report form 全部 environment preview

DEFINE POPUP (a_menupops[9]) MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF (a_menupops[9]) PROMPT "直接打印"

ON BAR 1 OF (a_menupops[9]) ACTIVATE POPUP (a_menupops[10])

DEFINE POPUP (a_menupops[10]) MARGIN RELATIVE SHADOW COLOR SCHEME 4

DEFINE BAR 1 OF (a_menupops[10]) PROMPT "产品"

DEFINE BAR 2 OF (a_menupops[10]) PROMPT "部门"

DEFINE BAR 3 OF (a_menupops[10]) PROMPT "物料"

DEFINE BAR 4 OF (a_menupops[10]) PROMPT "全部信息"

ON SELECTION BAR 1 OF (a_menupops[10]) report form 产品 environment to printer

ON SELECTION BAR 2 OF (a_menupops[10]) report form 部门 environment to printer

ON SELECTION BAR 3 OF (a_menupops[10]) report form 物料 environment  to printer

ON SELECTION BAR 4 OF (a_menupops[10]) report form 全部 environment to printer

ACTIVATE MENU (m.cMenuName) NOWAIT

IF m.cTypeParm2 = "C"

    m.getMenuName = m.cMenuName

    m.oFormRef.Name = m.cSaveFormName

ENDIF

*       *********************************************************

*       *                                                         

*       * _0V70J8GGO  ON SELECTION PAD                           

*       *                                                        

*       * Procedure Origin:                                      

*       *                                                         

*       * From Menu:  物料.MPR,            Record:   45          

*       * Called By:  ON SELECTION PAD                           

*       * Prompt:     退出系统                                   

*       * Snippet:    1                                           

*       *                                                        

*       *********************************************************

*

PROCEDURE _0v70j8ggo

public x

x=messagebox("是否真的退出?",1+32+256,"提示")

do case

  case x=1

    clear events

  case x=2

   return

endcase

*       *********************************************************

*       *                                                        

*       * _0V70J8GGR  ON SELECTION BAR 1 OF POPUP 数据删除       

*       *                                                         

*       * Procedure Origin:                                      

*       *                                                        

*       * From Menu:  物料.MPR,            Record:   20          

*       * Called By:  ON SELECTION BAR 1 OF POPUP 数据删除       

*       * Prompt:     传统数据删除                               

*       * Snippet:    2                                          

*       *                                                        

*       *********************************************************

*

PROCEDURE _0v70j8ggr

public x

x=messagebox("是否真的删除?",1+32+256,"提示")

do case

  case x=1

   do form 传统数据删除

  case x=2

   return

endcase

*       *********************************************************

*       *                                                        

*       * _0V70J8GGS  ON SELECTION BAR 2 OF POPUP 数据删除       

*       *                                                        

*       * Procedure Origin:                                       

*       *                                                        

*       * From Menu:  物料.MPR,            Record:   21          

*       * Called By:  ON SELECTION BAR 2 OF POPUP 数据删除       

*       * Prompt:     复和数据删除                                

*       * Snippet:    3                                          

*       *                                                        

*       *********************************************************

*

PROCEDURE _0v70j8ggs

public x

x=messagebox("是否真的退出?",1+32+256,"提示")

do case

  case x=1

   do form 复合数据删除

  case x=2

   return

endcase

*       *********************************************************

*       *                                                        

*       * _0V70J8GGT  ON SELECTION BAR 1 OF POPUP 系统维护       

*       *                                                        

*       * Procedure Origin:                                      

*       *                                                        

*       * From Menu:  物料.MPR,            Record:   24          

*       * Called By:  ON SELECTION BAR 1 OF POPUP 系统维护       

*       * Prompt:     数据备份                                   

*       * Snippet:    4                                          

*       *                                                        

*       *********************************************************

*

PROCEDURE _0v70j8ggt

md 数据备份

 use 部门

 copy to 数据备份\部门备份

 use

select 0

 use 产品

 copy to 数据备份\产品备份

 use

select 0

 use 物料

 copy to 数据备份\物料备份

 use

messagebox("数据备份成功",0+64+0,"恭喜!")

6.程序调试

调试结果正确

7.设计小结

   此次课程设计算是又苦又甜。前期准备工作就花了很多时间,图书馆都跑了两个。第一次去实验室做的时候什么都没做成。后来在自己电脑上弄了很长时间总算有点效果。数据库的设计是最头痛的,因为要自己完整的去学习一遍。不过还好,在各类资料的借鉴下和同组成员的努力下还算凑合。以后会更加喜欢VFP,喜欢这门语言,因为真的很有用。感谢老师天这么热依然坚持在岗位……

8.参考文献

1.     Visual FoxPro数据库基础;主编:余文芳 人民邮电出版社。

2.     Visual FoxPro数据库开发实例;主编:王晶莹 机械工业出版社

3.     网络资源。 

相关推荐