$PBExportHeader$w_rp_mustpay_paycodehz.srw forward global type w_rp_mustpay_paycodehz from w_publ_easyq end type type sle_cuscode from singlelineedit within w_rp_mustpay_paycodehz end type type st_2 from statictext within w_rp_mustpay_paycodehz end type type sle_cusname from singlelineedit within w_rp_mustpay_paycodehz end type type st_1 from statictext within w_rp_mustpay_paycodehz end type type cb_3 from uo_imflatbutton within w_rp_mustpay_paycodehz end type type ddlb_2 from dropdownlistbox within w_rp_mustpay_paycodehz end type type st_5 from statictext within w_rp_mustpay_paycodehz end type type ddlb_1 from dropdownlistbox within w_rp_mustpay_paycodehz end type type cb_xls from uo_imflatbutton within w_rp_mustpay_paycodehz end type type st_6 from statictext within w_rp_mustpay_paycodehz end type type ddlb_scid from uo_ddlb_scid within w_rp_mustpay_paycodehz end type type st_7 from statictext within w_rp_mustpay_paycodehz end type end forward global type w_rp_mustpay_paycodehz from w_publ_easyq integer x = 9 integer y = 12 integer width = 5230 string title = "供应商对帐表" event ue_xls ( ) sle_cuscode sle_cuscode st_2 st_2 sle_cusname sle_cusname st_1 st_1 cb_3 cb_3 ddlb_2 ddlb_2 st_5 st_5 ddlb_1 ddlb_1 cb_xls cb_xls st_6 st_6 ddlb_scid ddlb_scid st_7 st_7 end type global w_rp_mustpay_paycodehz w_rp_mustpay_paycodehz type variables long cur_scid = -1 long ins_moneyid string printname1 string printname2 Long ll_xls_billid,ll_xls_Templatesid String ls_xls_DefaultDataWindow end variables forward prototypes public function integer wf_xls_retrievedata (long arg_ationid, ref s_xls_billlist arg_str_billlist, ref uo_sendtoexcel arg_obj_st, ref string arg_msg) end prototypes event ue_xls(); string arg_msg Long ll_Templatesid,ll_ationid ll_Templatesid = Message.LongParm ll_ationid = long(Message.wordparm ) if isnull(ll_Templatesid) then ll_Templatesid = 0 if isnull(ll_ationid) then ll_ationid = 0 if ll_Templatesid = 0 then return ll_xls_Templatesid = ll_Templatesid uo_xls_constant uo_constant //Excel全局设置对象 uo_constant = create uo_xls_constant uo_sendtoexcel obj_st //实例化数据处理对象 obj_st = create uo_sendtoexcel obj_st.commit_transaction = sqlca //事务对象 建议显示设置 默认等于sqlca obj_st.uo_const = uo_constant //全局配置对象 s_xls_billlist str_billlist str_billlist = obj_st.of_getbillinfo(ll_Templatesid,arg_msg) //根据模版获取相应的单据信息 if str_billlist.count <=0 then MessageBox('错误1',arg_msg) return end if if wf_xls_retrievedata(ll_ationid,str_billlist,obj_st,arg_msg) <> 1 then MessageBox('错误2',arg_msg) return end if //发送数据 obj_st.event oe_sendtoexcel(str_billlist) end event public function integer wf_xls_retrievedata (long arg_ationid, ref s_xls_billlist arg_str_billlist, ref uo_sendtoexcel arg_obj_st, ref string arg_msg);//============================================================================== // 函数: w_publ_1ton_share_detail::wf_xls_retrievedata() //------------------------------------------------------------------------------ // 描述: 此函数需要 重载,复制祖先范例代码,然后修改retrieve参数部分两处即可 //------------------------------------------------------------------------------ Long LS_ROW,ll_id,i,ll_scid //LS_ROW = dw_spt.GetRow() //IF LS_ROW <= 0 THEN // arg_msg = '没有目标单据!' // RETURN 0 //END IF IF arg_ationid = 1 Or arg_ationid = 2 THEN //打印 // IF Not f_power_ind(18,sys_msg_pow) THEN // arg_msg = sys_msg_pow // RETURN 0 // END IF ELSE //发送 // IF Not f_power_ind(888,sys_msg_pow) THEN // arg_msg = sys_msg_pow // RETURN 0 // END IF END IF //修改点:获取 指定retriev参数 //long ll_cusid DateTime firstdate,enddate firstdate = DateTime(Date(em_1.Text),Time(0)) enddate = DateTime(RelativeDate(Date(em_2.Text),1),Time(0)) //ll_cusid = dw_spt.Object.sptid[LS_ROW] string ls_code='' if pos(sle_cuscode.text,'%')>0 then ls_code=sle_cuscode.text else ls_code='%'+sle_cuscode.text+'%' end if ////可选设置/// arg_obj_st.uo_const.create_new_pwd( ) //创建随机密码 if sys_option_xls_ifuse_passwd = 1 then arg_obj_st.uo_const.pwd = trim(sys_option_xls_user_passwd) //默认加密密码 默认为随即密码 boolean xls_locked xls_locked = not (sys_option_xls_lock = 1) /// Excel 的可选设置 if arg_obj_st.of_setoption(arg_ationid, xls_locked,true,arg_msg) <> 1 then return 0 end if for i = 1 to arg_str_billlist.count ////可选操作/// arg_str_billlist.bill[i].ds_data = create datastore // arg_str_billlist.bill[i].ds_data.dataobject = arg_str_billlist.bill[i].datawindow // arg_str_billlist.bill[i].ds_data.settransobject(sqlca) //修改点:注意retrieve 参数与上文对应 arg_str_billlist.bill[i].ds_data.retrieve(ins_moneyid,ls_code,firstdate,enddate,sys_user_spttype) next return 1 end function on w_rp_mustpay_paycodehz.create int iCurrent call super::create this.sle_cuscode=create sle_cuscode this.st_2=create st_2 this.sle_cusname=create sle_cusname this.st_1=create st_1 this.cb_3=create cb_3 this.ddlb_2=create ddlb_2 this.st_5=create st_5 this.ddlb_1=create ddlb_1 this.cb_xls=create cb_xls this.st_6=create st_6 this.ddlb_scid=create ddlb_scid this.st_7=create st_7 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.sle_cuscode this.Control[iCurrent+2]=this.st_2 this.Control[iCurrent+3]=this.sle_cusname this.Control[iCurrent+4]=this.st_1 this.Control[iCurrent+5]=this.cb_3 this.Control[iCurrent+6]=this.ddlb_2 this.Control[iCurrent+7]=this.st_5 this.Control[iCurrent+8]=this.ddlb_1 this.Control[iCurrent+9]=this.cb_xls this.Control[iCurrent+10]=this.st_6 this.Control[iCurrent+11]=this.ddlb_scid this.Control[iCurrent+12]=this.st_7 end on on w_rp_mustpay_paycodehz.destroy call super::destroy destroy(this.sle_cuscode) destroy(this.st_2) destroy(this.sle_cusname) destroy(this.st_1) destroy(this.cb_3) destroy(this.ddlb_2) destroy(this.st_5) destroy(this.ddlb_1) destroy(this.cb_xls) destroy(this.st_6) destroy(this.ddlb_scid) destroy(this.st_7) end on event open;call super::open;//String ls_printname1, ls_printname2 //ls_printname1 = 'dw_rp_mstpay_paycodehz' //ls_printname2 = 'dw_rp_mstpay_paycodehz' // //String ls_windowname //ls_windowname = This.ClassName () // //printname1 = f_get_dwprint_dynamic_chname(ls_printname1,ls_windowname) //IF printname1 = '' THEN // printname1 = ls_printname1 //ELSE // dw_1.DataObject = printname1 //END IF // //printname2 = f_get_dwprint_dynamic_chname(ls_printname2,ls_windowname) //IF printname2 = '' THEN // printname2 = ls_printname2 //END IF // //dw_1.SetTransObject (sqlca) //IF dw_1.DataObject = "" THEN // MessageBox('错误','未定义格式或格式不存在',stopsign!,ok!) // RETURN //END IF //dw_1.Object.DataWindow.Print.Preview.Rulers = "yes" // //IF cbx_loginretr.Checked THEN // cb_1.TriggerEvent(Clicked!) //END IF // // // end event event ue_before_open;call super::ue_before_open;if_ue_retr=true if_ue_filter=true if_ue_sort=true if_ue_sentdataout=true end event event ue_before_openretrieve;call super::ue_before_openretrieve;dw_1.Object.DataWindow.Print.Preview.Rulers = "yes" end event type cb_func from w_publ_easyq`cb_func within w_rp_mustpay_paycodehz end type type cb_exit from w_publ_easyq`cb_exit within w_rp_mustpay_paycodehz integer x = 1417 end type type cb_2 from w_publ_easyq`cb_2 within w_rp_mustpay_paycodehz integer taborder = 100 boolean bringtotop = true end type type cb_psetup from w_publ_easyq`cb_psetup within w_rp_mustpay_paycodehz boolean bringtotop = true end type type cb_1 from w_publ_easyq`cb_1 within w_rp_mustpay_paycodehz boolean bringtotop = true end type event cb_1::clicked;call super::clicked;if dw_1.dataobject = "" then messagebox('错误','未定义格式或格式不存在',stopsign!,ok!) return end if datetime firstdate,enddate firstdate=datetime(date(em_1.text),time(0)) enddate =DateTime(Date(em_2.Text),Time('23:59:59')) string ls_code='' if pos(sle_cuscode.text,'%')>0 then ls_code=sle_cuscode.text else ls_code='%'+sle_cuscode.text+'%' end if DELETE FROM u_parm_pay where id=1 ; if sqlca.sqlcode<>0 then messagebox('错误','数据库操作失败!',stopsign!,ok!) rollback; return end if insert into u_parm_pay (firstdate,enddate,id) values (:firstdate,:enddate,1); if sqlca.sqlcode<>0 then messagebox('错误','数据库操作失败!',stopsign!,ok!) rollback; return end if commit; dw_1.retrieve(ins_moneyid,ls_code,firstdate,enddate,sys_user_spttype,cur_scid) dw_1.object.txt_dzrq.text=em_1.text+" 到 "+em_2.text end event type st_3 from w_publ_easyq`st_3 within w_rp_mustpay_paycodehz integer x = 1518 integer y = 204 integer width = 215 end type type st_4 from w_publ_easyq`st_4 within w_rp_mustpay_paycodehz integer x = 2245 integer y = 204 end type type em_1 from w_publ_easyq`em_1 within w_rp_mustpay_paycodehz integer x = 1728 integer y = 188 integer taborder = 110 end type type em_2 from w_publ_easyq`em_2 within w_rp_mustpay_paycodehz integer x = 2354 integer y = 188 integer taborder = 120 long textcolor = 0 end type type ddlb_yl from w_publ_easyq`ddlb_yl within w_rp_mustpay_paycodehz integer x = 1874 integer y = 8 boolean enabled = true end type type cbx_yl from w_publ_easyq`cbx_yl within w_rp_mustpay_paycodehz integer x = 1655 integer y = 12 boolean enabled = false end type type dw_1 from w_publ_easyq`dw_1 within w_rp_mustpay_paycodehz integer y = 300 integer width = 3397 integer height = 1544 string dataobject = "dw_rp_mstpay_paycodehz" boolean setcolumn_visible_use = false boolean autosave_filter_use = false boolean autosave_sort_use = false boolean autosave_setlayout_use = false boolean autosave_columnvisible_use = false end type event dw_1::constructor; //titleclick_sort_use=true //单击标题排序功能开关 // RBUTTON_FILTER_USE=true //右键查询功能开关 end event event dw_1::destructor; //titleclick_sort_use=true //单击标题排序功能开关 // RBUTTON_FILTER_USE=true //右键查询功能开关 end event event dw_1::ue_setlayout;int i = 0 end event type sle_mtrl from w_publ_easyq`sle_mtrl within w_rp_mustpay_paycodehz end type type sle_cust from w_publ_easyq`sle_cust within w_rp_mustpay_paycodehz end type type st_mtrl from w_publ_easyq`st_mtrl within w_rp_mustpay_paycodehz end type type st_cust from w_publ_easyq`st_cust within w_rp_mustpay_paycodehz end type type cbx_loginretr from w_publ_easyq`cbx_loginretr within w_rp_mustpay_paycodehz boolean visible = true integer x = 1655 integer y = 96 end type type pb_em1 from w_publ_easyq`pb_em1 within w_rp_mustpay_paycodehz integer x = 2135 integer y = 188 end type type pb_em2 from w_publ_easyq`pb_em2 within w_rp_mustpay_paycodehz integer x = 2770 integer y = 188 end type type pb_2 from w_publ_easyq`pb_2 within w_rp_mustpay_paycodehz integer x = 2880 integer y = 188 end type type cb_help from w_publ_easyq`cb_help within w_rp_mustpay_paycodehz integer x = 1266 end type type cb_copyself from w_publ_easyq`cb_copyself within w_rp_mustpay_paycodehz end type type gb_1 from w_publ_easyq`gb_1 within w_rp_mustpay_paycodehz end type type ln_bar from w_publ_easyq`ln_bar within w_rp_mustpay_paycodehz end type type ln_bar2 from w_publ_easyq`ln_bar2 within w_rp_mustpay_paycodehz end type type r_bar from w_publ_easyq`r_bar within w_rp_mustpay_paycodehz end type type ln_1 from w_publ_easyq`ln_1 within w_rp_mustpay_paycodehz end type type ln_2 from w_publ_easyq`ln_2 within w_rp_mustpay_paycodehz end type type ln_3 from w_publ_easyq`ln_3 within w_rp_mustpay_paycodehz end type type ln_4 from w_publ_easyq`ln_4 within w_rp_mustpay_paycodehz end type type sle_cuscode from singlelineedit within w_rp_mustpay_paycodehz integer x = 3387 integer y = 192 integer width = 512 integer height = 88 integer taborder = 80 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 boolean autohscroll = false borderstyle borderstyle = stylelowered! end type type st_2 from statictext within w_rp_mustpay_paycodehz integer x = 3017 integer y = 204 integer width = 361 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 = "供应商编号含:" boolean focusrectangle = false end type type sle_cusname from singlelineedit within w_rp_mustpay_paycodehz integer x = 4082 integer y = 192 integer width = 841 integer height = 88 integer taborder = 90 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 134217739 boolean displayonly = true borderstyle borderstyle = stylelowered! end type type st_1 from statictext within w_rp_mustpay_paycodehz integer x = 3922 integer y = 204 integer width = 151 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 = "名称:" alignment alignment = right! boolean focusrectangle = false end type type cb_3 from uo_imflatbutton within w_rp_mustpay_paycodehz integer x = 4933 integer y = 192 integer width = 110 integer height = 88 integer taborder = 100 boolean bringtotop = true string text = "..." end type event clicked;call super::clicked;if not isvalid(w_spt_edit) then s_edit_index_tran s_ch_tran s_ch_tran.if_retrieve_all = local_retrieve_all s_ch_tran.work_mode = 1 s_ch_tran.arg_pkid = 0 s_ch_tran.arg_string_code = sle_cuscode.text openwithparm(w_spt_edit,s_ch_tran) s_spt s_inscust s_inscust=message.powerobjectparm if s_inscust.sptid > 0 then sle_cusname.text=s_inscust.name sle_cuscode.text=s_inscust.sptcode end if end if end event type ddlb_2 from dropdownlistbox within w_rp_mustpay_paycodehz integer x = 1093 integer y = 192 integer width = 430 integer height = 1296 integer taborder = 90 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 boolean sorted = false boolean vscrollbar = true borderstyle borderstyle = stylelowered! end type event constructor;Long ll_moneyid,i String ls_name DECLARE getmx CURSOR FOR SELECT moneyid,Name FROM cw_currency Order By moneyid ; OPEN getmx; DO WHILE sqlca.SQLCode = 0 FETCH getmx INTO :ll_moneyid,:ls_name ; IF sqlca.SQLCode <> 0 THEN EXIT THIS.AddItem(ls_name+Fill(' ',50)+'['+String(ll_moneyid)+']') i++ if i=1 then this.text=ls_name+Fill(' ',50)+'['+String(ll_moneyid)+']' ins_moneyid=ll_moneyid end if LOOP CLOSE getmx; end event event selectionchanged; ins_moneyid=Long(Mid ( THIS.Text,Pos(THIS.Text,'[') + 1,Len(THIS.Text) - Pos(THIS.Text,'[') - 1 )) cb_1.triggerevent(clicked!) end event type st_5 from statictext within w_rp_mustpay_paycodehz integer x = 955 integer y = 212 integer width = 133 integer height = 48 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 = "币种" alignment alignment = right! boolean focusrectangle = false end type type ddlb_1 from dropdownlistbox within w_rp_mustpay_paycodehz integer x = 2400 integer y = 28 integer width = 384 integer height = 984 integer taborder = 80 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 string text = "格式一" boolean sorted = false string item[] = {"格式一","格式二"} borderstyle borderstyle = stylelowered! end type event selectionchanged; IF THIS.Text = '格式一' THEN dw_1.DataObject = 'dw_rp_mstpay_paycodehz' ELSEIF THIS.Text = '格式二' THEN dw_1.DataObject = 'dw_rp_mstpay_paycodehz_2' END IF wf_replacedw() dw_1.Object.DataWindow.Print.Preview.Rulers = "yes" cb_1.TriggerEvent(Clicked!) st_7.text=string(dw_1.dataobject) end event type cb_xls from uo_imflatbutton within w_rp_mustpay_paycodehz integer x = 965 integer y = 4 integer height = 164 integer taborder = 250 boolean bringtotop = true string text = "Excel打印" string normalpicname = "excel.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;// 约定 用 parent.Classname ( ) 即状况名称 作为打印模板的分类 uo_sendtoexcel obj_st obj_st = create uo_sendtoexcel obj_st.commit_transaction = sqlca obj_st.TriggerEventObject = this.getparent() obj_st.TriggerEventname = 'ue_xls' string arg_msg menu m1 m1 = obj_st.of_createmenu( parent.Classname ( ),sys_user_xls_print_str,sys_user_xls_send_str) if upperbound( m1.item)=2 then messagebox('错误','当前单据还没有设置Excel打印模板.') else m1.PopMenu(this.x ,this.y+THIS.height) end if end event type st_6 from statictext within w_rp_mustpay_paycodehz integer x = 87 integer y = 208 integer width = 128 integer height = 48 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 = "分部" boolean focusrectangle = false end type type ddlb_scid from uo_ddlb_scid within w_rp_mustpay_paycodehz integer x = 233 integer y = 192 integer width = 549 integer height = 1120 integer taborder = 40 boolean bringtotop = true end type event constructor;call super::constructor;cur_scid = This.uo_scid end event event selectionchanged;call super::selectionchanged;cur_scid = This.uo_scid cb_1.TriggerEvent(Clicked!) end event type st_7 from statictext within w_rp_mustpay_paycodehz integer x = 2903 integer y = 52 integer width = 1198 integer height = 48 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 boolean focusrectangle = false end type event constructor;THIS.BackColor = 14215660 end event