w_warebalc_view.srw 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762
  1. $PBExportHeader$w_warebalc_view.srw
  2. forward
  3. global type w_warebalc_view from w_publ_easyq
  4. end type
  5. type tv_1 from uo_tv_mtrltype within w_warebalc_view
  6. end type
  7. type st_2 from statictext within w_warebalc_view
  8. end type
  9. type ddlb_storageid from uo_ddlb_storageid within w_warebalc_view
  10. end type
  11. type cb_other from uo_imflatbutton within w_warebalc_view
  12. end type
  13. type st_1 from statictext within w_warebalc_view
  14. end type
  15. type em_month from editmask within w_warebalc_view
  16. end type
  17. type st_lastbalcdate from statictext within w_warebalc_view
  18. end type
  19. type ddlb_1 from dropdownlistbox within w_warebalc_view
  20. end type
  21. type cb_balc from uo_imflatbutton within w_warebalc_view
  22. end type
  23. end forward
  24. global type w_warebalc_view from w_publ_easyq
  25. string title = "仓库结存表"
  26. event ue_retrieve_info ( )
  27. event retrieve_pageretr ( )
  28. event ue_mtrl_info ( )
  29. event ue_retrieve_inoutmx ( )
  30. event ue_usual_query_filt ( )
  31. event ue_usual_query_retr ( )
  32. event ue_cmp_mtrlware ( )
  33. event ue_cmp_amt2 ( )
  34. event ue_cmp ( )
  35. event ue_update_inware_mtrlwareid ( )
  36. tv_1 tv_1
  37. st_2 st_2
  38. ddlb_storageid ddlb_storageid
  39. cb_other cb_other
  40. st_1 st_1
  41. em_month em_month
  42. st_lastbalcdate st_lastbalcdate
  43. ddlb_1 ddlb_1
  44. cb_balc cb_balc
  45. end type
  46. global w_warebalc_view w_warebalc_view
  47. type variables
  48. Long cur_storageid = -1
  49. Long cur_storageid_arr[]
  50. DateTime balcdate //结存日期
  51. Int cur_mtrlorigin = -1 //当前显示物料来源
  52. String ls_handtype = ''
  53. string ls_mtrltype = ''
  54. long ins_if_info = 0
  55. integer cur_billtype_in = -1
  56. integer cur_billtype_out = -1
  57. end variables
  58. forward prototypes
  59. public subroutine wf_hidecol ()
  60. public function window getparentwindow ()
  61. end prototypes
  62. event ue_retrieve_info();if ddlb_1.text = '分类统计表' then return
  63. Long ll_row
  64. Long ll_mtrlid
  65. ll_row = dw_1.GetRow()
  66. IF ll_row <= 0 THEN
  67. ll_mtrlid = 0
  68. ELSE
  69. ll_mtrlid = dw_1.Object.u_mtrldef_mtrlid[ll_row]
  70. END IF
  71. IF IsValid(w_mtrl_info) THEN
  72. w_mtrl_info.WindowState = Normal!
  73. w_mtrl_info.ins_mtrlid = ll_mtrlid
  74. w_mtrl_info.wf_retrieve(ll_mtrlid)
  75. END IF
  76. end event
  77. event retrieve_pageretr();
  78. //Int rtr_zeronoallocqty
  79. //
  80. //IF cbx_1.Checked THEN
  81. // rtr_zeronoallocqty = -1
  82. //ELSE
  83. // rtr_zeronoallocqty = 0
  84. //END IF
  85. dw_1.Retrieve(cur_storageid_arr,ls_handtype,ls_mtrltype,cur_mtrlorigin,publ_operator)
  86. IF dw_1.RowCount() > 0 AND dw_1.GetRow() = 0 THEN dw_1.SetRow(1)
  87. //查询最后结存日期
  88. DateTime ldt_lastbalcdate
  89. SELECT max( balcdate)
  90. INTO :ldt_lastbalcdate
  91. FROM u_warebalc
  92. WHERE (storageid = :cur_storageid OR :cur_storageid = -1)
  93. And balcdateint <> 0;
  94. IF sqlca.SQLCode <> 0 THEN
  95. SetNull(ldt_lastbalcdate)
  96. END IF
  97. IF IsNull(ldt_lastbalcdate) THEN
  98. st_lastbalcdate.Text = '没有结存记录'
  99. ELSE
  100. st_lastbalcdate.Text = '最后结存日期:'+String(ldt_lastbalcdate, 'yyyy-mm-dd')
  101. END IF
  102. SetPointer(Arrow!)
  103. end event
  104. event ue_mtrl_info();if ddlb_1.text = '分类统计表' then return
  105. Long ll_row
  106. ll_row = dw_1.GetRow()
  107. IF ll_row <= 0 THEN
  108. MessageBox('提示','请选择物料',information!,OK!)
  109. RETURN
  110. END IF
  111. Long ll_mtrlid
  112. ll_mtrlid = dw_1.Object.u_mtrldef_mtrlid[ll_row]
  113. IF IsValid(w_mtrl_info) THEN
  114. w_mtrl_info.WindowState = Normal!
  115. w_mtrl_info.ins_mtrlid = ll_mtrlid
  116. w_mtrl_info.wf_retrieve(ll_mtrlid)
  117. ELSE
  118. OpenWithParm(w_mtrl_info,ll_mtrlid)
  119. END IF
  120. end event
  121. event ue_retrieve_inoutmx();//Long ll_row
  122. //Long ll_storageid,ll_mtrlid, ll_mtrlwareid
  123. //String ls_status,ls_woodcode,ls_pcode
  124. //String ls_plancode,ls_mtrlcuscode,ls_location
  125. //Long ll_sptid
  126. //DateTime ld_fdate,ld_edate,ld_showsale_data
  127. //Int li_storagetype
  128. //
  129. //ll_row = dw_1.GetRow()
  130. //
  131. //
  132. //tab_1.tabpage_1.dw_inout.setredraw(false)
  133. //tab_1.tabpage_1.dw_inout.setfilter('')
  134. //tab_1.tabpage_1.dw_inout.filter()
  135. //
  136. //tab_1.tabpage_2.dw_out_noaudit.setredraw(false)
  137. //tab_1.tabpage_2.dw_out_noaudit.setfilter('')
  138. //tab_1.tabpage_2.dw_out_noaudit.filter()
  139. //
  140. //IF ll_row <= 0 THEN
  141. // tab_1.tabpage_1.dw_inout.Reset()
  142. // tab_1.tabpage_2.dw_out_noaudit.Reset()
  143. //ELSE
  144. // ld_fdate = DateTime(Date(tab_1.tabpage_1.em_3.Text),Time(0))
  145. // ld_edate = DateTime(Date(tab_1.tabpage_1.em_4.Text),Time('23:59:59'))
  146. //
  147. // IF ld_fdate < sys_showsaledata_mindt THEN
  148. // ld_showsale_data = sys_showsaledata_mindt
  149. // ELSE
  150. // ld_showsale_data = ld_fdate
  151. // END IF
  152. //
  153. // ll_mtrlwareid = dw_1.Object.u_mtrlware_mtrlwareid[ll_row]
  154. // ll_storageid = dw_1.Object.u_mtrlware_storageid[ll_row]
  155. // ll_mtrlid = dw_1.Object.u_mtrldef_mtrlid[ll_row]
  156. // ls_status = dw_1.Object.u_mtrlware_status[ll_row]
  157. // ls_woodcode = dw_1.Object.u_mtrlware_woodcode[ll_row]
  158. // ls_pcode = dw_1.Object.u_mtrlware_pcode[ll_row]
  159. // ls_plancode = dw_1.Object.u_mtrlware_plancode[ll_row]
  160. // ll_sptid = dw_1.Object.u_mtrlware_sptid[ll_row]
  161. //
  162. // tab_1.tabpage_1.dw_inout.Retrieve(ll_storageid,ll_mtrlid,ld_fdate,ld_edate,ls_status,ls_woodcode,ls_pcode,ld_showsale_data,ls_plancode,ll_sptid, cur_billtype_in, cur_billtype_out)
  163. // tab_1.tabpage_2.dw_out_noaudit.Retrieve(ll_mtrlwareid)
  164. //END IF
  165. //tab_1.tabpage_1.dw_inout.setredraw(true)
  166. //tab_1.tabpage_2.dw_out_noaudit.setredraw(true)
  167. end event
  168. event ue_usual_query_filt();//String obj_expr = ''
  169. //IF ddlb_1.Text = '明细统计表' or ddlb_1.text='汇总统计表' THEN
  170. //
  171. // IF Trim(sle_usual_query.Text) <> '' THEN
  172. // IF Pos(Trim(sle_usual_query.Text),'%') = 0 THEN
  173. // obj_expr = obj_expr+' ( u_mtrldef_mtrlcode LIKE "%'+Trim(sle_usual_query.Text)+'%") '
  174. // obj_expr = obj_expr+' or ( u_mtrldef_mtrlname LIKE "%'+Trim(sle_usual_query.Text)+'%") '
  175. // ELSE
  176. // obj_expr = obj_expr+' ( u_mtrldef_mtrlcode LIKE "'+Trim(sle_usual_query.Text)+'") '
  177. // obj_expr = obj_expr+' or ( u_mtrldef_mtrlname LIKE "'+Trim(sle_usual_query.Text)+'") '
  178. // END IF
  179. // END IF
  180. //ELSE
  181. // IF Trim(sle_usual_query.Text) <> '' THEN
  182. // IF Pos(Trim(sle_usual_query.Text),'%') = 0 THEN
  183. // obj_expr = obj_expr+' ( u_mtrltype_mtrltype LIKE "%'+Trim(sle_usual_query.Text)+'%") '
  184. // ELSE
  185. // obj_expr = obj_expr+' ( u_mtrltype_mtrltype LIKE "'+Trim(sle_usual_query.Text)+'") '
  186. // END IF
  187. // END IF
  188. //END IF
  189. //
  190. //dw_1.SetFilter(obj_expr)
  191. //
  192. //dw_1.SetRedraw(FALSE)
  193. //dw_1.Filter()
  194. //IF dw_1.RowCount() >= 1 THEN
  195. // dw_1.SelectRow(0,FALSE)
  196. // dw_1.SelectRow(1,TRUE)
  197. //END IF
  198. //dw_1.SetRedraw(TRUE)
  199. //
  200. //
  201. end event
  202. event ue_usual_query_retr();//String ls_querystrpart = ''
  203. //ls_newselect = Lower(ori_oldselect)
  204. //IF Trim(sle_usual_query.Text) <> '' THEN
  205. // IF Pos(Trim(sle_usual_query.Text),'%') = 0 THEN
  206. // ls_querystrpart = ls_querystrpart + "u_mtrldef.mtrlcode like '%"+Trim(sle_usual_query.Text)+"%'"
  207. // ls_querystrpart = ls_querystrpart + " or u_mtrldef.mtrlname like '%"+Trim(sle_usual_query.Text)+"%')"
  208. // ELSE
  209. // ls_querystrpart = ls_querystrpart + " (u_mtrldef.mtrlcode like '"+Trim(sle_usual_query.Text)+"'"
  210. // ls_querystrpart = ls_querystrpart + " or u_mtrldef.mtrlname like '"+Trim(sle_usual_query.Text)+"')"
  211. // END IF
  212. //
  213. // IF Pos(ls_newselect," where ") <> 0 THEN
  214. // ls_newselect = ls_newselect+" AND ("+ls_querystrpart+')'
  215. // ELSE
  216. // ls_newselect = ls_newselect+" where ("+ls_querystrpart+')'
  217. // END IF
  218. //END IF
  219. //wf_retrieveuc(dw_pageretr,ls_newselect,1)
  220. //THIS.TriggerEvent('retrieve_pageretr')
  221. //
  222. end event
  223. event ue_cmp_mtrlware();//按库存数重算本期期初
  224. IF Not f_power_ind(1507) THEN
  225. MessageBox(publ_operator,'你没有使用权限!')
  226. RETURN
  227. END IF
  228. //IF Not dw_pageretr.DataObject = 'dw_warebalc_view' THEN
  229. // MessageBox('系统提示','必须在客户产品统计表中才能执行本功能')
  230. // RETURN
  231. //END IF
  232. IF MessageBox (publ_operator,"是否确定要执行按库存数重算结存功能?",Question!,YesNo! ) = 2 THEN RETURN
  233. IF cur_storageid = -1 THEN
  234. MessageBox('系统提示','请先选择仓库')
  235. RETURN
  236. END IF
  237. Long li_if_fifo = 0
  238. SELECT if_fifo
  239. INTO :li_if_fifo
  240. FROM u_storage
  241. Where storageid = :cur_storageid Using sqlca;
  242. IF sqlca.SQLCode <> 0 THEN
  243. MessageBox('提示', "查询仓库存货核算方法错误!")
  244. RETURN
  245. END IF
  246. IF li_if_fifo = 1 THEN
  247. MessageBox('提示', "此功能不适合使用先进先出方法的仓库!")
  248. RETURN
  249. END IF
  250. Long rslt = 1
  251. String arg_msg
  252. datastore ds_warebalc
  253. ds_warebalc = Create datastore
  254. ds_warebalc.DataObject = 'dw_warebalc_view'
  255. ds_warebalc.SetTransObject(sqlca)
  256. ds_warebalc.Retrieve(cur_storageid_arr,'','',-1,publ_operator)
  257. // //清空筛选内容
  258. //ds_warebalc.SetFilter('')
  259. //ds_warebalc.Filter()
  260. //ds_warebalc.Retrieve(cur_storageid_arr,'','',-1,publ_operator)
  261. Long ll_i
  262. Decimal ld_newcost // 最新成本价
  263. Decimal ld_bgqty,ld_bgamt,ld_incqty,ld_incamt,ld_desqty,ld_desamt
  264. Decimal ld_balcqty,ld_balcamt
  265. Long ll_mtrlid
  266. String ls_status,ls_pcode,ls_woodcode
  267. String ls_mtrlcode
  268. Decimal ld_noallocqty,ld_wareamt,ld_noallocaddqty
  269. Decimal ld_noallocqty_sum,ld_wareamt_sum,ld_noallocaddqty_sum,ld_incaddqty,ld_desaddqty
  270. Long ll_sptid_cusid,ll_sptid
  271. Open(w_sys_wait_jdt) //初始化进度条
  272. w_sys_wait_jdt.Show()
  273. //结存查库存
  274. w_sys_wait_jdt.wf_accepttol(ds_warebalc.RowCount())
  275. FOR ll_i = 1 To ds_warebalc.RowCount()
  276. ll_mtrlid = ds_warebalc.Object.u_mtrldef_mtrlid[ll_i]
  277. ls_mtrlcode = ds_warebalc.Object.u_mtrldef_mtrlcode[ll_i]
  278. ls_status = ds_warebalc.Object.u_warebalc_status[ll_i]
  279. ls_woodcode = ds_warebalc.Object.u_warebalc_woodcode[ll_i]
  280. ls_pcode = ds_warebalc.Object.u_warebalc_pcode[ll_i]
  281. ll_sptid_cusid = ds_warebalc.Object.u_warebalc_sptid_cusid[ll_i]
  282. w_sys_wait_jdt.st_msg.Text = " 正在结存重算:"+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+"..." //进度信息
  283. w_sys_wait_jdt.wf_inc(ll_i)
  284. SELECT isnull(sum(noallocqty),0),
  285. isnull(sum(wareamt),0),
  286. isnull(sum(noallocaddqty),0)
  287. INTO :ld_noallocqty,
  288. :ld_wareamt,
  289. :ld_noallocaddqty
  290. FROM u_mtrlware
  291. WHERE mtrlid = :ll_mtrlid
  292. AND storageid = :cur_storageid
  293. AND status = :ls_status
  294. AND woodcode = :ls_woodcode
  295. AND pcode = :ls_pcode
  296. And sptid = :ll_sptid_cusid;
  297. IF sqlca.SQLCode <> 0 THEN
  298. IF sqlca.SQLCode = 100 THEN
  299. ld_noallocqty = 0
  300. ld_wareamt = 0
  301. ELSE
  302. rslt = 0
  303. arg_msg = '查询库存资料失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  304. GOTO ext
  305. END IF
  306. END IF
  307. UPDATE u_warebalc
  308. SET balcqty = :ld_noallocqty,
  309. balcaddqty = :ld_noallocaddqty,
  310. balcamt = :ld_wareamt,
  311. bgqty = :ld_noallocqty + desqty - incqty,
  312. bgamt = :ld_wareamt + desamt - incamt,
  313. bgaddqty = :ld_noallocaddqty + desaddqty - incaddqty
  314. WHERE mtrlid = :ll_mtrlid
  315. AND balcdateint = 0
  316. AND Storageid = :cur_storageid
  317. AND status = :ls_status
  318. AND woodcode = :ls_woodcode
  319. AND pcode = :ls_pcode
  320. And sptid_cusid = :ll_sptid_cusid;
  321. IF sqlca.SQLCode <> 0 THEN
  322. rslt = 0
  323. arg_msg = '更新结存失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  324. GOTO ext
  325. END IF
  326. ld_noallocqty_sum += ld_noallocqty
  327. ld_wareamt_sum += ld_wareamt
  328. ld_noallocaddqty_sum += ld_noallocaddqty
  329. NEXT
  330. //库存计结存
  331. Long cnt,ll_scid
  332. datastore ds_mtrlware
  333. ds_mtrlware = Create datastore
  334. ds_mtrlware.DataObject = 'ds_warebalc_view_cmpl_mtrlware_to_balc'
  335. ds_mtrlware.SetTransObject(sqlca)
  336. ds_mtrlware.Retrieve(cur_storageid)
  337. ds_mtrlware.AcceptText()
  338. IF ld_noallocqty_sum <> ds_mtrlware.Object.sumqty[1] Or &
  339. ld_wareamt_sum <> ds_mtrlware.Object.sumamt[1] Or &
  340. ld_noallocaddqty_sum <> ds_mtrlware.Object.sumaddqty[1] THEN
  341. SELECT scid INTO :ll_scid
  342. FROM u_storage
  343. Where storageid = :cur_storageid;
  344. IF sqlca.SQLCode <> 0 THEN
  345. rslt = 0
  346. arg_msg = '查询仓库所属分部失败,操作取消'
  347. GOTO ext
  348. END IF
  349. w_sys_wait_jdt.wf_accepttol(ds_mtrlware.RowCount())
  350. FOR ll_i = 1 To ds_mtrlware.RowCount()
  351. ll_mtrlid = 0
  352. ls_mtrlcode = ''
  353. ls_status = ''
  354. ls_woodcode = ''
  355. ls_pcode = ''
  356. ld_noallocqty = 0
  357. ld_wareamt = 0
  358. ll_sptid = 0
  359. cnt = 0
  360. ls_mtrlcode = ds_mtrlware.Object.u_mtrldef_mtrlcode[ll_i]
  361. ll_mtrlid = ds_mtrlware.Object.mtrlid[ll_i]
  362. ls_status = ds_mtrlware.Object.status[ll_i]
  363. ls_woodcode = ds_mtrlware.Object.woodcode[ll_i]
  364. ls_pcode = ds_mtrlware.Object.pcode[ll_i]
  365. ld_noallocqty = ds_mtrlware.Object.qty[ll_i]
  366. ld_noallocaddqty = ds_mtrlware.Object.addqty[ll_i]
  367. ld_wareamt = ds_mtrlware.Object.amt[ll_i]
  368. ll_sptid = ds_mtrlware.Object.u_mtrlware_sptid[ll_i]
  369. w_sys_wait_jdt.st_msg.Text = " 正在库存重算:"+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+"..." //进度信息
  370. w_sys_wait_jdt.wf_inc(ll_i)
  371. SELECT count(*) INTO :cnt
  372. FROM u_warebalc
  373. WHERE mtrlid = :ll_mtrlid
  374. AND balcdateint = 0
  375. AND Storageid = :cur_storageid
  376. AND status = :ls_status
  377. AND woodcode = :ls_woodcode
  378. AND pcode = :ls_pcode
  379. And sptid_cusid = :ll_sptid;
  380. IF sqlca.SQLCode <> 0 THEN
  381. rslt = 0
  382. arg_msg = '查询结存失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  383. GOTO ext
  384. END IF
  385. IF cnt > 0 THEN CONTINUE
  386. SELECT CASE when sum(Round(u_inwaremx.qty * u_inwaremx.cost,2)) Is Null THEN 0 ELSE sum(Round(u_inwaremx.qty * u_inwaremx.cost,2)) END ,
  387. CASE when sum(u_inwaremx.qty) Is Null THEN 0 ELSE sum(u_inwaremx.qty) END,
  388. CASE when sum(u_inwaremx.addqty) Is Null THEN 0 ELSE sum(u_inwaremx.addqty) END
  389. Into :ld_incamt,:ld_incqty,:ld_incaddqty
  390. From u_inwaremx,u_inware
  391. Where u_inwaremx.scid = u_inware.scid
  392. And u_inwaremx.inwareid = u_inware.inwareid
  393. And u_inware.storageid = :cur_storageid
  394. And u_inware.balcdateint = 0
  395. And u_inwaremx.mtrlid = :ll_mtrlid
  396. And u_inwaremx.status = :ls_status
  397. And u_inwaremx.woodcode = :ls_woodcode
  398. And u_inwaremx.pcode = :ls_pcode
  399. And u_inwaremx.sptid_cusid = :ll_sptid;
  400. IF sqlca.SQLCode <> 0 THEN
  401. rslt = 0
  402. arg_msg = '查询进仓失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  403. GOTO ext
  404. END IF
  405. SELECT CASE when sum(u_outwaremx.costamt) Is Null THEN 0 ELSE sum(u_outwaremx.costamt) END ,
  406. CASE when sum(u_outwaremx.qty) Is Null THEN 0 ELSE sum(u_outwaremx.qty) END ,
  407. CASE when sum(u_outwaremx.addqty) Is Null THEN 0 ELSE sum(u_outwaremx.addqty) END
  408. Into :ld_desamt,:ld_desqty,:ld_desaddqty
  409. From u_outwaremx,u_outware
  410. Where u_outwaremx.scid = u_outware.scid
  411. And u_outwaremx.outwareid = u_outware.outwareid
  412. And u_outware.storageid = :cur_storageid
  413. And u_outware.balcdateint = 0
  414. And u_outwaremx.mtrlid = :ll_mtrlid
  415. And u_outwaremx.status = :ls_status
  416. And u_outwaremx.woodcode = :ls_woodcode
  417. And u_outwaremx.pcode = :ls_pcode
  418. And u_outwaremx.sptid = :ll_sptid;
  419. IF sqlca.SQLCode <> 0 THEN
  420. rslt = 0
  421. arg_msg = '查询出仓失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  422. GOTO ext
  423. END IF
  424. INSERT INTO u_warebalc
  425. (scid,
  426. balcdateint,
  427. storageid,
  428. mtrlid,
  429. status,
  430. woodcode,
  431. pcode,
  432. bgqty,
  433. bgamt,
  434. incqty,
  435. incamt,
  436. desqty,
  437. desamt,
  438. balcqty,
  439. balcamt,
  440. sptid_cusid,
  441. bgaddqty,
  442. balcaddqty,
  443. incaddqty,
  444. desaddqty
  445. )
  446. VALUES
  447. (:ll_scid,0,
  448. :cur_storageid,
  449. :ll_mtrlid,
  450. :ls_status,
  451. :ls_woodcode,
  452. :ls_pcode,
  453. :ld_noallocqty + :ld_desqty - :ld_incqty,
  454. :ld_wareamt + :ld_desamt - :ld_incamt,
  455. :ld_incqty,
  456. :ld_incamt,
  457. :ld_desqty,
  458. :ld_desamt,
  459. :ld_noallocqty,
  460. :ld_wareamt,
  461. :ll_sptid,
  462. :ld_noallocaddqty + :ld_desaddqty - :ld_incaddqty,
  463. :ld_noallocaddqty,
  464. :ld_incqty,
  465. :ld_desaddqty);
  466. IF sqlca.SQLCode <> 0 THEN
  467. rslt = 0
  468. arg_msg = '新加结存失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  469. GOTO ext
  470. END IF
  471. NEXT
  472. END IF
  473. //CLOSE(w_sys_wait_jdt)
  474. //COMMIT;
  475. //MessageBox('系统提示','重算成功!')
  476. //THIS.TriggerEvent('retrieve_pageretr')
  477. ext:
  478. Destroy ds_warebalc
  479. Destroy ds_mtrlware
  480. Close(w_sys_wait_jdt)
  481. IF rslt = 0 THEN
  482. ROLLBACK;
  483. MessageBox('Error',arg_msg)
  484. RETURN
  485. ELSE
  486. COMMIT;
  487. MessageBox('系统提示','重算成功!')
  488. This.TriggerEvent('retrieve_pageretr')
  489. END IF
  490. end event
  491. event ue_cmp_amt2();//按上期结存重算本期结余
  492. IF Not f_power_ind(1507) THEN
  493. MessageBox(publ_operator,'你没有使用权限!')
  494. RETURN
  495. END IF
  496. //IF Not dw_pageretr.DataObject = 'dw_warebalc_view' THEN
  497. // MessageBox('系统提示','必须在客户产品统计表中才能执行本功能')
  498. // RETURN
  499. //END IF
  500. IF cur_storageid = -1 THEN
  501. MessageBox('系统提示','请先选择仓库')
  502. RETURN
  503. END IF
  504. Long li_if_fifo = 0
  505. SELECT if_fifo
  506. INTO :li_if_fifo
  507. FROM u_storage
  508. Where storageid = :cur_storageid Using sqlca;
  509. IF sqlca.SQLCode <> 0 THEN
  510. MessageBox('提示', "查询仓库存货核算方法错误!")
  511. RETURN
  512. END IF
  513. IF li_if_fifo = 1 THEN
  514. MessageBox('提示', "此功能不适合使用先进先出方法的仓库!")
  515. RETURN
  516. END IF
  517. Long rslt = 1
  518. String arg_msg
  519. Long cnt
  520. cnt = 0
  521. SELECT count(*) INTO :cnt
  522. FROM u_mtrlware
  523. WHERE u_mtrlware.storageid = :cur_storageid
  524. AND ( u_mtrlware.plancode <> '' OR sptid <> 0 )
  525. AND u_mtrlware.noallocqty <> 0
  526. And u_mtrlware.mtrlid In (SELECT mtrlid From u_warebalc Where storageid = :cur_storageid And balcdateint = 0);
  527. IF sqlca.SQLCode <> 0 THEN
  528. MessageBox('系统提示','查询仓库物料使用了批号库存失败,'+sqlca.SQLErrText)
  529. RETURN
  530. END IF
  531. IF cnt > 0 THEN
  532. MessageBox('系统提示','仓库物料使用了批号库存,不能重算')
  533. RETURN
  534. END IF
  535. cnt = 0
  536. SELECT count(*) INTO :cnt
  537. FROM u_outware,u_outwaremx
  538. WHERE u_outware.storageid = :cur_storageid
  539. AND u_outware.scid = u_outwaremx.scid
  540. AND u_outware.outwareid = u_outwaremx.outwareid
  541. AND u_outware.flag = 1
  542. AND u_outware.balcdateint = 0
  543. AND u_outwaremx.plancode <> ''
  544. And u_outwaremx.mtrlid In (SELECT mtrlid From u_warebalc Where storageid = :cur_storageid And balcdateint = 0);
  545. IF sqlca.SQLCode <> 0 THEN
  546. MessageBox('系统提示','查询仓库物料出仓使用了批号库存失败,'+sqlca.SQLErrText)
  547. RETURN
  548. END IF
  549. IF cnt > 0 THEN
  550. MessageBox('系统提示','仓库物料出仓使用了批号库存,不能重算')
  551. RETURN
  552. END IF
  553. cnt = 0
  554. SELECT count(*) INTO :cnt
  555. FROM u_inware,u_inwaremx
  556. WHERE u_inware.storageid = :cur_storageid
  557. AND u_inware.scid = u_inwaremx.scid
  558. AND u_inware.inwareid = u_inwaremx.inwareid
  559. AND u_inware.flag = 1
  560. AND u_inware.balcdateint = 0
  561. AND u_inwaremx.plancode <> ''
  562. And u_inwaremx.mtrlid In (SELECT mtrlid From u_warebalc Where storageid = :cur_storageid And balcdateint = 0);
  563. IF sqlca.SQLCode <> 0 THEN
  564. MessageBox('系统提示','查询仓库物料进仓使用了批号库存失败,'+sqlca.SQLErrText)
  565. RETURN
  566. END IF
  567. IF cnt > 0 THEN
  568. MessageBox('系统提示','仓库物料进仓使用了批号库存,不能重算')
  569. RETURN
  570. END IF
  571. IF MessageBox (publ_operator,"是否确定要执行按上期结存重算本期结余功能?",Question!,YesNo! ) = 2 THEN RETURN
  572. //IF cur_storageid = -1 THEN
  573. // MessageBox('系统提示','请先选择仓库')
  574. // RETURN
  575. //END IF
  576. datastore ds_warebalc
  577. ds_warebalc = Create datastore
  578. ds_warebalc.DataObject = 'dw_warebalc_view_ds'
  579. ds_warebalc.SetTransObject(sqlca)
  580. ds_warebalc.Retrieve(cur_storageid_arr,0)
  581. // //清空筛选内容
  582. //ds_warebalc.SetFilter('')
  583. //ds_warebalc.Filter()
  584. //ds_warebalc.Retrieve(cur_storageid_arr,'','',cur_mtrlorigin,publ_operator)
  585. Long ll_lastbalcdateint
  586. Long ll_i
  587. Decimal ld_newcost,ld_newcost_out // 最新成本价
  588. Decimal ld_balcqty_last,ld_balcamt_last,ld_inamt,ld_inqty,ld_outamt,ld_outqty
  589. Decimal ld_ubalcqty_last,ld_uinqty,ld_uoutqty
  590. Decimal ld_bgqty,ld_bgamt,ld_incqty,ld_incamt,ld_desqty,ld_desamt
  591. Decimal ld_balcqty,ld_balcamt
  592. Long ll_mtrlid
  593. String ls_status,ls_pcode,ls_woodcode
  594. String ls_mtrlcode,ls_msg
  595. Long ll_sptid_cusid
  596. cnt = 0
  597. SELECT count(*) INTO :cnt
  598. FROM u_warebalc
  599. Where storageid = :cur_storageid;
  600. IF sqlca.SQLCode <> 0 THEN
  601. rslt = 0
  602. arg_msg = '查询历史结存失败,操作取消'
  603. GOTO ext
  604. END IF
  605. IF cnt > 0 THEN
  606. SELECT max(balcdateint) INTO :ll_lastbalcdateint
  607. FROM u_warebalc
  608. Where storageid = :cur_storageid;
  609. IF sqlca.SQLCode <> 0 THEN
  610. rslt = 0
  611. arg_msg = '查询上次结存失败,操作取消'
  612. GOTO ext
  613. END IF
  614. ELSE
  615. ll_lastbalcdateint = -1
  616. END IF
  617. UPDATE u_mtrlware
  618. SET noallocqty = 0,wareamt = 0
  619. Where storageid = : cur_storageid;
  620. IF sqlca.SQLCode <> 0 THEN
  621. rslt = 0
  622. arg_msg = '清除库存数量,金额失败,操作取消'
  623. GOTO ext
  624. END IF
  625. Open(w_sys_wait_jdt) //初始化进度条
  626. w_sys_wait_jdt.Show()
  627. w_sys_wait_jdt.wf_accepttol(ds_warebalc.RowCount())
  628. FOR ll_i = 1 To ds_warebalc.RowCount()
  629. ld_bgqty = ds_warebalc.Object.bgqty[ll_i]
  630. ld_bgamt = ds_warebalc.Object.bgamt[ll_i]
  631. ld_incqty = ds_warebalc.Object.incqty[ll_i]
  632. ld_incamt = ds_warebalc.Object.incamt[ll_i]
  633. ld_desqty = ds_warebalc.Object.desqty[ll_i]
  634. ld_desamt = ds_warebalc.Object.desamt[ll_i]
  635. ls_status = ds_warebalc.Object.u_warebalc_status[ll_i]
  636. ls_woodcode = ds_warebalc.Object.u_warebalc_woodcode[ll_i]
  637. ls_pcode = ds_warebalc.Object.u_warebalc_pcode[ll_i]
  638. ls_mtrlcode = ds_warebalc.Object.u_mtrldef_mtrlcode[ll_i]
  639. ll_mtrlid = ds_warebalc.Object.mtrlid[ll_i]
  640. ll_sptid_cusid = ds_warebalc.Object.u_warebalc_sptid_cusid[ll_i]
  641. w_sys_wait_jdt.st_msg.Text = " 正在重算:"+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+"..." //进度信息
  642. w_sys_wait_jdt.wf_inc(ll_i)
  643. IF IsNull(ld_bgqty) THEN ld_bgqty = 0
  644. IF IsNull(ld_incqty) THEN ld_incqty = 0
  645. IF IsNull(ld_bgamt) THEN ld_bgamt = 0
  646. IF IsNull(ld_incamt) THEN ld_incamt = 0
  647. IF IsNull(ld_desqty) THEN ld_desqty = 0
  648. IF IsNull(ld_desamt) THEN ld_desamt = 0
  649. //查期初
  650. If ll_lastbalcdateint > 0 THEN
  651. SELECT balcqty,balcamt
  652. INTO :ld_balcqty_last,:ld_balcamt_last
  653. FROM u_warebalc
  654. WHERE storageid = :cur_storageid
  655. AND mtrlid = :ll_mtrlid
  656. AND status = :ls_status
  657. AND woodcode = :ls_woodcode
  658. AND pcode = :ls_pcode
  659. AND balcdateint = :ll_lastbalcdateint
  660. And sptid_cusid = :ll_sptid_cusid;
  661. IF sqlca.SQLCode = -1 THEN
  662. rslt = 0
  663. arg_msg = '查询上月结存失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+','+sqlca.SQLErrText
  664. GOTO ext
  665. elseif sqlca.sqlcode = 100 then
  666. ld_balcqty_last = 0
  667. ld_balcamt_last = 0
  668. END IF
  669. IF ld_balcqty_last <> ld_bgqty THEN ld_bgqty = ld_balcqty_last
  670. IF ld_balcamt_last <> ld_bgamt THEN ld_bgamt = ld_balcamt_last
  671. ELSE
  672. ld_bgqty = 0
  673. ld_bgamt = 0
  674. END IF
  675. //查进仓
  676. SELECT isnull(sum(u_inwaremx.qty),0),isnull(sum(u_inwaremx.uqty),0),isnull(sum(round(u_inwaremx.cost * u_inwaremx.qty,2)),0)
  677. INTO :ld_inqty,:ld_uinqty,:ld_inamt
  678. FROM u_inware,u_inwaremx
  679. WHERE u_inware.scid = u_inwaremx.scid
  680. AND u_inware.inwareid = u_inwaremx.inwareid
  681. AND u_inwaremx.mtrlid = :ll_mtrlid
  682. AND u_inwaremx.status = :ls_status
  683. AND u_inwaremx.woodcode = :ls_woodcode
  684. AND u_inwaremx.pcode = :ls_pcode
  685. AND u_inware.storageid = :cur_storageid
  686. AND u_inware.balcdateint = 0
  687. AND u_inware.flag = 1
  688. And u_inwaremx.sptid_cusid = :ll_sptid_cusid;
  689. IF sqlca.SQLCode <> 0 THEN
  690. rslt = 0
  691. arg_msg = '查询本月进仓失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+','+sqlca.SQLErrText
  692. GOTO ext
  693. END IF
  694. IF ld_incqty <> ld_inqty THEN ld_incqty = ld_inqty
  695. IF ld_incamt <> ld_inamt THEN ld_incamt = ld_inamt
  696. //查出仓
  697. SELECT isnull(sum(u_outwaremx.qty),0),
  698. isnull(sum(u_outwaremx.uqty),0),
  699. isnull(sum(round(u_outwaremx.costamt,2)),0)
  700. INTO :ld_outqty,:ld_uoutqty,:ld_outamt
  701. FROM u_outware,u_outwaremx
  702. WHERE u_outware.scid = u_outwaremx.scid
  703. AND u_outware.outwareid = u_outwaremx.outwareid
  704. AND u_outwaremx.mtrlid = :ll_mtrlid
  705. AND u_outwaremx.status = :ls_status
  706. AND u_outwaremx.woodcode = :ls_woodcode
  707. AND u_outwaremx.pcode = :ls_pcode
  708. AND u_outware.storageid = :cur_storageid
  709. AND u_outware.balcdateint = 0
  710. AND u_outware.flag = 1
  711. And u_outwaremx.sptid = :ll_sptid_cusid;
  712. IF sqlca.SQLCode <> 0 THEN
  713. rslt = 0
  714. arg_msg = '查询本月出仓失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+','+sqlca.SQLErrText
  715. GOTO ext
  716. END IF
  717. IF ld_desqty <> ld_outqty THEN ld_desqty = ld_outqty
  718. IF ld_desamt <> ld_outamt THEN ld_desamt = ld_outamt
  719. IF IsNull(ld_bgqty) THEN ld_bgqty = 0
  720. IF IsNull(ld_bgamt) THEN ld_bgamt = 0
  721. IF IsNull(ld_incqty) THEN ld_incqty = 0
  722. IF IsNull(ld_incamt) THEN ld_incamt = 0
  723. IF IsNull(ld_desqty) THEN ld_desqty = 0
  724. IF IsNull(ld_desamt) THEN ld_desamt = 0
  725. //出仓成本价
  726. IF ld_bgqty + ld_incqty <> 0 THEN
  727. ld_newcost_out = Round((ld_bgamt + ld_incamt) / (ld_bgqty + ld_incqty),10)
  728. ELSE
  729. IF ld_desqty <> 0 THEN
  730. ld_newcost_out = Round(ld_desamt / ld_desqty, 10)
  731. ELSE
  732. ld_newcost_out = 0
  733. END IF
  734. END IF
  735. IF ld_newcost_out < 0 THEN ld_newcost_out = 0
  736. //更新期间出金额
  737. UPDATE u_outwaremx
  738. SET u_outwaremx.cost = :ld_newcost_out,
  739. u_outwaremx.costamt = round(u_outwaremx.qty * :ld_newcost_out,2)
  740. FROM u_outwaremx INNER JOIN
  741. u_outware ON u_outwaremx.scid = u_outware.scid AND
  742. u_outwaremx.outwareid = u_outware.outwareid
  743. WHERE u_outwaremx.mtrlid = :ll_mtrlid
  744. AND u_outware.storageid = :cur_storageid
  745. AND u_outwaremx.status = :ls_status
  746. AND u_outwaremx.woodcode = :ls_woodcode
  747. AND u_outwaremx.pcode = :ls_pcode
  748. AND u_outware.balcflag = 0
  749. And u_outwaremx.sptid = :ll_sptid_cusid;
  750. IF sqlca.SQLCode <> 0 THEN
  751. rslt = 0
  752. arg_msg = '更新未结存的出仓单金额失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+','+sqlca.SQLErrText
  753. GOTO ext
  754. END IF
  755. //重新查出仓
  756. SELECT isnull(sum(u_outwaremx.qty),0),
  757. isnull(sum(u_outwaremx.uqty),0),
  758. isnull(sum(round(u_outwaremx.costamt,2)),0)
  759. INTO :ld_outqty,:ld_uoutqty,:ld_outamt
  760. FROM u_outware,u_outwaremx
  761. WHERE u_outware.scid = u_outwaremx.scid
  762. AND u_outware.outwareid = u_outwaremx.outwareid
  763. AND u_outwaremx.mtrlid = :ll_mtrlid
  764. AND u_outwaremx.status = :ls_status
  765. AND u_outwaremx.woodcode = :ls_woodcode
  766. AND u_outwaremx.pcode = :ls_pcode
  767. AND u_outware.storageid = :cur_storageid
  768. AND u_outware.balcdateint = 0
  769. AND u_outware.flag = 1
  770. And u_outwaremx.sptid = :ll_sptid_cusid;
  771. IF sqlca.SQLCode <> 0 THEN
  772. rslt = 0
  773. arg_msg = '查询本月出仓失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+','+sqlca.SQLErrText
  774. GOTO ext
  775. END IF
  776. IF ld_desqty <> ld_outqty THEN ld_desqty = ld_outqty
  777. IF ld_desamt <> ld_outamt THEN ld_desamt = ld_outamt
  778. IF IsNull(ld_bgqty) THEN ld_bgqty = 0
  779. IF IsNull(ld_bgamt) THEN ld_bgamt = 0
  780. IF IsNull(ld_incqty) THEN ld_incqty = 0
  781. IF IsNull(ld_incamt) THEN ld_incamt = 0
  782. IF IsNull(ld_desqty) THEN ld_desqty = 0
  783. IF IsNull(ld_desamt) THEN ld_desamt = 0
  784. //更新期间出金额,结存金额
  785. UPDATE u_warebalc
  786. SET bgqty = :ld_bgqty,
  787. bgamt = :ld_bgamt,
  788. incqty = :ld_incqty,
  789. incamt = :ld_incamt,
  790. desqty = :ld_desqty,
  791. desamt = :ld_desamt,
  792. balcqty = :ld_bgqty + :ld_incqty - :ld_desqty,
  793. balcamt = :ld_bgamt + :ld_incamt - :ld_desamt
  794. WHERE mtrlid = :ll_mtrlid
  795. AND balcdateint = 0
  796. AND Storageid = :cur_storageid
  797. AND status = :ls_status
  798. AND woodcode = :ls_woodcode
  799. AND pcode = :ls_pcode
  800. And sptid_cusid = :ll_sptid_cusid;
  801. IF sqlca.SQLCode <> 0 THEN
  802. rslt = 0
  803. arg_msg = '更新结存失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+','+sqlca.SQLErrText
  804. GOTO ext
  805. END IF
  806. IF ld_bgqty + ld_incqty - ld_desqty <> 0 THEN
  807. ld_newcost = Round((ld_bgamt + ld_incamt - ld_desamt) / (ld_bgqty + ld_incqty - ld_desqty),10)
  808. ELSE
  809. ld_newcost = 0
  810. END IF
  811. IF ld_newcost < 0 THEN ld_newcost = 0
  812. UPDATE u_mtrlware
  813. SET cost = :ld_newcost,
  814. noallocqty = :ld_bgqty + :ld_incqty - :ld_desqty ,
  815. wareamt = :ld_bgamt + :ld_incamt - :ld_desamt
  816. WHERE mtrlid = :ll_mtrlid
  817. AND Storageid = :cur_storageid
  818. AND status = :ls_status
  819. AND woodcode = :ls_woodcode
  820. AND pcode = :ls_pcode
  821. AND plancode = ''
  822. And sptid = :ll_sptid_cusid;
  823. IF sqlca.SQLCode <> 0 THEN
  824. rslt = 0
  825. arg_msg = '更新库存金额失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+','+sqlca.SQLErrText
  826. GOTO ext
  827. END IF
  828. NEXT
  829. ext:
  830. Destroy ds_warebalc
  831. Close(w_sys_wait_jdt)
  832. IF rslt = 0 THEN
  833. ROLLBACK;
  834. MessageBox('Error',arg_msg)
  835. RETURN
  836. ELSE
  837. COMMIT;
  838. MessageBox('系统提示','重算成功!')
  839. This.TriggerEvent('retrieve_pageretr')
  840. END IF
  841. end event
  842. event ue_cmp();//超级重算
  843. IF Not f_power_ind(1507) THEN
  844. MessageBox(publ_operator,'你没有使用权限!')
  845. RETURN
  846. END IF
  847. //IF NOT dw_pageretr.DataObject = 'dw_warebalc_view' THEN
  848. // MessageBox('系统提示','必须在客户产品统计表中才能执行本功能')
  849. // RETURN
  850. //END IF
  851. IF MessageBox (publ_operator,"是否确定要执行超级重算结存功能?",Question!,YesNo! ) = 2 THEN RETURN
  852. IF cur_storageid = -1 THEN
  853. MessageBox('系统提示','请先选择仓库')
  854. RETURN
  855. END IF
  856. //// //清空筛选内容
  857. //dw_pageretr.SetFilter('')
  858. //dw_pageretr.Filter()
  859. //dw_pageretr.Retrieve(cur_storageid_arr,'','',-1,publ_operator)
  860. Long rslt = 1
  861. String arg_msg
  862. Long ll_i
  863. Decimal ld_newcost // 最新成本价
  864. Decimal ld_bgqty,ld_bgamt,ld_incqty,ld_incamt,ld_desqty,ld_desamt
  865. Decimal ld_balcqty,ld_balcamt
  866. Long ll_mtrlid
  867. String ls_status,ls_pcode,ls_woodcode
  868. String ls_mtrlcode
  869. Decimal ld_noallocqty,ld_wareamt
  870. Decimal ld_noallocqty_sum,ld_wareamt_sum
  871. Long ll_sptid
  872. Open(w_sys_wait_jdt) //初始化进度条
  873. w_sys_wait_jdt.Show()
  874. //
  875. ////结存查库存
  876. //库存计结存
  877. Long cnt,ll_scid
  878. datastore ds_mtrlware
  879. ds_mtrlware = Create datastore
  880. ds_mtrlware.DataObject = 'ds_warebalc_view_cmpl_mtrlware_to_balc2'
  881. ds_mtrlware.SetTransObject(sqlca)
  882. ds_mtrlware.Retrieve(cur_storageid)
  883. ds_mtrlware.AcceptText()
  884. //IF ld_noallocqty_sum <> ds_mtrlware.Object.sumqty[1] OR &
  885. // ld_wareamt_sum <> ds_mtrlware.Object.sumamt[1] THEN
  886. SELECT scid INTO :ll_scid
  887. FROM u_storage
  888. Where storageid = :cur_storageid;
  889. IF sqlca.SQLCode <> 0 THEN
  890. rslt = 0
  891. arg_msg = '查询仓库所属分部失败'
  892. GOTO ext
  893. END IF
  894. w_sys_wait_jdt.wf_accepttol(ds_mtrlware.RowCount())
  895. FOR ll_i = 1 To ds_mtrlware.RowCount()
  896. ll_mtrlid = 0
  897. ls_mtrlcode = ''
  898. ls_status = ''
  899. ls_woodcode = ''
  900. ls_pcode = ''
  901. ld_noallocqty = 0
  902. ld_wareamt = 0
  903. ll_sptid = 0
  904. cnt = 0
  905. ls_mtrlcode = ds_mtrlware.Object.u_mtrldef_mtrlcode[ll_i]
  906. ll_mtrlid = ds_mtrlware.Object.mtrlid[ll_i]
  907. ls_status = ds_mtrlware.Object.status[ll_i]
  908. ls_woodcode = ds_mtrlware.Object.woodcode[ll_i]
  909. ls_pcode = ds_mtrlware.Object.pcode[ll_i]
  910. ld_noallocqty = ds_mtrlware.Object.qty[ll_i]
  911. ld_wareamt = ds_mtrlware.Object.amt[ll_i]
  912. ll_sptid = ds_mtrlware.Object.u_mtrlware_sptid[ll_i]
  913. w_sys_wait_jdt.st_msg.Text = " 正在库存重算:"+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode+"..." //进度信息
  914. w_sys_wait_jdt.wf_inc(ll_i)
  915. SELECT sum(Round(u_inwaremx.qty * u_inwaremx.cost,2)) ,
  916. sum(u_inwaremx.qty)
  917. INTO :ld_incamt,:ld_incqty
  918. FROM u_inwaremx,u_inware
  919. WHERE u_inwaremx.scid = u_inware.scid
  920. AND u_inwaremx.inwareid = u_inware.inwareid
  921. AND u_inware.storageid = :cur_storageid
  922. AND u_inware.balcdateint = 0
  923. AND u_inwaremx.mtrlid = :ll_mtrlid
  924. AND u_inwaremx.status = :ls_status
  925. AND u_inwaremx.woodcode = :ls_woodcode
  926. AND u_inwaremx.pcode = :ls_pcode
  927. AND u_inwaremx.sptid_cusid = :ll_sptid
  928. And u_inware.flag = 1;
  929. IF sqlca.SQLCode <> 0 THEN
  930. rslt = 0
  931. arg_msg = '查询进仓失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  932. GOTO ext
  933. END IF
  934. SELECT sum(u_outwaremx.costamt) ,
  935. sum(u_outwaremx.qty)
  936. INTO :ld_desamt,:ld_desqty
  937. FROM u_outwaremx,u_outware
  938. WHERE u_outwaremx.scid = u_outware.scid
  939. AND u_outwaremx.outwareid = u_outware.outwareid
  940. AND u_outware.storageid = :cur_storageid
  941. AND u_outware.balcdateint = 0
  942. AND u_outwaremx.mtrlid = :ll_mtrlid
  943. AND u_outwaremx.status = :ls_status
  944. AND u_outwaremx.woodcode = :ls_woodcode
  945. AND u_outwaremx.pcode = :ls_pcode
  946. AND u_outwaremx.sptid = :ll_sptid
  947. And u_outware.flag = 1;
  948. IF sqlca.SQLCode <> 0 THEN
  949. rslt = 0
  950. arg_msg = '查询出仓失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  951. GOTO ext
  952. END IF
  953. IF IsNull(ld_desqty) THEN ld_desqty = 0
  954. IF IsNull(ld_incqty) THEN ld_incqty = 0
  955. IF IsNull(ld_desamt) THEN ld_desamt = 0
  956. IF IsNull(ld_incamt) THEN ld_incamt = 0
  957. UPDATE u_warebalc
  958. SET balcqty = :ld_noallocqty,
  959. balcamt = :ld_wareamt,
  960. bgqty = :ld_noallocqty + :ld_desqty - :ld_incqty,
  961. bgamt = :ld_wareamt + :ld_desamt - :ld_incamt,
  962. incqty = :ld_incqty,
  963. incamt = :ld_incamt,
  964. desqty = :ld_desqty,
  965. desamt = :ld_desamt
  966. WHERE mtrlid = :ll_mtrlid
  967. AND balcdateint = 0
  968. AND Storageid = :cur_storageid
  969. AND status = :ls_status
  970. AND woodcode = :ls_woodcode
  971. AND pcode = :ls_pcode
  972. And sptid_cusid = :ll_sptid;
  973. IF sqlca.SQLCode <> 0 THEN
  974. rslt = 0
  975. arg_msg = '更新结存失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  976. GOTO ext
  977. ELSEIF sqlca.SQLNRows = 0 THEN
  978. INSERT INTO u_warebalc
  979. (scid,
  980. balcdateint,
  981. storageid,
  982. mtrlid,
  983. status,
  984. woodcode,
  985. pcode,
  986. bgqty,
  987. bgamt,
  988. incqty,
  989. incamt,
  990. desqty,
  991. desamt,
  992. balcqty,
  993. balcamt,
  994. sptid_cusid)
  995. VALUES
  996. (:sys_scid,0,
  997. :cur_storageid,
  998. :ll_mtrlid,
  999. :ls_status,
  1000. :ls_woodcode,
  1001. :ls_pcode,
  1002. :ld_noallocqty + :ld_desqty - :ld_incqty,
  1003. :ld_wareamt + :ld_desamt - :ld_incamt,
  1004. :ld_incqty,
  1005. :ld_incamt,
  1006. :ld_desqty,
  1007. :ld_desamt,
  1008. :ld_noallocqty,
  1009. :ld_wareamt,
  1010. :ll_sptid);
  1011. IF sqlca.SQLCode <> 0 THEN
  1012. rslt = 0
  1013. arg_msg = '新加结存失败,物料:'+ls_mtrlcode+','+sys_option_change_status+':'+ls_status+','+sys_option_change_woodcode+':'+ls_woodcode+','+sys_option_change_pcode+':'+ls_pcode
  1014. GOTO ext
  1015. END IF
  1016. END IF
  1017. NEXT
  1018. //END IF
  1019. ext:
  1020. Destroy ds_mtrlware
  1021. Close(w_sys_wait_jdt)
  1022. IF rslt = 0 THEN
  1023. ROLLBACK;
  1024. MessageBox('Error',arg_msg)
  1025. RETURN
  1026. ELSE
  1027. COMMIT;
  1028. MessageBox('系统提示','重算成功!')
  1029. This.TriggerEvent('retrieve_pageretr')
  1030. END IF
  1031. end event
  1032. event ue_update_inware_mtrlwareid();UPDATE u_inwaremx
  1033. SET mtrlwareid = u_mtrlware.mtrlwareid
  1034. FROM u_inware INNER JOIN
  1035. u_inwaremx ON u_inware.scid = u_inwaremx.scid AND
  1036. u_inware.inwareid = u_inwaremx.inwareid INNER JOIN
  1037. u_mtrlware ON u_inwaremx.scid = u_mtrlware.scid AND
  1038. u_inwaremx.mtrlid = u_mtrlware.mtrlid AND
  1039. u_inwaremx.plancode = u_mtrlware.plancode AND
  1040. u_inwaremx.status = u_mtrlware.Status AND
  1041. u_inwaremx.woodcode = u_mtrlware.woodcode AND
  1042. u_inwaremx.pcode = u_mtrlware.pcode AND
  1043. u_inwaremx.sptid_cusid = u_mtrlware.Sptid AND
  1044. u_inware.storageid = u_mtrlware.storageid AND
  1045. u_inware.Dxflag = u_mtrlware.Dxflag
  1046. Where (u_inware.flag = 1) And (u_inwaremx.mtrlwareid = 0);
  1047. IF sqlca.SQLCode <> 0 THEN
  1048. ROLLBACK;
  1049. MessageBox('','失败')
  1050. ELSE
  1051. COMMIT;
  1052. MessageBox('','成功')
  1053. END IF
  1054. end event
  1055. public subroutine wf_hidecol ();s_hide_col s_col
  1056. s_col.col_1 = 'u_mtrldef_bgamt'
  1057. s_col.col_2 = 'u_mtrldef_incamt'
  1058. s_col.col_3 = 'u_mtrldef_desamt'
  1059. s_col.col_4 = 'u_mtrldef_balcamt'
  1060. f_hide_col(123,dw_1,s_col)
  1061. end subroutine
  1062. public function window getparentwindow ();return this
  1063. end function
  1064. on w_warebalc_view.create
  1065. int iCurrent
  1066. call super::create
  1067. this.tv_1=create tv_1
  1068. this.st_2=create st_2
  1069. this.ddlb_storageid=create ddlb_storageid
  1070. this.cb_other=create cb_other
  1071. this.st_1=create st_1
  1072. this.em_month=create em_month
  1073. this.st_lastbalcdate=create st_lastbalcdate
  1074. this.ddlb_1=create ddlb_1
  1075. this.cb_balc=create cb_balc
  1076. iCurrent=UpperBound(this.Control)
  1077. this.Control[iCurrent+1]=this.tv_1
  1078. this.Control[iCurrent+2]=this.st_2
  1079. this.Control[iCurrent+3]=this.ddlb_storageid
  1080. this.Control[iCurrent+4]=this.cb_other
  1081. this.Control[iCurrent+5]=this.st_1
  1082. this.Control[iCurrent+6]=this.em_month
  1083. this.Control[iCurrent+7]=this.st_lastbalcdate
  1084. this.Control[iCurrent+8]=this.ddlb_1
  1085. this.Control[iCurrent+9]=this.cb_balc
  1086. end on
  1087. on w_warebalc_view.destroy
  1088. call super::destroy
  1089. destroy(this.tv_1)
  1090. destroy(this.st_2)
  1091. destroy(this.ddlb_storageid)
  1092. destroy(this.cb_other)
  1093. destroy(this.st_1)
  1094. destroy(this.em_month)
  1095. destroy(this.st_lastbalcdate)
  1096. destroy(this.ddlb_1)
  1097. destroy(this.cb_balc)
  1098. end on
  1099. event resize;call super::resize;//IF cbx_inout.Checked THEN
  1100. // tab_1.Visible = TRUE
  1101. //
  1102. // dw_1.Width = THIS.Width - dw_1.X - 40
  1103. // dw_1.Height = THIS.Height - dw_1.Y - tab_1.Height - 150
  1104. //
  1105. // tv_1.Height = THIS.Height - tv_1.Y - 150
  1106. //
  1107. //
  1108. //
  1109. // tab_1.Width = THIS.Width - tab_1.X - 40
  1110. //
  1111. // tab_1.Y = dw_1.Y + dw_1.Height + 10
  1112. // tab_1.X = dw_1.X
  1113. // tab_1.tabpage_1.dw_inout.Height = tab_1.tabpage_1.Height - tab_1.tabpage_1.dw_inout.Y - 40
  1114. // tab_1.tabpage_1.dw_inout.Width = tab_1.tabpage_1.Width - tab_1.tabpage_1.dw_inout.X - 40
  1115. // tab_1.tabpage_2.dw_out_noaudit.Height = tab_1.tabpage_2.Height - tab_1.tabpage_2.dw_out_noaudit.Y - 40
  1116. // tab_1.tabpage_2.dw_out_noaudit.Width = tab_1.tabpage_2.Width - tab_1.tabpage_2.dw_out_noaudit.X - 40
  1117. //ELSE
  1118. dw_1.Width = THIS.Width - dw_1.X - 40
  1119. dw_1.Height = THIS.Height - dw_1.Y - 150
  1120. tv_1.Height = THIS.Height - tv_1.Y - 150
  1121. // tab_1.Visible = FALSE
  1122. //
  1123. //END IF
  1124. end event
  1125. event ue_before_open;call super::ue_before_open;//cbx_1.visible = false
  1126. //cbx_inout.visible = false
  1127. ins_if_info = Long(f_ProfileString (sys_empid,This.ClassName(), "ins_if_info",'0'))
  1128. IF ins_if_info = 1 THEN
  1129. This.PostEvent('ue_mtrl_info')
  1130. END IF
  1131. end event
  1132. event ue_before_openretrieve;call super::ue_before_openretrieve;//tab_1.tabpage_1.dw_inout.settransobject(sqlca)
  1133. //tab_1.tabpage_2.dw_out_noaudit.settransobject(sqlca)
  1134. end event
  1135. event close;call super::close;IF IsValid(w_mtrl_info) THEN
  1136. ins_if_info = 1
  1137. ELSE
  1138. ins_if_info = 0
  1139. END IF
  1140. f_SetProfileString (sys_empid,This.ClassName(),"ins_if_info",String(ins_if_info))
  1141. end event
  1142. type cb_func from w_publ_easyq`cb_func within w_warebalc_view
  1143. end type
  1144. type cb_exit from w_publ_easyq`cb_exit within w_warebalc_view
  1145. integer x = 1536
  1146. end type
  1147. type cb_2 from w_publ_easyq`cb_2 within w_warebalc_view
  1148. integer x = 1234
  1149. boolean bringtotop = true
  1150. end type
  1151. type cb_psetup from w_publ_easyq`cb_psetup within w_warebalc_view
  1152. integer x = 978
  1153. boolean bringtotop = true
  1154. end type
  1155. type cb_1 from w_publ_easyq`cb_1 within w_warebalc_view
  1156. boolean bringtotop = true
  1157. end type
  1158. event cb_1::clicked;parent.triggerevent("retrieve_pageretr")
  1159. end event
  1160. type st_3 from w_publ_easyq`st_3 within w_warebalc_view
  1161. boolean visible = false
  1162. integer x = 690
  1163. integer y = 204
  1164. end type
  1165. type st_4 from w_publ_easyq`st_4 within w_warebalc_view
  1166. boolean visible = false
  1167. integer x = 1381
  1168. integer y = 204
  1169. end type
  1170. type em_1 from w_publ_easyq`em_1 within w_warebalc_view
  1171. boolean visible = false
  1172. integer x = 882
  1173. integer y = 188
  1174. integer taborder = 120
  1175. end type
  1176. type em_2 from w_publ_easyq`em_2 within w_warebalc_view
  1177. boolean visible = false
  1178. integer x = 1486
  1179. integer y = 188
  1180. integer taborder = 130
  1181. end type
  1182. type ddlb_yl from w_publ_easyq`ddlb_yl within w_warebalc_view
  1183. integer x = 2071
  1184. integer y = 8
  1185. end type
  1186. type cbx_yl from w_publ_easyq`cbx_yl within w_warebalc_view
  1187. integer x = 1861
  1188. integer y = 12
  1189. end type
  1190. type dw_1 from w_publ_easyq`dw_1 within w_warebalc_view
  1191. integer x = 805
  1192. integer y = 300
  1193. integer width = 2400
  1194. integer height = 988
  1195. string dataobject = "dw_warebalc_view_sum"
  1196. end type
  1197. event dw_1::doubleclicked;call super::doubleclicked;IF dwo.Name = 'u_mtrlware_waredscrp' THEN
  1198. Parent.TriggerEvent('ue_waredscrp_view')
  1199. END IF
  1200. end event
  1201. event dw_1::rowfocuschanged;call super::rowfocuschanged;Parent.TriggerEvent('ue_retrieve_info')
  1202. //IF cbx_inout.Checked THEN
  1203. // Parent.TriggerEvent('ue_retrieve_inoutmx')
  1204. //END IF
  1205. end event
  1206. type sle_mtrl from w_publ_easyq`sle_mtrl within w_warebalc_view
  1207. end type
  1208. type sle_cust from w_publ_easyq`sle_cust within w_warebalc_view
  1209. end type
  1210. type st_mtrl from w_publ_easyq`st_mtrl within w_warebalc_view
  1211. end type
  1212. type st_cust from w_publ_easyq`st_cust within w_warebalc_view
  1213. end type
  1214. type cbx_loginretr from w_publ_easyq`cbx_loginretr within w_warebalc_view
  1215. boolean visible = true
  1216. integer x = 1861
  1217. integer y = 100
  1218. end type
  1219. type pb_em1 from w_publ_easyq`pb_em1 within w_warebalc_view
  1220. boolean visible = false
  1221. integer x = 1298
  1222. integer y = 188
  1223. end type
  1224. type pb_em2 from w_publ_easyq`pb_em2 within w_warebalc_view
  1225. boolean visible = false
  1226. integer x = 1897
  1227. integer y = 188
  1228. end type
  1229. type pb_2 from w_publ_easyq`pb_2 within w_warebalc_view
  1230. boolean visible = false
  1231. integer x = 2007
  1232. integer y = 188
  1233. end type
  1234. type cb_help from w_publ_easyq`cb_help within w_warebalc_view
  1235. integer x = 1385
  1236. end type
  1237. type cb_copyself from w_publ_easyq`cb_copyself within w_warebalc_view
  1238. integer x = 722
  1239. end type
  1240. type gb_1 from w_publ_easyq`gb_1 within w_warebalc_view
  1241. end type
  1242. type ln_bar from w_publ_easyq`ln_bar within w_warebalc_view
  1243. end type
  1244. type ln_bar2 from w_publ_easyq`ln_bar2 within w_warebalc_view
  1245. end type
  1246. type r_bar from w_publ_easyq`r_bar within w_warebalc_view
  1247. integer x = 2272
  1248. end type
  1249. type ln_1 from w_publ_easyq`ln_1 within w_warebalc_view
  1250. end type
  1251. type ln_2 from w_publ_easyq`ln_2 within w_warebalc_view
  1252. end type
  1253. type ln_3 from w_publ_easyq`ln_3 within w_warebalc_view
  1254. boolean visible = false
  1255. end type
  1256. type ln_4 from w_publ_easyq`ln_4 within w_warebalc_view
  1257. boolean visible = false
  1258. end type
  1259. type tv_1 from uo_tv_mtrltype within w_warebalc_view
  1260. integer y = 300
  1261. integer width = 800
  1262. integer height = 1808
  1263. integer taborder = 130
  1264. boolean bringtotop = true
  1265. integer textsize = -9
  1266. fontcharset fontcharset = gb2312charset!
  1267. fontfamily fontfamily = anyfont!
  1268. string facename = "宋体"
  1269. end type
  1270. event selectionchanged;call super::selectionchanged;ls_handtype = THIS.uo_cur_info.handtype
  1271. ls_mtrltype = THIS.uo_cur_info.mtrltype
  1272. IF ls_handtype <> '' THEN
  1273. ls_mtrltype = '%'+ls_handtype+'%'
  1274. ls_handtype = ls_handtype+'%'
  1275. ELSE
  1276. ls_mtrltype = ""
  1277. END IF
  1278. PARENT.TriggerEvent('retrieve_pageretr')
  1279. end event
  1280. type st_2 from statictext within w_warebalc_view
  1281. integer x = 5
  1282. integer y = 204
  1283. integer width = 192
  1284. integer height = 48
  1285. boolean bringtotop = true
  1286. integer textsize = -9
  1287. integer weight = 400
  1288. fontcharset fontcharset = gb2312charset!
  1289. fontpitch fontpitch = variable!
  1290. string facename = "宋体"
  1291. long textcolor = 33554432
  1292. long backcolor = 134217739
  1293. string text = "仓库:"
  1294. alignment alignment = right!
  1295. boolean focusrectangle = false
  1296. end type
  1297. type ddlb_storageid from uo_ddlb_storageid within w_warebalc_view
  1298. integer x = 206
  1299. integer y = 188
  1300. integer width = 1088
  1301. integer height = 1232
  1302. integer taborder = 130
  1303. boolean bringtotop = true
  1304. end type
  1305. event constructor;call super::constructor;cur_storageid = this.uo_storageid
  1306. cur_storageid_arr = this.uo_storageid_arr
  1307. end event
  1308. event selectionchanged;call super::selectionchanged;cur_storageid = this.uo_storageid
  1309. cur_storageid_arr = this.uo_storageid_arr
  1310. cb_1.triggerevent(clicked!)
  1311. end event
  1312. type cb_other from uo_imflatbutton within w_warebalc_view
  1313. integer x = 466
  1314. integer width = 256
  1315. integer height = 164
  1316. integer taborder = 30
  1317. boolean bringtotop = true
  1318. string text = "辅助功能"
  1319. string normalpicname = "other.BMP"
  1320. integer picsize = 16
  1321. toolbaralignment pic_align = alignattop!
  1322. boolean border = false
  1323. end type
  1324. event clicked;call super::clicked;m_Dfc_Control_PopupMenu dmPopupMenu
  1325. String menustr
  1326. menustr = "Text=按上期结存数量金额重算本期结存表~tEvent=ue_cmp_amt2"
  1327. menustr = menustr + "|" + "Text=按现库存表数量金额倒推重算本期本期结存表~tEvent=ue_cmp_mtrlware"
  1328. menustr = menustr + "|" + "Text=超级重算~tEvent=ue_cmp"
  1329. menustr = menustr + "|" + "Text=-"
  1330. menustr = menustr + "|" + "Text=更新进仓单明细库存ID~tEvent=ue_update_inware_mtrlwareid"
  1331. menustr = menustr + "|" + "Text=物料相关查询~tEvent=ue_mtrl_info"
  1332. IF Len(Trim(menustr)) <> 0 THEN
  1333. dmPopupMenu = CREATE m_Dfc_Control_PopupMenu
  1334. dmPopupMenu.mf_BuildMenu(THIS, menustr)
  1335. dmPopupMenu.mf_PopMenu()
  1336. DESTROY dmPopupMenu
  1337. END IF
  1338. end event
  1339. type st_1 from statictext within w_warebalc_view
  1340. integer x = 1381
  1341. integer y = 204
  1342. integer width = 242
  1343. integer height = 48
  1344. boolean bringtotop = true
  1345. integer textsize = -9
  1346. integer weight = 400
  1347. fontcharset fontcharset = gb2312charset!
  1348. fontpitch fontpitch = variable!
  1349. string facename = "宋体"
  1350. long textcolor = 33554432
  1351. long backcolor = 134217739
  1352. string text = "结存日期"
  1353. alignment alignment = right!
  1354. boolean focusrectangle = false
  1355. end type
  1356. type em_month from editmask within w_warebalc_view
  1357. integer x = 1632
  1358. integer y = 188
  1359. integer width = 434
  1360. integer height = 88
  1361. integer taborder = 130
  1362. boolean bringtotop = true
  1363. integer textsize = -9
  1364. integer weight = 400
  1365. fontcharset fontcharset = gb2312charset!
  1366. fontpitch fontpitch = variable!
  1367. string facename = "宋体"
  1368. long textcolor = 33554432
  1369. string text = "none"
  1370. alignment alignment = center!
  1371. borderstyle borderstyle = stylelowered!
  1372. maskdatatype maskdatatype = datemask!
  1373. string mask = "yyyy-mm-dd"
  1374. boolean spin = true
  1375. end type
  1376. event constructor;this.text = string(today(),'yyyy-mm-dd')
  1377. end event
  1378. event rbuttondown;s_calender_arg s_calender
  1379. s_calender.PointerX = THIS.PointerX()
  1380. s_calender.PointerY = THIS.PointerY()
  1381. s_calender.X = THIS.X
  1382. s_calender.Y = THIS.Y
  1383. OpenWithParm(w_calendar,s_calender)
  1384. THIS.Text = String(id_date_selected)
  1385. end event
  1386. type st_lastbalcdate from statictext within w_warebalc_view
  1387. integer x = 2158
  1388. integer y = 204
  1389. integer width = 823
  1390. integer height = 48
  1391. boolean bringtotop = true
  1392. integer textsize = -9
  1393. integer weight = 400
  1394. fontcharset fontcharset = gb2312charset!
  1395. fontpitch fontpitch = variable!
  1396. string facename = "宋体"
  1397. long textcolor = 33554432
  1398. long backcolor = 134217739
  1399. string text = "最后结存日期"
  1400. boolean focusrectangle = false
  1401. end type
  1402. type ddlb_1 from dropdownlistbox within w_warebalc_view
  1403. integer x = 2427
  1404. integer y = 32
  1405. integer width = 745
  1406. integer height = 1100
  1407. integer taborder = 100
  1408. boolean bringtotop = true
  1409. integer textsize = -9
  1410. integer weight = 400
  1411. fontcharset fontcharset = gb2312charset!
  1412. fontpitch fontpitch = variable!
  1413. string facename = "宋体"
  1414. long textcolor = 33554432
  1415. string text = "汇总统计表"
  1416. boolean sorted = false
  1417. boolean vscrollbar = true
  1418. string item[] = {"汇总统计表","产品明细统计表","客户产品统计表","分类统计表","汇总统计表(设定售价)"}
  1419. borderstyle borderstyle = stylelowered!
  1420. end type
  1421. event selectionchanged;dw_1.SetRedraw(False)
  1422. dw_1.uf_save_profile_layout()
  1423. IF this.Text = '客户产品统计表' THEN
  1424. dw_1.DataObject = 'dw_warebalc_view'
  1425. ELSEIF this.Text = '产品明细统计表' THEN
  1426. dw_1.DataObject = 'dw_warebalc_view_sum_1'
  1427. ELSEIF this.Text = '汇总统计表' THEN
  1428. dw_1.DataObject = 'dw_warebalc_view_sum'
  1429. ELSEIF this.Text = '分类统计表' THEN
  1430. dw_1.DataObject = 'dw_warebalc_view_2'
  1431. ELSEIF this.Text = '汇总统计表(设定售价)' THEN
  1432. dw_1.DataObject = 'dw_warebalc_view_sum_saleprice'
  1433. END IF
  1434. dw_1.SetTransObject(sqlca)
  1435. dw_1.ins_INIfile_name = sys_inifilename
  1436. dw_1.ins_opemp = publ_operator
  1437. dw_1.cardw_empid = sys_empid
  1438. dw_1.cur_DataObject = dw_1.DataObject
  1439. dw_1.uf_read_profile_layout()
  1440. wf_hidecol()
  1441. f_title_change(dw_1)
  1442. dw_1.SetRedraw(True)
  1443. cb_1.TriggerEvent(Clicked!)
  1444. end event
  1445. type cb_balc from uo_imflatbutton within w_warebalc_view
  1446. integer x = 302
  1447. integer width = 165
  1448. integer height = 164
  1449. integer taborder = 30
  1450. boolean bringtotop = true
  1451. string text = "结存"
  1452. string normalpicname = "update2.BMP"
  1453. integer picsize = 16
  1454. toolbaralignment pic_align = alignattop!
  1455. boolean border = false
  1456. end type
  1457. event clicked;call super::clicked;IF NOT f_power_ind(75) THEN
  1458. MessageBox('提示','你没有使用权限!',information!,ok!)
  1459. RETURN
  1460. END IF
  1461. IF cur_storageid = -1 THEN
  1462. MessageBox("提示","请选择仓库结存",information!,ok!)
  1463. RETURN
  1464. END IF
  1465. balcdate = DateTime(Date(em_month.Text),Time('23:59:59'))
  1466. IF MessageBox ('询问',"是否确定要把当前日仓库进行结存操作吗?"+'~n'+&
  1467. '结存时间: '+String(balcdate,'YYYY-MM-DD HH:MM:SS')+',结存过程中不能进行其它操作!',Question!,YesNo! ) = 2 THEN RETURN
  1468. w_sys_wait.Show()
  1469. String arg_msg = '',err_msg = ''
  1470. uf_warebalc(1,0,cur_storageid,balcdate,arg_msg)
  1471. w_sys_wait.Hide()
  1472. MessageBox('提示',arg_msg,information!,ok!)
  1473. cb_1.TriggerEvent(Clicked!)
  1474. end event