$PBExportHeader$w_msg_send_ljfieb.srw forward global type w_msg_send_ljfieb from w_publ_base end type type st_1 from statictext within w_msg_send_ljfieb end type type st_2 from statictext within w_msg_send_ljfieb end type type st_3 from statictext within w_msg_send_ljfieb end type type sle_title from singlelineedit within w_msg_send_ljfieb end type type mle_msg from multilineedit within w_msg_send_ljfieb end type type dw_emp from datawindow within w_msg_send_ljfieb end type type cb_send from uo_imflatbutton within w_msg_send_ljfieb end type type cb_ch from commandbutton within w_msg_send_ljfieb end type type cb_del from commandbutton within w_msg_send_ljfieb end type type cb_reset from commandbutton within w_msg_send_ljfieb end type type st_text from statictext within w_msg_send_ljfieb end type type st_msg from statictext within w_msg_send_ljfieb end type type st_4 from statictext within w_msg_send_ljfieb end type type ddlb_scid from uo_ddlb_scid_notall within w_msg_send_ljfieb end type type r_bar from rectangle within w_msg_send_ljfieb end type type ln_bar from line within w_msg_send_ljfieb end type type ln_bar2 from line within w_msg_send_ljfieb end type end forward global type w_msg_send_ljfieb from w_publ_base integer width = 3611 integer height = 2004 string title = "消息发送" boolean minbox = false windowtype windowtype = response! st_1 st_1 st_2 st_2 st_3 st_3 sle_title sle_title mle_msg mle_msg dw_emp dw_emp cb_send cb_send cb_ch cb_ch cb_del cb_del cb_reset cb_reset st_text st_text st_msg st_msg st_4 st_4 ddlb_scid ddlb_scid r_bar r_bar ln_bar ln_bar ln_bar2 ln_bar2 end type global w_msg_send_ljfieb w_msg_send_ljfieb type variables long ins_billtype // 1 - 选供应商, 2 - 选客户 long ins_kind // 0 - 新建 1 -回复 string ins_title,ins_msg string ins_cuscode,ins_cusname,ins_sccode uo_ljfieb uo_fieb Transaction tr_eb_sqlca int ins_ifsend = 0 // long cur_scid end variables on w_msg_send_ljfieb.create int iCurrent call super::create this.st_1=create st_1 this.st_2=create st_2 this.st_3=create st_3 this.sle_title=create sle_title this.mle_msg=create mle_msg this.dw_emp=create dw_emp this.cb_send=create cb_send this.cb_ch=create cb_ch this.cb_del=create cb_del this.cb_reset=create cb_reset this.st_text=create st_text this.st_msg=create st_msg this.st_4=create st_4 this.ddlb_scid=create ddlb_scid this.r_bar=create r_bar this.ln_bar=create ln_bar this.ln_bar2=create ln_bar2 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.st_1 this.Control[iCurrent+2]=this.st_2 this.Control[iCurrent+3]=this.st_3 this.Control[iCurrent+4]=this.sle_title this.Control[iCurrent+5]=this.mle_msg this.Control[iCurrent+6]=this.dw_emp this.Control[iCurrent+7]=this.cb_send this.Control[iCurrent+8]=this.cb_ch this.Control[iCurrent+9]=this.cb_del this.Control[iCurrent+10]=this.cb_reset this.Control[iCurrent+11]=this.st_text this.Control[iCurrent+12]=this.st_msg this.Control[iCurrent+13]=this.st_4 this.Control[iCurrent+14]=this.ddlb_scid this.Control[iCurrent+15]=this.r_bar this.Control[iCurrent+16]=this.ln_bar this.Control[iCurrent+17]=this.ln_bar2 end on on w_msg_send_ljfieb.destroy call super::destroy destroy(this.st_1) destroy(this.st_2) destroy(this.st_3) destroy(this.sle_title) destroy(this.mle_msg) destroy(this.dw_emp) destroy(this.cb_send) destroy(this.cb_ch) destroy(this.cb_del) destroy(this.cb_reset) destroy(this.st_text) destroy(this.st_msg) destroy(this.st_4) destroy(this.ddlb_scid) destroy(this.r_bar) destroy(this.ln_bar) destroy(this.ln_bar2) end on event resize;call super::resize;ln_bar.endx = this.width ln_bar2.endx = this.width r_bar.width = this.width end event event open;call super::open;tr_eb_sqlca = sys_email_sqlca // 电子商务连接 IF sys_email_sqlca.DBHandle() = 0 THEN MessageBox('Error','电子商务数据库连接失败,请检查') RETURN END IF s_edit_index_tran s_inscust s_inscust = Message.PowerObjectParm uo_fieb = Create uo_ljfieb uo_fieb.commit_transaction = tr_eb_sqlca ins_billtype = s_inscust.b_long ins_title = s_inscust.b_string ins_kind = s_inscust.c_long ins_cuscode = s_inscust.c_string ins_cusname = s_inscust.d_string ins_sccode = s_inscust.e_string ins_msg = s_inscust.f_string sle_title.setfocus() IF ins_kind = 1 THEN Long ll_row String ls_msg cb_ch.Enabled = False cb_del.Enabled = False cb_reset.Enabled = False dw_emp.Reset() ll_row = dw_emp.InsertRow(0) dw_emp.Object.cuscode[ll_row] = ins_cuscode dw_emp.Object.cusname[ll_row] = ins_cusname dw_emp.Object.sccode[ll_row] = ins_sccode sle_title.Text = '回复:' + ins_title mle_msg.Text = '~r~n' + '~r~n' + '~r~n' + '~r~n' mle_msg.Text = mle_msg.Text + '-----------------回复消息-----------------' + '~r~n' IF lenA(ins_msg) > 100 THEN ls_msg = leftA(ins_msg,100) + '...' ELSE ls_msg = ins_msg END IF mle_msg.Text = mle_msg.Text + ls_msg mle_msg.SelectText(0,0) mle_msg.setfocus() END IF mle_msg.triggerevent('enchange') end event event close;call super::close;closewithreturn(this,ins_ifsend) end event type cb_func from w_publ_base`cb_func within w_msg_send_ljfieb boolean visible = false end type type cb_exit from w_publ_base`cb_exit within w_msg_send_ljfieb integer x = 242 integer width = 151 integer height = 164 integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type type st_1 from statictext within w_msg_send_ljfieb integer x = 50 integer y = 204 integer width = 306 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_msg_send_ljfieb integer x = 1207 integer y = 284 integer width = 123 integer height = 52 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 st_3 from statictext within w_msg_send_ljfieb integer x = 1211 integer y = 392 integer width = 123 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 sle_title from singlelineedit within w_msg_send_ljfieb integer x = 1335 integer y = 272 integer width = 2213 integer height = 84 integer taborder = 20 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type mle_msg from multilineedit within w_msg_send_ljfieb event enchange pbm_enchange integer x = 1335 integer y = 444 integer width = 2213 integer height = 1452 integer taborder = 30 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 boolean vscrollbar = true boolean autovscroll = true borderstyle borderstyle = stylelowered! end type event enchange;long ll_len ll_len = 500 IF ll_len - lena(This.Text) >= 0 THEN st_msg.Text = '剩余' + String(ll_len - lena(This.Text)) + '个字节' st_msg.textcolor = rgb(0,0,0) ELSE st_msg.Text = '超出' + String(lena(This.Text) - ll_len) + '个字节' st_msg.textcolor = rgb(255,0,0) END IF end event type dw_emp from datawindow within w_msg_send_ljfieb integer x = 18 integer y = 268 integer width = 1193 integer height = 1636 integer taborder = 40 boolean bringtotop = true string title = "none" string dataobject = "dw_msg_send_list" boolean hscrollbar = true boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type type cb_send from uo_imflatbutton within w_msg_send_ljfieb integer width = 165 integer height = 164 integer taborder = 10 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;IF Not f_power_ind(1595) THEN MessageBox(publ_operator,sys_msg_pow) RETURN END IF IF tr_eb_sqlca.DBHandle() = 0 THEN MessageBox('Error','电子商务数据库连接失败,请检查') RETURN END IF String ls_title,ls_msg String ls_SerialNum Long ll_i String ls_sccode dw_emp.AcceptText() IF dw_emp.RowCount() <= 0 THEN MessageBox('系统提示','请先选择接收人') RETURN END IF IF cur_scid < 0 THEN MessageBox('系统提示','请先选择分部') ddlb_scid.SetFocus() RETURN END IF SELECT sccode INTO :ls_sccode FROM u_scdef Where scid = :cur_scid Using sqlca; IF sqlca.SQLCode <> 0 THEN MessageBox('系统提示','查询分部代号失败,'+sqlca.SQLErrText) RETURN END IF ls_title = Trim(sle_title.Text) ls_msg = Trim(mle_msg.Text) IF ls_title = '' THEN MessageBox('系统提示','请填写标题') sle_title.SetFocus() RETURN END IF IF ls_msg = '' THEN MessageBox('系统提示','请填写正文') mle_msg.SetFocus() RETURN END IF IF lena(ls_msg) > 500 THEN MessageBox('系统提示','正文内容不能超过500字节,请检查') mle_msg.SetFocus() RETURN END IF IF MessageBox('系统提示','确定要把消息发送到列表中的接收者吗?',question!,yesno!) = 2 THEN RETURN Long ll_SendCusCommID,ll_ReceiveCusCommID String ls_commsccode,ls_commcode String arg_msg //查询本企业通信信息 SELECT CusCommID INTO :ll_SendCusCommID FROM LJFIEB_CusComm Where CusType = 0 Using tr_eb_sqlca; IF tr_eb_sqlca.SQLCode <> 0 THEN MessageBox('Error', '查询本企业通信信息失败,请检查设置,'+tr_eb_sqlca.SQLErrText) RETURN END IF FOR ll_i = 1 To dw_emp.RowCount() ls_commcode = dw_emp.Object.cuscode[ll_i] ls_commsccode = dw_emp.Object.sccode[ll_i] SELECT TOP 1 NEWID() INTO :ls_SerialNum From u_user Using sqlca; IF sqlca.SQLCode <> 0 THEN ROLLBACK Using sqlca; ROLLBACK Using sys_email_sqlca; MessageBox('Error', '第'+String(ll_i)+'行,生成序列号失败,'+sqlca.SQLErrText) RETURN END IF IF IsNull(ls_SerialNum) THEN ls_SerialNum = '' IF ls_SerialNum = '' THEN ROLLBACK Using sys_email_sqlca; MessageBox('Error', '第'+String(ll_i)+'行,错误的发送序列号') RETURN END IF SELECT CusCommID INTO :ll_ReceiveCusCommID FROM LJFIEB_CusComm Where cuscode = :ls_commcode Using tr_eb_sqlca; IF tr_eb_sqlca.SQLCode <> 0 THEN ROLLBACK Using tr_eb_sqlca; MessageBox('Error', '第'+String(ll_i)+'行,查询企业相关通信设置失败,'+tr_eb_sqlca.SQLErrText) RETURN END IF IF ll_ReceiveCusCommID = 0 THEN ROLLBACK Using tr_eb_sqlca; MessageBox('Error', '第'+String(ll_i)+'行,企业相关的通信设置不正确,请检查') RETURN END IF IF uo_fieb.add_packet(ls_SerialNum,'',ll_SendCusCommID,ls_sccode,ll_ReceiveCusCommID,ls_commsccode,7,ls_title,ls_msg,'','','',0,arg_msg,False) = 0 THEN MessageBox('Error',arg_msg) RETURN END IF NEXT COMMIT Using tr_eb_sqlca; ins_ifsend = 1 MessageBox('系统提示','发送成功!') Close(Parent) end event type cb_ch from commandbutton within w_msg_send_ljfieb integer x = 352 integer y = 180 integer width = 334 integer height = 84 integer taborder = 30 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "选择接收人" end type event clicked; IF sys_email_sqlca.DBHandle() = 0 THEN MessageBox('Error','电子商务数据库连接失败,请检查') RETURN END IF Long ll_row,ll_i s_edit_index_tran s_open //传递参数使用 s_open.if_select_any = True s_open.b_string = '' IF ins_billtype = 1 THEN OpenWithParm(w_spt_ecomm_ch,s_open) ELSE OpenWithParm(w_cust_comm_ch,s_open) END IF s_custom_arr INS_RT_STRU INS_RT_STRU = Message.PowerObjectParm FOR ll_i = 1 To UpperBound(INS_RT_STRU.commcode) IF INS_RT_STRU.commcode[ll_i] = '' THEN CONTINUE IF dw_emp.Find("CusCode ='" + String(INS_RT_STRU.commcode[ll_i]) + "'", 1, dw_emp.RowCount()) > 0 THEN CONTINUE ll_row = dw_emp.InsertRow(0) dw_emp.Object.CusCode[ll_row] = INS_RT_STRU.commcode[ll_i] dw_emp.Object.CusName[ll_row] = INS_RT_STRU.Name[ll_i] dw_emp.Object.sccode[ll_row] = INS_RT_STRU.commsccode[ll_i] NEXT end event type cb_del from commandbutton within w_msg_send_ljfieb integer x = 690 integer y = 180 integer width = 334 integer height = 84 integer taborder = 40 boolean bringtotop = true 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_emp.getrow() if ll_row <= 0 then messagebox('系统提示','请选择要删除的接收人') return end if dw_emp.DeleteRow (ll_row) end event type cb_reset from commandbutton within w_msg_send_ljfieb integer x = 1029 integer y = 180 integer width = 178 integer height = 84 integer taborder = 40 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "清空" end type event clicked;IF dw_emp.RowCount() <= 0 THEN RETURN IF MessageBox('询问','确定要清空接收人列表吗?',question!,yesno!) = 2 THEN RETURN dw_emp.Reset() end event type st_text from statictext within w_msg_send_ljfieb integer x = 1403 integer y = 372 integer width = 1326 integer height = 56 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 16711680 long backcolor = 134217739 string text = "正文最多可填500个字节,中文 = 2字节,英文 = 1字节" boolean focusrectangle = false end type type st_msg from statictext within w_msg_send_ljfieb integer x = 2958 integer y = 368 integer width = 581 integer height = 56 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 16711680 long backcolor = 134217739 boolean focusrectangle = false end type type st_4 from statictext within w_msg_send_ljfieb integer x = 1207 integer y = 192 integer width = 123 integer height = 52 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long backcolor = 134217739 string text = "分部" alignment alignment = right! boolean focusrectangle = false end type type ddlb_scid from uo_ddlb_scid_notall within w_msg_send_ljfieb integer x = 1335 integer y = 184 integer width = 507 integer height = 556 integer taborder = 20 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 end event type r_bar from rectangle within w_msg_send_ljfieb long linecolor = 16777215 integer linethickness = 4 long fillcolor = 1073741824 integer x = 3351 integer width = 87 integer height = 68 end type event constructor;this.fillcolor = 14215660 this.linecolor = 14215660 this.x = -1 this.y = -1 this.height = ln_bar.beginy - 5 end event type ln_bar from line within w_msg_send_ljfieb long linecolor = 268435456 integer linethickness = 4 integer beginy = 172 integer endx = 3200 integer endy = 172 end type type ln_bar2 from line within w_msg_send_ljfieb long linecolor = 16777215 integer linethickness = 4 integer beginy = 176 integer endx = 3255 integer endy = 176 end type