$PBExportHeader$w_mtrldef_edit_price_inwarebuyplanprice.srw forward global type w_mtrldef_edit_price_inwarebuyplanprice from w_publ_base end type type cb_1 from uo_imflatbutton within w_mtrldef_edit_price_inwarebuyplanprice end type type st_3 from statictext within w_mtrldef_edit_price_inwarebuyplanprice end type type em_1 from editmask within w_mtrldef_edit_price_inwarebuyplanprice end type type pb_em1 from picturebutton within w_mtrldef_edit_price_inwarebuyplanprice end type type st_4 from statictext within w_mtrldef_edit_price_inwarebuyplanprice end type type em_2 from editmask within w_mtrldef_edit_price_inwarebuyplanprice end type type pb_em2 from picturebutton within w_mtrldef_edit_price_inwarebuyplanprice end type type pb_2 from picturebutton within w_mtrldef_edit_price_inwarebuyplanprice end type end forward global type w_mtrldef_edit_price_inwarebuyplanprice from w_publ_base integer width = 1504 integer height = 808 string title = "更新计划价" boolean minbox = false windowtype windowtype = response! event ue_date1 ( ) event ue_date2 ( ) event ue_date3 ( ) event ue_date4 ( ) cb_1 cb_1 st_3 st_3 em_1 em_1 pb_em1 pb_em1 st_4 st_4 em_2 em_2 pb_em2 pb_em2 pb_2 pb_2 end type global w_mtrldef_edit_price_inwarebuyplanprice w_mtrldef_edit_price_inwarebuyplanprice type variables s_edit_index_tran ls_rtn //传递参数使用 end variables forward prototypes public function integer days_in_month (integer month, integer year) end prototypes event ue_date1();//IF THIS.Text = "本日" THEN em_1.text = string(today(),"yyyy-mm-dd") em_2.text = string(today(),"yyyy-mm-dd") //ELSEIF THIS.Text = "本周" THEN // int li_DayNum // li_DayNum = DayNumber(today()) // em_1.text = string(RelativeDate ( today(), 1 - li_DayNum ),"yyyy-mm-dd") // em_2.text = string(RelativeDate ( today(), 7 - li_DayNum ),"yyyy-mm-dd") //ELSEIF THIS.Text = "本月" THEN // int li_Month, li_Year, li_Days // li_Month = Month(today()) // li_Year = Year(today()) // li_Days = days_in_month(li_Month, li_Year) // em_1.text = string(Date(li_Year, li_Month, 1),"yyyy-mm-dd") // em_2.text = string(Date(li_Year, li_Month, li_Days),"yyyy-mm-dd") //END IF end event event ue_date2();//IF THIS.Text = "本日" THEN // em_1.text = string(today(),"yyyy-mm-dd") // em_2.text = string(today(),"yyyy-mm-dd") //ELSEIF THIS.Text = "本周" THEN int li_DayNum li_DayNum = DayNumber(today()) em_1.text = string(RelativeDate ( today(), 1 - li_DayNum ),"yyyy-mm-dd") em_2.text = string(RelativeDate ( today(), 7 - li_DayNum ),"yyyy-mm-dd") //ELSEIF THIS.Text = "本月" THEN // int li_Month, li_Year, li_Days // li_Month = Month(today()) // li_Year = Year(today()) // li_Days = days_in_month(li_Month, li_Year) // em_1.text = string(Date(li_Year, li_Month, 1),"yyyy-mm-dd") // em_2.text = string(Date(li_Year, li_Month, li_Days),"yyyy-mm-dd") //END IF end event event ue_date3();//IF THIS.Text = "本日" THEN // em_1.text = string(today(),"yyyy-mm-dd") // em_2.text = string(today(),"yyyy-mm-dd") //ELSEIF THIS.Text = "本周" THEN // int li_DayNum // li_DayNum = DayNumber(today()) // em_1.text = string(RelativeDate ( today(), 1 - li_DayNum ),"yyyy-mm-dd") // em_2.text = string(RelativeDate ( today(), 7 - li_DayNum ),"yyyy-mm-dd") //ELSEIF THIS.Text = "本月" THEN int li_Month, li_Year, li_Days li_Month = Month(today()) li_Year = Year(today()) li_Days = days_in_month(li_Month, li_Year) em_1.text = string(Date(li_Year, li_Month, 1),"yyyy-mm-dd") em_2.text = string(Date(li_Year, li_Month, li_Days),"yyyy-mm-dd") //END IF end event event ue_date4();//IF THIS.Text = "本日" THEN // em_1.text = string(today(),"yyyy-mm-dd") // em_2.text = string(today(),"yyyy-mm-dd") //ELSEIF THIS.Text = "本周" THEN // int li_DayNum // li_DayNum = DayNumber(today()) // em_1.text = string(RelativeDate ( today(), 1 - li_DayNum ),"yyyy-mm-dd") // em_2.text = string(RelativeDate ( today(), 7 - li_DayNum ),"yyyy-mm-dd") //ELSEIF THIS.Text = "本月" THEN Int li_Month, li_Year, li_Days li_Month = Month(Today()) li_Year = Year(Today()) IF li_Month = 1 THEN li_Month = 12 li_Year = li_Year - 1 ELSE li_Month -= 1 END IF li_Days = days_in_month(li_Month, li_Year) em_1.Text = String(Date(li_Year, li_Month, 1),"yyyy-mm-dd") em_2.Text = String(Date(li_Year, li_Month, li_Days),"yyyy-mm-dd") //END IF end event public function integer days_in_month (integer month, integer year);//Most cases are straight forward in that there are a fixed number of //days in 11 of the 12 months. February is, of course, the problem. //In a leap year February has 29 days, otherwise 28. Integer li_DaysInMonth, li_Days[12] = {31,28,31,30,31,30,31,31,30,31,30,31} // Get the number of days per month for a non leap year. li_DaysInMonth = li_Days[Month] // Check for a leap year. If Month = 2 Then // If the year is a leap year, change the number of days. // Leap Year Calculation: // Year divisible by 4, but not by 100, unless it is also divisible by 400 If ( (Mod(Year,4) = 0 And Mod(Year,100) <> 0) Or (Mod(Year,400) = 0) ) Then li_DaysInMonth = 29 End If End If //Return the number of days in the relevant month Return li_DaysInMonth end function on w_mtrldef_edit_price_inwarebuyplanprice.create int iCurrent call super::create this.cb_1=create cb_1 this.st_3=create st_3 this.em_1=create em_1 this.pb_em1=create pb_em1 this.st_4=create st_4 this.em_2=create em_2 this.pb_em2=create pb_em2 this.pb_2=create pb_2 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.cb_1 this.Control[iCurrent+2]=this.st_3 this.Control[iCurrent+3]=this.em_1 this.Control[iCurrent+4]=this.pb_em1 this.Control[iCurrent+5]=this.st_4 this.Control[iCurrent+6]=this.em_2 this.Control[iCurrent+7]=this.pb_em2 this.Control[iCurrent+8]=this.pb_2 end on on w_mtrldef_edit_price_inwarebuyplanprice.destroy call super::destroy destroy(this.cb_1) destroy(this.st_3) destroy(this.em_1) destroy(this.pb_em1) destroy(this.st_4) destroy(this.em_2) destroy(this.pb_em2) destroy(this.pb_2) end on event close;call super::close; CloseWithReturn(this,ls_rtn) end event event open;call super::open;this.triggerevent('ue_date3') end event type cb_func from w_publ_base`cb_func within w_mtrldef_edit_price_inwarebuyplanprice boolean visible = false integer x = 809 boolean enabled = false end type type cb_exit from w_publ_base`cb_exit within w_mtrldef_edit_price_inwarebuyplanprice integer x = 805 integer y = 520 string text = "取消" end type event cb_exit::clicked;ls_rtn.first_date=datetime(date(1900-01-01),time(0)) ls_rtn.end_date=datetime(date(1900-01-01),time(0)) close(parent) end event type cb_1 from uo_imflatbutton within w_mtrldef_edit_price_inwarebuyplanprice integer x = 334 integer y = 520 integer width = 311 integer height = 96 integer taborder = 20 boolean bringtotop = true end type event clicked;call super::clicked; ls_rtn.first_date=datetime(date(string(em_1.text)),time(0)) ls_rtn.end_date=datetime(date(string(em_2.text)),time(23:59:59)) CLOSE(PARENT) end event type st_3 from statictext within w_mtrldef_edit_price_inwarebuyplanprice integer x = 32 integer y = 244 integer width = 201 integer height = 60 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 134217739 boolean enabled = false string text = "日期从:" alignment alignment = right! boolean focusrectangle = false end type type em_1 from editmask within w_mtrldef_edit_price_inwarebuyplanprice integer x = 233 integer y = 228 integer width = 407 integer height = 88 integer taborder = 110 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 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 type pb_em1 from picturebutton within w_mtrldef_edit_price_inwarebuyplanprice integer x = 649 integer y = 228 integer width = 101 integer height = 92 integer taborder = 120 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string picturename = "date.BMP" alignment htextalign = left! end type event clicked;em_1.triggerevent(rbuttondown!) end event type st_4 from statictext within w_mtrldef_edit_price_inwarebuyplanprice integer x = 741 integer y = 244 integer width = 105 integer height = 60 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 134217739 boolean enabled = false string text = "到:" alignment alignment = right! boolean focusrectangle = false end type type em_2 from editmask within w_mtrldef_edit_price_inwarebuyplanprice integer x = 846 integer y = 228 integer width = 407 integer height = 88 integer taborder = 130 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 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 type pb_em2 from picturebutton within w_mtrldef_edit_price_inwarebuyplanprice integer x = 1262 integer y = 228 integer width = 101 integer height = 92 integer taborder = 140 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string picturename = "date.BMP" alignment htextalign = left! end type event clicked;em_2.triggerevent(rbuttondown!) end event type pb_2 from picturebutton within w_mtrldef_edit_price_inwarebuyplanprice integer x = 1371 integer y = 228 integer width = 101 integer height = 92 integer taborder = 150 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string picturename = "date1.BMP" alignment htextalign = left! end type event clicked;m_Dfc_Control_PopupMenu dmPopupMenu string menustr menustr="Text=本日~tEvent=ue_date1" menustr = menustr + "|" + "Text=本周~tEvent=ue_date2" menustr = menustr + "|" + "Text=本月~tEvent=ue_date3" menustr = menustr + "|" + "Text=上月~tEvent=ue_date4" if len(trim(menustr))<>0 then dmPopupMenu = Create m_Dfc_Control_PopupMenu dmPopupMenu.mf_BuildMenu(This, menustr) dmPopupMenu.mf_PopMenu() Destroy dmPopupMenu end if end event