以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  记录数  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=34808)

--  作者:bm
--  发布时间:2013/6/16 14:57:00
--  记录数

请高手帮忙优化下代码。如图要统计状态例不同状态记录数。显示在RibbonMenu.StatusBar.Message1 。如果有的话显示。没有的不用显示。

 


图片点击可在新窗口打开查看此主题相关图片如下:2013-06-16_14-53-53.jpg
图片点击可在新窗口打开查看

 

Dim f1,f2,f3 ,f4,f5,f6,f7,f8,f9 As String
f1 = "状态 = \'接单\'"
f2 = "状态 = \'已派车\'"
f3 = "状态 = \'作业中\'"
f4 = "状态 = \'待收单\'"
f5 = "状态 = \'待结账\'"

f6 = "状态 = \'正结费\'"
f7 = "状态 = \'待确认\'"
f8 = "状态 = \'待审核\'"
f9 = "状态 = \'已审核\'"
Dim c1 As Integer = Tables("业务大表").Compute("Count([_Identify])",f1)
Dim c2 As Integer = Tables("业务大表").Compute("Count([_Identify])",f2)
Dim c3 As Integer = Tables("业务大表").Compute("Count([_Identify])",f3)
Dim c4 As Integer = Tables("业务大表").Compute("Count([_Identify])",f4)
Dim c5 As Integer = Tables("业务大表").Compute("Count([_Identify])",f5)
Dim c6 As Integer = Tables("业务大表").Compute("Count([_Identify])",f6)
Dim c7 As Integer = Tables("业务大表").Compute("Count([_Identify])",f7)
Dim c8 As Integer = Tables("业务大表").Compute("Count([_Identify])",f8)
Dim c9 As Integer = Tables("业务大表").Compute("Count([_Identify])",f9)
RibbonMenu.StatusBar.Message1 =  "接单:" & c1 & "  已派车:" & c2 & "  作业中:" & c3 & "  待收单:" & c4 & "  待结账:" & c5 & "  正结费:" & c6 & "  待确认:" & c7 & "  待审核:" & c8 & "  已审核:" & c9

 


--  作者:y2287958
--  发布时间:2013/6/16 16:27:00
--  
试试这个或者参考一下:
Dim s As String
Dim f() As String = {"接单","已派车","作业中","待收单","待结账","正结费","待确认","待审核","已审核"}
For i As Integer = 0 To f.Length-1
    Dim c As Integer = Tables("业务大表").Compute("Count([_Identify])","状态 = \'" & f(i) & "\'")
    If c > 0
        s += f(i) & ":" & c
    End If
Next
RibbonMenu.StatusBar.Message1 =  s

--  作者:bm
--  发布时间:2013/6/16 18:28:00
--  谢谢
谢谢了。非常好用图片点击可在新窗口打开查看