¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | #parent: #root |
| | | Attribute TimeUnit |
| | | { |
| | | #keys: '3[415136.0.941300421][415136.0.941300420][415136.0.941300422]' |
| | | Description: 'æ¶é´ç±»å' |
| | | ValueType: String |
| | | } |
| | |
| | | #parent: #root |
| | | Method FilterByDatePeriod ( |
| | | Date start, |
| | | Date end |
| | | Date end, |
| | | String timeunit |
| | | ) declarative remote as Boolean |
| | | { |
| | | TextBody: |
| | |
| | | // çå
°é¸½ May-29-2024 (created) |
| | | value := false; |
| | | //info( this.Index(), this.LibCal_SubscriberEventTable().Name(), this.Period(), start, end ); |
| | | if( this.Period() >= start and this.Period() <= end ){ |
| | | if( this.Period() >= start and this.Period() <= end and this.TimeUnit() = timeunit ){ |
| | | value := true; |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | #parent: #root |
| | | Method GetCellByTimeUnit ( |
| | | LibCal_SubscriberEventRow row, |
| | | String desc |
| | | ) as LibCal_SubscriberEventCell |
| | | { |
| | | TextBody: |
| | | [* |
| | | // çå
°é¸½ Jul-26-2024 (created) |
| | | cell := selectobject( this, LibCal_SubscriberEventCell, cell, cell.LibCal_SubscriberEventRow() = row ); |
| | | if( isnull( cell ) ){ |
| | | cell := this.LibCal_SubscriberEventCell( relnew, Value := '0' |
| | | , Description := desc ); |
| | | row.LibCal_SubscriberEventCell( relinsert, cell ); |
| | | } |
| | | return cell; |
| | | *] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | #parent: #root |
| | | Method GetTimeByTimeUnit ( |
| | | DateTime starttime, |
| | | DateTime starttimetmp, |
| | | String timeunit |
| | | ) as Date |
| | | { |
| | | TextBody: |
| | | [* |
| | | // çå
°é¸½ Jul-26-2024 (created) |
| | | time := starttime.Date(); |
| | | if( starttime = starttimetmp ){ |
| | | if ( timeunit = Translations::MP_GlobalParameters_Week() ){ |
| | | time := starttime.StartOfWeek().Date(); |
| | | } else if ( timeunit = Translations::MP_GlobalParameters_Month() ){ |
| | | time := starttime.StartOfMonth().Date(); |
| | | } |
| | | } |
| | | return time; |
| | | *] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | #parent: #root |
| | | Method InitializeDate ( |
| | | LibCal_SubscriberEventTable table, |
| | | DateTime starttime, |
| | | DateTime endtime, |
| | | String desc |
| | | ) |
| | | { |
| | | TextBody: |
| | | [* |
| | | // çå
°é¸½ May-29-2024 (created) |
| | | startTime := starttime; |
| | | nextweektime := starttime; |
| | | nextmonthtime := starttime; |
| | | while( startTime < endtime ){ |
| | | //for( startTime := starttime; startTime < endtime; startTime := startTime.StartOfNextDay() ){ |
| | | //天 |
| | | daytime := this.GetTimeByTimeUnit( starttime, startTime, Translations::MP_GlobalParameters_Day() ); |
| | | daycolumn := table.GetColumnByTimeUnit( table, daytime, Translations::MP_GlobalParameters_Day() ); |
| | | daycell := daycolumn.GetCellByTimeUnit( this, desc ); |
| | | |
| | | dayvalue := [Real]daycell.Value(); |
| | | if( startTime.StartOfNextDay() > endtime ){ |
| | | duration := endtime - startTime; |
| | | dayvalue := dayvalue + duration.HoursAsReal(); |
| | | daycell.Period( relnew, Start := startTime.Format( 'M/D/Y H:m' ), End := endtime.Format( 'M/D/Y H:m' ) ); |
| | | }else{ |
| | | duration := startTime.StartOfNextDay() - startTime; |
| | | dayvalue := dayvalue + duration.HoursAsReal(); |
| | | daycell.Period( relnew, Start := startTime.Format( 'M/D/Y H:m' ), End := startTime.StartOfNextDay().Format( 'M/D/Y H:m' ) ); |
| | | } |
| | | daycell.Value( [String]dayvalue ); |
| | | //å¨ |
| | | if( nextweektime = startTime ){ |
| | | weektime := this.GetTimeByTimeUnit( starttime, startTime, Translations::MP_GlobalParameters_Week() ); |
| | | weekcolumn := table.GetColumnByTimeUnit( table, weektime, Translations::MP_GlobalParameters_Week() ); |
| | | weekcell := weekcolumn.GetCellByTimeUnit( this, desc ); |
| | | |
| | | weekvalue := [Real]weekcell.Value(); |
| | | if( startTime.StartOfNextWeek() > endtime ){ |
| | | duration := endtime - startTime; |
| | | weekvalue := weekvalue + duration.HoursAsReal(); |
| | | weekcell.Period( relnew, Start := startTime.Format( 'M/D/Y H:m' ), End := endtime.Format( 'M/D/Y H:m' ) ); |
| | | }else{ |
| | | duration := startTime.StartOfNextWeek() - startTime; |
| | | weekvalue := weekvalue + duration.HoursAsReal(); |
| | | weekcell.Period( relnew, Start := startTime.Format( 'M/D/Y H:m' ), End := startTime.StartOfNextWeek().Format( 'M/D/Y H:m' ) ); |
| | | } |
| | | weekcell.Value( [String]weekvalue ); |
| | | nextweektime := startTime.StartOfNextWeek(); |
| | | } |
| | | // info( '-----------------------------1------------------------', nextmonthtime, startTime, nextweektime ); |
| | | //æ |
| | | if( nextmonthtime = startTime ){ |
| | | monthtime := this.GetTimeByTimeUnit( starttime, startTime, Translations::MP_GlobalParameters_Month() ); |
| | | monthcolumn := table.GetColumnByTimeUnit( table, monthtime, Translations::MP_GlobalParameters_Month() ); |
| | | monthcell := monthcolumn.GetCellByTimeUnit( this, desc ); |
| | | info( nextmonthtime, startTime, monthtime, isnull( monthcolumn ), isnull( monthcell ) ); |
| | | monthvalue := [Real]monthcell.Value(); |
| | | if( startTime.StartOfNextMonth() > endtime ){ |
| | | duration := endtime - startTime; |
| | | monthvalue := monthvalue + duration.HoursAsReal(); |
| | | monthcell.Period( relnew, Start := startTime.Format( 'M/D/Y H:m' ), End := endtime.Format( 'M/D/Y H:m' ) ); |
| | | }else{ |
| | | duration := startTime.StartOfNextMonth() - startTime; |
| | | monthvalue := monthvalue + duration.HoursAsReal(); |
| | | monthcell.Period( relnew, Start := startTime.Format( 'M/D/Y H:m' ), End := startTime.StartOfNextMonth().Format( 'M/D/Y H:m' ) ); |
| | | } |
| | | monthcell.Value( [String]monthvalue ); |
| | | nextmonthtime := startTime.StartOfNextMonth(); |
| | | } |
| | | startTime := startTime.StartOfNextDay(); |
| | | } |
| | | *] |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | #parent: #root |
| | | Method GetColumnByTimeUnit ( |
| | | LibCal_SubscriberEventTable table, |
| | | Date time, |
| | | String timeunit |
| | | ) as LibCal_SubscriberEventColumn |
| | | { |
| | | TextBody: |
| | | [* |
| | | // çå
°é¸½ Jul-26-2024 (created) |
| | | column := selectobject( table, LibCal_SubscriberEventColumn, column, column.Name() = time.Format( 'M/D/Y' ) ); |
| | | if( isnull( column ) ){ |
| | | column := table.LibCal_SubscriberEventColumn( relnew, Name := time.Format( 'M/D/Y' ), Period := time, TimeUnit := timeunit ); |
| | | } |
| | | return column; |
| | | *] |
| | | } |
| | |
| | | [* |
| | | // çå
°é¸½ May-28-2024 (created) |
| | | rownr := this.LibCal_SubscriberEventRow( relsize ); |
| | | //subscribercolumn := selectobject( this, LibCal_SubscriberEventColumn, column, column.RowName() = 'Line' ); |
| | | //if( isnull( subscribercolumn ) ){ |
| | | // subscribercolumn := this.LibCal_SubscriberEventColumn( relnew, RowName := 'Line' ); |
| | | //} |
| | | //eventcolumn := selectobject( this, LibCal_SubscriberEventColumn, column, column.RowName() = 'Event' ); |
| | | //if( isnull( eventcolumn ) ){ |
| | | // eventcolumn := this.LibCal_SubscriberEventColumn( relnew, RowName := 'Event' ); |
| | | //} |
| | | |
| | | traverse( subscribers, Elements, subscriber ){ |
| | | // info( '------------------------', subscriber.CalendarID(), subscriber.CalendarType() ); |
| | | // traverse( subscriber,Participation.astype( LibCal_Subscription ).LeadingParticipation, participation ){ |
| | | |
| | | traverse( subscriber,Participation.astype( LibCal_Subscription ).LeadingParticipation, participation, participation.Event().EventCategory().Name() = 'Unavailable' ){ |
| | | // info( '---------------1---------', participation.Event().Subject(), '------', participation.Event().EventCategory().Name() ); |
| | | event := participation.Event(); |
| | | |
| | | row := selectobject( this, LibCal_SubscriberEventRow, row, row.Subscriber() = subscriber.CalendarID() |
| | |
| | | Event := event.Subject(), |
| | | EventType := event.EventType().Name() ); |
| | | |
| | | // subscribercell := subscribercolumn.LibCal_SubscriberEventCell( relnew, Value := row.Subscriber() ); |
| | | // if( counter( this, LibCal_SubscriberEventRow, linerow, linerow.Subscriber() = row.Subscriber() ) <> 1 ){ |
| | | // subscribercell.Value( '' ); |
| | | // } |
| | | // row.LibCal_SubscriberEventCell( relinsert, subscribercell ); |
| | | // |
| | | // eventcell := eventcolumn.LibCal_SubscriberEventCell( relnew, Value := row.Event() ); |
| | | // row.LibCal_SubscriberEventCell( relinsert, eventcell ); |
| | | rownr := rownr + 1; |
| | | } |
| | | |
| | | traverse( participation, ExplicitTimeInterval, eti ){ |
| | | info( eti.Start(), eti.End(), eti.DefinitionName() ); |
| | | if( this.ID() = 'Day' ){ |
| | | this.InitializeDay( this, row, eti.Start(), eti.End(), event.Description() ); |
| | | }else if( this.ID() = 'Week' ){ |
| | | this.InitializeWeek( this, row, eti.Start(), eti.End(), event.Description() ); |
| | | }else{ |
| | | this.InitializeMonth( this, row, eti.Start(), eti.End(), event.Description() ); |
| | | row.InitializeDate( this, eti.Start(), eti.End(), event.Description() ); |
| | | } |
| | | } |
| | | |
| | | |
| | | // |
| | | // endTime := participation.EndDate().DateTime( timezone ).AddAsPeriod( timezone, event.EndTimeOfDay() ); |
| | | // startTime := participation.StartDate().DateTime( timezone ).AddAsPeriod( timezone, event.StartTimeOfDay() ); |
| | | |
| | | } |
| | | } |
| | |
| | | // çå
°é¸½ May-28-2024 (created) |
| | | owner.LibCal_SubscriberEventTable( relflush ); |
| | | if( owner.LibCal_SubscriberEventTable( relsize ) < 1 ){ |
| | | owner.LibCal_SubscriberEventTable( relnew, ID := 'Day', Name := 'Day' ); |
| | | owner.LibCal_SubscriberEventTable( relnew, ID := 'Week', Name := 'Week' ); |
| | | owner.LibCal_SubscriberEventTable( relnew, ID := 'Month', Name := 'Month' ); |
| | | owner.LibCal_SubscriberEventTable( relnew, ID := LibCal_SubscriberEventTable::GetDefaultName(), Name := LibCal_SubscriberEventTable::GetDefaultName() ); |
| | | } |
| | | info('-----------------------------', owner.LibCal_SubscriberEventTable( relsize ), subscribers.Size() ); |
| | | |
| | | traverse( owner, LibCal_SubscriberEventTable, table ){ |
| | | table.InitializeTable( subscribers ); |
| | | } |
| | |
| | | subscribers := dhSubscribers.Data(); |
| | | eventtypes := dhEventTypes.Data(); |
| | | date := dhDate.Data(); |
| | | traverse( dhCalendar.Data(), LibCal_SubscriberEventTable, table, table.ID() = RadioButtonGroupUseForPlanning.BoundValue() ){ |
| | | columns := selectset( table, LibCal_SubscriberEventColumn, column, column.FilterByDatePeriod( date.Start(), date.End() ) ); |
| | | traverse( dhCalendar.Data(), LibCal_SubscriberEventTable, table ){ |
| | | columns := selectset( table, LibCal_SubscriberEventColumn, column, column.FilterByDatePeriod( date.Start(), date.End(), RadioButtonGroupUseForPlanning.BoundValue() ) ); |
| | | rows := selectset( table, LibCal_SubscriberEventRow, row, row.FilterBySubscriberAndEventType( subscribers, eventtypes ) ); |
| | | } |
| | | dhColumns.Data( &columns ); |