w_billstyle_add.srw 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. $PBExportHeader$w_billstyle_add.srw
  2. forward
  3. global type w_billstyle_add from w_publ_base
  4. end type
  5. type dw_1 from datawindow within w_billstyle_add
  6. end type
  7. type cb_2 from uo_imflatbutton within w_billstyle_add
  8. end type
  9. end forward
  10. global type w_billstyle_add from w_publ_base
  11. integer width = 1486
  12. integer height = 1600
  13. string title = "单据抬头格式建立"
  14. boolean minbox = false
  15. windowtype windowtype = response!
  16. dw_1 dw_1
  17. cb_2 cb_2
  18. end type
  19. global w_billstyle_add w_billstyle_add
  20. type variables
  21. String ins_sqlerrtext
  22. end variables
  23. forward prototypes
  24. public subroutine wf_aa ()
  25. end prototypes
  26. public subroutine wf_aa ();long i
  27. if i = 1 then
  28. end if
  29. end subroutine
  30. on w_billstyle_add.create
  31. int iCurrent
  32. call super::create
  33. this.dw_1=create dw_1
  34. this.cb_2=create cb_2
  35. iCurrent=UpperBound(this.Control)
  36. this.Control[iCurrent+1]=this.dw_1
  37. this.Control[iCurrent+2]=this.cb_2
  38. end on
  39. on w_billstyle_add.destroy
  40. call super::destroy
  41. destroy(this.dw_1)
  42. destroy(this.cb_2)
  43. end on
  44. event open;call super::open;Long ll_id
  45. ll_id = Message.DoubleParm
  46. dw_1.SetTransObject(sqlca)
  47. IF ll_id = 0 THEN
  48. dw_1.InsertRow(0)
  49. ELSE
  50. dw_1.Retrieve(ll_id)
  51. END IF
  52. dw_1.SetFocus()
  53. dw_1.SetColumn('module')
  54. end event
  55. type cb_func from w_publ_base`cb_func within w_billstyle_add
  56. boolean visible = false
  57. integer x = 293
  58. integer y = 272
  59. boolean enabled = false
  60. end type
  61. type cb_exit from w_publ_base`cb_exit within w_billstyle_add
  62. integer x = 805
  63. integer y = 1344
  64. string text = "取消"
  65. end type
  66. type dw_1 from datawindow within w_billstyle_add
  67. event dwnkey pbm_dwnkey
  68. integer x = 78
  69. integer y = 64
  70. integer width = 1307
  71. integer height = 1196
  72. integer taborder = 10
  73. boolean bringtotop = true
  74. string title = "none"
  75. string dataobject = "dw_billstyle_add"
  76. boolean livescroll = true
  77. borderstyle borderstyle = stylelowered!
  78. end type
  79. event dwnkey;IF Key = KeyEnter! OR Key = Keydownarrow! THEN //
  80. keybd_event ( 9, 0, 0 , 0 ) // 按下tab
  81. keybd_event ( 9, 0, 2, 0 ) // 释放tab
  82. ELSEIF Key = Keyuparrow! THEN
  83. keybd_event ( 16, 0, 0 , 0 )
  84. keybd_event ( 9, 0, 0 , 0 )
  85. keybd_event ( 9, 0, 2, 0 )
  86. keybd_event ( 16, 0, 2, 0 )
  87. END IF
  88. end event
  89. event dberror;ins_sqlerrtext = SQLErrText
  90. RETURN 1
  91. end event
  92. type cb_2 from uo_imflatbutton within w_billstyle_add
  93. integer x = 343
  94. integer y = 1344
  95. integer width = 311
  96. integer height = 96
  97. integer taborder = 20
  98. boolean bringtotop = true
  99. string normalpicname = "ok.bmp"
  100. end type
  101. event clicked;call super::clicked;Long ll_id
  102. String errmsg = ''
  103. dw_1.AcceptText()
  104. IF dw_1.GetNextModified(0, Primary!) = 0 THEN
  105. MessageBox('提示','没有任何修改,不可以保存!', Information!, OK! )
  106. RETURN
  107. END IF
  108. dw_1.Object.module[dw_1.GetRow()] = Trim(dw_1.Object.module[dw_1.GetRow()])
  109. dw_1.Object.billstyle[dw_1.GetRow()] = Trim(dw_1.Object.billstyle[dw_1.GetRow()])
  110. dw_1.Object.datestyle[dw_1.GetRow()] = Trim(dw_1.Object.datestyle[dw_1.GetRow()])
  111. dw_1.Object.firststr[dw_1.GetRow()] = Trim(dw_1.Object.firststr[dw_1.GetRow()])
  112. dw_1.Object.oldfirststr[dw_1.GetRow()] = Trim(dw_1.Object.oldfirststr[dw_1.GetRow()])
  113. dw_1.Object.dscrp[dw_1.GetRow()] = Trim(dw_1.Object.dscrp[dw_1.GetRow()])
  114. dw_1.Object.win1[dw_1.GetRow()] = Trim(dw_1.Object.win1[dw_1.GetRow()])
  115. dw_1.Object.win2[dw_1.GetRow()] = Trim(dw_1.Object.win2[dw_1.GetRow()])
  116. dw_1.Object.tablename[dw_1.GetRow()] = Trim(dw_1.Object.tablename[dw_1.GetRow()])
  117. dw_1.Object.codename[dw_1.GetRow()] = Trim(dw_1.Object.codename[dw_1.GetRow()])
  118. IF dw_1.Object.billstyle[dw_1.GetRow()] = '' THEN
  119. MessageBox('提示','请输入单据名称!', Information!, OK! )
  120. dw_1.SetFocus()
  121. dw_1.SetColumn("billstyle")
  122. RETURN
  123. END IF
  124. IF dw_1.Object.oldfirststr[dw_1.GetRow()] = '' THEN
  125. MessageBox('提示','请输入旧单据抬头!', Information!, OK! )
  126. dw_1.SetFocus()
  127. dw_1.SetColumn("oldfirststr")
  128. RETURN
  129. END IF
  130. IF Len(String(dw_1.Object.oldfirststr[dw_1.GetRow()])) <> 2 THEN
  131. MessageBox('提示','请单据抬头只能为2位字符!', Information!, OK! )
  132. dw_1.SetFocus()
  133. dw_1.SetColumn("oldfirststr")
  134. RETURN
  135. END IF
  136. IF Len(String(dw_1.Object.firststr[dw_1.GetRow()])) > 0 THEN
  137. IF Len(String(dw_1.Object.firststr[dw_1.GetRow()])) <> 2 THEN
  138. MessageBox('提示','新单据抬头只能为2位字符!', Information!, OK! )
  139. dw_1.SetFocus()
  140. dw_1.SetColumn("firststr")
  141. RETURN
  142. END IF
  143. END IF
  144. IF dw_1.Object.datestyle[dw_1.GetRow()] = '' THEN
  145. MessageBox('提示','请选择格式!', Information!, OK! )
  146. dw_1.SetFocus()
  147. dw_1.SetColumn("datestyle")
  148. RETURN
  149. END IF
  150. IF dw_1.Object.win1[dw_1.GetRow()] = '' THEN
  151. MessageBox('提示','请输入对应窗口1!', Information!, OK! )
  152. dw_1.SetFocus()
  153. dw_1.SetColumn("win1")
  154. RETURN
  155. END IF
  156. IF dw_1.Object.tablename[dw_1.GetRow()] = '' THEN
  157. MessageBox('提示','请输入对应表名!', Information!, OK! )
  158. dw_1.SetFocus()
  159. dw_1.SetColumn("tablename")
  160. RETURN
  161. END IF
  162. IF dw_1.Object.codename[dw_1.GetRow()] = '' THEN
  163. MessageBox('提示','请输入单号列名!', Information!, OK! )
  164. dw_1.SetFocus()
  165. dw_1.SetColumn("codename")
  166. RETURN
  167. END IF
  168. IF dw_1.Object.id[dw_1.GetRow()] = 0 THEN
  169. ll_id = f_sys_scidentity(0,"u_billcode","id",errmsg,FALSE,sqlca)
  170. IF ll_id <= 0 THEN
  171. MessageBox("错误",errmsg, StopSign!, OK! )
  172. RETURN
  173. ELSE
  174. dw_1.Object.id[dw_1.GetRow()] = ll_id
  175. END IF
  176. END IF
  177. String ls_errmsg
  178. IF dw_1.Update() = -1 THEN
  179. IF Pos(ins_sqlerrtext,"Cannot insert duplicate key row") > 0 THEN
  180. ls_errmsg = "关键内容重复"
  181. ELSE
  182. ls_errmsg = "因为网络或其他原因>"+ins_sqlerrtext
  183. END IF
  184. ROLLBACK;
  185. MessageBox ('错误',ls_errmsg+",保存操作失败!", StopSign!, OK! )
  186. RETURN
  187. ELSE
  188. COMMIT;
  189. MessageBox ('提示',"保存操作成功!",Exclamation!,OK!)
  190. END IF
  191. Close(PARENT)
  192. end event