w_mtrldef_edit_price_inwarebuyplanprice.srw 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. $PBExportHeader$w_mtrldef_edit_price_inwarebuyplanprice.srw
  2. forward
  3. global type w_mtrldef_edit_price_inwarebuyplanprice from w_publ_base
  4. end type
  5. type cb_1 from uo_imflatbutton within w_mtrldef_edit_price_inwarebuyplanprice
  6. end type
  7. type st_3 from statictext within w_mtrldef_edit_price_inwarebuyplanprice
  8. end type
  9. type em_1 from editmask within w_mtrldef_edit_price_inwarebuyplanprice
  10. end type
  11. type pb_em1 from picturebutton within w_mtrldef_edit_price_inwarebuyplanprice
  12. end type
  13. type st_4 from statictext within w_mtrldef_edit_price_inwarebuyplanprice
  14. end type
  15. type em_2 from editmask within w_mtrldef_edit_price_inwarebuyplanprice
  16. end type
  17. type pb_em2 from picturebutton within w_mtrldef_edit_price_inwarebuyplanprice
  18. end type
  19. type pb_2 from picturebutton within w_mtrldef_edit_price_inwarebuyplanprice
  20. end type
  21. end forward
  22. global type w_mtrldef_edit_price_inwarebuyplanprice from w_publ_base
  23. integer width = 1504
  24. integer height = 808
  25. string title = "更新计划价"
  26. boolean minbox = false
  27. windowtype windowtype = response!
  28. event ue_date1 ( )
  29. event ue_date2 ( )
  30. event ue_date3 ( )
  31. event ue_date4 ( )
  32. cb_1 cb_1
  33. st_3 st_3
  34. em_1 em_1
  35. pb_em1 pb_em1
  36. st_4 st_4
  37. em_2 em_2
  38. pb_em2 pb_em2
  39. pb_2 pb_2
  40. end type
  41. global w_mtrldef_edit_price_inwarebuyplanprice w_mtrldef_edit_price_inwarebuyplanprice
  42. type variables
  43. s_edit_index_tran ls_rtn //传递参数使用
  44. end variables
  45. forward prototypes
  46. public function integer days_in_month (integer month, integer year)
  47. end prototypes
  48. event ue_date1();//IF THIS.Text = "本日" THEN
  49. em_1.text = string(today(),"yyyy-mm-dd")
  50. em_2.text = string(today(),"yyyy-mm-dd")
  51. //ELSEIF THIS.Text = "本周" THEN
  52. // int li_DayNum
  53. // li_DayNum = DayNumber(today())
  54. // em_1.text = string(RelativeDate ( today(), 1 - li_DayNum ),"yyyy-mm-dd")
  55. // em_2.text = string(RelativeDate ( today(), 7 - li_DayNum ),"yyyy-mm-dd")
  56. //ELSEIF THIS.Text = "本月" THEN
  57. // int li_Month, li_Year, li_Days
  58. // li_Month = Month(today())
  59. // li_Year = Year(today())
  60. // li_Days = days_in_month(li_Month, li_Year)
  61. // em_1.text = string(Date(li_Year, li_Month, 1),"yyyy-mm-dd")
  62. // em_2.text = string(Date(li_Year, li_Month, li_Days),"yyyy-mm-dd")
  63. //END IF
  64. end event
  65. event ue_date2();//IF THIS.Text = "本日" THEN
  66. // em_1.text = string(today(),"yyyy-mm-dd")
  67. // em_2.text = string(today(),"yyyy-mm-dd")
  68. //ELSEIF THIS.Text = "本周" THEN
  69. int li_DayNum
  70. li_DayNum = DayNumber(today())
  71. em_1.text = string(RelativeDate ( today(), 1 - li_DayNum ),"yyyy-mm-dd")
  72. em_2.text = string(RelativeDate ( today(), 7 - li_DayNum ),"yyyy-mm-dd")
  73. //ELSEIF THIS.Text = "本月" THEN
  74. // int li_Month, li_Year, li_Days
  75. // li_Month = Month(today())
  76. // li_Year = Year(today())
  77. // li_Days = days_in_month(li_Month, li_Year)
  78. // em_1.text = string(Date(li_Year, li_Month, 1),"yyyy-mm-dd")
  79. // em_2.text = string(Date(li_Year, li_Month, li_Days),"yyyy-mm-dd")
  80. //END IF
  81. end event
  82. event ue_date3();//IF THIS.Text = "本日" THEN
  83. // em_1.text = string(today(),"yyyy-mm-dd")
  84. // em_2.text = string(today(),"yyyy-mm-dd")
  85. //ELSEIF THIS.Text = "本周" THEN
  86. // int li_DayNum
  87. // li_DayNum = DayNumber(today())
  88. // em_1.text = string(RelativeDate ( today(), 1 - li_DayNum ),"yyyy-mm-dd")
  89. // em_2.text = string(RelativeDate ( today(), 7 - li_DayNum ),"yyyy-mm-dd")
  90. //ELSEIF THIS.Text = "本月" THEN
  91. int li_Month, li_Year, li_Days
  92. li_Month = Month(today())
  93. li_Year = Year(today())
  94. li_Days = days_in_month(li_Month, li_Year)
  95. em_1.text = string(Date(li_Year, li_Month, 1),"yyyy-mm-dd")
  96. em_2.text = string(Date(li_Year, li_Month, li_Days),"yyyy-mm-dd")
  97. //END IF
  98. end event
  99. event ue_date4();//IF THIS.Text = "本日" THEN
  100. // em_1.text = string(today(),"yyyy-mm-dd")
  101. // em_2.text = string(today(),"yyyy-mm-dd")
  102. //ELSEIF THIS.Text = "本周" THEN
  103. // int li_DayNum
  104. // li_DayNum = DayNumber(today())
  105. // em_1.text = string(RelativeDate ( today(), 1 - li_DayNum ),"yyyy-mm-dd")
  106. // em_2.text = string(RelativeDate ( today(), 7 - li_DayNum ),"yyyy-mm-dd")
  107. //ELSEIF THIS.Text = "本月" THEN
  108. Int li_Month, li_Year, li_Days
  109. li_Month = Month(Today())
  110. li_Year = Year(Today())
  111. IF li_Month = 1 THEN
  112. li_Month = 12
  113. li_Year = li_Year - 1
  114. ELSE
  115. li_Month -= 1
  116. END IF
  117. li_Days = days_in_month(li_Month, li_Year)
  118. em_1.Text = String(Date(li_Year, li_Month, 1),"yyyy-mm-dd")
  119. em_2.Text = String(Date(li_Year, li_Month, li_Days),"yyyy-mm-dd")
  120. //END IF
  121. end event
  122. public function integer days_in_month (integer month, integer year);//Most cases are straight forward in that there are a fixed number of
  123. //days in 11 of the 12 months. February is, of course, the problem.
  124. //In a leap year February has 29 days, otherwise 28.
  125. Integer li_DaysInMonth, li_Days[12] = {31,28,31,30,31,30,31,31,30,31,30,31}
  126. // Get the number of days per month for a non leap year.
  127. li_DaysInMonth = li_Days[Month]
  128. // Check for a leap year.
  129. If Month = 2 Then
  130. // If the year is a leap year, change the number of days.
  131. // Leap Year Calculation:
  132. // Year divisible by 4, but not by 100, unless it is also divisible by 400
  133. If ( (Mod(Year,4) = 0 And Mod(Year,100) <> 0) Or (Mod(Year,400) = 0) ) Then
  134. li_DaysInMonth = 29
  135. End If
  136. End If
  137. //Return the number of days in the relevant month
  138. Return li_DaysInMonth
  139. end function
  140. on w_mtrldef_edit_price_inwarebuyplanprice.create
  141. int iCurrent
  142. call super::create
  143. this.cb_1=create cb_1
  144. this.st_3=create st_3
  145. this.em_1=create em_1
  146. this.pb_em1=create pb_em1
  147. this.st_4=create st_4
  148. this.em_2=create em_2
  149. this.pb_em2=create pb_em2
  150. this.pb_2=create pb_2
  151. iCurrent=UpperBound(this.Control)
  152. this.Control[iCurrent+1]=this.cb_1
  153. this.Control[iCurrent+2]=this.st_3
  154. this.Control[iCurrent+3]=this.em_1
  155. this.Control[iCurrent+4]=this.pb_em1
  156. this.Control[iCurrent+5]=this.st_4
  157. this.Control[iCurrent+6]=this.em_2
  158. this.Control[iCurrent+7]=this.pb_em2
  159. this.Control[iCurrent+8]=this.pb_2
  160. end on
  161. on w_mtrldef_edit_price_inwarebuyplanprice.destroy
  162. call super::destroy
  163. destroy(this.cb_1)
  164. destroy(this.st_3)
  165. destroy(this.em_1)
  166. destroy(this.pb_em1)
  167. destroy(this.st_4)
  168. destroy(this.em_2)
  169. destroy(this.pb_em2)
  170. destroy(this.pb_2)
  171. end on
  172. event close;call super::close;
  173. CloseWithReturn(this,ls_rtn)
  174. end event
  175. event open;call super::open;this.triggerevent('ue_date3')
  176. end event
  177. type cb_func from w_publ_base`cb_func within w_mtrldef_edit_price_inwarebuyplanprice
  178. boolean visible = false
  179. integer x = 809
  180. boolean enabled = false
  181. end type
  182. type cb_exit from w_publ_base`cb_exit within w_mtrldef_edit_price_inwarebuyplanprice
  183. integer x = 805
  184. integer y = 520
  185. string text = "取消"
  186. end type
  187. event cb_exit::clicked;ls_rtn.first_date=datetime(date(1900-01-01),time(0))
  188. ls_rtn.end_date=datetime(date(1900-01-01),time(0))
  189. close(parent)
  190. end event
  191. type cb_1 from uo_imflatbutton within w_mtrldef_edit_price_inwarebuyplanprice
  192. integer x = 334
  193. integer y = 520
  194. integer width = 311
  195. integer height = 96
  196. integer taborder = 20
  197. boolean bringtotop = true
  198. end type
  199. event clicked;call super::clicked;
  200. ls_rtn.first_date=datetime(date(string(em_1.text)),time(0))
  201. ls_rtn.end_date=datetime(date(string(em_2.text)),time(23:59:59))
  202. CLOSE(PARENT)
  203. end event
  204. type st_3 from statictext within w_mtrldef_edit_price_inwarebuyplanprice
  205. integer x = 32
  206. integer y = 244
  207. integer width = 201
  208. integer height = 60
  209. boolean bringtotop = true
  210. integer textsize = -9
  211. integer weight = 400
  212. fontcharset fontcharset = gb2312charset!
  213. fontpitch fontpitch = variable!
  214. string facename = "宋体"
  215. long textcolor = 33554432
  216. long backcolor = 134217739
  217. boolean enabled = false
  218. string text = "日期从:"
  219. alignment alignment = right!
  220. boolean focusrectangle = false
  221. end type
  222. type em_1 from editmask within w_mtrldef_edit_price_inwarebuyplanprice
  223. integer x = 233
  224. integer y = 228
  225. integer width = 407
  226. integer height = 88
  227. integer taborder = 110
  228. boolean bringtotop = true
  229. integer textsize = -9
  230. integer weight = 400
  231. fontcharset fontcharset = gb2312charset!
  232. fontpitch fontpitch = variable!
  233. string facename = "宋体"
  234. long textcolor = 33554432
  235. borderstyle borderstyle = stylelowered!
  236. maskdatatype maskdatatype = datemask!
  237. string mask = "yyyy-mm-dd"
  238. boolean spin = true
  239. end type
  240. event rbuttondown;s_calender_arg s_calender
  241. s_calender.PointerX = THIS.PointerX()
  242. s_calender.PointerY = THIS.PointerY()
  243. s_calender.X = THIS.X
  244. s_calender.Y = THIS.Y
  245. OpenWithParm(w_calendar,s_calender)
  246. THIS.Text = String(id_date_selected)
  247. end event
  248. type pb_em1 from picturebutton within w_mtrldef_edit_price_inwarebuyplanprice
  249. integer x = 649
  250. integer y = 228
  251. integer width = 101
  252. integer height = 92
  253. integer taborder = 120
  254. boolean bringtotop = true
  255. integer textsize = -9
  256. integer weight = 400
  257. fontcharset fontcharset = gb2312charset!
  258. fontpitch fontpitch = variable!
  259. string facename = "宋体"
  260. string picturename = "date.BMP"
  261. alignment htextalign = left!
  262. end type
  263. event clicked;em_1.triggerevent(rbuttondown!)
  264. end event
  265. type st_4 from statictext within w_mtrldef_edit_price_inwarebuyplanprice
  266. integer x = 741
  267. integer y = 244
  268. integer width = 105
  269. integer height = 60
  270. boolean bringtotop = true
  271. integer textsize = -9
  272. integer weight = 400
  273. fontcharset fontcharset = gb2312charset!
  274. fontpitch fontpitch = variable!
  275. string facename = "宋体"
  276. long textcolor = 33554432
  277. long backcolor = 134217739
  278. boolean enabled = false
  279. string text = "到:"
  280. alignment alignment = right!
  281. boolean focusrectangle = false
  282. end type
  283. type em_2 from editmask within w_mtrldef_edit_price_inwarebuyplanprice
  284. integer x = 846
  285. integer y = 228
  286. integer width = 407
  287. integer height = 88
  288. integer taborder = 130
  289. boolean bringtotop = true
  290. integer textsize = -9
  291. integer weight = 400
  292. fontcharset fontcharset = gb2312charset!
  293. fontpitch fontpitch = variable!
  294. string facename = "宋体"
  295. long textcolor = 33554432
  296. borderstyle borderstyle = stylelowered!
  297. maskdatatype maskdatatype = datemask!
  298. string mask = "yyyy-mm-dd"
  299. boolean spin = true
  300. end type
  301. event rbuttondown;s_calender_arg s_calender
  302. s_calender.PointerX = THIS.PointerX()
  303. s_calender.PointerY = THIS.PointerY()
  304. s_calender.X = THIS.X
  305. s_calender.Y = THIS.Y
  306. OpenWithParm(w_calendar,s_calender)
  307. THIS.Text = String(id_date_selected)
  308. end event
  309. type pb_em2 from picturebutton within w_mtrldef_edit_price_inwarebuyplanprice
  310. integer x = 1262
  311. integer y = 228
  312. integer width = 101
  313. integer height = 92
  314. integer taborder = 140
  315. boolean bringtotop = true
  316. integer textsize = -9
  317. integer weight = 400
  318. fontcharset fontcharset = gb2312charset!
  319. fontpitch fontpitch = variable!
  320. string facename = "宋体"
  321. string picturename = "date.BMP"
  322. alignment htextalign = left!
  323. end type
  324. event clicked;em_2.triggerevent(rbuttondown!)
  325. end event
  326. type pb_2 from picturebutton within w_mtrldef_edit_price_inwarebuyplanprice
  327. integer x = 1371
  328. integer y = 228
  329. integer width = 101
  330. integer height = 92
  331. integer taborder = 150
  332. boolean bringtotop = true
  333. integer textsize = -9
  334. integer weight = 400
  335. fontcharset fontcharset = gb2312charset!
  336. fontpitch fontpitch = variable!
  337. string facename = "宋体"
  338. string picturename = "date1.BMP"
  339. alignment htextalign = left!
  340. end type
  341. event clicked;m_Dfc_Control_PopupMenu dmPopupMenu
  342. string menustr
  343. menustr="Text=本日~tEvent=ue_date1"
  344. menustr = menustr + "|" + "Text=本周~tEvent=ue_date2"
  345. menustr = menustr + "|" + "Text=本月~tEvent=ue_date3"
  346. menustr = menustr + "|" + "Text=上月~tEvent=ue_date4"
  347. if len(trim(menustr))<>0 then
  348. dmPopupMenu = Create m_Dfc_Control_PopupMenu
  349. dmPopupMenu.mf_BuildMenu(This, menustr)
  350. dmPopupMenu.mf_PopMenu()
  351. Destroy dmPopupMenu
  352. end if
  353. end event