$PBExportHeader$w_aifmb_querycom2.srw forward global type w_aifmb_querycom2 from window end type type cb_5 from commandbutton within w_aifmb_querycom2 end type type cb_4 from commandbutton within w_aifmb_querycom2 end type type em_2 from editmask within w_aifmb_querycom2 end type type cb_3 from commandbutton within w_aifmb_querycom2 end type type em_1 from editmask within w_aifmb_querycom2 end type type cb_2 from commandbutton within w_aifmb_querycom2 end type type cb_addcusspt from commandbutton within w_aifmb_querycom2 end type type cb_addspt from commandbutton within w_aifmb_querycom2 end type type cb_addcus from commandbutton within w_aifmb_querycom2 end type type cb_1 from commandbutton within w_aifmb_querycom2 end type type dw_1 from u_dw_rbtnfilter within w_aifmb_querycom2 end type end forward global type w_aifmb_querycom2 from window integer width = 3351 integer height = 1968 windowtype windowtype = child! long backcolor = 67108864 string icon = "AppIcon!" boolean center = true event ue_search ( ) cb_5 cb_5 cb_4 cb_4 em_2 em_2 cb_3 cb_3 em_1 em_1 cb_2 cb_2 cb_addcusspt cb_addcusspt cb_addspt cb_addspt cb_addcus cb_addcus cb_1 cb_1 dw_1 dw_1 end type global w_aifmb_querycom2 w_aifmb_querycom2 forward prototypes public function integer wf_retrieve_type (ref string arg_msg) end prototypes event ue_search();DataStore ds_productcode uo_aifmb lo_aifmb ds_productcode = Create DataStore lo_aifmb = Create uo_aifmb Int rslt = 1 String arg_msg ds_productcode.DataObject = dw_1.DataObject Long pageindex = 0 Long pagesize = 0 pageindex = Long(em_1.Text) IF pageindex <= 0 THEN em_1.Text = '1' pageindex = 1 END IF pagesize = Long(em_2.Text) IF pagesize <= 0 THEN em_2.Text = '10' pagesize = 10 END IF IF lo_aifmb.uf_getlinkedentlist(ds_productcode, pageindex, pagesize, arg_msg) <> 1 THEN rslt = 0 GOTO ext END IF dw_1.Reset() ds_productcode.RowsCopy(1, ds_productcode.RowCount(), Primary!, dw_1, 1, Primary!) IF wf_retrieve_type(arg_msg) <> 1 THEN rslt = 0 GOTO ext END IF ext: Destroy ds_productcode Destroy lo_aifmb IF rslt = 0 THEN MessageBox('ERROR', arg_msg) END IF end event public function integer wf_retrieve_type (ref string arg_msg);Int rslt = 1 String ls_CusID Long ll_custype String ls_cuscode String ls_cusname Long i FOR i = 1 To dw_1.RowCount() ls_CusID = dw_1.Object.CusID[i] IF IsNull(ls_CusID) THEN CONTINUE IF ls_CusID = '' THEN CONTINUE SELECT top 1 custype, cuscode, cusname INTO :ll_custype, :ls_cuscode, :ls_cusname FROM LJFIEB_CusComm WHERE CusID = :ls_CusID Using sys_email_sqlca; IF sys_email_sqlca.SQLCode <> 0 THEN CONTINUE dw_1.Object.custype[i] = ll_custype dw_1.Object.cuscode[i] = ls_cuscode dw_1.Object.cusname[i] = ls_cusname NEXT RETURN rslt end function on w_aifmb_querycom2.create this.cb_5=create cb_5 this.cb_4=create cb_4 this.em_2=create em_2 this.cb_3=create cb_3 this.em_1=create em_1 this.cb_2=create cb_2 this.cb_addcusspt=create cb_addcusspt this.cb_addspt=create cb_addspt this.cb_addcus=create cb_addcus this.cb_1=create cb_1 this.dw_1=create dw_1 this.Control[]={this.cb_5,& this.cb_4,& this.em_2,& this.cb_3,& this.em_1,& this.cb_2,& this.cb_addcusspt,& this.cb_addspt,& this.cb_addcus,& this.cb_1,& this.dw_1} end on on w_aifmb_querycom2.destroy destroy(this.cb_5) destroy(this.cb_4) destroy(this.em_2) destroy(this.cb_3) destroy(this.em_1) destroy(this.cb_2) destroy(this.cb_addcusspt) destroy(this.cb_addspt) destroy(this.cb_addcus) destroy(this.cb_1) destroy(this.dw_1) end on event resize; dw_1.Width = This.WorkSpaceWidth() - dw_1.X dw_1.Height = This.WorkSpaceHeight() - dw_1.Y end event type cb_5 from commandbutton within w_aifmb_querycom2 integer x = 2816 integer y = 40 integer width = 274 integer height = 84 integer taborder = 20 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "消息记录" end type event clicked;open(w_aifmb_addcuscomm_request2) end event type cb_4 from commandbutton within w_aifmb_querycom2 integer x = 2409 integer y = 40 integer width = 274 integer height = 84 integer taborder = 10 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "发消息" end type event clicked;Long i, j = 0, row = 0 FOR i = 1 To dw_1.RowCount() IF dw_1.Object.ch[i] = 1 THEN j = i EXIT END IF NEXT Long arr_entids[] Long k = 0 IF j <= 0 THEN row = dw_1.GetRow() IF row <= 0 THEN MessageBox('提示', '请选择对象') RETURN END IF k++ arr_entids[k] = dw_1.Object.UserID[row] ELSE FOR i = j To dw_1.RowCount() IF dw_1.Object.ch[i] = 1 THEN k++ arr_entids[k] = dw_1.Object.UserID[i] END IF NEXT END IF Open(w_aifmb_linkmsg) s_aifmb_linkmsg s_rslt s_rslt = Message.PowerObjectParm IF s_rslt.ifok = 0 THEN RETURN END IF Int rslt = 1 String arg_msg = '' uo_aifmb lo_aifmb lo_aifmb = Create uo_aifmb IF lo_aifmb.uf_setentlinkmsg(arr_entids, s_rslt.msgcontent, s_rslt.linkstring, arg_msg) <> 1 THEN rslt = 0 GOTO ext END IF ext: Destroy lo_aifmb IF rslt = 0 THEN MessageBox('ERROR', arg_msg) ELSE MessageBox('提示', '发送成功') END IF end event type em_2 from editmask within w_aifmb_querycom2 integer x = 946 integer y = 40 integer width = 165 integer height = 84 integer taborder = 90 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 string text = "10" alignment alignment = right! borderstyle borderstyle = stylelowered! string mask = "#,##0" end type type cb_3 from commandbutton within w_aifmb_querycom2 integer x = 681 integer y = 40 integer width = 242 integer height = 84 integer taborder = 80 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "下一页" end type event clicked;long pageindex pageindex = long(em_1.Text) pageindex += 1 em_1.Text = string(pageindex) parent.triggerevent('ue_search') end event type em_1 from editmask within w_aifmb_querycom2 integer x = 517 integer y = 40 integer width = 165 integer height = 84 integer taborder = 70 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 string text = "1" alignment alignment = right! borderstyle borderstyle = stylelowered! string mask = "#,##0" end type type cb_2 from commandbutton within w_aifmb_querycom2 integer x = 274 integer y = 40 integer width = 242 integer height = 84 integer taborder = 60 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "上一页" end type event clicked;long pageindex pageindex = long(em_1.Text) pageindex -= 1 em_1.Text = string(pageindex) parent.triggerevent('ue_search') end event type cb_addcusspt from commandbutton within w_aifmb_querycom2 integer x = 1856 integer y = 40 integer width = 439 integer height = 84 integer taborder = 50 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "加为客户供应商" end type event clicked;Long ll_row ll_row = dw_1.GetRow() IF ll_row <= 0 THEN MessageBox('提示', '请选择添加对象') RETURN END IF s_aifmb_addcuscomm s_parm s_parm.cusid = dw_1.Object.cusid[ll_row] s_parm.cuscode = dw_1.Object.usercode[ll_row] s_parm.cusname = dw_1.Object.username[ll_row] s_parm.lb_readonly = False s_parm.custype = 3 IF s_parm.cusid = '' THEN MessageBox('提示', '对方唯一码为空不能添加') RETURN END IF IF s_parm.cusid = '00000000-0000-0000-0000-000000000000' THEN MessageBox('提示', '对方唯一码为零不能添加') RETURN END IF //查询是否已经绑定客户 Long ll_cnt SELECT COUNT(0) INTO :ll_cnt FROM LJFIEB_CusComm WHERE CusID = :s_parm.cusid Using sys_email_sqlca; IF sys_email_sqlca.SQLCode <> 0 THEN MessageBox('提示', '查询企业是否有本地信息失败,' + sys_email_sqlca.SQLErrText) RETURN END IF String ls_cuscode String ls_cusname IF ll_cnt > 0 THEN SELECT top 1 cuscode, cusname INTO :ls_cuscode, :ls_cusname FROM LJFIEB_CusComm WHERE CusID = :s_parm.cusid Using sys_email_sqlca; IF sys_email_sqlca.SQLCode <> 0 THEN MessageBox('提示', '查询本地企业信息失败,' + sys_email_sqlca.SQLErrText) RETURN END IF s_parm.cuscode = ls_cuscode s_parm.cusname = ls_cusname s_parm.lb_readonly = True SELECT COUNT(0) INTO :ll_cnt FROM u_cust Where commcode = :ls_cuscode; IF sqlca.SQLCode <> 0 THEN MessageBox('提示', '查询已绑定客户个数失败,' + sys_email_sqlca.SQLErrText) RETURN END IF IF ll_cnt > 0 THEN IF MessageBox('提问', '本企业已经绑定了' + String(ll_cnt) + '个客户,是否继续?', Question!, YesNo!, 1) <> 1 THEN RETURN END IF END IF SELECT COUNT(0) INTO :ll_cnt FROM u_spt Where commcode = :ls_cuscode; IF sqlca.SQLCode <> 0 THEN MessageBox('提示', '查询已绑定供应商个数失败,' + sys_email_sqlca.SQLErrText) RETURN END IF IF ll_cnt > 0 THEN IF MessageBox('提问', '本企业已经绑定了' + String(ll_cnt) + '个供应商,是否继续?', Question!, YesNo!, 1) <> 1 THEN RETURN END IF END IF END IF s_custom s_cust s_cust.cuscode = dw_1.Object.usercode[ll_row] s_cust.Name = dw_1.Object.username[ll_row] s_cust.tele = dw_1.Object.tele[ll_row] s_cust.tele1 = dw_1.Object.phone[ll_row] s_cust.Address = dw_1.Object.Address[ll_row] s_cust.email = dw_1.Object.email[ll_row] s_cust.dscrp = dw_1.Object.dscrp[ll_row] s_edit_index_tran s_tran s_tran.if_retrieve_all = False //是否一次RETRIEVE所有行 s_tran.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式 s_tran.arg_pkid = 0 //目标定位PKID (备用) s_tran.e_long = 1 s_tran.a_any = s_cust OpenWithParm(w_cust_edit, s_tran) s_custom S_INSCUST S_INSCUST = Message.PowerObjectParm //接受返回结构 IF S_INSCUST.cusid <= 0 THEN RETURN s_parm.ll_cusid = S_INSCUST.cusid s_parm.ls_cuscode = S_INSCUST.cuscode s_parm.ls_cusname = S_INSCUST.Name s_spt s_spt_tran s_spt_tran.sptcode = dw_1.Object.usercode[ll_row] s_spt_tran.Name = dw_1.Object.username[ll_row] s_spt_tran.tele = dw_1.Object.tele[ll_row] s_spt_tran.tele1 = dw_1.Object.phone[ll_row] s_spt_tran.Address = dw_1.Object.Address[ll_row] s_spt_tran.email = dw_1.Object.email[ll_row] s_spt_tran.dscrp = dw_1.Object.dscrp[ll_row] s_edit_index_tran s_tran_spt s_tran_spt.if_retrieve_all = False //是否一次RETRIEVE所有行 s_tran_spt.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式 s_tran_spt.arg_pkid = 0 //目标定位PKID (备用) s_tran_spt.e_long = 1 s_tran_spt.a_any = s_spt_tran OpenWithParm(w_spt_edit, s_tran_spt) s_spt S_INSSPT S_INSSPT = Message.PowerObjectParm //接受返回结构 IF S_INSSPT.sptid <= 0 THEN RETURN s_parm.ll_sptid = S_INSSPT.sptid s_parm.ls_sptcode = S_INSSPT.sptcode s_parm.ls_sptname = S_INSSPT.Name OpenWithParm(w_aifmb_addcuscomm,s_parm) end event type cb_addspt from commandbutton within w_aifmb_querycom2 integer x = 1513 integer y = 40 integer width = 329 integer height = 84 integer taborder = 50 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "加为供应商" end type event clicked;Long ll_row ll_row = dw_1.GetRow() IF ll_row <= 0 THEN MessageBox('提示', '请选择添加对象') RETURN END IF s_aifmb_addcuscomm s_parm s_parm.cusid = dw_1.Object.cusid[ll_row] s_parm.cuscode = dw_1.Object.usercode[ll_row] s_parm.cusname = dw_1.Object.username[ll_row] s_parm.lb_readonly = False s_parm.custype = 1 IF s_parm.cusid = '' THEN MessageBox('提示', '对方唯一码为空不能添加') RETURN END IF IF s_parm.cusid = '00000000-0000-0000-0000-000000000000' THEN MessageBox('提示', '对方唯一码为零不能添加') RETURN END IF //查询是否已经绑定客户 Long ll_cnt SELECT COUNT(0) INTO :ll_cnt FROM LJFIEB_CusComm WHERE CusID = :s_parm.cusid Using sys_email_sqlca; IF sys_email_sqlca.SQLCode <> 0 THEN MessageBox('提示', '查询企业是否有本地信息失败,' + sys_email_sqlca.SQLErrText) RETURN END IF String ls_cuscode String ls_cusname IF ll_cnt > 0 THEN SELECT top 1 cuscode, cusname INTO :ls_cuscode, :ls_cusname FROM LJFIEB_CusComm WHERE CusID = :s_parm.cusid Using sys_email_sqlca; IF sys_email_sqlca.SQLCode <> 0 THEN MessageBox('提示', '查询本地企业信息失败,' + sys_email_sqlca.SQLErrText) RETURN END IF s_parm.cuscode = ls_cuscode s_parm.cusname = ls_cusname s_parm.lb_readonly = True SELECT COUNT(0) INTO :ll_cnt FROM u_spt Where commcode = :ls_cuscode; IF sqlca.SQLCode <> 0 THEN MessageBox('提示', '查询已绑定供应商个数失败,' + sys_email_sqlca.SQLErrText) RETURN END IF IF ll_cnt > 0 THEN IF MessageBox('提问', '本企业已经绑定了' + String(ll_cnt) + '个供应商,是否继续?', Question!, YesNo!, 1) <> 1 THEN RETURN END IF END IF END IF s_spt s_spt_tran s_spt_tran.sptcode = dw_1.Object.usercode[ll_row] s_spt_tran.Name = dw_1.Object.username[ll_row] s_spt_tran.tele = dw_1.Object.tele[ll_row] s_spt_tran.tele1 = dw_1.Object.phone[ll_row] s_spt_tran.Address = dw_1.Object.Address[ll_row] s_spt_tran.email = dw_1.Object.email[ll_row] s_spt_tran.dscrp = dw_1.Object.dscrp[ll_row] s_edit_index_tran s_tran_spt s_tran_spt.if_retrieve_all = False //是否一次RETRIEVE所有行 s_tran_spt.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式 s_tran_spt.arg_pkid = 0 //目标定位PKID (备用) s_tran_spt.e_long = 1 s_tran_spt.a_any = s_spt_tran OpenWithParm(w_spt_edit, s_tran_spt) s_spt S_INSSPT S_INSSPT = Message.PowerObjectParm //接受返回结构 IF S_INSSPT.sptid <= 0 THEN RETURN s_parm.ll_sptid = S_INSSPT.sptid s_parm.ls_sptcode = S_INSSPT.sptcode s_parm.ls_sptname = S_INSSPT.Name OpenWithParm(w_aifmb_addcuscomm,s_parm) end event type cb_addcus from commandbutton within w_aifmb_querycom2 integer x = 1225 integer y = 40 integer width = 274 integer height = 84 integer taborder = 40 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "加为客户" end type event clicked;Long ll_row ll_row = dw_1.GetRow() IF ll_row <= 0 THEN MessageBox('提示', '请选择添加对象') RETURN END IF s_aifmb_addcuscomm s_parm s_parm.cusid = dw_1.Object.cusid[ll_row] s_parm.cuscode = dw_1.Object.usercode[ll_row] s_parm.cusname = dw_1.Object.username[ll_row] s_parm.lb_readonly = False s_parm.custype = 2 IF s_parm.cusid = '' THEN MessageBox('提示', '对方唯一码为空不能添加') RETURN END IF IF s_parm.cusid = '00000000-0000-0000-0000-000000000000' THEN MessageBox('提示', '对方唯一码为零不能添加') RETURN END IF //查询是否已经绑定客户 Long ll_cnt SELECT COUNT(0) INTO :ll_cnt FROM LJFIEB_CusComm WHERE CusID = :s_parm.cusid Using sys_email_sqlca; IF sys_email_sqlca.SQLCode <> 0 THEN MessageBox('提示', '查询企业是否有本地信息失败,' + sys_email_sqlca.SQLErrText) RETURN END IF String ls_cuscode String ls_cusname IF ll_cnt > 0 THEN SELECT top 1 cuscode, cusname INTO :ls_cuscode, :ls_cusname FROM LJFIEB_CusComm WHERE CusID = :s_parm.cusid Using sys_email_sqlca; IF sys_email_sqlca.SQLCode <> 0 THEN MessageBox('提示', '查询本地企业信息失败,' + sys_email_sqlca.SQLErrText) RETURN END IF s_parm.cuscode = ls_cuscode s_parm.cusname = ls_cusname s_parm.lb_readonly = True SELECT COUNT(0) INTO :ll_cnt FROM u_cust Where commcode = :ls_cuscode; IF sqlca.SQLCode <> 0 THEN MessageBox('提示', '查询已绑定客户个数失败,' + sys_email_sqlca.SQLErrText) RETURN END IF IF ll_cnt > 0 THEN IF MessageBox('提问', '本企业已经绑定了' + String(ll_cnt) + '个客户,是否继续?', Question!, YesNo!, 1) <> 1 THEN RETURN END IF END IF END IF s_custom s_cust s_cust.cuscode = dw_1.Object.usercode[ll_row] s_cust.Name = dw_1.Object.username[ll_row] s_cust.tele = dw_1.Object.tele[ll_row] s_cust.tele1 = dw_1.Object.phone[ll_row] s_cust.Address = dw_1.Object.Address[ll_row] s_cust.email = dw_1.Object.email[ll_row] s_cust.dscrp = dw_1.Object.dscrp[ll_row] s_edit_index_tran s_tran s_tran.if_retrieve_all = False //是否一次RETRIEVE所有行 s_tran.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式 s_tran.arg_pkid = 0 //目标定位PKID (备用) s_tran.e_long = 1 s_tran.a_any = s_cust OpenWithParm(w_cust_edit, s_tran) s_custom S_INSCUST S_INSCUST = Message.PowerObjectParm //接受返回结构 IF S_INSCUST.cusid <= 0 THEN RETURN s_parm.ll_cusid = S_INSCUST.cusid s_parm.ls_cuscode = S_INSCUST.cuscode s_parm.ls_cusname = S_INSCUST.Name OpenWithParm(w_aifmb_addcuscomm,s_parm) end event type cb_1 from commandbutton within w_aifmb_querycom2 integer x = 37 integer y = 40 integer width = 206 integer height = 84 integer taborder = 20 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "查找" end type event clicked;parent.triggerevent('ue_search') end event type dw_1 from u_dw_rbtnfilter within w_aifmb_querycom2 integer y = 152 integer width = 2446 integer height = 1212 string dataobject = "dw_aifmb_querycom2" boolean hscrollbar = true boolean vscrollbar = true boolean hsplitscroll = true boolean rbutton_filter_use = true boolean rbutton_setposition_use = true boolean titleclick_sort_use = true end type event rowfocuschanged;call super::rowfocuschanged;this.selectrow(0, false) if currentrow > 0 then this.selectrow(currentrow,true) end if end event event clicked;call super::clicked;if row > 0 then this.setrow(row) end if end event