2,748
社区成员




Create Table 仓库操作a (物资编号 V(4),操作 V(4),数量 N(4),日期 D)
Insert Into 仓库操作a Values ("0001","期初",18,{^2016/03/21})
Insert Into 仓库操作a Values ("0002","入库",12,{^2016/03/04})
Insert Into 仓库操作a Values ("0002","出库",5,{^2016/03/20})
Insert Into 仓库操作a Values ("0001","出库",5,{^2016/03/14})
Insert Into 仓库操作a Values ("0005","期初",49,{^2016/03/11})
Create Table 物资信息表a (物资编号 V(4),物资名称 V(50),备注 V(40))
Insert Into 物资信息表a Values ("0001","灯管 T5 28W","")
Insert Into 物资信息表a Values ("0002","1#螺纹管","")
Insert Into 物资信息表a Values ("0003","光纤4芯黄色","")
Insert Into 物资信息表a Values ("0004","铜球阀DN20","原库存")
Insert Into 物资信息表a Values ("0005","六类网线浅蓝色","")
Set Default To Left(Sys(16),Rat('\',Sys(16)))
If Reccount() = 0
Messagebox("仓库操作表为空!",64,"系统提示")
Cancel
Endif
Sele 物资编号,操作,Sum(数量) 数量 From 仓库操作a Group By 物资编号,操作 Into Cursor 操作汇总
Do (_Genxtab) With '库存表' && 这个"库存表"是个cursor,在.prg中运行正常,连编成.EXE文件时提示"文件找不到"
*!* Select Dbf("库存表")
If Type("期初") = "U"
Alter Table 库存表 Add 期初 N(6)
Endif
If Type("入库") = "U"
Alter Table 库存表 Add 入库 N(6)
Endif
If Type("出库") = "U"
Alter Table 库存表 Add 出库 N(6)
Endif
Alter Table 库存表 Add 库存 N(8)
Repl All 库存 With (期初 + 入库 - 出库)
Select 库存表.物资编号,物资名称,期初,入库,出库,库存,物资信息表a.备注 From 库存表;
Inner Join 物资信息表a On 库存表.物资编号 = 物资信息表a.物资编号 Into Cursor 库存汇总表
Browse
Close Tables