Foxtable(狐表)用户栏目专家坐堂 → [求助]关于按钮代码(四楼新问题也已解决)


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

主题:[求助]关于按钮代码(四楼新问题也已解决)

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


加好友 发短信
等级:管理员 帖子:47480 积分:251277 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2011/9/26 10:44:00 [显示全部帖子]

For Each nr As DataRow In  DataTables("设备折旧2").DataRows
    If nr.IsNull("去向") And  nr.IsNull("产权单位") Then
        nr("停用日期")=Nothing
    Else
        If nr.IsNull("去向") Then
            Dim mydate As Date = Forms("设备管理").Controls("DateTimePicker1").Text
            Dim y As Integer = mydate.Year
            Dim m As Integer = mydate.Month
            Dim Days As Integer = Date.DaysInMonth(y,m)
            Dim d As Date = New Date(y,m,Days)
            nr("停用日期") = d
            Dim dr As DataRow = DataTables("设备目录").Find("[设备编号] = '" & nr("设备编号") & "'")
            If dr IsNot Nothing Then
                dr("产权单位") = nr("产权单位")
            End If
        End If
    End If
    If nr.IsNull("停用日期") Then
        nr("折旧结束") = Nothing
    Else
        Dim dt As Date = nr("停用日期")
        nr("折旧结束") = new Date(dt.year,dt.month,Date.DaysInMonth(dt.year,dt.month))
    End If
    If nr.IsNull("折旧开始") And  nr.IsNull("折旧结束") Then
        nr("折旧月数")=Nothing
    Else
        Dim d1 As Date =  nr("折旧开始")
        Dim d2 As Date = nr("折旧结束")
        If d1>d2
            nr("折旧月数") = 0
        Else
            nr("折旧月数") = (d2.year - d1.year) * 12 + (d2.month - d1.month) + 1
        End If
    End If
Next


 回到顶部