Foxtable(狐表)用户栏目专家坐堂 → [求助]计算


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

主题:[求助]计算

帅哥哟,离线,有人找我吗?
江南小镇
  11楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:七尾狐 帖子:1710 积分:11410 威望:0 精华:0 注册:2015/6/22 8:11:00
  发帖心情 Post By:2018/1/31 20:04:00 [显示全部帖子]

老师,我上面说的错误计算跟下面我标出的代码有关联吗?

Dim ck As DataRow = e.DataRow
Dim rk = DataTables("入库明细").Find("入库单编号明细 = '" & e.DataRow("入库批次号") & "'")
If rk IsNot Nothing Then
    Dim sum = e.DataTable.compute("sum(出库_数量)", "入库批次号 = '" & e.DataRow("入库批次号") & "' and _Identify <= " & e.DataRow("_Identify"))
    ck("最后库存") = rk("入库_数量") - sum
End If


'MessageBox.Show(8)

'=================================================================================================================
Select Case e.DataCol.Name
    Case "出库_数量"
        SystemReady = False
        If e.DataRow.isnull("出库_数量") = False Then
            If e.DataRow.IsNull("出库_价税合计") Then
                e.DataRow("出库_价税合计") = e.DataRow("出库_价税合计") * e.DataRow("出库_数量") 
            ElseIf e.DataRow.isnull("出库_售价") Then
                e.DataRow("出库_售价") = e.DataRow("出库_价税合计") / e.DataRow("出库_数量")
            Else
                e.DataRow("出库_价税合计") = e.DataRow("出库_售价") * e.DataRow("出库_数量") 
                
            End If
        End If
        SystemReady = True
    Case "出库_售价"
        SystemReady = False
        If e.DataRow.isnull("出库_售价") = False Then
            If e.DataRow.IsNull("出库_价税合计") Then
                e.DataRow("出库_价税合计") = e.DataRow("出库_售价") * e.DataRow("出库_数量") 
            ElseIf e.DataRow.isnull("出库_数量") Then
                e.DataRow("出库_数量") = e.DataRow("出库_价税合计") / e.DataRow("出库_售价") 
            Else
                e.DataRow("出库_价税合计") = e.DataRow("出库_售价") * e.DataRow("出库_数量") 
            End If
        End If
        SystemReady = True
    Case "出库_价税合计"
        SystemReady = False
        If e.DataRow.isnull("出库_价税合计") = False Then
            If e.DataRow.IsNull("出库_售价") Then
                If e.DataRow.IsNull("出库_数量") = False Then
                    e.DataRow("出库_售价") = e.DataRow("出库_价税合计") / e.DataRow("出库_数量")
                End If
            ElseIf e.DataRow.isnull("出库_数量") Then
                If e.DataRow.IsNull("出库_售价") = False Then
                    e.DataRow("出库_数量") = e.DataRow("出库_价税合计") / e.DataRow("出库_售价") 
                End If
            Else
                If e.DataRow.IsNull("出库_数量") = False Then
                    e.DataRow("出库_售价") = e.DataRow("出库_价税合计") / e.DataRow("出库_数量")
                End If
            End If
        End If
        SystemReady = True
End Select
'--------------------------------------------------------------------------------------
Select Case e.DataCol.Name
    Case "出库_税率"
        SystemReady = False
        If e.DataRow("出库_税率") > 0 Then
            e.DataRow("出库_金额") = e.DataRow("出库_价税合计") / e.DataRow("出库_税率")
            e.DataRow("出库_税金") = e.DataRow("出库_价税合计") - e.DataRow("出库_金额")
        End If
        SystemReady = True
    Case "出库_税金"
        SystemReady = False
        If e.DataRow.isnull("出库_税金") = False Then
            e.DataRow("出库_金额") = e.DataRow("出库_价税合计") - e.DataRow("出库_税金")
            If e.DataRow("出库_金额") > 0 Then
                e.DataRow("出库_税率") = e.DataRow("出库_价税合计") / e.DataRow("出库_金额")
            End If
        End If
        SystemReady = True
    Case "出库_金额"
        SystemReady = False
        If e.DataRow.isnull("出库_金额") = False Then
            e.DataRow("出库_税金") = e.DataRow("出库_价税合计") - e.DataRow("出库_金额")
            If e.DataRow("出库_金额") > 0 Then
                e.DataRow("出库_税率") = e.DataRow("出库_价税合计") / e.DataRow("出库_金额")
            End If
        End If
        SystemReady = True
End Select

 回到顶部
帅哥哟,离线,有人找我吗?
江南小镇
  12楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:七尾狐 帖子:1710 积分:11410 威望:0 精华:0 注册:2015/6/22 8:11:00
  发帖心情 Post By:2018/1/31 22:47:00 [显示全部帖子]

老师,当数量列、单价列的数据修改后重置金额列或税金列税率列就会错误修改税率。

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:计算.table


 回到顶部
帅哥哟,离线,有人找我吗?
江南小镇
  13楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:七尾狐 帖子:1710 积分:11410 威望:0 精华:0 注册:2015/6/22 8:11:00
  发帖心情 Post By:2018/1/31 23:14:00 [显示全部帖子]

老师,如果价税合计修改后能通过代码自动重置税率列吗?

 回到顶部
帅哥哟,离线,有人找我吗?
江南小镇
  14楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:七尾狐 帖子:1710 积分:11410 威望:0 精华:0 注册:2015/6/22 8:11:00
  发帖心情 Post By:2018/1/31 23:31:00 [显示全部帖子]

老师,我有点糊涂,请老师帮忙。
Select Case e.DataCol.Name
    Case "数量"
        SystemReady = False
        If e.DataRow.isnull("数量") = False Then
            If e.DataRow.IsNull("价税合计") Then
                e.DataRow("价税合计") = e.DataRow("单价") * e.DataRow("数量")
            ElseIf e.DataRow.isnull("单价") Then
                e.DataRow("单价") = e.DataRow("价税合计") / e.DataRow("数量")
            Else
                e.DataRow("价税合计") = e.DataRow("单价") * e.DataRow("数量")
                
            End If
        End If
        SystemReady = True
    Case "单价"
        SystemReady = False
        If e.DataRow.isnull("单价") = False Then
            If e.DataRow.IsNull("价税合计") Then
                e.DataRow("价税合计") = e.DataRow("单价") * e.DataRow("数量")
            ElseIf e.DataRow.isnull("数量") Then
                e.DataRow("数量") = e.DataRow("价税合计") / e.DataRow("单价")
            Else
                e.DataRow("价税合计") = e.DataRow("单价") * e.DataRow("数量")
            End If
        End If
        SystemReady = True
    Case "价税合计"
        SystemReady = False
        If e.DataRow.isnull("价税合计") = False Then
            If e.DataRow.IsNull("单价") Then
                If e.DataRow.IsNull("数量") = False Then
                    e.DataRow("单价") = e.DataRow("价税合计") / e.DataRow("数量")
                End If
            ElseIf e.DataRow.isnull("数量") Then
                If e.DataRow.IsNull("单价") = False Then
                    e.DataRow("数量") = e.DataRow("价税合计") / e.DataRow("单价")
                    
                End If
            Else
                If e.DataRow.IsNull("数量") = False Then
                    e.DataRow("单价") = e.DataRow("价税合计") / e.DataRow("数量")
                    
                End If
                
            End If
        End If
'--------------------------------------------------------------------------------------




'------------------------------------------------------------------------------------
        SystemReady = True
End Select
Select Case e.DataCol.Name
    Case "税率"
        SystemReady = False
        If e.DataRow("税率") > 0 Then
            e.DataRow("金额") = e.DataRow("价税合计") / e.DataRow("税率")
            e.DataRow("税金") = e.DataRow("价税合计") - e.DataRow("金额")
        End If
        SystemReady = True
    Case "税金"
        SystemReady = False
        If e.DataRow.isnull("税金") = False Then
            e.DataRow("金额") = e.DataRow("价税合计") - e.DataRow("税金")
            If e.DataRow("金额") > 0 Then
                e.DataRow("税率") = e.DataRow("价税合计") / e.DataRow("金额")
            End If
        End If
        SystemReady = True
    Case "金额"
        SystemReady = False
        If e.DataRow.isnull("金额") = False Then
            e.DataRow("税金") = e.DataRow("价税合计") - e.DataRow("金额")
            If e.DataRow("金额") > 0 Then
                e.DataRow("税率") = e.DataRow("价税合计") / e.DataRow("金额")
            End If
        End If
        SystemReady = True
End Select

 回到顶部
总数 15 上一页 1 2