PB實現庫房臺賬模糊查詢功能
阿新 • • 發佈:2019-01-10
俗話說,天下PB一般醜,←我說的。
PB做出來的介面是真的醜。。先給一張圖吧
簡單的不能再簡單了,那個tab可以更美觀一點,公司的人都是幹了十七八年PB的老員工,問他們這些也不太好意思,是那麼回事就行了,反正實現的功能一樣。。美觀。。是給客戶看的又不是我。。要改再說。
沒寫多少函式,至於這些函式幹什麼的,每個公司跟每個公司都不一樣,有需要的話我可以分享給大家。
寫下模糊查詢吧,可能大家比較在意怎麼實現拼接語句,庫房的人總不能一打開臺賬全部的單子都查的吧。
dwo的語法就是 select * from table 沒有where條件。沒有入參
投機取巧了,where條件是寫了一個字串哈哈哈,反正客戶看不見。。。。。
String ls_input String is_sqlwhere,ls_sqlstr,newSql int stime,etime is_sqlwhere =' Where db_center='+"'"+gs_dbname+"'" //==================================================================== // 檢測是否含有'號 //==================================================================== //IF Pos(sle_input.Text,"'") > 0 THEN // RETURN //END IF // // //==================================================================== // 查詢條件 //==================================================================== // ls_input = Trim(sle_input.Text) //po IF cbx_po.Checked THEN if len(ls_sqlstr) > 0 then ls_sqlstr += " and INV_WarehouseAccount.po_sn like N'%"+Trim(sle_po.Text) +"%' " else ls_sqlstr = " and INV_WarehouseAccount.po_sn like N'%"+Trim(sle_po.Text) +"%' " end if END IF //material code IF cbx_mc.Checked THEN if len(ls_sqlstr) > 0 then ls_sqlstr += " and INV_WarehouseAccount.Item_code like N'%"+Trim(sle_mc.Text) +"%' " else ls_sqlstr = " and INV_WarehouseAccount.Item_code like N'%"+Trim(sle_mc.Text) +"%' " end if END IF //Material Name IF cbx_mn.Checked THEN if len(ls_sqlstr) > 0 then ls_sqlstr += " and INV_WarehouseAccount.Material_Name like N'%"+Trim(sle_mn.Text) +"%' " else ls_sqlstr = " and INV_WarehouseAccount.Material_Name like N'%"+Trim(sle_mn.Text) +"%' " end if END IF ///warehouse IF cbx_warehouse.Checked THEN if len(ls_sqlstr) > 0 then ls_sqlstr += " and INV_WarehouseAccount.warehouse_sn like N'%"+Trim(sle_warehouse.Text) +"%' " else ls_sqlstr = " and INV_WarehouseAccount.warehouse_sn like N'%"+Trim(sle_warehouse.Text) +"%' " end if END IF //bin IF cbx_bin.Checked THEN if len(ls_sqlstr) > 0 then ls_sqlstr += " and INV_WarehouseAccount.Bin_sn like N'%"+Trim(sle_bin.Text) +"%' " else ls_sqlstr = " and INV_WarehouseAccount.Bin_sn like N'%"+Trim(sle_bin.Text) +"%' " end if END IF //date IF cbx_date.Checked THEN stime = len(sle_stime.text) etime = len(sle_etime.text) if stime>0 and etime=0 then if len(ls_sqlstr) > 0 then ls_sqlstr +="and INV_WarehouseAccount.create_date >='"+Trim(sle_stime.text)+"'" else ls_sqlstr ="and INV_WarehouseAccount.create_date >='"+Trim(sle_stime.text)+"'" end if end if if stime=0 and etime>0 then if len(ls_sqlstr) > 0 then ls_sqlstr +="and INV_WarehouseAccount.create_date <='"+Trim(sle_etime.text)+"'" else ls_sqlstr ="and INV_WarehouseAccount.create_date <='"+Trim(sle_etime.text)+"'" end if end if if stime>0 and etime>0 then if len(ls_sqlstr) > 0 then ls_sqlstr +="and INV_WarehouseAccount.create_date between'"+Trim(sle_stime.text)+"'"+" and '"+Trim(sle_etime.text)+"'" else ls_sqlstr ="and INV_WarehouseAccount.create_date between'"+Trim(sle_stime.text)+"'"+" and '"+Trim(sle_etime.text)+"'" end if //todo change time swap end if END IF //==================================================================== // 檢索資料 //==================================================================== dw_list.setredraw(false) newSql = oldSql + is_sqlwhere + ls_sqlstr +" order by INV_WarehouseAccount.po_sn,INV_WarehouseAccount.item_code,INV_WarehouseAccount.batch_no;" dw_list.setsqlselect(newSql) //newSql=dw_list.getsqlselect( ) dw_list.retrieve() dw_list.setredraw(true)