123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434 |
- $PBExportHeader$w_expensesdef.srw
- forward
- global type w_expensesdef from w_publ_edit_choice
- end type
- type cbx_mlselect from checkbox within w_expensesdef
- end type
- type cbx_allselect from checkbox within w_expensesdef
- end type
- end forward
- global type w_expensesdef from w_publ_edit_choice
- integer width = 2048
- integer height = 1544
- string title = "客户费用项目"
- cbx_mlselect cbx_mlselect
- cbx_allselect cbx_allselect
- end type
- global w_expensesdef w_expensesdef
- type variables
- s_mtrldef_array INS_RT_STRU
- int if_mlselect=0
- boolean if_select_all=false
- boolean if_changeselect=true
- end variables
- forward prototypes
- public function integer wf_face_change ()
- end prototypes
- public function integer wf_face_change (); cbx_mlselect.enabled = not dw_edit_mode
- cbx_allselect.enabled = not dw_edit_mode
- IF dw_edit_mode THEN
- cb_func.Enabled = FALSE
- cb_choice.Enabled = FALSE
- cb_delet.Enabled = FALSE
- cb_rtr.Enabled = FALSE
-
- cb_edit.Text = "放弃&E"
- cb_add.Text = "保存&S"
- cb_edit.normalpicname = 'Undo.bmp'
- cb_add.normalpicname = 'Save.bmp'
- ELSE
- cb_func.Enabled = TRUE
- cb_delet.Enabled = TRUE
- cb_choice.Enabled = TRUE
- cb_rtr.Enabled = TRUE
-
- cb_edit.Text = "修改&E"
- cb_add.Text = "新建&S"
- cb_edit.normalpicname = 'OPEN.bmp'
- cb_add.normalpicname = 'new.bmp'
- END IF
- cb_edit.of_init_draw()
- cb_add.of_init_draw()
- cb_edit.of_paint()
- cb_add.of_paint()
- cb_add.TriggerEvent('ue_textchange')
- cb_edit.TriggerEvent('ue_textchange')
- RETURN 1
- end function
- on w_expensesdef.create
- int iCurrent
- call super::create
- this.cbx_mlselect=create cbx_mlselect
- this.cbx_allselect=create cbx_allselect
- iCurrent=UpperBound(this.Control)
- this.Control[iCurrent+1]=this.cbx_mlselect
- this.Control[iCurrent+2]=this.cbx_allselect
- end on
- on w_expensesdef.destroy
- call super::destroy
- destroy(this.cbx_mlselect)
- destroy(this.cbx_allselect)
- end on
- event close;call super::close;CLOSEWITHRETURN(THIS,INS_RT_STRU)
- end event
- type cb_func from w_publ_edit_choice`cb_func within w_expensesdef
- end type
- type cb_exit from w_publ_edit_choice`cb_exit within w_expensesdef
- end type
- type cb_add from w_publ_edit_choice`cb_add within w_expensesdef
- end type
- event cb_add::clicked;call super::clicked;IF NOT f_power_ind(1018) THEN
- MessageBox('提示','你没有使用权限!', Information!, OK! )
- RETURN
- END IF
- Long ll_newid,i
- String errmsg
- IF dw_edit_mode THEN
- dw_uc.AcceptText()
- IF dw_uc.GetNextModified(0, Primary!) = 0 THEN
- MessageBox('提示','没有任何修改,不可以保存!', Information!, OK! )
- RETURN
- END IF
- dw_uc.Object.expensesname[dw_uc.GetRow()] = Trim(dw_uc.Object.expensesname[dw_uc.GetRow()])
- dw_uc.Object.expensescode[dw_uc.GetRow()] = Trim(dw_uc.Object.expensescode[dw_uc.GetRow()])
-
- IF dw_uc.Object.expensesname[dw_uc.GetRow()] = '' THEN
- MessageBox('提示','请输入项目名称!', Information!, OK! )
- RETURN
- END IF
- IF dw_uc.Object.expensescode[dw_uc.GetRow()] = '' THEN
- MessageBox('提示','请输入项目名称!', Information!, OK! )
- RETURN
- END IF
- IF dw_uc.Object.expensesid[dw_uc.GetRow()] = 0 THEN
- ll_newid = f_sys_scidentity(0,"U_Expenses","ExpensesID",errmsg,FALSE,sqlca)
- IF ll_newid <= 0 THEN
- MessageBox('提示',errmsg, Information!, OK! )
- RETURN
- ELSE
- dw_uc.Object.expensesid[dw_uc.GetRow()] = ll_newid
- END IF
- END IF
- END IF
- IF dw_edit_mode THEN
- String ls_errmsg
- IF dw_uc.Update() = -1 THEN
- IF Pos(ins_sqlerrtext,"Cannot insert duplicate key row") > 0 THEN
- ls_errmsg = "关键内容重复"
- ELSE
- ls_errmsg = "因为网络或其他原因>"+ins_sqlerrtext
- END IF
- ROLLBACK;
- MessageBox ('提示',ls_errmsg+",保存操作失败!",Exclamation!,OK!)
- LS_UPDATE_FLAG = FALSE
- RETURN
- ELSE
- COMMIT;
- FOR i = 1 TO 3
- dw_uc.SetTabOrder ( i, 0 )
- NEXT
- LS_UPDATE_FLAG = TRUE
- END IF
- ins_sqlerrtext = ""
- ELSE
- Long li_row, li_cur_row
- li_cur_row = dw_uc.GetRow()
- li_row = dw_uc.InsertRow (0)
- FOR i = 1 TO 3
- dw_uc.SetTabOrder ( i, i*10 )
- NEXT
- dw_uc.SelectRow(0,FALSE)
- dw_uc.ScrollToRow (li_row)
- dw_uc.SelectRow(li_row,TRUE)
- dw_uc.SetFocus()
- modifyrow_no = li_row
- END IF
- dw_edit_mode = NOT dw_edit_mode
- WF_FACE_CHANGE()
- end event
- type cb_edit from w_publ_edit_choice`cb_edit within w_expensesdef
- end type
- event cb_edit::clicked;call super::clicked;IF NOT f_power_ind(1018) THEN
- MessageBox('提示','你没有使用权限!', Information!, OK! )
- RETURN
- END IF
- long i
- IF dw_edit_mode THEN
- if dw_uc.GetItemStatus(dw_UC.getrow(), 0, Primary!)=NewModified! or dw_uc.GetItemStatus(dw_UC.getrow(), 0, Primary!)=New! then
- dw_UC.deleterow(dw_UC.getrow())
- else
- dw_UC.ReselectRow(dw_UC.getrow())
- end if
- for i=1 to 3
- dw_UC.SetTabOrder ( i, 0 )
- next
- modifyrow_no = 0
- ELSE
- modifyrow_no = dw_UC.getrow()
- for i=1 to 3
- dw_UC.SetTabOrder ( i, i*10 )
- next
- dw_UC.SetFocus()
-
- dw_UC.selectrow(0,false)
- dw_UC.ScrollToRow (modifyrow_no)
- dw_uc.selectrow(modifyrow_no,true)
-
- END IF
- dw_edit_mode= NOT dw_edit_mode
- WF_FACE_CHANGE()
- end event
- type cb_delet from w_publ_edit_choice`cb_delet within w_expensesdef
- end type
- event cb_delet::clicked;call super::clicked;IF NOT f_power_ind(1018) THEN
- MessageBox('提示','你没有使用权限!', Information!, OK! )
- RETURN
- END IF
- IF MessageBox ('询问',"是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN
- RETURN
- END IF
- Long LS_id
- Long LS_LONG = 0
- String ls_code,arg_msg
- IF DW_UC.GetRow() <= 0 THEN
- MessageBox('','没有操作目标记录!', Information!, OK! )
- RETURN
- END IF
- LS_id = DW_UC.Object.Expensesid[DW_UC.GetRow()]
- SELECT count(u_reissuemx.mtrlid) INTO :LS_LONG
- FROM u_reissuemx INNER JOIN
- u_reissue ON u_reissuemx.reissueid = u_reissue.reissueid AND
- u_reissuemx.scid = u_reissue.scid
- Where (u_reissue.TYPE = 1) AND u_reissuemx.mtrlid = :LS_id;
- IF SQLCA.SQLCode <> 0 THEN
- MessageBox ('提示',"数据查询操作失败!(请重试!)",Exclamation!,OK!)
- RETURN
- END IF
- IF LS_LONG > 0 THEN
- MessageBox ('提示',"该资料已经使用于补件单,不可以删除!",Exclamation!,OK!)
- RETURN
- END IF
- DW_UC.SetRedraw (FALSE)
- DW_UC.DeleteRow (0)
- DW_UC.TriggerEvent (RowFocusChanged!)
- IF DW_UC.Update() = -1 THEN
- ROLLBACK;
- MessageBox ('提示',"删除记录操作失败!",Exclamation!,OK!)
- ELSE
- COMMIT;
- END IF
- DW_UC.SetRedraw (TRUE)
- end event
- type cb_choice from w_publ_edit_choice`cb_choice within w_expensesdef
- end type
- event cb_choice::clicked;call super::clicked;Long ROW,ls_i,chC = 0
- ROW = dw_uc.GetRow()
- IF ROW <= 0 THEN
- MessageBox('提示','请先选择目标行!', Information!, OK! )
- RETURN
- END IF
- FOR ls_i = 1 TO dw_uc.RowCount()
- IF dw_uc.IsSelected(ls_i) THEN
- chC++
- INS_RT_STRU.mtrlid[chC] = dw_uc.Object.Expensesid[ls_i]
- INS_RT_STRU.mtrlname[chC] = dw_uc.Object.Expensesname[ls_i]
- INS_RT_STRU.mtrlcode[chC] = dw_uc.Object.Expensescode[ls_i]
- END IF
- NEXT
- IF chC = 0 THEN
- MessageBox('提示','请至少选择一个目标行!', Information!, OK! )
- RETURN
- END IF
- Close(PARENT)
- end event
- type dw_uc from w_publ_edit_choice`dw_uc within w_expensesdef
- integer width = 2016
- string dataobject = "dw_expensesdef"
- end type
- event dw_uc::clicked;if row > 0 and dw_edit_mode then
- this.setrow(row)
- if if_mlselect = 1 then
- if if_changeselect then
- this.selectrow(row,not this.isselected(row))
- else
- if_changeselect = true
- end if
- else
- this.selectrow(0,false)
- this.selectrow(row,true)
- end if
- end if
- end event
- event dw_uc::rowfocuschanged;IF modifyrow_no > 0 AND dw_edit_mode THEN
- THIS.SetRow(modifyrow_no)
- THIS.ScrollToRow(modifyrow_no)
- ELSE
- IF if_mlselect = 1 THEN
- IF currentrow <= 0 THEN RETURN
- IF KeyDown(keycontrol!) THEN
- IF THIS.IsSelected(currentrow) THEN
- THIS.SelectRow(currentrow,FALSE)
- if_changeselect = FALSE
- ELSE
- if_changeselect = TRUE
- END IF
- ELSE
- IF NOT THIS.IsSelected(currentrow) THEN
- THIS.SelectRow(currentrow,TRUE)
- if_changeselect = FALSE
- ELSE
- if_changeselect = TRUE
- END IF
- END IF
- ELSE
- IF dw_edit_mode THEN RETURN
- IF currentrow <= 0 THEN RETURN
- THIS.SelectRow(0,FALSE)
- THIS.SelectRow(currentrow,TRUE)
- dw_uc.SetRow(currentrow)
- dw_uc.ScrollToRow (currentrow)
- END IF
- END IF
- end event
- event dw_uc::rbuttondown; if dw_edit_mode then return
- call super::rbuttondown
- end event
- event dw_uc::doubleclicked;call super::doubleclicked;cb_choice.triggerevent( clicked!)
- end event
- type cb_rtr from w_publ_edit_choice`cb_rtr within w_expensesdef
- end type
- type cb_help from w_publ_edit_choice`cb_help within w_expensesdef
- end type
- type ln_bar from w_publ_edit_choice`ln_bar within w_expensesdef
- end type
- type ln_bar2 from w_publ_edit_choice`ln_bar2 within w_expensesdef
- end type
- type r_bar from w_publ_edit_choice`r_bar within w_expensesdef
- integer x = 1390
- end type
- type cbx_mlselect from checkbox within w_expensesdef
- integer x = 1362
- integer y = 52
- integer width = 215
- integer height = 60
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 16711680
- long backcolor = 134217739
- string text = "多选"
- end type
- event clicked;if this.checked then
- if_mlselect=1
- cbx_allselect.enabled=true
- else
- if_mlselect=0
- cbx_allselect.enabled=false
- cbx_allselect.checked=false
- cbx_allselect.triggerevent(clicked!)
- end if
-
- f_SetProfileString (sys_empid,dw_uc.DATAOBJECT, "if_mlselect", string(if_mlselect))
- end event
- event constructor;this.backcolor = 14215660
- if_mlselect=long(f_ProfileString (sys_empid,dw_uc.DATAOBJECT, "if_mlselect",'0'))
- if if_mlselect = 0 then
- cbx_mlselect.checked = false
- else
- cbx_mlselect.checked = true
- end if
- end event
- type cbx_allselect from checkbox within w_expensesdef
- integer x = 1678
- integer y = 52
- integer width = 229
- integer height = 60
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 16711680
- long backcolor = 134217739
- boolean enabled = false
- string text = "全选"
- end type
- event clicked;if dw_uc.rowcount()<=0 then return
- long li
- if this.checked then
- for li =1 to dw_uc.rowcount()
- dw_uc.selectrow(li,true)
- next
- else
- for li =1 to dw_uc.rowcount()
- dw_uc.selectrow(li,false)
- next
- end if
- end event
- event constructor;this.backcolor = 14215660
- end event
|