w_rp_combine_setting_add2.srw 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. $PBExportHeader$w_rp_combine_setting_add2.srw
  2. forward
  3. global type w_rp_combine_setting_add2 from w_publ_base
  4. end type
  5. type dw_1 from datawindow within w_rp_combine_setting_add2
  6. end type
  7. type cb_1 from uo_imflatbutton within w_rp_combine_setting_add2
  8. end type
  9. type cb_2 from uo_imflatbutton within w_rp_combine_setting_add2
  10. end type
  11. end forward
  12. global type w_rp_combine_setting_add2 from w_publ_base
  13. integer width = 2651
  14. integer height = 792
  15. string title = "统计行增加|修改"
  16. boolean minbox = false
  17. windowtype windowtype = response!
  18. dw_1 dw_1
  19. cb_1 cb_1
  20. cb_2 cb_2
  21. end type
  22. global w_rp_combine_setting_add2 w_rp_combine_setting_add2
  23. type variables
  24. s_rp_rowdef s_row_open
  25. end variables
  26. forward prototypes
  27. public function integer wf_save ()
  28. public subroutine wf_insertrow ()
  29. end prototypes
  30. public function integer wf_save ();Long ll_row
  31. Long ll_rpid,ll_rowid
  32. String ls_rowcode,ls_rowname
  33. Int li_rowtype,li_rowcmpltype
  34. String errmsg
  35. Int rslt = 1
  36. dw_1.AcceptText()
  37. ll_row = dw_1.GetRow()
  38. IF ll_row <= 0 THEN
  39. MessageBox('提示','请选择资料')
  40. rslt = 0
  41. GOTO ext
  42. END IF
  43. ll_rpid = dw_1.Object.rpid[ll_row]
  44. ll_rowid = dw_1.Object.rowid[ll_row]
  45. ls_rowcode = Trim(dw_1.Object.rowcode[ll_row])
  46. ls_rowname = dw_1.Object.rowname[ll_row]
  47. li_rowtype = dw_1.Object.rowtype[ll_row]
  48. li_rowcmpltype = dw_1.Object.rowcmpltype[ll_row]
  49. IF ls_rowcode = '' THEN
  50. MessageBox('提示','请输入行号')
  51. dw_1.SetFocus()
  52. dw_1.SetColumn('rowcode')
  53. rslt = 0
  54. GOTO ext
  55. END IF
  56. IF ls_rowname = '' AND li_rowcmpltype <> 0 THEN
  57. MessageBox('提示','请输入空行不能设置统计类型')
  58. dw_1.SetFocus()
  59. dw_1.SetColumn('rowcmpltype')
  60. rslt = 0
  61. GOTO ext
  62. END IF
  63. //IF ls_rowname <> '' AND li_rowcmpltype = 0 THEN
  64. // MessageBox('提示','请选择统计类型')
  65. // dw_1.SetFocus()
  66. // dw_1.SetColumn('rowcmpltype')
  67. // rslt = 0
  68. // GOTO ext
  69. //END IF
  70. IF ll_rowid = 0 THEN
  71. ll_rowid = f_sys_scidentity(0,"cw_rp_rowdef","rowid",errmsg,TRUE,id_sqlca)
  72. IF ll_rowid <= 0 THEN
  73. MessageBox('提示',errmsg)
  74. rslt = 0
  75. GOTO ext
  76. END IF
  77. INSERT INTO cw_rp_rowdef(rowid,rpid,rowcode,rowname,rowtype,rowcmpltype)
  78. Values(:ll_rowid,:ll_rpid,:ls_rowcode,:ls_rowname,:li_rowtype,:li_rowcmpltype);
  79. IF sqlca.SQLCode <> 0 THEN
  80. errmsg = sqlca.SQLErrText
  81. ROLLBACK;
  82. MessageBox('提示','增加资料失败,'+errmsg)
  83. rslt = 0
  84. GOTO ext
  85. END IF
  86. ELSE
  87. UPDATE cw_rp_rowdef SET
  88. rowcode = :ls_rowcode,
  89. rowname = :ls_rowname,
  90. rowcmpltype = :li_rowcmpltype
  91. Where rowid = :ll_rowid;
  92. IF sqlca.SQLCode <> 0 THEN
  93. errmsg = sqlca.SQLErrText
  94. ROLLBACK;
  95. MessageBox('提示','修改资料失败,'+errmsg)
  96. rslt = 0
  97. GOTO ext
  98. END IF
  99. END IF
  100. COMMIT;
  101. ext:
  102. RETURN rslt
  103. end function
  104. public subroutine wf_insertrow ();Long ll_row
  105. dw_1.Reset()
  106. ll_row = dw_1.InsertRow(0)
  107. dw_1.SetRow(ll_row)
  108. dw_1.Object.rpid[ll_row] = s_row_open.rpid
  109. dw_1.Object.rowtype[ll_row] = s_row_open.rowtype
  110. dw_1.SetFocus()
  111. dw_1.SetColumn('rowcode')
  112. end subroutine
  113. on w_rp_combine_setting_add2.create
  114. int iCurrent
  115. call super::create
  116. this.dw_1=create dw_1
  117. this.cb_1=create cb_1
  118. this.cb_2=create cb_2
  119. iCurrent=UpperBound(this.Control)
  120. this.Control[iCurrent+1]=this.dw_1
  121. this.Control[iCurrent+2]=this.cb_1
  122. this.Control[iCurrent+3]=this.cb_2
  123. end on
  124. on w_rp_combine_setting_add2.destroy
  125. call super::destroy
  126. destroy(this.dw_1)
  127. destroy(this.cb_1)
  128. destroy(this.cb_2)
  129. end on
  130. event open;call super::open;dw_1.SetTransObject(sqlca)
  131. s_row_open = Message.PowerObjectParm
  132. IF dw_1.Retrieve(s_row_open.rowid) = 0 THEN
  133. wf_insertrow()
  134. ELSE
  135. dw_1.SetColumn('rowcode')
  136. END IF
  137. end event
  138. type cb_func from w_publ_base`cb_func within w_rp_combine_setting_add2
  139. integer x = 549
  140. integer y = 156
  141. integer width = 311
  142. integer height = 96
  143. string text = "功能"
  144. string normalpicname = ""
  145. integer picsize = 0
  146. toolbaralignment pic_align = alignatleft!
  147. boolean border = true
  148. end type
  149. type cb_exit from w_publ_base`cb_exit within w_rp_combine_setting_add2
  150. integer x = 1627
  151. integer y = 508
  152. end type
  153. type dw_1 from datawindow within w_rp_combine_setting_add2
  154. integer x = 165
  155. integer y = 80
  156. integer width = 2258
  157. integer height = 340
  158. integer taborder = 30
  159. boolean bringtotop = true
  160. string title = "none"
  161. string dataobject = "dw_rp_combine_setting_add2"
  162. boolean border = false
  163. boolean livescroll = true
  164. end type
  165. type cb_1 from uo_imflatbutton within w_rp_combine_setting_add2
  166. integer x = 841
  167. integer y = 508
  168. integer width = 329
  169. integer height = 96
  170. integer taborder = 30
  171. boolean bringtotop = true
  172. string text = "保存并退出"
  173. end type
  174. event clicked;call super::clicked;IF wf_save() = 1 THEN CLOSE(PARENT)
  175. end event
  176. type cb_2 from uo_imflatbutton within w_rp_combine_setting_add2
  177. integer x = 1234
  178. integer y = 508
  179. integer width = 329
  180. integer height = 96
  181. integer taborder = 20
  182. boolean bringtotop = true
  183. string text = "保存并新增"
  184. end type
  185. event clicked;call super::clicked;IF wf_save() = 1 THEN wf_insertrow()
  186. end event