| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 807 人关注过本帖
标题:请教任意输入字显示
只看楼主 加入收藏
pylyh
Rank: 1
等 级:新手上路
帖 子:59
专家分:0
注 册:2013-8-26
结帖率:56.25%
收藏
已结贴  问题点数:20 回复次数:11 
请教任意输入字显示
请教问题
这句中: SELECT dspph,dcc,dpm,dgg,dsl,dkc,dkh,dfw,dhzh,dhth,drq,dxh,dlx FROM (path+"lys") WHERE &cxjgtj INTO CURSOR cxtmp

 " &cxjgtj " 现在只有输入全部才可以显示,怎样可以改为输入任意一个字都可以显示。
2014-03-05 23:55
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9841
专家分:27213
注 册:2012-2-5
收藏
得分:7 
看下CXJGTJ的代码

坚守VFP最后的阵地
2014-03-06 00:11
pylyh
Rank: 1
等 级:新手上路
帖 子:59
专家分:0
注 册:2013-8-26
收藏
得分:0 
PROCEDURE rckcx
 PARAMETER RCPOPUP
 PUBLIC CXFORM
 PUBLIC XRCPOPUP , QRQ , ZRQ , SPPH , KH , HZH , HTH , CXJGTJ , RKZL , CKZL , RKJS ,  ;
      CKJS
 PUSH KEY CLEAR
 ON KEY LABEL ESC DO getout IN rckcx
 SET SKIP OF MENU _MSYSMENU .T.
 XRCPOPUP = RCPOPUP
 CXJGTJ = ''
 STORE 0 TO RKZL , CKZL , RKJS , CKJS
 STORE SPACE(8) TO HTH
 STORE SPACE(7) TO HZH
 STORE SPACE(4) TO KH
 STORE SPACE(8) TO SPPH
 STORE {} TO QRQ , ZRQ
 CXFORM = CREATEOBJECT('cxform')
  CXFORM.SHOW
 READ EVENTS
ENDPROC
*------
PROCEDURE getout
 RELEASE CXFORM
 RETURN
ENDPROC
*------
PROCEDURE cxtj
 PARAMETER FN , FE , LE
 IF  .NOT. EMPTY(CXJGTJ)
    CKCXTJE = CXJGTJ + SPACE(1) + 'AND' + SPACE(1) + FN + LE + FE
 ELSE
    CKCXTJE = CXJGTJ + FN + LE + FE
 ENDIF
 RETURN CKCXTJE
ENDPROC
*------
DEFINE CLASS cxform AS Form
 TOP = 0
 LEFT = 0
 HEIGHT = 405
 WIDTH = 635
 BACKCOLOR = RGB(255,240,230)
 BORDERSTYLE = 2
 KEYPREVIEW = .T.
 ALWAYSONTOP = .F.
 CAPTION = '入出库查询'
 CLOSABLE = .F.
 CONTROLBOX = .T.
 MAXBUTTON = .F.
 MINBUTTON = .F.
 MOVABLE = .F.
 VISIBLE = .T.
 NAME = 'cxform'
 ADD OBJECT SPPHLABEL AS LABEL WITH TOP = 10 , LEFT = 10 , HEIGHT = 25 , WIDTH = 55 ,  ;
      CAPTION = '商品编号:' , BACKCOLOR = RGB(255,240,230) , NAME =  ;
      'spphlabel'
 ADD OBJECT SPPHTEXT AS TEXTBOX WITH TOP = 6 , LEFT = 65 , HEIGHT = 22 , WIDTH = 70 ,  ;
      INPUTMASK = 'XXXXXXXX' , CONTROLSOURCE = 'spph' , NAME = 'spphtext'
 ADD OBJECT HTHLABEL AS LABEL WITH TOP = 10 , LEFT = 145 , HEIGHT = 22 , WIDTH = 45 ,  ;
      CAPTION = '合同号:' , BACKCOLOR = RGB(255,240,230) , NAME =  ;
      'hthlabel'
 ADD OBJECT HTHTEXT AS TEXTBOX WITH TOP = 6 , LEFT = 190 , HEIGHT = 22 , WIDTH = 70 ,  ;
      INPUTMASK = 'XXXXXXXX' , CONTROLSOURCE = 'hth' , NAME = 'hthtext'
 ADD OBJECT HZHLABEL AS LABEL WITH TOP = 10 , LEFT = 270 , HEIGHT = 22 , WIDTH = 45 ,  ;
      CAPTION = '货主号:' , BACKCOLOR = RGB(255,240,230) , NAME =  ;
      'hzhlabel'
 ADD OBJECT HZHTEXT AS TEXTBOX WITH TOP = 6 , LEFT = 315 , HEIGHT = 22 , WIDTH = 60 ,  ;
      INPUTMASK = 'XXXXXXX' , CONTROLSOURCE = 'hzh' , NAME = 'hzhtext'
 ADD OBJECT KHLABEL AS LABEL WITH TOP = 10 , LEFT = 385 , HEIGHT = 22 , WIDTH = 30 ,  ;
      CAPTION = '库号:' , BACKCOLOR = RGB(255,240,230) , NAME = 'khlabel'
 ADD OBJECT KHTEXT AS TEXTBOX WITH TOP = 6 , LEFT = 415 , HEIGHT = 22 , WIDTH = 40 ,  ;
      INPUTMASK = 'XXXX' , CONTROLSOURCE = 'kh' , NAME = 'khtext'
 ADD OBJECT QRQLABEL AS LABEL WITH TOP = 10 , LEFT = 465 , HEIGHT = 22 , WIDTH = 45 ,  ;
      CAPTION = '起日期:' , BACKCOLOR = RGB(255,240,230) , NAME =  ;
      'qrqlabel'
 ADD OBJECT QRQTEXT AS TEXTBOX WITH TOP = 6 , LEFT = 510 , HEIGHT = 22 , WIDTH = 75 ,  ;
      CONTROLSOURCE = 'qrq' , NAME = 'qrqtext'
 ADD OBJECT ZRQLABEL AS LABEL WITH TOP = 35 , LEFT = 465 , HEIGHT = 22 , WIDTH = 45 ,  ;
      CAPTION = '止日期:' , BACKCOLOR = RGB(255,240,230) , NAME =  ;
      'zrqlabel'
 ADD OBJECT ZRQTEXT AS TEXTBOX WITH TOP = 31 , LEFT = 510 , HEIGHT = 22 , WIDTH = 75 ,  ;
      CONTROLSOURCE = 'zrq' , NAME = 'zrqtext'
 ADD OBJECT CXGRID AS GRID WITH TOP = 60 , LEFT = 0 , WIDTH = 520 , HEIGHT = 310 ,  ;
      SCROLLBARS = 3 , COLUMNCOUNT = 13 , GRIDLINES = 2 , VISIBLE = .F. ,  ;
      DELETEMARK = .F. , RECORDMARK = .T. , HEADERHEIGHT = 30 , ROWHEIGHT = 22 ,  ;
      NAME = 'cxgrid'
 ADD OBJECT RKZLLABEL AS LABEL WITH TOP = 65 , LEFT = 550 , HEIGHT = 25 , WIDTH = 70 ,  ;
      FONTSIZE = 12 , FONTNAME = '宋体' , VISIBLE = .F. , CAPTION =  ;
      '入库吨:' , FORECOLOR = RGB(255,0,0) , BACKCOLOR = RGB(255,240,230) , NAME =  ;
      'rkzllabel'
 ADD OBJECT RKZLTEXT AS TEXTBOX WITH TOP = 85 , LEFT = 535 , HEIGHT = 25 , WIDTH = 95 ,  ;
      FONTSIZE = 12 , ENABLED = .F. , VISIBLE = .F. , CONTROLSOURCE =  ;
      'rkzl' , INPUTMASK = '99999.999' , DISABLEDBACKCOLOR = RGB(255,240,230) ,  ;
      DISABLEDFORECOLOR = RGB(0,0,255) , NAME = 'rkzltext'
 ADD OBJECT CKZLLABEL AS LABEL WITH TOP = 115 , LEFT = 550 , HEIGHT = 25 , WIDTH = 70 ,  ;
      FONTSIZE = 12 , FONTNAME = '宋体' , VISIBLE = .F. , CAPTION =  ;
      '出库吨:' , FORECOLOR = RGB(255,0,0) , BACKCOLOR = RGB(255,240,230) , NAME  ;
      = 'ckzllabel'
 ADD OBJECT CKZLTEXT AS TEXTBOX WITH TOP = 135 , LEFT = 535 , HEIGHT = 25 , WIDTH =  ;
      95 , FONTSIZE = 12 , ENABLED = .F. , VISIBLE = .F. , CONTROLSOURCE =  ;
      'ckzl' , INPUTMASK = '99999.999' , DISABLEDBACKCOLOR = RGB(255,240,230) ,  ;
      DISABLEDFORECOLOR = RGB(0,0,255) , NAME = 'ckzltext'
 ADD OBJECT RKJSLABEL AS LABEL WITH TOP = 165 , LEFT = 550 , HEIGHT = 25 , WIDTH = 70 ,  ;
      FONTSIZE = 12 , FONTNAME = '宋体' , VISIBLE = .F. , CAPTION =  ;
      '入库件数:' , FORECOLOR = RGB(255,0,0) , BACKCOLOR = RGB(255,240,230) ,  ;
      NAME = 'rkjslabel'
 ADD OBJECT RKJSTEXT AS TEXTBOX WITH TOP = 185 , LEFT = 535 , HEIGHT = 25 , WIDTH =  ;
      95 , FONTSIZE = 12 , ENABLED = .F. , VISIBLE = .F. , CONTROLSOURCE =  ;
      'rkjs' , INPUTMASK = '99999999' , DISABLEDBACKCOLOR = RGB(255,240,230) ,  ;
      DISABLEDFORECOLOR = RGB(0,0,255) , NAME = 'rkjstext'
 ADD OBJECT CKJSLABEL AS LABEL WITH TOP = 215 , LEFT = 550 , HEIGHT = 25 , WIDTH = 70 ,  ;
      FONTSIZE = 12 , FONTNAME = '宋体' , VISIBLE = .F. , CAPTION =  ;
      '出库件数:' , FORECOLOR = RGB(255,0,0) , BACKCOLOR = RGB(255,240,230) ,  ;
      NAME = 'ckjslabel'
 ADD OBJECT CKJSTEXT AS TEXTBOX WITH TOP = 235 , LEFT = 535 , HEIGHT = 25 , WIDTH =  ;
      95 , FONTSIZE = 12 , ENABLED = .F. , VISIBLE = .F. , CONTROLSOURCE =  ;
      'ckjs' , INPUTMASK = '99999999' , DISABLEDBACKCOLOR = RGB(255,240,230) ,  ;
      DISABLEDFORECOLOR = RGB(0,0,255) , NAME = 'ckjstext'
 ADD OBJECT PRINTBUTTON AS COMMANDBUTTON WITH FONTNAME = '宋体' , CAPTION = '打   印' ,  ;
      VISIBLE = .F. , HEIGHT = 25 , TOP = 280 , LEFT = 550 , WIDTH = 70 ,  ;
      NAME = 'printbutton'
 ADD OBJECT CXCX AS COMMANDBUTTON WITH FONTNAME = '宋体' , CAPTION = '查   询' ,  ;
      VISIBLE = .F. , HEIGHT = 25 , TOP = 315 , LEFT = 550 , WIDTH = 70 , NAME =  ;
      'cxcx'
 ADD OBJECT CXGETOUT AS COMMANDBUTTON WITH FONTNAME = '宋体' , CAPTION = '退   出' ,  ;
      VISIBLE = .T. , HEIGHT = 25 , TOP = 350 , LEFT = 550 , WIDTH = 70 ,  ;
      NAME = 'cxgetout'

PROCEDURE Unload
 CLEAR
 CLOSE ALL
 POP KEY
 SET SKIP OF MENU _MSYSMENU .F.
 RELEASE CXFORM , XRCPOPUP , QRQ , ZRQ , SPPH , KH , HZH , HTH , CXJGTJ , RKZL , CKZL ,  ;
      RKJS , CKJS
ENDPROC
*------

PROCEDURE spphtext.GotFocus
 IF XRCPOPUP = 'ckpop'
    THISFORM.CAPTION = '出库查询'
 ELSE
    THISFORM.CAPTION = '入库查询'
 ENDIF
ENDPROC
*------

PROCEDURE spphtext.Valid
 RKZL = 0
 CKZL = 0
 IF EMPTY(THISFORM.SPPHTEXT.VALUE)
    THISFORM.HTHTEXT.ENABLED = .T.
 ELSE
    HTH = SPACE(8)
    HZH = SPACE(7)
    KH = SPACE(4)
    QRQ = {}
    ZRQ = {}
    THISFORM.HTHTEXT.ENABLED = .F.
    THISFORM.HZHTEXT.ENABLED = .F.
    THISFORM.KHTEXT.ENABLED = .F.
    THISFORM.QRQTEXT.ENABLED = .F.
    THISFORM.ZRQTEXT.ENABLED = .F.
     THISFORM.REFRESH
    SELECT DSPPH , DCC , DPM , DGG , DSL , DKC , DKH , DFW , DHZH , DHTH , DRQ , DXH , DLX  ;
         FROM (PATH + 'lys') WHERE DSPPH = SPPH INTO CURSOR cxtmp
    USE IN LYS
    IF _TALLY = 0
       ?? CHR(7)
       THISFORM.CXGRID.VISIBLE = .F.
       WAIT WINDOW '无此条件数据!'
       SPPH = SPACE(8)
        THISFORM.REFRESH
       RETURN 0
    ELSE
       SUM FOR DLX = '入库' TO RKZL DSL * DGG / 1000
       SUM FOR DLX = '出库' TO CKZL -DSL * DGG / 1000
       SUM FOR DLX = '入库' TO RKJS DSL
       SUM FOR DLX = '出库' TO CKJS -DSL
       GO TOP
       THISFORM.SPPHTEXT.ENABLED = .F.
       THISFORM.CXGRID.VISIBLE = .T.
       THISFORM.CXGRID.RECORDSOURCE = 'cxtmp'
       THISFORM.RKZLLABEL.VISIBLE = .T.
       THISFORM.RKZLTEXT.VISIBLE = .T.
       THISFORM.CKZLLABEL.VISIBLE = .T.
       THISFORM.CKZLTEXT.VISIBLE = .T.
       THISFORM.RKJSLABEL.VISIBLE = .T.
       THISFORM.RKJSTEXT.VISIBLE = .T.
       THISFORM.CKJSLABEL.VISIBLE = .T.
       THISFORM.CKJSTEXT.VISIBLE = .T.
       THISFORM.PRINTBUTTON.VISIBLE = .T.
       THISFORM.CXCX.VISIBLE = .T.
        THISFORM.REFRESH
    ENDIF
 ENDIF
ENDPROC
*------

PROCEDURE hthtext.Valid
 THISFORM.QRQTEXT.ENABLED = .T.
 THISFORM.ZRQTEXT.ENABLED = .T.
 IF EMPTY(THISFORM.HTHTEXT.VALUE)
    THISFORM.HZHTEXT.ENABLED = .T.
    THISFORM.KHTEXT.ENABLED = .T.
 ELSE
    HZH = SPACE(7)
    KH = SPACE(4)
    THISFORM.HZHTEXT.ENABLED = .F.
    THISFORM.KHTEXT.ENABLED = .F.
     THISFORM.REFRESH
    CXJGTJ = CXTJ('DHTH','hth','=')
 ENDIF
ENDPROC
*------

PROCEDURE hzhtext.Valid
 CXJGTJ = ''
 IF  .NOT. EMPTY(THISFORM.HZHTEXT.VALUE)
    CXJGTJ = CXTJ('DHZH','hzh','=')
 ENDIF
ENDPROC
*------

PROCEDURE khtext.Valid
 IF  .NOT. EMPTY(THISFORM.KHTEXT.VALUE)
    CXJGTJ = CXTJ('DKH','kh','=')
 ENDIF
ENDPROC
*------

PROCEDURE qrqtext.Valid
 IF  .NOT. EMPTY(THISFORM.QRQTEXT.VALUE)
    CXJGTJ = CXTJ('DRQ','qrq','>=')
 ENDIF
ENDPROC
*------

PROCEDURE zrqtext.Valid
 RKZL = 0
 CKZL = 0
 IF  .NOT. EMPTY(THISFORM.ZRQTEXT.VALUE)
    CXJGTJ = CXTJ('DRQ','zrq','<=')
 ELSE
    IF EMPTY(CXJGTJ)
       RETURN -5
    ENDIF
 ENDIF
 IF XRCPOPUP = 'ckpop'
    CXJGTJ = CXJGTJ + " AND dlx='出库'"
 ELSE
    CXJGTJ = CXJGTJ + " AND dlx='入库'"
 ENDIF
 IF LASTKEY() = 5 .OR. LASTKEY() = 19
    RETURN -1
 ELSE
     SELECT dspph,dcc,dpm,dgg,dsl,dkc,dkh,dfw,dhzh,dhth,drq,dxh,dlx FROM (path+"lys") WHERE &cxjgtj INTO CURSOR cxtmp
    USE IN LYS
    IF _TALLY = 0
       ?? CHR(7)
       THISFORM.HZHTEXT.ENABLED = .T.
       THISFORM.KHTEXT.ENABLED = .T.
       THISFORM.CXGRID.VISIBLE = .F.
       WAIT WINDOW '无此条件数据!'
       SPPH = SPACE(8)
       HTH = SPACE(8)
       HZH = SPACE(7)
       KH = SPACE(4)
       STORE {} TO QRQ , ZRQ
        THISFORM.REFRESH
       RETURN -5
    ELSE
       SUM FOR DLX = '入库' TO RKZL DSL * DGG / 1000
       SUM FOR DLX = '出库' TO CKZL -DSL * DGG / 1000
       SUM FOR DLX = '入库' TO RKJS DSL
       SUM FOR DLX = '出库' TO CKJS -DSL
       GO TOP
       THISFORM.SPPHTEXT.ENABLED = .F.
       THISFORM.HTHTEXT.ENABLED = .F.
       THISFORM.HZHTEXT.ENABLED = .F.
       THISFORM.KHTEXT.ENABLED = .F.
       THISFORM.QRQTEXT.ENABLED = .F.
       THISFORM.ZRQTEXT.ENABLED = .F.
       THISFORM.CXGRID.VISIBLE = .T.
       THISFORM.CXGRID.RECORDSOURCE = 'cxtmp'
       THISFORM.RKZLLABEL.VISIBLE = .T.
       THISFORM.RKZLTEXT.VISIBLE = .T.
       THISFORM.CKZLLABEL.VISIBLE = .T.
       THISFORM.CKZLTEXT.VISIBLE = .T.
       THISFORM.RKJSLABEL.VISIBLE = .T.
       THISFORM.RKJSTEXT.VISIBLE = .T.
       THISFORM.CKJSLABEL.VISIBLE = .T.
       THISFORM.CKJSTEXT.VISIBLE = .T.
       THISFORM.PRINTBUTTON.VISIBLE = .T.
       THISFORM.CXCX.VISIBLE = .T.
        THISFORM.REFRESH
    ENDIF
 ENDIF
ENDPROC
*--
2014-03-06 00:26
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9841
专家分:27213
注 册:2012-2-5
收藏
得分:0 
加引号试试

坚守VFP最后的阵地
2014-03-06 01:12
pylyh
Rank: 1
等 级:新手上路
帖 子:59
专家分:0
注 册:2013-8-26
收藏
得分:0 
回复 4楼 sdta
怎样加法,请指导!
2014-03-06 20:15
qingfameng
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:35
帖 子:964
专家分:3019
注 册:2010-2-6
收藏
得分:7 

也可以这样考虑。起日期与止日期,必须首先默认2个具体值,比如:trq1=date()-20,trq2=date(),
 表单中其他项,就可以成为可选项了,问题能大大简化。查询按钮 click 参考代码如下,
 
  SELECT 你的出(入)库表
  cxjgtj='  where qrq>=trq1 and zrq<=zrq '
  IF !EMPTY(spbh)
     cxjgtj=cxjgtj+" and  alltrim(商品编号)='"+alltrim(spbh)+"'"
  ENDIF
  
  IF !EMPTY(hth)
     cxjgtj=cxjgtj+" and alltrim(合同号)='"+alltrim(hth)+"'"
  ENDIF
  ........
  
  IF rkzl<>0
     cxjgtj=cxjgtj+" and alltrim(str(入库吨))='"+alltrim(str(rkzl))+"'"
  ENDIF

  .......
  
    最后:
   SELECT dspph,dcc,dpm,dgg,dsl,dkc,dkh,dfw,dhzh,dhth,drq,dxh,dlx FROM (path+"lys") INTO CURSOR cxtmp &cxjgtj
 
收到的鲜花
  • sdta2014-03-06 22:46 送鲜花  20朵   附言:我很赞同
2014-03-06 22:29
pylyh
Rank: 1
等 级:新手上路
帖 子:59
专家分:0
注 册:2013-8-26
收藏
得分:0 
回复 6楼 qingfameng
你好,我想在现有程序做些改动,在合同号中输入12就能显示出所有字符中包括12的编号,不用输入6*12,请问怎样修改,因现在必须输入整个才能显示。
图片附件: 游客没有浏览图片的权限,请 登录注册


[ 本帖最后由 pylyh 于 2014-3-6 23:25 编辑 ]
2014-03-06 23:20
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9841
专家分:27213
注 册:2012-2-5
收藏
得分:0 
SELECT dspph,dcc,dpm,dgg,dsl,dkc,dkh,dfw,dhzh,dhth,drq,dxh,dlx FROM (path+"lys") INTO CURSOR cxtmp &cxjgtj. AND ALLTRIM(THISFORM.合同号.VALUE)$ALLTRIM(商品批号)
SELECT dspph,dcc,dpm,dgg,dsl,dkc,dkh,dfw,dhzh,dhth,drq,dxh,dlx FROM (path+"lys") INTO CURSOR cxtmp &cxjgtj. AND ALLTRIM(THISFORM.合同号.VALUE)$ALLTRIM(商品批号)

在原来的查询条件中再加个条件

[ 本帖最后由 sdta 于 2014-3-6 23:31 编辑 ]

坚守VFP最后的阵地
2014-03-06 23:30
pylyh
Rank: 1
等 级:新手上路
帖 子:59
专家分:0
注 册:2013-8-26
收藏
得分:0 
回复 8楼 sdta
请问怎样在合同号中输入任意一个字符就能显示出来?现在还是要输入全称。
2014-03-07 00:08
sdta
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
来 自:江苏省连云港市
等 级:版主
威 望:335
帖 子:9841
专家分:27213
注 册:2012-2-5
收藏
得分:0 
看8楼代码

坚守VFP最后的阵地
2014-03-07 00:14
快速回复:请教任意输入字显示
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.031303 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved