Foxtable(狐表)用户栏目专家坐堂 → 帮我看看这个代码错在哪里,谢谢


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

主题:帮我看看这个代码错在哪里,谢谢

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


加好友 发短信
等级:二尾狐 帖子:524 积分:3676 威望:0 精华:0 注册:2012/7/27 10:28:00
帮我看看这个代码错在哪里,谢谢  发帖心情 Post By:2016/7/19 21:41:00 [只看该作者]

Dim chk As WinForm.CheckBox
chk = Forms("工资修改").Controls("是否满勤")
Dim jkje As WinForm.TextBox = e.Form.Controls("TB借款金额")
Dim kcfk As WinForm.TextBox = e.Form.Controls("TB扣除罚款")
Dim shbx As WinForm.TextBox = e.Form.Controls("TB社会保险")
Dim hjkc As WinForm.Label = e.Form.Controls("扣除金额")
Dim v1 As Double = Val(jkje.Text)
Dim v2 As Double = Val(kcfk.Text)
Dim v3 As Double = Val(shbx.Text)
Dim scbt As WinForm.TextBox = e.Form.Controls("TB生产补贴")
Dim clbt As WinForm.TextBox = e.Form.Controls("TB差旅补贴")
Dim fybx As WinForm.TextBox = e.Form.Controls("TB费用报销")
Dim btje As WinForm.Label = e.Form.Controls("补贴金额")
Dim v4 As Double = Val(scbt.Text)
Dim v5 As Double = Val(clbt.Text)
Dim v6 As Double = Val(fybx.Text)
Dim gzlb2 As WinForm.Label = e.Form.Controls("工资类别")
Dim tbgz As WinForm.TextBox = e.Form.Controls("TB工资数据")
Dim gzss As WinForm.TextBox = e.Form.Controls("TB工作时间")
Dim gzts As WinForm.TextBox = e.Form.Controls("TB工作天数")
Dim yfgz As WinForm.Label = e.Form.Controls("应发工资")
Dim mqts As WinForm.TextBox = e.Form.Controls("TB天数")
Dim sfgz As WinForm.Label = e.Form.Controls("实发工资")
Dim xg As WinForm.TextBox = e.Form.Controls("TB工资修改")
Dim g1 As Double = Val(tbgz.Text)
Dim g2 As Double = Val(gzss.Text)
Dim g3 As Double = Val(gzts.Text)
Dim g4 As Double = Val(mqts.Text)
Dim j1 As Double = Val(xg.Text)
Dim d As Double
Dim d2 As Double
Dim d3 As Double
Dim d4 As Double
Dim d5 As Double
Dim d6 As Double
Dim d7 As Double
Dim d8 As Double
d = v1 + v2 + v3
d2 = v4 + v5 + v6
d3 = g1 * g2
d4 = g1 * g2 - d + d2
d5 = g1 / g4 * g3
d6 = g1 / g4 * g3 - d + d2
d7 = g1
d8 = g1 - d + d2
If d > 0 Then
    e.Form.Controls("扣除金额").Visible=True
    e.Form.Controls("L扣元").Visible=True
    hjkc.text =format(d,"n")
Else
    e.Form.Controls("扣除金额").Visible=False
    e.Form.Controls("L扣元").Visible=False
End If
If d2 > 0 Then
    e.Form.Controls("补贴金额").Visible=True
    e.Form.Controls("L补元").Visible=True
    btje.text =format(d2,"n")
Else
    e.Form.Controls("补贴金额").Visible=False
    e.Form.Controls("L补元").Visible=False
End If
If gzlb2.text= "计时工资"  Then
    If xg.text ="" Then
        If d3 > 0 Or d4 > 0 Then
            e.Form.Controls("应发工资").Visible=True
            e.Form.Controls("实发工资").Visible=True
            e.Form.Controls("L1元").Visible=True
            e.Form.Controls("L实元").Visible=True
            yfgz.text =format(d3,"n")
            sfgz.text =format(d4,"n")
        Else
            e.Form.Controls("应发工资").Visible=False
            e.Form.Controls("L1元").Visible=False
            e.Form.Controls("实发工资").Visible=False
            e.Form.Controls("L1元").Visible=False
        End If
    Else
        e.Form.Controls("应发工资").Visible=True
        e.Form.Controls("实发工资").Visible=True
        e.Form.Controls("L1元").Visible=True
        e.Form.Controls("L实元").Visible=True
        yfgz.text =format(d3,"n")
        sfgz.text = format(j1,"n")
    End If
Else
    If gzlb2.text= "固定工资" Then
        If xg.text ="" Then
            If d5 >0 Or d6 > 0 Or d7 > 0 Or d8 > 0 Then
                If chk.Checked = True Then
                    e.Form.Controls("应发工资").Visible=True
                    e.Form.Controls("实发工资").Visible=True
                    e.Form.Controls("L1元").Visible=True
                    e.Form.Controls("L实元").Visible=True
                    yfgz.text =format(d7,"n")
                    sfgz.text =format(d8,"n")
                Else
                    e.Form.Controls("应发工资").Visible=True
                    e.Form.Controls("实发工资").Visible=True
                    e.Form.Controls("L1元").Visible=True
                    e.Form.Controls("L实元").Visible=True
                    yfgz.text =format(d5,"n")
                    sfgz.text =format(d6,"n")
                End If
            Else
                e.Form.Controls("应发工资").Visible=False
                e.Form.Controls("L1元").Visible=False
                e.Form.Controls("实发工资").Visible=False
                e.Form.Controls("L1元").Visible=False
            End If
        Else
            e.Form.Controls("应发工资").Visible=True
            e.Form.Controls("实发工资").Visible=True
            e.Form.Controls("L1元").Visible=True
            e.Form.Controls("L实元").Visible=True
            yfgz.text =format(d7,"n")
            sfgz.text = format(j1,"n")
        End If
    End If
End If

("应发工资")和("实发工资")不计算,搞不懂错在哪里了

 


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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/7/19 21:44:00 [只看该作者]


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


加好友 发短信
等级:二尾狐 帖子:524 积分:3676 威望:0 精华:0 注册:2012/7/27 10:28:00
  发帖心情 Post By:2016/7/19 21:47:00 [只看该作者]

看不懂,控件都是绑定了标的,但是我需要这些计算啊

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/7/19 21:49:00 [只看该作者]

Tables("表a").Current("第一列") = format(d3,"n")


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


加好友 发短信
等级:二尾狐 帖子:524 积分:3676 威望:0 精华:0 注册:2012/7/27 10:28:00
  发帖心情 Post By:2016/7/20 16:50:00 [只看该作者]

Dim chk As WinForm.CheckBox
chk = Forms("员工工资系统").Controls("是否满勤")
Dim jkje As WinForm.TextBox = e.Form.Controls("TB借款金额")
Dim kcfk As WinForm.TextBox = e.Form.Controls("TB扣除罚款")
Dim shbx As WinForm.TextBox = e.Form.Controls("TB社会保险")
Dim hjkc As WinForm.Label = e.Form.Controls("扣除金额")
Dim v1 As Double = Val(jkje.Text)
Dim v2 As Double = Val(kcfk.Text)
Dim v3 As Double = Val(shbx.Text)

Dim scbt As WinForm.TextBox = e.Form.Controls("TB生产补贴")
Dim clbt As WinForm.TextBox = e.Form.Controls("TB差旅补贴")
Dim fybx As WinForm.TextBox = e.Form.Controls("TB费用报销")
Dim btje As WinForm.Label = e.Form.Controls("补贴金额")
Dim v4 As Double = Val(scbt.Text)
Dim v5 As Double = Val(clbt.Text)
Dim v6 As Double = Val(fybx.Text)

Dim gzlb As WinForm.Label = e.Form.Controls("工资类别")
Dim tbgz As WinForm.TextBox = e.Form.Controls("TB工资数据")
Dim gzss As WinForm.TextBox = e.Form.Controls("TB工作时间")
Dim gzts As WinForm.TextBox = e.Form.Controls("TB工作天数")
Dim yfgz As WinForm.Label = e.Form.Controls("应发工资")
Dim mqts As WinForm.TextBox = e.Form.Controls("TB天数")
Dim sfgz As WinForm.Label = e.Form.Controls("实发工资")
Dim xg As WinForm.TextBox = e.Form.Controls("TB工资修改")
Dim g2 As Double = Val(tbgz.Text)
Dim g3 As Double = Val(gzss.Text)
Dim g4 As Double = Val(gzts.Text)
Dim g5 As Double = Val(mqts.Text)
Dim j1 As Double = Val(xg.Text)

Dim k As Double
Dim d As Double
Dim d2 As Double
Dim d3 As Double
Dim d4 As Double
Dim d5 As Double
Dim d6 As Double
Dim d7 As Double
Dim d8 As Double

If chk.Checked = True Then
    k = v2
Else
    k = v2 + 100
End If

d = v1 + k + v3
d2 = v4 + v5 + v6
d3 = g2 * g3
d4 = g2 * g3 - d + d2
d5 = g2 / g5 * g4
d6 = g2 / g5 * g4 - d + d2
d7 = g2
d8 = g2 - d + d2


If d > 0 Then
    e.Form.Controls("扣除金额").Visible=True
    e.Form.Controls("L扣元").Visible=True
    hjkc.text =format(d,"n")
Else
    e.Form.Controls("扣除金额").Visible=False
    e.Form.Controls("L扣元").Visible=False
End If
If d2 > 0 Then
    e.Form.Controls("补贴金额").Visible=True
    e.Form.Controls("L补元").Visible=True
    btje.text =format(d2,"n")
Else
    e.Form.Controls("补贴金额").Visible=False
    e.Form.Controls("L补元").Visible=False
End If

If gzlb.Visible = True Then
    If  gzlb.text= "计时工资"Then
        If xg.text ="" Then
            If d3 > 0  Or d4 > 0 Then
                e.Form.Controls("应发工资").Visible=True
                e.Form.Controls("实发工资").Visible=True
                e.Form.Controls("L1元").Visible=True
                e.Form.Controls("L实元").Visible=True
                Tables("工资报表").Current("正常工资") = format(d3,"n")
                Tables("工资报表").Current("实发工资") =format(d4,"n")
            Else
                e.Form.Controls("应发工资").Visible=False
                e.Form.Controls("L1元").Visible=False
                e.Form.Controls("实发工资").Visible=False
                e.Form.Controls("L1元").Visible=False
            End If
        Else
            e.Form.Controls("应发工资").Visible=True
            e.Form.Controls("实发工资").Visible=True
            e.Form.Controls("L1元").Visible=True
            e.Form.Controls("L实元").Visible=True
            Tables("工资报表").Current("正常工资") = format(d3,"n")
            Tables("工资报表").Current("实发工资") =format(j1,"n")
        End If
    Else
        If gzlb.text= "固定工资" Then
            If chk.Checked = True Then
                If xg.text ="" Then
                    If d7 > 0  Or d8 > 0 Then
                        e.Form.Controls("应发工资").Visible=True
                        e.Form.Controls("实发工资").Visible=True
                        e.Form.Controls("L1元").Visible=True
                        e.Form.Controls("L实元").Visible=True
                        Tables("工资报表").Current("正常工资") = format(d7,"n")
                        Tables("工资报表").Current("实发工资") =format(d8,"n")
                    Else
                        e.Form.Controls("应发工资").Visible=False
                        e.Form.Controls("L1元").Visible=False
                        e.Form.Controls("实发工资").Visible=False
                        e.Form.Controls("L1元").Visible=False
                    End If
                Else
                    e.Form.Controls("应发工资").Visible=True
                    e.Form.Controls("实发工资").Visible=True
                    e.Form.Controls("L1元").Visible=True
                    e.Form.Controls("L实元").Visible=True
                    Tables("工资报表").Current("正常工资") = format(d7,"n")
                    Tables("工资报表").Current("实发工资") =format(j1,"n")
                End If
            Else
                If xg.text ="" Then
                    If d5 > 0  Or d6 > 0 Then
                        e.Form.Controls("应发工资").Visible=True
                        e.Form.Controls("实发工资").Visible=True
                        e.Form.Controls("L1元").Visible=True
                        e.Form.Controls("L实元").Visible=True
                        Tables("工资报表").Current("正常工资") = format(d5,"n")
                        Tables("工资报表").Current("实发工资") =format(d6,"n")
                    Else
                        e.Form.Controls("应发工资").Visible=False
                        e.Form.Controls("L1元").Visible=False
                        e.Form.Controls("实发工资").Visible=False
                        e.Form.Controls("L1元").Visible=False
                    End If
                Else
                    e.Form.Controls("应发工资").Visible=True
                    e.Form.Controls("实发工资").Visible=True
                    e.Form.Controls("L1元").Visible=True
                    e.Form.Controls("L实元").Visible=True
                    Tables("工资报表").Current("正常工资") = format(d5,"n")
                    Tables("工资报表").Current("实发工资") =format(j1,"n")
                End If
            End If
        End If
    End If
End If

 


此主题相关图片如下:cw.jpg
按此在新窗口浏览图片

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/7/20 16:53:00 [只看该作者]

 上传实例具体说明。

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


加好友 发短信
等级:二尾狐 帖子:524 积分:3676 威望:0 精华:0 注册:2012/7/27 10:28:00
  发帖心情 Post By:2016/7/20 16:58:00 [只看该作者]

实列太大,怎么办?

 


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


加好友 发短信
等级:二尾狐 帖子:524 积分:3676 威望:0 精华:0 注册:2012/7/27 10:28:00
  发帖心情 Post By:2016/7/20 16:59:00 [只看该作者]

而且是SQL的

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/7/20 17:02:00 [只看该作者]

你表里面有没有数据啊?

 

Tables("工资报表").Current


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


加好友 发短信
等级:二尾狐 帖子:524 积分:3676 威望:0 精华:0 注册:2012/7/27 10:28:00
  发帖心情 Post By:2016/7/20 17:03:00 [只看该作者]

有,整个程序发你QQ了,你收一下吧


 回到顶部
总数 34 1 2 3 4 下一页