lazhen
2024-08-07 59e208f515c361caffcdfe35543f1b917d449d44
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Quintiq file version 2.0
#parent: #root
Method GenerateColumn (
  MacroPlan owner,
  String timeunit,
  Date startdate,
  Date enddate
)
{
  TextBody:
  [*
    // 甄兰鸽 Jun-25-2024 (created)
    //查询日期返回需要在计划日期之内
    weekstart             := owner.StartOfPlanning().Date();
    traverse( owner, Period_MP, period, not period.IsHistorical() and period.TimeUnit() = Translations::MP_GlobalParameters_Day() ){
      if( timeunit = 'All' or timeunit = Translations::MP_GlobalParameters_Day() ){
        periodtime          := period.StartDate();
        periodname          := periodtime.Format( "M2/D2/Y" );
        
        this.Column( relnew, Name := periodname, Period := periodtime, TimeUnit := Translations::MP_GlobalParameters_Day() );
      }
      
      if( timeunit = 'All' or timeunit = Translations::MP_GlobalParameters_Week() ){
        if( period.StartDate() = weekstart ){
          weekperiodname    := weekstart.Format( "M2/D2/Y" );
          this.Column( relnew, Name := weekperiodname, Period := weekstart, TimeUnit := Translations::MP_GlobalParameters_Week() );
          weekstart         := ( weekstart + Duration::Days( 7 ) ).Date();
        }
      }
    }
  *]
}