以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- HTML报表 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=187550) |
-- 作者:denghui69986 -- 发布时间:2023/7/25 18:01:00 -- HTML报表 在论坛看见一个不一样的报表,试了很多次,把下面代码统计一周需要修改成统计一个月,试了多次没改成功,老师帮忙指点统计一个月修改那里没看明白,谢谢 http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=32104&authorid=0&page=0&star=1
Dim s1,s2,s3,flt,flt1,lms As String
Dim drs1 As List(of DataRow)
Dim sb1 As new StringBuilder
Dim n1,sn1 As Double
Dim v1,v2 As String()
Dim d1 As Date
d1=Date.Today.Adddays(-Date.Today.DayOfWeek)
flt = "日期 >= #" & d1 & "#"
s3 ="</Center></b></td>" & vbcrlf & New String(" ",6) & "<td><b><Center>"
lms = "日期,产品,数量,单价,折扣,金额,备注"
v1 = lms.split(",")
v2 = DataTables("订单").GetComboListString("姓名",flt).split("|")
sb1.Append("<html> <body background=""..\\Images\\bj.jpg""><Center>" & vbcrlf & vbcrlf)
For Each s1 In v2
flt1 = "姓名 =\'" & s1 & "\' And " & flt
drs1 =DataTables("订单").Select(flt1,"日期")
sn1=DataTables("订单").Compute("sum(金额)",flt1)
If s1 > v2(0) Then
sb1.Appendline("</Table>" )
sb1.AppendLine("<pre>" & vbcrlf & vbcrlf & vbcrlf )
Else
sb1.AppendLine("<pre>")
End If
sb1.Append( "<h3><font color=""blue"">" & s1 & "</font> 本周报表" & new String(" ",13))
sb1.Append("金额合计 : <font color=""blue"">¥" & Format(sn1,"#,###.00") & "</Font></pre></h3>")
sb1.AppendLine(vbcrlf & vbcrlf & "<Table border=""1""")
sb1.AppendLine("cellpadding=""20"">")
sb1.AppendLine(vbcrlf & "<h4>" & vbcrlf & "<tr>")
sb1.Appendline(New String(" ",6) & "<td><b><Center>" & lms.replace(",",s3) & "</Center></b></td>" )
sb1.Appendline("</tr></h4>" )
For Each dr As DataRow In drs1
n1=0
For Each s2 In v1
If n1 = 0 Then sb1.Appendline( "<tr>")
If dr.isnull(s2) Then
sb1.Appendline(New String(" ",6) & "<td> </td>" )
Else
sb1.Appendline(New String(" ",6) & "<td>" & Cstr(dr(s2)) & "</td>" )
End If
If n1 = v1.length-1 Then sb1.AppendLine("</tr>")
n1+=1
Next
Next
Next
sb1.Appendline( vbcrlf & "</Center></body></html>")
flt =ProjectPath & "通讯记录\\Test.Html"
FileSys.WriteAllText(flt,sb1.Tostring , False, Encoding.UTF8)
Dim Proc As New Process \'定义一个新的Process
Proc.File = Flt
Proc.Start() |
-- 作者:有点蓝 -- 发布时间:2023/7/25 20:09:00 -- d1=Date.Today.Adddays(-Date.Today.DayOfWeek) 改为 d1=Date.Today.Addmonths(-1)
|
-- 作者:denghui69986 -- 发布时间:2023/7/26 7:31:00 -- 感谢 |