From 32f0336643e045587fca0b513564ee68f6f801ab Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期三, 18 十二月 2024 15:42:30 +0800
Subject: [PATCH] 日历不可用时间报表优化

---
 _Main/BL/Type_LibCal_SubscriberEventRow/Method_InitializeDate.qbl |   39 ++++++++++++++++++++++++++++++++++-----
 1 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/_Main/BL/Type_LibCal_SubscriberEventRow/Method_InitializeDate.qbl b/_Main/BL/Type_LibCal_SubscriberEventRow/Method_InitializeDate.qbl
index fdff292..d715c17 100644
--- a/_Main/BL/Type_LibCal_SubscriberEventRow/Method_InitializeDate.qbl
+++ b/_Main/BL/Type_LibCal_SubscriberEventRow/Method_InitializeDate.qbl
@@ -10,15 +10,25 @@
   TextBody:
   [*
     // 鐢勫叞楦� May-29-2024 (created)
-    startTime     := starttime;
-    nextweektime  := starttime;
-    nextmonthtime := starttime;
+    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 );
+      if( table.MaxDayDate().IsInfinite() ){
+        table.MaxDayDate( daytime );
+      }else{
+        table.MaxDayDate( ifexpr( table.MaxDayDate() < daytime, daytime, table.MaxDayDate() ) );
+      }
+      if( table.MinDayDate().IsInfinite() ){
+        table.MinDayDate( daytime );
+      }else{
+        table.MinDayDate( ifexpr( table.MinDayDate() > daytime, daytime, table.MinDayDate() ) );
+      }
       
       dayvalue        := [Real]daycell.Value();
       if( startTime.StartOfNextDay() > endtime ){
@@ -36,7 +46,16 @@
         weektime      := this.GetTimeByTimeUnit( starttime, startTime, Translations::MP_GlobalParameters_Week() );
         weekcolumn    := table.GetColumnByTimeUnit( table, weektime, Translations::MP_GlobalParameters_Week() );
         weekcell      := weekcolumn.GetCellByTimeUnit( this, desc );
-        
+        if( table.MaxWeekDate().IsInfinite() ){
+          table.MaxWeekDate( weektime );
+        }else{
+          table.MaxWeekDate( ifexpr( table.MaxWeekDate() < weektime, weektime, table.MaxWeekDate() ) );
+        }
+        if( table.MinWeekDate().IsInfinite() ){
+          table.MinWeekDate( weektime );
+        }else{
+          table.MinWeekDate( ifexpr( table.MinWeekDate() > weektime, weektime, table.MinWeekDate() ) );
+        }
         weekvalue     := [Real]weekcell.Value();
         if( startTime.StartOfNextWeek() > endtime ){
           duration    := endtime - startTime;
@@ -56,7 +75,17 @@
         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 ) );
+        if( table.MaxMonthDate().IsInfinite() ){
+          table.MaxMonthDate( monthtime );
+        }else{
+          table.MaxMonthDate( ifexpr( table.MaxMonthDate() < monthtime, monthtime, table.MaxMonthDate() ) );
+        }
+        if( table.MinMonthDate().IsInfinite() ){
+          table.MinMonthDate( monthtime );
+        }else{
+          table.MinMonthDate( ifexpr( table.MinMonthDate() > monthtime, monthtime, table.MinMonthDate() ) );
+        }
+    //    info( nextmonthtime, startTime, monthtime, isnull( monthcolumn ), isnull( monthcell ) );
         monthvalue    := [Real]monthcell.Value();
         if( startTime.StartOfNextMonth() > endtime ){
           duration    := endtime - startTime;

--
Gitblit v1.9.3