123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- $PBExportHeader$w_edit_mx_requiredate.srw
- forward
- global type w_edit_mx_requiredate from w_publ_base
- end type
- type dw_1 from u_dw_rbtnfilter within w_edit_mx_requiredate
- end type
- type cb_choice from uo_imflatbutton within w_edit_mx_requiredate
- end type
- end forward
- global type w_edit_mx_requiredate from w_publ_base
- integer width = 1984
- string title = "销售订单日期编辑"
- boolean minbox = false
- windowtype windowtype = response!
- event ue_p_requiredate ( )
- dw_1 dw_1
- cb_choice cb_choice
- end type
- global w_edit_mx_requiredate w_edit_mx_requiredate
- type variables
- s_edit_index_tran s_tranr
- long ins_scid
- long ins_taskid
- end variables
- event ue_p_requiredate();
- IF dw_1.GetRow() <= 0 THEN RETURN
- datetime rq
- Long uc_row
- Long i
- dw_1.AcceptText()
- rq = dw_1.OBJECT.u_saletaskmx_requiredate[1]
- IF ISNULL(rq) then
- messagebox("","第一行不能为空")
- return
- end if
- IF MessageBox('提示','是否要以第一行为参照批设定交货时间', question!, YesNo!, 2) = 2 then return
- dw_1.SetRedraw(FALSE)
- FOR i = 1 TO dw_1.RowCount()
- dw_1.Object.u_saletaskmx_requiredate[i] = rq
- NEXT
- dw_1.SetRedraw(TRUE)
- end event
- on w_edit_mx_requiredate.create
- int iCurrent
- call super::create
- this.dw_1=create dw_1
- this.cb_choice=create cb_choice
- iCurrent=UpperBound(this.Control)
- this.Control[iCurrent+1]=this.dw_1
- this.Control[iCurrent+2]=this.cb_choice
- end on
- on w_edit_mx_requiredate.destroy
- call super::destroy
- destroy(this.dw_1)
- destroy(this.cb_choice)
- end on
- event open;call super::open;s_tranr = Message.PowerObjectParm
- ins_scid = s_tranr.b_long
- ins_taskid = s_tranr.c_long
- dw_1.SetTransObject (sqlca)
- dw_1.retrieve(ins_scid,ins_taskid)
- end event
- type cb_func from w_publ_base`cb_func within w_edit_mx_requiredate
- end type
- type cb_exit from w_publ_base`cb_exit within w_edit_mx_requiredate
- integer width = 165
- integer height = 152
- integer picsize = 16
- toolbaralignment pic_align = alignattop!
- boolean border = false
- end type
- type dw_1 from u_dw_rbtnfilter within w_edit_mx_requiredate
- integer x = 14
- integer y = 164
- integer width = 1947
- integer height = 888
- integer taborder = 20
- boolean bringtotop = true
- string dataobject = "dw_edit_requiredate"
- boolean hscrollbar = true
- boolean vscrollbar = true
- boolean hsplitscroll = true
- end type
- event doubleclicked;call super::doubleclicked;IF Lower(Left(dwo.Type,4)) = 'text' THEN
- String LS_STR,column_name
- column_name = dwo.Name
- IF column_name = 'u_saletaskmx_requiredate_t' THEN
- parent.triggerevent('ue_p_requiredate')
- END IF
- END IF
- end event
- type cb_choice from uo_imflatbutton within w_edit_mx_requiredate
- integer x = 165
- integer width = 165
- integer height = 152
- integer taborder = 60
- boolean bringtotop = true
- boolean default = true
- string normalpicname = "ok.bmp"
- integer picsize = 16
- toolbaralignment pic_align = alignattop!
- boolean border = false
- end type
- event clicked;long rslt =1
- string arg_msg
- datetime requiredate,rq
- long i
- long mtrlid,taskid,scid,printid
- select requiredate into :rq from u_saletask
- where taskid = :ins_taskid and scid = :ins_scid;
- IF SQLCA.SQLCODE<>0 THEN
- ARG_MSG = "查询交货日期失败"
- RSLT = 0
- GOTO EXT
- END IF
- for i =1 to dw_1.rowcount()
- mtrlid = dw_1.object.u_saletaskmx_mtrlid[i]
- //taskid = dw_1.object.taskid[i]
- //scid = dw_1.object.scid[i]
- printid = dw_1.object.u_saletaskmx_printid[i]
- requiredate = dw_1.object.u_saletaskmx_requiredate[i]
-
- IF requiredate<=DATETIME('1900-01-01') or isnull(requiredate) THEN continue
-
- update u_saletaskmx
- set requiredate = :requiredate
- where mtrlid = :mtrlid
- and taskid = :ins_taskid
- and scid = :ins_scid
- and printid = :printid;
-
- IF SQLCA.SQLCODE<>0 THEN
- ARG_MSG = "第"+string(i)+"行,更新交货日期"+sqlca.sqlerrtext
- RSLT = 0
- GOTO EXT
- END IF
- next
- update u_saletask
- set requiredate = (select max(requiredate)
- from u_saletaskmx
- where taskid = :ins_taskid and scid = :ins_scid)
- where taskid = :ins_taskid and scid = :ins_scid ;
- IF SQLCA.SQLCODE<>0 THEN
- ARG_MSG = "主表更新最新交货日期失败"+sqlca.sqlerrtext
- RSLT = 0
- GOTO EXT
- END IF
- EXT:
- IF RSLT = 1 THEN
- COMMIT;
- ELSE
- messagebox("提示",ARG_MSG)
- ROLLBACK;
- return
- END IF
- CLOSE(PARENT)
- end event
|