--
换个位置处理,在总计前加一个小计
……
End If
.Body.AddRow(r("NO."),r("产品"),r("客户"),r("数量"),r("单价"),r("金额"),r("日期"))
Next
Dim lr As DataRow = dt.DataRows(dt.DataRows.count - 1)
qty = dt.compute("sum(数量)","产品=\'" & lr("产品") & "\' And 客户= \'" & lr("客户") & "\'")
amt = dt.compute("sum(金额)","产品=\'" & lr("产品") & "\' And 客户= \'" & lr("客户") & "\'")
With .Body.AddRow()
.Attribute = "style=\'background-color:#F0FFFF\'"
.AddCell("小计 " & lr("客户"),"colspan=\'3\'")
.AddCells(qty,"",amt,"")
End With
End If
qty = dt.compute("sum(数量)")
amt = dt.compute("sum(金额)")
If EndRow >= Count Then
.Body.AddRow("总计","","",qty,"",amt,"").Attribute = "style=\'background-color:#98FB98\'"
End If