$PBExportHeader$w_rp_multibarmx.srw forward global type w_rp_multibarmx from w_publ_base end type type dw_1 from datawindow within w_rp_multibarmx end type type cb_1 from uo_imflatbutton within w_rp_multibarmx end type type cb_2 from uo_imflatbutton within w_rp_multibarmx end type type dw_2 from datawindow within w_rp_multibarmx end type type cb_4 from uo_imflatbutton within w_rp_multibarmx end type type cb_sort from uo_imflatbutton within w_rp_multibarmx end type type sle_subid from singlelineedit within w_rp_multibarmx end type type cb_3 from uo_imflatbutton within w_rp_multibarmx end type type cb_6 from uo_imflatbutton within w_rp_multibarmx end type type cb_7 from uo_imflatbutton within w_rp_multibarmx end type type sle_barname from singlelineedit within w_rp_multibarmx end type type st_2 from statictext within w_rp_multibarmx end type type gb_1 from groupbox within w_rp_multibarmx end type type rb_1 from radiobutton within w_rp_multibarmx end type type rb_2 from radiobutton within w_rp_multibarmx end type type st_3 from statictext within w_rp_multibarmx end type type cb_8 from uo_imflatbutton within w_rp_multibarmx end type type cb_9 from uo_imflatbutton within w_rp_multibarmx end type type cb_5 from uo_imflatbutton within w_rp_multibarmx end type type st_1 from statictext within w_rp_multibarmx end type end forward global type w_rp_multibarmx from w_publ_base integer width = 1998 integer height = 1532 string title = "编缉多栏式明细分类帐" boolean minbox = false windowtype windowtype = response! long backcolor = 83162356 dw_1 dw_1 cb_1 cb_1 cb_2 cb_2 dw_2 dw_2 cb_4 cb_4 cb_sort cb_sort sle_subid sle_subid cb_3 cb_3 cb_6 cb_6 cb_7 cb_7 sle_barname sle_barname st_2 st_2 gb_1 gb_1 rb_1 rb_1 rb_2 rb_2 st_3 st_3 cb_8 cb_8 cb_9 cb_9 cb_5 cb_5 st_1 st_1 end type global w_rp_multibarmx w_rp_multibarmx type variables long multibarid string ins_sqlerrtext_1 ,ins_sqlerrtext_2 end variables forward prototypes public function integer wf_checkdata () end prototypes public function integer wf_checkdata ();string ls_csubid,ls_psubid long len_p,cnt ls_psubid=dw_1.object.subid[dw_1.getrow()] if ls_psubid='' then messagebox(publ_operator,'请输入多栏帐科目') return 0 end if ls_csubid=sle_subid.text if ls_csubid='' then messagebox(publ_operator,'请输入多栏帐明细项科目代码') return 0 end if select count(*) into:cnt from cw_subject where accsetid=:sys_accsetid and subid=:ls_csubid; if sqlca.sqlcode<>0 or cnt=0 then messagebox(publ_operator,'帐套内不存在科目>>'+ls_csubid) return 0 end if if sle_barname.text='' then messagebox(publ_operator,'请输入多栏帐明细项栏目名称') return 0 end if len_p=len(ls_psubid) if left(ls_csubid,len_p)<>ls_psubid then messagebox(publ_operator,'科目'+ls_csubid+'不是多栏帐科目'+ls_psubid+'的下级科目') return 0 end if return 1 end function on w_rp_multibarmx.create int iCurrent call super::create this.dw_1=create dw_1 this.cb_1=create cb_1 this.cb_2=create cb_2 this.dw_2=create dw_2 this.cb_4=create cb_4 this.cb_sort=create cb_sort this.sle_subid=create sle_subid this.cb_3=create cb_3 this.cb_6=create cb_6 this.cb_7=create cb_7 this.sle_barname=create sle_barname this.st_2=create st_2 this.gb_1=create gb_1 this.rb_1=create rb_1 this.rb_2=create rb_2 this.st_3=create st_3 this.cb_8=create cb_8 this.cb_9=create cb_9 this.cb_5=create cb_5 this.st_1=create st_1 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.dw_1 this.Control[iCurrent+2]=this.cb_1 this.Control[iCurrent+3]=this.cb_2 this.Control[iCurrent+4]=this.dw_2 this.Control[iCurrent+5]=this.cb_4 this.Control[iCurrent+6]=this.cb_sort this.Control[iCurrent+7]=this.sle_subid this.Control[iCurrent+8]=this.cb_3 this.Control[iCurrent+9]=this.cb_6 this.Control[iCurrent+10]=this.cb_7 this.Control[iCurrent+11]=this.sle_barname this.Control[iCurrent+12]=this.st_2 this.Control[iCurrent+13]=this.gb_1 this.Control[iCurrent+14]=this.rb_1 this.Control[iCurrent+15]=this.rb_2 this.Control[iCurrent+16]=this.st_3 this.Control[iCurrent+17]=this.cb_8 this.Control[iCurrent+18]=this.cb_9 this.Control[iCurrent+19]=this.cb_5 this.Control[iCurrent+20]=this.st_1 end on on w_rp_multibarmx.destroy call super::destroy destroy(this.dw_1) destroy(this.cb_1) destroy(this.cb_2) destroy(this.dw_2) destroy(this.cb_4) destroy(this.cb_sort) destroy(this.sle_subid) destroy(this.cb_3) destroy(this.cb_6) destroy(this.cb_7) destroy(this.sle_barname) destroy(this.st_2) destroy(this.gb_1) destroy(this.rb_1) destroy(this.rb_2) destroy(this.st_3) destroy(this.cb_8) destroy(this.cb_9) destroy(this.cb_5) destroy(this.st_1) end on event open;call super::open;dw_1.settransobject(sqlca) dw_2.settransobject(sqlca) multibarid=message.doubleparm //messagebox("",multibarid) if multibarid=0 then dw_1.insertrow(0) else dw_1.retrieve(sys_accsetid,multibarid) dw_2.retrieve(sys_accsetid,multibarid) end if end event type cb_func from w_publ_base`cb_func within w_rp_multibarmx boolean visible = false integer x = 1065 integer y = 280 boolean enabled = false end type type cb_exit from w_publ_base`cb_exit within w_rp_multibarmx integer x = 1536 integer y = 136 string text = "取消" end type type dw_1 from datawindow within w_rp_multibarmx integer x = 41 integer y = 24 integer width = 1445 integer height = 256 integer taborder = 20 boolean bringtotop = true string dataobject = "dw_multibar_edit" boolean border = false boolean livescroll = true end type event dberror;ins_sqlerrtext_1 = SQLErrText RETURN 1 end event type cb_1 from uo_imflatbutton within w_rp_multibarmx integer x = 1536 integer y = 24 integer width = 311 integer height = 96 integer taborder = 140 boolean bringtotop = true string normalpicname = "ok.bmp" end type event clicked;dw_1.AcceptText() dw_2.AcceptText() String arg_msg,ls_msg Long i IF dw_1.Object.subid[dw_1.GetRow()] = '' THEN MessageBox(publ_operator,'请输入多栏帐科目') RETURN 0 END IF IF dw_2.RowCount() <= 0 THEN MessageBox(publ_operator,'没有设置多栏帐栏目,不能保存') RETURN END IF multibarid = dw_1.Object.multibarid[dw_1.GetRow()] IF multibarid = 0 THEN multibarid = f_sys_scidentity(sys_accsetid,"cw_multibar","multibarid",arg_msg,TRUE,id_sqlca) ROLLBACK; IF multibarid <= 0 THEN MessageBox(publ_operator,arg_msg) RETURN END IF END IF dw_1.Object.multibarid[dw_1.GetRow()] = multibarid dw_1.Object.accsetid[dw_1.GetRow()] = sys_accsetid FOR i = 1 TO dw_2.RowCount() dw_2.Object.accsetid[i] = sys_accsetid dw_2.Object.multibarid[i] = multibarid dw_2.Object.itemno[i] = i NEXT dw_1.AcceptText() dw_2.AcceptText() String ls_errmsg IF dw_1.UPDATE() = -1 THEN IF Pos(ins_sqlerrtext_1,"Cannot insert duplicate key row") > 0 THEN ls_errmsg = "关键内容重复" ELSE ls_errmsg = "因为网络或其他原因>"+ins_sqlerrtext_1 END IF ROLLBACK; MessageBox (publ_operator,ls_errmsg+",保存操作失败!",Exclamation!,OK!) RETURN END IF ins_sqlerrtext_1 = "" DELETE FROM cw_multibarmx WHERE accsetid = :sys_accsetid AND multibarid = :multibarid; IF sqlca.SQLCode <> 0 THEN ls_msg = sqlca.SQLErrText ROLLBACK; MessageBox (publ_operator,"删除原多栏帐项目操作失败!"+ls_msg,Exclamation!,OK!) RETURN END IF IF dw_2.UPDATE() = -1 THEN IF Pos(ins_sqlerrtext_2,"Cannot insert duplicate key row") > 0 THEN ls_errmsg = "关键内容重复" ELSE ls_errmsg = "因为网络或其他原因>"+ins_sqlerrtext_2 END IF ROLLBACK; MessageBox (publ_operator,ls_errmsg+",保存操作失败!",Exclamation!,OK!) RETURN ELSE COMMIT; END IF ins_sqlerrtext_2 = "" IF IsValid(w_rp_multibar) THEN w_rp_multibar.wf_retrieve() END IF CLOSE(PARENT) end event type cb_2 from uo_imflatbutton within w_rp_multibarmx integer x = 901 integer y = 40 integer width = 155 integer height = 88 integer taborder = 150 boolean bringtotop = true string text = "选择" end type event clicked;s_subject s_rt_subject openwithparm(w_subjectdef_edit,1) s_rt_subject=message.powerobjectparm if s_rt_subject.subid='' then return long li_row li_row=dw_1.getrow() if li_row<=0 then messagebox('系统提示','没有多栏帐!') return end if dw_1.object.subid[li_row]=s_rt_subject.subid dw_1.object.multibarname[li_row]=s_rt_subject.name end event type dw_2 from datawindow within w_rp_multibarmx integer x = 69 integer y = 396 integer width = 1810 integer height = 728 integer taborder = 40 boolean bringtotop = true string dataobject = "dw_multibarmx" boolean hscrollbar = true boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type event rowfocuschanged;if currentrow<=0 then return this.selectrow(0,false) this.selectrow(currentrow,true) if this.rowcount() > 1 then sle_subid.text=dw_2.object.subid[dw_2.getrow()] sle_barname.text=dw_2.object.barname[dw_2.getrow()] if dw_2.object.dcflag[dw_2.getrow()]=1 then rb_1.checked=true else rb_2.checked=true end if end if end event event dberror;ins_sqlerrtext_2=sqlerrtext return 1 end event type cb_4 from uo_imflatbutton within w_rp_multibarmx integer x = 1737 integer y = 1260 integer width = 142 integer height = 96 integer taborder = 100 boolean bringtotop = true string text = "↓" end type event clicked;long li_row li_row=dw_2.getrow() if li_row<=0 or li_row=dw_2.rowcount() then return if dw_2.object.dcflag[li_row]<>dw_2.object.dcflag[li_row + 1] then return dw_2.object.itemno[li_row]=dw_2.object.itemno[li_row] + 1 dw_2.object.itemno[li_row + 1]=dw_2.object.itemno[li_row + 1] - 1 dw_2.SetRedraw(false) dw_2.SetSort(" itemno A") dw_2.sort() dw_2.SetRedraw(true) end event type cb_sort from uo_imflatbutton within w_rp_multibarmx integer x = 562 integer y = 1260 integer width = 274 integer height = 96 integer taborder = 80 boolean bringtotop = true string text = "自动编排" end type event clicked;dw_2.SetRedraw(false) dw_2.SetSort("dcflag D,subid A") dw_2.sort() dw_2.SetRedraw(true) end event type sle_subid from singlelineedit within w_rp_multibarmx integer x = 315 integer y = 1136 integer width = 389 integer height = 88 integer taborder = 30 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 boolean autohscroll = false borderstyle borderstyle = stylelowered! end type type cb_3 from uo_imflatbutton within w_rp_multibarmx integer x = 1591 integer y = 1260 integer width = 142 integer height = 96 integer taborder = 130 boolean bringtotop = true string text = "↑" end type event clicked;long li_row li_row=dw_2.getrow() if li_row<=0 or li_row=1 then return if dw_2.object.dcflag[li_row]<>dw_2.object.dcflag[li_row - 1] then return dw_2.object.itemno[li_row]=dw_2.object.itemno[li_row] - 1 dw_2.object.itemno[li_row - 1]=dw_2.object.itemno[li_row - 1] + 1 dw_2.SetRedraw(false) dw_2.SetSort(" itemno A") dw_2.sort() dw_2.SetRedraw(true) end event type cb_6 from uo_imflatbutton within w_rp_multibarmx integer x = 1088 integer y = 1260 integer width = 247 integer height = 96 integer taborder = 90 boolean bringtotop = true string text = "修改" string normalpicname = "open.bmp" end type event clicked;long li_row li_row=dw_2.getrow() if li_row<=0 then messagebox(publ_operator,'请选择要修改的多栏帐明细项') return end if if wf_checkdata()=0 then return end if int dcflag if rb_1.checked then dcflag=1 else dcflag=0 end if dw_2.object.dcflag[li_row]=dcflag dw_2.object.subid[li_row]=sle_subid.text dw_2.object.barname[li_row]=sle_barname.text dw_2.SetRedraw(false) dw_2.SetSort("dcflag D,itemno A") dw_2.sort() dw_2.SetRedraw(true) end event type cb_7 from uo_imflatbutton within w_rp_multibarmx integer x = 1335 integer y = 1260 integer width = 247 integer height = 96 integer taborder = 120 boolean bringtotop = true string text = "删除" string normalpicname = "delete.bmp" end type event clicked;long li_row li_row=dw_2.getrow() if li_row<=0 then return dw_2.deleterow(li_row) end event type sle_barname from singlelineedit within w_rp_multibarmx integer x = 1015 integer y = 1136 integer width = 526 integer height = 92 integer taborder = 60 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 boolean autohscroll = false borderstyle borderstyle = stylelowered! end type type st_2 from statictext within w_rp_multibarmx integer x = 91 integer y = 1152 integer width = 224 integer height = 56 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 boolean enabled = false string text = "科目代码" boolean focusrectangle = false end type type gb_1 from groupbox within w_rp_multibarmx integer x = 69 integer y = 1104 integer width = 1810 integer height = 132 integer taborder = 70 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 end type type rb_1 from radiobutton within w_rp_multibarmx integer x = 1554 integer y = 1152 integer width = 151 integer height = 56 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "借" boolean checked = true end type type rb_2 from radiobutton within w_rp_multibarmx integer x = 1714 integer y = 1152 integer width = 155 integer height = 56 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "贷" end type type st_3 from statictext within w_rp_multibarmx integer x = 786 integer y = 1152 integer width = 224 integer height = 56 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 boolean enabled = false string text = "栏目名称" alignment alignment = right! boolean focusrectangle = false end type type cb_8 from uo_imflatbutton within w_rp_multibarmx integer x = 704 integer y = 1140 integer width = 78 integer height = 84 integer taborder = 50 boolean bringtotop = true string text = ".." end type event clicked;s_subject s_rt_subject OpenWithParm(w_subjectdef_edit,0) s_rt_subject = Message.PowerObjectParm IF s_rt_subject.subid = '' THEN RETURN sle_subid.Text = s_rt_subject.subid sle_barname.Text = s_rt_subject.Name IF s_rt_subject.dcflag = 1 THEN rb_1.Checked = TRUE ELSE rb_2.Checked = TRUE END IF end event type cb_9 from uo_imflatbutton within w_rp_multibarmx integer x = 841 integer y = 1260 integer width = 247 integer height = 96 integer taborder = 110 boolean bringtotop = true string text = "增加" string normalpicname = "new.bmp" end type event clicked;IF wf_checkdata() = 0 THEN RETURN END IF Long li_row,find_row Int dcflag IF rb_1.Checked THEN dcflag = 1 ELSE dcflag = 0 END IF find_row = dw_2.Find("subid = '"+sle_subid.Text+"'", 1, dw_2.RowCount()) IF find_row > 0 THEN RETURN li_row = dw_2.InsertRow(0) dw_2.Object.dcflag[li_row] = dcflag dw_2.Object.subid[li_row] = sle_subid.Text dw_2.Object.barname[li_row] = sle_barname.Text IF li_row = 1 THEN dw_2.Object.itemno[li_row] = 1 ELSE dw_2.Object.itemno[li_row] = dw_2.Object.itemno[li_row - 1] + 1 END IF dw_2.SetRedraw(FALSE) dw_2.SetSort("dcflag D,itemno A") dw_2.Sort() dw_2.SetRedraw(TRUE) end event type cb_5 from uo_imflatbutton within w_rp_multibarmx integer x = 55 integer y = 1260 integer width = 494 integer height = 96 integer taborder = 60 boolean bringtotop = true string text = "自动列出明细科目" end type event clicked;Long ll_uc_row,ll_child_row String ls_subid,ls_subname,ls_subid_uc Int li_dcflag Long ll_length_child_subid Long ll_length_uc_subid Long ll_1,ll_2,ll_3,ll_4,ll_5,ll_6 ll_uc_row = dw_1.GetRow() IF ll_uc_row <= 0 THEN MessageBox('提示','请选择多栏帐科目') RETURN END IF IF dw_1.Object.subid[ll_uc_row] = '' THEN MessageBox('提示','没有多栏帐科目,请检查') RETURN END IF ls_subid_uc = dw_1.Object.subid[ll_uc_row] ll_1 = s_sys_accset.step1 ll_2 = s_sys_accset.step1+s_sys_accset.step2 ll_3 = s_sys_accset.step1+s_sys_accset.step2+s_sys_accset.step3 ll_4 = s_sys_accset.step1+s_sys_accset.step2+s_sys_accset.step3+s_sys_accset.step4 ll_5 = s_sys_accset.step1+s_sys_accset.step2+s_sys_accset.step3+s_sys_accset.step4+s_sys_accset.step5 ll_6 = s_sys_accset.step1+s_sys_accset.step2+s_sys_accset.step3+s_sys_accset.step4+s_sys_accset.step5+s_sys_accset.step6 ll_length_uc_subid = Len(ls_subid_uc) CHOOSE CASE ll_length_uc_subid CASE ll_1 ll_length_child_subid = ll_2 CASE ll_2 ll_length_child_subid = ll_3 CASE ll_3 ll_length_child_subid = ll_4 CASE ll_4 ll_length_child_subid = ll_5 CASE ll_5 ll_length_child_subid = ll_6 CASE ll_6 MessageBox('提示','第6级科目,没有明细科目') RETURN END CHOOSE dw_2.reset() DECLARE cur_subid CURSOR FOR SELECT cw_subject.subid, cw_subject.name, cw_subject.dcflag FROM cw_subject WHERE len(subid) = :ll_length_child_subid AND left(subid,:ll_length_uc_subid) = :ls_subid_uc AND accsetid = :sys_accsetid Order By subid; OPEN cur_subid; FETCH cur_subid INTO :ls_subid,:ls_subname,:li_dcflag; DO WHILE sqlca.SQLCode = 0 ll_child_row = dw_2.InsertRow(0) dw_2.Object.dcflag[ll_child_row] = li_dcflag dw_2.Object.subid[ll_child_row] = ls_subid dw_2.Object.barname[ll_child_row] = ls_subname dw_2.Object.itemno[ll_child_row] = ll_child_row FETCH cur_subid INTO :ls_subid,:ls_subname,:li_dcflag; LOOP CLOSE cur_subid; end event type st_1 from statictext within w_rp_multibarmx integer x = 69 integer y = 312 integer width = 402 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 = 67108864 string text = "多栏帐明细项" boolean focusrectangle = false end type