$PBExportHeader$w_mustpay_ch.srw forward global type w_mustpay_ch from w_pageretr_ch2 end type type st_4 from statictext within w_mustpay_ch end type type em_1 from editmask within w_mustpay_ch end type type em_2 from editmask within w_mustpay_ch end type type pb_em1 from picturebutton within w_mustpay_ch end type type pb_em2 from picturebutton within w_mustpay_ch end type type pb_2 from picturebutton within w_mustpay_ch end type type cbx_chkdate from checkbox within w_mustpay_ch end type end forward global type w_mustpay_ch from w_pageretr_ch2 string title = "供应商应收账选择 [按Ctrl键反选]" event ue_date1 ( ) event ue_date2 ( ) event ue_date3 ( ) event ue_date4 ( ) st_4 st_4 em_1 em_1 em_2 em_2 pb_em1 pb_em1 pb_em2 pb_em2 pb_2 pb_2 cbx_chkdate cbx_chkdate end type global w_mustpay_ch w_mustpay_ch type variables s_bmstpay_arr INS_RT_STRU long cur_scid long cur_sptid long cur_moneyid 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_mustpay_ch.create int iCurrent call super::create this.st_4=create st_4 this.em_1=create em_1 this.em_2=create em_2 this.pb_em1=create pb_em1 this.pb_em2=create pb_em2 this.pb_2=create pb_2 this.cbx_chkdate=create cbx_chkdate iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.st_4 this.Control[iCurrent+2]=this.em_1 this.Control[iCurrent+3]=this.em_2 this.Control[iCurrent+4]=this.pb_em1 this.Control[iCurrent+5]=this.pb_em2 this.Control[iCurrent+6]=this.pb_2 this.Control[iCurrent+7]=this.cbx_chkdate end on on w_mustpay_ch.destroy call super::destroy destroy(this.st_4) destroy(this.em_1) destroy(this.em_2) destroy(this.pb_em1) destroy(this.pb_em2) destroy(this.pb_2) destroy(this.cbx_chkdate) end on event close;call super::close;CLOSEWITHRETURN(THIS,INS_RT_STRU) end event event retrieve_pageretr;Boolean cb_firstpage_enabled,cb_nextpage_enabled,cb_retrieveall_enabled Boolean cb_priorpage_enabled,cb_func_enabled,cb_retrieve_enabled cb_nextpage_enabled = cb_nextpage.Enabled cb_retrieveall_enabled = cb_retrieveall.Enabled cb_func_enabled = cb_func.Enabled cb_nextpage.Enabled = False cb_retrieveall.Enabled = False cb_func.Enabled = False Int li_chkdate DateTime ldt_sdate, ldt_edate IF cbx_chkdate.Checked THEN li_chkdate = 1 ldt_sdate = DateTime(Date(em_1.Text)) ldt_edate = DateTime(Date(em_2.Text), 23:59:59) ELSE li_chkdate = 0 SetNull(ldt_sdate) SetNull(ldt_edate) END IF SetPointer(HourGlass!) dw_pageretr.Retrieve(cur_scid, cur_sptid, li_chkdate, ldt_sdate, ldt_edate, cur_moneyid) IF dw_pageretr.RowCount() > 0 And dw_pageretr.GetRow() = 0 THEN dw_pageretr.SetRow(1) SetPointer(Arrow!) cb_nextpage.Enabled = cb_nextpage_enabled cb_retrieveall.Enabled = cb_retrieveall_enabled cb_func.Enabled = cb_func_enabled IF cbx_mlselect.Checked And dw_pageretr.RowCount() > 1 THEN dw_pageretr.SelectRow(1,False) END IF end event event open; This.TriggerEvent('ue_before_open') wf_movetocenter() OLD_TITLE = This.Title s_tran = Message.PowerObjectParm IF Not IsNull(s_tran) THEN retrieve_all = s_tran.if_retrieve_all mode = s_tran.work_mode arg_pkid = s_tran.arg_pkid arg_string_code = s_tran.arg_string_code cur_scid = s_tran.b_long cur_sptid = s_tran.c_long cur_moneyid = s_tran.d_long IF sys_option_scid_msttake_mstpay = 1 THEN cur_scid = cur_scid ELSE cur_scid = -1 END IF END IF //////////////// // This.Title = This.Title //////////////// // dw_pageretr.RBUTTON_FILTER_USE = True //右键查询功能开关 dw_pageretr.titleclick_sort_use = True //单击标题排序功能开关 dw_pageretr.SetTransObject (sqlca) pkcolumndbtname = wf_get_pkcolumndbtname(dw_pageretr) //取第一列为关键字 ori_oldselect = dw_pageretr.Describe("DataWindow.Table.Select") ls_newselect = ori_oldselect ds_curquery = Create DATASTORE ds_curquery.DataObject = 'd_extr_find' ds_curquery.SetTransObject (sqlca) wf_editindex_lockf() IF Not retrieve_all And Trim(arg_string_code) <> '' THEN sle_usual_query.Text = Trim(arg_string_code) This.TriggerEvent("ue_usual_query_RETR") //修改ls_newselect,retrieve ELSE wf_retrieveuc(dw_pageretr,ls_newselect,1) This.TriggerEvent('RETRIEVE_pageretr') END IF IF retrieve_all And Trim(arg_string_code) <> '' THEN This.TriggerEvent("ue_usual_query_filt") END IF dw_choice.SetTransObject(sqlca) wf_face_change() //s_hide_col s_col //s_col.col_1 = 'cost' //s_col.col_2 = 'wareamt' //f_hide_col(490,dw_pageretr,s_col) //f_hide_col(490,dw_choice,s_col) // //s_hide_col s_col_mtrlsectype //s_col_mtrlsectype.col_1 = 'u_mtrldef_mtrlsectype' //f_hide_col(1308,dw_pageretr,s_col_mtrlsectype) //f_hide_col(1308,dw_choice,s_col_mtrlsectype) // //s_hide_col s_col_zxmtrlmode //s_col_zxmtrlmode.col_1 = 'u_mtrldef_zxmtrlmode' //f_hide_col(1309,dw_pageretr,s_col_zxmtrlmode) //f_hide_col(1309,dw_choice,s_col_zxmtrlmode) end event event ue_usual_query_filt;call super::ue_usual_query_filt;String obj_expr = '' IF Trim(sle_usual_query.Text) <> '' THEN IF Pos(Trim(sle_usual_query.Text),'%') = 0 THEN obj_expr = obj_expr+'( billcode LIKE "%'+Trim(sle_usual_query.Text)+'%") ' obj_expr = obj_expr+' or ( U_Bmstpay_relcode LIKE "%'+Trim(sle_usual_query.Text)+'%" )' ELSE obj_expr = obj_expr+'( billcode LIKE "'+Trim(sle_usual_query.Text)+'" )' obj_expr = obj_expr+' or ( U_Bmstpay_relcode LIKE "'+Trim(sle_usual_query.Text)+'" )' END IF END IF dw_pageretr.SetFilter(obj_expr) dw_pageretr.SetRedraw(False) dw_pageretr.Filter() IF dw_pageretr.RowCount() >= 1 THEN dw_pageretr.SelectRow(0,False) dw_pageretr.SelectRow(1,True ) END IF dw_pageretr.SetRedraw(True ) end event event ue_usual_query_retr;call super::ue_usual_query_retr;String ls_querystrpart = '' ls_newselect = Lower(ori_oldselect) IF Trim(sle_usual_query.Text) <> '' THEN IF Pos(Trim(sle_usual_query.Text),'%') = 0 THEN ls_querystrpart = ls_querystrpart + "(U_Bmstpay.billcode like '%"+Trim(sle_usual_query.Text)+"%'" ls_querystrpart = ls_querystrpart + " or U_Bmstpay.relcode like '%"+Trim(sle_usual_query.Text)+"%')" ELSE ls_querystrpart = ls_querystrpart + "( U_Bmstpay.billcode like '"+Trim(sle_usual_query.Text)+"'" ls_querystrpart = ls_querystrpart + " or U_Bmstpay.relcode like '"+Trim(sle_usual_query.Text)+"')" END IF IF Pos(ls_newselect," where ") <> 0 THEN ls_newselect = ls_newselect+" AND ("+ls_querystrpart+')' ELSE ls_newselect = ls_newselect+" where ("+ls_querystrpart+')' END IF END IF wf_retrieveuc(dw_pageretr,ls_newselect,1) THIS.TriggerEvent('retrieve_pageretr') end event type cb_func from w_pageretr_ch2`cb_func within w_mustpay_ch end type type cb_exit from w_pageretr_ch2`cb_exit within w_mustpay_ch end type type sle_usual_query from w_pageretr_ch2`sle_usual_query within w_mustpay_ch end type type cb_retrieveall from w_pageretr_ch2`cb_retrieveall within w_mustpay_ch end type type em_pagerowno from w_pageretr_ch2`em_pagerowno within w_mustpay_ch end type type dw_pageretr from w_pageretr_ch2`dw_pageretr within w_mustpay_ch string dataobject = "dw_mstpay_ch" end type type st_1 from w_pageretr_ch2`st_1 within w_mustpay_ch string text = "凭证号码含:" end type type cb_nextpage from w_pageretr_ch2`cb_nextpage within w_mustpay_ch end type type cb_choice from w_pageretr_ch2`cb_choice within w_mustpay_ch integer weight = 700 end type event cb_choice::clicked;call super::clicked;Long ROW,ls_i = 0,chC = 0 datawindow dw IF cbx_ml.Checked THEN //直接多选 dw = dw_pageretr ROW = dw.GetRow() IF ROW <= 0 THEN MessageBox('提示','请先选择目标行!', Information!, OK! ) RETURN END IF ELSE dw = dw_choice dw.AcceptText() ROW = dw.RowCount() IF ROW <= 0 THEN MessageBox('提示','请先选择缓冲目标!', Information!, OK! ) RETURN END IF END IF FOR ls_i = 1 To dw.RowCount() IF not cbx_ml.Checked or dw.IsSelected(ls_i) THEN chC++ INS_RT_STRU.scid[chC] = dw.Object.U_Bmstpay_scid[ls_i] INS_RT_STRU.payid[chC] = dw.Object.payid[ls_i] INS_RT_STRU.paydate[chC] = dw.Object.paydate[ls_i] INS_RT_STRU.inrep[chC] = dw.Object.inrep[ls_i] INS_RT_STRU.oriamt[chC] = dw.Object.oriamt[ls_i] INS_RT_STRU.mstpayamt[chC] = dw.Object.mstpayamt[ls_i] INS_RT_STRU.payamt[chC] = dw.Object.payamt[ls_i] INS_RT_STRU.billcode[chC] = dw.Object.billcode[ls_i] INS_RT_STRU.relcode[chC] = dw.Object.U_Bmstpay_relcode[ls_i] INS_RT_STRU.dscrp[chC] = dw.Object.dscrp[ls_i] INS_RT_STRU.viewdate[chC] = dw.Object.viewdate[ls_i] INS_RT_STRU.banktypeid[chC] = dw.Object.U_Bmstpay_banktypeid[ls_i] INS_RT_STRU.buildtype[chC] = dw.Object.buildtype[ls_i] INS_RT_STRU.inwareid[chC] = dw.Object.inwareid[ls_i] INS_RT_STRU.accountsid[chC] = dw.Object.U_Bmstpay_accountsid[ls_i] INS_RT_STRU.itemid[chC] = dw.Object.U_Bmstpay_itemid[ls_i] INS_RT_STRU.moneyid[chC] = dw.Object.U_Bmstpay_moneyid[ls_i] END IF NEXT IF chC = 0 THEN MessageBox('提示','请至少选择一个目标行!', Information!, OK! ) RETURN END IF CLOSE(PARENT) end event type cb_refresh from w_pageretr_ch2`cb_refresh within w_mustpay_ch end type type cb_help from w_pageretr_ch2`cb_help within w_mustpay_ch end type type ln_bar from w_pageretr_ch2`ln_bar within w_mustpay_ch end type type ln_bar2 from w_pageretr_ch2`ln_bar2 within w_mustpay_ch end type type r_bar from w_pageretr_ch2`r_bar within w_mustpay_ch end type type ln_1 from w_pageretr_ch2`ln_1 within w_mustpay_ch end type type ln_2 from w_pageretr_ch2`ln_2 within w_mustpay_ch end type type cbx_ml from w_pageretr_ch2`cbx_ml within w_mustpay_ch end type type cb_ok from w_pageretr_ch2`cb_ok within w_mustpay_ch end type event cb_ok::clicked;call super::clicked;Long ROW,ls_i,chC = 0 ROW = dw_pageretr.GetRow() IF ROW <= 0 THEN MessageBox('提示','请先选择目标行!', Information!, OK! ) RETURN END IF FOR ls_i = 1 To dw_pageretr.RowCount() IF dw_pageretr.IsSelected(ls_i) THEN IF dw_choice.Find('payid ='+String(dw_pageretr.Object.payid[ls_i]),1,dw_choice.RowCount()) = 0 THEN chC++ dw_pageretr.RowsCopy(ls_i, ls_i, Primary!, dw_choice, dw_choice.RowCount() + 1, Primary!) END IF END IF NEXT end event type cb_del from w_pageretr_ch2`cb_del within w_mustpay_ch end type type cbx_mlselect from w_pageretr_ch2`cbx_mlselect within w_mustpay_ch integer x = 1239 end type type dw_choice from w_pageretr_ch2`dw_choice within w_mustpay_ch string dataobject = "dw_mstpay_ch" end type type cbx_allselect from w_pageretr_ch2`cbx_allselect within w_mustpay_ch integer x = 1467 end type type st_4 from statictext within w_mustpay_ch integer x = 2565 integer y = 196 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_1 from editmask within w_mustpay_ch integer x = 2057 integer y = 180 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 event constructor;This.Text = String(Today(), 'yyyy-mm')+'-01' end event type em_2 from editmask within w_mustpay_ch integer x = 2670 integer y = 180 integer width = 407 integer height = 88 integer taborder = 120 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 event constructor;This.Text = String(Today(), 'yyyy-mm-dd') end event type pb_em1 from picturebutton within w_mustpay_ch integer x = 2473 integer y = 180 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 pb_em2 from picturebutton within w_mustpay_ch integer x = 3086 integer y = 180 integer width = 101 integer height = 92 integer taborder = 130 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_mustpay_ch integer x = 3195 integer y = 180 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 = "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 type cbx_chkdate from checkbox within w_mustpay_ch integer x = 1787 integer y = 196 integer width = 265 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 string text = "按日期" end type