123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375 |
- $PBExportHeader$w_repair_balc_before.srw
- forward
- global type w_repair_balc_before from w_publ_base
- end type
- type st_1 from statictext within w_repair_balc_before
- end type
- type st_2 from statictext within w_repair_balc_before
- end type
- type st_3 from statictext within w_repair_balc_before
- end type
- type st_4 from statictext within w_repair_balc_before
- end type
- type st_5 from statictext within w_repair_balc_before
- end type
- type sle_balcdateint from singlelineedit within w_repair_balc_before
- end type
- type sle_balcdateint_before from singlelineedit within w_repair_balc_before
- end type
- type cb_1 from commandbutton within w_repair_balc_before
- end type
- type ddlb_1 from uo_ddlb_storageid within w_repair_balc_before
- end type
- end forward
- global type w_repair_balc_before from w_publ_base
- integer width = 2222
- integer height = 892
- boolean minbox = false
- windowtype windowtype = response!
- st_1 st_1
- st_2 st_2
- st_3 st_3
- st_4 st_4
- st_5 st_5
- sle_balcdateint sle_balcdateint
- sle_balcdateint_before sle_balcdateint_before
- cb_1 cb_1
- ddlb_1 ddlb_1
- end type
- global w_repair_balc_before w_repair_balc_before
- type variables
- long cur_storageid = -1
- end variables
- on w_repair_balc_before.create
- int iCurrent
- call super::create
- this.st_1=create st_1
- this.st_2=create st_2
- this.st_3=create st_3
- this.st_4=create st_4
- this.st_5=create st_5
- this.sle_balcdateint=create sle_balcdateint
- this.sle_balcdateint_before=create sle_balcdateint_before
- this.cb_1=create cb_1
- this.ddlb_1=create ddlb_1
- iCurrent=UpperBound(this.Control)
- this.Control[iCurrent+1]=this.st_1
- this.Control[iCurrent+2]=this.st_2
- this.Control[iCurrent+3]=this.st_3
- this.Control[iCurrent+4]=this.st_4
- this.Control[iCurrent+5]=this.st_5
- this.Control[iCurrent+6]=this.sle_balcdateint
- this.Control[iCurrent+7]=this.sle_balcdateint_before
- this.Control[iCurrent+8]=this.cb_1
- this.Control[iCurrent+9]=this.ddlb_1
- end on
- on w_repair_balc_before.destroy
- call super::destroy
- destroy(this.st_1)
- destroy(this.st_2)
- destroy(this.st_3)
- destroy(this.st_4)
- destroy(this.st_5)
- destroy(this.sle_balcdateint)
- destroy(this.sle_balcdateint_before)
- destroy(this.cb_1)
- destroy(this.ddlb_1)
- end on
- type cb_func from w_publ_base`cb_func within w_repair_balc_before
- boolean visible = false
- integer x = 1152
- integer y = 832
- end type
- type cb_exit from w_publ_base`cb_exit within w_repair_balc_before
- integer x = 1838
- integer y = 684
- end type
- type st_1 from statictext within w_repair_balc_before
- integer x = 357
- integer y = 60
- integer width = 146
- integer height = 56
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- long backcolor = 134217739
- string text = "仓库"
- boolean focusrectangle = false
- end type
- type st_2 from statictext within w_repair_balc_before
- integer x = 82
- integer y = 160
- integer width = 402
- integer height = 48
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- long backcolor = 134217739
- string text = "要修复的结存日"
- boolean focusrectangle = false
- end type
- type st_3 from statictext within w_repair_balc_before
- integer x = 64
- integer y = 252
- integer width = 402
- integer height = 56
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- long backcolor = 134217739
- string text = "以往的结存日"
- alignment alignment = right!
- boolean focusrectangle = false
- end type
- type st_4 from statictext within w_repair_balc_before
- integer x = 59
- integer y = 388
- integer width = 1632
- integer height = 60
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 16711680
- long backcolor = 134217739
- string text = "说明:在~"要修复的结存日~"中输入想要修复的结存日,如~"20081031~","
- boolean focusrectangle = false
- end type
- type st_5 from statictext within w_repair_balc_before
- integer x = 197
- integer y = 444
- integer width = 1947
- integer height = 208
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 16711680
- long backcolor = 134217739
- string text = "在~"以往的结存日~"中输入要修复的结存日之前的一个结存日,比如要修复的结存日是~"20081031~",~"20081031~"之前的结存日是~"20080930~",则在~"以往结存日~"中输入~"20080930~""
- boolean focusrectangle = false
- end type
- type sle_balcdateint from singlelineedit within w_repair_balc_before
- integer x = 512
- integer y = 152
- integer width = 402
- integer height = 84
- integer taborder = 20
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- borderstyle borderstyle = stylelowered!
- end type
- type sle_balcdateint_before from singlelineedit within w_repair_balc_before
- integer x = 512
- integer y = 256
- integer width = 402
- integer height = 84
- integer taborder = 30
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- long textcolor = 33554432
- borderstyle borderstyle = stylelowered!
- end type
- type cb_1 from commandbutton within w_repair_balc_before
- integer x = 1495
- integer y = 48
- integer width = 293
- integer height = 108
- integer taborder = 20
- boolean bringtotop = true
- integer textsize = -9
- integer weight = 400
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- string text = "重算"
- end type
- event clicked;IF MessageBox ("询问","是否确认要执行操作?",question!,yesno! ) = 2 THEN RETURN
- IF cur_storageid = -1 THEN
- MessageBox('提示','请选择仓库',information!,ok!)
- RETURN
- END IF
- IF Trim(sle_balcdateint.Text) = '' OR Trim(sle_balcdateint_before.Text) = '' THEN
- MessageBox('提示','请输入正确的结存日期',information!,ok!)
- RETURN
- END IF
- Long ll_balcdateint,ll_balcdateint_before
- Long rslt
- rslt = 1
- String arg_msg
- ll_balcdateint = Long(sle_balcdateint.Text)
- ll_balcdateint_before = Long(sle_balcdateint_before.Text)
- //1.用上次结存的结余金额更新要修改的结存的期初金额
- UPDATE u_warebalc
- SET u_warebalc.bgamt = a.balcamt
- FROM u_warebalc INNER JOIN
- (SELECT mtrlid, Storageid, status, pcode, woodcode, balcqty, balcamt
- FROM u_warebalc
- WHERE (Storageid = :cur_storageid) AND (balcdateint = :ll_balcdateint_before)) a ON
- u_warebalc.mtrlid = a.mtrlid AND u_warebalc.Storageid = a.Storageid AND
- u_warebalc.status = a.status AND u_warebalc.pcode = a.pcode AND
- u_warebalc.woodcode = a.woodcode
- Where (u_warebalc.Storageid = :cur_storageid) And (u_warebalc.balcdateint = :ll_balcdateint);
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '更新结存期初金额失败'
- GOTO ext
- END IF
- //2.用当时结存的进仓单金额汇总出结存的期间进金额
- UPDATE u_warebalc
- SET u_warebalc.incamt = a.amt
- FROM u_warebalc INNER JOIN
- (SELECT u_inwaremx.mtrlid, u_inwaremx.status, u_inwaremx.woodcode,
- u_inwaremx.pcode, ISNULL(SUM(u_inwaremx.qty), 0) AS qty,
- ISNULL(SUM(ROUND(u_inwaremx.cost * u_inwaremx.qty, 2)), 0) AS amt,
- u_inware.storageid
- FROM u_inware INNER JOIN
- u_inwaremx ON u_inware.scid = u_inwaremx.scid AND
- u_inware.inwareid = u_inwaremx.inwareid
- WHERE (u_inware.balcdateint = :ll_balcdateint) AND (u_inware.flag = 1)
- GROUP BY u_inwaremx.mtrlid, u_inwaremx.status, u_inwaremx.woodcode,
- u_inwaremx.pcode, u_inware.storageid) a ON
- u_warebalc.mtrlid = a.mtrlid AND u_warebalc.Storageid = a.storageid AND
- u_warebalc.status = a.status AND u_warebalc.pcode = a.pcode AND
- u_warebalc.woodcode = a.woodcode
- WHERE (u_warebalc.balcdateint = :ll_balcdateint)
- And (u_warebalc.Storageid = :cur_storageid);
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '更新现结存期间进金额失败'
- GOTO ext
- END IF
- //2.1更新出仓单costamt
- UPDATE u_outwaremx
- SET u_outwaremx.costamt = CASE (a.bgqty + a.incqty)
- WHEN 0 THEN 0 ELSE (a.bgamt + a.incamt) / (a.bgqty + a.incqty)
- END * u_outwaremx.qty
- FROM u_outwaremx INNER JOIN
- u_outware ON u_outwaremx.scid = u_outware.scid AND
- u_outwaremx.outwareid = u_outware.outwareid INNER JOIN
- (SELECT mtrlid, Storageid, status, pcode, woodcode, bgamt, incamt, bgqty,
- incqty
- FROM u_warebalc) a ON u_outwaremx.mtrlid = a.mtrlid AND
- u_outware.StorageID = a.Storageid AND u_outwaremx.status = a.status AND
- u_outwaremx.woodcode = a.woodcode AND u_outwaremx.pcode = a.pcode
- WHERE (u_outware.balcdateint = :ll_balcdateint) AND (u_outware.flag = 1)
- And (u_outware.Storageid = :cur_storageid);
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '更新出仓单金额失败'
- GOTO ext
- END IF
-
- //3.用当时结存的出仓单金额汇总出结存的期间出金额
- UPDATE u_warebalc
- SET u_warebalc.desamt = a.amt
- FROM u_warebalc INNER JOIN
- (SELECT u_outwaremx.mtrlid, u_outwaremx.status, u_outwaremx.woodcode,
- u_outwaremx.pcode, ISNULL(SUM(u_outwaremx.qty), 0) AS qty,
- ISNULL(SUM(ROUND(u_outwaremx.costamt, 2)), 0) AS amt,
- u_outware.StorageID
- FROM u_outware INNER JOIN
- u_outwaremx ON u_outware.scid = u_outwaremx.scid AND
- u_outware.outwareid = u_outwaremx.outwareid
- WHERE (u_outware.balcdateint = :ll_balcdateint) AND (u_outware.flag = 1)
- GROUP BY u_outwaremx.mtrlid, u_outwaremx.status, u_outwaremx.woodcode,
- u_outwaremx.pcode, u_outware.StorageID) a ON
- u_warebalc.mtrlid = a.mtrlid AND u_warebalc.Storageid = a.StorageID AND
- u_warebalc.status = a.status AND u_warebalc.pcode = a.pcode AND
- u_warebalc.woodcode = a.woodcode
- WHERE (u_warebalc.balcdateint = :ll_balcdateint)
- And (u_warebalc.Storageid = :cur_storageid);
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '更新结存期间出金额失败'
- GOTO ext
- END IF
- //4.更新结余金额
- UPDATE u_warebalc
- SET balcamt = bgamt + incamt - desamt
- WHERE balcdateint = :ll_balcdateint
- AND Storageid = :cur_storageid;
- IF sqlca.SQLCode <> 0 THEN
- rslt = 0
- arg_msg = '更新结余金额失败'
- GOTO ext
- END IF
- ext:
- IF rslt = 1 THEN
- COMMIT;
- MessageBox('提示','操作完成!',information!,ok!)
- ELSE
- ROLLBACK;
- MessageBox('错误',arg_msg,stopsign!,ok!)
- END IF
- end event
- type ddlb_1 from uo_ddlb_storageid within w_repair_balc_before
- integer x = 512
- integer y = 52
- integer width = 635
- integer height = 504
- integer taborder = 20
- boolean bringtotop = true
- end type
- event selectionchanged;call super::selectionchanged;cur_storageid = this.uo_storageid
- end event
- event constructor;call super::constructor;cur_storageid = this.uo_storageid
- end event
|