123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- $PBExportHeader$w_del_hisprice.srw
- forward
- global type w_del_hisprice from window
- end type
- type em_deltime from editmask within w_del_hisprice
- end type
- type cb_cancel from uo_imflatbutton within w_del_hisprice
- end type
- type cb_ok from uo_imflatbutton within w_del_hisprice
- end type
- type st_1 from statictext within w_del_hisprice
- end type
- end forward
- global type w_del_hisprice from window
- integer width = 997
- integer height = 544
- boolean titlebar = true
- string title = "删除价格"
- boolean controlmenu = true
- windowtype windowtype = response!
- long backcolor = 134217739
- string icon = "AppIcon!"
- boolean center = true
- em_deltime em_deltime
- cb_cancel cb_cancel
- cb_ok cb_ok
- st_1 st_1
- end type
- global w_del_hisprice w_del_hisprice
- type variables
- int workmode
- string ls_title
- end variables
- forward prototypes
- public function integer wf_delete (integer arg_workmode, datetime arg_deltime, ref string arg_msg)
- end prototypes
- public function integer wf_delete (integer arg_workmode, datetime arg_deltime, ref string arg_msg);
- Int rslt = 1
- Long rowcnt,i
- long id
- string ls_code
- datastore ds
- ds = CREATE datastore
- IF arg_workmode = 1 THEN
- ds.DataObject = 'dw_spt_index'
- ELSE
- ds.DataObject = 'dw_cust_index'
- END IF
- ds.SetTransObject( sqlca)
- rowcnt = ds.Retrieve( )
- IF rowcnt < 1 THEN
- arg_msg='没有数据可删除'
- rslt = 0
- GOTO ext
- END IF
- Open(w_sys_wait_jdt) //初始化进度条
- w_sys_wait_jdt.Show()
- w_sys_wait_jdt.wf_accepttol(rowcnt)
- w_sys_wait_jdt.wf_inc(0.5)
- w_sys_wait_jdt.st_msg.Text = "正在删除数据..."
- FOR i = 1 TO rowcnt
- w_sys_wait_jdt.wf_inc(i)
- IF arg_workmode = 1 THEN //供应商
- id=ds.object.sptid[i]
- ls_code=ds.object.name[i]
- w_sys_wait_jdt.st_msg.Text = "正在删除["+ls_code +"]历史价格数据..."
- DELETE FROM u_spt_price_mx
- Where opdate <= :arg_deltime AND outdate <= :arg_deltime and sptid=:id;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = ls_code +'删除历史价格失败'+sqlca.SQLErrText
- rollback;
- rslt = 0
- GOTO ext
- else
- commit;
- END IF
- ELSE //客户
- id=ds.object.cusid[i]
- ls_code=ds.object.name[i]
- w_sys_wait_jdt.st_msg.Text = "正在删除["+ls_code +"]历史价格数据..."
- DELETE FROM u_cus_price_MX
- Where opdate <= :arg_deltime AND outdate <= :arg_deltime and cusid=:id;
- IF sqlca.SQLCode <> 0 THEN
- arg_msg = ls_code +'删除历史价格失败'+sqlca.SQLErrText
- rollback;
- rslt = 0
- GOTO ext
- else
- commit;
- END IF
- END IF
-
- NEXT
- ext:
- Close(w_sys_wait_jdt)
- RETURN rslt
- end function
- on w_del_hisprice.create
- this.em_deltime=create em_deltime
- this.cb_cancel=create cb_cancel
- this.cb_ok=create cb_ok
- this.st_1=create st_1
- this.Control[]={this.em_deltime,&
- this.cb_cancel,&
- this.cb_ok,&
- this.st_1}
- end on
- on w_del_hisprice.destroy
- destroy(this.em_deltime)
- destroy(this.cb_cancel)
- destroy(this.cb_ok)
- destroy(this.st_1)
- end on
- event open;s_edit_index_tran S_INSCUST //传递参数使用
- S_INSCUST = Message.PowerObjectParm
- workmode=s_INSCUST.work_mode
- if workmode=1 then
- ls_title='供应商历史价格删除'
- else
- ls_title='客户历史价格删除'
- end if
- this.title=ls_title
- end event
- type em_deltime from editmask within w_del_hisprice
- integer x = 421
- integer y = 112
- integer width = 439
- integer height = 88
- integer taborder = 20
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- alignment alignment = center!
- borderstyle borderstyle = stylelowered!
- maskdatatype maskdatatype = datemask!
- string mask = "yyyy-mm-dd"
- boolean spin = true
- end type
- event rbuttondown;s_calender_arg s_calender
- s_calender.PointerX = THIS.PointerX()
- s_calender.PointerY = THIS.PointerY()
- s_calender.X = THIS.X
- s_calender.Y = THIS.Y
- OpenWithParm(w_calendar,s_calender)
- THIS.Text = String(id_date_selected)
- end event
- event constructor;this.text=string(today(),'yyyy-mm-dd')
- end event
- type cb_cancel from uo_imflatbutton within w_del_hisprice
- integer x = 535
- integer y = 300
- integer width = 265
- integer taborder = 40
- string text = "取消"
- boolean cancel = true
- end type
- event clicked;call super::clicked;
- close(parent)
- end event
- type cb_ok from uo_imflatbutton within w_del_hisprice
- integer x = 151
- integer y = 300
- integer width = 265
- integer taborder = 30
- end type
- event clicked;call super::clicked;String arg_msg
- Integer Net
- datetime arg_deltime
- arg_deltime=DateTime(Date(em_deltime.Text),Time('23:59:59'))
- Net = MessageBox('询问','是否确定要将'+String(em_deltime.Text)+' 23:59:59'+'之前的所有'+ls_title,Exclamation!,YesNo!,2 )
- IF Net = 1 THEN
- IF wf_delete(workmode,arg_deltime,arg_msg) = 0 THEN
- MessageBox('错误',arg_msg,stopsign!,ok!)
- return
- else
- MessageBox('提示','删除完毕!',information!,ok!)
- END IF
- END IF
- Close(PARENT)
- end event
- type st_1 from statictext within w_del_hisprice
- integer x = 137
- integer y = 128
- integer width = 256
- integer height = 48
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- long backcolor = 134217739
- string text = "删除月份"
- boolean focusrectangle = false
- end type
|