123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- $PBExportHeader$w_sortrow.srw
- $PBExportComments$排序窗口
- forward
- global type w_sortrow from w_publ_base
- end type
- type cb_del from uo_imflatbutton within w_sortrow
- end type
- type cb_add from uo_imflatbutton within w_sortrow
- end type
- type cb_1 from uo_imflatbutton within w_sortrow
- end type
- type dw_criteria from u_dw within w_sortrow
- end type
- end forward
- global type w_sortrow from w_publ_base
- integer x = 617
- integer y = 364
- integer width = 1385
- integer height = 716
- string title = "排序"
- boolean minbox = false
- windowtype windowtype = response!
- cb_del cb_del
- cb_add cb_add
- cb_1 cb_1
- dw_criteria dw_criteria
- end type
- global w_sortrow w_sortrow
- type variables
- Long i_lRow
- String i_aszTypes[]
- DataWindow i_dwToActOn
- end variables
- forward prototypes
- public subroutine wf_setdw_criteria (datawindow arg_dw, long ncolumncount)
- public subroutine wf_save (string arg_sortstr)
- end prototypes
- public subroutine wf_setdw_criteria (datawindow arg_dw, long ncolumncount);Long i,cnt,nColumnIndex
- string des_1,des_2
- string ls_str,oneText
- string sort_arr[],OneSort[]
- //ls_str = "u_cust_name A,u_bmsttakemx_billcode D"
- s_sort_col s_col[]
- LS_STR = f_find_sortset(arg_dw.Dataobject)
- IF nColumnCount <= 0 THEN RETURN
- IF ls_str = "" THEN RETURN
- f_split(ls_str,",",sort_arr)
- for i = 1 to upperbound(sort_arr)
- oneText = sort_arr[i]
- f_split(oneText," ",OneSort)
-
- IF upperbound(OneSort) <> 2 THEN CONTINUE
- cnt++
- s_col[cnt].column_name = OneSort[1]
- s_col[cnt].operators = OneSort[2]
-
- For nColumnIndex = 1 To nColumnCount
- des_1= i_dwToActOn.Describe( "#" + String(nColumnIndex) + ".Name")
- des_2= i_dwtoacton.describe(des_1+ "_t.Text")
-
- IF des_1 = s_col[cnt].column_name THEN
- s_col[cnt].column_number = nColumnIndex
- s_col[cnt].column_name_text = des_2
- END IF
- Next
- next
- IF upperbound(s_col) > 0 THEN
- dw_criteria.reset()
- FOR i = 1 to upperbound(s_col)
- cnt = dw_criteria.insertrow(i)
- dw_criteria.object.column_number[cnt] = s_col[i].column_number
- dw_criteria.object.operators[cnt] = s_col[i].operators
- NEXT
- END IF
- end subroutine
- public subroutine wf_save (string arg_sortstr);String dwname
- dwname = i_dwToActOn.DataObject
- IF dwname = "" THEN RETURN
- UPDATE u_sortSet
- SET sortStr = :arg_sortStr
- WHERE dwname = :dwname;
- IF SQLCA.SQLCode = 0 THEN
- IF SQLCA.SQLNRows = 0 THEN
- INSERT INTO u_sortSet(dwname,sortStr)
- VALUES(:dwname,:arg_sortStr);
- END IF
- COMMIT;
- ELSE
- ROLLBACK;
- END IF
- RETURN
- end subroutine
- on w_sortrow.create
- int iCurrent
- call super::create
- this.cb_del=create cb_del
- this.cb_add=create cb_add
- this.cb_1=create cb_1
- this.dw_criteria=create dw_criteria
- iCurrent=UpperBound(this.Control)
- this.Control[iCurrent+1]=this.cb_del
- this.Control[iCurrent+2]=this.cb_add
- this.Control[iCurrent+3]=this.cb_1
- this.Control[iCurrent+4]=this.dw_criteria
- end on
- on w_sortrow.destroy
- call super::destroy
- destroy(this.cb_del)
- destroy(this.cb_add)
- destroy(this.cb_1)
- destroy(this.dw_criteria)
- end on
- event open;call super::open;Integer nColumnCount, nColumnIndex
- String szColumn
- Long lRow
- DataWindowChild dwcColumns
- string des_1,des_2
- i_dwToActOn = Message.PowerObjectParm
- i_lRow = 0
- nColumnCount = Integer( i_dwToActOn.Object.DataWindow.Column.Count)
- dw_criteria.GetChild( "column_number", dwcColumns)
- i_aszTypes[ nColumnCount] = ""
- For nColumnIndex = 1 To nColumnCount
- des_1= i_dwToActOn.Describe( "#" + String(nColumnIndex) + ".Name")
- des_2= i_dwtoacton.describe(des_1+ "_t.Text")
- szColumn = f_strip( i_dwToActOn.Describe( i_dwToActOn.Describe( "#" + String(nColumnIndex) + ".Name") + "_t.Text"))
- If szColumn <> "!" Then
- lRow = dwcColumns.InsertRow( 0)
- dwcColumns.SetItem( lRow, "column_name", szColumn)
- dwcColumns.SetItem( lRow, "column_number", nColumnIndex)
- i_aszTypes[ nColumnIndex] = i_dwToActOn.Describe( "#" + String(nColumnIndex) + ".ColType")
- End If
- Next
- dw_criteria.TriggerEvent( "NewRow")
- wf_SetDw_criteria(i_dwToActOn,nColumnCount)
- end event
- type cb_func from w_publ_base`cb_func within w_sortrow
- boolean visible = false
- integer y = 488
- boolean enabled = false
- end type
- type cb_exit from w_publ_base`cb_exit within w_sortrow
- integer x = 791
- integer y = 488
- integer width = 325
- string text = "取消"
- end type
- type cb_del from uo_imflatbutton within w_sortrow
- integer x = 1001
- integer y = 136
- integer width = 325
- integer height = 96
- integer taborder = 41
- string text = "删除行"
- end type
- event clicked;call super::clicked;dw_criteria.TriggerEvent( "DELETERow")
- end event
- type cb_add from uo_imflatbutton within w_sortrow
- integer x = 1001
- integer y = 16
- integer width = 325
- integer height = 96
- integer taborder = 41
- string text = "增加行"
- end type
- event clicked;call super::clicked;dw_criteria.TriggerEvent( "NewRow")
- end event
- type cb_1 from uo_imflatbutton within w_sortrow
- integer x = 311
- integer y = 488
- integer width = 325
- integer height = 96
- integer taborder = 41
- boolean default = true
- end type
- event clicked;call super::clicked;Long lNoOfCriteria, lRow, lColumnNo,lLen
- Integer nPos
- String szFind,szColumn,szOperator
- STRING szExpression=''
- lNoOfCriteria = dw_criteria.RowCount()
- For lRow = 1 To lNoOfCriteria
- lColumnNo = dw_criteria.GetItemNumber( lRow, "column_number")
- szColumn = i_dwToActOn.Describe( "#" + String( lColumnNo) + ".Name")//dbName //FILTER 与SELECT 区别
- If IsNull( dw_criteria.GetItemNumber( lrow, "column_number")) Then
- exit
- End If
- szOperator = ( dw_criteria.GetItemString( lRow, "operators"))
- szExpression = szExpression + szColumn +' '+ szOperator + ','
- Next
- SZFIND=trim(szExpression)
- if right(SZFIND,1)=',' THEN
- SZFIND=LEFT(SZFIND,LEN(SZFIND) - 1)
- END IF
- wf_save(SZFIND)
- Closewithreturn(parent,szfind)
- end event
- type dw_criteria from u_dw within w_sortrow
- integer x = 18
- integer y = 12
- integer width = 951
- integer height = 448
- integer taborder = 20
- boolean bringtotop = true
- string dataobject = "d_sort"
- boolean vscrollbar = true
- boolean border = false
- end type
|