Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method GenerateColumn ( 
 | 
  MacroPlan owner, 
 | 
  String timeunit, 
 | 
  Date startdate, 
 | 
  Date enddate 
 | 
) 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    // 甄兰鸽 Jun-25-2024 (created) 
 | 
    startofplanning           := owner.StartOfPlanning(); 
 | 
    startofyear               := startofplanning.StartOfYear().Date(); 
 | 
    startofendyear            := startofplanning.StartOfNextYear().Date(); 
 | 
    //查询日期返回需要在计划日期之内 
 | 
    if( startdate < startofendyear and enddate > startofyear ){ 
 | 
      if( startdate < startofyear ){ 
 | 
        startdate             := startofyear; 
 | 
      } 
 | 
      if( enddate > startofendyear ){ 
 | 
        enddate               := startofendyear; 
 | 
      } 
 | 
      if( timeunit = 'All' or timeunit = Translations::MP_GlobalParameters_Day() ){ 
 | 
        for( start := startdate; start <= enddate; start := start.DateTime().StartOfNextDay().Date() ){ 
 | 
          periodname          := start.Format( "M2/D2/Y" ); 
 | 
          this.Column( relnew, Name := periodname, StartDate := start, EndDate := start, TimeUnit := Translations::MP_GlobalParameters_Day() ); 
 | 
        } 
 | 
      } 
 | 
      if( timeunit = 'All' or timeunit = Translations::MP_GlobalParameters_Week() ){ 
 | 
        weekstartstr          := ' KW'; 
 | 
        for( start := startdate; start <= enddate; start := start.StartOfNextWeek() ){ 
 | 
          weekend             := ( start.StartOfNextWeek() - Duration::Days( 1 ) ).Date();//Name := weekend.Format( "M2/D2/Y" ) 
 | 
           
 | 
          this.Column( relnew, Name := weekend.Format( "M2/D2" ).Concat( weekstartstr.Concat( weekend.Week().Format( 'N(LPad0(2))' ) ) ), StartDate := start, EndDate := weekend, TimeUnit := Translations::MP_GlobalParameters_Week() ); 
 | 
        } 
 | 
      } 
 | 
    } 
 | 
  *] 
 | 
} 
 |