Tables(e.form.Name & "_Table1").fill("selec a.供应商编码, a.供应商名称,a.简码, 期初金额, sum(金额2) as 进货金额, sum(金额1) as 付款金额,(isnull(期初金额,0)-isnull(sum(金额2),0)+isnull(sum(金额1),0)) as 余额 from {供应商} as a left join ( selec 单位编码, 单位名称, 贷方金额 as 金额1, 0 as 金额2 from {资金收付明细单} where 单据状态='已审核' union all selec 供应商编码,供应商名称,0,实际金额 as 金额2 from {辅料流水帐} where 单据状态='已审核') As b on a.供应商编码 = b.单位编码 And a.供应商名称 = b.单位名称 group by a.供应商编码, a.供应商名称,a.简码,期初金额","wjhansdata",True)
'Tables(e.form.Name & "_Table1").SetColVisibleWidth("产品编码|60|产品名称|236|产品规格|100|基本单位|60|辅助库存|60|库存数量|100")
Tables(e.form.Name & "_Table1").Cols("期初金额").GrandTotal = True '指定要合计的列
Tables(e.form.Name & "_Table1").Cols("进货金额").GrandTotal = True
Tables(e.form.Name & "_Table1").Cols("付款金额").GrandTotal = True
Tables(e.form.Name & "_Table1").Cols("余额").GrandTotal = True
Tables(e.form.Name & "_Table1").SetColVisibleWidth("供应商编码|60|供应商名称|260|余额|120")
Tables(e.form.Name & "_Table1").GrandTotal = True '显示合计模式
'Tables(e.form.Name & "_Table1").DataTable.DataCols("余额").SetFormat("0.00")
这样计算出来的