w_rp_sc_workpricetable.srw 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  1. $PBExportHeader$w_rp_sc_workpricetable.srw
  2. forward
  3. global type w_rp_sc_workpricetable from w_publ_easyq
  4. end type
  5. type tv_1 from uo_tv_mtrltype within w_rp_sc_workpricetable
  6. end type
  7. type st_1 from statictext within w_rp_sc_workpricetable
  8. end type
  9. type ddlb_mtrlorigin from uo_ddlb_mtrlorigin within w_rp_sc_workpricetable
  10. end type
  11. type ddlb_mtrlprp from uo_ddlb_mtrlprp within w_rp_sc_workpricetable
  12. end type
  13. type ddlb_status from dropdownlistbox within w_rp_sc_workpricetable
  14. end type
  15. type ddlb_1 from dropdownlistbox within w_rp_sc_workpricetable
  16. end type
  17. end forward
  18. global type w_rp_sc_workpricetable from w_publ_easyq
  19. integer width = 3538
  20. integer height = 2096
  21. string title = "物料工价统计表"
  22. tv_1 tv_1
  23. st_1 st_1
  24. ddlb_mtrlorigin ddlb_mtrlorigin
  25. ddlb_mtrlprp ddlb_mtrlprp
  26. ddlb_status ddlb_status
  27. ddlb_1 ddlb_1
  28. end type
  29. global w_rp_sc_workpricetable w_rp_sc_workpricetable
  30. type variables
  31. Long cur_flag = -1
  32. String ls_handtype = ''
  33. int cur_mtrlorigin=-1
  34. long cur_mtrlprp=-1
  35. end variables
  36. forward prototypes
  37. public subroutine wf_insert ()
  38. end prototypes
  39. public subroutine wf_insert ();Long i,j,ll_ds_cnt,itemid[]
  40. String ls_s,Name[],ls_m,dd_name[]
  41. Long col = 50
  42. String ls_modify
  43. Long ls_mtrlid_arr[]
  44. Long ll_mxbt,ll_i
  45. Long ll_ddd_cnt
  46. Long z
  47. String ls_outwarecode
  48. String tp_name
  49. Long tp_itemid
  50. Decimal ld_amt,ld_billamt,ld_otheramt,ld_amt_real
  51. Decimal ld_bill_amt,ld_costamt,ld_gpamt
  52. If dw_1.RowCount() <= 0 Then Return
  53. //====================================================================
  54. //设置标题
  55. //====================================================================
  56. String ls_temp = ''
  57. String ls_long = ''
  58. dw_1.SetRedraw(False)
  59. datastore ds
  60. ds = Create datastore
  61. ds.DataObject = "ds_sc_proname_list"
  62. ds.SetTransObject(sqlca)
  63. datastore ddd
  64. ddd = Create datastore
  65. ddd.DataObject = "ddd_sc_proname"
  66. ddd.SetTransObject(sqlca)
  67. //刷新ds
  68. For ll_i = 1 To dw_1.RowCount()
  69. ll_mxbt++
  70. ls_mtrlid_arr[ll_mxbt] = dw_1.Object.u_mtrldef_mtrlid[ll_i]
  71. Next
  72. If ll_mxbt = 0 Then
  73. ll_mxbt++
  74. ls_mtrlid_arr[ll_mxbt] = 0
  75. End If
  76. ll_ds_cnt = ds.Retrieve(ls_mtrlid_arr)
  77. ll_ddd_cnt = ddd.Retrieve(ls_mtrlid_arr)
  78. If ll_ddd_cnt > col Then
  79. ll_ddd_cnt = col
  80. End If
  81. For i = 1 To ll_ds_cnt
  82. itemid[i] = Long(ds.Object.mtrlid[i])
  83. Name[i] = String(ds.Object.Name[i])
  84. Next
  85. For i = 1 To ll_ddd_cnt
  86. dd_name[i] = String(ddd.Object.Name[i])
  87. Next
  88. //设置可见工序
  89. For j = 1 To col
  90. ls_s = "workprice"+String(j)
  91. dw_1.Modify(ls_s + '.Visible = 1')
  92. dw_1.Modify(ls_s+".format=~"#,##0.##~~tIF("+ls_s+"=0,'#','#,##0.##')~"")
  93. Next
  94. //设置标题
  95. For j = 1 To ll_ddd_cnt
  96. ls_long = String(Long(Len( dd_name[j]) / 4) * 400 )
  97. If Long(ls_long) < 400 Then ls_long = '400'
  98. ls_temp = 'workprice' + String(j)
  99. dw_1.Modify(ls_temp + '.width = ' + ls_long)
  100. dw_1.Modify(ls_temp +"_t.text = '" +dd_name[j]+ "'")
  101. Next
  102. //隐藏其他
  103. For j = ll_ddd_cnt + 1 To col
  104. ls_modify = ''
  105. ls_s = "workprice" + String(j)
  106. dw_1.Modify(ls_s + '.Visible = 0')
  107. ls_modify = ls_modify + ls_s + '.visible=0 ~n '
  108. dw_1.Modify(ls_modify)
  109. Next
  110. //====================================================================
  111. //插入数据
  112. //====================================================================
  113. If dw_1.RowCount() <= 0 Then Goto ext
  114. Long ll_mtrlid
  115. Int li_column_count, q
  116. String ls_column_name,ls_column_text
  117. li_column_count = Long(dw_1.Describe("DataWindow.Column.Count"))
  118. For z = 1 To dw_1.RowCount()
  119. ll_mtrlid = dw_1.Object.u_mtrldef_mtrlid[z]
  120. For i = 1 To ll_ds_cnt
  121. tp_itemid = itemid[i]
  122. tp_name = Name[i]
  123. If tp_itemid = ll_mtrlid Then
  124. For q = 1 To li_column_count //根据已合并的列名进行赋值
  125. ls_column_name = dw_1.Describe("#" + String(q) +".name")
  126. ls_column_text = dw_1.Describe(ls_column_name + "_t.text")
  127. If tp_name = ls_column_text Then
  128. dw_1.SetItem(z,q,String(ds.Object.workprice[i],'#,##0.00'))
  129. End If
  130. Next
  131. End If
  132. Next
  133. Next
  134. ext:
  135. Destroy ds
  136. Destroy ddd
  137. dw_1.SetRedraw(True)
  138. end subroutine
  139. on w_rp_sc_workpricetable.create
  140. int iCurrent
  141. call super::create
  142. this.tv_1=create tv_1
  143. this.st_1=create st_1
  144. this.ddlb_mtrlorigin=create ddlb_mtrlorigin
  145. this.ddlb_mtrlprp=create ddlb_mtrlprp
  146. this.ddlb_status=create ddlb_status
  147. this.ddlb_1=create ddlb_1
  148. iCurrent=UpperBound(this.Control)
  149. this.Control[iCurrent+1]=this.tv_1
  150. this.Control[iCurrent+2]=this.st_1
  151. this.Control[iCurrent+3]=this.ddlb_mtrlorigin
  152. this.Control[iCurrent+4]=this.ddlb_mtrlprp
  153. this.Control[iCurrent+5]=this.ddlb_status
  154. this.Control[iCurrent+6]=this.ddlb_1
  155. end on
  156. on w_rp_sc_workpricetable.destroy
  157. call super::destroy
  158. destroy(this.tv_1)
  159. destroy(this.st_1)
  160. destroy(this.ddlb_mtrlorigin)
  161. destroy(this.ddlb_mtrlprp)
  162. destroy(this.ddlb_status)
  163. destroy(this.ddlb_1)
  164. end on
  165. event resize;call super::resize;tv_1.height=this.height - dw_1.y - 115
  166. end event
  167. event ue_before_openretrieve;call super::ue_before_openretrieve;s_hide_col s_col1,s_col2
  168. s_col1.col_1 = 'costamt'
  169. f_hide_col(490,dw_1,s_col1)
  170. s_col2.col_1 = 'grossprofit'
  171. f_hide_col(843,dw_1,s_col2)
  172. s_hide_col s_col_mtrlsectype
  173. s_col_mtrlsectype.col_1 = 'u_mtrldef_mtrlsectype'
  174. f_hide_col(1308,dw_1,s_col_mtrlsectype)
  175. s_hide_col s_col_zxmtrlmode
  176. s_col_zxmtrlmode.col_1 = 'u_mtrldef_zxmtrlmode'
  177. f_hide_col(1309,dw_1,s_col_zxmtrlmode)
  178. end event
  179. event open;dw_1.SetTransObject (sqlca)
  180. dw_1.RBUTTON_FILTER_USE = True //右键查询功能开关
  181. IF dw_1.Describe("DataWindow.Objects") = "" THEN dw_1.DataObject = ''
  182. IF Trim(dw_1.DataObject) <> '' THEN
  183. dw_1.Object.DataWindow.Print.MARGIN.Top = Integer(f_ProfileString(sys_empid,dw_1.DataObject, "MARGIN_TOP", "110"))
  184. dw_1.Object.DataWindow.Print.MARGIN.Left = Integer(f_ProfileString(sys_empid,dw_1.DataObject, "MARGIN_LEFT", "96" ))
  185. dw_1.Object.DataWindow.Print.MARGIN.bottom = Integer(f_ProfileString(sys_empid,dw_1.DataObject, "MARGIN_BOTTOM", "110"))
  186. dw_1.Object.DataWindow.Print.MARGIN.Right = Integer(f_ProfileString(sys_empid,dw_1.DataObject, "MARGIN_RIGHT", "96" ))
  187. END IF
  188. This.TriggerEvent('ue_before_openretrieve')
  189. IF cbx_loginretr.Checked THEN
  190. cb_1.TriggerEvent(Clicked!)
  191. END IF
  192. end event
  193. type cb_func from w_publ_easyq`cb_func within w_rp_sc_workpricetable
  194. end type
  195. type cb_exit from w_publ_easyq`cb_exit within w_rp_sc_workpricetable
  196. end type
  197. type cb_2 from w_publ_easyq`cb_2 within w_rp_sc_workpricetable
  198. boolean bringtotop = true
  199. end type
  200. type cb_psetup from w_publ_easyq`cb_psetup within w_rp_sc_workpricetable
  201. boolean bringtotop = true
  202. end type
  203. type cb_1 from w_publ_easyq`cb_1 within w_rp_sc_workpricetable
  204. boolean bringtotop = true
  205. end type
  206. event cb_1::clicked;If dw_1.DataObject = 'dw_rp_sc_workpricetable_mx_2' Then
  207. dw_1.Retrieve(cur_mtrlorigin,cur_mtrlprp,cur_flag,ls_handtype)
  208. wf_insert()
  209. Else
  210. dw_1.Retrieve(cur_mtrlorigin,cur_mtrlprp,cur_flag,ls_handtype)
  211. End If
  212. end event
  213. type st_3 from w_publ_easyq`st_3 within w_rp_sc_workpricetable
  214. boolean visible = false
  215. integer x = 1701
  216. integer y = 212
  217. end type
  218. type st_4 from w_publ_easyq`st_4 within w_rp_sc_workpricetable
  219. boolean visible = false
  220. integer x = 2405
  221. integer y = 212
  222. end type
  223. type em_1 from w_publ_easyq`em_1 within w_rp_sc_workpricetable
  224. boolean visible = false
  225. integer x = 1893
  226. integer taborder = 110
  227. end type
  228. type em_2 from w_publ_easyq`em_2 within w_rp_sc_workpricetable
  229. boolean visible = false
  230. integer x = 2505
  231. integer taborder = 120
  232. end type
  233. type ddlb_yl from w_publ_easyq`ddlb_yl within w_rp_sc_workpricetable
  234. integer x = 1637
  235. integer y = 0
  236. end type
  237. type cbx_yl from w_publ_easyq`cbx_yl within w_rp_sc_workpricetable
  238. integer x = 1426
  239. integer y = 4
  240. end type
  241. type dw_1 from w_publ_easyq`dw_1 within w_rp_sc_workpricetable
  242. integer x = 768
  243. integer y = 300
  244. integer width = 2048
  245. integer height = 1088
  246. string dataobject = "dw_rp_sc_workpricetable_mx"
  247. end type
  248. type sle_mtrl from w_publ_easyq`sle_mtrl within w_rp_sc_workpricetable
  249. end type
  250. type sle_cust from w_publ_easyq`sle_cust within w_rp_sc_workpricetable
  251. end type
  252. type st_mtrl from w_publ_easyq`st_mtrl within w_rp_sc_workpricetable
  253. end type
  254. type st_cust from w_publ_easyq`st_cust within w_rp_sc_workpricetable
  255. end type
  256. type cbx_loginretr from w_publ_easyq`cbx_loginretr within w_rp_sc_workpricetable
  257. boolean visible = true
  258. integer x = 1426
  259. integer y = 100
  260. end type
  261. type pb_em1 from w_publ_easyq`pb_em1 within w_rp_sc_workpricetable
  262. boolean visible = false
  263. integer x = 2309
  264. integer y = 184
  265. end type
  266. type pb_em2 from w_publ_easyq`pb_em2 within w_rp_sc_workpricetable
  267. boolean visible = false
  268. integer x = 2917
  269. integer y = 184
  270. end type
  271. type pb_2 from w_publ_easyq`pb_2 within w_rp_sc_workpricetable
  272. boolean visible = false
  273. integer x = 3026
  274. integer y = 184
  275. end type
  276. type cb_help from w_publ_easyq`cb_help within w_rp_sc_workpricetable
  277. end type
  278. type cb_copyself from w_publ_easyq`cb_copyself within w_rp_sc_workpricetable
  279. end type
  280. type gb_1 from w_publ_easyq`gb_1 within w_rp_sc_workpricetable
  281. end type
  282. type ln_bar from w_publ_easyq`ln_bar within w_rp_sc_workpricetable
  283. end type
  284. type ln_bar2 from w_publ_easyq`ln_bar2 within w_rp_sc_workpricetable
  285. end type
  286. type r_bar from w_publ_easyq`r_bar within w_rp_sc_workpricetable
  287. end type
  288. type ln_1 from w_publ_easyq`ln_1 within w_rp_sc_workpricetable
  289. end type
  290. type ln_2 from w_publ_easyq`ln_2 within w_rp_sc_workpricetable
  291. end type
  292. type ln_3 from w_publ_easyq`ln_3 within w_rp_sc_workpricetable
  293. end type
  294. type ln_4 from w_publ_easyq`ln_4 within w_rp_sc_workpricetable
  295. end type
  296. type tv_1 from uo_tv_mtrltype within w_rp_sc_workpricetable
  297. integer y = 300
  298. integer width = 768
  299. integer height = 1120
  300. integer taborder = 70
  301. boolean bringtotop = true
  302. integer textsize = -9
  303. fontcharset fontcharset = gb2312charset!
  304. fontfamily fontfamily = anyfont!
  305. string facename = "宋体"
  306. end type
  307. event selectionchanged;call super::selectionchanged;ls_handtype = THIS.uo_cur_info.handtype
  308. ls_handtype = ls_handtype + '%'
  309. cb_1.triggerevent(clicked!)
  310. end event
  311. type st_1 from statictext within w_rp_sc_workpricetable
  312. integer y = 208
  313. integer width = 151
  314. integer height = 48
  315. boolean bringtotop = true
  316. integer textsize = -9
  317. integer weight = 400
  318. fontcharset fontcharset = gb2312charset!
  319. fontpitch fontpitch = variable!
  320. string facename = "宋体"
  321. long textcolor = 33554432
  322. long backcolor = 134217739
  323. string text = "来 源"
  324. alignment alignment = right!
  325. boolean focusrectangle = false
  326. end type
  327. type ddlb_mtrlorigin from uo_ddlb_mtrlorigin within w_rp_sc_workpricetable
  328. integer x = 160
  329. integer y = 192
  330. integer width = 471
  331. integer height = 480
  332. integer taborder = 120
  333. boolean bringtotop = true
  334. string text = "全部[-1]"
  335. end type
  336. event selectionchanged;call super::selectionchanged;cur_mtrlorigin = THIS.uo_mtrlorigin
  337. cb_1.triggerevent(clicked!)
  338. end event
  339. type ddlb_mtrlprp from uo_ddlb_mtrlprp within w_rp_sc_workpricetable
  340. integer x = 649
  341. integer y = 192
  342. integer width = 379
  343. integer taborder = 120
  344. boolean bringtotop = true
  345. end type
  346. event selectionchanged;call super::selectionchanged;cur_mtrlprp = THIS.uo_mtrlprp
  347. cb_1.triggerevent(clicked!)
  348. end event
  349. type ddlb_status from dropdownlistbox within w_rp_sc_workpricetable
  350. integer x = 1051
  351. integer y = 192
  352. integer width = 306
  353. integer height = 468
  354. integer taborder = 130
  355. boolean bringtotop = true
  356. integer textsize = -9
  357. integer weight = 400
  358. fontcharset fontcharset = gb2312charset!
  359. fontpitch fontpitch = variable!
  360. string facename = "宋体"
  361. long textcolor = 33554432
  362. string text = "[全部]"
  363. boolean sorted = false
  364. string item[] = {"[全部]","未审核","审核完毕"}
  365. borderstyle borderstyle = stylelowered!
  366. end type
  367. event selectionchanged;IF Index = 1 THEN
  368. cur_flag = -1
  369. ELSEIF Index = 2 THEN
  370. cur_flag = 0
  371. ELSEIF Index = 3 THEN
  372. cur_flag = 1
  373. END IF
  374. cb_1.triggerevent(clicked!)
  375. end event
  376. type ddlb_1 from dropdownlistbox within w_rp_sc_workpricetable
  377. integer x = 2007
  378. integer y = 88
  379. integer width = 736
  380. integer height = 300
  381. integer taborder = 80
  382. boolean bringtotop = true
  383. integer textsize = -9
  384. integer weight = 400
  385. fontcharset fontcharset = gb2312charset!
  386. fontpitch fontpitch = variable!
  387. string facename = "宋体"
  388. long textcolor = 33554432
  389. string text = "默认格式"
  390. string item[] = {"默认格式","按物料横向列出工序"}
  391. borderstyle borderstyle = stylelowered!
  392. end type
  393. event selectionchanged;If This.Text = '默认格式' Then
  394. dw_1.DataObject = 'dw_rp_sc_workpricetable_mx'
  395. Else
  396. dw_1.DataObject = 'dw_rp_sc_workpricetable_mx_2'
  397. End If
  398. dw_1.SetTransObject (sqlca)
  399. cb_1.TriggerEvent(Clicked!)
  400. end event
  401. event constructor;If This.Text = '默认格式' Then
  402. dw_1.DataObject = 'dw_rp_sc_workpricetable_mx'
  403. Else
  404. dw_1.DataObject = 'dw_rp_sc_workpricetable_mx_2'
  405. End If
  406. end event