Foxtable(狐表)用户栏目专家坐堂 → 问问兄弟们百分比显示怎么做啊!


  共有4396人关注过本帖树形打印复制链接

主题:问问兄弟们百分比显示怎么做啊!

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/27 22:45:00 [显示全部帖子]

 代码如下,做小部分,其余部分,你参考去做

 

 http://www.foxtable.com/help/topics/2720.htm

 

 

Dim d1 As Date = e.Form.Controls("DateTimePicker1").Value
Dim d2 As Date = e.Form.Controls("DateTimePicker2").Value

Dim filter1 As String
Dim filter2 As String
If e.Form.Controls("RadioButton1").Checked Then
    Dim w As Integer = d1.DayOfWeek '算出今天是星期几
    Dim dt1 As Date = d1.AddDays(-w) '获取本周的第一天
    Dim dt2 As Date = d1.AddDays(6 - w) '获取本周的最后一天
    filter1 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
   
    w = d2.DayOfWeek '算出今天是星期几
    dt1 = d2.AddDays(-w) '获取本周的第一天
    dt2 = d2.AddDays(6 - w) '获取本周的最后一天
    filter2 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
Else If e.Form.Controls("RadioButton2").Checked Then
   
Else If e.Form.Controls("RadioButton3").Checked Then
   
Else If e.Form.Controls("RadioButton4").Checked Then
   
End If

e.Form.Controls("Label7").Text = DataTables("表a").Compute("sum(销售额)", filter1)
e.Form.Controls("Label01").Text = DataTables("表a").Compute("sum(销售额)", filter2)
e.Form.Controls("Label8").Text = DataTables("表a").Compute("sum(利润)", filter1)
e.Form.Controls("Label13").Text = format(val(e.Form.Controls("Label8").Text) / val(e.Form.Controls("Label7").Text) * 100, "#.00") & "%"


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/28 15:57:00 [显示全部帖子]

 回复6楼,给已经给你做了本周的了,其余的,你只需要简单设置一下filter1,filter2就行了。

 

 你说的图表是什么意思?这个? http://www.foxtable.com/help/topics/0972.htm

 


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/28 19:30:00 [显示全部帖子]

按钮代码

 

Dim d1 As Date = e.Form.Controls("DateTimePicker1").Value
Dim d2 As Date = e.Form.Controls("DateTimePicker2").Value
Dim filter1 As String
Dim filter2 As String
If e.Form.Controls("RadioButton1").Checked Then
    Dim w As Integer = d1.DayOfWeek '算出今天是星期几
    Dim dt1 As Date = d1.AddDays(-w) '获取本周的第一天
    Dim dt2 As Date = d1.AddDays(6 - w) '获取本周的最后一天
    filter1 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
   
    w = d2.DayOfWeek '算出今天是星期几
    dt1 = d2.AddDays(-w) '获取本周的第一天
    dt2 = d2.AddDays(6 - w) '获取本周的最后一天
    filter2 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
Else If e.Form.Controls("RadioButton2").Checked Then
    Dim y As Integer = d1.Year
    Dim m As Integer = d1.Month
    Dim dt1 As New Date(y, m, 1)
    Dim dt2 As New Date(y, m, Date.DaysInMonth(y, m)) '获取本月的最后一天
    filter1 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
   
    y = d2.Year
    m = d2.Month
    dt1 = New Date(y, m, 1)
    dt2 = New Date(y, m, Date.DaysInMonth(y, m)) '获取本月的最后一天
    filter2 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
Else If e.Form.Controls("RadioButton3").Checked Then
    Dim y As Integer = Date.Today.Year
    Dim dt1 As New Date(y, 1, 1)
    Dim dt2 As New Date(y, 12, 31)
    filter1 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
   
    y = Date.Today.Year
    dt1 = New Date(y, 1, 1)
    dt2 = New Date(y, 12, 31)
    filter2 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
   
Else If e.Form.Controls("RadioButton4").Checked Then
    filter1 = "1=1"
    filter2 = "1=1"
End If
e.Form.Controls("Label7").Text = DataTables("表a").Compute("sum(销售额)", filter1)
e.Form.Controls("Label01").Text = DataTables("表a").Compute("sum(销售额)", filter2)
e.Form.Controls("Label8").Text = DataTables("表a").Compute("sum(利润)", filter1)
e.Form.Controls("Label13").Text = format(val(e.Form.Controls("Label8").Text) / val(e.Form.Controls("Label7").Text) * 100, "#.00") & "%"

e.Form.Controls("Label7").Text = DataTables("表a").Compute("sum(销售额)", filter1)
e.Form.Controls("Label29").Text = DataTables("表a").Compute("sum(销售额)", filter2)
e.Form.Controls("Label27").Text = DataTables("表a").Compute("sum(合计成本)", filter1)
e.Form.Controls("Label26").Text = format(val(e.Form.Controls("Label27").Text) / val(e.Form.Controls("Label7").Text) * 100, "#.00") & "%"

e.Form.Controls("Label7").Text = DataTables("表a").Compute("sum(销售额)", filter1)
e.Form.Controls("Label05").Text = DataTables("表a").Compute("sum(销售额)", filter2)
e.Form.Controls("Label9").Text = DataTables("表a").Compute("sum(货物成本)", filter1)
e.Form.Controls("Label14").Text = format(val(e.Form.Controls("Label9").Text) / val(e.Form.Controls("Label7").Text) * 100, "#.00") & "%"

e.Form.Controls("Label7").Text = DataTables("表a").Compute("sum(销售额)", filter1)
e.Form.Controls("Label08").Text = DataTables("表a").Compute("sum(销售额)", filter2)
e.Form.Controls("Label10").Text = DataTables("表a").Compute("sum(物流成本)", filter1)
e.Form.Controls("Label15").Text = format(val(e.Form.Controls("Label10").Text) / val(e.Form.Controls("Label7").Text) * 100, "#.00") & "%"

e.Form.Controls("Label7").Text = DataTables("表a").Compute("sum(销售额)", filter1)
e.Form.Controls("Label09").Text = DataTables("表a").Compute("sum(销售额)", filter2)
e.Form.Controls("Label11").Text = DataTables("表a").Compute("sum(其它成本)", filter1)
e.Form.Controls("Label16").Text = format(val(e.Form.Controls("Label11").Text) / val(e.Form.Controls("Label7").Text) * 100, "#.00") & "%"


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/28 20:21:00 [显示全部帖子]

  这段改一改,本季,参考  http://www.foxtable.com/help/topics/2720.htm

 

If e.Form.Controls("RadioButton1").Checked Then
    Dim w As Integer = d1.DayOfWeek '算出今天是星期几
    Dim dt1 As Date = d1.AddDays(-w) '获取本周的第一天
    Dim dt2 As Date = d1.AddDays(6 - w) '获取本周的最后一天
    filter1 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
   
    w = d2.DayOfWeek '算出今天是星期几
    dt1 = d2.AddDays(-w) '获取本周的第一天
    dt2 = d2.AddDays(6 - w) '获取本周的最后一天
    filter2 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
Else If e.Form.Controls("RadioButton2").Checked Then
    Dim y As Integer = d1.Year
    Dim m As Integer = d1.Month
    Dim dt1 As New Date(y, m, 1)
    Dim dt2 As New Date(y, m, Date.DaysInMonth(y, m)) '获取本月的最后一天
    filter1 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
   
    y = d2.Year
    m = d2.Month
    dt1 = New Date(y, m, 1)
    dt2 = New Date(y, m, Date.DaysInMonth(y, m)) '获取本月的最后一天
    filter2 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
Else If e.Form.Controls("RadioButton3").Checked Then
    Dim y As Integer = d1.Year
    Dim dt1 As New Date(y, 1, 1)
    Dim dt2 As New Date(y, 12, 31)
    filter1 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
   
    y = d2.Year
    dt1 = New Date(y, 1, 1)
    dt2 = New Date(y, 12, 31)
    filter2 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
   
Else If e.Form.Controls("RadioButton4").Checked Then
    filter1 = "1=1"
    filter2 = "1=1"
End If


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/28 20:46:00 [显示全部帖子]

 回复12楼,之前的代码,测试本周没有问题。

 

 你记得,填入两个日期。


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/28 20:47:00 [显示全部帖子]

 回复12楼,本年的问题,看11楼的代码,改一下。

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/28 21:03:00 [显示全部帖子]

 可以,代码如下

 

Dim d1 As Date = e.Form.Controls("DateTimePicker1").Value
'Dim d2 As Date = e.Form.Controls("DateTimePicker2").Value
Dim filter1 As String
'Dim filter2 As String
If e.Form.Controls("RadioButton1").Checked Then
    Dim w As Integer = d1.DayOfWeek '算出今天是星期几
    Dim dt1 As Date = d1.AddDays(-w) '获取本周的第一天
    Dim dt2 As Date = d1.AddDays(6 - w) '获取本周的最后一天
    filter1 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
   
    'w = d2.DayOfWeek '算出今天是星期几
    'dt1 = d2.AddDays(-w) '获取本周的第一天
    'dt2 = d2.AddDays(6 - w) '获取本周的最后一天
    'filter2 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
Else If e.Form.Controls("RadioButton2").Checked Then
    Dim y As Integer = d1.Year
    Dim m As Integer = d1.Month
    Dim dt1 As New Date(y, m, 1)
    Dim dt2 As New Date(y, m, Date.DaysInMonth(y, m)) '获取本月的最后一天
    filter1 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
   
    'y = d2.Year
    'm = d2.Month
    'dt1 = New Date(y, m, 1)
    'dt2 = New Date(y, m, Date.DaysInMonth(y, m)) '获取本月的最后一天
    'filter2 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
Else If e.Form.Controls("RadioButton3").Checked Then
    Dim y As Integer = d1.Year
    Dim dt1 As New Date(y, 1, 1)
    Dim dt2 As New Date(y, 12, 31)
    filter1 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
   
    'y = d1.Year
    'dt1 = New Date(y, 1, 1)
    'dt2 = New Date(y, 12, 31)
    'filter2 = "回款日期 >= #" & dt1 & "# and 回款日期 <= #" & dt2 & "#"
   
Else If e.Form.Controls("RadioButton4").Checked Then
    filter1 = "1=1"
    'filter2 = "1=1"
End If
e.Form.Controls("Label7").Text = DataTables("表a").Compute("sum(销售额)", filter1)
'e.Form.Controls("Label01").Text = DataTables("表a").Compute("sum(销售额)", filter2)
e.Form.Controls("Label8").Text = DataTables("表a").Compute("sum(利润)", filter1)
e.Form.Controls("Label13").Text = format(val(e.Form.Controls("Label8").Text) / val(e.Form.Controls("Label7").Text) * 100, "#.00") & "%"

e.Form.Controls("Label7").Text = DataTables("表a").Compute("sum(销售额)", filter1)
'e.Form.Controls("Label29").Text = DataTables("表a").Compute("sum(销售额)", filter2)
e.Form.Controls("Label27").Text = DataTables("表a").Compute("sum(合计成本)", filter1)
e.Form.Controls("Label26").Text = format(val(e.Form.Controls("Label27").Text) / val(e.Form.Controls("Label7").Text) * 100, "#.00") & "%"

e.Form.Controls("Label7").Text = DataTables("表a").Compute("sum(销售额)", filter1)
'e.Form.Controls("Label05").Text = DataTables("表a").Compute("sum(销售额)", filter2)
e.Form.Controls("Label9").Text = DataTables("表a").Compute("sum(货物成本)", filter1)
e.Form.Controls("Label14").Text = format(val(e.Form.Controls("Label9").Text) / val(e.Form.Controls("Label7").Text) * 100, "#.00") & "%"

e.Form.Controls("Label7").Text = DataTables("表a").Compute("sum(销售额)", filter1)
'e.Form.Controls("Label08").Text = DataTables("表a").Compute("sum(销售额)", filter2)
e.Form.Controls("Label10").Text = DataTables("表a").Compute("sum(物流成本)", filter1)
e.Form.Controls("Label15").Text = format(val(e.Form.Controls("Label10").Text) / val(e.Form.Controls("Label7").Text) * 100, "#.00") & "%"

e.Form.Controls("Label7").Text = DataTables("表a").Compute("sum(销售额)", filter1)
'e.Form.Controls("Label09").Text = DataTables("表a").Compute("sum(销售额)", filter2)
e.Form.Controls("Label11").Text = DataTables("表a").Compute("sum(其它成本)", filter1)
e.Form.Controls("Label16").Text = format(val(e.Form.Controls("Label11").Text) / val(e.Form.Controls("Label7").Text) * 100, "#.00") & "%"


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/28 21:22:00 [显示全部帖子]

代码

 

Else If e.Form.Controls("RadioButton5").Checked Then
Dim y As Integer = d1.Year
Dim q As Integer = (d1.Month - 1) \ 3 + 1 '计算现在是第几个季度
Dim dt1 As New Date(y, 3 * (q - 1) + 1, 1) '获取本季度的第一天
Dim dt2 As New Date(y, 3 * q, Date.DaysInMonth(y,3 * q)) '获取本季度的最后一天
Filter1 = "回款日期 >= #" & dt1 & "# And 回款日期 <= #" & dt2


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/28 21:29:00 [显示全部帖子]

Else If e.Form.Controls("RadioButton5").Checked Then
Dim y As Integer = d1.Year
Dim q As Integer = (d1.Month - 1) \ 3 + 1 '计算现在是第几个季度
Dim dt1 As New Date(y, 3 * (q - 1) + 1, 1) '获取本季度的第一天
Dim dt2 As New Date(y, 3 * q, Date.DaysInMonth(y,3 * q)) '获取本季度的最后一天
Filter1 = "回款日期 >= #" & dt1 & "# And 回款日期 <= #" & dt2 & "#"


 回到顶部