From bc0a06655cb1cc8f661c7ad869ebab70ecc561bb Mon Sep 17 00:00:00 2001
From: rislai <risheng.lai@capgemini.com>
Date: 星期二, 09 七月 2024 09:05:48 +0800
Subject: [PATCH] Merge branch 'dev' of http://47.101.211.7:10101/r/VWED into dev

---
 _Main/BL/Type_InventorySummaryReport/Method_Clear.qbl                                                                                          |    8 
 _Main/BL/Type_InventroySummaryRow/Method_SetCellValue0.qbl                                                                                     |   21 
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Response_OnCreated.def                                                         |   16 
 _Main/BL/Type_FinancialSalesSource/StaticMethod_Initialize.qbl                                                                                 |   16 
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_OnCreated.def                                                     |    6 
 _Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_MacroPlanner_ActionBarGroupReport_ButtonFinancialWeeklyReport_OnCli.def |   16 
 _Main/BL/Relations/Relation_FinancialWeeklyColumn_FinancialWeeklyCell_FinancialWeeklyCell_Finan.qbl                                            |   26 +
 _Main/BL/Type_FinancialWeeklyReport/Attribute_IsShow.qbl                                                                                       |    7 
 _Main/BL/Relations/Relation_FinancialWeeklyReport_FinancialWeeklyColumn_FinancialWeeklyColumn_F.qbl                                            |   26 +
 _Main/BL/Type_FinancialWeeklyColumn/Attribute_Index.qbl                                                                                        |    7 
 _Main/BL/Type_InventorySummaryReport/Method_GenerateColumn.qbl                                                                                 |   38 +
 _Main/BL/Type_InventorySummaryColumn/Method_GenerateCell.qbl                                                                                   |   41 +
 _Main/BL/Type_FinancialWeeklyReport/StaticMethod_GetDefaultName.qbl                                                                            |   10 
 _Main/BL/Type_FinancialWeeklyRow/_ROOT_Type_FinancialWeeklyRow.qbl                                                                             |   10 
 _Main/BL/Type_FinancialProductionReport/StaticMethod_GetDefaultDLUnit.qbl                                                                      |    1 
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Response_PanelHeader_ButtonExport_OnClick.def                                  |   18 
 _Main/BL/Type_FinancialWeeklyReport/StaticMethod_Initialize.qbl                                                                                |  173 +++++++
 _Main/BL/Type_FinancialWeeklyReport/StaticMethod_Download.qbl                                                                                  |   65 ++
 _Main/BL/Type_FinancialWeeklyRow/Attribute_RowNr.qbl                                                                                           |    7 
 _Main/BL/Type_FinancialProductionReport/StaticMethod_GetDefaultCCUnit.qbl                                                                      |    1 
 _Main/BL/Type_FinancialWeeklyColumn/DefaultValue_Name.qbl                                                                                      |    6 
 _Main/BL/Type_InventorySummaryReport/Method_GetRow.qbl                                                                                         |    6 
 _Main/BL/Type_InventroySummaryRow/Method_SetCellValue#0.qbl                                                                                    |   18 
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_OnCreated.def                                                          |    6 
 _Main/BL/Type_InventorySummaryColumn/Attribute_TimeUnit.qbl                                                                                    |    2 
 _Main/BL/Type_InventroySummaryRow/Method_InitializeCell.qbl                                                                                    |   10 
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_matrixEditorActionBarPageTable.def                                   |   10 
 _Main/BL/Type_FinancialWeeklyReport/StaticMethod_GetDefaultDLUnit.qbl                                                                          |   11 
 _Main/BL/Type_FinancialWeeklyCell/_ROOT_Type_FinancialWeeklyCell.qbl                                                                           |   10 
 _Main/BL/Type_FinancialWeeklyReport/Method_GenerateColumn.qbl                                                                                  |   20 
 _Main/BL/Type_InventorySummaryReport/Method_Generate.qbl                                                                                       |   61 +-
 _Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_ActionBarGroupReport.def                                               |   11 
 _Main/BL/Type_FinancialWeeklyCell/Attribute_Value.qbl                                                                                          |    7 
 _Main/BL/Type_FinancialSalesRow/Method_InitializeCell.qbl                                                                                      |   10 
 _Main/BL/Type_FinancialWeeklyRow/DefaultValue_Name.qbl                                                                                         |    6 
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_matrixeditorContextMenuTable.def                                     |   10 
 _Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelUnit_ddslUnit_OnCreated.def                                     |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_MatrixEditorTable.def                                                |   97 ++++
 _Main/BL/Relations/Relation_FinancialWeeklyReport_MacroPlan_MacroPlan_FinancialWeeklyReport.qbl                                                |   23 
 _Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelCategory_RadioButtonGroupUseForPlanning_OnCreated.def           |   16 
 _Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelPeriod_DateSelectorStart_OnChanged.def                          |   10 
 _Main/BL/Type_FinancialWeeklyReport/DefaultValue_ID.qbl                                                                                        |    6 
 _Main/BL/Type_FinancialWeeklyRow/Attribute_Name.qbl                                                                                            |    7 
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelUnit_715_ddslUnit_OnCreated.def                                   |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Component_PanelPeriod.def                                                     |    1 
 _Main/BL/Type_FinancialWeeklyReport/StaticMethod_GetDefaultAllUnit.qbl                                                                         |   10 
 _Main/BL/Type_FinancialWeeklyColumn/Attribute_Name.qbl                                                                                         |    7 
 _Main/BL/Type_FinancialWeeklyColumn/Attribute_Period.qbl                                                                                       |    7 
 _Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl                                                                               |  110 ++++
 _Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelPeriod_DateSelectorEnd_OnChanged.def                            |   10 
 _Main/BL/Type_FinancialSalesReport/Method_GetRow.qbl                                                                                           |    6 
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_PanelTable.def                                                       |   14 
 _Main/BL/Type_FinancialWeeklyColumn/_ROOT_Type_FinancialWeeklyColumn.qbl                                                                       |   10 
 _Main/BL/Type_FinancialWeeklyReport/_ROOT_Type_FinancialWeeklyReport.qbl                                                                       |   10 
 _Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_OnCreated.def                                                        |    8 
 _Main/BL/Type_InventorySummaryReport/StaticMethod_GetDefaultCCUnit.qbl                                                                         |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/_ROOT_Component_FormFinancialWeeklyReport.def                                  |   18 
 _Main/BL/Type_FinancialProductionCell/Function_CalcPlanValue.qbl                                                                               |   13 
 _Main/BL/Type_FinancialWeeklyCell/DefaultValue_Value.qbl                                                                                       |    6 
 _Main/BL/Type_FinancialWeeklyReport/StaticMethod_GetDefaultCCUnit.qbl                                                                          |   11 
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_PanelHeader.def                                                      |   25 +
 _Main/BL/Type_FinancialWeeklyReport/Attribute_Name.qbl                                                                                         |    8 
 _Main/UI/MacroPlannerWebApp/Views/Financial_weekly_report_view.vw                                                                              |   92 +++
 _Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Component_PanelCategory.def                                                   |    1 
 _Main/BL/Relations/Relation_FinancialWeeklyRow_FinancialWeeklyCell_FinancialWeeklyCell_Financia.qbl                                            |   23 
 _Main/BL/Type_FinancialWeeklyReport/DefaultValue_Name.qbl                                                                                      |    6 
 _Main/BL/Relations/Relation_FinancialWeeklyReport_FinancialWeeklyRow_FinancialWeeklyRow_Financi.qbl                                            |   23 
 _Main/BL/Type_FinancialWeeklyReport/Attribute_ID.qbl                                                                                           |    8 
 /dev/null                                                                                                                                      |   15 
 _Main/BL/Type_FinancialProductionCell/Attribute_PlanValue.qbl                                                                                  |    8 
 _Main/BL/Type_FinancialWeeklyColumn/Function_CalcIndex.qbl                                                                                     |   13 
 _Main/BL/Type_InventorySummarySource/StaticMethod_Download.qbl                                                                                 |   85 ++
 _Main/BL/Type_InventorySummaryReport/StaticMethod_GetDefaultDLUnit.qbl                                                                         |    2 
 _Main/BL/Type_InventroySummaryRow/Method_Initialize.qbl                                                                                        |    2 
 74 files changed, 1,301 insertions(+), 133 deletions(-)

diff --git a/_Main/BL/Relations/Relation_FinancialWeeklyColumn_FinancialWeeklyCell_FinancialWeeklyCell_Finan.qbl b/_Main/BL/Relations/Relation_FinancialWeeklyColumn_FinancialWeeklyCell_FinancialWeeklyCell_Finan.qbl
new file mode 100644
index 0000000..d1549b6
--- /dev/null
+++ b/_Main/BL/Relations/Relation_FinancialWeeklyColumn_FinancialWeeklyCell_FinancialWeeklyCell_Finan.qbl
@@ -0,0 +1,26 @@
+Quintiq file version 2.0
+#parent: #root
+Relation FinancialWeeklyColumn_FinancialWeeklyCell_FinancialWeeklyCell_FinancialWeeklyColumn
+{
+  #keys: '1[415136.0.880724166]'
+  ProceduralSequenceRelationStrategy
+  {
+    #keys: '13[0.0.0][415136.0.880724185][415136.0.880724179][415136.0.880724186][415136.0.880724180][415136.0.880724187][415136.0.880724181][415136.0.880724188][415136.0.880724182][415136.0.880724189][415136.0.880724183][415136.0.880724190][415136.0.880724184]'
+    SequenceElementSuffix: 'CellInColumn'
+    SequenceSuffix: 'CellInColumn'
+  }
+  RelationSide.LeftSide FinancialWeeklyCell
+  {
+    #keys: '3[415136.0.880724168][415136.0.880724167][415136.0.880724169]'
+    Cardinality: '1toN'
+    ObjectDefinition: FinancialWeeklyColumn
+    OwningSide: 'Owned'
+  }
+  RelationSide.RightSide FinancialWeeklyColumn
+  {
+    #keys: '3[415136.0.880724171][415136.0.880724170][415136.0.880724172]'
+    Cardinality: '0to1'
+    ObjectDefinition: FinancialWeeklyCell
+    OwningSide: 'Reference'
+  }
+}
diff --git a/_Main/BL/Relations/Relation_FinancialWeeklyReport_FinancialWeeklyColumn_FinancialWeeklyColumn_F.qbl b/_Main/BL/Relations/Relation_FinancialWeeklyReport_FinancialWeeklyColumn_FinancialWeeklyColumn_F.qbl
new file mode 100644
index 0000000..60e95e6
--- /dev/null
+++ b/_Main/BL/Relations/Relation_FinancialWeeklyReport_FinancialWeeklyColumn_FinancialWeeklyColumn_F.qbl
@@ -0,0 +1,26 @@
+Quintiq file version 2.0
+#parent: #root
+Relation FinancialWeeklyReport_FinancialWeeklyColumn_FinancialWeeklyColumn_FinancialWeeklyReport
+{
+  #keys: '1[415136.0.880724207]'
+  ProceduralSequenceRelationStrategy
+  {
+    #keys: '13[0.0.0][415136.0.880724228][415136.0.880724222][415136.0.880724229][415136.0.880724223][415136.0.880724230][415136.0.880724224][415136.0.880724231][415136.0.880724225][415136.0.880724232][415136.0.880724226][415136.0.880724233][415136.0.880724227]'
+    SequenceElementSuffix: 'Column'
+    SequenceSuffix: 'Column'
+  }
+  RelationSide.LeftSide FinancialWeeklyColumn
+  {
+    #keys: '3[415136.0.880724209][415136.0.880724208][415136.0.880724210]'
+    Cardinality: '1toN'
+    ObjectDefinition: FinancialWeeklyReport
+    OwningSide: 'Owned'
+  }
+  RelationSide.RightSide FinancialWeeklyReport
+  {
+    #keys: '3[415136.0.880724212][415136.0.880724211][415136.0.880724213]'
+    Cardinality: '0to1'
+    ObjectDefinition: FinancialWeeklyColumn
+    OwningSide: 'Reference'
+  }
+}
diff --git a/_Main/BL/Relations/Relation_FinancialWeeklyReport_FinancialWeeklyRow_FinancialWeeklyRow_Financi.qbl b/_Main/BL/Relations/Relation_FinancialWeeklyReport_FinancialWeeklyRow_FinancialWeeklyRow_Financi.qbl
new file mode 100644
index 0000000..1e7eb8b
--- /dev/null
+++ b/_Main/BL/Relations/Relation_FinancialWeeklyReport_FinancialWeeklyRow_FinancialWeeklyRow_Financi.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+Relation FinancialWeeklyReport_FinancialWeeklyRow_FinancialWeeklyRow_FinancialWeeklyReport
+{
+  #keys: '1[415136.0.880724123]'
+  DefaultRelationStrategy
+  {
+  }
+  RelationSide.LeftSide FinancialWeeklyRow
+  {
+    #keys: '3[415136.0.880724125][415136.0.880724124][415136.0.880724126]'
+    Cardinality: '1toN'
+    ObjectDefinition: FinancialWeeklyReport
+    OwningSide: 'Owned'
+  }
+  RelationSide.RightSide FinancialWeeklyReport
+  {
+    #keys: '3[415136.0.880724128][415136.0.880724127][415136.0.880724129]'
+    Cardinality: '0to1'
+    ObjectDefinition: FinancialWeeklyRow
+    OwningSide: 'Reference'
+  }
+}
diff --git a/_Main/BL/Relations/Relation_FinancialWeeklyReport_MacroPlan_MacroPlan_FinancialWeeklyReport.qbl b/_Main/BL/Relations/Relation_FinancialWeeklyReport_MacroPlan_MacroPlan_FinancialWeeklyReport.qbl
new file mode 100644
index 0000000..443896d
--- /dev/null
+++ b/_Main/BL/Relations/Relation_FinancialWeeklyReport_MacroPlan_MacroPlan_FinancialWeeklyReport.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+Relation FinancialWeeklyReport_MacroPlan_MacroPlan_FinancialWeeklyReport
+{
+  #keys: '1[415136.0.880700289]'
+  DefaultRelationStrategy
+  {
+  }
+  RelationSide.LeftSide MacroPlan
+  {
+    #keys: '3[415136.0.880700291][415136.0.880700290][415136.0.880700292]'
+    Cardinality: '0to1'
+    ObjectDefinition: FinancialWeeklyReport
+    OwningSide: 'Reference'
+  }
+  RelationSide.RightSide FinancialWeeklyReport
+  {
+    #keys: '3[415136.0.880700294][415136.0.880700293][415136.0.880700295]'
+    Cardinality: '0to1'
+    ObjectDefinition: MacroPlan
+    OwningSide: 'Owned'
+  }
+}
diff --git a/_Main/BL/Relations/Relation_FinancialWeeklyRow_FinancialWeeklyCell_FinancialWeeklyCell_Financia.qbl b/_Main/BL/Relations/Relation_FinancialWeeklyRow_FinancialWeeklyCell_FinancialWeeklyCell_Financia.qbl
new file mode 100644
index 0000000..8992c88
--- /dev/null
+++ b/_Main/BL/Relations/Relation_FinancialWeeklyRow_FinancialWeeklyCell_FinancialWeeklyCell_Financia.qbl
@@ -0,0 +1,23 @@
+Quintiq file version 2.0
+#parent: #root
+Relation FinancialWeeklyRow_FinancialWeeklyCell_FinancialWeeklyCell_FinancialWeeklyRow
+{
+  #keys: '1[415136.0.880700305]'
+  DefaultRelationStrategy
+  {
+  }
+  RelationSide.LeftSide FinancialWeeklyCell
+  {
+    #keys: '3[415136.0.880700307][415136.0.880700306][415136.0.880700308]'
+    Cardinality: '1toN'
+    ObjectDefinition: FinancialWeeklyRow
+    OwningSide: 'Reference'
+  }
+  RelationSide.RightSide FinancialWeeklyRow
+  {
+    #keys: '3[415136.0.880700310][415136.0.880700309][415136.0.880700311]'
+    Cardinality: '0to1'
+    ObjectDefinition: FinancialWeeklyCell
+    OwningSide: 'Reference'
+  }
+}
diff --git a/_Main/BL/Relations/Relation_InventorySummaryCell_ProductInStockingPointInPeriod_ProductInStocki.qbl b/_Main/BL/Relations/Relation_InventorySummaryCell_ProductInStockingPointInPeriod_ProductInStocki.qbl
deleted file mode 100644
index b73e32a..0000000
--- a/_Main/BL/Relations/Relation_InventorySummaryCell_ProductInStockingPointInPeriod_ProductInStocki.qbl
+++ /dev/null
@@ -1,23 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Relation InventorySummaryCell_ProductInStockingPointInPeriod_ProductInStockingPointInPeriod_InventorySummaryCell
-{
-  #keys: '1[415136.0.865101866]'
-  DefaultRelationStrategy
-  {
-  }
-  RelationSide.LeftSide ProductInStockingPointInPeriod
-  {
-    #keys: '3[415136.0.865101868][415136.0.865101867][415136.0.865101869]'
-    Cardinality: '1toN'
-    ObjectDefinition: InventorySummaryCell
-    OwningSide: 'Reference'
-  }
-  RelationSide.RightSide InventorySummaryCell
-  {
-    #keys: '3[415136.0.865101871][415136.0.865101870][415136.0.865101872]'
-    Cardinality: '0to1'
-    ObjectDefinition: ProductInStockingPointInPeriod
-    OwningSide: 'Reference'
-  }
-}
diff --git a/_Main/BL/Type_FinancialProductionCell/Attribute_PlanValue.qbl b/_Main/BL/Type_FinancialProductionCell/Attribute_PlanValue.qbl
new file mode 100644
index 0000000..87d0ca7
--- /dev/null
+++ b/_Main/BL/Type_FinancialProductionCell/Attribute_PlanValue.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute PlanValue
+{
+  #keys: '3[415136.0.880970239][415136.0.880970238][415136.0.880970240]'
+  Description: '璁″垝鍊�'
+  ValueType: Real
+}
diff --git a/_Main/BL/Type_FinancialProductionCell/Function_CalcPlanValue.qbl b/_Main/BL/Type_FinancialProductionCell/Function_CalcPlanValue.qbl
new file mode 100644
index 0000000..b51c61d
--- /dev/null
+++ b/_Main/BL/Type_FinancialProductionCell/Function_CalcPlanValue.qbl
@@ -0,0 +1,13 @@
+Quintiq file version 2.0
+#parent: #root
+Function CalcPlanValue
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jul-5-2024 (created)
+    
+    value := ifexpr( this.FinancialProductionColumn().FinancialProductionReport().FinancialProductionSource().MacroPlan().StartOfPlanning().StartOfMonth().Date() <= this.FinancialProductionColumn().Period(), [Real]this.Value(), 0 );
+    
+    this.PlanValue( value );
+  *]
+}
diff --git a/_Main/BL/Type_FinancialProductionReport/StaticMethod_GetDefaultCCUnit.qbl b/_Main/BL/Type_FinancialProductionReport/StaticMethod_GetDefaultCCUnit.qbl
index e469589..77d1f16 100644
--- a/_Main/BL/Type_FinancialProductionReport/StaticMethod_GetDefaultCCUnit.qbl
+++ b/_Main/BL/Type_FinancialProductionReport/StaticMethod_GetDefaultCCUnit.qbl
@@ -6,5 +6,6 @@
   [*
     // 鐢勫叞楦� Jun-25-2024 (created)
     return '闀挎槬';
+    //return 'Assembly Plant (France)';
   *]
 }
diff --git a/_Main/BL/Type_FinancialProductionReport/StaticMethod_GetDefaultDLUnit.qbl b/_Main/BL/Type_FinancialProductionReport/StaticMethod_GetDefaultDLUnit.qbl
index 71132d4..4759121 100644
--- a/_Main/BL/Type_FinancialProductionReport/StaticMethod_GetDefaultDLUnit.qbl
+++ b/_Main/BL/Type_FinancialProductionReport/StaticMethod_GetDefaultDLUnit.qbl
@@ -6,5 +6,6 @@
   [*
     // 鐢勫叞楦� Jun-25-2024 (created)
     return '澶ц繛';
+    //return 'Assembly Plant (Spain)';
   *]
 }
diff --git a/_Main/BL/Type_FinancialSalesReport/Method_GetRow.qbl b/_Main/BL/Type_FinancialSalesReport/Method_GetRow.qbl
index a656035..6cbc77d 100644
--- a/_Main/BL/Type_FinancialSalesReport/Method_GetRow.qbl
+++ b/_Main/BL/Type_FinancialSalesReport/Method_GetRow.qbl
@@ -2,9 +2,7 @@
 #parent: #root
 Method GetRow (
   String salessegment,
-  String product,
-  DateTime startdate,
-  DateTime enddate
+  String product
 ) as FinancialSalesRow
 {
   TextBody:
@@ -15,7 +13,7 @@
     if( isnull( row ) ){
       row := this.FinancialSalesRow( relnew, Name := product, Unit := salessegment );
       //鍒濆鍖栧崟鍏冩牸
-      row.InitializeCell( this, startdate, enddate );
+      row.InitializeCell( this );
     }
     
     return row;
diff --git a/_Main/BL/Type_FinancialSalesRow/Method_InitializeCell.qbl b/_Main/BL/Type_FinancialSalesRow/Method_InitializeCell.qbl
index 0ef49d7..0c6ebc7 100644
--- a/_Main/BL/Type_FinancialSalesRow/Method_InitializeCell.qbl
+++ b/_Main/BL/Type_FinancialSalesRow/Method_InitializeCell.qbl
@@ -1,19 +1,13 @@
 Quintiq file version 2.0
 #parent: #root
 Method InitializeCell (
-  FinancialSalesReport table,
-  DateTime startdate,
-  DateTime enddate
+  FinancialSalesReport table
 )
 {
   TextBody:
   [*
     // 鐢勫叞楦� Jun-28-2024 (created)
-    for( start := startdate; start < enddate; start := start.StartOfNextMonth() ){
-      periodtime := start.Date();
-      periodname := periodtime.Format( "M2/D2/Y" );
-      column := selectobject( table, FinancialSalesColumn, column, column.Name() = periodname and column.Period() = periodtime );
-      
+    traverse( table, FinancialSalesColumn, column ){
       this.Initialize( column, this.Unit() );
     }
   *]
diff --git a/_Main/BL/Type_FinancialSalesSource/StaticMethod_Initialize.qbl b/_Main/BL/Type_FinancialSalesSource/StaticMethod_Initialize.qbl
index 8f63f1f..804d079 100644
--- a/_Main/BL/Type_FinancialSalesSource/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_FinancialSalesSource/StaticMethod_Initialize.qbl
@@ -23,7 +23,7 @@
     table                     := source.FinancialSalesReport( relnew, ID := source.Name(), Name := source.Name(), IsImport := false );
     showtable                 := source.FinancialSalesReport( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsImport := false, IsShow := true );
     startofplanning           := owner.StartOfPlanning();
-    startofyear               := startofplanning.StartOfYear();
+    //startofyear               := startofplanning.StartOfYear();
     startofnextyear           := startofplanning.StartOfNextYear();
     
     search                    := source.FinancialSalesSearch( relnew, Unit := allsalessegment, Generation := allsalessegment, MqbMlb := allsalessegment, Power := allsalessegment );
@@ -34,7 +34,7 @@
     traverse( owner, SalesDemand.astype( Forecast ), forecast, forecast.StartDate() < startofnextyear.Date() and ( ( forecast.SalesSegmentName() = ccsalessegment and forecast.Product_MP().MQBMLB() = 'MLB' ) 
               or forecast.SalesSegmentName() = tjsalessegment or forecast.SalesSegmentName() = fssalessegment ) ){
       product    := forecast.Product_MP();
-      allrow     := table.GetRow( allsalessegment, product.ID(), startofyear, startofnextyear );
+      allrow     := table.GetRow( allsalessegment, product.ID() );
       periodtime := forecast.StartDate().StartOfMonth();
       periodname := periodtime.Format( "M2/D2/Y" );
       
@@ -47,13 +47,13 @@
       //Forecast鐨凷ales Segment涓洪暱鏄ワ紝璇嗗埆鍑篗LB鐨勬墍鏈変骇鍝佹眹鎬�
       if( forecast.SalesSegmentName() = ccsalessegment and product.MQBMLB() = 'MLB' ){
     //    info( '------------------------', column.Name() );
-        ccrow := table.GetRow( ccsalessegment, product.ID(), startofyear, startofnextyear );
+        ccrow := table.GetRow( ccsalessegment, product.ID() );
     //    info( '------------------------', ccrow.FinancialSalesCell( relsize ), column.FinancialSalesCell( relsize ) );
         ccrow.Initialize( column, forecast.Quantity() );
       }else if( forecast.SalesSegmentName() = tjsalessegment or forecast.SalesSegmentName() = fssalessegment ){
         //澶ц繛璐㈠姟閿�閲忥細棣栧厛鍦╢orecast鐣岄潰鏌ユ壘Sales Segment鏄ぉ娲ュ拰浣涘北鐨勬墍鏈夐渶姹傦紝姣忎釜浜у搧鎸夋湀姹囨�婚渶姹傛暟閲�
     //    info( '------------------------', column.Name() );
-        dlrow := table.GetRow( dlsalessegment, product.ID(), startofyear, startofnextyear );
+        dlrow := table.GetRow( dlsalessegment, product.ID() );
     //    info( '------------------------', dlrow.FinancialSalesCell( relsize ), column.FinancialSalesCell( relsize ) );
         dlrow.Initialize( column, forecast.Quantity() );
       }
@@ -67,10 +67,10 @@
           periodtime := pispip.Start().StartOfMonth().Date();
           periodname := periodtime.Format( "M2/D2/Y" );
           column    := selectobject( table, FinancialSalesColumn, column, column.Name() = periodname and column.Period() = periodtime );
-          ccrow := table.GetRow( ccsalessegment, product.ID(), startofyear, startofnextyear );
+          ccrow := table.GetRow( ccsalessegment, product.ID() );
           ccrow.Initialize( column, pispip.DependentDemandAndSalesDemandQuantity() );//鍙朤otal Demand瀛楁鎸夋湀姹囨�婚渶姹傛暟閲�
           
-          allrow     := table.GetRow( allsalessegment, product.ID(), startofyear, startofnextyear );
+          allrow     := table.GetRow( allsalessegment, product.ID() );
           allrow.Initialize( column, pispip.DependentDemandAndSalesDemandQuantity() );
         }
       }
@@ -84,10 +84,10 @@
         
         column    := selectobject( table, FinancialSalesColumn, column, column.Name() = periodname and column.Period() = periodtime );
         traverse( trip, ProductInTrip, pit ){
-          dlrow      := table.GetRow( dlsalessegment, pit.ProductID(), startofyear, startofnextyear );
+          dlrow      := table.GetRow( dlsalessegment, pit.ProductID() );
           dlrow.Initialize( column, pit.Quantity() );//鍙朤otal Demand瀛楁鎸夋湀姹囨�婚渶姹傛暟閲�
           
-          allrow     := table.GetRow( allsalessegment, pit.ProductID(), startofyear, startofnextyear );
+          allrow     := table.GetRow( allsalessegment, pit.ProductID() );
           allrow.Initialize( column, pit.Quantity() );
         }
       }
diff --git a/_Main/BL/Type_FinancialWeeklyCell/Attribute_Value.qbl b/_Main/BL/Type_FinancialWeeklyCell/Attribute_Value.qbl
new file mode 100644
index 0000000..d0100df
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyCell/Attribute_Value.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute Value
+{
+  #keys: '3[415136.0.880700281][415136.0.880700280][415136.0.880700282]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_FinancialWeeklyCell/DefaultValue_Value.qbl b/_Main/BL/Type_FinancialWeeklyCell/DefaultValue_Value.qbl
new file mode 100644
index 0000000..913414b
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyCell/DefaultValue_Value.qbl
@@ -0,0 +1,6 @@
+Quintiq file version 2.0
+#parent: #root
+DefaultValue
+{
+  TargetAttribute: Value
+}
diff --git a/_Main/BL/Type_FinancialWeeklyCell/_ROOT_Type_FinancialWeeklyCell.qbl b/_Main/BL/Type_FinancialWeeklyCell/_ROOT_Type_FinancialWeeklyCell.qbl
new file mode 100644
index 0000000..dcfd66f
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyCell/_ROOT_Type_FinancialWeeklyCell.qbl
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+Type FinancialWeeklyCell
+{
+  #keys: '5[415136.0.880700278][415136.0.880700276][0.0.0][415136.0.880700277][415136.0.880700279]'
+  BaseType: Object
+  Description: '璐㈠姟鍛ㄦ姤鎶ヨ〃鍗曞厓鏍�'
+  StructuredName: 'FinancialWeeklyCells'
+}
diff --git a/_Main/BL/Type_FinancialWeeklyColumn/Attribute_Index.qbl b/_Main/BL/Type_FinancialWeeklyColumn/Attribute_Index.qbl
new file mode 100644
index 0000000..e9d1d66
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyColumn/Attribute_Index.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute Index
+{
+  #keys: '3[415136.0.880700264][415136.0.880700263][415136.0.880700265]'
+  ValueType: Number
+}
diff --git a/_Main/BL/Type_FinancialWeeklyColumn/Attribute_Name.qbl b/_Main/BL/Type_FinancialWeeklyColumn/Attribute_Name.qbl
new file mode 100644
index 0000000..8d33fbb
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyColumn/Attribute_Name.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute Name
+{
+  #keys: '3[415136.0.880700267][415136.0.880700266][415136.0.880700268]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_FinancialWeeklyColumn/Attribute_Period.qbl b/_Main/BL/Type_FinancialWeeklyColumn/Attribute_Period.qbl
new file mode 100644
index 0000000..89fbd65
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyColumn/Attribute_Period.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute Period
+{
+  #keys: '3[415136.0.880700270][415136.0.880700269][415136.0.880700271]'
+  ValueType: Date
+}
diff --git a/_Main/BL/Type_FinancialWeeklyColumn/DefaultValue_Name.qbl b/_Main/BL/Type_FinancialWeeklyColumn/DefaultValue_Name.qbl
new file mode 100644
index 0000000..86c3d59
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyColumn/DefaultValue_Name.qbl
@@ -0,0 +1,6 @@
+Quintiq file version 2.0
+#parent: #root
+DefaultValue
+{
+  TargetAttribute: Name
+}
diff --git a/_Main/BL/Type_FinancialWeeklyColumn/Function_CalcIndex.qbl b/_Main/BL/Type_FinancialWeeklyColumn/Function_CalcIndex.qbl
new file mode 100644
index 0000000..9adb565
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyColumn/Function_CalcIndex.qbl
@@ -0,0 +1,13 @@
+Quintiq file version 2.0
+#parent: #root
+Function CalcIndex
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jun-21-2024 (created)1
+    
+    value := ifexpr( isnull( this.PreviousColumn() ), 0, this.PreviousColumn().Index() + 1 );
+    
+    this.Index( value );
+  *]
+}
diff --git a/_Main/BL/Type_FinancialWeeklyColumn/_ROOT_Type_FinancialWeeklyColumn.qbl b/_Main/BL/Type_FinancialWeeklyColumn/_ROOT_Type_FinancialWeeklyColumn.qbl
new file mode 100644
index 0000000..d58efd7
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyColumn/_ROOT_Type_FinancialWeeklyColumn.qbl
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+Type FinancialWeeklyColumn
+{
+  #keys: '5[415136.0.880700261][415136.0.880700259][0.0.0][415136.0.880700260][415136.0.880700262]'
+  BaseType: Object
+  Description: '璐㈠姟鍛ㄦ姤鍒�'
+  StructuredName: 'FinancialWeeklyColumns'
+}
diff --git a/_Main/BL/Type_FinancialWeeklyReport/Attribute_ID.qbl b/_Main/BL/Type_FinancialWeeklyReport/Attribute_ID.qbl
new file mode 100644
index 0000000..1615973
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyReport/Attribute_ID.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ID
+{
+  #keys: '3[415136.0.880700226][415136.0.880700225][415136.0.880700227]'
+  IsReadOnly: true
+  ValueType: String
+}
diff --git a/_Main/BL/Type_FinancialWeeklyReport/Attribute_IsShow.qbl b/_Main/BL/Type_FinancialWeeklyReport/Attribute_IsShow.qbl
new file mode 100644
index 0000000..91c8574
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyReport/Attribute_IsShow.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsShow
+{
+  #keys: '3[415136.0.880700229][415136.0.880700228][415136.0.880700230]'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_FinancialWeeklyReport/Attribute_Name.qbl b/_Main/BL/Type_FinancialWeeklyReport/Attribute_Name.qbl
new file mode 100644
index 0000000..f308987
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyReport/Attribute_Name.qbl
@@ -0,0 +1,8 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute Name
+{
+  #keys: '3[415136.0.880700232][415136.0.880700231][415136.0.880700233]'
+  Description: '鍚嶇О'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_FinancialWeeklyReport/DefaultValue_ID.qbl b/_Main/BL/Type_FinancialWeeklyReport/DefaultValue_ID.qbl
new file mode 100644
index 0000000..049abc0
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyReport/DefaultValue_ID.qbl
@@ -0,0 +1,6 @@
+Quintiq file version 2.0
+#parent: #root
+DefaultValue
+{
+  TargetAttribute: ID
+}
diff --git a/_Main/BL/Type_FinancialWeeklyReport/DefaultValue_Name.qbl b/_Main/BL/Type_FinancialWeeklyReport/DefaultValue_Name.qbl
new file mode 100644
index 0000000..86c3d59
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyReport/DefaultValue_Name.qbl
@@ -0,0 +1,6 @@
+Quintiq file version 2.0
+#parent: #root
+DefaultValue
+{
+  TargetAttribute: Name
+}
diff --git a/_Main/BL/Type_FinancialWeeklyReport/Method_GenerateColumn.qbl b/_Main/BL/Type_FinancialWeeklyReport/Method_GenerateColumn.qbl
new file mode 100644
index 0000000..3e3dbae
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyReport/Method_GenerateColumn.qbl
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: #root
+Method GenerateColumn (
+  MacroPlan owner
+)
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jun-25-2024 (created)
+    startofplanning           := owner.StartOfPlanning();
+    startofyear               := startofplanning.StartOfYear();
+    startofnextyear           := startofplanning.StartOfNextYear();
+    
+    for( start := startofyear; start < startofnextyear; start := start.StartOfNextMonth() ){
+      periodtime := start.Date();
+      periodname := periodtime.Format( "M2/D2/Y" );
+      this.FinancialWeeklyColumn( relnew, Name := periodname, Period := periodtime );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_FinancialWeeklyReport/StaticMethod_Download.qbl b/_Main/BL/Type_FinancialWeeklyReport/StaticMethod_Download.qbl
new file mode 100644
index 0000000..1814b15
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyReport/StaticMethod_Download.qbl
@@ -0,0 +1,65 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod Download (
+  MacroPlan macroPlan
+) as BinaryValue
+{
+  Description: '涓嬭浇璐㈠姟鎶ヨ〃鏁版嵁'
+  TextBody:
+  [*
+    
+    table := macroPlan.FinancialWeeklyReport();
+    
+    xmlDOMI := XMLDOMImplementation::Create();
+    xmlDOM  := xmlDOMI.CreateDocumentFromString( '<?xml version="1.0" encoding="UTF-16"?><table><name>' + table.Name() + '</name></table>' );
+    
+    tableElement := xmlDOM.GetElementByTagName( "table", 0 );
+    //琛屽悕
+    rowcolumnelement := xmlDOM.CreateElement( "column" );
+    rownameelement   := xmlDOM.CreateElement( "name" );
+    rowtypeelement   := xmlDOM.CreateElement( "type" );
+    rownameelement.TextContent( '' );
+    rowtypeelement.TextContent( "String" );
+    rowcolumnelement.AppendChild( rownameelement );
+    rowcolumnelement.AppendChild( rowtypeelement );
+    
+    tableElement.AppendChild( rowcolumnelement ); 
+    traverse ( table, FinancialWeeklyColumn, column ) {
+      columnelement := xmlDOM.CreateElement( "column" );
+      nameelement   := xmlDOM.CreateElement( "name" );
+      typeelement   := xmlDOM.CreateElement( "type" );
+      nameelement.TextContent( column.Name() );
+      typeelement.TextContent( "String" );
+      columnelement.AppendChild( nameelement );
+      columnelement.AppendChild( typeelement );
+      
+      cells := selectsortedset( column, FinancialWeeklyCell, cell, cell.FinancialWeeklyRow().RowNr() );
+    
+      traverse ( cells, Elements, c ) {
+        if( column.Index() = 0 ){
+          row := c.FinancialWeeklyRow();
+          //琛屽悕
+          rowcellElement := xmlDOM.CreateElement( "cell" );
+          rowcellElement.SetAttribute( "value", row.Name() );
+          rowcolumnelement.AppendChild( rowcellElement );
+        }
+        cellElement := xmlDOM.CreateElement( "cell" );
+        cellElement.SetAttribute( "value", c.Value() ); 
+        columnelement.AppendChild( cellElement );
+      }
+      tableElement.AppendChild( columnelement );  
+    }
+    
+    xmlString := xmlDOMI.CreateSerializer().WriteToString( xmlDOM );
+    
+    //info( xmlString );
+    
+    tableGroupHandle := TableGroupHandle::Create( FinancialWeeklyReport::GetDefaultName() );
+    tableHandle      := TableHandle::ImportXML( BinaryValue::Construct( xmlString ) );
+    tableGroupHandle.Add( tableHandle );
+    
+    binaryData := XLS::SaveTableGroupToBinaryData( tableGroupHandle, true );
+    
+    return binaryData.AsBinaryValue();
+  *]
+}
diff --git a/_Main/BL/Type_FinancialWeeklyReport/StaticMethod_GetDefaultAllUnit.qbl b/_Main/BL/Type_FinancialWeeklyReport/StaticMethod_GetDefaultAllUnit.qbl
new file mode 100644
index 0000000..518f4c6
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyReport/StaticMethod_GetDefaultAllUnit.qbl
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetDefaultAllUnit () const as String
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jun-28-2024 (created)
+    return '<All>';
+  *]
+}
diff --git a/_Main/BL/Type_FinancialWeeklyReport/StaticMethod_GetDefaultCCUnit.qbl b/_Main/BL/Type_FinancialWeeklyReport/StaticMethod_GetDefaultCCUnit.qbl
new file mode 100644
index 0000000..739a84b
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyReport/StaticMethod_GetDefaultCCUnit.qbl
@@ -0,0 +1,11 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetDefaultCCUnit () const as String
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jun-28-2024 (created)
+    return '闀挎槬';
+    //return 'Assembly Plant (France)';
+  *]
+}
diff --git a/_Main/BL/Type_FinancialWeeklyReport/StaticMethod_GetDefaultDLUnit.qbl b/_Main/BL/Type_FinancialWeeklyReport/StaticMethod_GetDefaultDLUnit.qbl
new file mode 100644
index 0000000..d544c74
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyReport/StaticMethod_GetDefaultDLUnit.qbl
@@ -0,0 +1,11 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetDefaultDLUnit () const as String
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jun-28-2024 (created)
+    return '澶ц繛';
+    //return 'Assembly Plant (Spain)';
+  *]
+}
diff --git a/_Main/BL/Type_FinancialWeeklyReport/StaticMethod_GetDefaultName.qbl b/_Main/BL/Type_FinancialWeeklyReport/StaticMethod_GetDefaultName.qbl
new file mode 100644
index 0000000..9b7d1de
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyReport/StaticMethod_GetDefaultName.qbl
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetDefaultName () const as String
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jun-25-2024 (created)
+    return 'Financial weekly';
+  *]
+}
diff --git a/_Main/BL/Type_FinancialWeeklyReport/StaticMethod_Initialize.qbl b/_Main/BL/Type_FinancialWeeklyReport/StaticMethod_Initialize.qbl
new file mode 100644
index 0000000..dcd3b98
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyReport/StaticMethod_Initialize.qbl
@@ -0,0 +1,173 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod Initialize (
+  MacroPlan owner
+)
+{
+  Description: '鍒濆鍖�'
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jul-4-2024 (created)
+    owner.FinancialWeeklyReport( relflush );
+    ccunit                    := FinancialWeeklyReport::GetDefaultCCUnit();
+    dlunit                    := FinancialWeeklyReport::GetDefaultDLUnit();
+    allunit                   := FinancialWeeklyReport::GetDefaultAllUnit();
+    defaultname               := FinancialWeeklyReport::GetDefaultName();
+    startofplanning           := owner.StartOfPlanning();
+    
+    table                     := owner.FinancialWeeklyReport( relnew, ID := defaultname, Name := defaultname );
+    //浜ч噺鎶ヨ〃
+    productiontable           := selectobject( owner, FinancialProductionSource.FinancialProductionReport, report, not report.IsImport() and not report.IsShow() );
+    //閿�閲忔姤琛�
+    salestable                := selectobject( owner, FinancialSalesSource.FinancialSalesReport, report, not report.IsImport() and not report.IsShow() );
+    
+    table.GenerateColumn( owner );
+    totalproduction           := table.FinancialWeeklyRow( relnew, Name := '鎬讳骇閲�', RowNr := 1 );
+    dlproduction              := table.FinancialWeeklyRow( relnew, Name := 'DL浜ч噺', RowNr := 2 );
+    ccproduction              := table.FinancialWeeklyRow( relnew, Name := 'CC浜ч噺', RowNr := 3 );
+    totalsales                := table.FinancialWeeklyRow( relnew, Name := '鎬婚攢閲�', RowNr := 4 );
+    dlsales                   := table.FinancialWeeklyRow( relnew, Name := 'DL閿�閲�', RowNr := 5 );
+    ccsales                   := table.FinancialWeeklyRow( relnew, Name := 'CC閿�閲�', RowNr := 6 );
+    //SUM
+    totalpvaluesum            := [Real]0;
+    dlpvaluesum               := [Real]0;
+    ccpvaluesum               := [Real]0;
+    totalsvaluesum            := [Real]0;
+    dlsvaluesum               := [Real]0;
+    ccsvaluesum               := [Real]0;
+    //绱閲�
+    totalpvaluecumulant       := [Real]0;
+    dlpvaluecumulant          := [Real]0;
+    ccpvaluecumulant          := [Real]0;
+    totalsvaluecumulant       := [Real]0;
+    dlsvaluecumulant          := [Real]0;
+    ccsvaluecumulant          := [Real]0;
+    
+    traverse( table, FinancialWeeklyColumn, column ){
+      productioncolumn      := selectobject( productiontable, FinancialProductionColumn, pcolumn, pcolumn.Name() = column.Name() and pcolumn.Period() = column.Period() );
+      salescolumn           := selectobject( salestable, FinancialSalesColumn, scolumn, scolumn.Name() = column.Name() and scolumn.Period() = column.Period() );
+      
+      //浜ч噺姹囨��
+      totalpvalue           := [Real]0;
+      dlpvalue              := [Real]0;
+      ccpvalue              := [Real]0;
+      traverse( productioncolumn, FinancialProductionCell, cell, [Real]cell.Value() > 0 ){
+        unit                := cell.FinancialProductionRow().Unit();
+        
+        if( unit = allunit ){
+          totalpvalue       := totalpvalue + [Real]cell.Value();
+          if( column.Period() = startofplanning.StartOfMonth().Date() ){
+            totalpvaluecumulant := totalpvaluecumulant - cell.PlanValue();
+          }
+        }else if( unit = dlunit ){
+          dlpvalue          := dlpvalue + [Real]cell.Value();
+          if( column.Period() = startofplanning.StartOfMonth().Date() ){
+            dlpvaluecumulant := dlpvaluecumulant - cell.PlanValue();
+          }
+        }else if( unit = ccunit ){
+          ccpvalue          := ccpvalue + [Real]cell.Value();
+          if( column.Period() = startofplanning.StartOfMonth().Date() ){
+            ccpvaluecumulant := ccpvaluecumulant - cell.PlanValue();
+          }
+        }
+      }
+      totalpcell            := column.FinancialWeeklyCell( relnew, Value := [String]totalpvalue );
+      totalproduction.FinancialWeeklyCell( relinsert, totalpcell );
+      dlpcell               := column.FinancialWeeklyCell( relnew, Value := [String]dlpvalue );
+      dlproduction.FinancialWeeklyCell( relinsert, dlpcell );
+      ccpcell               := column.FinancialWeeklyCell( relnew, Value := [String]ccpvalue );
+      ccproduction.FinancialWeeklyCell( relinsert, ccpcell );
+      
+      //閿�閲忔眹鎬�
+      totalsvalue           := [Real]0;
+      dlsvalue              := [Real]0;
+      ccsvalue              := [Real]0;
+      traverse( salescolumn, FinancialSalesCell, cell, [Real]cell.Value() > 0 ){
+        unit                := cell.FinancialSalesRow().Unit();
+        if( unit = allunit ){
+          totalsvalue       := totalsvalue + [Real]cell.Value();
+        }else if( unit = dlunit ){
+          dlsvalue          := dlsvalue + [Real]cell.Value();
+        }else if( unit = ccunit ){
+          ccsvalue          := ccsvalue + [Real]cell.Value();
+        }
+      }
+      totalscell            := column.FinancialWeeklyCell( relnew, Value := [String]totalsvalue );
+      totalsales.FinancialWeeklyCell( relinsert, totalscell );
+      dlscell               := column.FinancialWeeklyCell( relnew, Value := [String]dlsvalue );
+      dlsales.FinancialWeeklyCell( relinsert, dlscell );
+      ccscell               := column.FinancialWeeklyCell( relnew, Value := [String]ccsvalue );
+      ccsales.FinancialWeeklyCell( relinsert, ccscell );
+      
+      if( column.Period() < startofplanning.StartOfMonth().Date() ){
+        totalpvaluecumulant := totalpvaluecumulant + totalpvalue;
+        dlpvaluecumulant    := dlpvaluecumulant + dlpvalue;
+        ccpvaluecumulant    := ccpvaluecumulant + ccpvalue;
+        totalsvaluecumulant := totalsvaluecumulant + totalsvalue;
+        dlsvaluecumulant    := dlsvaluecumulant + dlsvalue;
+        ccsvaluecumulant    := ccsvaluecumulant + ccsvalue;
+      }
+      totalpvaluesum        := totalpvaluesum + totalpvalue;
+      dlpvaluesum           := dlpvaluesum + dlpvalue;
+      ccpvaluesum           := ccpvaluesum + ccpvalue;
+      totalsvaluesum        := totalsvaluesum + totalsvalue;
+      dlsvaluesum           := dlsvaluesum + dlsvalue;
+      ccsvaluesum           := ccsvaluesum + ccsvalue;
+    }
+    sumcolumn                 := table.FinancialWeeklyColumn( relnew, Name := 'SUM' );
+    cumulantcolumn            := table.FinancialWeeklyColumn( relnew, Name := '绱閲�' );
+    proportioncolumn          := table.FinancialWeeklyColumn( relnew, Name := '鍗犳瘮' );
+    //SUM
+    totalpcellsum           := sumcolumn.FinancialWeeklyCell( relnew, Value := [String]totalpvaluesum );
+    totalproduction.FinancialWeeklyCell( relinsert, totalpcellsum );
+    dlpcellsum              := sumcolumn.FinancialWeeklyCell( relnew, Value := [String]dlpvaluesum );
+    dlproduction.FinancialWeeklyCell( relinsert, dlpcellsum );
+    ccpcellsum              := sumcolumn.FinancialWeeklyCell( relnew, Value := [String]ccpvaluesum );
+    ccproduction.FinancialWeeklyCell( relinsert, ccpcellsum );
+    totalscellsum           := sumcolumn.FinancialWeeklyCell( relnew, Value := [String]totalsvaluesum );
+    totalsales.FinancialWeeklyCell( relinsert, totalscellsum );
+    dlscellsum              := sumcolumn.FinancialWeeklyCell( relnew, Value := [String]dlsvaluesum );
+    dlsales.FinancialWeeklyCell( relinsert, dlscellsum );
+    ccscellsum              := sumcolumn.FinancialWeeklyCell( relnew, Value := [String]ccsvaluesum );
+    ccsales.FinancialWeeklyCell( relinsert, ccscellsum );
+    //绱閲�
+    totalpcellcumulant      := cumulantcolumn.FinancialWeeklyCell( relnew, Value := [String]totalpvaluecumulant );
+    totalproduction.FinancialWeeklyCell( relinsert, totalpcellcumulant );
+    dlpcellcumulant         := cumulantcolumn.FinancialWeeklyCell( relnew, Value := [String]dlpvaluecumulant );
+    dlproduction.FinancialWeeklyCell( relinsert, dlpcellcumulant );
+    ccpcellcumulant         := cumulantcolumn.FinancialWeeklyCell( relnew, Value := [String]ccpvaluecumulant );
+    ccproduction.FinancialWeeklyCell( relinsert, ccpcellcumulant );
+    totalscellcumulant      := cumulantcolumn.FinancialWeeklyCell( relnew, Value := [String]totalsvaluecumulant );
+    totalsales.FinancialWeeklyCell( relinsert, totalscellcumulant );
+    dlscellcumulant         := cumulantcolumn.FinancialWeeklyCell( relnew, Value := [String]dlsvaluecumulant );
+    dlsales.FinancialWeeklyCell( relinsert, dlscellcumulant );
+    ccscellcumulant         := cumulantcolumn.FinancialWeeklyCell( relnew, Value := [String]ccsvaluecumulant );
+    ccsales.FinancialWeeklyCell( relinsert, ccscellcumulant );
+    //鍗犳瘮
+    totalpvalueproportion   := guard( ( totalpvaluecumulant / totalpvaluesum ).Format( 'N(Dec(2))' ), '0.00' );
+    totalpcellproportion    := proportioncolumn.FinancialWeeklyCell( relnew, Value := totalpvalueproportion );
+    totalproduction.FinancialWeeklyCell( relinsert, totalpcellproportion );
+    
+    dlpvalueproportion      := guard( ( dlpvaluecumulant / dlpvaluesum ).Format( 'N(Dec(2))' ), '0.00' );
+    dlpcellproportion       := proportioncolumn.FinancialWeeklyCell( relnew, Value := dlpvalueproportion );
+    dlproduction.FinancialWeeklyCell( relinsert, dlpcellproportion );
+    
+    ccpvalueproportion      := guard( ( ccpvaluecumulant / ccpvaluesum ).Format( 'N(Dec(2))' ), '0.00' );
+    ccpcellproportion       := proportioncolumn.FinancialWeeklyCell( relnew, Value := ccpvalueproportion );
+    ccproduction.FinancialWeeklyCell( relinsert, ccpcellproportion );
+    
+    totalsvalueproportion   := guard( ( totalsvaluecumulant / totalsvaluesum ).Format( 'N(Dec(2))' ), '0.00' );
+    totalscellproportion    := proportioncolumn.FinancialWeeklyCell( relnew, Value := totalsvalueproportion );
+    totalsales.FinancialWeeklyCell( relinsert, totalscellproportion );
+    
+    dlsvalueproportion      := guard( ( dlsvaluecumulant / dlsvaluesum ).Format( 'N(Dec(2))' ), '0.00' );
+    dlscellproportion       := proportioncolumn.FinancialWeeklyCell( relnew, Value := dlsvalueproportion );
+    dlsales.FinancialWeeklyCell( relinsert, dlscellproportion );
+    
+    ccsvalueproportion      := guard( ( ccsvaluecumulant / ccsvaluesum ).Format( 'N(Dec(2))' ), '0.00' );
+    ccscellproportion       := proportioncolumn.FinancialWeeklyCell( relnew, Value := ccsvalueproportion );
+    ccsales.FinancialWeeklyCell( relinsert, ccscellproportion );
+    
+    info( sumcolumn.FinancialWeeklyCell( relsize ), cumulantcolumn.FinancialWeeklyCell( relsize ), proportioncolumn.FinancialWeeklyCell( relsize ) );
+  *]
+}
diff --git a/_Main/BL/Type_FinancialWeeklyReport/_ROOT_Type_FinancialWeeklyReport.qbl b/_Main/BL/Type_FinancialWeeklyReport/_ROOT_Type_FinancialWeeklyReport.qbl
new file mode 100644
index 0000000..0d8d278
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyReport/_ROOT_Type_FinancialWeeklyReport.qbl
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+Type FinancialWeeklyReport
+{
+  #keys: '5[415136.0.880700223][415136.0.880700221][0.0.0][415136.0.880700222][415136.0.880700224]'
+  BaseType: Object
+  Description: '璐㈠姟鍛ㄦ姤鎶ヨ〃'
+  StructuredName: 'FinancialWeeklyReports'
+}
diff --git a/_Main/BL/Type_FinancialWeeklyRow/Attribute_Name.qbl b/_Main/BL/Type_FinancialWeeklyRow/Attribute_Name.qbl
new file mode 100644
index 0000000..f048b61
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyRow/Attribute_Name.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute Name
+{
+  #keys: '3[415136.0.880700246][415136.0.880700245][415136.0.880700247]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_FinancialWeeklyRow/Attribute_RowNr.qbl b/_Main/BL/Type_FinancialWeeklyRow/Attribute_RowNr.qbl
new file mode 100644
index 0000000..1c9317f
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyRow/Attribute_RowNr.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute RowNr
+{
+  #keys: '3[415136.0.880700249][415136.0.880700248][415136.0.880700250]'
+  ValueType: Number
+}
diff --git a/_Main/BL/Type_FinancialWeeklyRow/DefaultValue_Name.qbl b/_Main/BL/Type_FinancialWeeklyRow/DefaultValue_Name.qbl
new file mode 100644
index 0000000..86c3d59
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyRow/DefaultValue_Name.qbl
@@ -0,0 +1,6 @@
+Quintiq file version 2.0
+#parent: #root
+DefaultValue
+{
+  TargetAttribute: Name
+}
diff --git a/_Main/BL/Type_FinancialWeeklyRow/_ROOT_Type_FinancialWeeklyRow.qbl b/_Main/BL/Type_FinancialWeeklyRow/_ROOT_Type_FinancialWeeklyRow.qbl
new file mode 100644
index 0000000..e68f59a
--- /dev/null
+++ b/_Main/BL/Type_FinancialWeeklyRow/_ROOT_Type_FinancialWeeklyRow.qbl
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+#root
+#parent: #DomainModel
+Type FinancialWeeklyRow
+{
+  #keys: '5[415136.0.880700240][415136.0.880700238][0.0.0][415136.0.880700239][415136.0.880700241]'
+  BaseType: Object
+  Description: '璐㈠姟鍛ㄦ姤琛�'
+  StructuredName: 'FinancialWeeklyRows'
+}
diff --git a/_Main/BL/Type_InventorySummaryCell/Function_CalcAverageInventory.qbl b/_Main/BL/Type_InventorySummaryCell/Function_CalcAverageInventory.qbl
deleted file mode 100644
index 976add9..0000000
--- a/_Main/BL/Type_InventorySummaryCell/Function_CalcAverageInventory.qbl
+++ /dev/null
@@ -1,13 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Function CalcAverageInventory
-{
-  TextBody:
-  [*
-    // 鐢勫叞楦� Jul-1-2024 (created)
-    
-    value := average( this, ProductInStockingPointInPeriod, pispip, pispip.PlannedInventoryLevelEnd() );
-    
-    this.AverageInventory( value );
-  *]
-}
diff --git a/_Main/BL/Type_InventorySummaryCell/Function_CalcEndingInventory.qbl b/_Main/BL/Type_InventorySummaryCell/Function_CalcEndingInventory.qbl
deleted file mode 100644
index 7fcd1da..0000000
--- a/_Main/BL/Type_InventorySummaryCell/Function_CalcEndingInventory.qbl
+++ /dev/null
@@ -1,13 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Function CalcEndingInventory
-{
-  TextBody:
-  [*
-    // 鐢勫叞楦� Jul-1-2024 (created)
-    
-    value := maxobject( this, ProductInStockingPointInPeriod, pispip, pispip.Start() );
-    
-    this.EndingInventory( value.PlannedInventoryLevelEnd() );
-  *]
-}
diff --git a/_Main/BL/Type_InventorySummaryCell/Function_CalcMaximumInventory.qbl b/_Main/BL/Type_InventorySummaryCell/Function_CalcMaximumInventory.qbl
deleted file mode 100644
index db9ad44..0000000
--- a/_Main/BL/Type_InventorySummaryCell/Function_CalcMaximumInventory.qbl
+++ /dev/null
@@ -1,13 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Function CalcMaximumInventory
-{
-  TextBody:
-  [*
-    // 鐢勫叞楦� Jul-1-2024 (created)
-    
-    value := max( this, ProductInStockingPointInPeriod, pispip, pispip.PlannedInventoryLevelEnd() );
-    
-    this.MaximumInventory( value );
-  *]
-}
diff --git a/_Main/BL/Type_InventorySummaryCell/Function_CalcMinimumInventory.qbl b/_Main/BL/Type_InventorySummaryCell/Function_CalcMinimumInventory.qbl
deleted file mode 100644
index e730b7c..0000000
--- a/_Main/BL/Type_InventorySummaryCell/Function_CalcMinimumInventory.qbl
+++ /dev/null
@@ -1,13 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Function CalcMinimumInventory
-{
-  TextBody:
-  [*
-    // 鐢勫叞楦� Jul-1-2024 (created)
-    
-    value := min( this, ProductInStockingPointInPeriod, pispip, pispip.PlannedInventoryLevelEnd() );
-    
-    this.MinimumInventory( value );
-  *]
-}
diff --git a/_Main/BL/Type_InventorySummaryColumn/Attribute_Category.qbl b/_Main/BL/Type_InventorySummaryColumn/Attribute_TimeUnit.qbl
similarity index 89%
rename from _Main/BL/Type_InventorySummaryColumn/Attribute_Category.qbl
rename to _Main/BL/Type_InventorySummaryColumn/Attribute_TimeUnit.qbl
index 2674d93..9090596 100644
--- a/_Main/BL/Type_InventorySummaryColumn/Attribute_Category.qbl
+++ b/_Main/BL/Type_InventorySummaryColumn/Attribute_TimeUnit.qbl
@@ -1,6 +1,6 @@
 Quintiq file version 2.0
 #parent: #root
-Attribute Category
+Attribute TimeUnit
 {
   #keys: '3[415136.0.865101993][415136.0.865101992][415136.0.865101994]'
   Description: 'day;week;month'
diff --git a/_Main/BL/Type_InventorySummaryColumn/Method_GenerateCell.qbl b/_Main/BL/Type_InventorySummaryColumn/Method_GenerateCell.qbl
new file mode 100644
index 0000000..a85f1cd
--- /dev/null
+++ b/_Main/BL/Type_InventorySummaryColumn/Method_GenerateCell.qbl
@@ -0,0 +1,41 @@
+Quintiq file version 2.0
+#parent: #root
+Method GenerateCell (
+  InventoryPointSelections selections,
+  Strings ccstockingpointids,
+  Strings dlstockingpointids,
+  InventorySummaryReport table,
+  Date start,
+  Date end,
+  String productid,
+  String allunit,
+  String ccunit,
+  String dlunit
+)
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jul-3-2024 (created)
+    //All
+    alldetails := selectset( selections, Elements.InventoryInterfaceDataDetail, detail, detail.PartNumber() = productid and detail.Date() >= start and detail.Date() <= end );
+    if( alldetails.Size() > 0 ){
+      allrow     := table.GetRow( allunit, productid );
+      allvalue := sum( alldetails, Elements, e, e.Quantity() );
+      allrow.SetCellValue( this, allvalue );
+      //闀挎槬
+      ccdetails := selectset( alldetails, Elements, detail, ccstockingpointids.Find( detail.InventoryPointSelection().StockpoingPoint() ) >= 0 );
+      if( ccdetails.Size() > 0 ){
+        ccrow := table.GetRow( ccunit, productid );
+        value := sum( ccdetails, Elements, e, e.Quantity() );
+        ccrow.SetCellValue( this, value );
+      }
+      //澶ц繛
+      dldetails := selectset( alldetails, Elements, detail, dlstockingpointids.Find( detail.InventoryPointSelection().StockpoingPoint() ) >= 0 );
+      if( dldetails.Size() > 0 ){
+        dlrow := table.GetRow( dlunit, productid );
+        value := sum( dldetails, Elements, e, e.Quantity() );
+        dlrow.SetCellValue( this, value );
+      }
+    }
+  *]
+}
diff --git a/_Main/BL/Type_InventorySummaryReport/Method_Clear.qbl b/_Main/BL/Type_InventorySummaryReport/Method_Clear.qbl
index ec171dc..25d5339 100644
--- a/_Main/BL/Type_InventorySummaryReport/Method_Clear.qbl
+++ b/_Main/BL/Type_InventorySummaryReport/Method_Clear.qbl
@@ -1,6 +1,10 @@
 Quintiq file version 2.0
 #parent: #root
-Method Clear
+Method Clear (
+  String timeunit,
+  DateTime starttime,
+  DateTime endtime
+)
 {
   TextBody:
   [*
@@ -8,6 +12,6 @@
     this.InventorySummaryColumn( relflush );
     this.InventroySummaryRow( relflush );
     
-    this.GenerateColumn( this.InventorySummarySource().MacroPlan() );
+    this.GenerateColumn( this.InventorySummarySource().MacroPlan(), timeunit, starttime, endtime );
   *]
 }
diff --git a/_Main/BL/Type_InventorySummaryReport/Method_Generate.qbl b/_Main/BL/Type_InventorySummaryReport/Method_Generate.qbl
index 8fbefce..f2bc208 100644
--- a/_Main/BL/Type_InventorySummaryReport/Method_Generate.qbl
+++ b/_Main/BL/Type_InventorySummaryReport/Method_Generate.qbl
@@ -8,35 +8,40 @@
   TextBody:
   [*
     // 鐢勫叞楦� Jun-25-2024 (created)
-    table      := selectobject( this, InventorySummarySource.InventorySummaryReport, report, not report.IsShow() );
-    allunit    := '<All>';
-    //娓呯┖涔嬪墠瀛樺偍鐨勬樉绀烘暟鎹�
-    this.Clear();
-    //杩囨护鍚庣殑浜у搧id
-    productids := selectuniquevalues( products, Elements, product, ( search.Generation() = allunit or product.Generation() = search.Generation() )
-                                      and ( search.MqbMlb() = allunit or product.MQBMLB() = search.MqbMlb() )
-                                      and ( search.Power() = allunit or product.Power() = search.Power() ), product.ID() );
-    sumrow     := this.InventroySummaryRow( relnew, Name := 'SUM', Unit := search.Unit(), RowNr := table.InventroySummaryRow( relsize ) );
-    traverse( table, InventroySummaryRow, row, row.Unit() = search.Unit() ){
-      productid  := construct( Strings );
-      productid.Add( row.Name() );
-      
-      if( productids.ContainsAll( productid ) ){
-        showrow := this.InventroySummaryRow( relnew, Name := row.Name(), Unit := row.Unit(), RowNr := row.RowNr() );
+    startofplanning           := search.InventorySummarySource().MacroPlan().StartOfPlanning();
+    startofyear               := startofplanning.StartOfYear();
+    startofendyear            := startofplanning.StartOfNextYear() - Duration::Days( 1 );
+    //鏌ヨ鏃ユ湡杩斿洖闇�瑕佸湪璁″垝鏃ユ湡涔嬪唴
+    if( search.StartDate().DateTime() < startofendyear and search.EndDate().DateTime() > startofyear ){
+      table      := selectobject( this, InventorySummarySource.InventorySummaryReport, report, not report.IsShow() );
+      allunit    := '<All>';
+      //娓呯┖涔嬪墠瀛樺偍鐨勬樉绀烘暟鎹�
+      this.Clear( search.Category(), search.StartDate().DateTime(), search.EndDate().DateTime() );
+      //杩囨护鍚庣殑浜у搧id
+      productids := selectuniquevalues( products, Elements, product, ( search.Generation() = allunit or product.Generation() = search.Generation() )
+                                        and ( search.MqbMlb() = allunit or product.MQBMLB() = search.MqbMlb() )
+                                        and ( search.Power() = allunit or product.Power() = search.Power() ), product.ID() );
+      sumrow     := this.InventroySummaryRow( relnew, Name := 'SUM', Unit := search.Unit(), RowNr := table.InventroySummaryRow( relsize ) );
+      sumrow.InitializeCell( this );
+      traverse( table, InventroySummaryRow, row, row.Unit() = search.Unit() ){
+        productid  := construct( Strings );
+        productid.Add( row.Name() );
         
-        traverse( row, InventorySummaryCell, cell ){
-    //      column   := selectobject( this, InventorySummaryColumn, column, column.Name() = cell.InventorySummaryColumn().Name() );
-    //      
-    //      sumcell  := selectobject( column, InventorySummaryCell, c, c.InventroySummaryRow() = sumrow );
-    //      if( isnull( sumcell ) ){
-    //        sumcell := column.InventorySummaryCell( relnew, Value := '0' );
-    //        sumrow.InventorySummaryCell( relinsert, sumcell );
-    //      }
-    //      
-    //      showcell := column.InventorySummaryCell( relnew, Value := cell.Value() );
-    //      showrow.InventorySummaryCell( relinsert, showcell );
-    //      value := [Real]cell.Value() + [Real]sumcell.Value();
-    //      sumcell.Value( [String]value );
+        if( productids.ContainsAll( productid ) ){
+          showrow := this.InventroySummaryRow( relnew, Name := row.Name(), Unit := row.Unit(), RowNr := row.RowNr() );
+          
+          traverse( row, InventorySummaryCell, cell, cell.InventorySummaryColumn().TimeUnit() = search.Category() ){
+            column   := selectobject( this, InventorySummaryColumn, column, column.Name() = cell.InventorySummaryColumn().Name() );
+            
+            sumcell  := selectobject( column, InventorySummaryCell, c, c.InventroySummaryRow() = sumrow );
+            
+            showcell := column.InventorySummaryCell( relnew, EndingInventory := cell.EndingInventory(), MinimumInventory := cell.MinimumInventory(), MaximumInventory := cell.MaximumInventory(), AverageInventory := cell.AverageInventory() );
+            showrow.InventorySummaryCell( relinsert, showcell );
+            sumcell.EndingInventory( sumcell.EndingInventory() + cell.EndingInventory() );
+            sumcell.MinimumInventory( sumcell.MinimumInventory() + cell.MinimumInventory() );
+            sumcell.MaximumInventory( sumcell.MaximumInventory() + cell.MaximumInventory() );
+            sumcell.AverageInventory( sumcell.AverageInventory() + cell.AverageInventory() );
+          }
         }
       }
     }
diff --git a/_Main/BL/Type_InventorySummaryReport/Method_GenerateColumn.qbl b/_Main/BL/Type_InventorySummaryReport/Method_GenerateColumn.qbl
index bce7074..1b7156e 100644
--- a/_Main/BL/Type_InventorySummaryReport/Method_GenerateColumn.qbl
+++ b/_Main/BL/Type_InventorySummaryReport/Method_GenerateColumn.qbl
@@ -1,7 +1,10 @@
 Quintiq file version 2.0
 #parent: #root
 Method GenerateColumn (
-  MacroPlan owner
+  MacroPlan owner,
+  String timeunit,
+  DateTime starttime,
+  DateTime endtime
 )
 {
   TextBody:
@@ -9,12 +12,37 @@
     // 鐢勫叞楦� Jun-25-2024 (created)
     startofplanning           := owner.StartOfPlanning();
     startofyear               := startofplanning.StartOfYear();
-    startofnextyear           := startofplanning.StartOfNextYear();
-    
-    for( start := startofyear; start < startofnextyear; start := start.StartOfNextMonth() ){
+    startofendyear            := startofplanning.StartOfNextYear() - Duration::Days( 1 );
+    //鏌ヨ鏃ユ湡杩斿洖闇�瑕佸湪璁″垝鏃ユ湡涔嬪唴
+    if( starttime < startofendyear and endtime > startofyear ){
+      if( starttime < startofyear ){
+        starttime := startofyear;
+      }
+      if( endtime > startofendyear ){
+        endtime := startofendyear;
+      }
+    for( start := starttime; start <= endtime; start := start.StartOfNextDay() ){
       periodtime := start.Date();
       periodname := periodtime.Format( "M2/D2/Y" );
-      this.InventorySummaryColumn( relnew, Name := periodname, Period := periodtime );
+      
+      if( timeunit = 'All' or timeunit = Translations::MP_GlobalParameters_Day() ){
+        this.InventorySummaryColumn( relnew, Name := periodname, Period := periodtime, TimeUnit := Translations::MP_GlobalParameters_Day() );
+      }
+      if( timeunit = 'All' or timeunit = Translations::MP_GlobalParameters_Week() ){
+        weekend := ( start.StartOfNextWeek() - Duration::Days( 1 ) ).Date();
+        
+        if( periodtime = weekend ){
+          this.InventorySummaryColumn( relnew, Name := periodname, Period := periodtime, TimeUnit := Translations::MP_GlobalParameters_Week() );
+        }
+      }
+      if( timeunit = 'All' or timeunit = Translations::MP_GlobalParameters_Month() ){
+        monthend := ( start.StartOfNextMonth() - Duration::Days( 1 ) ).Date();
+        
+        if( periodtime = monthend ){
+          this.InventorySummaryColumn( relnew, Name := periodname, Period := periodtime, TimeUnit := Translations::MP_GlobalParameters_Month() );
+        }
+      }
+    }
     }
   *]
 }
diff --git a/_Main/BL/Type_InventorySummaryReport/Method_GetRow.qbl b/_Main/BL/Type_InventorySummaryReport/Method_GetRow.qbl
index c11af49..7fc4aeb 100644
--- a/_Main/BL/Type_InventorySummaryReport/Method_GetRow.qbl
+++ b/_Main/BL/Type_InventorySummaryReport/Method_GetRow.qbl
@@ -2,9 +2,7 @@
 #parent: #root
 Method GetRow (
   String unit,
-  String product,
-  DateTime startdate,
-  DateTime enddate
+  String product
 ) as InventroySummaryRow
 {
   TextBody:
@@ -15,7 +13,7 @@
     if( isnull( row ) ){
       row := this.InventroySummaryRow( relnew, Name := product, Unit := unit );
       //鍒濆鍖栧崟鍏冩牸
-      row.InitializeCell( this, startdate, enddate );
+      row.InitializeCell( this );
     }
     
     return row;
diff --git a/_Main/BL/Type_InventorySummaryReport/StaticMethod_GetDefaultCCUnit.qbl b/_Main/BL/Type_InventorySummaryReport/StaticMethod_GetDefaultCCUnit.qbl
index 6b92234..739a84b 100644
--- a/_Main/BL/Type_InventorySummaryReport/StaticMethod_GetDefaultCCUnit.qbl
+++ b/_Main/BL/Type_InventorySummaryReport/StaticMethod_GetDefaultCCUnit.qbl
@@ -6,6 +6,6 @@
   [*
     // 鐢勫叞楦� Jun-28-2024 (created)
     return '闀挎槬';
-    //return 'China';
+    //return 'Assembly Plant (France)';
   *]
 }
diff --git a/_Main/BL/Type_InventorySummaryReport/StaticMethod_GetDefaultDLUnit.qbl b/_Main/BL/Type_InventorySummaryReport/StaticMethod_GetDefaultDLUnit.qbl
index f21ff7d..d544c74 100644
--- a/_Main/BL/Type_InventorySummaryReport/StaticMethod_GetDefaultDLUnit.qbl
+++ b/_Main/BL/Type_InventorySummaryReport/StaticMethod_GetDefaultDLUnit.qbl
@@ -6,6 +6,6 @@
   [*
     // 鐢勫叞楦� Jun-28-2024 (created)
     return '澶ц繛';
-    //return 'Foregin';
+    //return 'Assembly Plant (Spain)';
   *]
 }
diff --git a/_Main/BL/Type_InventorySummarySource/StaticMethod_Download.qbl b/_Main/BL/Type_InventorySummarySource/StaticMethod_Download.qbl
index 6fe5b7f..2f2dbb5 100644
--- a/_Main/BL/Type_InventorySummarySource/StaticMethod_Download.qbl
+++ b/_Main/BL/Type_InventorySummarySource/StaticMethod_Download.qbl
@@ -8,7 +8,7 @@
   TextBody:
   [*
     
-    table := selectobject( macroPlan, FinancialSalesSource.FinancialSalesReport, table, not table.IsImport() and table.IsShow() );
+    table := selectobject( macroPlan, InventorySummarySource.InventorySummaryReport, table, table.IsShow() );
     
     xmlDOMI := XMLDOMImplementation::Create();
     xmlDOM  := xmlDOMI.CreateDocumentFromString( '<?xml version="1.0" encoding="UTF-16"?><table><name>' + table.Name() + '</name></table>' );
@@ -30,10 +30,19 @@
     unittypeelement.TextContent( "String" );
     unitcolumnelement.AppendChild( unitnameelement );
     unitcolumnelement.AppendChild( unittypeelement );
+    //Attribute
+    attricolumnelement := xmlDOM.CreateElement( "column" );
+    attrinameelement   := xmlDOM.CreateElement( "name" );
+    attritypeelement   := xmlDOM.CreateElement( "type" );
+    attrinameelement.TextContent( 'Attribute' );
+    attritypeelement.TextContent( "String" );
+    attricolumnelement.AppendChild( attrinameelement );
+    attricolumnelement.AppendChild( attritypeelement );
     
     tableElement.AppendChild( productcolumnelement ); 
     tableElement.AppendChild( unitcolumnelement ); 
-    traverse ( table, FinancialSalesColumn, column ) {
+    tableElement.AppendChild( attricolumnelement );
+    traverse ( table, InventorySummaryColumn, column ) {
       columnelement := xmlDOM.CreateElement( "column" );
       nameelement   := xmlDOM.CreateElement( "name" );
       typeelement   := xmlDOM.CreateElement( "type" );
@@ -42,23 +51,71 @@
       columnelement.AppendChild( nameelement );
       columnelement.AppendChild( typeelement );
       
-      cells := selectsortedset( column, FinancialSalesCell, cell, cell.FinancialSalesRow().RowNr() );
+      cells := selectsortedset( column, InventorySummaryCell, cell, cell.InventroySummaryRow().RowNr() );
     
       traverse ( cells, Elements, c ) {
         if( column.Index() = 0 ){
-          row := c.FinancialSalesRow();
+          row := c.InventroySummaryRow();
           //Product
-          productcellElement := xmlDOM.CreateElement( "cell" );
-          productcellElement.SetAttribute( "value", row.Name() );
-          productcolumnelement.AppendChild( productcellElement );
+          productcellElement1 := xmlDOM.CreateElement( "cell" );
+          productcellElement1.SetAttribute( "value", row.Name() );
+          productcolumnelement.AppendChild( productcellElement1 );
+          productcellElement2 := xmlDOM.CreateElement( "cell" );
+          productcellElement2.SetAttribute( "value", row.Name() );
+          productcolumnelement.AppendChild( productcellElement2 );
+          productcellElement3 := xmlDOM.CreateElement( "cell" );
+          productcellElement3.SetAttribute( "value", row.Name() );
+          productcolumnelement.AppendChild( productcellElement3 );
+          productcellElement4 := xmlDOM.CreateElement( "cell" );
+          productcellElement4.SetAttribute( "value", row.Name() );
+          productcolumnelement.AppendChild( productcellElement4 );
           //Unit
-          unitcellElement := xmlDOM.CreateElement( "cell" );
-          unitcellElement.SetAttribute( "value", row.Unit() );
-          unitcolumnelement.AppendChild( unitcellElement );
+          unitcellElement1 := xmlDOM.CreateElement( "cell" );
+          unitcellElement1.SetAttribute( "value", row.Unit() );
+          unitcolumnelement.AppendChild( unitcellElement1 );
+          unitcellElement2 := xmlDOM.CreateElement( "cell" );
+          unitcellElement2.SetAttribute( "value", row.Unit() );
+          unitcolumnelement.AppendChild( unitcellElement2 );
+          unitcellElement3 := xmlDOM.CreateElement( "cell" );
+          unitcellElement3.SetAttribute( "value", row.Unit() );
+          unitcolumnelement.AppendChild( unitcellElement3 );
+          unitcellElement4 := xmlDOM.CreateElement( "cell" );
+          unitcellElement4.SetAttribute( "value", row.Unit() );
+          unitcolumnelement.AppendChild( unitcellElement4 );
+          //Attribute
+          //鏈熸湯搴撳瓨
+          endcellElement := xmlDOM.CreateElement( "cell" );
+          endcellElement.SetAttribute( "value", 'EndingInventory' );
+          attricolumnelement.AppendChild( endcellElement );
+          //鏈�灏忓簱瀛�
+          mincellElement := xmlDOM.CreateElement( "cell" );
+          mincellElement.SetAttribute( "value", 'MinimumInventory' );
+          attricolumnelement.AppendChild( mincellElement );
+          //鏈�澶у簱瀛�
+          maxcellElement := xmlDOM.CreateElement( "cell" );
+          maxcellElement.SetAttribute( "value", 'MaximumInventory' );
+          attricolumnelement.AppendChild( maxcellElement );
+          //骞冲潎搴撳瓨
+          avecellElement := xmlDOM.CreateElement( "cell" );
+          avecellElement.SetAttribute( "value", 'AverageInventory' );
+          attricolumnelement.AppendChild( avecellElement );
         }
-        cellElement := xmlDOM.CreateElement( "cell" );
-        cellElement.SetAttribute( "value", c.Value() ); 
-        columnelement.AppendChild( cellElement );
+        //鏈熸湯搴撳瓨
+        endcellElement := xmlDOM.CreateElement( "cell" );
+        endcellElement.SetAttribute( "value", [String]c.EndingInventory() );
+        columnelement.AppendChild( endcellElement );
+        //鏈�灏忓簱瀛�
+        mincellElement := xmlDOM.CreateElement( "cell" );
+        mincellElement.SetAttribute( "value", [String]c.MinimumInventory() );
+        columnelement.AppendChild( mincellElement );
+        //鏈�澶у簱瀛�
+        maxcellElement := xmlDOM.CreateElement( "cell" );
+        maxcellElement.SetAttribute( "value", [String]c.MaximumInventory() );
+        columnelement.AppendChild( maxcellElement );
+        //骞冲潎搴撳瓨
+        avecellElement := xmlDOM.CreateElement( "cell" );
+        avecellElement.SetAttribute( "value", [String]c.AverageInventory() );
+        columnelement.AppendChild( avecellElement );
       }
       tableElement.AppendChild( columnelement );  
     }
@@ -67,7 +124,7 @@
     
     //info( xmlString );
     
-    tableGroupHandle := TableGroupHandle::Create( FinancialSalesReport::GetDefaultName() );
+    tableGroupHandle := TableGroupHandle::Create( InventorySummaryReport::GetDefaultName() );
     tableHandle      := TableHandle::ImportXML( BinaryValue::Construct( xmlString ) );
     tableGroupHandle.Add( tableHandle );
     
diff --git a/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl b/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
index 6ed8f07..455d0bc 100644
--- a/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_InventorySummarySource/StaticMethod_Initialize.qbl
@@ -1,7 +1,8 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod Initialize (
-  MacroPlan owner
+  MacroPlan owner,
+  InterfaceDataset interface
 )
 {
   Description: '鍒濆鍖�'
@@ -23,25 +24,106 @@
     
     search                    := source.InventorySummarySearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit, StartDate := Date::MinDate(), EndDate := Date::MaxDate() );
     
-    table.GenerateColumn( owner );
-    
-    //浠嶱roduct planning鏌ユ壘搴撳瓨鐐逛负闀挎槬瑁呴厤绾胯竟搴撶殑鎵�鏈塎QB浜у搧锛屽彇Total Demand瀛楁鎸夋湀姹囨�婚渶姹傛暟閲�
+    table.GenerateColumn( owner, 'All', startofyear, startofnextyear );
+    //info( '-----------------------------------', table.InventorySummaryColumn( relsize ) );
+    //搴撳瓨鏁伴噺涓篈ctual inventories閲岄潰鐨勭偣Planned inventories瀛楁搴撳瓨閲忓姞鎬�
     traverse( owner, Product_MP.ProductInStockingPoint_MP, pisp, pisp.IsLeaf() and not pisp.IsSystem() and ( pisp.StockingPoint_MP().UnitID() = ccunit or pisp.StockingPoint_MP().UnitID() = dlunit ) ){
       unit := pisp.StockingPoint_MP().UnitID();
       product := pisp.Product_MP();
-        traverse( pisp, ProductInStockingPointInPeriod, pispip, pispip.Start() >= startofplanning
-                and pispip.Start() < startofnextyear and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Month() ){
-          periodtime := pispip.Start().StartOfMonth().Date();
-          periodname := periodtime.Format( "M2/D2/Y" );
-          column    := selectobject( table, InventorySummaryColumn, column, column.Name() = periodname and column.Period() = periodtime );
-          ccrow := table.GetRow( ccunit, product.ID(), startofyear, startofnextyear );
-          ccrow.Initialize( column, pispip );//鍙朤otal Demand瀛楁鎸夋湀姹囨�婚渶姹傛暟閲�
+    //  info( '-----------------------------------', unit, product.ID() );
+      weekpispips := construct( ProductInStockingPointInPeriods );
+      monthpispips := construct( ProductInStockingPointInPeriods );
+      nextweek := startofplanning.StartOfNextWeek();
+      nextmonth := startofplanning.StartOfNextMonth();
+      
+      unitrow := table.GetRow( unit, product.ID() );
+      allrow     := table.GetRow( allunit, product.ID() );
+      pispips := selectsortedset( pisp, ProductInStockingPointInPeriod, pispip, pispip.Start() >= startofplanning and pispip.Start() < startofnextyear and pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day(), pispip.Start() );
+    //  info( '-----------------------------------', isnull( allrow ), pispips.Size() );
+      traverse( pispips, Elements, pispip, pispip.Start() = startofplanning ){
+    //    info( '-----------------------------------', pispip.Start() );
+        period     := pispip.Period_MP();
+        periodtime := period.Start().Date();
+        periodname := periodtime.Format( "M2/D2/Y" );
+        //澶╋紝閫夋嫨鏃ラ绮掑害鏃讹紝鏈熸湯搴撳瓨锛屾渶灏忓簱瀛橈紝鏈�澶у簱瀛樺拰骞冲潎搴撳瓨鐨勬暟鍊间繚鎸佷竴鑷�
+        daycolumn := selectobject( table, InventorySummaryColumn, column, column.Name() = periodname, column.Period() = periodtime, column.TimeUnit() = Translations::MP_GlobalParameters_Day() );
+        info( daycolumn.Name(), daycolumn.Period(), daycolumn.TimeUnit() );
+        unitrow.SetCellValue( daycolumn, pispip.PlannedInventoryLevelEnd() );
+        allrow.SetCellValue( daycolumn, pispip.PlannedInventoryLevelEnd() );
+        
+        //鍛紝閫夋嫨鍛ㄦ椂锛屾湡鏈簱瀛樹负姣忎竴鍛ㄦ渶鍚庝竴澶╃殑姹囨�诲簱瀛樹俊鎭紝鏈�灏忓簱瀛樹负杩欎竴鍛ㄥ簱瀛橀噺鏈�灏忕殑涓�澶╃殑鏁板�硷紝鏈�澶у簱瀛樹负杩欎竴鍛ㄥ簱瀛橀噺鏈�澶х殑涓�澶╃殑鏁板�硷紝骞冲潎搴撳瓨涓鸿鍛ㄧ殑骞冲潎鍊�
+        if( period.Start() < nextweek ){
+          weekpispips.Add( pispip );
           
-          allrow     := table.GetRow( allunit, product.ID(), startofyear, startofnextyear );
-          allrow.Initialize( column, pispip );
+          weekend := nextweek - Duration::Days( 1 );
+          if( period.Start() = weekend ){
+            weekcolumn := selectobject( table, InventorySummaryColumn, column, column.Name() = periodname, column.Period() = periodtime, column.TimeUnit() = Translations::MP_GlobalParameters_Week() );
+            
+            maxinventory := max( weekpispips, Elements, e, e.PlannedInventoryLevelEnd() );
+            mininventory := min( weekpispips, Elements, e, e.PlannedInventoryLevelEnd() );
+            aveinventory := average( weekpispips, Elements, e, e.PlannedInventoryLevelEnd() );
+            unitrow.SetCellValue( weekcolumn, pispip.PlannedInventoryLevelEnd(), mininventory, maxinventory, aveinventory );
+            allrow.SetCellValue( weekcolumn, pispip.PlannedInventoryLevelEnd(), mininventory, maxinventory, aveinventory );
+          }
+        }else{
+          weekpispips.Flush();
+          weekpispips.Add( pispip );
+          nextweek := nextweek.StartOfNextWeek();
         }
+        
+        //鏈堬紝閫夋嫨鏈堟椂锛屾湡鏈簱瀛樹负姣忎竴鏈堟渶鍚庝竴澶╃殑姹囨�诲簱瀛樹俊鎭紝鏈�灏忓簱瀛樹负杩欎竴涓湀搴撳瓨閲忔渶灏忕殑涓�澶╃殑鏁板�硷紝鏈�澶у簱瀛樹负杩欎竴涓湀搴撳瓨閲忔渶澶х殑涓�澶╃殑鏁板�硷紝骞冲潎搴撳瓨涓鸿鏈堢殑骞冲潎鍊�
+        if( period.Start() < nextmonth ){
+          monthpispips.Add( pispip );
+          
+          monthend := nextmonth - Duration::Days( 1 );
+          if( period.Start() = monthend ){
+            monthcolumn := selectobject( table, InventorySummaryColumn, column, column.Name() = periodname, column.Period() = periodtime, column.TimeUnit() = Translations::MP_GlobalParameters_Month() );
+            
+            maxinventory := max( monthpispips, Elements, e, e.PlannedInventoryLevelEnd() );
+            mininventory := min( monthpispips, Elements, e, e.PlannedInventoryLevelEnd() );
+            aveinventory := average( monthpispips, Elements, e, e.PlannedInventoryLevelEnd() );
+            unitrow.SetCellValue( monthcolumn, pispip.PlannedInventoryLevelEnd(), mininventory, maxinventory, aveinventory );
+            allrow.SetCellValue( monthcolumn, pispip.PlannedInventoryLevelEnd(), mininventory, maxinventory, aveinventory );
+          }
+        }else{
+          monthpispips.Flush();
+          monthpispips.Add( pispip );
+          nextmonth := nextmonth.StartOfNextMonth();
+        }
+      }
     }
-    
+    //棣栧厛鍦‥ntities閲岃瘑鍒埗绾nit涓洪暱鏄�/澶ц繛鐨勬墍鏈夊簱瀛樼偣
+    //闀挎槬搴撳瓨鐐�
+    ccsps := construct( Strings );
+    //澶ц繛搴撳瓨鐐�
+    dlsps := construct( Strings );
+    allsps := construct( Strings );
+    traverse( owner, Unit, unit, unit.ID() = ccunit or unit.ID() = dlunit ){
+      if( unit.ID() = ccunit ){
+        ccsps := selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() );
+      }
+      if( unit.ID() = dlunit ){
+        dlsps := selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() );
+      }
+      allsps := allsps.Union( selectuniquevalues( unit, StockingPoint_MP, sp, sp.ID() ) );
+    }
+    //鍐嶅湪搴撳瓨鏇存柊鐨勫瓙鐣岄潰搴撳瓨鐐归�夋嫨涓壘鍒拌繖浜涘簱瀛樼偣鎵�鍏宠仈鐨勫凡鍕鹃�夊簱浣�
+    selections := selectset( interface, InventoryPointSelection, selection, allsps.Find( selection.StockpoingPoint() ) >= 0 and selection.IsIncluded() );
+    productids := selectuniquevalues( selections, Elements, selection, selection.ProductID() );
+    //鏈�鍚庡皢杩欎簺搴撲綅涓浂浠跺彿鐨勬暟閲忚繘琛屽姞鎬�
+    traverse( table, InventorySummaryColumn, column, column.Period() < startofplanning.Date() ){
+      traverse( productids, Elements, productid ){
+        if( column.TimeUnit() = Translations::MP_GlobalParameters_Day() ){//澶�
+          column.GenerateCell( selections, ccsps, dlsps, table, column.Period(), column.Period(), productid, allunit, ccunit, dlunit );
+        }else if( column.TimeUnit() = Translations::MP_GlobalParameters_Week() ){//鍛�
+          column.GenerateCell( selections, ccsps, dlsps, table, column.Period().StartOfWeek(), column.Period(), productid, allunit, ccunit, dlunit );
+        }else if( column.TimeUnit() = Translations::MP_GlobalParameters_Month() ){//鏈�
+          column.GenerateCell( selections, ccsps, dlsps, table, column.Period().StartOfMonth(), column.Period(), productid, allunit, ccunit, dlunit );
+        }
+      }
+    }
+      
+        
     rows := selectsortedset( table, InventroySummaryRow, row, row.Name() );
     i    := 0;
     traverse( rows, Elements, e ){
diff --git "a/_Main/BL/Type_InventroySummaryRow/Method_Initialize\0430.qbl" "b/_Main/BL/Type_InventroySummaryRow/Method_Initialize\0430.qbl"
deleted file mode 100644
index ec79cf4..0000000
--- "a/_Main/BL/Type_InventroySummaryRow/Method_Initialize\0430.qbl"
+++ /dev/null
@@ -1,15 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Method Initialize (
-  InventorySummaryColumn column,
-  ProductInStockingPointInPeriod pispip
-)
-{
-  TextBody:
-  [*
-    // 鐢勫叞楦� Jun-24-2024 (created)
-    cell := selectobject( this, InventorySummaryCell, cell, cell.InventorySummaryColumn() = column );
-    
-    cell.ProductInStockingPointInPeriod( relinsert, pispip );
-  *]
-}
diff --git a/_Main/BL/Type_InventroySummaryRow/Method_Initialize.qbl b/_Main/BL/Type_InventroySummaryRow/Method_Initialize.qbl
index fbffb32..4adcb27 100644
--- a/_Main/BL/Type_InventroySummaryRow/Method_Initialize.qbl
+++ b/_Main/BL/Type_InventroySummaryRow/Method_Initialize.qbl
@@ -8,7 +8,7 @@
   TextBody:
   [*
     // 鐢勫叞楦� Jun-24-2024 (created)
-    cell := column.InventorySummaryCell( relnew );
+    cell := column.InventorySummaryCell( relnew, AverageInventory := 0, EndingInventory := 0, MaximumInventory := 0, MinimumInventory := 0 );
     
     this.InventorySummaryCell( relinsert, cell );
   *]
diff --git a/_Main/BL/Type_InventroySummaryRow/Method_InitializeCell.qbl b/_Main/BL/Type_InventroySummaryRow/Method_InitializeCell.qbl
index a619b37..46259bb 100644
--- a/_Main/BL/Type_InventroySummaryRow/Method_InitializeCell.qbl
+++ b/_Main/BL/Type_InventroySummaryRow/Method_InitializeCell.qbl
@@ -1,19 +1,13 @@
 Quintiq file version 2.0
 #parent: #root
 Method InitializeCell (
-  InventorySummaryReport table,
-  DateTime startdate,
-  DateTime enddate
+  InventorySummaryReport table
 )
 {
   TextBody:
   [*
     // 鐢勫叞楦� Jun-28-2024 (created)
-    for( start := startdate; start < enddate; start := start.StartOfNextMonth() ){
-      periodtime := start.Date();
-      periodname := periodtime.Format( "M2/D2/Y" );
-      column := selectobject( table, InventorySummaryColumn, column, column.Name() = periodname and column.Period() = periodtime );
-    
+    traverse( table, InventorySummaryColumn, column ){
       this.Initialize( column, this.Unit() );
     }
   *]
diff --git "a/_Main/BL/Type_InventroySummaryRow/Method_SetCellValue\0430.qbl" "b/_Main/BL/Type_InventroySummaryRow/Method_SetCellValue\0430.qbl"
new file mode 100644
index 0000000..20f91c4
--- /dev/null
+++ "b/_Main/BL/Type_InventroySummaryRow/Method_SetCellValue\0430.qbl"
@@ -0,0 +1,18 @@
+Quintiq file version 2.0
+#parent: #root
+Method SetCellValue (
+  InventorySummaryColumn column,
+  Real quantity
+)
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jun-24-2024 (created)
+    cell := selectobject( this, InventorySummaryCell, cell, cell.InventorySummaryColumn() = column );
+    
+    cell.AverageInventory( cell.AverageInventory() + quantity );
+    cell.EndingInventory( cell.EndingInventory() + quantity );
+    cell.MaximumInventory( cell.MaximumInventory() + quantity );
+    cell.MinimumInventory( cell.MinimumInventory() + quantity );
+  *]
+}
diff --git a/_Main/BL/Type_InventroySummaryRow/Method_SetCellValue0.qbl b/_Main/BL/Type_InventroySummaryRow/Method_SetCellValue0.qbl
new file mode 100644
index 0000000..7f6b3b2
--- /dev/null
+++ b/_Main/BL/Type_InventroySummaryRow/Method_SetCellValue0.qbl
@@ -0,0 +1,21 @@
+Quintiq file version 2.0
+#parent: #root
+Method SetCellValue (
+  InventorySummaryColumn column,
+  Real endinginventory,
+  Real minimuminventory,
+  Real maximuminventory,
+  Real averageinventory
+)
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jun-24-2024 (created)
+    cell := selectobject( this, InventorySummaryCell, cell, cell.InventorySummaryColumn() = column );
+    
+    cell.AverageInventory( cell.AverageInventory() + averageinventory );
+    cell.EndingInventory( cell.EndingInventory() + endinginventory );
+    cell.MaximumInventory( cell.MaximumInventory() + maximuminventory );
+    cell.MinimumInventory( cell.MinimumInventory() + minimuminventory );
+  *]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_ActionBarGroupReport.def b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_ActionBarGroupReport.def
index 68f5a8f..ab55c75 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_ActionBarGroupReport.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Component_ActionBarGroupReport.def
@@ -38,6 +38,17 @@
         Taborder: 2
       ]
     }
+    Component ButtonFinancialWeeklyReport
+    {
+      #keys: '[415136.0.882254645]'
+      BaseType: 'WebButton'
+      Properties:
+      [
+        Image: 'DOCUMENT_DIRTY'
+        Label: 'Financial weekly report'
+        Taborder: 3
+      ]
+    }
   ]
   Properties:
   [
diff --git a/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_MacroPlanner_ActionBarGroupReport_ButtonFinancialWeeklyReport_OnCli.def b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_MacroPlanner_ActionBarGroupReport_ButtonFinancialWeeklyReport_OnCli.def
new file mode 100644
index 0000000..980aac3
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_ApplicationMacroPlanner/Response_MacroPlanner_ActionBarGroupReport_ButtonFinancialWeeklyReport_OnCli.def
@@ -0,0 +1,16 @@
+Quintiq file version 2.0
+#parent: ActionBarGroupReport/ButtonFinancialWeeklyReport
+Response OnClick () id:Response_MacroPlanner_ActionBarGroupReport_ButtonFinancialWeeklyReport_OnClick
+{
+  #keys: '[415136.0.882254805]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  QuillAction
+  {
+    Body:
+    [*
+      ApplicationScope.ViewManager().ResetUserViewById( "Financial_weekly_report_view", true);
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_OnCreated.def
index 62f7985..d90dc62 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_OnCreated.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_OnCreated.def
@@ -10,12 +10,12 @@
     Body:
     [*
       //鍒濆鍖�
-      if( not exists( MacroPlan, FinancialProductionSource, source, not source.IsImport() ) ){
+      //if( not exists( MacroPlan, FinancialProductionSource, source, not source.IsImport() ) ){
         FinancialProductionSource::Initialize( MacroPlan );
-      }
+      //}
       //info( '------------------1----------------' );
       table := selectobject( MacroPlan, FinancialProductionSource.FinancialProductionReport, table, not table.IsImport() and table.IsShow() );
-      info( '------------------2----------------', table.IsImport(), table.IsShow() );
+      //info( '------------------2----------------', table.IsImport(), table.IsShow() );
       DataHolderTable.Data( table );
       
       dhSearch.Data( table.FinancialProductionSource().FinancialProductionSearch() );
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_OnCreated.def
index 533640c..68f009c 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_OnCreated.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_OnCreated.def
@@ -9,12 +9,12 @@
   {
     Body:
     [*
-      if( not exists( MacroPlan, FinancialSalesSource, source, not source.IsImport() ) ){
+      //if( not exists( MacroPlan, FinancialSalesSource, source, not source.IsImport() ) ){
         FinancialSalesSource::Initialize( MacroPlan );
-      }
+      //}
       //info( '------------------1----------------' );
       table := selectobject( MacroPlan, FinancialSalesSource.FinancialSalesReport, table, not table.IsImport() and table.IsShow() );
-      info( '------------------2----------------', table.IsImport(), table.IsShow() );
+      //info( '------------------2----------------', table.IsImport(), table.IsShow() );
       DataHolderTable.Data( table );
       
       dhSearch.Data( table.FinancialSalesSource().FinancialSalesSearch() );
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelUnit_715_ddslUnit_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelUnit_715_ddslUnit_OnCreated.def
index 5a4d8e6..5424b65 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelUnit_715_ddslUnit_OnCreated.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialSalesReport/Response_PanelUnit_715_ddslUnit_OnCreated.def
@@ -10,7 +10,7 @@
     Body:
     [*
       
-      valueString := "<All>;" + FinancialProductionReport::GetDefaultCCUnit() + ";" + FinancialProductionReport::GetDefaultDLUnit();
+      valueString := "<All>;" + FinancialSalesReport::GetSalesSegmentCC() + ";" + FinancialSalesReport::GetSalesSegmentDL();
       
       this.Strings( valueString );
     *]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_MatrixEditorTable.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_MatrixEditorTable.def
new file mode 100644
index 0000000..4b02630
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_MatrixEditorTable.def
@@ -0,0 +1,97 @@
+Quintiq file version 2.0
+Component MatrixEditorTable
+{
+  #keys: '[415136.0.881011903]'
+  BaseType: 'WebMatrixEditor'
+  Children:
+  [
+    Component MatrixEditorCellTable
+    {
+      #keys: '[415136.0.881011904]'
+      BaseType: 'WebMatrixEditorCell'
+      Children:
+      [
+        Component DataExtractorTable
+        {
+          #keys: '[415136.0.881011905]'
+          BaseType: 'WebDataExtractor'
+          Properties:
+          [
+            DataType: 'MacroPlan'
+            Source: 'MacroPlan'
+            Taborder: 0
+            Transformation: 'FinancialWeeklyReport.FinancialWeeklyColumn.FinancialWeeklyCell'
+          ]
+        }
+      ]
+      Properties:
+      [
+        Attributes: 'Value'
+        Column: 'FinancialWeeklyColumn'
+        Row: 'FinancialWeeklyRow'
+        Taborder: 0
+      ]
+    }
+    Component MatrixEditorRowsTable
+    {
+      #keys: '[415136.0.881011908]'
+      BaseType: 'WebMatrixEditorHeaderLevel'
+      Children:
+      [
+        Component DataExtractorRow
+        {
+          #keys: '[415136.0.881011909]'
+          BaseType: 'WebDataExtractor'
+          Properties:
+          [
+            DataType: 'MacroPlan'
+            Source: 'MacroPlan'
+            Taborder: 0
+            Transformation: 'FinancialWeeklyReport.FinancialWeeklyRow'
+          ]
+        }
+      ]
+      Properties:
+      [
+        Legend: 'Name'
+        SortCriteria: 'RowNr'
+        Taborder: 1
+      ]
+    }
+    Component MatrixEditorColumnsTable
+    {
+      #keys: '[415136.0.881011912]'
+      BaseType: 'WebMatrixEditorHeaderLevel'
+      Children:
+      [
+        Component DataExtractorColumn
+        {
+          #keys: '[415136.0.881011913]'
+          BaseType: 'WebDataExtractor'
+          Properties:
+          [
+            DataType: 'MacroPlan'
+            Source: 'MacroPlan'
+            Taborder: 0
+            Transformation: 'FinancialWeeklyReport.FinancialWeeklyColumn'
+          ]
+        }
+      ]
+      Properties:
+      [
+        Legend: 'Name'
+        SortCriteria: 'Index'
+        Taborder: 2
+      ]
+    }
+    #child: matrixEditorActionBarPageTable
+    #child: matrixeditorContextMenuTable
+  ]
+  Properties:
+  [
+    Columns: 'MatrixEditorColumnsTable'
+    ContextMenu: 'matrixeditorContextMenuTable'
+    Rows: 'MatrixEditorRowsTable'
+    Taborder: 0
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_PanelHeader.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_PanelHeader.def
new file mode 100644
index 0000000..8d20e9e
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_PanelHeader.def
@@ -0,0 +1,25 @@
+Quintiq file version 2.0
+Component PanelHeader
+{
+  #keys: '[415136.0.881011755]'
+  BaseType: 'WebPanel'
+  Children:
+  [
+    Component ButtonExport
+    {
+      #keys: '[415136.0.881011811]'
+      BaseType: 'WebButton'
+      Properties:
+      [
+        Image: 'EXPORT1'
+        Taborder: 0
+      ]
+    }
+  ]
+  Properties:
+  [
+    FixedSize: true
+    Orientation: 'horizontal'
+    Taborder: 0
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_PanelTable.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_PanelTable.def
new file mode 100644
index 0000000..410f2fd
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_PanelTable.def
@@ -0,0 +1,14 @@
+Quintiq file version 2.0
+Component PanelTable
+{
+  #keys: '[415136.0.881011874]'
+  BaseType: 'WebPanel'
+  Children:
+  [
+    #child: MatrixEditorTable
+  ]
+  Properties:
+  [
+    Taborder: 1
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_matrixEditorActionBarPageTable.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_matrixEditorActionBarPageTable.def
new file mode 100644
index 0000000..4e80537
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_matrixEditorActionBarPageTable.def
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+Component matrixEditorActionBarPageTable
+{
+  #keys: '[415136.0.881011916]'
+  BaseType: 'matrixEditorActionBarPage'
+  Properties:
+  [
+    Taborder: 3
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_matrixeditorContextMenuTable.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_matrixeditorContextMenuTable.def
new file mode 100644
index 0000000..d8d4084
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Component_matrixeditorContextMenuTable.def
@@ -0,0 +1,10 @@
+Quintiq file version 2.0
+Component matrixeditorContextMenuTable
+{
+  #keys: '[415136.0.881011919]'
+  BaseType: 'matrixeditorContextMenu'
+  Properties:
+  [
+    Taborder: 4
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Response_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Response_OnCreated.def
new file mode 100644
index 0000000..3cf4d42
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Response_OnCreated.def
@@ -0,0 +1,16 @@
+Quintiq file version 2.0
+#parent: #root
+Response OnCreated () id:Response_FormFinancialWeeklyReport_OnCreated
+{
+  #keys: '[415136.0.882110991]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebComponent_OnCreated'
+  QuillAction
+  {
+    Body:
+    [*
+      FinancialWeeklyReport::Initialize( MacroPlan );
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Response_PanelHeader_ButtonExport_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Response_PanelHeader_ButtonExport_OnClick.def
new file mode 100644
index 0000000..d0c2cab
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/Response_PanelHeader_ButtonExport_OnClick.def
@@ -0,0 +1,18 @@
+Quintiq file version 2.0
+#parent: PanelHeader/ButtonExport
+Response OnClick () id:Response_PanelHeader_ButtonExport_OnClick
+{
+  #keys: '[415136.0.882111199]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebButton_OnClick'
+  QuillAction
+  {
+    Body:
+    [*
+      binaryValue := FinancialWeeklyReport::Download( MacroPlan );
+      
+      Application.Download( FinancialWeeklyReport::GetDefaultName() + '.xlsx', binaryValue.AsBinaryData() );
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/_ROOT_Component_FormFinancialWeeklyReport.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/_ROOT_Component_FormFinancialWeeklyReport.def
new file mode 100644
index 0000000..af4455d
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialWeeklyReport/_ROOT_Component_FormFinancialWeeklyReport.def
@@ -0,0 +1,18 @@
+Quintiq file version 2.0
+#root
+#parent: MacroPlannerWebApp
+OrphanComponent FormFinancialWeeklyReport
+{
+  #keys: '[415136.0.881011703]'
+  BaseType: 'WebForm'
+  Children:
+  [
+    #child: PanelHeader
+    #child: PanelTable
+  ]
+  Properties:
+  [
+    Image: 'DOCUMENT_DIRTY'
+    Title: 'Financial weekly report'
+  ]
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Component_PanelCategory.def b/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Component_PanelCategory.def
index 1c06644..fe8fadd 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Component_PanelCategory.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Component_PanelCategory.def
@@ -11,7 +11,6 @@
       BaseType: 'WebRadioButtonGroup'
       Properties:
       [
-        BoundValue: 'Day'
         ButtonLabels: 'Day;Week;Month'
         ButtonValues: 'Day;Week;Month'
         Orientation: 'horizontal'
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Component_PanelPeriod.def b/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Component_PanelPeriod.def
index bc6b316..188ac98 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Component_PanelPeriod.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Component_PanelPeriod.def
@@ -21,6 +21,7 @@
       BaseType: 'WebDateSelector'
       Properties:
       [
+        Date: 9999-12-31
         Label: 'End date'
         Taborder: 1
       ]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_OnCreated.def
index 9b50f5f..ca45d5d 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_OnCreated.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_OnCreated.def
@@ -9,12 +9,12 @@
   {
     Body:
     [*
-      if( not isnull( MacroPlan.InventorySummarySource() ) ){
-        InventorySummarySource::Initialize( MacroPlan );
-      }
+      //if( not isnull( MacroPlan.InventorySummarySource() ) ){
+        InventorySummarySource::Initialize( MacroPlan, InterfaceDataset );
+      //}
       //info( '------------------1----------------' );
       table := selectobject( MacroPlan, InventorySummarySource.InventorySummaryReport, table, table.IsShow() );
-      info( '------------------2----------------', table.IsShow() );
+      //info( '------------------2----------------', table.IsShow() );
       DataHolderTable.Data( table );
       
       dhSearch.Data( table.InventorySummarySource().InventorySummarySearch() );
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelCategory_RadioButtonGroupUseForPlanning_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelCategory_RadioButtonGroupUseForPlanning_OnCreated.def
new file mode 100644
index 0000000..cfe85d3
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelCategory_RadioButtonGroupUseForPlanning_OnCreated.def
@@ -0,0 +1,16 @@
+Quintiq file version 2.0
+#parent: PanelCategory/RadioButtonGroupUseForPlanning_545
+Response OnCreated () id:Response_PanelCategory_RadioButtonGroupUseForPlanning_OnCreated
+{
+  #keys: '[415136.0.875614032]'
+  CanBindMultiple: false
+  DefinitionID: 'Responsedef_WebComponent_OnCreated'
+  QuillAction
+  {
+    Body:
+    [*
+      this.ButtonValues( Translations::MP_GlobalParameters_Day() + ';' + Translations::MP_GlobalParameters_Week() + ';' + Translations::MP_GlobalParameters_Month() );
+    *]
+    GroupServerCalls: false
+  }
+}
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelPeriod_DateSelectorEnd_OnChanged.def b/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelPeriod_DateSelectorEnd_OnChanged.def
index 7d13e79..503f315 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelPeriod_DateSelectorEnd_OnChanged.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelPeriod_DateSelectorEnd_OnChanged.def
@@ -10,9 +10,13 @@
     Body:
     [*
       //鏃ユ湡鏀瑰彉鍚庡埛鏂版樉绀�
-      if( dhSearch.Data().EndDate() <> this.Date() ){
-        dhSearch.Data().EndDate( this.Date() );
-        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
+      if( this.Date() < DateSelectorStart.Date() ){
+        this.HintError( 'The end date cannot be less than the start date!' );
+      }else{
+        if( dhSearch.Data().EndDate() <> this.Date() ){
+          dhSearch.Data().EndDate( this.Date() );
+          DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
+        }
       }
     *]
     GroupServerCalls: false
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelPeriod_DateSelectorStart_OnChanged.def b/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelPeriod_DateSelectorStart_OnChanged.def
index aa54f0a..ba04b08 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelPeriod_DateSelectorStart_OnChanged.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelPeriod_DateSelectorStart_OnChanged.def
@@ -10,9 +10,13 @@
     Body:
     [*
       //鏃ユ湡鏀瑰彉鍚庡埛鏂版樉绀�
-      if( dhSearch.Data().StartDate() <> this.Date() ){
-        dhSearch.Data().StartDate( this.Date() );
-        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
+      if( this.Date() > DateSelectorEnd.Date() ){
+        this.HintError( 'The start date cannot be later than the end date!' );
+      }else{
+        if( dhSearch.Data().StartDate() <> this.Date() ){
+          dhSearch.Data().StartDate( this.Date() );
+          DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
+        }
       }
     *]
     GroupServerCalls: false
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelUnit_ddslUnit_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelUnit_ddslUnit_OnCreated.def
index 67038e1..81f2cba 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelUnit_ddslUnit_OnCreated.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormInventorySummaryReport/Response_PanelUnit_ddslUnit_OnCreated.def
@@ -10,7 +10,7 @@
     Body:
     [*
       
-      valueString := "<All>;" + FinancialProductionReport::GetDefaultCCUnit() + ";" + FinancialProductionReport::GetDefaultDLUnit();
+      valueString := "<All>;" + InventorySummaryReport::GetDefaultCCUnit() + ";" + InventorySummaryReport::GetDefaultDLUnit();
       
       this.Strings( valueString );
     *]
diff --git a/_Main/UI/MacroPlannerWebApp/Views/Financial_weekly_report_view.vw b/_Main/UI/MacroPlannerWebApp/Views/Financial_weekly_report_view.vw
new file mode 100644
index 0000000..64db5a0
--- /dev/null
+++ b/_Main/UI/MacroPlannerWebApp/Views/Financial_weekly_report_view.vw
@@ -0,0 +1,92 @@
+Quintiq file version 2.0
+{
+  viewcontents
+  {
+    forms
+    {
+      form_FormFinancialWeeklyReport
+      {
+        title: 'QMacroPlanner::FormFinancialWeeklyReport'
+        shown: true
+        componentID: 'QMacroPlanner::FormFinancialWeeklyReport'
+        layout
+        {
+          mode: 'open'
+          rowPosition: 1
+          rowSpan: 15
+          columnPosition: 1
+          columnSpan: 13
+        }
+        components
+        {
+          FormFinancialWeeklyReport_PanelHeader
+          {
+            sizeRatio: 1
+          }
+          FormFinancialWeeklyReport_PanelTable
+          {
+            sizeRatio: 1
+          }
+          FormFinancialWeeklyReport_MatrixEditorTable
+          {
+            gridColor: '#c4c4c4'
+            totalHeaderWidth: 67
+            attributeHeaderWidthRatio: 0.6
+            nameHeaderWidthRatio: 0.4
+            columnWidth: 100
+            horizontalGrid: true
+            verticalGrid: true
+            backendState
+            {
+              componentId: 'QMacroPlanner::FormFinancialWeeklyReport.MatrixEditorTable'
+              state
+              {
+                cells
+                {
+                  attributes
+                  {
+                    attribute_Value
+                    {
+                      type: 'MatrixEditorWebApiCellDataModelInterest'
+                      index: 0
+                      rowsubtotal: ''
+                      columnsubtotal: ''
+                      attribute: 'Value'
+                    }
+                  }
+                }
+                columns
+                {
+                  sorting
+                  {
+                    criteria: "datamember:'Index'"
+                  }
+                }
+                rows
+                {
+                  sorting
+                  {
+                    criteria: "datamember:'RowNr'"
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+    }
+    userconfigurableinformation
+    {
+    }
+    page: ''
+    group: ''
+    index: 19
+    image: 'DOCUMENT_DIRTY'
+    description: ''
+  }
+  formatversion: 2
+  id: 'Financial_weekly_report_view'
+  name: 'Financial weekly report view'
+  isglobal: false
+  isroot: true
+}

--
Gitblit v1.9.3