123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488 |
- $PBExportHeader$w_item_cust_spt_edit.srw
- forward
- global type w_item_cust_spt_edit from w_publ_edit_choice
- end type
- type cb_1 from uo_imflatbutton within w_item_cust_spt_edit
- end type
- type dw_1 from u_dw_rbtnfilter within w_item_cust_spt_edit
- end type
- type cb_addmx from uo_imflatbutton within w_item_cust_spt_edit
- end type
- type cb_delmx from uo_imflatbutton within w_item_cust_spt_edit
- end type
- end forward
- global type w_item_cust_spt_edit from w_publ_edit_choice
- integer width = 3611
- integer height = 2380
- string title = "客户及供应商辅助项目"
- boolean minbox = true
- windowtype windowtype = popup!
- event retrieve_mx ( )
- cb_1 cb_1
- dw_1 dw_1
- cb_addmx cb_addmx
- cb_delmx cb_delmx
- end type
- global w_item_cust_spt_edit w_item_cust_spt_edit
- forward prototypes
- public subroutine wf_face ()
- end prototypes
- event retrieve_mx();Long ll_row,ll_itemid
- ll_row = dw_uc.GetRow()
- IF ll_row <= 0 THEN
- dw_1.Reset()
- ELSE
- ll_itemid = dw_uc.Object.itemid[ll_row]
- dw_1.Retrieve(ll_itemid)
- END IF
- end event
- public subroutine wf_face ();cb_addmx.Enabled = NOT dw_edit_mode
- cb_delmx.Enabled = NOT dw_edit_mode
- end subroutine
- on w_item_cust_spt_edit.create
- int iCurrent
- call super::create
- this.cb_1=create cb_1
- this.dw_1=create dw_1
- this.cb_addmx=create cb_addmx
- this.cb_delmx=create cb_delmx
- iCurrent=UpperBound(this.Control)
- this.Control[iCurrent+1]=this.cb_1
- this.Control[iCurrent+2]=this.dw_1
- this.Control[iCurrent+3]=this.cb_addmx
- this.Control[iCurrent+4]=this.cb_delmx
- end on
- on w_item_cust_spt_edit.destroy
- call super::destroy
- destroy(this.cb_1)
- destroy(this.dw_1)
- destroy(this.cb_addmx)
- destroy(this.cb_delmx)
- end on
- event ue_before_open;call super::ue_before_open;dw_1.SetTransObject(sqlca)
- end event
- type cb_func from w_publ_edit_choice`cb_func within w_item_cust_spt_edit
- end type
- type cb_exit from w_publ_edit_choice`cb_exit within w_item_cust_spt_edit
- integer x = 1454
- end type
- type cb_add from w_publ_edit_choice`cb_add within w_item_cust_spt_edit
- end type
- event cb_add::clicked;call super::clicked;IF Not (f_power_ind(1274) OR f_power_ind(1276)) 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.itemcode[dw_uc.GetRow()] = Trim(dw_uc.Object.itemcode[dw_uc.GetRow()])
- dw_uc.Object.itemname[dw_uc.GetRow()] = Trim(dw_uc.Object.itemname[dw_uc.GetRow()])
-
-
- IF dw_uc.Object.itemcode[dw_uc.GetRow()] = '' THEN
- MessageBox('提示','请输入项目编号!',information!,ok!)
- RETURN
- END IF
-
- IF dw_uc.Object.itemname[dw_uc.GetRow()] = '' THEN
- MessageBox('提示','请输入项目名称!',information!,ok!)
- RETURN
- END IF
-
-
- IF dw_uc.Object.itemid[dw_uc.GetRow()] = 0 THEN
- ll_newid = f_sys_scidentity(0,"u_item_cust_spt_def","itemid",errmsg,FALSE,sqlca)
- IF ll_newid <= 0 THEN
- MessageBox('错误',errmsg,stopsign!,ok!)
- RETURN
- ELSE
- dw_uc.Object.itemid[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+",保存操作失败!",stopsign!,OK!)
- LS_UPDATE_FLAG = FALSE
- RETURN
- ELSE
- COMMIT;
- FOR i = 1 TO 6
- 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 6
- 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()
- wf_face()
- end event
- type cb_edit from w_publ_edit_choice`cb_edit within w_item_cust_spt_edit
- end type
- event cb_edit::clicked;call super::clicked;IF Not (f_power_ind(1274) OR f_power_ind(1276)) 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 6
- dw_uc.SetTabOrder ( i, 0 )
- NEXT
- modifyrow_no = 0
- ELSE
- modifyrow_no = dw_uc.GetRow()
- FOR i = 1 TO 6
- 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()
- wf_face()
- end event
- type cb_delet from w_publ_edit_choice`cb_delet within w_item_cust_spt_edit
- end type
- event cb_delet::clicked;call super::clicked;IF Not (f_power_ind(1274) OR f_power_ind(1276)) THEN
- MessageBox('提示','你没有使用权限!',information!,ok!)
- RETURN
- END IF
- String arg_msg
- IF DW_UC.GetRow() <= 0 THEN
- MessageBox('提示','没有操作目标记录!',information!,ok!)
- RETURN
- END IF
- IF MessageBox ('询问',"是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN
- RETURN
- END IF
- Long LS_LONG,ll_itemid
- ll_itemid = DW_UC.Object.itemid[DW_UC.GetRow()]
- LS_LONG = 0
- SELECT COUNT(*) INTO :LS_LONG FROM u_item_cust_spt Where itemid = :ll_itemid ;
- IF SQLCA.SQLCode <> 0 THEN
- MessageBox ("错误","数据查询操作失败!(请重试!)",stopsign!,OK!)
- RETURN
- END IF
- IF LS_LONG > 0 THEN
- IF MessageBox ('询问',"该资料已用于客户或供应商资料,删除时会将相关资料删除,是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN
- RETURN
- END IF
- END IF
- DELETE FROM u_item_cust_spt
- Where itemid = :ll_itemid;
- IF SQLCA.SQLCode <> 0 THEN
- MessageBox ("错误","删除操作失败(客户供应商)!~n"+SQLCA.SQLErrText,stopsign!,OK!)
- ROLLBACK;
- RETURN
- END IF
- DELETE FROM u_item_cust_spt_def_mx
- Where itemid = :ll_itemid;
- IF SQLCA.SQLCode <> 0 THEN
- MessageBox ("错误","删除操作失败(项目明细)!~n"+SQLCA.SQLErrText,stopsign!,OK!)
- ROLLBACK;
- RETURN
- END IF
- DW_UC.SetRedraw (FALSE)
- DW_UC.DeleteRow (0)
- DW_UC.TriggerEvent (RowFocusChanged!)
- IF DW_UC.Update() = -1 THEN
- ROLLBACK;
- MessageBox ("错误","删除记录操作失败!",stopsign!,OK!)
- ELSE
- COMMIT;
- END IF
- DW_UC.SetRedraw (TRUE)
- end event
- type cb_choice from w_publ_edit_choice`cb_choice within w_item_cust_spt_edit
- boolean visible = false
- integer x = 1806
- integer width = 165
- boolean enabled = false
- end type
- type dw_uc from w_publ_edit_choice`dw_uc within w_item_cust_spt_edit
- integer width = 2062
- integer height = 2064
- string dataobject = "dw_item_cust_spt_def"
- end type
- event dw_uc::rowfocuschanged;call super::rowfocuschanged;PARENT.TriggerEvent('retrieve_mx')
- end event
- type cb_rtr from w_publ_edit_choice`cb_rtr within w_item_cust_spt_edit
- end type
- event cb_rtr::clicked;call super::clicked;PARENT.TriggerEvent('retrieve_mx')
- end event
- type cb_help from w_publ_edit_choice`cb_help within w_item_cust_spt_edit
- integer x = 1303
- end type
- type ln_bar from w_publ_edit_choice`ln_bar within w_item_cust_spt_edit
- end type
- type ln_bar2 from w_publ_edit_choice`ln_bar2 within w_item_cust_spt_edit
- end type
- type r_bar from w_publ_edit_choice`r_bar within w_item_cust_spt_edit
- integer x = 2043
- end type
- type cb_1 from uo_imflatbutton within w_item_cust_spt_edit
- integer x = 837
- integer width = 466
- integer height = 164
- integer taborder = 30
- boolean bringtotop = true
- string text = "加入客户/供应商"
- string normalpicname = "mx.bmp"
- integer picsize = 16
- toolbaralignment pic_align = alignattop!
- boolean border = false
- end type
- event clicked;call super::clicked;IF Not (f_power_ind(1274) OR f_power_ind(1276)) THEN
- MessageBox('提示','你没有使用权限!',information!,ok!)
- RETURN
- END IF
- String arg_msg
- IF DW_UC.GetRow() <= 0 THEN
- MessageBox('提示','没有操作目标记录!',information!,ok!)
- RETURN
- END IF
- IF MessageBox ('询问',"是否确定要当前记录加入到客户或供应商资料?",Question!,YesNo! ) = 2 THEN
- RETURN
- END IF
- Long LS_LONG,ll_itemid
- Int li_itemtype
- ll_itemid = DW_UC.Object.itemid[DW_UC.GetRow()]
- li_itemtype = DW_UC.Object.itemtype[DW_UC.GetRow()]
- IF li_itemtype = 0 THEN
- INSERT INTO u_item_cust_spt
- (itemid,relid,reltype,dscrp)
- SELECT :ll_itemid,cusid,0,''
- FROM u_cust
- WHERE inuse = 1
- and cusid NOT IN
- (SELECT relid FROM u_item_cust_spt
- Where reltype = 0 and itemid = :ll_itemid );
- IF SQLCA.SQLCode <> 0 THEN
- MessageBox ("错误","数据加入客户资料失败!~n"+SQLCA.SQLErrText,stopsign!,OK!)
- ROLLBACK;
- RETURN
- END IF
- ELSE
- INSERT INTO u_item_cust_spt
- (itemid,relid,reltype,dscrp)
- SELECT :ll_itemid,sptid,1,''
- FROM u_spt WHERE inuse = 1
- and sptid NOT IN
- (SELECT relid FROM u_item_cust_spt
- Where reltype = 1 and itemid = :ll_itemid );
- IF SQLCA.SQLCode <> 0 THEN
- MessageBox ("错误","数据加入供应商资料失败!~n"+SQLCA.SQLErrText,stopsign!,OK!)
- ROLLBACK;
- RETURN
- END IF
- END IF
- COMMIT;
- MessageBox ("提示","操作成功",information!,ok!)
- end event
- type dw_1 from u_dw_rbtnfilter within w_item_cust_spt_edit
- integer x = 2062
- integer y = 176
- integer width = 1477
- integer height = 2064
- integer taborder = 20
- boolean bringtotop = true
- string dataobject = "dw_item_cust_spt_def_mx"
- boolean hscrollbar = true
- boolean vscrollbar = true
- end type
- event rowfocuschanged;call super::rowfocuschanged;IF currentrow <= 0 THEN RETURN
- THIS.SelectRow(0,FALSE)
- THIS.SelectRow(currentrow,TRUE)
- end event
- type cb_addmx from uo_imflatbutton within w_item_cust_spt_edit
- integer x = 2075
- integer width = 233
- integer height = 164
- integer taborder = 60
- boolean bringtotop = true
- string text = "增项目"
- string normalpicname = "mx1.bmp"
- integer picsize = 16
- toolbaralignment pic_align = alignattop!
- boolean border = false
- end type
- event clicked;call super::clicked;IF Not (f_power_ind(1067) OR f_power_ind(1069)) THEN
- MessageBox('提示','你没有使用权限!',information!,ok!)
- RETURN
- END IF
- IF DW_UC.GetRow() <= 0 THEN
- MessageBox('提示','没有操作目标记录!',information!,ok!)
- RETURN
- END IF
- Int li_inputtype
- Long ll_itemid
- ll_itemid = DW_UC.Object.itemid[DW_UC.GetRow()]
- li_inputtype = DW_UC.Object.inputtype[DW_UC.GetRow()]
- IF li_inputtype <> 0 THEN
- MessageBox('提示','不是选项类型的项目不能增加明细项目!',information!,ok!)
- RETURN
- END IF
- OpenWithParm(w_item_cust_spt_mx_add,ll_itemid)
- PARENT.TriggerEvent('retrieve_mx')
- end event
- type cb_delmx from uo_imflatbutton within w_item_cust_spt_edit
- integer x = 2309
- integer width = 233
- integer height = 164
- integer taborder = 70
- boolean bringtotop = true
- string text = "删项目"
- string normalpicname = "mx2.bmp"
- integer picsize = 16
- toolbaralignment pic_align = alignattop!
- boolean border = false
- end type
- event clicked;call super::clicked;IF Not (f_power_ind(1067) OR f_power_ind(1069)) THEN
- MessageBox('提示','你没有使用权限!',information!,ok!)
- RETURN
- END IF
- String arg_msg
- IF dw_1.GetRow() <= 0 THEN
- MessageBox('提示','没有操作目标记录!',information!,ok!)
- RETURN
- END IF
- IF MessageBox ('询问',"是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN
- RETURN
- END IF
- Long ll_mxid
- ll_mxid = dw_1.Object.mxid[dw_1.GetRow()]
- DELETE FROM u_item_cust_spt_def_mx
- Where mxid = :ll_mxid;
- IF SQLCA.SQLCode <> 0 THEN
- MessageBox ("错误","删除操作失败(项目明细)!~n"+SQLCA.SQLErrText,stopsign!,OK!)
- ROLLBACK;
- RETURN
- END IF
- COMMIT;
- PARENT.TriggerEvent('retrieve_mx')
- end event
|