$PBExportHeader$w_rp_associat_sptcust.srw forward global type w_rp_associat_sptcust from w_publ_easyq end type type cb_3 from uo_imflatbutton within w_rp_associat_sptcust end type type cb_4 from uo_imflatbutton within w_rp_associat_sptcust end type type cb_5 from uo_imflatbutton within w_rp_associat_sptcust end type type cb_6 from uo_imflatbutton within w_rp_associat_sptcust end type type cb_7 from uo_imflatbutton within w_rp_associat_sptcust end type type st_1 from statictext within w_rp_associat_sptcust end type type st_2 from statictext within w_rp_associat_sptcust end type type ddlb_3 from uo_ddlb_scid within w_rp_associat_sptcust end type type ddlb_money from uo_ddlb_moneyid within w_rp_associat_sptcust end type type cbx_ifacc from checkbox within w_rp_associat_sptcust end type end forward global type w_rp_associat_sptcust from w_publ_easyq integer width = 4357 string title = "往来账" event ue_usual_query_filt ( ) cb_3 cb_3 cb_4 cb_4 cb_5 cb_5 cb_6 cb_6 cb_7 cb_7 st_1 st_1 st_2 st_2 ddlb_3 ddlb_3 ddlb_money ddlb_money cbx_ifacc cbx_ifacc end type global w_rp_associat_sptcust w_rp_associat_sptcust type variables long ins_moneyid=0 long cur_scid long cur_scid_arr[] uo_reissue_sptcust uo_sptcust end variables forward prototypes public function string wf_getname (integer ai_id, integer ai_type) end prototypes event ue_usual_query_filt();String obj_expr = '' IF Trim(sle_cust.Text) <> '' THEN IF Pos(Trim(sle_cust.Text),'%') = 0 THEN obj_expr = obj_expr+'( sptcode like "%'+Trim(sle_cust.Text)+'%" )' obj_expr = obj_expr+' or (u_spt_name like "%'+Trim(sle_cust.Text)+'%" )' obj_expr = obj_expr+'or( u_cust_cuscode like "%'+Trim(sle_cust.Text)+'%" )' obj_expr = obj_expr+' or (u_cust_name like "%'+Trim(sle_cust.Text)+'%" )' ELSE obj_expr = obj_expr+'( sptcode like "'+Trim(sle_cust.Text)+'") ' obj_expr = obj_expr+' or (u_spt_name like "'+Trim(sle_cust.Text)+'" )' obj_expr = obj_expr+'or ( u_cust_cuscode like "'+Trim(sle_cust.Text)+'") ' obj_expr = obj_expr+' or (u_cust_name like "'+Trim(sle_cust.Text)+'" )' END IF END IF dw_1.SetFilter(obj_expr) dw_1.SetRedraw(False) dw_1.Filter() IF dw_1.RowCount() >= 1 THEN dw_1.SelectRow(0,False) dw_1.SelectRow(1,True) END IF dw_1.SetRedraw(True) end event public function string wf_getname (integer ai_id, integer ai_type);string ls_name if ai_type = 1 then SELECT U_Expenses.ExpensesName into :ls_name FROM U_Expenses where U_Expenses.Expensestype = 1 and ExpensesID = :ai_id ; else SELECT U_Expenses.ExpensesName into :ls_name FROM U_Expenses where U_Expenses.Expensestype = 0 and ExpensesID = :ai_id ; end if if isnull(ls_name ) then ls_name = '' return ls_name end function on w_rp_associat_sptcust.create int iCurrent call super::create this.cb_3=create cb_3 this.cb_4=create cb_4 this.cb_5=create cb_5 this.cb_6=create cb_6 this.cb_7=create cb_7 this.st_1=create st_1 this.st_2=create st_2 this.ddlb_3=create ddlb_3 this.ddlb_money=create ddlb_money this.cbx_ifacc=create cbx_ifacc iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.cb_3 this.Control[iCurrent+2]=this.cb_4 this.Control[iCurrent+3]=this.cb_5 this.Control[iCurrent+4]=this.cb_6 this.Control[iCurrent+5]=this.cb_7 this.Control[iCurrent+6]=this.st_1 this.Control[iCurrent+7]=this.st_2 this.Control[iCurrent+8]=this.ddlb_3 this.Control[iCurrent+9]=this.ddlb_money this.Control[iCurrent+10]=this.cbx_ifacc end on on w_rp_associat_sptcust.destroy call super::destroy destroy(this.cb_3) destroy(this.cb_4) destroy(this.cb_5) destroy(this.cb_6) destroy(this.cb_7) destroy(this.st_1) destroy(this.st_2) destroy(this.ddlb_3) destroy(this.ddlb_money) destroy(this.cbx_ifacc) end on event open;call super::open;uo_sptcust = CREATE uo_reissue_sptcust uo_sptcust.commit_transaction = sqlca end event type cb_func from w_publ_easyq`cb_func within w_rp_associat_sptcust integer x = 1637 integer width = 165 string text = "功能" end type type cb_exit from w_publ_easyq`cb_exit within w_rp_associat_sptcust integer x = 2501 end type type cb_2 from w_publ_easyq`cb_2 within w_rp_associat_sptcust integer x = 2313 end type type cb_psetup from w_publ_easyq`cb_psetup within w_rp_associat_sptcust integer x = 2057 end type type cb_1 from w_publ_easyq`cb_1 within w_rp_associat_sptcust end type event cb_1::clicked;call super::clicked;Int arg_ifacc DateTime firstdate,enddate firstdate = DateTime(Date(em_1.Text),Time(0)) enddate = DateTime(Date(em_2.Text),Time('23:59:59')) if cbx_ifacc.checked then arg_ifacc = 1 else arg_ifacc = 0 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; DELETE From u_parm_pay Where id = 2 ; IF sqlca.SQLCode <> 0 THEN MessageBox('错误','数据库操作失败!'+sqlca.SQLErrText,stopsign!,ok!) ROLLBACK; RETURN END IF INSERT INTO u_parm_pay (firstdate,enddate,id) Values (:firstdate,:enddate,2); IF sqlca.SQLCode <> 0 THEN MessageBox('错误','数据库操作失败!'+sqlca.SQLErrText,stopsign!,ok!) ROLLBACK; RETURN END IF COMMIT; dw_1.Retrieve(arg_ifacc,cur_scid_arr,ins_moneyid) end event type st_3 from w_publ_easyq`st_3 within w_rp_associat_sptcust end type type st_4 from w_publ_easyq`st_4 within w_rp_associat_sptcust end type type em_1 from w_publ_easyq`em_1 within w_rp_associat_sptcust end type type em_2 from w_publ_easyq`em_2 within w_rp_associat_sptcust end type type ddlb_yl from w_publ_easyq`ddlb_yl within w_rp_associat_sptcust boolean visible = false end type type cbx_yl from w_publ_easyq`cbx_yl within w_rp_associat_sptcust boolean visible = false end type type dw_1 from w_publ_easyq`dw_1 within w_rp_associat_sptcust integer y = 404 string dataobject = "dw_rp_associat_sptcust" end type type sle_mtrl from w_publ_easyq`sle_mtrl within w_rp_associat_sptcust integer x = 3131 integer y = 72 end type type sle_cust from w_publ_easyq`sle_cust within w_rp_associat_sptcust boolean visible = true integer x = 2149 integer y = 188 end type event sle_cust::modified;call super::modified; PARENT.TRIGGEREVENT("ue_usual_query_filt") end event type st_mtrl from w_publ_easyq`st_mtrl within w_rp_associat_sptcust integer x = 2674 integer y = 88 end type type st_cust from w_publ_easyq`st_cust within w_rp_associat_sptcust boolean visible = true integer x = 1495 integer y = 204 integer width = 645 string text = "供应商/客户名称/编码含:" end type type cbx_loginretr from w_publ_easyq`cbx_loginretr within w_rp_associat_sptcust end type type pb_em1 from w_publ_easyq`pb_em1 within w_rp_associat_sptcust end type type pb_em2 from w_publ_easyq`pb_em2 within w_rp_associat_sptcust end type type pb_2 from w_publ_easyq`pb_2 within w_rp_associat_sptcust end type type cb_help from w_publ_easyq`cb_help within w_rp_associat_sptcust boolean visible = false integer x = 3525 end type type cb_copyself from w_publ_easyq`cb_copyself within w_rp_associat_sptcust integer x = 1801 end type type gb_1 from w_publ_easyq`gb_1 within w_rp_associat_sptcust end type type ln_bar from w_publ_easyq`ln_bar within w_rp_associat_sptcust end type type ln_bar2 from w_publ_easyq`ln_bar2 within w_rp_associat_sptcust end type event ln_bar2::constructor;call super::constructor;long i for i = 1 to dw_1.rowcount() next end event type r_bar from w_publ_easyq`r_bar within w_rp_associat_sptcust integer x = 3360 end type type ln_1 from w_publ_easyq`ln_1 within w_rp_associat_sptcust integer beginy = 392 integer endy = 392 end type type ln_2 from w_publ_easyq`ln_2 within w_rp_associat_sptcust integer beginy = 396 integer endy = 396 end type type ln_3 from w_publ_easyq`ln_3 within w_rp_associat_sptcust boolean visible = false end type type ln_4 from w_publ_easyq`ln_4 within w_rp_associat_sptcust boolean visible = false end type type cb_3 from uo_imflatbutton within w_rp_associat_sptcust integer x = 160 integer width = 151 integer height = 164 integer taborder = 80 boolean bringtotop = true string text = "全选" string normalpicname = "ok.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;long i for i = 1 to dw_1.rowcount() dw_1.object.isselected[i] = 1 next end event type cb_4 from uo_imflatbutton within w_rp_associat_sptcust integer x = 320 integer width = 151 integer height = 164 integer taborder = 90 boolean bringtotop = true string text = "反选" string normalpicname = "DELETE.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;long i for i = 1 to dw_1.rowcount() dw_1.object.isselected[i] = 0 next end event type cb_5 from uo_imflatbutton within w_rp_associat_sptcust integer x = 480 integer width = 293 integer height = 164 integer taborder = 90 string dragicon = "ServerProfile!" boolean bringtotop = true string text = "往来对冲" string normalpicname = "audit.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;Long i ,j = 0 dw_1.AcceptText( ) Dec{5} ldec_pay = 0 ,ldec_take = 0 ,ldec_retult = 0 String arg_msg , ls_spt_mtrname,ls_cus_mtrname Long spt_itemid1,cus_itemid1,spt_mtrlid1,cus_mtrlid1,spt_relid1,cus_relid1 IF Not f_power_ind(1852,sys_msg_pow) THEN MessageBox(publ_operator,sys_msg_pow) RETURN END IF If Not DateTime( em_2.Text) > DateTime(2000-01-01,Now()) Then MessageBox('提示','不合理发生时间', Information!, OK! ) Return End If spt_itemid1 = Long(f_ProfileString(0,spt_itemid, "spt_itemid", '0')) cus_itemid1 = Long( f_ProfileString (0,cus_itemid, "cus_itemid", '0')) spt_mtrlid1 = Long(f_ProfileString(0,spt_mtrlid, "spt_mtrlid", '0')) cus_mtrlid1 = Long( f_ProfileString (0,cus_mtrlid, "cus_mtrlid", '0')) spt_relid1 = Long( f_ProfileString (0,spt_relid, "spt_relid", '0') ) cus_relid1 = Long( f_ProfileString (0,cus_relid, "cus_relid", '0') ) //publ_operator //请输入经手人 //relid = //请选择结算方式 //请选择币种 ins_moneyid //u_reissue_itemid //请选择项目 // uo_sptcust If spt_relid1 = 0 Then MessageBox('提示','请在相关资料设置,设置供应商结算方式', Information!, OK! ) Return End If If cus_relid1 = 0 Then MessageBox('提示','请在相关资料设置,设置客户结算方式', Information!, OK! ) Return End If If spt_itemid1 = 0 Then MessageBox('提示','请在相关资料设置,设置供应商项目', Information!, OK! ) Return End If If cus_itemid1 = 0 Then MessageBox('提示','请在相关资料设置,设置客户项目', Information!, OK! ) Return End If If spt_mtrlid1 = 0 Then MessageBox('提示','请在相关资料设置,设置供应商费用', Information!, OK! ) Return End If If cus_mtrlid1 = 0 Then MessageBox('提示','请在相关资料设置,设置客户费用', Information!, OK! ) Return End If ls_spt_mtrname = wf_getname(spt_mtrlid1,1) ls_cus_mtrname = wf_getname(cus_mtrlid1,0) For i = 1 To dw_1.RowCount() If dw_1.Object.IsSelected[i] = 1 Then j++ Next If j > 0 Then Else MessageBox('提示','请选定当前目标行!', Information!, OK! ) Return End If j = 0 For i = 1 To dw_1.RowCount() If dw_1.Object.IsSelected[i] = 1 Then ldec_pay = Dec(dw_1.Object.v_mustpaybalc_balcamt_balcamt[i]) ldec_take = Dec( dw_1.Object.balcamt2[i]) If IsNull(ldec_pay) Or ldec_pay = 0 Then Return If IsNull(ldec_take) Or ldec_take = 0 Then Return If ldec_take > ldec_pay Then ldec_retult = ldec_pay Else ldec_retult = ldec_take End If // uo_sptcust.if_getid_ture = false If uo_sptcust.newbegin(uo_sptcust.scid,arg_msg) = 0 Then MessageBox('错误',arg_msg,stopsign!,OK!) Return End If // uo_sptcust.it_newbegin = true uo_sptcust.reissuedate = DateTime( em_2.Text) uo_sptcust.dscrp = '往来对冲自动生成' uo_sptcust.cusid = dw_1.Object.sptid[i] uo_sptcust.relcode = '' uo_sptcust.r_type = 2 uo_sptcust.relid = spt_relid1 uo_sptcust.moneyid = ins_moneyid uo_sptcust.reissueemp = publ_operator uo_sptcust.itemid = spt_itemid1 If uo_sptcust.acceptmx( 1,& -ldec_retult,& -ldec_retult,& '往来对冲自动生成',& 1,& arg_msg,& spt_mtrlid1,ls_spt_mtrname) = 0 Then MessageBox('错误',arg_msg, stopsign!, OK! ) Return End If If uo_sptcust.Save(false,arg_msg) = 0 Then MessageBox('错误',arg_msg, stopsign!, OK! ) Return End If If uo_sptcust.getinfo(uo_sptcust.scid,uo_sptcust.reissueid ,arg_msg) = 0 Then MessageBox('错误',arg_msg, stopsign!, OK! ) Return End If If uo_sptcust.auditing(false,arg_msg) = 0 Then MessageBox('错误',arg_msg, stopsign!, OK! ) return Else // uo_sptcust('提示','审核成功!', Information!, OK! ) End If uo_sptcust.if_getid_ture = false If uo_sptcust.newbegin(uo_sptcust.scid,arg_msg) = 0 Then MessageBox('错误',arg_msg,stopsign!,OK!) Return End If uo_sptcust.reissuedate = DateTime( em_2.Text) uo_sptcust.dscrp = '往来对冲自动生成' uo_sptcust.cusid = dw_1.Object.u_cust_cusid[i] uo_sptcust.relcode = '' uo_sptcust.r_type = 1 uo_sptcust.relid = cus_relid1 uo_sptcust.moneyid = ins_moneyid uo_sptcust.reissueemp = publ_operator uo_sptcust.itemid = cus_itemid1 If uo_sptcust.acceptmx( 1,& ldec_retult,& ldec_retult,& '往来对冲自动生成',& 1,& arg_msg,& cus_mtrlid1,ls_cus_mtrname) = 0 Then MessageBox('错误',arg_msg, stopsign!, OK! ) Return End If If uo_sptcust.Save(false,arg_msg) = 0 Then MessageBox('错误',arg_msg, stopsign!, OK! ) Return End If If uo_sptcust.getinfo(uo_sptcust.scid,uo_sptcust.reissueid ,arg_msg) = 0 Then MessageBox('错误',arg_msg, stopsign!, OK! ) Return End If If uo_sptcust.auditing(True,arg_msg) = 0 Then MessageBox('错误',arg_msg, stopsign!, OK! ) return Else // uo_sptcust('提示','审核成功!', Information!, OK! ) End If j++ Else End If Next If j > 0 Then MessageBox('提示','对冲成功!', Information!, OK! ) cb_1.triggerevent(clicked!) end event type cb_6 from uo_imflatbutton within w_rp_associat_sptcust integer x = 782 integer width = 384 integer height = 164 integer taborder = 100 string dragicon = "Information!" boolean bringtotop = true string text = "关联往来单位" string normalpicname = "p7.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;IF Not f_power_ind(1853,sys_msg_pow) THEN MessageBox(publ_operator,sys_msg_pow) RETURN END IF s_edit_index_tran s_rpinfo s_rpinfo.if_sendout = if_power_sendout s_rpinfo.if_print = if_power_print OpenWithParm(w_associat_sptcust,s_rpinfo) end event type cb_7 from uo_imflatbutton within w_rp_associat_sptcust integer x = 1175 integer width = 384 integer height = 164 integer taborder = 100 string dragicon = "OleGenReg!" boolean bringtotop = true string text = "相关资料设置" string normalpicname = "p2.BMP" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;IF Not f_power_ind(1851,sys_msg_pow) THEN MessageBox(publ_operator,sys_msg_pow) RETURN END IF open(w_associat_sptcust_set) end event type st_1 from statictext within w_rp_associat_sptcust integer x = 87 integer y = 312 integer width = 151 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_2 from statictext within w_rp_associat_sptcust integer x = 750 integer y = 312 integer width = 151 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_3 from uo_ddlb_scid within w_rp_associat_sptcust integer x = 215 integer y = 296 integer width = 526 integer height = 768 integer taborder = 40 boolean bringtotop = true end type event constructor;call super::constructor;THIS.Enabled = (sys_option_scid_msttake_mstpay = 1) cur_scid_arr = THIS.uo_scid_arr end event event selectionchanged;call super::selectionchanged;cur_scid_arr = THIS.uo_scid_arr cb_1.TriggerEvent(Clicked!) end event type ddlb_money from uo_ddlb_moneyid within w_rp_associat_sptcust integer x = 901 integer y = 296 integer taborder = 40 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 cbx_ifacc from checkbox within w_rp_associat_sptcust integer x = 1472 integer y = 312 integer width = 896 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 event clicked;int li_ifacc IF THIS.Checked THEN this.weight = 700 this.textcolor = 255 li_ifacc = 1 ELSE this.weight = 400 this.textcolor = 0 li_ifacc = 0 END IF f_SetProfileString (sys_empid,publ_userid+'_'+dw_1.DataObject, "ifacc",String(li_ifacc)) cb_1.TriggerEvent(Clicked!) end event event constructor;int li_ifacc li_ifacc = Long(f_ProfileString (sys_empid,publ_userid+'_'+dw_1.DataObject, "ifacc",'0')) IF li_ifacc = 1 THEN THIS.Checked = TRUE this.weight = 700 this.textcolor = 255 ELSE THIS.Checked = FALSE this.weight = 400 this.textcolor = 0 END IF end event