$PBExportHeader$w_aifmb_addpromotions.srw forward global type w_aifmb_addpromotions from window end type type lv_1 from uo_piclistview within w_aifmb_addpromotions end type type cb_picaddfile from commandbutton within w_aifmb_addpromotions end type type cb_picdel from commandbutton within w_aifmb_addpromotions end type type cb_addfj from commandbutton within w_aifmb_addpromotions end type type cb_cancel from commandbutton within w_aifmb_addpromotions end type type cb_ok from commandbutton within w_aifmb_addpromotions end type type dw_1 from datawindow within w_aifmb_addpromotions end type end forward global type w_aifmb_addpromotions from window integer width = 3607 integer height = 1500 boolean titlebar = true string title = "添加促销" boolean controlmenu = true windowtype windowtype = response! long backcolor = 67108864 string icon = "AppIcon!" boolean center = true event ue_node_ch ( ) event ue_product_ch ( ) event ue_mtrl_ch ( ) lv_1 lv_1 cb_picaddfile cb_picaddfile cb_picdel cb_picdel cb_addfj cb_addfj cb_cancel cb_cancel cb_ok cb_ok dw_1 dw_1 end type global w_aifmb_addpromotions w_aifmb_addpromotions type variables s_aifmb_promotions s_tran end variables event ue_node_ch();Long ll_nodeid String ls_nodename Open(w_aifmb_class_map_ch) ll_nodeid = Message.DoubleParm IF ll_nodeid > 0 THEN SELECT NodeName INTO :ls_nodename FROM aifmb_ClassNode Where NodeID = :ll_nodeid; IF sqlca.SQLCode <> 0 THEN MessageBox('ERROR', '查询基类名称失败,' + sqlca.SQLErrText) RETURN END IF dw_1.Object.NodeID[1] = ll_nodeid dw_1.Object.NodeName[1] = ls_nodename END IF end event event ue_product_ch();Open(w_aifmb_product) long ll_productid ll_productid = Message.DoubleParm IF ll_productid <= 0 THEN RETURN String ls_nodename String ls_mtrlcode String ls_mtrlname String ls_mtrlmode long ll_nodeid string ls_unit decimal ld_net_weight decimal ld_gross_weight decimal ld_cubage string ls_mtrlengname string ls_dscrp string ls_qualitydscrp SELECT aifmb_ProductCode.mtrlcode, aifmb_ProductCode.mtrlname, aifmb_ProductCode.mtrlmode, aifmb_ProductCode.NodeID, aifmb_ClassNode.NodeName, aifmb_ProductCode.unit, aifmb_ProductCode.net_weight, aifmb_ProductCode.gross_weight, aifmb_ProductCode.cubage, aifmb_ProductCode.mtrlengname, aifmb_ProductCode.dscrp, aifmb_ProductCode.qualitydscrp INTO :ls_mtrlcode, :ls_mtrlname, :ls_mtrlmode, :ll_nodeid, :ls_nodename, :ls_unit, :ld_net_weight, :ld_gross_weight, :ld_cubage, :ls_mtrlengname, :ls_dscrp, :ls_qualitydscrp FROM aifmb_ProductCode LEFT OUTER JOIN aifmb_ClassNode ON aifmb_ProductCode.NodeID = aifmb_ClassNode.NodeID Where (aifmb_ProductCode.ProductID = :ll_productid); IF sqlca.SQLCode <> 0 THEN MessageBox('ERROR', '查询标准物料信息失败ID=' + String(ll_productid) + ',' + sqlca.SQLErrText) RETURN END IF //dw_1.Object.mtrlid[1] = 0 dw_1.Object.nodeid[1] = ll_nodeid dw_1.Object.nodename[1] = ls_nodename dw_1.Object.ProductID[1] = ll_productid dw_1.Object.procode[1] = ls_mtrlcode dw_1.Object.proname[1] = ls_mtrlname dw_1.Object.productname[1] = ls_mtrlname dw_1.Object.promode[1] = ls_mtrlmode dw_1.Object.prounit[1] = ls_unit //dw_1.Object.net_weight[1] = ld_net_weight //dw_1.Object.gross_weight[1] = ld_gross_weight //dw_1.Object.cubage[1] = ld_cubage //dw_1.Object.mtrlengname[1] = ls_mtrlengname //dw_1.Object.dscrp[1] = ls_dscrp //dw_1.Object.qualitydscrp[1] = ls_qualitydscrp end event event ue_mtrl_ch(); s_edit_index_tran s_tranf8 //传递参数使用 s_tranf8.if_retrieve_all = False //是否一次RETRIEVE所有行 s_tranf8.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式 s_tranf8.arg_pkid = 0 //目标定位PKID (备用) s_tranf8.arg_string_code = '' //查询列(物料编码)部分内容,用于初步筛选 s_tranf8.if_select_all = False //多选 s_tranf8.b_long = -1 //选采购 s_tranf8.c_long = -1 s_tranf8.f_long = -1 s_tranf8.g_long = -1 //s_tranf8.arg_string_code = dw_1.Object.realmtrlcode[ll_row] OpenWithParm(W_mtrldef_edit,s_tranf8) //调用 s_mtrldef_array S_INSCUST IF ClassName(Message.PowerObjectParm) <> 's_mtrldef_array' THEN RETURN S_INSCUST = Message.PowerObjectParm //接受返回结构 IF UpperBound(S_INSCUST.mtrlid) <= 0 THEN RETURN IF S_INSCUST.mtrlid[1] <= 0 THEN RETURN //dw_1.Object.mtrlid[1] = S_INSCUST.mtrlid[1] dw_1.Object.ProductID[1] = 0 dw_1.Object.procode[1] = S_INSCUST.mtrlcode[1] dw_1.Object.proname[1] = S_INSCUST.mtrlname[1] dw_1.Object.promode[1] = S_INSCUST.mtrlmode[1] dw_1.Object.productname[1] = S_INSCUST.mtrlname[1] dw_1.Object.prounit[1] = S_INSCUST.unit[1] //dw_1.Object.net_weight[1] = S_INSCUST.net_weight[1] //dw_1.Object.gross_weight[1] = S_INSCUST.gross_weight[1] //dw_1.Object.cubage[1] = S_INSCUST.cubage[1] //dw_1.Object.mtrlengname[1] = S_INSCUST.mtrlengname[1] //dw_1.Object.dscrp[1] = S_INSCUST.dscrp[1] end event on w_aifmb_addpromotions.create this.lv_1=create lv_1 this.cb_picaddfile=create cb_picaddfile this.cb_picdel=create cb_picdel this.cb_addfj=create cb_addfj this.cb_cancel=create cb_cancel this.cb_ok=create cb_ok this.dw_1=create dw_1 this.Control[]={this.lv_1,& this.cb_picaddfile,& this.cb_picdel,& this.cb_addfj,& this.cb_cancel,& this.cb_ok,& this.dw_1} end on on w_aifmb_addpromotions.destroy destroy(this.lv_1) destroy(this.cb_picaddfile) destroy(this.cb_picdel) destroy(this.cb_addfj) destroy(this.cb_cancel) destroy(this.cb_ok) destroy(this.dw_1) end on event open;uo_aifmb = create uo_aifmb s_aifmb_promotions s_input s_input = Message.PowerObjectParm lv_1.uf_setsize(100, 100) dw_1.InsertRow(0) IF IsNull(s_input) Or Not IsValid(s_input) THEN s_tran.PromoID = 0 dw_1.Object.StartTime[1] = DateTime(Today(), time(0)) dw_1.Object.EndTime[1] = DateTime(RelativeDate(Today(),7), time(0)) dw_1.Object.PromoCode[1] = uo_aifmb.pf_getpromocode() dw_1.Object.CreaterName[1] = uo_aifmb.sf_username() dw_1.Object.CreaterPhone[1] = uo_aifmb.sf_phone() dw_1.Object.CreaterEmail[1] = uo_aifmb.sf_email() dw_1.Object.CreaterQQ[1] = uo_aifmb.sf_QQ() ELSE s_tran = s_input dw_1.Object.PromoID[1] = s_tran.PromoID dw_1.Object.EntID[1] = s_tran.EntID dw_1.Object.CreaterID[1] = s_tran.CreaterID dw_1.Object.CreatTime[1] = s_tran.CreatTime dw_1.Object.IsAudit[1] = s_tran.IsAudit dw_1.Object.AuditerID[1] = s_tran.AuditerID dw_1.Object.AuditTime[1] = s_tran.AuditTime dw_1.Object.StartTime[1] = s_tran.StartTime dw_1.Object.EndTime[1] = s_tran.EndTime dw_1.Object.PromoName[1] = s_tran.PromoName dw_1.Object.PromoTitle[1] = s_tran.PromoTitle dw_1.Object.PromoURL[1] = s_tran.PromoURL dw_1.Object.PromoRange[1] = s_tran.PromoRange dw_1.Object.PromoRemark[1] = s_tran.PromoRemark dw_1.Object.PromoCode[1] = s_tran.PromoCode dw_1.Object.NodeID[1] = s_tran.NodeID dw_1.Object.ProductID[1] = s_tran.ProductID dw_1.Object.ProCode[1] = s_tran.ProCode dw_1.Object.ProName[1] = s_tran.ProName dw_1.Object.ProMode[1] = s_tran.ProMode dw_1.Object.ProUnit[1] = s_tran.ProUnit IF s_tran.IsPublic THEN dw_1.Object.IsPublic[1] = 1 ELSE dw_1.Object.IsPublic[1] = 0 END IF dw_1.Object.PromoType[1] = s_tran.PromoType dw_1.Object.MPrice[1] = s_tran.MPrice dw_1.Object.NPrice[1] = s_tran.NPrice dw_1.Object.CreaterName[1] = s_tran.CreaterName dw_1.Object.CreaterPhone[1] = s_tran.CreaterPhone dw_1.Object.CreaterEmail[1] = s_tran.CreaterEmail dw_1.Object.CreaterQQ[1] = s_tran.CreaterQQ END IF destroy uo_aifmb end event event close;closewithreturn(this, s_tran) end event type lv_1 from uo_piclistview within w_aifmb_addpromotions integer x = 1893 integer width = 1399 integer height = 1284 integer taborder = 20 end type type cb_picaddfile from commandbutton within w_aifmb_addpromotions integer x = 3305 integer width = 274 integer height = 104 integer taborder = 20 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "添加文件" end type event clicked;String ls_path String arr_files[] IF GetFileOpenName('上传图片', ls_path, arr_files, 'bmp', '图片 (*.bmp;*.gif;*.jpg;*.jpeg;*.png),*.bmp;*.gif;*.jpg;*.jpeg;*.png') <> 1 THEN RETURN END IF IF UpperBound(arr_files) <= 0 THEN RETURN END IF IF UpperBound(arr_files) = 1 THEN ls_path = Mid(ls_path, 1, Len(ls_path) - Len(arr_files[1])) END IF IF Right(ls_path, 1) <> '\' THEN ls_path += '\' END IF Int rslt = 1 String arg_msg Long i s_piclistview_parm s_parm, s_empty FOR i = 1 To UpperBound(arr_files) s_parm = s_empty s_parm.Label = arr_files[i] s_parm.tmppath = ls_path + arr_files[i] IF lv_1.uf_additem(s_parm, arg_msg) <> 1 THEN rslt = 0 GOTO ext END IF NEXT ext: IF rslt = 0 THEN MessageBox('ERROR', arg_msg) END IF end event type cb_picdel from commandbutton within w_aifmb_addpromotions integer x = 3305 integer y = 232 integer width = 274 integer height = 104 integer taborder = 30 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "删除" end type event clicked;Long ll_selectedindex ll_selectedindex = lv_1.SelectedIndex() DO WHILE ll_selectedindex > 0 lv_1.DeleteItem(ll_selectedindex) ll_selectedindex = lv_1.SelectedIndex() LOOP end event type cb_addfj from commandbutton within w_aifmb_addpromotions integer x = 3305 integer y = 116 integer width = 274 integer height = 104 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_erpfj_ch) s_aifmb_erpfj_ch s_tran s_tran = Message.PowerObjectParm String arg_msg Long i FOR i = 1 To UpperBound(s_tran.pics) IF lv_1.uf_additem(s_tran.pics[i], arg_msg) <> 1 THEN END IF NEXT end event type cb_cancel from commandbutton within w_aifmb_addpromotions integer x = 3218 integer y = 1296 integer width = 210 integer height = 104 integer taborder = 30 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "取消" end type event clicked;s_tran.PromoID = 0 close(parent) end event type cb_ok from commandbutton within w_aifmb_addpromotions integer x = 2981 integer y = 1296 integer width = 210 integer height = 104 integer taborder = 20 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = " 确认" end type event clicked;Int rslt = 1 String arg_msg dw_1.AcceptText() s_piclistview_parm s_parm[] IF lv_1.uf_getitems(s_parm, arg_msg) <> 1 THEN MessageBox('ERROR', arg_msg) RETURN END IF uo_aifmb = Create uo_aifmb s_aifmb_promotions s_modle[] s_modle[1].PromoID = dw_1.Object.PromoID[1] s_modle[1].EntID = dw_1.Object.EntID[1] s_modle[1].CreaterID = dw_1.Object.CreaterID[1] s_modle[1].CreatTime = dw_1.Object.CreatTime[1] s_modle[1].IsAudit = dw_1.Object.IsAudit[1] s_modle[1].AuditerID = dw_1.Object.AuditerID[1] s_modle[1].AuditTime = dw_1.Object.AuditTime[1] s_modle[1].StartTime = dw_1.Object.StartTime[1] s_modle[1].EndTime = dw_1.Object.EndTime[1] s_modle[1].PromoName = dw_1.Object.PromoName[1] s_modle[1].PromoTitle = dw_1.Object.PromoTitle[1] s_modle[1].PromoURL = dw_1.Object.PromoURL[1] s_modle[1].PromoRange = dw_1.Object.PromoRange[1] s_modle[1].PromoRemark = dw_1.Object.PromoRemark[1] s_modle[1].PromoCode = dw_1.Object.PromoCode[1] s_modle[1].NodeID = dw_1.Object.NodeID[1] s_modle[1].ProductID = dw_1.Object.ProductID[1] s_modle[1].ProCode = dw_1.Object.ProCode[1] s_modle[1].ProName = dw_1.Object.ProName[1] s_modle[1].ProMode = dw_1.Object.ProMode[1] s_modle[1].ProUnit = dw_1.Object.ProUnit[1] s_modle[1].IsPublic = (dw_1.Object.IsPublic[1] = 1) s_modle[1].PromoType = dw_1.Object.PromoType[1] s_modle[1].MPrice = dw_1.Object.MPrice[1] s_modle[1].NPrice = dw_1.Object.NPrice[1] s_modle[1].CreaterName = dw_1.Object.CreaterName[1] s_modle[1].CreaterPhone = dw_1.Object.CreaterPhone[1] s_modle[1].CreaterEmail = dw_1.Object.CreaterEmail[1] s_modle[1].CreaterQQ = dw_1.Object.CreaterQQ[1] s_modle[1].pics = s_parm IF uo_aifmb.uf_setPromotions(s_modle, arg_msg) <> 1 THEN rslt = 0 GOTO ext END IF s_tran = s_modle[1] ext: Destroy uo_aifmb IF rslt = 0 THEN MessageBox('ERROR', arg_msg) ELSE Close(Parent) END IF end event type dw_1 from datawindow within w_aifmb_addpromotions integer width = 1883 integer height = 1284 integer taborder = 10 string title = "none" string dataobject = "dw_aifmb_addpromotions" boolean livescroll = true borderstyle borderstyle = stylelowered! end type event buttonclicked;string ls_colname ls_colname = dwo.Name ls_colname = lower(ls_colname) IF ls_colname = 'b_1' THEN parent.triggerevent('ue_node_ch') ELSEIF ls_colname = 'b_2' THEN parent.triggerevent('ue_product_ch') ELSEIF ls_colname = 'b_3' THEN parent.triggerevent('ue_mtrl_ch') END IF end event