$PBExportHeader$w_money_aging.srw forward global type w_money_aging from window end type type cb_4 from commandbutton within w_money_aging end type type cb_3 from commandbutton within w_money_aging end type type cb_2 from commandbutton within w_money_aging end type type cb_1 from commandbutton within w_money_aging end type type dw_1 from datawindow within w_money_aging end type type s_email_cloudmx from structure within w_money_aging end type end forward type s_email_cloudmx from structure string name integer days end type global type w_money_aging from window integer width = 1504 integer height = 872 boolean titlebar = true string title = "账龄分组设置" boolean controlmenu = true windowtype windowtype = response! long backcolor = 67108864 string icon = "AppIcon!" boolean center = true cb_4 cb_4 cb_3 cb_3 cb_2 cb_2 cb_1 cb_1 dw_1 dw_1 end type global w_money_aging w_money_aging type variables boolean dw_edit_mode Long it_MXBT = 0 private: s_email_cloudmx ss_email_cloudmx[] s_email_cloudmx sss_email_cloudmx end variables forward prototypes public subroutine wf_lock_child () public subroutine wf_face () public function integer save (ref string arg_msg) public function integer acceptmx (string arg_name, integer arg_days, ref string arg_msg) public subroutine wf_setname () end prototypes public subroutine wf_lock_child ();integer LS_INT IF dw_edit_mode THEN FOR LS_INT=3 TO 4 dw_1.SetTabOrder (LS_INT,LS_INT*10 ) dw_1.SetTabOrder (LS_INT,LS_INT*10 ) NEXT ELSE FOR LS_INT=3 TO 50 dw_1.SetTabOrder (LS_INT, 0) dw_1.SetTabOrder (LS_INT, 0) NEXT END IF end subroutine public subroutine wf_face ();IF dw_edit_mode THEN cb_2.Text = "保存" cb_1.Enabled = True cb_3.Enabled = True cb_4.Enabled = True ELSE cb_2.Text = "修改" cb_1.Enabled = False cb_3.Enabled = False cb_4.Enabled = false END IF dw_1.retrieve() end subroutine public function integer save (ref string arg_msg);Integer rslt = 1,cnt = 0,i,j,k DateTime server_dt Long ll_billid String ls_sccode DELETE From u_money_aging; IF sqlca.SQLCode <> 0 THEN rslt = 0 arG_MSG = "删除旧有明细操作失败"+"~n"+sqlca.SQLErrText ROLLBACK Using sqlca; GOTO ext END IF FOR i = 1 To it_mxbt ll_billid = f_sys_scidentity(0,"u_money_aging","id",arG_MSG,True,id_sqlca) //数据commit事务) IF ll_billid <= 0 THEN rslt = 0 GOTO ext END IF INSERT INTO u_money_aging ( id, name, days) VALUES (:ll_billid, :ss_email_cloudmx[i].name, :ss_email_cloudmx[i].days ) Using sqlca; IF sqlca.SQLCode <> 0 THEN ll_billid = 0 //还原billID rslt = 0 arG_MSG = "因网络或其它原因导致插入明细操作失败"+"~n"+sqlca.SQLErrText ROLLBACK Using sqlca; GOTO ext END IF NEXT ext: // IF rslt = 0 THEN it_mxbt = 0 ROLLBACK Using sqlca; ELSEIF rslt = 1 THEN COMMIT Using sqlca; END IF Return(rslt) end function public function integer acceptmx (string arg_name, integer arg_days, ref string arg_msg);Int rslt = 1 Long cnt = 0,LS_i,ls_j IF IsNull(arg_name) THEN arg_name = '' IF IsNull(arg_days) THEN arg_days = 0 //IF Trim(arg_name) = '' THEN // rslt = 0 // arG_MSG = '名称不能为空' // GOTO ext //END IF IF IsNumber(string(arg_days)) =false THEN rslt = 0 arG_MSG = '天数不为数字' GOTO ext END IF //写入内容 it_mxbt++ ss_email_cloudmx[it_mxbt].name = arg_name ss_email_cloudmx[it_mxbt].days = arg_days ext: IF rslt = 0 THEN it_mxbt = 0 END IF Return(rslt) end function public subroutine wf_setname ();Integer i,j,sum dw_1.AcceptText() FOR i = 1 To dw_1.RowCount() sum = 0 IF dw_1.Object.days[i] = 0 And i <> dw_1.RowCount() THEN dw_1.Object.days[i] = 1 END IF IF dw_1.Object.days[i] >= 10000 THEN dw_1.Object.days[i] = 10000 IF dw_1.Object.days[i] <> 0 THEN FOR j = 1 To i - 1 sum = sum + dw_1.Object.days[j] NEXT dw_1.Object.Name[i] = String(sum +1) + "至" + String(sum +Long(dw_1.Object.days[i])) + "天" END IF NEXT end subroutine on w_money_aging.create this.cb_4=create cb_4 this.cb_3=create cb_3 this.cb_2=create cb_2 this.cb_1=create cb_1 this.dw_1=create dw_1 this.Control[]={this.cb_4,& this.cb_3,& this.cb_2,& this.cb_1,& this.dw_1} end on on w_money_aging.destroy destroy(this.cb_4) destroy(this.cb_3) destroy(this.cb_2) destroy(this.cb_1) destroy(this.dw_1) end on event open;dw_1.SetTransObject(sqlca) wf_face() dw_1.retrieve() end event type cb_4 from commandbutton within w_money_aging integer x = 1029 integer y = 132 integer width = 457 integer height = 116 integer taborder = 40 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "放弃" end type event clicked; dw_edit_mode = Not dw_edit_mode wf_lock_child() wf_face() end event type cb_3 from commandbutton within w_money_aging integer x = 1033 integer y = 416 integer width = 457 integer height = 116 integer taborder = 40 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "删行" end type event clicked;long ll_row,ll_currentrow ll_row=dw_1.getrow() if ll_row<=0 then return dw_1.deleterow(ll_row) ll_currentrow=dw_1.rowcount() dw_1.selectrow(0,false) dw_1.selectrow(ll_currentrow,true) end event type cb_2 from commandbutton within w_money_aging integer x = 1029 integer y = 8 integer width = 457 integer height = 116 integer taborder = 30 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "保存" end type event clicked;Integer i String arg_msg IF dw_edit_mode THEN dw_1.AcceptText() wf_setname() it_MXBT = 0 FOR i = 1 To dw_1.RowCount() IF dw_1.Object.days[i] <>0 THEN IF acceptmx(dw_1.Object.Name[i],& dw_1.Object.days[i],& arg_msg) = 0 THEN MessageBox('Error!',arg_msg) RETURN END IF END IF NEXT IF Save(arg_msg) = 0 THEN MessageBox('Error!',arg_msg) RETURN END IF MessageBox(publ_operator,'保存操作成功!') END IF dw_edit_mode = Not dw_edit_mode wf_lock_child() wf_face() end event type cb_1 from commandbutton within w_money_aging integer x = 1033 integer y = 296 integer width = 457 integer height = 116 integer taborder = 20 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "增行" end type event clicked;integer ll_currentrow ll_currentrow=dw_1.insertrow(0) dw_1.selectrow(0,false) dw_1.selectrow(ll_currentrow,true) end event type dw_1 from datawindow within w_money_aging integer x = 5 integer y = 8 integer width = 1029 integer height = 780 integer taborder = 10 string title = "none" string dataobject = "dw_money_aging" boolean hscrollbar = true boolean vscrollbar = true boolean hsplitscroll = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type event clicked;THIS.SelectRow(0,FALSE) THIS.SelectRow(row,TRUE) wf_setname() end event event itemchanged;wf_setname() end event