Foxtable(狐表)用户栏目专家坐堂 → [求助]周期增加订单,(子表)


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

主题:[求助]周期增加订单,(子表)

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


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

1、

 

Dim dt As DataTable = DataTables("派单")
Dim sd As Date = "2018-01-01"
Dim ed As Date = "2018-12-30"
Dim d As Date = sd
Dim idx As Integer = 1
Do While d <= ed
    If d.DayOfWeek = 3 Then '星期三
        If idx Mod 2 = 1 '间隔1周

            Dim ndr = dt.addnew
            ndr("日期") = d
            ndr("编号") = "01"
            ndr("户名") = "张三"
        End If
        idx += 1
    End If
    d = d.AddDays(1)
Loop

 

2、

 

Dim dt As DataTable = DataTables("派单")
Dim sd As Date = "2018-01-01"
Dim ed As Date = "2018-12-30"
Dim d As Date = sd
Dim idx As Integer = 1
Do While d <= ed
    If d.Day = 12 Then '12号
        If idx Mod 2 = 1 '间隔1月

            Dim ndr = dt.addnew
            ndr("日期") = d
            ndr("编号") = "01"
            ndr("户名") = "张三"
        End If
        idx += 1
    End If
    d = d.AddDays(1)
Loop


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


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

单独用一列存放数字,如 0,1,2,3,4,5,6 对应星期日、一、二......

 

然后写代码

 

Dim dt As DataTable = DataTables("派单")
Dim r as row = tables("表A").current
Dim sd As Date = r("第一列")
Dim ed As Date = r("第二列")
Dim d As Date = sd
Do While d <= ed
    If d.DayOfWeek = r("第三列") Then
        Dim ndr = dt.addnew
        ndr("日期") = d
        ndr("编号") =r.DataRow("编号")
        ndr("户名") =r.DataRow("户名")
        
    End If
    d = d.AddDays(1)
Loop

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


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

1、If idx Mod (r("间隔几周")+1) = 1 Then

 

2、

 

 

'Dim dt As DataTable = DataTables("派单")
Dim sd As Date = "2018-01-01"
Dim ed As Date = "2018-12-30"
Dim d As Date = sd
Dim idx As Integer = 1
Dim month As Integer = d.Month - 1
Do While d <= ed
    If d.Month - month = 1 Then '1月
        If d.DayOfWeek = 3 Then '星期三
            If idx = 2  then'第2周
                output.show(d)
                'Dim ndr = dt.addnew
                'ndr("日期") = d
                'ndr("编号") = "01"
                'ndr("户名") = "张三"
                month = d.month
                idx = 1
            Else
                idx += 1
            End If
        End If
    End If
    d = d.AddDays(1)
Loop


 回到顶部