$PBExportHeader$w_billstyle_add.srw forward global type w_billstyle_add from w_publ_base end type type dw_1 from datawindow within w_billstyle_add end type type cb_2 from uo_imflatbutton within w_billstyle_add end type end forward global type w_billstyle_add from w_publ_base integer width = 1486 integer height = 1600 string title = "单据抬头格式建立" boolean minbox = false windowtype windowtype = response! dw_1 dw_1 cb_2 cb_2 end type global w_billstyle_add w_billstyle_add type variables String ins_sqlerrtext end variables forward prototypes public subroutine wf_aa () end prototypes public subroutine wf_aa ();long i if i = 1 then end if end subroutine on w_billstyle_add.create int iCurrent call super::create this.dw_1=create dw_1 this.cb_2=create cb_2 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.dw_1 this.Control[iCurrent+2]=this.cb_2 end on on w_billstyle_add.destroy call super::destroy destroy(this.dw_1) destroy(this.cb_2) end on event open;call super::open;Long ll_id ll_id = Message.DoubleParm dw_1.SetTransObject(sqlca) IF ll_id = 0 THEN dw_1.InsertRow(0) ELSE dw_1.Retrieve(ll_id) END IF dw_1.SetFocus() dw_1.SetColumn('module') end event type cb_func from w_publ_base`cb_func within w_billstyle_add boolean visible = false integer x = 293 integer y = 272 boolean enabled = false end type type cb_exit from w_publ_base`cb_exit within w_billstyle_add integer x = 805 integer y = 1344 string text = "取消" end type type dw_1 from datawindow within w_billstyle_add event dwnkey pbm_dwnkey integer x = 78 integer y = 64 integer width = 1307 integer height = 1196 integer taborder = 10 boolean bringtotop = true string title = "none" string dataobject = "dw_billstyle_add" boolean livescroll = true borderstyle borderstyle = stylelowered! end type event dwnkey;IF Key = KeyEnter! OR Key = Keydownarrow! THEN // keybd_event ( 9, 0, 0 , 0 ) // 按下tab keybd_event ( 9, 0, 2, 0 ) // 释放tab ELSEIF Key = Keyuparrow! THEN keybd_event ( 16, 0, 0 , 0 ) keybd_event ( 9, 0, 0 , 0 ) keybd_event ( 9, 0, 2, 0 ) keybd_event ( 16, 0, 2, 0 ) END IF end event event dberror;ins_sqlerrtext = SQLErrText RETURN 1 end event type cb_2 from uo_imflatbutton within w_billstyle_add integer x = 343 integer y = 1344 integer width = 311 integer height = 96 integer taborder = 20 boolean bringtotop = true string normalpicname = "ok.bmp" end type event clicked;call super::clicked;Long ll_id String errmsg = '' dw_1.AcceptText() IF dw_1.GetNextModified(0, Primary!) = 0 THEN MessageBox('提示','没有任何修改,不可以保存!', Information!, OK! ) RETURN END IF dw_1.Object.module[dw_1.GetRow()] = Trim(dw_1.Object.module[dw_1.GetRow()]) dw_1.Object.billstyle[dw_1.GetRow()] = Trim(dw_1.Object.billstyle[dw_1.GetRow()]) dw_1.Object.datestyle[dw_1.GetRow()] = Trim(dw_1.Object.datestyle[dw_1.GetRow()]) dw_1.Object.firststr[dw_1.GetRow()] = Trim(dw_1.Object.firststr[dw_1.GetRow()]) dw_1.Object.oldfirststr[dw_1.GetRow()] = Trim(dw_1.Object.oldfirststr[dw_1.GetRow()]) dw_1.Object.dscrp[dw_1.GetRow()] = Trim(dw_1.Object.dscrp[dw_1.GetRow()]) dw_1.Object.win1[dw_1.GetRow()] = Trim(dw_1.Object.win1[dw_1.GetRow()]) dw_1.Object.win2[dw_1.GetRow()] = Trim(dw_1.Object.win2[dw_1.GetRow()]) dw_1.Object.tablename[dw_1.GetRow()] = Trim(dw_1.Object.tablename[dw_1.GetRow()]) dw_1.Object.codename[dw_1.GetRow()] = Trim(dw_1.Object.codename[dw_1.GetRow()]) IF dw_1.Object.billstyle[dw_1.GetRow()] = '' THEN MessageBox('提示','请输入单据名称!', Information!, OK! ) dw_1.SetFocus() dw_1.SetColumn("billstyle") RETURN END IF IF dw_1.Object.oldfirststr[dw_1.GetRow()] = '' THEN MessageBox('提示','请输入旧单据抬头!', Information!, OK! ) dw_1.SetFocus() dw_1.SetColumn("oldfirststr") RETURN END IF IF Len(String(dw_1.Object.oldfirststr[dw_1.GetRow()])) <> 2 THEN MessageBox('提示','请单据抬头只能为2位字符!', Information!, OK! ) dw_1.SetFocus() dw_1.SetColumn("oldfirststr") RETURN END IF IF Len(String(dw_1.Object.firststr[dw_1.GetRow()])) > 0 THEN IF Len(String(dw_1.Object.firststr[dw_1.GetRow()])) <> 2 THEN MessageBox('提示','新单据抬头只能为2位字符!', Information!, OK! ) dw_1.SetFocus() dw_1.SetColumn("firststr") RETURN END IF END IF IF dw_1.Object.datestyle[dw_1.GetRow()] = '' THEN MessageBox('提示','请选择格式!', Information!, OK! ) dw_1.SetFocus() dw_1.SetColumn("datestyle") RETURN END IF IF dw_1.Object.win1[dw_1.GetRow()] = '' THEN MessageBox('提示','请输入对应窗口1!', Information!, OK! ) dw_1.SetFocus() dw_1.SetColumn("win1") RETURN END IF IF dw_1.Object.tablename[dw_1.GetRow()] = '' THEN MessageBox('提示','请输入对应表名!', Information!, OK! ) dw_1.SetFocus() dw_1.SetColumn("tablename") RETURN END IF IF dw_1.Object.codename[dw_1.GetRow()] = '' THEN MessageBox('提示','请输入单号列名!', Information!, OK! ) dw_1.SetFocus() dw_1.SetColumn("codename") RETURN END IF IF dw_1.Object.id[dw_1.GetRow()] = 0 THEN ll_id = f_sys_scidentity(0,"u_billcode","id",errmsg,FALSE,sqlca) IF ll_id <= 0 THEN MessageBox("错误",errmsg, StopSign!, OK! ) RETURN ELSE dw_1.Object.id[dw_1.GetRow()] = ll_id END IF END IF String ls_errmsg IF dw_1.Update() = -1 THEN IF Pos(ins_sqlerrtext,"Cannot insert duplicate key row") > 0 THEN ls_errmsg = "关键内容重复" ELSE ls_errmsg = "因为网络或其他原因>"+ins_sqlerrtext END IF ROLLBACK; MessageBox ('错误',ls_errmsg+",保存操作失败!", StopSign!, OK! ) RETURN ELSE COMMIT; MessageBox ('提示',"保存操作成功!",Exclamation!,OK!) END IF Close(PARENT) end event