以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 怎么缺小计? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=129756) |
||||
-- 作者:jseteary -- 发布时间:2019/1/5 13:18:00 -- 怎么缺小计? 此主题相关图片如下:qq图片20190105131045.png 我做了一个汇总,怎么缺少小计,请大师指点一下 代码如下见附件
|
||||
-- 作者:有点蓝 -- 发布时间:2019/1/5 14:24:00 -- …… With wb.AddTable("","Table1") Dim nms() As String Dim qty As Double Dim amt As Double .Head.AddRow("No.","年","月份","岗位工资","岗位系数","应发工资","实发工资") For i As Integer = 0 To dt.DataRows.count - 1 Dim r As DataRow = dt.DataRows(i) If i > 0 Then Dim lr As DataRow = dt.DataRows(i-1) If r("年") <> lr("年") Then qty = dt.compute("sum(应发工资)","年= \'" & lr("年") & "\'") amt = dt.compute("sum(实发工资)","年= \'" & lr("年") & "\'") With .Body.AddRow() .Attribute = "style=\'background-color:#F0FFFF\'" .AddCell(lr("年") & "小计 " ,"colspan=\'3\'") .AddCells("","",qty,amt) End With End If End If .Body.AddRow(r("NO."),r("年"),r("月份"),r("岗位工资"),r("岗位系数"),r("应发工资"),r("实发工资")) Next Dim r1 As DataRow = dt.DataRows(dt.DataRows.count - 1) qty = dt.compute("sum(应发工资)","年= \'" & r1("年") & "\'") amt = dt.compute("sum(实发工资)","年= \'" & r1("年") & "\'") With .Body.AddRow() .Attribute = "style=\'background-color:#F0FFFF\'" .AddCell(r1("年") & "小计 " ,"colspan=\'3\'") .AddCells("","",qty,amt) End With qty = dt.compute("sum(应发工资)") amt = dt.compute("sum(实发工资)") .Body.AddRow("总计","","","","",qty,amt).Attribute = "style=\'background-color:#98FB98\'" End With …… |
||||
-- 作者:jseteary -- 发布时间:2019/1/5 14:35:00 -- 解决,谢谢 |