lazhen
2024-05-29 1aa50242db4bd962c4bbf68e7f8eb8c003bbde9a
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 InitializeWeek (
  LibCal_SubscriberEventTable table,
  LibCal_SubscriberEventRow row,
  DateTime starttime,
  DateTime endtime
)
{
  TextBody:
  [*
    // 甄兰鸽 May-29-2024 (created)
    for(  startTime := starttime; startTime < endtime; startTime := startTime.StartOfNextWeek() ){
      time := startTime;
      if( starttime = startTime ){
        time := startTime.StartOfWeek();
      }
      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.Date() );
      }
      
      duration := startTime.StartOfNextWeek() - startTime;
      if( startTime.StartOfNextWeek() > endtime ){
        duration := endtime - startTime;
      }
    //  info( startTime, column.Name(), duration.AsQUILL(), duration.HoursAsReal() );
      cell := column.LibCal_SubscriberEventCell( relnew, Value := [String]duration.HoursAsReal() );
      row.LibCal_SubscriberEventCell( relinsert, cell );
    }
  *]
}