w_rp_prdpftable.srw 11 KB

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