w_mtrldef_edit_dftsaleprice.srw 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. $PBExportHeader$w_mtrldef_edit_dftsaleprice.srw
  2. forward
  3. global type w_mtrldef_edit_dftsaleprice from w_publ_easyq
  4. end type
  5. type cb_save from uo_imflatbutton within w_mtrldef_edit_dftsaleprice
  6. end type
  7. type tv_1 from uo_tv_mtrltype within w_mtrldef_edit_dftsaleprice
  8. end type
  9. type cb_cancel from uo_imflatbutton within w_mtrldef_edit_dftsaleprice
  10. end type
  11. end forward
  12. global type w_mtrldef_edit_dftsaleprice from w_publ_easyq
  13. string title = "产品价格表价格批设定"
  14. cb_save cb_save
  15. tv_1 tv_1
  16. cb_cancel cb_cancel
  17. end type
  18. global w_mtrldef_edit_dftsaleprice w_mtrldef_edit_dftsaleprice
  19. type variables
  20. String cur_handtype = '%'
  21. Long cur_pricelistid[]
  22. Int cur_temp_count
  23. String cur_column_string[]
  24. end variables
  25. forward prototypes
  26. public function integer wf_refresh_face ()
  27. public function integer wf_retrieve_wagemx ()
  28. public function integer wf_save (ref string arg_msg, boolean ifcommit)
  29. end prototypes
  30. public function integer wf_refresh_face ();//wf_refresh_face
  31. Int ls_i
  32. cb_func.Enabled = NOT dw_edit_mode
  33. cb_1.Enabled = NOT dw_edit_mode
  34. IF dw_edit_mode THEN
  35. cb_cancel.Enabled = TRUE
  36. cb_save.Text = '保存'
  37. cb_save.normalpicname = 'Save.bmp'
  38. ls_i = 1
  39. DO WHILE ls_i <= 15
  40. dw_1.SetTabOrder("price"+String(ls_i,'00'),10*ls_i)
  41. ls_i++
  42. LOOP
  43. ELSE
  44. cb_cancel.Enabled = FALSE
  45. cb_save.Text = '修改'
  46. cb_save.normalpicname = 'open.bmp'
  47. ls_i = 1
  48. DO WHILE ls_i <= 15
  49. dw_1.SetTabOrder("price"+String(ls_i,'00'),0)
  50. ls_i++
  51. LOOP
  52. END IF
  53. cb_save.TriggerEvent('ue_textchange')
  54. cb_save.of_init_draw()
  55. cb_save.of_paint()
  56. RETURN 0
  57. end function
  58. public function integer wf_retrieve_wagemx ();Int rslt = 1
  59. Long ls_j,ls_k,ls_rowcount
  60. Long ll_mtrlid,ll_pricelistid
  61. Decimal ld_temp_amt
  62. ls_rowcount = dw_1.RowCount()
  63. OPEN(w_sys_wait_jdt) //初始化进度条
  64. w_sys_wait_jdt.Show()
  65. w_sys_wait_jdt.wf_accepttol(ls_rowcount)
  66. FOR ls_j = 1 TO ls_rowcount
  67. ll_mtrlid = dw_1.Object.mtrlid[ls_j]
  68. FOR ls_k = 1 TO cur_temp_count
  69. w_sys_wait_jdt.st_msg.Text = "正在查询数据("+String(ls_j)+","+String(ls_k)+")..." //进度信息
  70. ll_pricelistid = cur_pricelistid[ls_k]
  71. SELECT price
  72. INTO :ld_temp_amt
  73. FROM u_sale_price_mx
  74. WHERE pricelistid = :ll_pricelistid AND
  75. mtrlid = :ll_mtrlid;
  76. IF sqlca.SQLCode <> 0 THEN
  77. ld_temp_amt = 0
  78. END IF
  79. dw_1.SetItem(ls_j,"price"+String(ls_k,'00'),ld_temp_amt)
  80. NEXT
  81. w_sys_wait_jdt.wf_inc(ls_j) //进度
  82. NEXT
  83. dw_1.AcceptText()
  84. CLOSE(w_sys_wait_jdt)
  85. RETURN rslt
  86. end function
  87. public function integer wf_save (ref string arg_msg, boolean ifcommit);Int rslt = 1
  88. long ls_rowcount,ls_j,ls_k
  89. Long ll_mtrlid,ll_pricelistid
  90. Decimal ld_temp_amt
  91. dw_1.AcceptText()
  92. ls_rowcount = dw_1.RowCount()
  93. Open(w_sys_wait_jdt) //初始化进度条
  94. w_sys_wait_jdt.Show()
  95. w_sys_wait_jdt.wf_accepttol(ls_rowcount)
  96. FOR ls_j = 1 TO ls_rowcount
  97. ll_mtrlid = dw_1.Object.mtrlid[ls_j]
  98. FOR ls_k = 1 TO cur_temp_count
  99. ll_pricelistid = cur_pricelistid[ls_k]
  100. CHOOSE CASE ls_k
  101. CASE 1
  102. ld_temp_amt = dw_1.Object.price01[ls_j]
  103. CASE 2
  104. ld_temp_amt = dw_1.Object.price02[ls_j]
  105. CASE 3
  106. ld_temp_amt = dw_1.Object.price03[ls_j]
  107. CASE 4
  108. ld_temp_amt = dw_1.Object.price04[ls_j]
  109. CASE 5
  110. ld_temp_amt = dw_1.Object.price05[ls_j]
  111. CASE 6
  112. ld_temp_amt = dw_1.Object.price06[ls_j]
  113. CASE 7
  114. ld_temp_amt = dw_1.Object.price07[ls_j]
  115. CASE 8
  116. ld_temp_amt = dw_1.Object.price08[ls_j]
  117. CASE 9
  118. ld_temp_amt = dw_1.Object.price09[ls_j]
  119. CASE 10
  120. ld_temp_amt = dw_1.Object.price10[ls_j]
  121. CASE 11
  122. ld_temp_amt = dw_1.Object.price11[ls_j]
  123. CASE 12
  124. ld_temp_amt = dw_1.Object.price12[ls_j]
  125. CASE 13
  126. ld_temp_amt = dw_1.Object.price13[ls_j]
  127. CASE 14
  128. ld_temp_amt = dw_1.Object.price14[ls_j]
  129. CASE 15
  130. ld_temp_amt = dw_1.Object.price15[ls_j]
  131. END CHOOSE
  132. w_sys_wait_jdt.st_msg.Text = "正在保存数据("+String(ls_j)+","+String(ls_k)+")..." //进度信息
  133. UPDATE u_sale_price_mx
  134. SET price = :ld_temp_amt
  135. WHERE mtrlid = :ll_mtrlid
  136. AND pricelistid = :ll_pricelistid;
  137. IF sqlca.SQLCode = 0 THEN
  138. IF sqlca.SQLNRows = 0 THEN
  139. INSERT INTO u_sale_price_mx
  140. (pricelistid,mtrlid,price)
  141. VALUES
  142. (:ll_pricelistid,:ll_mtrlid,:ld_temp_amt);
  143. IF sqlca.SQLCode <> 0 THEN
  144. rslt = 0
  145. arg_msg = '新增价格表失败,在第'+String(ls_j)+'行,第'+String(ls_k)+'列工资项目'
  146. GOTO ext
  147. END IF
  148. END IF
  149. ELSE
  150. rslt = 0
  151. arg_msg = '更新价格表失败,在第'+String(ls_j)+'行,第'+String(ls_k)+'列工资项目'
  152. GOTO ext
  153. END IF
  154. NEXT
  155. w_sys_wait_jdt.wf_inc(ls_j) //进度
  156. NEXT
  157. dw_1.AcceptText()
  158. ext:
  159. IF rslt = 1 AND ifcommit THEN
  160. COMMIT;
  161. ELSE
  162. ROLLBACK;
  163. END IF
  164. Close(w_sys_wait_jdt)
  165. RETURN rslt
  166. end function
  167. on w_mtrldef_edit_dftsaleprice.create
  168. int iCurrent
  169. call super::create
  170. this.cb_save=create cb_save
  171. this.tv_1=create tv_1
  172. this.cb_cancel=create cb_cancel
  173. iCurrent=UpperBound(this.Control)
  174. this.Control[iCurrent+1]=this.cb_save
  175. this.Control[iCurrent+2]=this.tv_1
  176. this.Control[iCurrent+3]=this.cb_cancel
  177. end on
  178. on w_mtrldef_edit_dftsaleprice.destroy
  179. call super::destroy
  180. destroy(this.cb_save)
  181. destroy(this.tv_1)
  182. destroy(this.cb_cancel)
  183. end on
  184. event open;call super::open;cb_1.triggerevent(clicked!)
  185. wf_refresh_face()
  186. end event
  187. event resize;call super::resize;tv_1.Height = dw_1.Height
  188. end event
  189. type cb_func from w_publ_easyq`cb_func within w_mtrldef_edit_dftsaleprice
  190. integer x = 709
  191. end type
  192. type cb_exit from w_publ_easyq`cb_exit within w_mtrldef_edit_dftsaleprice
  193. integer x = 1417
  194. end type
  195. type cb_2 from w_publ_easyq`cb_2 within w_mtrldef_edit_dftsaleprice
  196. integer x = 1010
  197. integer taborder = 100
  198. boolean bringtotop = true
  199. end type
  200. type cb_psetup from w_publ_easyq`cb_psetup within w_mtrldef_edit_dftsaleprice
  201. integer x = 1161
  202. boolean bringtotop = true
  203. end type
  204. type cb_1 from w_publ_easyq`cb_1 within w_mtrldef_edit_dftsaleprice
  205. boolean bringtotop = true
  206. end type
  207. event cb_1::clicked;call super::clicked;dw_1.SetRedraw(FALSE)
  208. dw_1.SetTransObject(sqlca)
  209. dw_1.Retrieve(cur_handtype)
  210. String ls_pricelistname
  211. Long ls_pricelistid
  212. Int ls_j = 1
  213. DO WHILE ls_j <= 40
  214. dw_1.Modify("price"+String(ls_j,'00')+"_t.visible=true")
  215. dw_1.Modify("price"+String(ls_j,'00')+".visible=true")
  216. ls_j++
  217. LOOP
  218. DECLARE pricelist_cur CURSOR FOR
  219. SELECT
  220. u_sale_price_list.listname,
  221. u_sale_price_list.pricelistid
  222. FROM u_sale_price_list
  223. Order By u_sale_price_list.code;
  224. OPEN pricelist_cur;
  225. ls_j = 1
  226. FETCH pricelist_cur INTO :ls_pricelistname,:ls_pricelistid;
  227. DO WHILE sqlca.SQLCode = 0
  228. cur_pricelistid[ls_j] = ls_pricelistid
  229. cur_column_string[ls_j] = "price"+String(ls_j,'00')
  230. dw_1.Modify("price"+String(ls_j,'00')+"_t.Text='"+ls_pricelistname+"'")
  231. FETCH pricelist_cur INTO :ls_pricelistname,:ls_pricelistid;
  232. ls_j++
  233. LOOP
  234. CLOSE pricelist_cur;
  235. cur_temp_count = ls_j - 1
  236. DO WHILE ls_j <= 15
  237. dw_1.Modify("price"+String(ls_j,'00')+"_t.visible=false")
  238. dw_1.Modify("price"+String(ls_j,'00')+".visible=false")
  239. ls_j++
  240. LOOP
  241. wf_retrieve_wagemx()
  242. dw_1.SetRedraw(TRUE)
  243. end event
  244. type st_3 from w_publ_easyq`st_3 within w_mtrldef_edit_dftsaleprice
  245. boolean visible = false
  246. integer x = 1358
  247. integer y = 396
  248. end type
  249. type st_4 from w_publ_easyq`st_4 within w_mtrldef_edit_dftsaleprice
  250. boolean visible = false
  251. integer x = 1705
  252. integer y = 536
  253. end type
  254. type em_1 from w_publ_easyq`em_1 within w_mtrldef_edit_dftsaleprice
  255. boolean visible = false
  256. integer x = 1271
  257. integer y = 464
  258. integer taborder = 110
  259. end type
  260. type em_2 from w_publ_easyq`em_2 within w_mtrldef_edit_dftsaleprice
  261. boolean visible = false
  262. integer x = 1787
  263. integer y = 456
  264. integer taborder = 140
  265. end type
  266. type ddlb_yl from w_publ_easyq`ddlb_yl within w_mtrldef_edit_dftsaleprice
  267. integer x = 1778
  268. integer y = 48
  269. end type
  270. type cbx_yl from w_publ_easyq`cbx_yl within w_mtrldef_edit_dftsaleprice
  271. integer x = 1573
  272. integer y = 52
  273. end type
  274. type dw_1 from w_publ_easyq`dw_1 within w_mtrldef_edit_dftsaleprice
  275. integer x = 855
  276. integer y = 184
  277. integer width = 2656
  278. integer height = 1740
  279. string dataobject = "dw_mtrldef_edit_dftprice"
  280. boolean setcolumn_visible_use = false
  281. end type
  282. event dw_1::rowfocuschanged;IF currentrow <=0 THEN RETURN
  283. this.selectrow(0,false)
  284. this.selectrow(currentrow,true)
  285. end event
  286. event dw_1::clicked;call super::clicked;IF row <=0 THEN RETURN
  287. this.selectrow(0,false)
  288. this.selectrow(row,true)
  289. end event
  290. type sle_mtrl from w_publ_easyq`sle_mtrl within w_mtrldef_edit_dftsaleprice
  291. end type
  292. type sle_cust from w_publ_easyq`sle_cust within w_mtrldef_edit_dftsaleprice
  293. end type
  294. type st_mtrl from w_publ_easyq`st_mtrl within w_mtrldef_edit_dftsaleprice
  295. end type
  296. type st_cust from w_publ_easyq`st_cust within w_mtrldef_edit_dftsaleprice
  297. end type
  298. type cbx_loginretr from w_publ_easyq`cbx_loginretr within w_mtrldef_edit_dftsaleprice
  299. integer x = 1829
  300. integer y = 56
  301. end type
  302. type pb_em1 from w_publ_easyq`pb_em1 within w_mtrldef_edit_dftsaleprice
  303. end type
  304. type pb_em2 from w_publ_easyq`pb_em2 within w_mtrldef_edit_dftsaleprice
  305. boolean visible = false
  306. end type
  307. type pb_2 from w_publ_easyq`pb_2 within w_mtrldef_edit_dftsaleprice
  308. boolean visible = false
  309. end type
  310. type cb_help from w_publ_easyq`cb_help within w_mtrldef_edit_dftsaleprice
  311. integer x = 859
  312. end type
  313. type cb_copyself from w_publ_easyq`cb_copyself within w_mtrldef_edit_dftsaleprice
  314. integer x = 453
  315. end type
  316. type gb_1 from w_publ_easyq`gb_1 within w_mtrldef_edit_dftsaleprice
  317. end type
  318. type ln_bar from w_publ_easyq`ln_bar within w_mtrldef_edit_dftsaleprice
  319. end type
  320. type ln_bar2 from w_publ_easyq`ln_bar2 within w_mtrldef_edit_dftsaleprice
  321. end type
  322. type r_bar from w_publ_easyq`r_bar within w_mtrldef_edit_dftsaleprice
  323. end type
  324. type ln_1 from w_publ_easyq`ln_1 within w_mtrldef_edit_dftsaleprice
  325. boolean visible = false
  326. end type
  327. type ln_2 from w_publ_easyq`ln_2 within w_mtrldef_edit_dftsaleprice
  328. boolean visible = false
  329. end type
  330. type ln_3 from w_publ_easyq`ln_3 within w_mtrldef_edit_dftsaleprice
  331. end type
  332. type ln_4 from w_publ_easyq`ln_4 within w_mtrldef_edit_dftsaleprice
  333. end type
  334. type cb_save from uo_imflatbutton within w_mtrldef_edit_dftsaleprice
  335. integer x = 151
  336. integer width = 151
  337. integer height = 164
  338. integer taborder = 20
  339. boolean bringtotop = true
  340. string text = "修改"
  341. string normalpicname = "save.bmp"
  342. integer picsize = 16
  343. toolbaralignment pic_align = alignattop!
  344. boolean border = false
  345. end type
  346. event clicked;call super::clicked;IF NOT f_power_ind(964) THEN
  347. MessageBox('提示','你没有使用权限!', Information!, OK! )
  348. RETURN
  349. END IF
  350. string ls_msg
  351. IF dw_edit_mode THEN
  352. dw_1.SetFilter('')
  353. dw_1.Filter()
  354. dw_1.AcceptText()
  355. IF wf_save(ls_msg,TRUE) = 1 THEN
  356. f_setsysoplog('录入','录入价格,整体列表模式',ls_msg,TRUE)
  357. MessageBox('提示','保存成功!', Information!, OK! )
  358. ELSE
  359. MessageBox('提示','保存失败!原因:'+ls_msg, Information!, OK! )
  360. END IF
  361. END IF
  362. dw_edit_mode = NOT dw_edit_mode
  363. dw_1.ResetUpdate()
  364. IF NOT dw_edit_mode THEN
  365. cb_1.TriggerEvent(Clicked!)
  366. END IF
  367. wf_refresh_face()
  368. end event
  369. type tv_1 from uo_tv_mtrltype within w_mtrldef_edit_dftsaleprice
  370. integer y = 184
  371. integer width = 855
  372. integer height = 1740
  373. integer taborder = 60
  374. boolean bringtotop = true
  375. integer textsize = -9
  376. fontcharset fontcharset = gb2312charset!
  377. fontfamily fontfamily = anyfont!
  378. string facename = "宋体"
  379. end type
  380. event selectionchanged;call super::selectionchanged;cur_handtype = THIS.uo_cur_info.handtype
  381. cur_handtype = cur_handtype + '%'
  382. cb_1.TriggerEvent(Clicked!)
  383. end event
  384. type cb_cancel from uo_imflatbutton within w_mtrldef_edit_dftsaleprice
  385. integer x = 302
  386. integer width = 151
  387. integer height = 164
  388. integer taborder = 50
  389. boolean bringtotop = true
  390. string text = "取消"
  391. string normalpicname = "undo.bmp"
  392. integer picsize = 16
  393. toolbaralignment pic_align = alignattop!
  394. boolean border = false
  395. end type
  396. event clicked;call super::clicked;dw_edit_mode = FALSE
  397. dw_1.SetFilter('')
  398. dw_1.Filter()
  399. cb_1.TriggerEvent(Clicked!)
  400. wf_refresh_face()
  401. end event