Quintiq file version 2.0
|
#parent: #root
|
Method GenerateColumn (
|
Dates periods,
|
Boolean isshow
|
)
|
{
|
Description: '生成日期列'
|
TextBody:
|
[*
|
// 甄兰鸽 Jun-25-2024 (created)
|
timeunit := guard( this.InterfaceDataset().AssemblyOnlinePlanVersionSearch().TimeUnit(), Translations::MP_GlobalParameters_Day() ) ;
|
weekstart := periods.Element( 0 );
|
|
monthstart := periods.Element( 0 );
|
traverse( periods, Elements, periodtime ){
|
if( not isshow or timeunit = Translations::MP_GlobalParameters_Day() ){
|
periodname := periodtime.Format( "M2/D2/Y" );
|
|
this.Column( relnew, ColumnName := periodname, StartDate := periodtime, EndDate := periodtime, TimeUnit := Translations::MP_GlobalParameters_Day() );
|
}
|
if( not isshow or timeunit = Translations::MP_GlobalParameters_Week() ){
|
weekend := ( weekstart + Duration::Days( 6 ) ).Date();
|
if( ( weekend.Year() <> periodtime.Year() and weekend.Month() > 1 ) or ( abs( weekstart.Week() - periodtime.Week() ) > 1 and weekend.Year() = periodtime.Year() ) ){
|
weekstart := periodtime;
|
}
|
if( periodtime = weekstart ){
|
weekperiodname := weekstart.Format( "M2/D2/Y" );
|
this.Column( relnew, ColumnName := weekperiodname, StartDate := weekstart, EndDate := ( weekstart.StartOfNextWeek() - Duration::Days( 1 ) ).Date(), TimeUnit := Translations::MP_GlobalParameters_Week() );
|
|
}
|
weekstart := periodtime.StartOfNextWeek();
|
}
|
if( not isshow or timeunit = Translations::MP_GlobalParameters_Month() ){
|
if( ( monthstart.Year() <> periodtime.Year() and abs( monthstart.Month() - periodtime.Month() ) <> 11 ) or ( abs( monthstart.Month() - periodtime.Month() ) > 1 and monthstart.Year() = periodtime.Year() ) ){
|
monthstart := periodtime;
|
}
|
if( periodtime = monthstart ){
|
monthperiodname := monthstart.Format( "M2/D2/Y" );
|
enddate := ( monthstart.StartOfNextMonth() - Duration::Days( 1 ) ).Date();
|
this.Column( relnew, ColumnName := monthperiodname, StartDate := monthstart, EndDate := enddate, TimeUnit := Translations::MP_GlobalParameters_Month() );
|
|
}
|
monthstart := periodtime.StartOfNextMonth();
|
}
|
}
|
*]
|
}
|