w_del_hisprice.srw 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. $PBExportHeader$w_del_hisprice.srw
  2. forward
  3. global type w_del_hisprice from window
  4. end type
  5. type em_deltime from editmask within w_del_hisprice
  6. end type
  7. type cb_cancel from uo_imflatbutton within w_del_hisprice
  8. end type
  9. type cb_ok from uo_imflatbutton within w_del_hisprice
  10. end type
  11. type st_1 from statictext within w_del_hisprice
  12. end type
  13. end forward
  14. global type w_del_hisprice from window
  15. integer width = 997
  16. integer height = 544
  17. boolean titlebar = true
  18. string title = "删除价格"
  19. boolean controlmenu = true
  20. windowtype windowtype = response!
  21. long backcolor = 134217739
  22. string icon = "AppIcon!"
  23. boolean center = true
  24. em_deltime em_deltime
  25. cb_cancel cb_cancel
  26. cb_ok cb_ok
  27. st_1 st_1
  28. end type
  29. global w_del_hisprice w_del_hisprice
  30. type variables
  31. int workmode
  32. string ls_title
  33. end variables
  34. forward prototypes
  35. public function integer wf_delete (integer arg_workmode, datetime arg_deltime, ref string arg_msg)
  36. end prototypes
  37. public function integer wf_delete (integer arg_workmode, datetime arg_deltime, ref string arg_msg);
  38. Int rslt = 1
  39. Long rowcnt,i
  40. long id
  41. string ls_code
  42. datastore ds
  43. ds = CREATE datastore
  44. IF arg_workmode = 1 THEN
  45. ds.DataObject = 'dw_spt_index'
  46. ELSE
  47. ds.DataObject = 'dw_cust_index'
  48. END IF
  49. ds.SetTransObject( sqlca)
  50. rowcnt = ds.Retrieve( )
  51. IF rowcnt < 1 THEN
  52. arg_msg='没有数据可删除'
  53. rslt = 0
  54. GOTO ext
  55. END IF
  56. Open(w_sys_wait_jdt) //初始化进度条
  57. w_sys_wait_jdt.Show()
  58. w_sys_wait_jdt.wf_accepttol(rowcnt)
  59. w_sys_wait_jdt.wf_inc(0.5)
  60. w_sys_wait_jdt.st_msg.Text = "正在删除数据..."
  61. FOR i = 1 TO rowcnt
  62. w_sys_wait_jdt.wf_inc(i)
  63. IF arg_workmode = 1 THEN //供应商
  64. id=ds.object.sptid[i]
  65. ls_code=ds.object.name[i]
  66. w_sys_wait_jdt.st_msg.Text = "正在删除["+ls_code +"]历史价格数据..."
  67. DELETE FROM u_spt_price_mx
  68. Where opdate <= :arg_deltime AND outdate <= :arg_deltime and sptid=:id;
  69. IF sqlca.SQLCode <> 0 THEN
  70. arg_msg = ls_code +'删除历史价格失败'+sqlca.SQLErrText
  71. rollback;
  72. rslt = 0
  73. GOTO ext
  74. else
  75. commit;
  76. END IF
  77. ELSE //客户
  78. id=ds.object.cusid[i]
  79. ls_code=ds.object.name[i]
  80. w_sys_wait_jdt.st_msg.Text = "正在删除["+ls_code +"]历史价格数据..."
  81. DELETE FROM u_cus_price_MX
  82. Where opdate <= :arg_deltime AND outdate <= :arg_deltime and cusid=:id;
  83. IF sqlca.SQLCode <> 0 THEN
  84. arg_msg = ls_code +'删除历史价格失败'+sqlca.SQLErrText
  85. rollback;
  86. rslt = 0
  87. GOTO ext
  88. else
  89. commit;
  90. END IF
  91. END IF
  92. NEXT
  93. ext:
  94. Close(w_sys_wait_jdt)
  95. RETURN rslt
  96. end function
  97. on w_del_hisprice.create
  98. this.em_deltime=create em_deltime
  99. this.cb_cancel=create cb_cancel
  100. this.cb_ok=create cb_ok
  101. this.st_1=create st_1
  102. this.Control[]={this.em_deltime,&
  103. this.cb_cancel,&
  104. this.cb_ok,&
  105. this.st_1}
  106. end on
  107. on w_del_hisprice.destroy
  108. destroy(this.em_deltime)
  109. destroy(this.cb_cancel)
  110. destroy(this.cb_ok)
  111. destroy(this.st_1)
  112. end on
  113. event open;s_edit_index_tran S_INSCUST //传递参数使用
  114. S_INSCUST = Message.PowerObjectParm
  115. workmode=s_INSCUST.work_mode
  116. if workmode=1 then
  117. ls_title='供应商历史价格删除'
  118. else
  119. ls_title='客户历史价格删除'
  120. end if
  121. this.title=ls_title
  122. end event
  123. type em_deltime from editmask within w_del_hisprice
  124. integer x = 421
  125. integer y = 112
  126. integer width = 439
  127. integer height = 88
  128. integer taborder = 20
  129. boolean bringtotop = true
  130. integer textsize = -9
  131. integer weight = 400
  132. fontcharset fontcharset = gb2312charset!
  133. fontpitch fontpitch = variable!
  134. string facename = "宋体"
  135. long textcolor = 33554432
  136. alignment alignment = center!
  137. borderstyle borderstyle = stylelowered!
  138. maskdatatype maskdatatype = datemask!
  139. string mask = "yyyy-mm-dd"
  140. boolean spin = true
  141. end type
  142. event rbuttondown;s_calender_arg s_calender
  143. s_calender.PointerX = THIS.PointerX()
  144. s_calender.PointerY = THIS.PointerY()
  145. s_calender.X = THIS.X
  146. s_calender.Y = THIS.Y
  147. OpenWithParm(w_calendar,s_calender)
  148. THIS.Text = String(id_date_selected)
  149. end event
  150. event constructor;this.text=string(today(),'yyyy-mm-dd')
  151. end event
  152. type cb_cancel from uo_imflatbutton within w_del_hisprice
  153. integer x = 535
  154. integer y = 300
  155. integer width = 265
  156. integer taborder = 40
  157. string text = "取消"
  158. boolean cancel = true
  159. end type
  160. event clicked;call super::clicked;
  161. close(parent)
  162. end event
  163. type cb_ok from uo_imflatbutton within w_del_hisprice
  164. integer x = 151
  165. integer y = 300
  166. integer width = 265
  167. integer taborder = 30
  168. end type
  169. event clicked;call super::clicked;String arg_msg
  170. Integer Net
  171. datetime arg_deltime
  172. arg_deltime=DateTime(Date(em_deltime.Text),Time('23:59:59'))
  173. Net = MessageBox('询问','是否确定要将'+String(em_deltime.Text)+' 23:59:59'+'之前的所有'+ls_title,Exclamation!,YesNo!,2 )
  174. IF Net = 1 THEN
  175. IF wf_delete(workmode,arg_deltime,arg_msg) = 0 THEN
  176. MessageBox('错误',arg_msg,stopsign!,ok!)
  177. return
  178. else
  179. MessageBox('提示','删除完毕!',information!,ok!)
  180. END IF
  181. END IF
  182. Close(PARENT)
  183. end event
  184. type st_1 from statictext within w_del_hisprice
  185. integer x = 137
  186. integer y = 128
  187. integer width = 256
  188. integer height = 48
  189. integer textsize = -9
  190. integer weight = 400
  191. fontcharset fontcharset = gb2312charset!
  192. fontpitch fontpitch = variable!
  193. string facename = "宋体"
  194. long textcolor = 33554432
  195. long backcolor = 134217739
  196. string text = "删除月份"
  197. boolean focusrectangle = false
  198. end type