制作查询数据窗口php,pb 检索数据窗口做条件查询 | 学步园

思路  更改 数据窗口的sql     通过sql拼接字符串

参考代码

string temp_string

string where_string

string ls_old_sql,ls_new_sql

long ll_all

Date ls_start_date,ls_end_date

Boolean start_is_date,end_is_date

start_is_date = FALSE

end_is_date = FALSE

if IsDate(em_startdate.Text) and em_startdate.Text<>"0000-01-01"then

ls_start_date=date(em_startdate.Text)

start_is_date = TRUE

end if

if IsDate(em_enddate.Text) and em_enddate.Text<>"0000-01-01" then

ls_end_date=date(em_enddate.Text)

ls_end_date=RelativeDate(ls_end_date, 1)

end_is_date = TRUE

end if

IF start_is_date AND end_is_date THEN

IF ls_end_date < ls_start_date THEN

messagebox("错误信息","起始时间不能大于终止时间")

em_startdate.SetFocus()

return

END IF

END IF

IF NOT(start_is_date) THEN

em_startdate.text = "0000-01-01"

END IF

IF NOT(end_is_date) THEN

em_enddate.text = "0000-01-01"

END IF

temp_string = Trim(sle_rcpt_no.Text)

if len(temp_string)>1 then

where_string = " and RCPT_NO='"+temp_string+"'"

end if

temp_string = Trim(sle_name.Text)

if len(temp_string)>1 then

where_string = where_string + " and NAME like '%"+temp_string+"%'"

end if

temp_string = Trim(sle_oper.Text)

if len(temp_string)>1 then

where_string = where_string + " and OPERATOR_NO='"+temp_string+"'"

end if

temp_string = trim(sle_patient_id.Text)

if len(temp_string)>1 then

where_string = where_string + " and PATIENT_ID='"+temp_string+"'"

end if

IF start_is_date THEN

where_string = where_string + " and VISIT_DATE>=to_DATE('"+em_startdate.Text+"','YYYY-MM-DD')"

END IF

IF end_is_date THEN

where_string = where_string + " and VISIT_DATE<=to_DATE('"+STRING(LS_END_DATE,'YYYY-MM-DD')+"','YYYY-MM-DD')"

END IF

ls_old_sql=dw_main.getsqlselect( )

IF where_string<>"" THEN

ls_new_sql = ls_old_sql + " WHERE 1=1 " + where_string

dw_main.setsqlselect(ls_new_sql)

end if

ll_all = dw_main.retrieve( )

dw_main.setsqlselect(ls_old_sql)

IF ll_all<=0 THEN

MessageBox("数据为空","没有满足查询条件的收据")

sle_rcpt_no.SetFocus()

Return

END IF

dw_main.SetFocus()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值