w_cust_crm_add.srw 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. $PBExportHeader$w_cust_crm_add.srw
  2. forward
  3. global type w_cust_crm_add from w_publ_base
  4. end type
  5. type dw_1 from datawindow within w_cust_crm_add
  6. end type
  7. type cb_2 from uo_imflatbutton within w_cust_crm_add
  8. end type
  9. type cb_1 from uo_imflatbutton within w_cust_crm_add
  10. end type
  11. end forward
  12. global type w_cust_crm_add from w_publ_base
  13. integer width = 2432
  14. integer height = 1820
  15. string title = "客户资料"
  16. boolean minbox = false
  17. windowtype windowtype = response!
  18. dw_1 dw_1
  19. cb_2 cb_2
  20. cb_1 cb_1
  21. end type
  22. global w_cust_crm_add w_cust_crm_add
  23. type variables
  24. s_custom s_cust_open
  25. uo_crm uo_cus
  26. end variables
  27. forward prototypes
  28. public function integer wf_save ()
  29. public function integer wf_insertrow ()
  30. end prototypes
  31. public function integer wf_save ();Int rslt = 1
  32. Long li_row
  33. dw_1.AcceptText()
  34. li_row = dw_1.GetRow()
  35. IF li_row <= 0 THEN
  36. MessageBox('提示','记录错误',information!,ok!)
  37. rslt = 0
  38. GOTO ext
  39. END IF
  40. String arg_msg
  41. s_custom arg_s_cust
  42. arg_s_cust.cusid = dw_1.Object.cusid[dw_1.GetRow()]
  43. arg_s_cust.cuscode = dw_1.Object.cuscode[dw_1.GetRow()]
  44. arg_s_cust.Name = dw_1.Object.Name[dw_1.GetRow()]
  45. arg_s_cust.bsntype = dw_1.Object.custype[dw_1.GetRow()]
  46. arg_s_cust.rep = dw_1.Object.rep[dw_1.GetRow()]
  47. arg_s_cust.tele = dw_1.Object.tele[dw_1.GetRow()]
  48. arg_s_cust.tele1 = dw_1.Object.tele1[dw_1.GetRow()]
  49. arg_s_cust.bank = dw_1.Object.bank[dw_1.GetRow()]
  50. arg_s_cust.cunt = dw_1.Object.cunt[dw_1.GetRow()]
  51. arg_s_cust.Address = dw_1.Object.Address[dw_1.GetRow()]
  52. arg_s_cust.code = dw_1.Object.code[dw_1.GetRow()]
  53. arg_s_cust.dscrp = dw_1.Object.dscrp[dw_1.GetRow()]
  54. arg_s_cust.givebackrate = dw_1.Object.givebackrate[dw_1.GetRow()]
  55. arg_s_cust.freight = dw_1.Object.freight[dw_1.GetRow()]
  56. arg_s_cust.freight_tele = dw_1.Object.freight_tele[dw_1.GetRow()]
  57. arg_s_cust.fax = dw_1.Object.faxno[dw_1.GetRow()]
  58. arg_s_cust.upname = dw_1.Object.upname[dw_1.GetRow()]
  59. arg_s_cust.inuse = dw_1.Object.inuse[dw_1.GetRow()]
  60. arg_s_cust.cusareaid = dw_1.Object.cusareaid[dw_1.GetRow()]
  61. arg_s_cust.areaname = dw_1.Object.areaname[dw_1.GetRow()]
  62. arg_s_cust.cusareaname = dw_1.Object.cusareaname[dw_1.GetRow()]
  63. arg_s_cust.email = dw_1.Object.email[dw_1.GetRow()]
  64. arg_s_cust.State = dw_1.Object.State[dw_1.GetRow()]
  65. arg_s_cust.peoplenum = dw_1.Object.peoplenum[dw_1.GetRow()]
  66. arg_s_cust.mainmarket = dw_1.Object.mainmarket[dw_1.GetRow()]
  67. arg_s_cust.saleamt = dw_1.Object.saleamt[dw_1.GetRow()]
  68. arg_s_cust.nethttp = dw_1.Object.nethttp[dw_1.GetRow()]
  69. arg_s_cust.trade = dw_1.Object.trade[dw_1.GetRow()]
  70. arg_s_cust.corporation = dw_1.Object.corporation[dw_1.GetRow()]
  71. arg_s_cust.grade = dw_1.Object.grade[dw_1.GetRow()]
  72. arg_s_cust.simplename = dw_1.Object.simplename[dw_1.GetRow()]
  73. IF uo_cus.uof_add_cust(arg_s_cust,publ_operator,arg_msg,TRUE) = 0 THEN
  74. MessageBox ("错误",arg_msg+",保存操作失败!",stopsign!,ok!)
  75. rslt = 0
  76. GOTO ext
  77. END IF
  78. ext:
  79. RETURN rslt
  80. end function
  81. public function integer wf_insertrow ();Long ll_row
  82. ll_row = dw_1.InsertRow(0)
  83. dw_1.Object.cusareaid[ll_row] = s_cust_open.cusareaid
  84. IF sys_option_cust_audit = 1 THEN
  85. dw_1.Object.State[ll_row] = 0
  86. ELSE
  87. dw_1.Object.State[ll_row] = 1
  88. END IF
  89. dw_1.SetFocus()
  90. dw_1.SetColumn('cuscode')
  91. RETURN 1
  92. end function
  93. on w_cust_crm_add.create
  94. int iCurrent
  95. call super::create
  96. this.dw_1=create dw_1
  97. this.cb_2=create cb_2
  98. this.cb_1=create cb_1
  99. iCurrent=UpperBound(this.Control)
  100. this.Control[iCurrent+1]=this.dw_1
  101. this.Control[iCurrent+2]=this.cb_2
  102. this.Control[iCurrent+3]=this.cb_1
  103. end on
  104. on w_cust_crm_add.destroy
  105. call super::destroy
  106. destroy(this.dw_1)
  107. destroy(this.cb_2)
  108. destroy(this.cb_1)
  109. end on
  110. event open;call super::open;dw_1.SetTransObject(sqlca)
  111. s_cust_open = Message.PowerObjectParm
  112. uo_cus = CREATE uo_crm
  113. IF s_cust_open.cusid = 0 THEN
  114. wf_insertrow()
  115. ELSE
  116. dw_1.Retrieve(s_cust_open.cusid)
  117. END IF
  118. end event
  119. event close;call super::close;destroy uo_cus
  120. end event
  121. type cb_func from w_publ_base`cb_func within w_cust_crm_add
  122. boolean visible = false
  123. integer x = 1056
  124. integer y = 580
  125. boolean enabled = false
  126. end type
  127. type cb_exit from w_publ_base`cb_exit within w_cust_crm_add
  128. integer x = 1705
  129. integer y = 1596
  130. integer taborder = 30
  131. string text = "取消"
  132. end type
  133. type dw_1 from datawindow within w_cust_crm_add
  134. event key pbm_dwnkey
  135. event dwnkey pbm_dwnkey
  136. integer x = 55
  137. integer y = 64
  138. integer width = 2309
  139. integer height = 1492
  140. integer taborder = 10
  141. boolean bringtotop = true
  142. string dataobject = "dw_cust_crm_edit"
  143. boolean livescroll = true
  144. borderstyle borderstyle = stylelowered!
  145. end type
  146. event dwnkey;IF Key = KeyDownArrow! THEN RETURN 1
  147. IF Key = keyenter! OR Key = KeyDownArrow! THEN //
  148. keybd_event ( 9, 0, 0 , 0 ) // 按下tab
  149. keybd_event ( 9, 0, 2, 0 ) // 释放tab
  150. RETURN 0
  151. ELSEIF Key = keyuparrow! THEN
  152. keybd_event ( 16, 0, 0 , 0 )
  153. keybd_event ( 9, 0, 0 , 0 )
  154. keybd_event ( 9, 0, 2, 0 )
  155. keybd_event ( 16, 0, 2, 0 )
  156. RETURN 0
  157. END IF
  158. end event
  159. event buttonclicked;
  160. IF dwo.Name = 'b_s' THEN
  161. s_edit_index_tran s_ch_tran //传递参数使用
  162. s_ch_tran.if_retrieve_all = FALSE //是否一次RETRIEVE所有行
  163. s_ch_tran.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式
  164. s_ch_tran.arg_pkid = 0 //目标定位PKID (备用)
  165. OpenWithParm(w_station_edit,s_ch_tran) //调用
  166. s_station S_INSCUST
  167. S_INSCUST = Message.PowerObjectParm //接受返回结构
  168. IF S_INSCUST.stationid > 0 THEN //正常返回值则可以取以下值
  169. dw_1.SetRedraw(FALSE)
  170. dw_1.Object.freight[row] = S_INSCUST.stationname
  171. dw_1.Object.freight_tele[row] = S_INSCUST.tele
  172. dw_1.SetRedraw(TRUE)
  173. END IF
  174. END IF
  175. end event
  176. type cb_2 from uo_imflatbutton within w_cust_crm_add
  177. integer x = 1134
  178. integer y = 1596
  179. integer width = 407
  180. integer height = 96
  181. integer taborder = 40
  182. string text = "保存[C^+S]"
  183. string normalpicname = "save.bmp"
  184. end type
  185. event clicked;call super::clicked;if wf_save() = 0 then return
  186. close(parent)
  187. end event
  188. type cb_1 from uo_imflatbutton within w_cust_crm_add
  189. integer x = 480
  190. integer y = 1596
  191. integer width = 489
  192. integer height = 96
  193. integer taborder = 40
  194. string text = "保存&新增[&S]"
  195. string normalpicname = "save.bmp"
  196. end type
  197. event clicked;call super::clicked;IF wf_save() = 0 THEN RETURN
  198. wf_insertrow()
  199. end event