From 7d76b6db9a56ab18c131f538902b96e14e516875 Mon Sep 17 00:00:00 2001
From: xiaoding721 <33130084+xiaoding721@users.noreply.github.com>
Date: 星期五, 01 十一月 2024 17:26:36 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev

---
 _Main/BL/Type_CustomerDemandIDS/Method_GenerateColumn.qbl |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/_Main/BL/Type_CustomerDemandIDS/Method_GenerateColumn.qbl b/_Main/BL/Type_CustomerDemandIDS/Method_GenerateColumn.qbl
index 1cf28e8..f97e7fb 100644
--- a/_Main/BL/Type_CustomerDemandIDS/Method_GenerateColumn.qbl
+++ b/_Main/BL/Type_CustomerDemandIDS/Method_GenerateColumn.qbl
@@ -8,23 +8,33 @@
   [*
     // 鐢勫叞楦� 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() );
       
+      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, Name := weekperiodname, StartDate := weekstart, EndDate := ( weekstart + Duration::Days( 6 ) ).Date(), TimeUnit := Translations::MP_GlobalParameters_Week() );
-        weekstart         := ( weekstart + Duration::Days( 7 ) ).Date();
+        this.Column( relnew, Name := weekperiodname, StartDate := weekstart, EndDate := ( weekstart.StartOfNextWeek() - Duration::Days( 1 ) ).Date(), TimeUnit := Translations::MP_GlobalParameters_Week() );
+        
+      }
+      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, Name := monthperiodname, StartDate := monthstart, EndDate := enddate, TimeUnit := Translations::MP_GlobalParameters_Month() );
-        monthstart        := monthstart.StartOfNextMonth();
+        
       }
+      weekstart         := periodtime.StartOfNextWeek();
+      monthstart        := periodtime.StartOfNextMonth();
     }
   *]
 }

--
Gitblit v1.9.3