$PBExportHeader$w_rp_musttake_takecodehz.srw forward global type w_rp_musttake_takecodehz from w_publ_easyq end type type sle_cuscode from singlelineedit within w_rp_musttake_takecodehz end type type st_2 from statictext within w_rp_musttake_takecodehz end type type st_1 from statictext within w_rp_musttake_takecodehz end type type sle_cusname from singlelineedit within w_rp_musttake_takecodehz end type type cb_3 from uo_imflatbutton within w_rp_musttake_takecodehz end type type ddlb_1 from dropdownlistbox within w_rp_musttake_takecodehz end type type st_5 from statictext within w_rp_musttake_takecodehz end type type ddlb_money from uo_ddlb_moneyid within w_rp_musttake_takecodehz end type type cb_xls from uo_imflatbutton within w_rp_musttake_takecodehz end type type ddlb_scid from uo_ddlb_scid within w_rp_musttake_takecodehz end type type st_6 from statictext within w_rp_musttake_takecodehz end type type st_7 from statictext within w_rp_musttake_takecodehz end type end forward global type w_rp_musttake_takecodehz from w_publ_easyq integer x = 9 integer y = 12 integer width = 4658 string title = "客户对帐表" event ue_xls ( ) sle_cuscode sle_cuscode st_2 st_2 st_1 st_1 sle_cusname sle_cusname cb_3 cb_3 ddlb_1 ddlb_1 st_5 st_5 ddlb_money ddlb_money cb_xls cb_xls ddlb_scid ddlb_scid st_6 st_6 st_7 st_7 end type global w_rp_musttake_takecodehz w_rp_musttake_takecodehz type variables long cur_scid = -1 long ins_moneyid=0 string printname1 string printname2 string printname3 string printname4 Long ll_xls_billid,ll_xls_Templatesid String ls_xls_DefaultDataWindow end variables forward prototypes public subroutine wf_init_dw1 () 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 subroutine wf_init_dw1 ();IF ddlb_1.Text = '格式一' THEN dw_1.DataObject = 'dw_rp_msttake_takecodehz' ELSEIF ddlb_1.Text = '格式二' THEN dw_1.DataObject = 'dw_rp_msttake_takecodehz_2' ELSEIF ddlb_1.Text = '格式三' THEN dw_1.DataObject = 'dw_rp_msttake_takecodehz_3' ELSEIF ddlb_1.Text = '格式四' THEN dw_1.DataObject = 'dw_rp_msttake_takecodehz_4' END IF end subroutine 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_cust.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_cust.Object.cusid[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_areaid) next return 1 end function on w_rp_musttake_takecodehz.create int iCurrent call super::create this.sle_cuscode=create sle_cuscode this.st_2=create st_2 this.st_1=create st_1 this.sle_cusname=create sle_cusname this.cb_3=create cb_3 this.ddlb_1=create ddlb_1 this.st_5=create st_5 this.ddlb_money=create ddlb_money this.cb_xls=create cb_xls this.ddlb_scid=create ddlb_scid this.st_6=create st_6 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.st_1 this.Control[iCurrent+4]=this.sle_cusname this.Control[iCurrent+5]=this.cb_3 this.Control[iCurrent+6]=this.ddlb_1 this.Control[iCurrent+7]=this.st_5 this.Control[iCurrent+8]=this.ddlb_money this.Control[iCurrent+9]=this.cb_xls this.Control[iCurrent+10]=this.ddlb_scid this.Control[iCurrent+11]=this.st_6 this.Control[iCurrent+12]=this.st_7 end on on w_rp_musttake_takecodehz.destroy call super::destroy destroy(this.sle_cuscode) destroy(this.st_2) destroy(this.st_1) destroy(this.sle_cusname) destroy(this.cb_3) destroy(this.ddlb_1) destroy(this.st_5) destroy(this.ddlb_money) destroy(this.cb_xls) destroy(this.ddlb_scid) destroy(this.st_6) destroy(this.st_7) end on event ue_before_openretrieve;call super::ue_before_openretrieve;IF dw_1.DataObject <> '' THEN dw_1.Object.DataWindow.Print.Preview.Rulers = "yes" end event type cb_func from w_publ_easyq`cb_func within w_rp_musttake_takecodehz end type type cb_exit from w_publ_easyq`cb_exit within w_rp_musttake_takecodehz integer x = 1417 end type type cb_2 from w_publ_easyq`cb_2 within w_rp_musttake_takecodehz integer taborder = 100 boolean bringtotop = true end type type cb_psetup from w_publ_easyq`cb_psetup within w_rp_musttake_takecodehz boolean bringtotop = true end type type cb_1 from w_publ_easyq`cb_1 within w_rp_musttake_takecodehz 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 = 2 ; IF sqlca.SQLCode <> 0 THEN MessageBox('错误','数据库操作失败!',stopsign!,ok!) ROLLBACK; RETURN END IF INSERT Into u_parm_pay (firstdate,enddate,id) Values (:firstdate,:enddate,2); IF sqlca.SQLCode <> 0 THEN MessageBox('错误','数据库操作失败!',stopsign!,ok!) ROLLBACK; RETURN 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_areaid,cur_scid) dw_1.Object.txt_dzrq.Text = String(Date(firstdate))+" 到 "+em_2.Text end event type st_3 from w_publ_easyq`st_3 within w_rp_musttake_takecodehz integer x = 1307 integer y = 212 end type type st_4 from w_publ_easyq`st_4 within w_rp_musttake_takecodehz integer x = 2021 end type type em_1 from w_publ_easyq`em_1 within w_rp_musttake_takecodehz integer x = 1513 integer y = 188 integer taborder = 110 end type type em_2 from w_publ_easyq`em_2 within w_rp_musttake_takecodehz integer x = 2121 integer y = 188 integer taborder = 120 long textcolor = 0 end type type ddlb_yl from w_publ_easyq`ddlb_yl within w_rp_musttake_takecodehz integer x = 1856 integer y = 8 boolean enabled = true end type type cbx_yl from w_publ_easyq`cbx_yl within w_rp_musttake_takecodehz integer x = 1646 integer y = 8 boolean enabled = false boolean checked = true end type type dw_1 from w_publ_easyq`dw_1 within w_rp_musttake_takecodehz integer y = 308 integer width = 3378 integer height = 1624 string dataobject = "dw_rp_msttake_takecodehz" 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;int i = 0 end event event dw_1::destructor;int i = 0 end event event dw_1::ue_setlayout;int i = 0 end event type sle_mtrl from w_publ_easyq`sle_mtrl within w_rp_musttake_takecodehz end type type sle_cust from w_publ_easyq`sle_cust within w_rp_musttake_takecodehz end type type st_mtrl from w_publ_easyq`st_mtrl within w_rp_musttake_takecodehz end type type st_cust from w_publ_easyq`st_cust within w_rp_musttake_takecodehz end type type cbx_loginretr from w_publ_easyq`cbx_loginretr within w_rp_musttake_takecodehz boolean visible = true integer x = 1627 end type type pb_em1 from w_publ_easyq`pb_em1 within w_rp_musttake_takecodehz integer x = 1920 integer y = 188 end type type pb_em2 from w_publ_easyq`pb_em2 within w_rp_musttake_takecodehz integer x = 2537 integer y = 184 end type type pb_2 from w_publ_easyq`pb_2 within w_rp_musttake_takecodehz integer x = 2642 integer y = 184 end type type cb_help from w_publ_easyq`cb_help within w_rp_musttake_takecodehz integer x = 1266 end type type cb_copyself from w_publ_easyq`cb_copyself within w_rp_musttake_takecodehz end type type gb_1 from w_publ_easyq`gb_1 within w_rp_musttake_takecodehz end type type ln_bar from w_publ_easyq`ln_bar within w_rp_musttake_takecodehz end type type ln_bar2 from w_publ_easyq`ln_bar2 within w_rp_musttake_takecodehz end type type r_bar from w_publ_easyq`r_bar within w_rp_musttake_takecodehz end type type ln_1 from w_publ_easyq`ln_1 within w_rp_musttake_takecodehz end type type ln_2 from w_publ_easyq`ln_2 within w_rp_musttake_takecodehz end type type ln_3 from w_publ_easyq`ln_3 within w_rp_musttake_takecodehz integer beginy = 312 integer endy = 312 end type type ln_4 from w_publ_easyq`ln_4 within w_rp_musttake_takecodehz integer beginy = 316 integer endy = 316 end type type sle_cuscode from singlelineedit within w_rp_musttake_takecodehz integer x = 3054 integer y = 188 integer width = 352 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_musttake_takecodehz integer x = 2747 integer y = 208 integer width = 293 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 st_1 from statictext within w_rp_musttake_takecodehz integer x = 3410 integer y = 204 integer width = 224 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 sle_cusname from singlelineedit within w_rp_musttake_takecodehz integer x = 3639 integer y = 188 integer width = 882 integer height = 80 integer taborder = 100 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 cb_3 from uo_imflatbutton within w_rp_musttake_takecodehz integer x = 4544 integer y = 192 integer width = 110 integer height = 88 integer taborder = 110 boolean bringtotop = true string text = "..." end type event clicked;call super::clicked;if not isvalid(w_cust_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_cust_edit,s_ch_tran) s_custom s_inscust s_inscust=message.powerobjectparm if s_inscust.cusid > 0 then sle_cusname.text=s_inscust.name sle_cuscode.text=s_inscust.cuscode end if end if end event type ddlb_1 from dropdownlistbox within w_rp_musttake_takecodehz integer x = 2405 integer y = 40 integer width = 384 integer height = 984 integer taborder = 70 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_msttake_takecodehz' ELSEIF This.Text = '格式二' THEN dw_1.DataObject = 'dw_rp_msttake_takecodehz_2' ELSEIF This.Text = '格式三' THEN dw_1.DataObject = 'dw_rp_msttake_takecodehz_3' ELSEIF This.Text = '格式四' THEN dw_1.DataObject = 'dw_rp_msttake_takecodehz_4' ELSEIF This.Text = '格式五' THEN dw_1.DataObject = 'dw_rp_msttake_takecodehz_5' ELSEIF This.Text = '格式六' THEN dw_1.DataObject = 'dw_rp_msttake_takecodehz_6' END IF wf_replacedw() dw_1.Object.DataWindow.Print.Preview.Rulers = "yes" IF sle_cuscode.Text <> "" THEN cb_1.TriggerEvent(Clicked!) END IF st_7.text=string(dw_1.dataobject) end event event destructor;f_SetProfileString(sys_empid, String(parent.ClassName()), "ddlb", this.text) end event event constructor;String ls_text ls_text = f_ProfileString(sys_empid, String(Parent.ClassName()), "ddlb","格式一") Long Index Index = This.FindItem(ls_text, 1) IF Index > 0 THEN This.Text = ls_text END IF end event type st_5 from statictext within w_rp_musttake_takecodehz integer x = 686 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_money from uo_ddlb_moneyid within w_rp_musttake_takecodehz integer x = 823 integer y = 192 integer taborder = 130 boolean bringtotop = true end type event constructor;call super::constructor;ins_moneyid = THIS.uo_moneyid end event event selectionchanged;call super::selectionchanged;ins_moneyid = THIS.uo_moneyid cb_1.TriggerEvent(Clicked!) end event type cb_xls from uo_imflatbutton within w_rp_musttake_takecodehz integer x = 965 integer height = 164 integer taborder = 240 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 ddlb_scid from uo_ddlb_scid within w_rp_musttake_takecodehz integer x = 146 integer y = 196 integer width = 549 integer height = 1120 integer taborder = 30 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_6 from statictext within w_rp_musttake_takecodehz integer y = 212 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 st_7 from statictext within w_rp_musttake_takecodehz integer x = 2917 integer y = 56 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