$PBExportHeader$w_itemdef_ch.srw forward global type w_itemdef_ch from w_publ_edit_index end type type cbx_1 from checkbox within w_itemdef_ch end type end forward global type w_itemdef_ch from w_publ_edit_index integer width = 2519 integer height = 1616 string title = "收支项目" cbx_1 cbx_1 end type global w_itemdef_ch w_itemdef_ch type variables s_itemdef INS_RT_STRU string oldcode,oldname,newcode,newname int inuse=1 end variables on w_itemdef_ch.create int iCurrent call super::create this.cbx_1=create cbx_1 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.cbx_1 end on on w_itemdef_ch.destroy call super::destroy destroy(this.cbx_1) end on event close;call super::close;CLOSEWITHRETURN(THIS,INS_RT_STRU) // 窗体级子定义结构变量,用于返回 end event event open;call super::open;INS_RT_STRU.itemid=0 end event event retrieve_uc;boolean cb_firstpage_enabled,cb_nextpage_enabled,cb_retrieveall_enabled boolean cb_priorpage_enabled,cb_func_enabled,cb_retrieve_enabled cb_firstpage_enabled=cb_firstpage.enabled cb_nextpage_enabled=cb_nextpage.enabled cb_retrieveall_enabled=cb_retrieveall.enabled cb_priorpage_enabled=cb_priorpage.enabled cb_func_enabled=cb_func.enabled cb_retrieve_enabled=cb_retrieve.enabled cb_firstpage.enabled=false cb_nextpage.enabled=false cb_retrieveall.enabled=false cb_priorpage.enabled=false cb_func.enabled=false cb_retrieve.enabled=false IF not cbx_1.checked THEN inuse = -1 ELSE inuse = 1 END IF dw_UC.setredraw(false) dw_index.ShareDataOff() SetPointer(HourGlass!) dw_UC.retrieve(inuse) SetPointer(Arrow!) dw_uc.sharedata(dw_index) dw_UC.setredraw(true) if dw_index.rowcount()>=1 then dw_index.selectrow(0,false) dw_index.selectrow(1,true) end if cb_firstpage.enabled=cb_firstpage_enabled cb_nextpage.enabled=cb_nextpage_enabled cb_retrieveall.enabled=cb_retrieveall_enabled cb_priorpage.enabled=cb_priorpage_enabled cb_func.enabled=cb_func_enabled cb_retrieve.enabled=cb_retrieve_enabled end event event ue_usual_query_filt;call super::ue_usual_query_filt;if dw_edit_mode or keydown(keyf4!) or keydown(keyf5!) then return string obj_expr='' if trim(sle_usual_query.text)<>'' then IF POS(trim(sle_usual_query.text),'%')=0 THEN obj_expr=obj_expr+'( itemcode LIKE "%'+trim(sle_usual_query.text)+'%" )' ELSE obj_expr=obj_expr+'( itemcode LIKE "'+trim(sle_usual_query.text)+'" )' END IF end if dw_UC.setfilter(obj_expr) dw_UC.SetRedraw(False) dw_INDEX.SetRedraw(False) dw_UC.filter() if dw_index.rowcount()>=1 then dw_index.selectrow(0,false) dw_index.selectrow(1,true) end if dw_UC.SetRedraw(TRUE) dw_INDEX.SetRedraw(TRUE) end event event ue_usual_query_retr;call super::ue_usual_query_retr;if dw_edit_mode or keydown(keyf4!) or keydown(keyf5!) then return string ls_querystrpart='' ls_newselect=lower(ori_oldselect) if trim(sle_usual_query.text)<>'' then if pos(trim(sle_usual_query.text),'%')=0 then ls_querystrpart="(itemcode like '%"+trim(sle_usual_query.text)+"%')" else ls_querystrpart="(itemcode like '"+trim(sle_usual_query.text)+"')" end if if Pos(ls_newselect," where ") <> 0 then ls_newselect=ls_newselect+" AND ("+ls_querystrpart+')' else ls_newselect=ls_newselect+" where ("+ls_querystrpart+')' end if end if wf_retrieveuc(dw_uc,ls_newselect,1) this.triggerevent('retrieve_uc') //注意必须有此句 end event type cb_func from w_publ_edit_index`cb_func within w_itemdef_ch end type type cb_exit from w_publ_edit_index`cb_exit within w_itemdef_ch integer x = 1179 end type type sle_usual_query from w_publ_edit_index`sle_usual_query within w_itemdef_ch end type type cb_nextpage from w_publ_edit_index`cb_nextpage within w_itemdef_ch integer x = 928 integer y = 1600 end type type cb_priorpage from w_publ_edit_index`cb_priorpage within w_itemdef_ch integer x = 782 integer y = 1600 end type type cb_firstpage from w_publ_edit_index`cb_firstpage within w_itemdef_ch integer x = 635 integer y = 1600 end type type cb_retrieveall from w_publ_edit_index`cb_retrieveall within w_itemdef_ch integer x = 489 integer y = 1600 end type type em_pagerowno from w_publ_edit_index`em_pagerowno within w_itemdef_ch integer x = 192 integer y = 1600 end type type st_pagerowno from w_publ_edit_index`st_pagerowno within w_itemdef_ch integer x = 18 integer y = 1620 end type type st_1 from w_publ_edit_index`st_1 within w_itemdef_ch string text = "编号含" end type type cb_add from w_publ_edit_index`cb_add within w_itemdef_ch end type event cb_add::clicked;IF NOT f_power_ind(139) THEN MessageBox('提示','你没有使用权限!',information!,ok!) RETURN END IF Long ll_sptid = 0 String errmsg = '' Long ll_cnt Long ll_itemid,ll_dfttype String ls_dfttypename IF dw_edit_mode THEN dw_uc.AcceptText() IF dw_uc.GetNextModified(0, Primary!) = 0 THEN MessageBox('提示','没有任何修改,不可以保存!',information!,ok!) RETURN END IF dw_uc.Object.itemcode[dw_uc.GetRow()] = Trim(dw_uc.Object.itemcode[dw_uc.GetRow()]) dw_uc.Object.itemname[dw_uc.GetRow()] = Trim(dw_uc.Object.itemname[dw_uc.GetRow()]) dw_uc.Object.dscrp[dw_uc.GetRow()] = Trim(dw_uc.Object.dscrp[dw_uc.GetRow()]) IF dw_uc.Object.itemcode[dw_uc.GetRow()] = '' THEN MessageBox('提示','请输入项目编号!',information!,ok!) dw_uc.SetFocus() dw_uc.SetColumn("itemcode") RETURN END IF IF dw_uc.Object.itemname[dw_uc.GetRow()] = '' THEN MessageBox('提示','请输入项目名称!',information!,ok!) dw_uc.SetFocus() dw_uc.SetColumn("itemname") RETURN END IF //检查默认项目是否已存在 ll_itemid = dw_uc.Object.itemid[dw_uc.GetRow()] ll_dfttype = dw_uc.Object.dfttype[dw_uc.GetRow()] IF ll_dfttype <> 0 THEN ll_cnt = 0 SELECT count(*) INTO :ll_cnt FROM u_itemdef WHERE dfttype = :ll_dfttype AND itemid <> :ll_itemid; IF sqlca.SQLCode <> 0 THEN MessageBox('错误','查询默认项目是否已存在失败',stopsign!,ok!) RETURN END IF IF ll_cnt > 0 THEN CHOOSE CASE ll_dfttype CASE 1 ls_dfttypename = '默认销售收款' CASE 2 ls_dfttypename = '默认采购外协付款' CASE 3 ls_dfttypename = '默认销售优惠' CASE 4 ls_dfttypename = '默认销售退货' CASE 5 ls_dfttypename = '默认采购外协退货' END CHOOSE MessageBox('提示','已存在'+ls_dfttypename+'的项目,不能重复建立!',information!,ok!) dw_uc.SetFocus() dw_uc.SetColumn("dfttype") RETURN END IF CHOOSE CASE ll_dfttype CASE 1 IF dw_uc.Object.itemflag[dw_uc.GetRow()] = -1 THEN MessageBox('提示','默认销售收款项目方向只能设为收入!',information!,ok!) RETURN END IF CASE 2 IF dw_uc.Object.itemflag[dw_uc.GetRow()] = 1 THEN MessageBox('提示','默认采购外协付款方向只能设为支出!',information!,ok!) RETURN END IF CASE 3 IF dw_uc.Object.itemflag[dw_uc.GetRow()] = -1 THEN MessageBox('提示','默认销售优惠项目方向只能设为收入!',information!,ok!) RETURN END IF CASE 4 IF dw_uc.Object.itemflag[dw_uc.GetRow()] = 1 THEN MessageBox('提示','默认销售退货项目方向只能设为支出!',information!,ok!) RETURN END IF CASE 5 IF dw_uc.Object.itemflag[dw_uc.GetRow()] = -1 THEN MessageBox('提示','默认采购外协退货项目方向只能设为收入!',information!,ok!) RETURN END IF END CHOOSE END IF ////////////////////////////////////////////////// IF dw_uc.Object.itemid[dw_uc.GetRow()] = 0 THEN ll_sptid = f_sys_scidentity(0,"u_itemdef","itemid",errmsg,FALSE,sqlca) IF ll_sptid <= 0 THEN MessageBox("错误",errmsg,stopsign!,ok!) RETURN ELSE dw_uc.Object.itemid[dw_uc.GetRow()] = ll_sptid END IF ELSE newcode = dw_uc.Object.itemcode[dw_uc.GetRow()] newname = dw_uc.Object.itemname[dw_uc.GetRow()] String arg_msg f_setsysoplog('定义资料','项目修改,原:'+oldcode+','+oldname+'->新:'+newcode+','+newname,arg_msg,FALSE) END IF ///////////////////////////// END IF CALL SUPER::Clicked IF dw_edit_mode THEN dw_uc.SetColumn('itemcode') END IF end event type cb_edit from w_publ_edit_index`cb_edit within w_itemdef_ch end type event cb_edit::clicked;if not f_power_ind(139) then messagebox('提示','你没有使用权限!',information!,ok!) return end if CALL SUPER::CLICKED if dw_edit_mode then oldcode=DW_UC.OBJECT.itemcode[DW_UC.GETROW()] oldname=DW_UC.OBJECT.itemname[DW_UC.GETROW()] else oldcode='' oldname='' end if end event type cb_delet from w_publ_edit_index`cb_delet within w_itemdef_ch end type event cb_delet::clicked;IF NOT f_power_ind(139) THEN MessageBox('提示','你没有使用权限!',information!,ok!) RETURN END IF Long LS_id Long LS_LONG = 0,cnt=0 String ls_code,arg_msg IF DW_UC.GetRow() <= 0 THEN MessageBox('提示','没有操作目标记录!',information!,ok!) RETURN END IF LS_id = DW_UC.Object.itemid[DW_UC.GetRow()] ls_code = DW_UC.Object.itemcode[DW_UC.GetRow()] select count(*) into :cnt from u_iteminput where itemid=:ls_id; if sqlca.sqlcode<>0 then messagebox('错误','查询历史数据失败!>>'+sqlca.sqlerrtext,stopsign!,ok!) return end if if cnt>0 then Messagebox('提示','该项目已在其它支出中使用!不能删除!',information!,ok!) return end if cnt=0 select count(*) into :cnt from u_Bmstpay where itemid=:ls_id; if sqlca.sqlcode<>0 then messagebox('错误','查询历史数据失败!>>'+sqlca.sqlerrtext,stopsign!,ok!) return end if if cnt>0 then Messagebox('提示','该项目已在应付帐中使用!不能删除!',information!,ok!) return end if cnt=0 select count(*) into :cnt from u_Bmstpaymx where itemid=:ls_id; if sqlca.sqlcode<>0 then messagebox('错误','查询历史数据失败!>>'+sqlca.sqlerrtext,stopsign!,ok!) return end if if cnt>0 then Messagebox('提示','该项目已在应付帐中使用!不能删除!',information!,ok!) return end if cnt=0 select count(*) into :cnt from u_Bmsttake where itemid=:ls_id; if sqlca.sqlcode<>0 then messagebox('错误','查询历史数据失败!>>'+sqlca.sqlerrtext,stopsign!,ok!) return end if if cnt>0 then Messagebox('提示','该项目已在应收帐中使用!不能删除!',information!,ok!) return end if cnt=0 select count(*) into :cnt from u_Bmsttakemx where itemid=:ls_id; if sqlca.sqlcode<>0 then messagebox('错误','查询历史数据失败!>>'+sqlca.sqlerrtext,stopsign!,ok!) return end if if cnt>0 then Messagebox('提示','该项目已在应收帐中使用!不能删除!') return end if IF MessageBox ("询问","是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN RETURN END IF DW_UC.SetRedraw (FALSE) DW_UC.DeleteRow (0) DW_UC.TriggerEvent (RowFocusChanged!) IF DW_UC.UPDATE() = -1 THEN ROLLBACK; MessageBox ("错误","删除记录操作失败!",stopsign!,OK!) ELSE COMMIT; f_setsysoplog('定义资料','支出项目定义资料删除,ID:'+String(LS_id)+',code:'+ls_code,arg_msg,TRUE) END IF DW_UC.SetRedraw (TRUE) WF_INDEX_UC() end event type cb_choice from w_publ_edit_index`cb_choice within w_itemdef_ch integer x = 1029 end type event cb_choice::clicked;call super::clicked;LONG LS_ROW LS_ROW=dw_uc.getrow() if LS_ROW<=0 then messagebox('提示','请先选择目标行!',information!,ok!) return end if INS_RT_STRU.itemid=dw_INDEX.OBJECT.itemid[LS_ROW] INS_RT_STRU.itemcode=dw_INDEX.OBJECT.itemcode[LS_ROW] INS_RT_STRU.itemname=dw_INDEX.OBJECT.itemname[LS_ROW] INS_RT_STRU.itemtype=dw_INDEX.OBJECT.itemtype[LS_ROW] INS_RT_STRU.itemflag=dw_INDEX.OBJECT.itemflag[LS_ROW] INS_RT_STRU.itemsectype=dw_INDEX.OBJECT.itemsectYpe[LS_ROW] CLOSE(PARENT) end event type cb_cancel from w_publ_edit_index`cb_cancel within w_itemdef_ch end type type cbx_mlselect from w_publ_edit_index`cbx_mlselect within w_itemdef_ch integer x = 1669 integer y = 212 end type type cbx_allselect from w_publ_edit_index`cbx_allselect within w_itemdef_ch integer x = 1906 integer y = 216 integer width = 206 end type type cb_mode_itfchg_b from w_publ_edit_index`cb_mode_itfchg_b within w_itemdef_ch end type type cb_mode_itfchg from w_publ_edit_index`cb_mode_itfchg within w_itemdef_ch integer x = 1330 end type type gb_1 from w_publ_edit_index`gb_1 within w_itemdef_ch integer x = 37 integer y = 1596 end type type dw_uc from w_publ_edit_index`dw_uc within w_itemdef_ch integer x = 1202 integer width = 1262 integer height = 1208 string dataobject = "dw_itemdef_edit" end type type cb_retrieve from w_publ_edit_index`cb_retrieve within w_itemdef_ch end type type cb_print from w_publ_edit_index`cb_print within w_itemdef_ch end type event cb_print::clicked;call super::clicked;S_print_MSG LS_PRMSG LS_PRMSG.obj_dwNAME='dw_rp_item_index' LS_PRMSG.SHARE_DW=DW_UC LS_PRMSG.TAG_TEXT='项目资料表' LS_PRMSG.SETUP_FLAG=0 LS_PRMSG.PAGECH_FLAG=1 Openwithparm(w_publ_preview,LS_PRMSG) end event type ln_bar from w_publ_edit_index`ln_bar within w_itemdef_ch end type type ln_bar2 from w_publ_edit_index`ln_bar2 within w_itemdef_ch end type type r_bar from w_publ_edit_index`r_bar within w_itemdef_ch end type type ln_1 from w_publ_edit_index`ln_1 within w_itemdef_ch end type type ln_2 from w_publ_edit_index`ln_2 within w_itemdef_ch end type type dw_index from w_publ_edit_index`dw_index within w_itemdef_ch integer width = 1202 integer height = 1208 string dataobject = "dw_itemdef_index" end type type cb_help from w_publ_edit_index`cb_help within w_itemdef_ch end type type cbx_1 from checkbox within w_itemdef_ch integer x = 919 integer y = 212 integer width = 402 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 ll_ifuse if this.checked then ll_ifuse = 1 else ll_ifuse = -1 end if f_SetProfileString (sys_empid,dw_uc.DATAOBJECT, "if_user",string(ll_ifuse) ) parent.triggerevent('retrieve_uc') end event event constructor;Int ll_ifuse ll_ifuse = Long(f_ProfileString (sys_empid,dw_uc.DataObject, "if_user",'-1')) IF ll_ifuse = 1 THEN THIS.Checked = TRUE ELSE THIS.Checked = FALSE END IF end event