我是个vfp初学者,现有个代码要改下,请教高手我该如何更改,感谢,感谢了!
修改要求:在打印此标签时,只允许打印第一个字段名为"H"的字段,当遇到字段为"001"或者"H239" 时不允许打印,
标签报表原代码如下:
LOCAL lc_id_chpdd_m , lc_i, lc_mod, sql_tmp1
TEXT TO sql_tmp1 NOSHOW
select top 0 c.pingm, c.pingm_bh, c.pcs_lpsh, c.banh, c.dw, a.shul_jh, a.shul_bp, c.liaoh, b.chpdd_bh, f.keh_po, e.bum1_yj, d.keh_bh, chpdd_mc5, a.id_chpdd_m, f.dind_bh
from btr_chpdd_m a
left outer join btr_chpdd_b b on a.id_chpdd_b = b.id_chpdd_b
left outer join bmt_pingm c on a.id_pingm = c.id_pingm
left outer join btr_dind_m e on a.id_dind_m = e.id_dind_m
left outer join btr_dind_b f on e.id_dind_b = f.id_dind_b
left outer join bmt_keh_g d on b.id_keh = d.id_keh and b.id_group = d.id_group
ENDTEXT
IF USED("Pr_my_tr_chpdd_fm_m1")
SELECT Pr_my_tr_chpdd_fm_m1
USE
ENDIF
IF (SQLEXEC(myconnect,sql_tmp1,'Pr_my_tr_chpdd_fm_m1') <= 0)
WAIT WINDOW "通知单表明细取数不成功!" NOWAIT
RETURN
ELSE
SELECT Pr_my_tr_chpdd_fm_m1
ENDIF
SELECT Pr_My_tr_chpdd_fm_m
GO TOP
SCAN
lc_id_chpdd_m = ALLTRIM(id_chpdd_m)
lc_dw = ALLTRIM(dw)
lc_pingm = ALLTRIM(pingm)
lc_keh_po = ALLTRIM(keh_po)
lc_bum1_yj = ALLTRIM(bum1_yj)
lc_liaoh = ALLTRIM(liaoh)
lc_pingm_bh = ALLTRIM(pingm_bh)
lc_dind_bh = ALLTRIM(dind_bh)
lc_chpdd_mc5 = VAL(ALLTRIM(chpdd_mc5))
lc_i = CEILING((shul_jh+shul_bp)/IIF(VAL(ALLTRIM(chpdd_mc5))>0,VAL(ALLTRIM(chpdd_mc5)),(shul_jh+shul_bp)))
lc_mod = mod((shul_jh+shul_bp),IIF(VAL(ALLTRIM(chpdd_mc5))>0,VAL(ALLTRIM(chpdd_mc5)),(shul_jh+shul_bp)))
FOR i=1 TO lc_i
SELECT Pr_My_tr_chpdd_fm_m1
APPEND BLANK
REPLACE NEXT 1 dw WITH lc_dw,;
id_chpdd_m WITH lc_id_chpdd_m,;
pingm WITH lc_pingm,;
dind_bh WITH lc_dind_bh,;
bum1_yj WITH lc_bum1_yj,;
keh_po WITH lc_keh_po,;
liaoh WITH lc_liaoh,;
pingm_bh WITH lc_pingm_bh,;
shul_jh WITH IIF(i=lc_i AND lc_mod>0,lc_mod,lc_chpdd_mc5)
ENDFOR
SELECT Pr_My_tr_chpdd_fm_m
ENDSCAN
IF Pr_My_tr_chpdd_fm_b.keh_bh='H239'
MESSAGEBOX("标签格式不正确!请重新选择“001客户或H239客户标签”!!!","")
SELECT Pr_My_tr_chpdd_fm_m1
ZAP
ENDIF
SELECT Pr_My_tr_chpdd_fm_m1
this.InitialSelectedAlias = "Pr_My_tr_chpdd_fm_m1"