| Quintiq file version 2.0 | 
| #parent: #root | 
| Method GenerateColumn ( | 
|   Dates periods | 
| ) | 
| { | 
|   TextBody: | 
|   [* | 
|     // 甄兰鸽 Jun-25-2024 (created) | 
|     weekstart             := periods.Element( 0 ); | 
|     monthstart            := periods.Element( 0 ); | 
|     traverse( periods, Elements, periodtime ){ | 
|       periodname          := periodtime.Format( "M2/D2/Y" ); | 
|        | 
|       this.Column( relnew, Name := periodname, StartDate := periodtime, EndDate := periodtime, TimeUnit := Translations::MP_GlobalParameters_Day() ); | 
|        | 
|       if( periodtime = weekstart ){ | 
|         weekperiodname    := weekstart.Format( "M2/D2/Y" ); | 
|         this.Column( relnew, Name := weekperiodname, StartDate := weekstart, EndDate := ( weekstart + Duration::Days( 6 ) ).Date(), TimeUnit := Translations::MP_GlobalParameters_Week() ); | 
|         weekstart         := ( weekstart + Duration::Days( 7 ) ).Date(); | 
|       } | 
|       if( periodtime = monthstart ){ | 
|         monthperiodname   := monthstart.Format( "M2/D2/Y" ); | 
|         enddate           := ( monthstart.StartOfNextMonth() - Duration::Days( 1 ) ).Date(); | 
|         this.Column( relnew, Name := monthperiodname, StartDate := monthstart, EndDate := enddate, TimeUnit := Translations::MP_GlobalParameters_Month() ); | 
|         monthstart        := monthstart.StartOfNextMonth(); | 
|       } | 
|     } | 
|   *] | 
| } |