$PBExportHeader$w_flow_cred.srw forward global type w_flow_cred from w_publ_base end type type cb_save from commandbutton within w_flow_cred end type type cb_refresh from commandbutton within w_flow_cred end type type dw_2 from datawindow within w_flow_cred end type type cb_mod from commandbutton within w_flow_cred end type type cb_ch from commandbutton within w_flow_cred end type type cb_del from commandbutton within w_flow_cred end type type dw_1 from u_dw_rbtnfilter within w_flow_cred end type type cb_ch_brief from commandbutton within w_flow_cred end type type dw_3 from datawindow within w_flow_cred end type type cb_write_amt from commandbutton within w_flow_cred end type type st_amt from statictext within w_flow_cred end type end forward global type w_flow_cred from w_publ_base int Width=3269 int Height=2300 WindowType WindowType=response! boolean TitleBar=true string Title="现金流量金额分配" long BackColor=83686901 boolean MinBox=false cb_save cb_save cb_refresh cb_refresh dw_2 dw_2 cb_mod cb_mod cb_ch cb_ch cb_del cb_del dw_1 dw_1 cb_ch_brief cb_ch_brief dw_3 dw_3 cb_write_amt cb_write_amt st_amt st_amt end type global w_flow_cred w_flow_cred type variables s_flow_cred s_flowcred end variables forward prototypes public function integer wf_face () end prototypes public function integer wf_face ();cb_ch.enabled = dw_edit_mode cb_ch_brief.enabled = dw_edit_mode cb_write_amt.enabled = dw_edit_mode cb_save.enabled = dw_edit_mode cb_del.enabled = dw_edit_mode cb_refresh.enabled = not dw_edit_mode if dw_edit_mode then cb_mod.text = '放弃' dw_2.settaborder('cw_cashitem_brief',10) dw_2.settaborder('cw_cashitem_debit',20) dw_2.settaborder('cw_cashitem_credit',30) else cb_mod.text = '修改' dw_2.settaborder('cw_cashitem_brief',0) dw_2.settaborder('cw_cashitem_debit',0) dw_2.settaborder('cw_cashitem_credit',0) end if return 1 end function on w_flow_cred.create int iCurrent call super::create this.cb_save=create cb_save this.cb_refresh=create cb_refresh this.dw_2=create dw_2 this.cb_mod=create cb_mod this.cb_ch=create cb_ch this.cb_del=create cb_del this.dw_1=create dw_1 this.cb_ch_brief=create cb_ch_brief this.dw_3=create dw_3 this.cb_write_amt=create cb_write_amt this.st_amt=create st_amt iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.cb_save this.Control[iCurrent+2]=this.cb_refresh this.Control[iCurrent+3]=this.dw_2 this.Control[iCurrent+4]=this.cb_mod this.Control[iCurrent+5]=this.cb_ch this.Control[iCurrent+6]=this.cb_del this.Control[iCurrent+7]=this.dw_1 this.Control[iCurrent+8]=this.cb_ch_brief this.Control[iCurrent+9]=this.dw_3 this.Control[iCurrent+10]=this.cb_write_amt this.Control[iCurrent+11]=this.st_amt end on on w_flow_cred.destroy call super::destroy destroy(this.cb_save) destroy(this.cb_refresh) destroy(this.dw_2) destroy(this.cb_mod) destroy(this.cb_ch) destroy(this.cb_del) destroy(this.dw_1) destroy(this.cb_ch_brief) destroy(this.dw_3) destroy(this.cb_write_amt) destroy(this.st_amt) end on event open;call super::open;wf_face() s_flowcred = Message.PowerObjectParm st_amt.text = '金额:'+string(abs(s_flowcred.debit - s_flowcred.credit),'#,#0.00') dw_1.SetTransObject(sqlca) dw_2.SetTransObject(sqlca) cb_refresh.TriggerEvent(Clicked!) long ll_i,ll_row for ll_i = 1 to upperbound(s_flowcred.brief) ll_row = dw_3.insertrow(0) dw_3.object.brief[ll_row] = s_flowcred.brief[ll_i] next end event type cb_exit from w_publ_base`cb_exit within w_flow_cred int X=2944 int Y=1376 int Width=224 end type type cb_save from commandbutton within w_flow_cred int X=2693 int Y=1376 int Width=247 int Height=96 int TabOrder=20 boolean BringToTop=true string Text="保存" int TextSize=-9 int Weight=400 string FaceName="宋体" FontCharSet FontCharSet=GB2312CharSet! FontPitch FontPitch=Variable! end type event clicked;IF dw_2.RowCount() <= 0 THEN RETURN Long i Decimal sum_debit,sum_credit String c_msg dw_2.AcceptText() sum_debit = dw_2.Object.sum_debit[1] sum_credit = dw_2.Object.sum_credit[1] IF String(s_flowcred.debit - s_flowcred.credit,'#,##0.00') <> String(sum_debit - sum_credit,'#,##0.00') THEN c_msg = '凭证中现金流量类科目借方、贷方差额为:'+String(s_flowcred.debit - s_flowcred.credit,'#,##0.00') + '~n' c_msg = c_msg + '而现金流量金额分配中流入、流出差额为:'+String(sum_debit - sum_credit,'#,##0.00') + '~n' c_msg = c_msg + '两者不相等,是否继续保存?' IF MessageBox ( '系统提示', c_msg , Question! , YesNo! ) = 2 THEN RETURN END IF Long ls_flowid,ll_printid string ls_brief Decimal ls_debit,ls_credit DELETE FROM cw_cashitem WHERE accsetid = :s_flowcred.accsetid AND credid = :s_flowcred.credid; IF sqlca.SQLCode <> 0 THEN MessageBox('系统提示','删除凭证原现金流量失败>>'+sqlca.SQLErrText) ROLLBACK; RETURN END IF FOR i = 1 TO dw_2.RowCount() ls_flowid = dw_2.Object.cw_flow_flowid[i] ls_debit = dw_2.Object.cw_cashitem_debit[i] ls_credit = dw_2.Object.cw_cashitem_credit[i] ll_printid = dw_2.Object.pid[i] ls_brief = dw_2.Object.cw_cashitem_brief[i] IF IsNull(ls_debit) THEN ls_debit = 0 IF IsNull(ls_credit) THEN ls_credit = 0 IF ls_debit <> 0 OR ls_credit <> 0 THEN INSERT INTO cw_cashitem(accsetid,credid,flowid,debit,credit,brief,printid) Values(:s_flowcred.accsetid,:s_flowcred.credid,:ls_flowid,:ls_debit,:ls_credit,:ls_brief,:ll_printid); IF sqlca.SQLCode <> 0 THEN MessageBox('系统提示','增加凭证现金流量失败>>'+sqlca.SQLErrText) ROLLBACK; RETURN END IF END IF NEXT COMMIT; MessageBox('系统提示','凭证现金流量保存成功') dw_edit_mode = FALSE wf_face() end event type cb_refresh from commandbutton within w_flow_cred int Y=1376 int Width=270 int Height=96 int TabOrder=60 boolean BringToTop=true string Text="刷新" int TextSize=-9 int Weight=400 string FaceName="宋体" FontCharSet FontCharSet=GB2312CharSet! FontPitch FontPitch=Variable! end type event clicked;dw_1.retrieve(s_flowcred.accsetid) dw_2.retrieve(s_flowcred.accsetid,s_flowcred.credid) end event type dw_2 from datawindow within w_flow_cred int Y=1488 int Width=3173 int Height=644 int TabOrder=100 boolean BringToTop=true string DataObject="dw_flow_cred_ch" BorderStyle BorderStyle=StyleLowered! boolean HScrollBar=true boolean VScrollBar=true boolean LiveScroll=true end type event rowfocuschanged;IF currentrow <= 0 THEN RETURN THIS.SelectRow(0,FALSE) THIS.SelectRow(currentrow,TRUE) end event event doubleclicked;cb_del.triggerevent(clicked!) end event type cb_mod from commandbutton within w_flow_cred int X=891 int Y=1376 int Width=247 int Height=96 int TabOrder=70 boolean BringToTop=true string Text="修改" int TextSize=-9 int Weight=400 string FaceName="宋体" FontCharSet FontCharSet=GB2312CharSet! FontPitch FontPitch=Variable! end type event clicked;dw_edit_mode = not dw_edit_mode wf_face() end event type cb_ch from commandbutton within w_flow_cred int X=270 int Y=1376 int Width=311 int Height=96 int TabOrder=80 boolean BringToTop=true string Text="↓ 选择" int TextSize=-9 int Weight=400 string FaceName="宋体" FontCharSet FontCharSet=GB2312CharSet! FontPitch FontPitch=Variable! end type event clicked;if not dw_edit_mode then return Long ll_row,ll_row_i int li_detailfalg dw_1.AcceptText() ll_row = dw_1.GetRow() IF ll_row <= 0 THEN MessageBox('提示','请选择现金流量项目') RETURN END IF li_detailfalg = dw_1.object.detailfalg[ll_row] IF li_detailfalg = 0 THEN MessageBox('提示','一级项目,不能选择') RETURN END IF ll_row_i = dw_2.insertrow(0) dw_2.object.cw_flow_cashcode[ll_row_i] = dw_1.object.cw_flow_cashcode[ll_row] dw_2.object.cw_flow_flowname[ll_row_i] = dw_1.object.cw_flow_flowname[ll_row] dw_2.object.cw_flow_flowid[ll_row_i] = dw_1.object.cw_flow_flowid[ll_row] dw_2.object.cw_flow_dcflag[ll_row_i] = dw_1.object.cw_flow_dcflag[ll_row] dw_2.selectrow(0,false) dw_2.scrolltorow(ll_row_i) dw_2.selectrow(ll_row_i,true) dw_2.setfocus() dw_2.setcolumn('cw_cashitem_brief') end event type cb_del from commandbutton within w_flow_cred int X=581 int Y=1376 int Width=311 int Height=96 int TabOrder=90 boolean BringToTop=true string Text="↑ 删除" int TextSize=-9 int Weight=400 string FaceName="宋体" FontCharSet FontCharSet=GB2312CharSet! FontPitch FontPitch=Variable! end type event clicked;if not dw_edit_mode then return Long ll_row dw_2.AcceptText() ll_row = dw_2.GetRow() IF ll_row <= 0 THEN MessageBox('提示','请选择要删除的现金流量项目') RETURN END IF IF MessageBox ("IF","是否确定要删除现金流量项目吗?",Question!,YesNo! ) = 2 THEN RETURN dw_2.deleterow(ll_row) end event type dw_1 from u_dw_rbtnfilter within w_flow_cred int X=0 int Y=0 int Width=2194 int Height=1360 int TabOrder=30 boolean BringToTop=true string DataObject="dw_flow_cred" boolean HScrollBar=true boolean VScrollBar=true end type event rowfocuschanged;IF currentrow <= 0 THEN RETURN THIS.SelectRow(0,FALSE) THIS.SelectRow(currentrow,TRUE) end event event doubleclicked;cb_ch.triggerevent(clicked!) end event event constructor;call super::constructor; titleclick_sort_use=true //单击标题排序功能开关 RBUTTON_FILTER_USE=true //右键查询功能开关 end event type cb_ch_brief from commandbutton within w_flow_cred int X=2194 int Y=1376 int Width=357 int Height=96 int TabOrder=40 boolean BringToTop=true string Text="↓ 选择摘要" int TextSize=-9 int Weight=400 string FaceName="宋体" FontCharSet FontCharSet=GB2312CharSet! FontPitch FontPitch=Variable! end type event clicked;if not dw_edit_mode then return Long ll_row,ll_row_i dw_3.AcceptText() dw_2.AcceptText() ll_row = dw_3.GetRow() ll_row_i = dw_2.GetRow() IF ll_row <= 0 THEN MessageBox('提示','请选择摘要') RETURN END IF IF ll_row_i <= 0 THEN MessageBox('提示','请选择添加摘要的行') RETURN END IF dw_2.object.cw_cashitem_brief[ll_row_i] = dw_3.object.brief[ll_row] dw_2.selectrow(0,false) dw_2.scrolltorow(ll_row_i) dw_2.selectrow(ll_row_i,true) dw_2.setfocus() dw_2.setcolumn('cw_cashitem_brief') end event type dw_3 from datawindow within w_flow_cred int X=2194 int Width=978 int Height=1360 int TabOrder=50 boolean BringToTop=true string DataObject="dw_flow_cred_brief" BorderStyle BorderStyle=StyleLowered! boolean HScrollBar=true boolean VScrollBar=true boolean LiveScroll=true end type event doubleclicked;cb_ch_brief.triggerevent(clicked!) end event event rowfocuschanged;IF currentrow <= 0 THEN RETURN THIS.SelectRow(0,FALSE) THIS.SelectRow(currentrow,TRUE) end event type cb_write_amt from commandbutton within w_flow_cred int X=1838 int Y=1376 int Width=357 int Height=96 int TabOrder=30 boolean BringToTop=true string Text="自动填金额" int TextSize=-9 int Weight=400 string FaceName="宋体" FontCharSet FontCharSet=GB2312CharSet! FontPitch FontPitch=Variable! end type event clicked;IF NOT dw_edit_mode THEN RETURN Long ll_row_i dw_2.AcceptText() ll_row_i = dw_2.GetRow() IF ll_row_i <= 0 THEN MessageBox('提示','请选择添加摘要的行') RETURN END IF dw_2.SelectRow(0,FALSE) dw_2.ScrollToRow(ll_row_i) dw_2.SelectRow(ll_row_i,TRUE) dw_2.SetFocus() Decimal ld_amt ld_amt = s_flowcred.debit - s_flowcred.credit IF ld_amt > 0 THEN dw_2.Object.cw_cashitem_debit[ll_row_i] = Abs(ld_amt) dw_2.SetColumn('cw_cashitem_debit') ELSE dw_2.Object.cw_cashitem_credit[ll_row_i] = Abs(ld_amt) dw_2.SetColumn('cw_cashitem_credit') END IF end event type st_amt from statictext within w_flow_cred int X=1161 int Y=1400 int Width=585 int Height=52 boolean Enabled=false boolean BringToTop=true string Text="none" boolean FocusRectangle=false long TextColor=16711680 long BackColor=67108864 int TextSize=-9 int Weight=700 string FaceName="宋体" FontCharSet FontCharSet=GB2312CharSet! FontPitch FontPitch=Variable! end type