w_rp_sale_mx_hc.srw 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. $PBExportHeader$w_rp_sale_mx_hc.srw
  2. forward
  3. global type w_rp_sale_mx_hc from w_publ_easyq
  4. end type
  5. type ddlb_flag from dropdownlistbox within w_rp_sale_mx_hc
  6. end type
  7. type ddlb_1 from uo_ddlb_storageid within w_rp_sale_mx_hc
  8. end type
  9. type st_1 from statictext within w_rp_sale_mx_hc
  10. end type
  11. type st_2 from statictext within w_rp_sale_mx_hc
  12. end type
  13. type ddlb_scid from uo_ddlb_scid within w_rp_sale_mx_hc
  14. end type
  15. type st_5 from statictext within w_rp_sale_mx_hc
  16. end type
  17. type cb_mod from uo_imflatbutton within w_rp_sale_mx_hc
  18. end type
  19. type cb_save from uo_imflatbutton within w_rp_sale_mx_hc
  20. end type
  21. type cb_3 from uo_imflatbutton within w_rp_sale_mx_hc
  22. end type
  23. end forward
  24. global type w_rp_sale_mx_hc from w_publ_easyq
  25. string title = "销售明细表修改成本价"
  26. ddlb_flag ddlb_flag
  27. ddlb_1 ddlb_1
  28. st_1 st_1
  29. st_2 st_2
  30. ddlb_scid ddlb_scid
  31. st_5 st_5
  32. cb_mod cb_mod
  33. cb_save cb_save
  34. cb_3 cb_3
  35. end type
  36. global w_rp_sale_mx_hc w_rp_sale_mx_hc
  37. type variables
  38. Long cur_storageid_arr[]
  39. Long cur_flag = -1 //-1:全部,0仓库未审,1仓库已审核
  40. Long cur_secflag = -1 //-1:全部,0财务未审
  41. long cur_scid_arr[]
  42. long cur_scid
  43. long cur_storageid
  44. end variables
  45. forward prototypes
  46. public function integer wf_dw ()
  47. end prototypes
  48. public function integer wf_dw ();String ls_windowname
  49. ls_windowname = THIS.ClassName ( )
  50. String ls_old_dwname,ls_new_dwname = ''
  51. ls_old_dwname = dw_1.DataObject
  52. ls_new_dwname = f_get_dwprint_dynamic_chname(ls_old_dwname,ls_windowname)
  53. IF ls_new_dwname = '' THEN
  54. ls_new_dwname = ls_old_dwname
  55. END IF
  56. dw_1.DataObject = ls_new_dwname
  57. dw_1.SetTransObject(sqlca)
  58. dw_1.uf_read_profile_layout()
  59. //
  60. f_title_change(dw_1)
  61. RETURN 1
  62. end function
  63. on w_rp_sale_mx_hc.create
  64. int iCurrent
  65. call super::create
  66. this.ddlb_flag=create ddlb_flag
  67. this.ddlb_1=create ddlb_1
  68. this.st_1=create st_1
  69. this.st_2=create st_2
  70. this.ddlb_scid=create ddlb_scid
  71. this.st_5=create st_5
  72. this.cb_mod=create cb_mod
  73. this.cb_save=create cb_save
  74. this.cb_3=create cb_3
  75. iCurrent=UpperBound(this.Control)
  76. this.Control[iCurrent+1]=this.ddlb_flag
  77. this.Control[iCurrent+2]=this.ddlb_1
  78. this.Control[iCurrent+3]=this.st_1
  79. this.Control[iCurrent+4]=this.st_2
  80. this.Control[iCurrent+5]=this.ddlb_scid
  81. this.Control[iCurrent+6]=this.st_5
  82. this.Control[iCurrent+7]=this.cb_mod
  83. this.Control[iCurrent+8]=this.cb_save
  84. this.Control[iCurrent+9]=this.cb_3
  85. end on
  86. on w_rp_sale_mx_hc.destroy
  87. call super::destroy
  88. destroy(this.ddlb_flag)
  89. destroy(this.ddlb_1)
  90. destroy(this.st_1)
  91. destroy(this.st_2)
  92. destroy(this.ddlb_scid)
  93. destroy(this.st_5)
  94. destroy(this.cb_mod)
  95. destroy(this.cb_save)
  96. destroy(this.cb_3)
  97. end on
  98. event ue_before_openretrieve;call super::ue_before_openretrieve;s_hide_col s_col1,s_col2,s_col3
  99. s_col1.col_1 = 'u_outwaremx_costamt'
  100. f_hide_col(490,dw_1,s_col1)
  101. s_col2.col_1 = 'gfamt'
  102. f_hide_col(843,dw_1,s_col2)
  103. s_col3.col_1 = 'u_outwaremx_enprice'
  104. s_col3.col_2 = 'enamt'
  105. s_col3.col_3 = 'fprice'
  106. s_col3.col_4 = 'amt_1'
  107. s_col3.col_5 = 'rebate'
  108. s_col3.col_6 = 'u_outwaremx_dftsaleprice'
  109. s_col3.col_7 = 'u_outwaremx_price'
  110. s_col3.col_8 = 'u_outwaremx_ware_fprice'
  111. s_col3.col_9 = 'ware_amt'
  112. f_hide_col(122,dw_1,s_col3)
  113. s_hide_col s_col_mtrlsectype
  114. s_col_mtrlsectype.col_1 = 'u_mtrldef_mtrlsectype'
  115. f_hide_col(1308,dw_1,s_col_mtrlsectype)
  116. s_hide_col s_col_zxmtrlmode
  117. s_col_zxmtrlmode.col_1 = 'u_mtrldef_zxmtrlmode'
  118. f_hide_col(1309,dw_1,s_col_zxmtrlmode)
  119. end event
  120. type cb_func from w_publ_easyq`cb_func within w_rp_sale_mx_hc
  121. end type
  122. type cb_exit from w_publ_easyq`cb_exit within w_rp_sale_mx_hc
  123. integer x = 1938
  124. end type
  125. type cb_2 from w_publ_easyq`cb_2 within w_rp_sale_mx_hc
  126. integer x = 1637
  127. boolean bringtotop = true
  128. end type
  129. type cb_psetup from w_publ_easyq`cb_psetup within w_rp_sale_mx_hc
  130. integer x = 1381
  131. boolean bringtotop = true
  132. end type
  133. type cb_1 from w_publ_easyq`cb_1 within w_rp_sale_mx_hc
  134. boolean bringtotop = true
  135. end type
  136. event cb_1::clicked;DateTime first_date,end_date
  137. first_date = DateTime(Date(em_1.Text),Time(0))
  138. end_date = DateTime(Date(em_2.Text),Time('23:59:59'))
  139. IF first_date < sys_showsaledata_mindt THEN first_date = sys_showsaledata_mindt
  140. dw_1.Retrieve(cur_scid_arr,first_date,end_date,cur_flag,cur_secflag,cur_storageid_arr,sys_areaid)
  141. end event
  142. type st_3 from w_publ_easyq`st_3 within w_rp_sale_mx_hc
  143. integer x = 2066
  144. end type
  145. type st_4 from w_publ_easyq`st_4 within w_rp_sale_mx_hc
  146. integer x = 2784
  147. end type
  148. type em_1 from w_publ_easyq`em_1 within w_rp_sale_mx_hc
  149. integer x = 2286
  150. integer taborder = 130
  151. end type
  152. type em_2 from w_publ_easyq`em_2 within w_rp_sale_mx_hc
  153. integer x = 2875
  154. integer taborder = 140
  155. end type
  156. type ddlb_yl from w_publ_easyq`ddlb_yl within w_rp_sale_mx_hc
  157. integer x = 2377
  158. integer y = 0
  159. end type
  160. type cbx_yl from w_publ_easyq`cbx_yl within w_rp_sale_mx_hc
  161. integer x = 2167
  162. integer y = 4
  163. end type
  164. type dw_1 from w_publ_easyq`dw_1 within w_rp_sale_mx_hc
  165. integer y = 300
  166. integer width = 3557
  167. integer height = 1376
  168. string dataobject = "dw_rp_sale_mx_hc"
  169. end type
  170. event dw_1::doubleclicked;call super::doubleclicked;IF row > 0 THEN
  171. String ls_code
  172. Long ll_scid
  173. // int li_thflag
  174. ll_scid = THIS.Object.u_outware_scid[row]
  175. ls_code = THIS.Object.u_outware_outwarecode[row]
  176. // li_thflag = THIS.Object.thflag[row]
  177. f_open_win(ll_scid,ls_code)
  178. END IF
  179. end event
  180. event dw_1::clicked;call super::clicked; THIS.SetRow(row)
  181. end event
  182. type sle_mtrl from w_publ_easyq`sle_mtrl within w_rp_sale_mx_hc
  183. end type
  184. type sle_cust from w_publ_easyq`sle_cust within w_rp_sale_mx_hc
  185. end type
  186. type st_mtrl from w_publ_easyq`st_mtrl within w_rp_sale_mx_hc
  187. end type
  188. type st_cust from w_publ_easyq`st_cust within w_rp_sale_mx_hc
  189. end type
  190. type cbx_loginretr from w_publ_easyq`cbx_loginretr within w_rp_sale_mx_hc
  191. boolean visible = true
  192. integer x = 2167
  193. integer y = 96
  194. end type
  195. type pb_em1 from w_publ_easyq`pb_em1 within w_rp_sale_mx_hc
  196. integer x = 2702
  197. end type
  198. type pb_em2 from w_publ_easyq`pb_em2 within w_rp_sale_mx_hc
  199. integer x = 3287
  200. end type
  201. type pb_2 from w_publ_easyq`pb_2 within w_rp_sale_mx_hc
  202. integer x = 3397
  203. end type
  204. type cb_help from w_publ_easyq`cb_help within w_rp_sale_mx_hc
  205. integer x = 1787
  206. end type
  207. type cb_copyself from w_publ_easyq`cb_copyself within w_rp_sale_mx_hc
  208. integer x = 1125
  209. end type
  210. type gb_1 from w_publ_easyq`gb_1 within w_rp_sale_mx_hc
  211. end type
  212. type ln_bar from w_publ_easyq`ln_bar within w_rp_sale_mx_hc
  213. end type
  214. type ln_bar2 from w_publ_easyq`ln_bar2 within w_rp_sale_mx_hc
  215. end type
  216. type r_bar from w_publ_easyq`r_bar within w_rp_sale_mx_hc
  217. end type
  218. type ln_1 from w_publ_easyq`ln_1 within w_rp_sale_mx_hc
  219. end type
  220. type ln_2 from w_publ_easyq`ln_2 within w_rp_sale_mx_hc
  221. end type
  222. type ln_3 from w_publ_easyq`ln_3 within w_rp_sale_mx_hc
  223. end type
  224. type ln_4 from w_publ_easyq`ln_4 within w_rp_sale_mx_hc
  225. end type
  226. type ddlb_flag from dropdownlistbox within w_rp_sale_mx_hc
  227. integer x = 1669
  228. integer y = 200
  229. integer width = 379
  230. integer height = 484
  231. integer taborder = 90
  232. boolean bringtotop = true
  233. integer textsize = -9
  234. integer weight = 400
  235. fontcharset fontcharset = gb2312charset!
  236. fontpitch fontpitch = variable!
  237. string facename = "宋体"
  238. long textcolor = 33554432
  239. string text = "[全部]"
  240. boolean sorted = false
  241. boolean vscrollbar = true
  242. string item[] = {"[全部]","待仓库审核","待财务审核","审核完毕"}
  243. borderstyle borderstyle = stylelowered!
  244. end type
  245. event selectionchanged;if index=1 then
  246. cur_flag=-1
  247. cur_secflag= -1
  248. elseif index=2 then
  249. cur_flag= 0
  250. cur_secflag= -1
  251. elseif index=3 then
  252. cur_flag= 1
  253. cur_secflag= 0
  254. elseif index=4 then
  255. cur_flag= 1
  256. cur_secflag= 1
  257. end if
  258. cb_1.triggerevent(clicked!)
  259. end event
  260. type ddlb_1 from uo_ddlb_storageid within w_rp_sale_mx_hc
  261. integer x = 814
  262. integer y = 200
  263. integer width = 681
  264. integer height = 1108
  265. integer taborder = 140
  266. boolean bringtotop = true
  267. end type
  268. event constructor;Long ls_storageid
  269. String ls_storagename
  270. Long cnt = 0
  271. Long ll_i
  272. String ls_space
  273. Int li_spacenum
  274. FOR ll_i = 1 TO UpperBound(sys_user_storageid)
  275. ls_storageid = sys_user_storageid[ll_i]
  276. SELECT storagename
  277. INTO :ls_storagename
  278. FROM u_storage
  279. Where storageid = :ls_storageid;
  280. IF sqlca.SQLCode <> 0 OR IsNull(ls_storagename) THEN ls_storagename = ''
  281. li_spacenum = 50 - Len(Trim(ls_storagename)) - 2 - Len(String(ls_storageid))
  282. ls_space = Fill(' ',li_spacenum)
  283. THIS.AddItem (ls_storagename+ls_space+'['+String(ls_storageid)+']')
  284. NEXT
  285. THIS.uo_storageid = ls_storageid
  286. uo_storageid_arr[1] = ls_storageid
  287. THIS.Text = ls_storagename+ls_space+'['+String(ls_storageid)+']'
  288. //THIS.Text = '[全部]'
  289. //uo_storageid = -1
  290. //uo_storageid_arr = sys_user_storageid
  291. //
  292. uf_get_storageid_arr(ls_storageid)
  293. cur_storageid_arr = this.uo_storageid_arr
  294. cur_storageid = this.uo_storageid_arr[1]
  295. end event
  296. event selectionchanged;call super::selectionchanged;cur_storageid_arr = this.uo_storageid_arr
  297. cur_storageid = this.uo_storageid_arr[1]
  298. cb_1.triggerevent(clicked!)
  299. end event
  300. type st_1 from statictext within w_rp_sale_mx_hc
  301. integer x = 654
  302. integer y = 208
  303. integer width = 146
  304. integer height = 48
  305. boolean bringtotop = true
  306. integer textsize = -9
  307. integer weight = 400
  308. fontcharset fontcharset = gb2312charset!
  309. fontpitch fontpitch = variable!
  310. string facename = "宋体"
  311. long textcolor = 33554432
  312. long backcolor = 134217739
  313. string text = "仓库"
  314. alignment alignment = right!
  315. boolean focusrectangle = false
  316. end type
  317. type st_2 from statictext within w_rp_sale_mx_hc
  318. integer x = 1527
  319. integer y = 212
  320. integer width = 128
  321. integer height = 48
  322. boolean bringtotop = true
  323. integer textsize = -9
  324. integer weight = 400
  325. fontcharset fontcharset = gb2312charset!
  326. fontpitch fontpitch = variable!
  327. string facename = "宋体"
  328. long textcolor = 33554432
  329. long backcolor = 134217739
  330. string text = "状态"
  331. alignment alignment = right!
  332. boolean focusrectangle = false
  333. end type
  334. type ddlb_scid from uo_ddlb_scid within w_rp_sale_mx_hc
  335. integer x = 142
  336. integer y = 200
  337. integer width = 480
  338. integer height = 620
  339. integer taborder = 130
  340. boolean bringtotop = true
  341. end type
  342. event constructor;
  343. Long ls_scid
  344. Long cnt = 0
  345. String ls_scname
  346. long ll_i
  347. string ls_space
  348. int li_spacenum
  349. for ll_i =1 to upperbound(sys_user_scid)
  350. ls_scid = sys_user_scid[ll_i]
  351. SELECT scname
  352. INTO :ls_scname
  353. FROM u_scdef
  354. Where scid = :ls_scid;
  355. if sqlca.sqlcode <> 0 or isnull(ls_scname) then ls_scname = ''
  356. li_spacenum = 50 - len(trim(ls_scname)) - 2 - len(string(ls_scid))
  357. ls_space = fill(' ',li_spacenum)
  358. THIS.AddItem (ls_scname+ls_space+'['+String(ls_scid)+']')
  359. next
  360. THIS.uo_scid = ls_scid
  361. uo_scid_arr[1] = ls_scid
  362. THIS.Text = ls_scname+ls_space+'['+String(ls_scid)+']'
  363. SELECT count(*) INTO :cnt FROM u_scdef ;
  364. cur_scid_arr = THIS.uo_scid_arr
  365. cur_scid = THIS.uo_scid_arr[1]
  366. end event
  367. event selectionchanged;call super::selectionchanged;
  368. cur_scid_arr = THIS.uo_scid_arr
  369. cur_scid = THIS.uo_scid_arr[1]
  370. cb_1.triggerevent(clicked!)
  371. end event
  372. type st_5 from statictext within w_rp_sale_mx_hc
  373. integer x = 5
  374. integer y = 208
  375. integer width = 128
  376. integer height = 48
  377. boolean bringtotop = true
  378. integer textsize = -9
  379. integer weight = 400
  380. fontcharset fontcharset = gb2312charset!
  381. fontpitch fontpitch = variable!
  382. string facename = "宋体"
  383. long textcolor = 33554432
  384. long backcolor = 134217739
  385. string text = "分部"
  386. alignment alignment = right!
  387. boolean focusrectangle = false
  388. end type
  389. type cb_mod from uo_imflatbutton within w_rp_sale_mx_hc
  390. integer x = 302
  391. integer width = 165
  392. integer height = 164
  393. integer taborder = 80
  394. boolean bringtotop = true
  395. string text = "修改"
  396. string normalpicname = "open.bmp"
  397. integer picsize = 16
  398. toolbaralignment pic_align = alignattop!
  399. boolean border = false
  400. end type
  401. event clicked;call super::clicked;dw_edit_mode = NOT dw_edit_mode
  402. IF dw_edit_mode THEN
  403. dw_1.SetTabOrder('cost',10)
  404. cb_mod.Text = "放弃"
  405. cb_save.Enabled = TRUE
  406. ELSE
  407. dw_1.SetTabOrder('cost',0)
  408. cb_mod.Text = "修改"
  409. cb_save.Enabled = FALSE
  410. END IF
  411. cb_mod.TriggerEvent('ue_textchange')
  412. end event
  413. type cb_save from uo_imflatbutton within w_rp_sale_mx_hc
  414. integer x = 466
  415. integer width = 165
  416. integer height = 164
  417. integer taborder = 20
  418. boolean bringtotop = true
  419. boolean enabled = false
  420. string text = "保存"
  421. string normalpicname = "save.bmp"
  422. integer picsize = 16
  423. toolbaralignment pic_align = alignattop!
  424. boolean border = false
  425. end type
  426. event clicked;call super::clicked;///////// //
  427. Long NbrRows,ll_row
  428. Long scid,outwareid,printid
  429. Decimal qty,cost
  430. dw_1.AcceptText()
  431. NbrRows = dw_1.RowCount()
  432. DO WHILE ll_row <= NbrRows
  433. ll_row = dw_1.GetNextModified(ll_row, Primary!)
  434. IF ll_row > 0 THEN
  435. scid = dw_1.Object.u_outware_scid[ll_row]
  436. outwareid = dw_1.Object.u_outware_outwareid[ll_row]
  437. printid = dw_1.Object.u_outwaremx_printid[ll_row]
  438. qty = dw_1.Object.u_outwaremx_qty[ll_row]
  439. cost = dw_1.Object.cost[ll_row]
  440. UPDATE u_outwaremx
  441. SET costamt = :cost * :qty
  442. WHERE scid = :scid AND
  443. outwareid = :outwareid AND
  444. printid = :printid;
  445. IF sqlca.SQLCode <> 0 THEN
  446. ROLLBACK;
  447. MessageBox('错误','保存失败')
  448. RETURN
  449. END IF
  450. ELSE
  451. ll_row = NbrRows + 1
  452. END IF
  453. LOOP
  454. COMMIT;
  455. dw_edit_mode = NOT dw_edit_mode
  456. dw_1.SetTabOrder('cost',0)
  457. cb_mod.Text = "修改"
  458. cb_save.Enabled = FALSE
  459. cb_mod.TriggerEvent('ue_textchange')
  460. MessageBox('提示','保存成功')
  461. end event
  462. type cb_3 from uo_imflatbutton within w_rp_sale_mx_hc
  463. integer x = 631
  464. integer width = 494
  465. integer height = 164
  466. integer taborder = 90
  467. boolean bringtotop = true
  468. string text = "调用成本价调整单"
  469. boolean border = false
  470. end type
  471. event clicked;call super::clicked;s_edit_index_tran s_tran //传递参数使用
  472. s_mtrlware_noalloc_array S_INSCUST
  473. Long it_mx,i
  474. dw_1.AcceptText()
  475. FOR i = 1 TO dw_1.RowCount()
  476. IF dw_1.Object.ch[i] = 1 THEN
  477. it_mx++
  478. S_INSCUST.mtrlwareid[it_mx] = dw_1.Object.u_outwaremx_mtrlwareid[i]
  479. S_INSCUST.mtrlid[it_mx] = dw_1.Object.u_outwaremx_mtrlid[i]
  480. S_INSCUST.u_mtrldef_mtrlcode[it_mx] = dw_1.Object.u_mtrldef_mtrlcode[i]
  481. S_INSCUST.u_mtrldef_mtrlname[it_mx] = dw_1.Object.u_mtrldef_mtrlname[i]
  482. S_INSCUST.u_mtrldef_mtrlmode[it_mx] = dw_1.Object.u_mtrldef_mtrlmode[i]
  483. S_INSCUST.u_mtrldef_unit[it_mx] = dw_1.Object.u_mtrldef_unit[i]
  484. S_INSCUST.noallocqty[it_mx] = dw_1.Object.u_mtrlware_noallocqty[i]
  485. S_INSCUST.cost[it_mx] = dw_1.Object.u_mtrlware_cost[i]
  486. S_INSCUST.planprice[it_mx] = dw_1.Object.u_mtrlware_planprice[i]
  487. S_INSCUST.plancode[it_mx] = dw_1.Object.u_mtrlware_plancode[i]
  488. S_INSCUST.status[it_mx] = dw_1.Object.u_outwaremx_status[i]
  489. S_INSCUST.woodcode[it_mx] = dw_1.Object.u_outwaremx_woodcode[i]
  490. S_INSCUST.pcode[it_mx] = dw_1.Object.u_outwaremx_pcode[i]
  491. S_INSCUST.u_mtrldef_zxmtrlmode[it_mx] = dw_1.Object.u_mtrldef_zxmtrlmode[i]
  492. S_INSCUST.u_mtrldef_mtrlsectype[it_mx] = dw_1.Object.u_mtrldef_mtrlsectype[i]
  493. S_INSCUST.sptname[it_mx] = dw_1.Object.sptname[i]
  494. S_INSCUST.sptcode[it_mx] = dw_1.Object.sptcode[i]
  495. S_INSCUST.scid[it_mx] = cur_scid
  496. S_INSCUST.storageid[it_mx] = cur_storageid
  497. END IF
  498. NEXT
  499. if it_mx = 0 then return
  500. OpenWithParm(w_update_cost,s_tran)
  501. w_update_cost.wf_auto_addmx(S_INSCUST)
  502. end event