Tables(e.form.Name & "_Table1").fill("select a.*,b.已交货数量 from (select 加工商名称,产品名称,产品规格,产品型号,sum(发出数量) as 计划数,0 as 已交货数量, 0 as 未交货数量,状态,可超出比例,'' As 是否已完成,开单时间 from {加工计划明细} where 单据状态='已审核' and 单据类别='横机' group by 加工商名称,产品名称,产品规格,产品型号,状态,可超出比例,是否已完成,开单时间) as a left join (select c.加工商名称,c.产品名称,c.产品规格,c.产品型号,sum(c.收回数量) as 已交货数量 from {加工收发明细} as c inner join {加工计划明细} as d on c.加工商名称=d.加工商名称 AND c.产品名称=d.产品名称 and c.产品规格=d.产品规格 and c.产品型号=d.产品型号 where d.单据状态='已审核' and d.单据类别='横机' group by c.加工商名称,c.产品名称,c.产品规格,c.产品型号) as b on a.加工商名称=b.加工商名称 AND a.产品名称=b.产品名称 and a.产品规格=b.产品规格 and a.产品型号=b.产品型号","wjhansdata",True)
|