From d6bd7a69bc31efa79b21c7be12ba9547a921c251 Mon Sep 17 00:00:00 2001
From: hongji.li <hongji.a.li@capgemini.com>
Date: 星期五, 03 十一月 2023 16:28:41 +0800
Subject: [PATCH] 年度产销预算BUG修改

---
 _Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateSalesVolumeDataForBudget.qbl                                                |   49 ++
 _Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_Year.qbl                                                                           |    7 
 _Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeChart.qbl                                                                                  |  497 ++++++++++----------
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeChart/Response_pFilterCriteria_ButtonCapacityAndSaleBudgeChartTest_OnClick#603.def |   27 
 _Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateDataByYear.qbl                                                                 |   38 +
 _Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_GetAnnualSalesQuantity.qbl                                                        |   62 ++
 _Main/BL/Type_CapacityAndSaleBudgeFilterPlaceOfProductionOfArray/StaticMethod_InitializedData.qbl                                                |    2 
 _Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateSalesVolumeData.qbl                                                         |   18 
 _Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateDataByHalfAYear.qbl                                                            |   42 +
 _Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_ColumnType.qbl                                                                     |    7 
 _Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateDataByMonth.qbl                                                                |   42 +
 _Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateDataByQuarter.qbl                                                              |   45 +
 _Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_Create.qbl                                                                           |   18 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_pButton_ButtonCreateData_OnClick.def                                     |   18 
 _Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateData.qbl                                                                       |   28 +
 _Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreatePanelAllocationDataForScenario.qbl                                          |   11 
 _Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreatePanelAllocationDataForBudget.qbl                                            |   48 ++
 _Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_ScenarioName.qbl                                                                   |    7 
 _Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_GetQuantity.qbl                                                                      |   25 +
 _Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_SetFilterCriteria.qbl                                                             |   38 +
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeChart/Component_ChartCapacityAndSaleBudgeChart.def                                 |    1 
 _Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeCompare.qbl                                                                                |   69 +-
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_pButton_ButtonGenerateTestData_OnClick#19.def                            |    2 
 /dev/null                                                                                                                                        |   20 
 _Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_GetPanelAllocationQuantityForBudget.qbl                                           |   62 ++
 _var/_Main/ProjSettings/MacroPlanner/Views/X_分析视图_[414702.1.50321581].vw                                                                         |    2 
 _Main/BL/Type_GlobalDTOTable/Method_CreateCapacityAndSaleBudgeTestData#500.qbl                                                                   |   27 
 _Main/UI/MacroPlannerWebApp/Views/Pegging分析.vw                                                                                                   |    4 
 _Main/BL/Type_CapacityAndSaleBudgeFilterBusinessType/StaticMethod_InitializedData.qbl                                                            |    2 
 _Main/UI/MacroPlannerWebApp/Views/年度产销复盘.vw                                                                                                      |    6 
 _Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_SelectGenerateChartRows.qbl                                                          |   25 +
 _Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_Month.qbl                                                                          |    7 
 _Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreatePanelAllocation.qbl                                                         |   18 
 _Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Response_pButton_ButtonCapacityAndSaleBudgeCompare_OnClick#231.def         |   24 
 _Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_FilterCalculationRows.qbl                                                            |   21 
 _Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_GenerateBasicDataBasedOnFilteringCriteria.qbl                                     |   41 +
 _Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateSalesVolumeDataForScenario.qbl                                              |   47 +
 37 files changed, 1,058 insertions(+), 349 deletions(-)

diff --git a/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_Create.qbl b/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_Create.qbl
new file mode 100644
index 0000000..ee9147b
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_Create.qbl
@@ -0,0 +1,18 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod Create (
+  GlobalOTDSOP this,
+  String businessTypeOrPlaceOfProductionOfArray,
+  String timeStringAndScenarioName,
+  Real quantity
+)
+{
+  TextBody:
+  [*
+    this.CapacityAndSaleBudgeChartElement( relnew, 
+                                           BusinessTypeOrPlaceOfProductionOfArray := businessTypeOrPlaceOfProductionOfArray, 
+                                           TimeStringAndScenarioName := timeStringAndScenarioName,
+                                           Quantity := quantity
+                                          );
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateData.qbl b/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateData.qbl
new file mode 100644
index 0000000..b5c063f
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateData.qbl
@@ -0,0 +1,28 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod CreateData (
+  GlobalOTDSOP this,
+  MacroPlans macroPlans,
+  CapacityAndSaleBudgeCompareItemRows casbcirs,
+  String popoa,
+  String groupBy,
+  String saleOrCapacity,
+  CapacityAndSaleBudgeFilterYears years,
+  CapacityAndSaleBudgeFilterMonths months
+)
+{
+  TextBody:
+  [*
+    //info( "浜ц兘/閿�鍞锛�", saleOrCapacity, "    鏃堕棿鍒嗙粍锛�", groupBy, "    鍩哄湴/浜嬩笟閮細", popoa );
+    
+    if ( groupBy = "骞�" ) {
+      CapacityAndSaleBudgeChartElement::CreateDataByYear( this, macroPlans, casbcirs, popoa, saleOrCapacity, years, months );
+    } else if ( groupBy = "鏈�" ) {
+      CapacityAndSaleBudgeChartElement::CreateDataByMonth( this, macroPlans, casbcirs, popoa, saleOrCapacity, years, months );
+    } else if ( groupBy = "瀛e害" ) {
+      CapacityAndSaleBudgeChartElement::CreateDataByQuarter( this, macroPlans, casbcirs, popoa, saleOrCapacity, years, months );
+    } else if ( groupBy = "鍗婂勾" ) {
+      CapacityAndSaleBudgeChartElement::CreateDataByHalfAYear( this, macroPlans, casbcirs, popoa, saleOrCapacity, years, months );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateDataByHalfAYear.qbl b/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateDataByHalfAYear.qbl
new file mode 100644
index 0000000..ca7db25
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateDataByHalfAYear.qbl
@@ -0,0 +1,42 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod CreateDataByHalfAYear (
+  GlobalOTDSOP this,
+  MacroPlans macroPlans,
+  CapacityAndSaleBudgeCompareItemRows casbcirs,
+  String popoa,
+  String saleOrCapacity,
+  CapacityAndSaleBudgeFilterYears years,
+  CapacityAndSaleBudgeFilterMonths months
+)
+{
+  TextBody:
+  [*
+    calculationConditions := ifexpr( saleOrCapacity = "浜ц兘", "PanelAllocation", "SalesVolume" );
+    categories := construct( Strings );
+    if ( popoa = "闈㈡澘鍩哄湴" ) {
+      categories := selectuniquevalues( casbcirs, Elements, tempCASBCIR, true, tempCASBCIR.PlaceOfProductionOfArray() );
+    } else if ( popoa = "浜嬩笟閮�" ) {
+      categories := selectuniquevalues( casbcirs, Elements, tempCASBCIR, true, tempCASBCIR.BusinessType() );
+    }
+    
+    traverse ( years, Elements, y ) {
+      traverse ( categories, Elements, c ) {
+        for ( i := 0; i < 2; i ++ ) {
+          timeStringAndScenarioName := [String]y.YearNo() + "骞�" + "-" + ifexpr( i = 0, "涓婂崐骞�", "涓嬪崐骞�" ) + "-" + "鐩爣";
+          targetMonth               := selectset( months, Elements, tempM, tempM.MonthNo() >= ( ( i * 6 ) + 1  ) and 
+                                                  tempM.MonthNo() <= ( ( i + 1 ) * 6 ) );
+          filterCASBCIR             := CapacityAndSaleBudgeChartElement::FilterCalculationRows( casbcirs, c, popoa );
+          quantity                  := CapacityAndSaleBudgeChartElement::GetQuantity( filterCASBCIR, calculationConditions, "", y.YearNo(), targetMonth );
+          CapacityAndSaleBudgeChartElement::Create( this, c, timeStringAndScenarioName, quantity );
+          
+          traverse ( macroPlans, Elements, mp ) {
+            timeStringAndScenarioName := [String]y.YearNo() + "骞�" + "-" + ifexpr( i = 0, "涓婂崐骞�", "涓嬪崐骞�" ) + "-" + mp.ScenarioName();
+            quantity                  := CapacityAndSaleBudgeChartElement::GetQuantity( filterCASBCIR, calculationConditions, mp.ScenarioName(), y.YearNo(), targetMonth );
+            CapacityAndSaleBudgeChartElement::Create( this, c, timeStringAndScenarioName, quantity );
+          }
+        }
+      }
+    }
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateDataByMonth.qbl b/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateDataByMonth.qbl
new file mode 100644
index 0000000..ab7379c
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateDataByMonth.qbl
@@ -0,0 +1,42 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod CreateDataByMonth (
+  GlobalOTDSOP this,
+  MacroPlans macroPlans,
+  CapacityAndSaleBudgeCompareItemRows casbcirs,
+  String popoa,
+  String saleOrCapacity,
+  CapacityAndSaleBudgeFilterYears years,
+  CapacityAndSaleBudgeFilterMonths months
+)
+{
+  TextBody:
+  [*
+    calculationConditions := ifexpr( saleOrCapacity = "浜ц兘", "PanelAllocation", "SalesVolume" );
+    categories := construct( Strings );
+    if ( popoa = "闈㈡澘鍩哄湴" ) {
+      categories := selectuniquevalues( casbcirs, Elements, tempCASBCIR, true, tempCASBCIR.PlaceOfProductionOfArray() );
+    } else if ( popoa = "浜嬩笟閮�" ) {
+      categories := selectuniquevalues( casbcirs, Elements, tempCASBCIR, true, tempCASBCIR.BusinessType() );
+    }
+    
+    traverse ( years, Elements, y ) {
+      traverse ( categories, Elements, c ) {
+        traverse ( months, Elements, m ) {
+          filterCASBCIR := CapacityAndSaleBudgeChartElement::FilterCalculationRows( casbcirs, c, popoa );
+          timeStringAndScenarioName := [String]y.YearNo() + "骞�" + "-" + [String]m.MonthNo() + "鏈�" + "-" + "鐩爣";
+          targetMonths := construct( CapacityAndSaleBudgeFilterMonths );
+          targetMonths.Add( m );
+          quantity  := CapacityAndSaleBudgeChartElement::GetQuantity( filterCASBCIR, calculationConditions, "", y.YearNo(), targetMonths );
+          CapacityAndSaleBudgeChartElement::Create( this, c, timeStringAndScenarioName, quantity );
+         
+          traverse ( macroPlans, Elements, mp ) {
+            timeStringAndScenarioName := [String]y.YearNo() + "骞�" + "-" + [String]m.MonthNo() + "鏈�" + "-" + mp.ScenarioName();
+            quantity                  := CapacityAndSaleBudgeChartElement::GetQuantity( filterCASBCIR, calculationConditions, mp.ScenarioName(), y.YearNo(), targetMonths );
+            CapacityAndSaleBudgeChartElement::Create( this, c, timeStringAndScenarioName, quantity );
+          }
+        }
+      }
+    }
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateDataByQuarter.qbl b/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateDataByQuarter.qbl
new file mode 100644
index 0000000..889033f
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateDataByQuarter.qbl
@@ -0,0 +1,45 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod CreateDataByQuarter (
+  GlobalOTDSOP this,
+  MacroPlans macroPlans,
+  CapacityAndSaleBudgeCompareItemRows casbcirs,
+  String popoa,
+  String saleOrCapacity,
+  CapacityAndSaleBudgeFilterYears years,
+  CapacityAndSaleBudgeFilterMonths months
+)
+{
+  TextBody:
+  [*
+    calculationConditions := ifexpr( saleOrCapacity = "浜ц兘", "PanelAllocation", "SalesVolume" );
+    categories := construct( Strings );
+    if ( popoa = "闈㈡澘鍩哄湴" ) {
+      categories := selectuniquevalues( casbcirs, Elements, tempCASBCIR, true, tempCASBCIR.PlaceOfProductionOfArray() );
+    } else if ( popoa = "浜嬩笟閮�" ) {
+      categories := selectuniquevalues( casbcirs, Elements, tempCASBCIR, true, tempCASBCIR.BusinessType() );
+    }
+    
+    traverse ( years, Elements, y ) {
+      traverse ( categories, Elements, c ) {
+        for ( i := 1; i < 5; i ++ ) {
+          targetMonth := selectset( months, Elements, tempM, tempM.MonthNo() >= ( ( i - 1 ) * 3 + 1  ) and 
+                                    tempM.MonthNo() <= ( i * 3 ) );
+          if ( targetMonth.Size() > 0 ) {                                              
+            timeStringAndScenarioName := [String]y.YearNo() + "骞�" + "-" + "绗�" + [String]i + "瀛e害" + "-" + "鐩爣";
+            info( targetMonth.Size() );
+            filterCASBCIR             := CapacityAndSaleBudgeChartElement::FilterCalculationRows( casbcirs, c, popoa );
+            quantity                  := CapacityAndSaleBudgeChartElement::GetQuantity( filterCASBCIR, calculationConditions, "", y.YearNo(), targetMonth );
+            CapacityAndSaleBudgeChartElement::Create( this, c, timeStringAndScenarioName, quantity );
+           
+            traverse ( macroPlans, Elements, mp ) {
+              timeStringAndScenarioName := [String]y.YearNo() + "骞�" + "-" + "绗�" + [String]i + "瀛e害" + "-" + mp.ScenarioName();
+              quantity                  := CapacityAndSaleBudgeChartElement::GetQuantity( filterCASBCIR, calculationConditions, mp.ScenarioName(), y.YearNo(), targetMonth );
+              CapacityAndSaleBudgeChartElement::Create( this, c, timeStringAndScenarioName, quantity );
+            }
+          }
+        }
+      }
+    }
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateDataByYear.qbl b/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateDataByYear.qbl
new file mode 100644
index 0000000..d7c9acd
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_CreateDataByYear.qbl
@@ -0,0 +1,38 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod CreateDataByYear (
+  GlobalOTDSOP this,
+  MacroPlans macroPlans,
+  CapacityAndSaleBudgeCompareItemRows casbcirs,
+  String popoa,
+  String saleOrCapacity,
+  CapacityAndSaleBudgeFilterYears years,
+  CapacityAndSaleBudgeFilterMonths months
+)
+{
+  TextBody:
+  [*
+    calculationConditions := ifexpr( saleOrCapacity = "浜ц兘", "PanelAllocation", "SalesVolume" );
+    categories := construct( Strings );
+    if ( popoa = "闈㈡澘鍩哄湴" ) {
+      categories := selectuniquevalues( casbcirs, Elements, tempCASBCIR, true, tempCASBCIR.PlaceOfProductionOfArray() );
+    } else if ( popoa = "浜嬩笟閮�" ) {
+      categories := selectuniquevalues( casbcirs, Elements, tempCASBCIR, true, tempCASBCIR.BusinessType() );
+    }
+    
+    traverse ( years, Elements, y ) {
+      traverse ( categories, Elements, c ) {
+        timeStringAndScenarioName := [String]y.YearNo() + "骞�" + "-" + "鐩爣";
+        filterCASBCIR             := CapacityAndSaleBudgeChartElement::FilterCalculationRows( casbcirs, c, popoa );
+        quantity                  := CapacityAndSaleBudgeChartElement::GetQuantity( filterCASBCIR, calculationConditions, "", y.YearNo(), months );
+        CapacityAndSaleBudgeChartElement::Create( this, c, timeStringAndScenarioName, quantity );
+        
+        traverse ( macroPlans, Elements, mp ) {
+          timeStringAndScenarioName := [String]y.YearNo() + "骞�" + "-" + mp.ScenarioName();
+          quantity                  := CapacityAndSaleBudgeChartElement::GetQuantity( filterCASBCIR, calculationConditions, mp.ScenarioName(), y.YearNo(), months );
+          CapacityAndSaleBudgeChartElement::Create( this, c, timeStringAndScenarioName, quantity );
+        }
+      }
+    }
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_FilterCalculationRows.qbl b/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_FilterCalculationRows.qbl
new file mode 100644
index 0000000..42c90f3
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_FilterCalculationRows.qbl
@@ -0,0 +1,21 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod FilterCalculationRows (
+  CapacityAndSaleBudgeCompareItemRows casbcirs,
+  String category,
+  String popoa
+) as owning CapacityAndSaleBudgeCompareItemRows
+{
+  TextBody:
+  [*
+    resultCASBCIR := construct( CapacityAndSaleBudgeCompareItemRows );
+    
+    if ( popoa = "闈㈡澘鍩哄湴" ) {
+      resultCASBCIR := selectset( casbcirs, Elements, tempCASBCIR, tempCASBCIR.PlaceOfProductionOfArray() = category );
+    } else if ( popoa = "浜嬩笟閮�" ) {
+      resultCASBCIR := selectset( casbcirs, Elements, tempCASBCIR, tempCASBCIR.BusinessType() = category );
+    }
+    
+    return &resultCASBCIR;
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_GetQuantity.qbl b/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_GetQuantity.qbl
new file mode 100644
index 0000000..ae1ad4d
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_GetQuantity.qbl
@@ -0,0 +1,25 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetQuantity (
+  CapacityAndSaleBudgeCompareItemRows casbcirs,
+  String calculationConditions,
+  String scenarioName,
+  Number year,
+  CapacityAndSaleBudgeFilterMonths months
+) as Real
+{
+  TextBody:
+  [*
+    total := 0.0;
+    
+    total := sum( casbcirs, Elements.CapacityAndSaleBudgeCompareItemCell, tempCASBCIC,
+                  tempCASBCIC.CapacityAndSaleBudgeCompareItemColumn().ColumnType() = calculationConditions and
+                  tempCASBCIC.CapacityAndSaleBudgeCompareItemColumn().ScenarioName() = scenarioName        and
+                  tempCASBCIC.CapacityAndSaleBudgeCompareItemColumn().Year() = year                        and
+                  exists( months, Elements, tempM, tempM.MonthNo() = tempCASBCIC.CapacityAndSaleBudgeCompareItemColumn().Month() ),
+                  [Real]tempCASBCIC.CellContent()
+                 );
+    
+    return total;
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_SelectGenerateChartRows.qbl b/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_SelectGenerateChartRows.qbl
new file mode 100644
index 0000000..c01c3ad
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeChartElement/StaticMethod_SelectGenerateChartRows.qbl
@@ -0,0 +1,25 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SelectGenerateChartRows (
+  GlobalOTDSOP this,
+  owning CapacityAndSaleBudgeFilterItems items,
+  owning CapacityAndSaleBudgeFilterPlaceOfProductionOfArrays casbfpopoas,
+  owning CapacityAndSaleBudgeFilterBusinessTypes casbfbts,
+  owning CapacityAndSaleBudgeFilterYears years,
+  owning CapacityAndSaleBudgeFilterMonths months
+) as owning CapacityAndSaleBudgeCompareItemRows
+{
+  TextBody:
+  [*
+    casbcirs := construct( CapacityAndSaleBudgeCompareItemRows );
+    
+    CapacityAndSaleBudgeCompareItemCell::SetFilterCriteria( this, &items, &casbfpopoas, &casbfbts, &years, &months );
+    
+    casbcirs := selectset( this, CapacityAndSaleBudgeCompareItemRow, tempCASBCIR,
+                           exists( casbfpopoas, Elements, tempCASBFPOPOA, tempCASBFPOPOA.PlaceOfProductionOfArray() = tempCASBCIR.PlaceOfProductionOfArray() ) and
+                           exists( casbfbts, Elements, tempCASBFBT, tempCASBFBT.BusinessType() = tempCASBCIR.BusinessType() )
+                          ); 
+    
+    return &casbcirs;
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateData.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateData.qbl
deleted file mode 100644
index 51e9eb4..0000000
--- a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateData.qbl
+++ /dev/null
@@ -1,25 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-StaticMethod CreateData (
-  const GlobalOTDTable globalOTDTable,
-  GlobalOTDSOP this
-)
-{
-  TextBody:
-  [*
-    traverse ( globalOTDTable, Global_MappingAnnualBudgetData, gmabd ) {
-      productCode := gmabd.ProductID();
-      row         := CapacityAndSaleBudgeCompareItemRow::CreateIfNotExist( this, gmabd.BusinessType(), gmabd.OrganCode() );
-      CapacityAndSaleBudgeCompareItemRowProduct::CreateIfNotExist( row, productCode );
-    }
-    
-    columnBusinessType             := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "浜嬩笟閮�" );
-    columnPlaceOfProductionOfArray := CapacityAndSaleBudgeCompareItemColumn::CreateIfNotExist( this, "闈㈡澘鍩哄湴" );
-    traverse( this, CapacityAndSaleBudgeCompareItemRow, row ) {
-      cell := columnBusinessType.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := row.BusinessType() );
-      cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
-      cell := columnPlaceOfProductionOfArray.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := row.PlaceOfProductionOfArray() );
-      cell.CapacityAndSaleBudgeCompareItemRow( relset, row );
-    }
-  *]
-}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreatePanelAllocation.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreatePanelAllocation.qbl
new file mode 100644
index 0000000..ae7cb61
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreatePanelAllocation.qbl
@@ -0,0 +1,18 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod CreatePanelAllocation (
+  MacroPlans macroPlans,
+  const GlobalOTDTable globalOTDTable,
+  GlobalOTDSOP this,
+  CapacityAndSaleBudgeFilterItems capacityAndSaleBudgeFilterItems,
+  CapacityAndSaleBudgeFilterYears years,
+  CapacityAndSaleBudgeFilterMonths months
+)
+{
+  TextBody:
+  [*
+    CapacityAndSaleBudgeCompareItemCell::CreatePanelAllocationDataForBudget( globalOTDTable, this, capacityAndSaleBudgeFilterItems, years, months );
+    
+    CapacityAndSaleBudgeCompareItemCell::CreatePanelAllocationDataForScenario( macroPlans, this, capacityAndSaleBudgeFilterItems, years, months );
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreatePanelAllocationDataForBudget.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreatePanelAllocationDataForBudget.qbl
new file mode 100644
index 0000000..02ff695
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreatePanelAllocationDataForBudget.qbl
@@ -0,0 +1,48 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod CreatePanelAllocationDataForBudget (
+  const GlobalOTDTable globalOTDTable,
+  GlobalOTDSOP this,
+  CapacityAndSaleBudgeFilterItems capacityAndSaleBudgeFilterItems,
+  CapacityAndSaleBudgeFilterYears years,
+  CapacityAndSaleBudgeFilterMonths months
+)
+{
+  TextBody:
+  [*
+    if ( exists( capacityAndSaleBudgeFilterItems, Elements, tempCASBFI, tempCASBFI.ItemName() = "闈㈡澘鍒嗛厤閲�" ) ) {
+      columnNo := max( this, CapacityAndSaleBudgeCompareItemColumn, tempCASBCIC, true, tempCASBCIC.ColumnNo() ) + 1;
+      traverse ( years, Elements, y ) {
+        traverse ( months, Elements, m ) {
+          columnMonthName  := "闈㈡澘鍒嗛厤閲�" + "-" + [String]y.YearNo() + "骞�" + "-" + [String]m.MonthNo() + "鏈�" + "-" + "骞村害棰勭畻";
+          columnMonth      := this.CapacityAndSaleBudgeCompareItemColumn( relnew, ColumnName := columnMonthName, ColumnNo := columnNo, Year := y.YearNo(), Month := m.MonthNo(), ColumnType := "PanelAllocation" );
+          traverse ( this, CapacityAndSaleBudgeCompareItemRow, casbcir ) {
+    //        info( "褰撳墠琛岋細", casbcir.RowNo(), "    琛岀粍缁囷細", casbcir.PlaceOfProductionOfArray(), "    琛屼簨涓氶儴锛�", casbcir.BusinessType() ); 
+            annualPanelAllocationQuantity := CapacityAndSaleBudgeCompareItemCell::GetPanelAllocationQuantityForBudget( globalOTDTable,
+                                                                                                                       y.YearNo(), 
+                                                                                                                       m.MonthNo(),
+                                                                                                                       casbcir.PlaceOfProductionOfArray(),
+                                                                                                                       casbcir.BusinessType()  
+                                                                                                                      );
+            monthCell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]annualPanelAllocationQuantity );
+            monthCell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
+          }
+          columnNo++;
+        }
+        
+        columnYearName  := "闈㈡澘鍒嗛厤閲�" + "-" + [String]y.YearNo() + "骞�" + "-" + "total" + "-" + "骞村害棰勭畻";
+        columnYear      := this.CapacityAndSaleBudgeCompareItemColumn( relnew, ColumnName := columnYearName, ColumnNo := columnNo, Year := y.YearNo(), ColumnType := "PanelAllocation" );
+        traverse ( this, CapacityAndSaleBudgeCompareItemRow, casbcir  ) {
+          annualPanelAllocationQuantity := CapacityAndSaleBudgeCompareItemCell::GetPanelAllocationQuantityForBudget( globalOTDTable,
+                                                                                                                     y.YearNo(), 
+                                                                                                                     0,
+                                                                                                                     casbcir.PlaceOfProductionOfArray(),
+                                                                                                                     casbcir.BusinessType()
+                                                                                                                    );
+          yearCell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]annualPanelAllocationQuantity );
+          yearCell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
+        }
+      }
+    }
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreatePanelAllocationDataForScenario.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreatePanelAllocationDataForScenario.qbl
new file mode 100644
index 0000000..c646ba3
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreatePanelAllocationDataForScenario.qbl
@@ -0,0 +1,11 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod CreatePanelAllocationDataForScenario (
+  MacroPlans macroPlans,
+  GlobalOTDSOP this,
+  CapacityAndSaleBudgeFilterItems capacityAndSaleBudgeFilterItems,
+  CapacityAndSaleBudgeFilterYears years,
+  CapacityAndSaleBudgeFilterMonths months
+)
+{
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateSalesVolumeData.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateSalesVolumeData.qbl
new file mode 100644
index 0000000..cb8b77f
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateSalesVolumeData.qbl
@@ -0,0 +1,18 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod CreateSalesVolumeData (
+  MacroPlans macroPlans,
+  const GlobalOTDTable globalOTDTable,
+  GlobalOTDSOP this,
+  CapacityAndSaleBudgeFilterItems capacityAndSaleBudgeFilterItems,
+  CapacityAndSaleBudgeFilterYears years,
+  CapacityAndSaleBudgeFilterMonths months
+)
+{
+  TextBody:
+  [*
+    CapacityAndSaleBudgeCompareItemCell::CreateSalesVolumeDataForBudget( globalOTDTable, this, capacityAndSaleBudgeFilterItems, years, months );
+    
+    CapacityAndSaleBudgeCompareItemCell::CreateSalesVolumeDataForScenario( macroPlans, this, capacityAndSaleBudgeFilterItems, years, months );
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateSalesVolumeDataForBudget.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateSalesVolumeDataForBudget.qbl
new file mode 100644
index 0000000..3ce767b
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateSalesVolumeDataForBudget.qbl
@@ -0,0 +1,49 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod CreateSalesVolumeDataForBudget (
+  const GlobalOTDTable globalOTDTable,
+  GlobalOTDSOP this,
+  CapacityAndSaleBudgeFilterItems capacityAndSaleBudgeFilterItems,
+  CapacityAndSaleBudgeFilterYears years,
+  CapacityAndSaleBudgeFilterMonths months
+)
+{
+  TextBody:
+  [*
+    if ( exists( capacityAndSaleBudgeFilterItems, Elements, tempCASBFI, tempCASBFI.ItemName() = "閿�鍞" ) ) {
+      columnNo := max( this, CapacityAndSaleBudgeCompareItemColumn, tempCASBCIC, true, tempCASBCIC.ColumnNo() ) + 1;
+      traverse ( years, Elements, y ) {
+        traverse ( months, Elements, m ) {
+          columnMonthName  := "瀵瑰閿�鍞" + "-" + [String]y.YearNo() + "骞�" + "-" + [String]m.MonthNo() + "鏈�" + "-" + "骞村害棰勭畻";
+          columnMonth      := this.CapacityAndSaleBudgeCompareItemColumn( relnew, ColumnName := columnMonthName, ColumnNo := columnNo, Year := y.YearNo(), Month := m.MonthNo(), ColumnType := "SalesVolume" );
+          traverse ( this, CapacityAndSaleBudgeCompareItemRow, casbcir ) {
+    //        info( "褰撳墠琛岋細", casbcir.RowNo(), "    琛岀粍缁囷細", casbcir.PlaceOfProductionOfArray(), "    琛屼簨涓氶儴锛�", casbcir.BusinessType() ); 
+            annualSalesQuantity := CapacityAndSaleBudgeCompareItemCell::GetAnnualSalesQuantity( globalOTDTable,
+                                                                                                y.YearNo(), 
+                                                                                                m.MonthNo(),
+                                                                                                casbcir.PlaceOfProductionOfArray(),
+                                                                                                casbcir.BusinessType()  
+                                                                                               );
+            monthCell := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]annualSalesQuantity );
+            monthCell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
+          }
+          columnNo++;
+        }
+        
+        columnYearName  := "瀵瑰閿�鍞" + "-" + [String]y.YearNo() + "骞�" + "-" + "total" + "-" + "骞村害棰勭畻";
+        columnYear      := this.CapacityAndSaleBudgeCompareItemColumn( relnew, ColumnName := columnYearName, ColumnNo := columnNo, Year := y.YearNo(), ColumnType := "SalesVolume" );
+        traverse ( this, CapacityAndSaleBudgeCompareItemRow, casbcir  ) {
+          annualSalesQuantity := CapacityAndSaleBudgeCompareItemCell::GetAnnualSalesQuantity( globalOTDTable,
+                                                                                              y.YearNo(), 
+                                                                                              0,
+                                                                                              casbcir.PlaceOfProductionOfArray(),
+                                                                                              casbcir.BusinessType()
+                                                                                             );
+          yearCell := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]annualSalesQuantity );
+          yearCell.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
+        }
+        columnNo++;
+      }
+    }
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateSalesVolumeDataForScenario.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateSalesVolumeDataForScenario.qbl
new file mode 100644
index 0000000..cc0516c
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_CreateSalesVolumeDataForScenario.qbl
@@ -0,0 +1,47 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod CreateSalesVolumeDataForScenario (
+  MacroPlans macroPlans,
+  GlobalOTDSOP this,
+  CapacityAndSaleBudgeFilterItems capacityAndSaleBudgeFilterItems,
+  CapacityAndSaleBudgeFilterYears years,
+  CapacityAndSaleBudgeFilterMonths months
+)
+{
+  TextBody:
+  [*
+    if ( exists( capacityAndSaleBudgeFilterItems, Elements, tempCASBFI, tempCASBFI.ItemName() = "閿�鍞" ) ) {
+      columnNo := max( this, CapacityAndSaleBudgeCompareItemColumn, tempCASBCIC, true, tempCASBCIC.ColumnNo() ) + 1;
+      traverse ( macroPlans, Elements, mp ) {
+        traverse ( years, Elements, y ) {
+          traverse ( months, Elements, m ) {
+            columnMonthName  := "瀵瑰閿�鍞" + "-" + [String]y.YearNo() + "骞�" + "-" + [String]m.MonthNo() + "鏈�" + "-" + mp.ScenarioName();
+            columnMonth      := this.CapacityAndSaleBudgeCompareItemColumn( relnew, ColumnName := columnMonthName, ColumnNo := columnNo, Year := y.YearNo(), Month := m.MonthNo(), ColumnType := "SalesVolume", ScenarioName := mp.ScenarioName() );
+            traverse ( this, CapacityAndSaleBudgeCompareItemRow, casbcir ) {
+              productIDs := selectuniquevalues( casbcir, CapacityAndSaleBudgeCompareItemRowProduct, tempCASBCIRP, true, tempCASBCIRP.ProductCode() );
+              total      := sum( mp, SalesDemand, tempSD, productIDs.Find( tempSD.ProductID() ) >= 0       and
+                                                          tempSD.StartDate().Year()  = [Number]y.YearNo()  and
+                                                          tempSD.StartDate().Month() = [Number]m.MonthNo(),
+                                                          tempSD.Quantity() * tempSD.Price() );
+              cellMonth := columnMonth.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]total );
+              cellMonth.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
+              columnNo++;
+            }
+          }
+          
+          columnMonthName  := "瀵瑰閿�鍞" + "-" + [String]y.YearNo() + "骞�" + "-" + "total" + "-" + mp.ScenarioName();
+          columnYear       := this.CapacityAndSaleBudgeCompareItemColumn( relnew, ColumnName := columnMonthName, ColumnNo := columnNo, Year := y.YearNo(), ColumnType := "SalesVolume", ScenarioName := mp.ScenarioName() );
+          traverse ( this, CapacityAndSaleBudgeCompareItemRow, casbcir ) {
+            productIDs := selectuniquevalues( casbcir, CapacityAndSaleBudgeCompareItemRowProduct, tempCASBCIRP, true, tempCASBCIRP.ProductCode() );
+            total := sum( mp, SalesDemand, tempSD, productIDs.Find( tempSD.ProductID() ) >= 0       and
+                                                   tempSD.StartDate().Year()  = [Number]y.YearNo(),
+                                                   tempSD.Quantity() * tempSD.Price() );
+            cellYear := columnYear.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := [String]total );
+            cellYear.CapacityAndSaleBudgeCompareItemRow( relset, casbcir );
+          }
+          columnNo++;
+        }
+      }
+    }
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_GenerateBasicDataBasedOnFilteringCriteria.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_GenerateBasicDataBasedOnFilteringCriteria.qbl
new file mode 100644
index 0000000..f976af5
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_GenerateBasicDataBasedOnFilteringCriteria.qbl
@@ -0,0 +1,41 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GenerateBasicDataBasedOnFilteringCriteria (
+  GlobalOTDSOP globalOTDSOP,
+  const GlobalOTDTable globalOTDTable,
+  CapacityAndSaleBudgeFilterItems items,
+  CapacityAndSaleBudgeFilterPlaceOfProductionOfArrays casbfpopoas,
+  CapacityAndSaleBudgeFilterBusinessTypes casbfbts
+)
+{
+  TextBody:
+  [*
+    columnPOPOA := globalOTDSOP.CapacityAndSaleBudgeCompareItemColumn( relnew, ColumnName := "闈㈡澘鍩哄湴", ColumnNo := 0 );
+    columnBT    := globalOTDSOP.CapacityAndSaleBudgeCompareItemColumn( relnew, ColumnName := "浜嬩笟閮�", ColumnNo := 1 );
+    
+    rowNr := 0;
+    
+    info( "缁勭粐鍩哄湴涓暟锛�", casbfpopoas.Size(), "    浜嬩笟閮ㄤ釜鏁帮細", casbfbts.Size() );
+    
+    traverse ( casbfpopoas, Elements, casbfpopoa ) {
+      traverse ( casbfbts, Elements, casbfbt ) {
+        targetGlobal_MappingAnnualBudgetData := selectset( globalOTDTable, Global_MappingAnnualBudgetData, tempGMABD, tempGMABD.OrganCode() = casbfpopoa.PlaceOfProductionOfArray() and 
+                                                           tempGMABD.BusinessType() = casbfbt.BusinessType() );
+        if ( targetGlobal_MappingAnnualBudgetData.Size() > 0 ) {
+          targetCapacityAndSaleBudgeCompareItemRow := globalOTDSOP.CapacityAndSaleBudgeCompareItemRow( relnew, 
+                                                      PlaceOfProductionOfArray := casbfpopoa.PlaceOfProductionOfArray(), 
+                                                      BusinessType             := casbfbt.BusinessType(),
+                                                      RowNo                    := rowNr );
+          rowNr++;
+          traverse ( targetGlobal_MappingAnnualBudgetData, Elements, gmabd ) {
+            targetCapacityAndSaleBudgeCompareItemRow.CapacityAndSaleBudgeCompareItemRowProduct( relnew, ProductCode := gmabd.ProductID() );   
+          }
+          cellPOPOA := columnPOPOA.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := casbfpopoa.PlaceOfProductionOfArray() );
+          cellBT    := columnBT.CapacityAndSaleBudgeCompareItemCell( relnew, CellContent := casbfbt.BusinessType() );
+          cellPOPOA.CapacityAndSaleBudgeCompareItemRow( relset, targetCapacityAndSaleBudgeCompareItemRow );
+          cellBT.CapacityAndSaleBudgeCompareItemRow( relset, targetCapacityAndSaleBudgeCompareItemRow );
+        }
+      }
+    }
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_GetAnnualSalesQuantity.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_GetAnnualSalesQuantity.qbl
new file mode 100644
index 0000000..db9e694
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_GetAnnualSalesQuantity.qbl
@@ -0,0 +1,62 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetAnnualSalesQuantity (
+  const GlobalOTDTable globalOTDTable,
+  Number year,
+  Number month,
+  String placeOfProductionOfArray,
+  String businessType
+) as Real
+{
+  TextBody:
+  [*
+    total := 0.0;
+    
+    targetGlobal_MappingAnnualBudgetDatas := selectset( globalOTDTable, Global_MappingAnnualBudgetData, tempGMABD, 
+                                                        tempGMABD.YearNo()       = [String]year             and
+                                                        tempGMABD.OrganCode()    = placeOfProductionOfArray and
+                                                        tempGMABD.BusinessType() = businessType             
+                                                       );
+    
+    if ( month = 0 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales1() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales2() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales3() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales4() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales5() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales6() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales7() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales8() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales9() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales10() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales11() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales12() );
+    } else if ( month = 1 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales1() );
+    } else if ( month = 2 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales2() );
+    } else if ( month = 3 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales3() );
+    } else if ( month = 4 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales4() );
+    } else if ( month = 5 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales5() );
+    } else if ( month = 6 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales6() );
+    } else if ( month = 7 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales7() );
+    } else if ( month = 8 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales8() );
+    } else if ( month = 9 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales9() );
+    } else if ( month = 10 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales10() );
+    } else if ( month = 11 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales11() );
+    } else if ( month = 12 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySales12() );
+    } 
+    
+    return total;
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_GetPanelAllocationQuantityForBudget.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_GetPanelAllocationQuantityForBudget.qbl
new file mode 100644
index 0000000..c615dd1
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_GetPanelAllocationQuantityForBudget.qbl
@@ -0,0 +1,62 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod GetPanelAllocationQuantityForBudget (
+  const GlobalOTDTable globalOTDTable,
+  Number year,
+  Number month,
+  String placeOfProductionOfArray,
+  String businessType
+) as Real
+{
+  TextBody:
+  [*
+    total := 0.0;
+    
+    targetGlobal_MappingAnnualBudgetDatas := selectset( globalOTDTable, Global_MappingAnnualBudgetData, tempGMABD, 
+                                                        tempGMABD.YearNo()       = [String]year             and
+                                                        tempGMABD.OrganCode()    = placeOfProductionOfArray and
+                                                        tempGMABD.BusinessType() = businessType             
+                                                       );
+    
+    if ( month = 0 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity1() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity2() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity3() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity4() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity5() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity6() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity7() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity8() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity9() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity10() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity11() )
+             + sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity12() );
+    } else if ( month = 1 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity1() );
+    } else if ( month = 2 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity2() );
+    } else if ( month = 3 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity3() );
+    } else if ( month = 4 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity4() );
+    } else if ( month = 5 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity5() );
+    } else if ( month = 6 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity6() );
+    } else if ( month = 7 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity7() );
+    } else if ( month = 8 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity8() );
+    } else if ( month = 9 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity9() );
+    } else if ( month = 10 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity10() );
+    } else if ( month = 11 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity11() );
+    } else if ( month = 12 ) {
+      total := sum( targetGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, true, [Real]tempGMABD.MonthlySheetCapacity12() );
+    } 
+    
+    return total;
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_SetFilterCriteria.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_SetFilterCriteria.qbl
new file mode 100644
index 0000000..2b671f2
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemCell/StaticMethod_SetFilterCriteria.qbl
@@ -0,0 +1,38 @@
+Quintiq file version 2.0
+#parent: #root
+StaticMethod SetFilterCriteria (
+  GlobalOTDSOP this,
+  output owning CapacityAndSaleBudgeFilterItems items,
+  output owning CapacityAndSaleBudgeFilterPlaceOfProductionOfArrays casbfpopoas,
+  output owning CapacityAndSaleBudgeFilterBusinessTypes casbfbts,
+  output owning CapacityAndSaleBudgeFilterYears years,
+  output owning CapacityAndSaleBudgeFilterMonths months
+)
+{
+  TextBody:
+  [*
+    if ( items.Size() = 0 ) {
+      items := selectset( this, CapacityAndSaleBudgeFilterItem, tempCASBFI, tempCASBFI.ItemName() = "閿�鍞" );
+    }
+    
+    if ( casbfpopoas.Size() = 0 ) {
+      casbfpopoas := selectset( this, CapacityAndSaleBudgeFilterPlaceOfProductionOfArray, tempCASBFPOPOA, true );
+    }
+    
+    if ( casbfbts.Size() = 0 ) {
+      casbfbts := selectset( this, CapacityAndSaleBudgeFilterBusinessType, tempCASBFBT, true );
+    }
+    
+    if ( years.Size() = 0 ) {
+      years := selectset( this, CapacityAndSaleBudgeFilterYear, tempCASBFY, tempCASBFY.YearNo() = Date::ActualDate().Year() );
+    } else {
+      years := selectsortedset( years, Elements, tempCASBFY, true, tempCASBFY.YearNo() );
+    }
+    
+    if ( months.Size() = 0 ) {
+      months := selectsortedset( this, CapacityAndSaleBudgeFilterMonth, tempCASBFM, true, tempCASBFM.MonthNo() );
+    } else {
+      months := selectsortedset( months, Elements, tempCASBFM, true, tempCASBFM.MonthNo() );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_ColumnType.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_ColumnType.qbl
new file mode 100644
index 0000000..548bc7e
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_ColumnType.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ColumnType
+{
+  #keys: '3[414702.1.340387451][414702.1.340387450][414702.1.340387452]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_Month.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_Month.qbl
new file mode 100644
index 0000000..d88acda
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_Month.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute Month
+{
+  #keys: '3[414702.1.339609433][414702.1.339609432][414702.1.339609434]'
+  ValueType: Number
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_ScenarioName.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_ScenarioName.qbl
new file mode 100644
index 0000000..7056338
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_ScenarioName.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute ScenarioName
+{
+  #keys: '3[414702.1.339085005][414702.1.339085004][414702.1.339085006]'
+  ValueType: String
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_Year.qbl b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_Year.qbl
new file mode 100644
index 0000000..ddcd77c
--- /dev/null
+++ b/_Main/BL/Type_CapacityAndSaleBudgeCompareItemColumn/Attribute_Year.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute Year
+{
+  #keys: '3[414702.1.339609423][414702.1.339609422][414702.1.339609424]'
+  ValueType: Number
+}
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeFilterBusinessType/StaticMethod_InitializedData.qbl b/_Main/BL/Type_CapacityAndSaleBudgeFilterBusinessType/StaticMethod_InitializedData.qbl
index a41d703..7a77229 100644
--- a/_Main/BL/Type_CapacityAndSaleBudgeFilterBusinessType/StaticMethod_InitializedData.qbl
+++ b/_Main/BL/Type_CapacityAndSaleBudgeFilterBusinessType/StaticMethod_InitializedData.qbl
@@ -9,7 +9,7 @@
   [*
     globalOTDSOP.CapacityAndSaleBudgeFilterBusinessType( relflush );
     
-    businessTypes := selectuniquevalues( globalOTDTable, Global_MappingProduct_MP, tempGMPMP, true, tempGMPMP.BusinessType() );
+    businessTypes := selectuniquevalues( globalOTDTable, Global_MappingAnnualBudgetData, tempGMABD, true, tempGMABD.BusinessType() );
     
     traverse ( businessTypes, Elements, bt ) {
       globalOTDSOP.CapacityAndSaleBudgeFilterBusinessType( relnew, BusinessType := bt );
diff --git a/_Main/BL/Type_CapacityAndSaleBudgeFilterPlaceOfProductionOfArray/StaticMethod_InitializedData.qbl b/_Main/BL/Type_CapacityAndSaleBudgeFilterPlaceOfProductionOfArray/StaticMethod_InitializedData.qbl
index 3c65d07..53f41ff 100644
--- a/_Main/BL/Type_CapacityAndSaleBudgeFilterPlaceOfProductionOfArray/StaticMethod_InitializedData.qbl
+++ b/_Main/BL/Type_CapacityAndSaleBudgeFilterPlaceOfProductionOfArray/StaticMethod_InitializedData.qbl
@@ -9,7 +9,7 @@
   [*
     globalOTDSOP.CapacityAndSaleBudgeFilterPlaceOfProductionOfArray( relflush );
     
-    organCodes := selectuniquevalues( globalOTDTable, Global_MappingOperation, tempGMO, true, tempGMO.OrganCode() );
+    organCodes := selectuniquevalues( globalOTDTable, Global_MappingAnnualBudgetData, tempGMABD, true, tempGMABD.OrganCode() );
     
     traverse ( organCodes, Elements, oc ) {
       globalOTDSOP.CapacityAndSaleBudgeFilterPlaceOfProductionOfArray( relnew, PlaceOfProductionOfArray := oc );
diff --git a/_Main/BL/Type_GlobalDTOTable/Method_InitTestDataByYear.qbl "b/_Main/BL/Type_GlobalDTOTable/Method_CreateCapacityAndSaleBudgeTestData\043500.qbl"
similarity index 84%
rename from _Main/BL/Type_GlobalDTOTable/Method_InitTestDataByYear.qbl
rename to "_Main/BL/Type_GlobalDTOTable/Method_CreateCapacityAndSaleBudgeTestData\043500.qbl"
index 98dddf0..06ec0cb 100644
--- a/_Main/BL/Type_GlobalDTOTable/Method_InitTestDataByYear.qbl
+++ "b/_Main/BL/Type_GlobalDTOTable/Method_CreateCapacityAndSaleBudgeTestData\043500.qbl"
@@ -1,38 +1,29 @@
 Quintiq file version 2.0
 #parent: #root
-Method InitTestDataByYear (
-  MacroPlan macroPlan,
+Method CreateCapacityAndSaleBudgeTestData (
   GlobalOTDSOP globalOTDSOP,
+  const GlobalOTDTable globalOTDTable,
   CapacityAndSaleBudgeFilterYears years,
-  CapacityAndSaleBudgeFilterBusinessTypes businessTypes,
-  CapacityAndSaleBudgeFilterPlaceOfProductionOfArrays placeOfProductionOfArrays,
   Product_MPs product_MPs
 )
 {
   TextBody:
   [*
-    product_MPs := selectset( product_MPs, Elements, tempPMP, tempPMP.IsLeaf() and not tempPMP.IsSystem() );
-    
     this.Global_MappingAnnualBudgetData( relflush );
     
+    product_MPs := selectset( product_MPs, Elements, tempPMP, tempPMP.IsLeaf() and not tempPMP.IsSystem() );
     if ( years.Size() = 0 ) {
       years := selectset( globalOTDSOP, CapacityAndSaleBudgeFilterYear, tempCASBFY, 
-                          tempCASBFY.YearNo() = Date::ActualDate().Year()     or
-                          tempCASBFY.YearNo() = Date::ActualDate().Year() - 1 or
-                          tempCASBFY.YearNo() = Date::ActualDate().Year() + 1
+                          tempCASBFY.YearNo() = Date::ActualDate().Year()
                          );
     }
-    if ( businessTypes.Size() = 0 ) {
-      businessTypes := selectset( globalOTDSOP, CapacityAndSaleBudgeFilterBusinessType, tempCASBFBT, true );
-    }
-    if ( placeOfProductionOfArrays.Size() = 0 ) {
-      placeOfProductionOfArrays := selectset( globalOTDSOP, CapacityAndSaleBudgeFilterPlaceOfProductionOfArray, tempCASBFPOPOA, true );
-    }
+    businessTypes             := selectuniquevalues( globalOTDTable, Global_MappingProduct_MP, tempGMPMP, true, tempGMPMP.BusinessType() );
+    placeOfProductionOfArrays := selectuniquevalues( globalOTDTable, Global_MappingOperation, tempGMO, true, tempGMO.OrganCode() );
     
-    traverse ( years, Elements, year ) {
+    traverse ( years, Elements, year, businessTypes.Size() > 0 and placeOfProductionOfArrays.Size() > 0 ) {
       traverse ( product_MPs, Elements, pmp ) {
-        businessType             := businessTypes.Element( Number::Random( 0, businessTypes.Size() - 1 ) ).BusinessType();
-        placeOfProductionOfArray := placeOfProductionOfArrays.Element( Number::Random( 0, placeOfProductionOfArrays.Size() - 1 ) ).PlaceOfProductionOfArray();
+        businessType             := businessTypes.Element( Number::Random( 0, businessTypes.Size() - 1 ) );
+        placeOfProductionOfArray := placeOfProductionOfArrays.Element( Number::Random( 0, placeOfProductionOfArrays.Size() - 1 ) );
         mappingAnnualBudget := this.Global_MappingAnnualBudgetData( relnew, 
                                                                     ID           := OS::GenerateGUIDAsString(),
                                                                     YearNo       := [String]year.YearNo(),
diff --git "a/_Main/BL/Type_GlobalDTOTable/Method_InitTestData\04312.qbl" "b/_Main/BL/Type_GlobalDTOTable/Method_InitTestData\04312.qbl"
deleted file mode 100644
index b83e909..0000000
--- "a/_Main/BL/Type_GlobalDTOTable/Method_InitTestData\04312.qbl"
+++ /dev/null
@@ -1,40 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Method InitTestData (
-  MacroPlan macroPlan
-)
-{
-  TextBody:
-  [*
-    //// yypsybs Oct-7-2023 (created)
-    //productCodeList := selectuniquevalues( macroPlan, Product_MP, item, item.ID() );
-    //debuginfo( "productCodeList : " + [String]productCodeList.Size() );
-    //
-    //this.Global_MappingAnnualBudgetData( relflush );
-    //if( this.Global_MappingAnnualBudgetData( relsize ) = 0 ) {
-    //  debuginfo( "create Global_MappingAnnualBudgetData test data" );
-    //  id := 1;
-    //  for( year := Date::ActualDate().Year() - 10; year <= Date::ActualDate().Year() + 5; year := year + 1 ) {
-    //    for( i := 1; i <= productCodeList.Size(); i := i + 1 ) {
-    //      productCode := productCodeList.Element( i - 1 );
-    //      mappingAnnualBudget := this.Global_MappingAnnualBudgetData( relnew, 
-    //                                                                  ID := [String]id,
-    //                                                                  YearNo := [String]year,
-    //                                                                  BusinessType := "浜嬩笟閮�" + [String](productCode.Length() mod 3),
-    //                                                                  ProductID := productCode);
-    //      id := id + 1;
-    //      for( month := 1; month <= 12; month := month + 1 ) {
-    //        field := Reflection::FindAttribute( "Global_MappingAnnualBudgetData", "MonthlyModCapacity" + [String]month );
-    //        field.Set( mappingAnnualBudget, [String]Real::Random( 20000.0, 30000.0 ) );
-    //        field := Reflection::FindAttribute( "Global_MappingAnnualBudgetData", "MonthlySheetCapacity" + [String]month );
-    //        field.Set( mappingAnnualBudget, [String]Real::Random( 20000.0, 30000.0 ) );
-    //        field := Reflection::FindAttribute( "Global_MappingAnnualBudgetData", "MonthlySales" + [String]month );
-    //        field.Set( mappingAnnualBudget, [String]Real::Random( 20000.0, 30000.0 ) );
-    //      }
-    //    }
-    //  }
-    //  result2 := selectset( this, Global_MappingAnnualBudgetData, item, true );
-    //  debuginfo( "test MappingAnnualBudget size : " + [String]result2.Size() );
-    //}
-  *]
-}
diff --git a/_Main/BL/Type_GlobalDTOTable/Method_InitTestData.qbl b/_Main/BL/Type_GlobalDTOTable/Method_InitTestData.qbl
deleted file mode 100644
index abebe3c..0000000
--- a/_Main/BL/Type_GlobalDTOTable/Method_InitTestData.qbl
+++ /dev/null
@@ -1,20 +0,0 @@
-Quintiq file version 2.0
-#parent: #root
-Method InitTestData
-{
-  TextBody:
-  [*
-    //this.MatAttrSettingAndPlanStrategy( relflush );
-    
-    // yypsybs Sep-8-2023 (created)
-    //debuginfo( "CapacityAndSaleBudge::InitTestData" )
-    //mat1 := MatAttrSettingAndPlanStrategy::CreateIfNotExist( this, 1, "鎵嬫満浜嬩笟閮�", "MAT_1", "MAT_1", "TYPE_1", 233.0, "閫氱敤", "闀垮懆鏈�" );
-    //MatAttrSettingAndPlanStrategyDetail::CreateIfNotExist( mat1, "PROD_1", 666.0, "PROD_1_DESC" );
-    //MatAttrSettingAndPlanStrategyDetail::CreateIfNotExist( mat1, "PROD_2", 777.0, "PROD_2_DESC" );
-    //mat2 := MatAttrSettingAndPlanStrategy::CreateIfNotExist( this, 2, "鎵嬫満浜嬩笟閮�", "MAT_2", "MAT_2", "TYPE_2", 233.0, "涓撶敤", "闀垮懆鏈�" );
-    //MatAttrSettingAndPlanStrategyDetail::CreateIfNotExist( mat2, "PROD_1", 1666.0, "PROD_1_DESC" );
-    //MatAttrSettingAndPlanStrategyDetail::CreateIfNotExist( mat2, "PROD_2", 1777.0, "PROD_2_DESC" );
-    //MatAttrSettingAndPlanStrategy::CreateIfNotExist( this, 3, "鎵嬫満浜嬩笟閮�", "MAT_3", "MAT_3", "TYPE_1", 233.0, "閫氱敤", "鐭懆鏈�" );
-    //MatAttrSettingAndPlanStrategy::CreateIfNotExist( this, 4, "鎵嬫満浜嬩笟閮�", "MAT_4", "MAT_4", "TYPE_2", 233.0, "涓撶敤", "鐭懆鏈�" );
-  *]
-}
diff --git a/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeChart.qbl b/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeChart.qbl
index b96a8a8..fd760c1 100644
--- a/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeChart.qbl
+++ b/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeChart.qbl
@@ -4,263 +4,268 @@
   MacroPlans macroPlans,
   String saleOrCapacity,
   String groupBy,
-  String byBusinessTypeOrByOrgCode,
-  CapacityAndSaleBudgeFilterBusinessTypes businessTypes,
-  CapacityAndSaleBudgeFilterPlaceOfProductionOfArrays placeOfProductionOfArrays,
-  CapacityAndSaleBudgeFilterYears years,
-  CapacityAndSaleBudgeFilterMonths months,
+  String popoa,
+  owning CapacityAndSaleBudgeFilterItems items,
+  owning CapacityAndSaleBudgeFilterPlaceOfProductionOfArrays placeOfProductionOfArrays,
+  owning CapacityAndSaleBudgeFilterBusinessTypes businessTypes,
+  owning CapacityAndSaleBudgeFilterYears years,
+  owning CapacityAndSaleBudgeFilterMonths months,
   GlobalOTDTable otdTable
 )
 {
   Description: '鎸夊叆鍙傚鐞嗘暟鎹紝浜х敓闇�瑕佺殑CapacityAndSaleBudgeChartElement'
   TextBody:
   [*
-    info( "浜ц兘/閿�鍞锛�", saleOrCapacity, "    鏃堕棿鍒嗙粍锛�", groupBy, "    鍩哄湴/浜嬩笟閮細", byBusinessTypeOrByOrgCode );
-    // 骞翠唤涓嶉�夋椂鍏ㄩ��
-    if ( years.Size() = 0 ) {
-      years := selectset( this, CapacityAndSaleBudgeFilterYear, tempCASBFY, tempCASBFY.YearNo() = Date::ActualDate().Year() );
-    }
-    // 鏈堜唤涓嶉�夋椂鍏ㄩ��
-    if ( months.Size() = 0 ) {
-      months := selectsortedset( this, CapacityAndSaleBudgeFilterMonth, item, true, item.MonthNo() );
-    }
-    
-    // ====娓呯悊鏃ф暟鎹�====
     this.CapacityAndSaleBudgeChartRow( relflush );
     this.CapacityAndSaleBudgeChartElement( relflush );
     
-    // ====鎸夐潰鏉垮熀鍦板拰浜嬩笟閮ㄥ浜у搧杩涜绛涢�夊垎缁�====
-    targeGlobal_MappingAnnualBudgetDatas := selectset( otdTable, Global_MappingAnnualBudgetData, tempGMABD, true );
-    if ( businessTypes.Size() > 0 ) {
-      businessTypeStrings := selectuniquevalues( businessTypes, Elements, item, true, item.BusinessType() );
-      targeGlobal_MappingAnnualBudgetDatas := selectset( targeGlobal_MappingAnnualBudgetDatas, Elements, item, businessTypeStrings.Find( item.BusinessType() ) > -1 );
-    }
-    if ( placeOfProductionOfArrays.Size() > 0 ) {
-      placeOfProductionOfArrayStrings := selectuniquevalues( placeOfProductionOfArrays, Elements, item, true, item.PlaceOfProductionOfArray() );
-      targeGlobal_MappingAnnualBudgetDatas := selectset( targeGlobal_MappingAnnualBudgetDatas, Elements, item, placeOfProductionOfArrayStrings.Find( item.OrganCode() ) > -1 );
-    }
-    info( "閫変腑鐨勪釜鏁�:", targeGlobal_MappingAnnualBudgetDatas.Size() );
+    casbcirs := CapacityAndSaleBudgeChartElement::SelectGenerateChartRows( this, &items, &placeOfProductionOfArrays, &businessTypes, &years, &months );
     
-    traverse ( targeGlobal_MappingAnnualBudgetDatas, Elements, gmabd ) {
-      row := CapacityAndSaleBudgeChartRow::CreateIfNotExist( this, gmabd.BusinessType(), gmabd.OrganCode() );
-      // 璁板綍姣忚鍖呭惈鍝簺product
-      CapacityAndSaleBudgeChartRowProduct::CreateIfNotExist( row, gmabd.ProductID() );
-    }
+    CapacityAndSaleBudgeChartElement::CreateData( this, macroPlans, casbcirs, popoa, groupBy, saleOrCapacity, years, months );
     
-    rows := selectset( this, CapacityAndSaleBudgeChartRow, item, true );
-    placeOfProductionOfArrayList := selectuniquevalues( targeGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, tempGMABD.OrganCode() );
-    businessTypeList := selectuniquevalues( targeGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, tempGMABD.BusinessType() );
-    
-    // 鐢熸垚鍥捐〃鍏冪礌
-    traverse ( years, Elements, year ) {
-      if ( byBusinessTypeOrByOrgCode = "闈㈡澘鍩哄湴" and groupBy = "骞�" ) {
-        // 鐩爣
-        traverse ( placeOfProductionOfArrayList, Elements, placeOfProductionOfArray ) {
-          productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByPlaceOfProductionOfArray( rows, placeOfProductionOfArray );
-          this.CapacityAndSaleBudgeChartElement( relnew, 
-                                                 TimeStringAndScenarioName := [String]year.YearNo() + "骞�-鐩爣",
-                                                 BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
-                                                 Quantity := ifexpr( saleOrCapacity = "閿�鍞",
-                                                                     Global_MappingAnnualBudgetData::GetSaleByYear( productCodeList, otdTable, year.YearNo() ),
-                                                                     Global_MappingForecast::GetQuantityByYear( productCodeList, otdTable, year.YearNo() ) )
-                                                );
-          // S&OP
-          traverse ( macroPlans, Elements, macroPlan ) {
-            this.CapacityAndSaleBudgeChartElement( relnew, 
-                                                   TimeStringAndScenarioName := [String]year.YearNo() + "骞�-" + macroPlan.ScenarioName(),
-                                                   BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
-                                                   Quantity := ifexpr( saleOrCapacity = "閿�鍞",
-                                                                       Forecast::GetFulfilledBalanceByYear( productCodeList, macroPlan, year.YearNo() ),
-                                                                       Product_MP::GetNewSupplyByYear( productCodeList, macroPlan, year.YearNo() ) 
-                                                                       )
-                                                   ); 
-          }                    
-        }
-      } 
-      if ( byBusinessTypeOrByOrgCode = "闈㈡澘鍩哄湴" and groupBy = "鍗婂勾" ) {
-        for( halfNo := 1; halfNo <= 2; halfNo := halfNo + 1 ) {
-          traverse( placeOfProductionOfArrayList, Elements, placeOfProductionOfArray ) {
-            productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByPlaceOfProductionOfArray( rows, placeOfProductionOfArray );
-            this.CapacityAndSaleBudgeChartElement( relnew, 
-                                                   TimeStringAndScenarioName := [String]year.YearNo() + "骞�-" + ifexpr( halfNo = 1, "涓�", "涓�" ) + "鍗婂勾-鐩爣",
-                                                   BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
-                                                   Quantity := ifexpr( saleOrCapacity = "閿�鍞",
-                                                                       Global_MappingAnnualBudgetData::GetSaleByHalfYear( productCodeList, otdTable, year.YearNo(), halfNo ),
-                                                                       Global_MappingForecast::GetQuantityByHalfYear( productCodeList, otdTable, year.YearNo(), halfNo ) )
-                                                   );  
-            // S&OP
-            traverse( macroPlans, Elements, macroPlan ) {
-              this.CapacityAndSaleBudgeChartElement( relnew, 
-                                                     TimeStringAndScenarioName := [String]year.YearNo() + "骞�-" + ifexpr( halfNo = 1, "涓�", "涓�" ) + "鍗婂勾-" + macroPlan.ScenarioName(),
-                                                     BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
-                                                     Quantity := ifexpr( saleOrCapacity = "閿�鍞",
-                                                                         Forecast::GetFulfilledBalanceByHalfYear( productCodeList, macroPlan, year.YearNo(), halfNo ),
-                                                                         Product_MP::GetNewSupplyByHalfYear( productCodeList, macroPlan, year.YearNo(), halfNo )
-                                                                         )
-                                                     ); 
-            }                    
-          }
-        }
-      }
-      if ( byBusinessTypeOrByOrgCode = "闈㈡澘鍩哄湴" and groupBy = "瀛e害" ) {
-        for( seasonNo := 1; seasonNo <= 4; seasonNo := seasonNo + 1 ) {
-          traverse( placeOfProductionOfArrayList, Elements, placeOfProductionOfArray ) {
-            productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByPlaceOfProductionOfArray( rows, placeOfProductionOfArray );
-            this.CapacityAndSaleBudgeChartElement( relnew, 
-                                                   TimeStringAndScenarioName := [String]year.YearNo() + "骞�-绗�" + [String]seasonNo + "瀛e害-鐩爣",
-                                                   BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
-                                                   Quantity := ifexpr( saleOrCapacity = "閿�鍞",
-                                                                       Global_MappingAnnualBudgetData::GetSaleBySeason( productCodeList, otdTable, year.YearNo(), seasonNo ),
-                                                                       Global_MappingForecast::GetQuantityBySeason( productCodeList, otdTable, year.YearNo(), seasonNo ) )
-                                                   );  
-      //      info( "productCodeList : " + [String]productCodeList.Size() );
-            // S&OP
-            traverse( macroPlans, Elements, macroPlan ) {
-              this.CapacityAndSaleBudgeChartElement( relnew, 
-                                                     TimeStringAndScenarioName := [String]year.YearNo() + "骞�-绗�" + [String]seasonNo + "瀛e害-" + macroPlan.ScenarioName(),
-                                                     BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
-                                                     Quantity := ifexpr( saleOrCapacity = "閿�鍞",
-                                                                         Forecast::GetFulfilledBalanceBySeason( productCodeList, macroPlan, year.YearNo(), seasonNo ) ,
-                                                                         Product_MP::GetNewSupplyBySeason( productCodeList, macroPlan, year.YearNo(), seasonNo )
-                                                                         )
-                                                     ); 
-            }                    
-          }
-        }
-      }
-      if ( byBusinessTypeOrByOrgCode = "闈㈡澘鍩哄湴" and groupBy = "鏈�" ) {
-        traverse( months, Elements, month ) {
-    //      info( "process month start : " + [String]month.MonthNo() );
-          monthNoString := ifexpr( month.MonthNo() <= 9, "0" + [String]month.MonthNo(), [String]month.MonthNo() );
-          traverse( placeOfProductionOfArrayList, Elements, placeOfProductionOfArray ) {
-            productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByPlaceOfProductionOfArray( rows, placeOfProductionOfArray );
-            this.CapacityAndSaleBudgeChartElement( relnew, 
-                                                   TimeStringAndScenarioName := [String]year.YearNo() + "骞�-绗�" + monthNoString + "鏈�-鐩爣",
-                                                   BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
-                                                   Quantity := ifexpr( saleOrCapacity = "閿�鍞",
-                                                                       Global_MappingAnnualBudgetData::GetSaleByMonth( productCodeList, otdTable, year.YearNo(), month.MonthNo() ),
-                                                                       Global_MappingForecast::GetQuantityByMonth( productCodeList, otdTable, year.YearNo(), month.MonthNo() ) )
-                                                   );  
-            // S&OP
-            traverse( macroPlans, Elements, macroPlan ) {
-              this.CapacityAndSaleBudgeChartElement( relnew, 
-                                                     TimeStringAndScenarioName := [String]year.YearNo() + "骞�-绗�" + monthNoString + "鏈�-" + macroPlan.ScenarioName(),
-                                                     BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
-                                                     Quantity := ifexpr( saleOrCapacity = "閿�鍞",
-                                                                         Forecast::GetFulfilledBalanceByMonth( productCodeList, macroPlan, year.YearNo(), month.MonthNo() ),
-                                                                         Product_MP::GetNewSupplyByMonth( productCodeList, macroPlan, year.YearNo(), month.MonthNo() ) 
-                                                                         )
-                                                     ); 
-            }
-          }
-    //      info( "process month end : " + [String]month.MonthNo() );
-        }
-      }
-      if( byBusinessTypeOrByOrgCode = "浜嬩笟閮�" and groupBy = "骞�" ) {
-        // 鐩爣
-        traverse( businessTypeList, Elements, businessType ) {
-          productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByBusinessType( rows, businessType );
-          this.CapacityAndSaleBudgeChartElement( relnew, 
-                                                 TimeStringAndScenarioName := [String]year.YearNo() + "骞�-鐩爣",
-                                                 BusinessTypeOrPlaceOfProductionOfArray := businessType, 
-                                                 Quantity := ifexpr( saleOrCapacity = "閿�鍞",
-                                                                     Global_MappingAnnualBudgetData::GetSaleByYear( productCodeList, otdTable, year.YearNo() ),
-                                                                     Global_MappingForecast::GetQuantityByYear( productCodeList, otdTable, year.YearNo() ) )
-                                                 );  
-          // S&OP
-          traverse( macroPlans, Elements, macroPlan ) {
-            this.CapacityAndSaleBudgeChartElement( relnew, 
-                                                   TimeStringAndScenarioName := [String]year.YearNo() + "骞�-" + macroPlan.ScenarioName(),
-                                                   BusinessTypeOrPlaceOfProductionOfArray := businessType, 
-                                                   Quantity := ifexpr( saleOrCapacity = "閿�鍞",
-                                                                       Forecast::GetFulfilledBalanceByYear( productCodeList, macroPlan, year.YearNo() ) ,
-                                                                       Product_MP::GetNewSupplyByYear( productCodeList, macroPlan, year.YearNo() )
-                                                                       )
-                                                   ); 
-          }                    
-        }
-      } 
-      if ( byBusinessTypeOrByOrgCode = "浜嬩笟閮�" and groupBy = "鍗婂勾" ) {
-        for( halfNo := 1; halfNo <= 2; halfNo := halfNo + 1 ) {
-          traverse( businessTypeList, Elements, businessType ) {
-            productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByBusinessType( rows, businessType );
-            this.CapacityAndSaleBudgeChartElement( relnew, 
-                                                   TimeStringAndScenarioName := [String]year.YearNo() + "骞�-" + ifexpr( halfNo = 1, "涓�", "涓�" ) + "鍗婂勾-鐩爣",
-                                                   BusinessTypeOrPlaceOfProductionOfArray := businessType, 
-                                                   Quantity := ifexpr( saleOrCapacity = "閿�鍞",
-                                                                       Global_MappingAnnualBudgetData::GetSaleByHalfYear( productCodeList, otdTable, year.YearNo(), halfNo ),
-                                                                       Global_MappingForecast::GetQuantityByHalfYear( productCodeList, otdTable, year.YearNo(), halfNo ) )
-                                                   );  
-            // S&OP
-            traverse( macroPlans, Elements, macroPlan ) {
-              this.CapacityAndSaleBudgeChartElement( relnew, 
-                                                     TimeStringAndScenarioName := [String]year.YearNo() + "骞�-" + ifexpr( halfNo = 1, "涓�", "涓�" ) + "鍗婂勾-" + macroPlan.ScenarioName(),
-                                                     BusinessTypeOrPlaceOfProductionOfArray := businessType, 
-                                                     Quantity := ifexpr( saleOrCapacity = "閿�鍞",
-                                                                         Forecast::GetFulfilledBalanceByHalfYear( productCodeList, macroPlan, year.YearNo(), halfNo ) ,
-                                                                         Product_MP::GetNewSupplyByHalfYear( productCodeList, macroPlan, year.YearNo(), halfNo )
-                                                                         )
-                                                     ); 
-            }                    
-          }
-        }
-      }
-      if ( byBusinessTypeOrByOrgCode = "浜嬩笟閮�" and groupBy = "瀛e害" ) {
-        for( seasonNo := 1; seasonNo <= 4; seasonNo := seasonNo + 1 ) {
-    //      debuginfo( "process season start : " + [String]seasonNo );
-          traverse( businessTypeList, Elements, businessType ) {
-            productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByBusinessType( rows, businessType );
-            this.CapacityAndSaleBudgeChartElement( relnew, 
-                                                   TimeStringAndScenarioName := [String]year.YearNo() + "骞�-绗�" + [String]seasonNo + "瀛e害-鐩爣",
-                                                   BusinessTypeOrPlaceOfProductionOfArray := businessType, 
-                                                   Quantity := ifexpr( saleOrCapacity = "閿�鍞",
-                                                                       Global_MappingAnnualBudgetData::GetSaleBySeason( productCodeList, otdTable, year.YearNo(), seasonNo ),
-                                                                       Global_MappingForecast::GetQuantityBySeason( productCodeList, otdTable, year.YearNo(), seasonNo ) )
-                                                   );  
-            // S&OP
-            traverse( macroPlans, Elements, macroPlan ) {
-              this.CapacityAndSaleBudgeChartElement( relnew, 
-                                                     TimeStringAndScenarioName := [String]year.YearNo() + "骞�-绗�" + [String]seasonNo + "瀛e害-" + macroPlan.ScenarioName(),
-                                                     BusinessTypeOrPlaceOfProductionOfArray := businessType, 
-                                                     Quantity := ifexpr( saleOrCapacity = "閿�鍞",
-                                                                         Forecast::GetFulfilledBalanceBySeason( productCodeList, macroPlan, year.YearNo(), seasonNo ),
-                                                                         Product_MP::GetNewSupplyBySeason( productCodeList, macroPlan, year.YearNo(), seasonNo ) 
-                                                                         )
-                                                     ); 
-            }                    
-          }
-    //      info( "process season end : " + [String]seasonNo );
-        }
-      }
-      if ( byBusinessTypeOrByOrgCode = "浜嬩笟閮�" and groupBy = "鏈�" ) {
-        traverse( months, Elements, month ) {
-    //      debuginfo( "process month start : " + [String]month.MonthNo() );
-          monthNoString := ifexpr( month.MonthNo() <= 9, "0" + [String]month.MonthNo(), [String]month.MonthNo() );
-          traverse( businessTypeList, Elements, businessType ) {
-            productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByBusinessType( rows, businessType );
-            this.CapacityAndSaleBudgeChartElement( relnew, 
-                                                   TimeStringAndScenarioName := [String]year.YearNo() + "骞�-绗�" + monthNoString + "鏈�-鐩爣",
-                                                   BusinessTypeOrPlaceOfProductionOfArray := businessType, 
-                                                   Quantity := ifexpr( saleOrCapacity = "閿�鍞",
-                                                                       Global_MappingAnnualBudgetData::GetSaleByMonth( productCodeList, otdTable, year.YearNo(), month.MonthNo() ),
-                                                                       Global_MappingForecast::GetQuantityByMonth( productCodeList, otdTable, year.YearNo(), month.MonthNo() ) )
-                                                   );  
-            // S&OP
-            traverse( macroPlans, Elements, macroPlan ) {
-              this.CapacityAndSaleBudgeChartElement( relnew, 
-                                                     TimeStringAndScenarioName := [String]year.YearNo() + "骞�-绗�" + monthNoString + "鏈�-" + macroPlan.ScenarioName(),
-                                                     BusinessTypeOrPlaceOfProductionOfArray := businessType, 
-                                                     Quantity := ifexpr( saleOrCapacity = "閿�鍞",
-                                                                         Forecast::GetFulfilledBalanceByMonth( productCodeList, macroPlan, year.YearNo(), month.MonthNo() ) ,
-                                                                         Product_MP::GetNewSupplyByMonth( productCodeList, macroPlan, year.YearNo(), month.MonthNo() )
-                                                                         )
-                                                     ); 
-            }            
-          }
-    //      debuginfo( "process month end : " + [String]month.MonthNo() );
-        }
-      }
-    }
+    //// 骞翠唤涓嶉�夋椂鍏ㄩ��
+    //if ( years.Size() = 0 ) {
+    //  years := selectset( this, CapacityAndSaleBudgeFilterYear, tempCASBFY, tempCASBFY.YearNo() = Date::ActualDate().Year() );
+    //}
+    //// 鏈堜唤涓嶉�夋椂鍏ㄩ��
+    //if ( months.Size() = 0 ) {
+    //  months := selectsortedset( this, CapacityAndSaleBudgeFilterMonth, item, true, item.MonthNo() );
+    //}
+    //
+    //// ====娓呯悊鏃ф暟鎹�====
+    //
+    //// ====鎸夐潰鏉垮熀鍦板拰浜嬩笟閮ㄥ浜у搧杩涜绛涢�夊垎缁�====
+    //targeGlobal_MappingAnnualBudgetDatas := selectset( otdTable, Global_MappingAnnualBudgetData, tempGMABD, true );
+    //if ( businessTypes.Size() > 0 ) {
+    //  businessTypeStrings := selectuniquevalues( businessTypes, Elements, item, true, item.BusinessType() );
+    //  targeGlobal_MappingAnnualBudgetDatas := selectset( targeGlobal_MappingAnnualBudgetDatas, Elements, item, businessTypeStrings.Find( item.BusinessType() ) > -1 );
+    //}
+    //if ( placeOfProductionOfArrays.Size() > 0 ) {
+    //  placeOfProductionOfArrayStrings := selectuniquevalues( placeOfProductionOfArrays, Elements, item, true, item.PlaceOfProductionOfArray() );
+    //  targeGlobal_MappingAnnualBudgetDatas := selectset( targeGlobal_MappingAnnualBudgetDatas, Elements, item, placeOfProductionOfArrayStrings.Find( item.OrganCode() ) > -1 );
+    //}
+    ////info( "閫変腑鐨勪釜鏁�:", targeGlobal_MappingAnnualBudgetDatas.Size() );
+    //
+    //traverse ( targeGlobal_MappingAnnualBudgetDatas, Elements, gmabd ) {
+    //  row := CapacityAndSaleBudgeChartRow::CreateIfNotExist( this, gmabd.BusinessType(), gmabd.OrganCode() );
+    //  // 璁板綍姣忚鍖呭惈鍝簺product
+    //  CapacityAndSaleBudgeChartRowProduct::CreateIfNotExist( row, gmabd.ProductID() );
+    //}
+    //
+    //rows := selectset( this, CapacityAndSaleBudgeChartRow, item, true );
+    //placeOfProductionOfArrayList := selectuniquevalues( targeGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, tempGMABD.OrganCode() );
+    //businessTypeList := selectuniquevalues( targeGlobal_MappingAnnualBudgetDatas, Elements, tempGMABD, tempGMABD.BusinessType() );
+    //
+    //// 鐢熸垚鍥捐〃鍏冪礌
+    //traverse ( years, Elements, year ) {
+    //  if ( popoa = "闈㈡澘鍩哄湴" and groupBy = "骞�" ) {
+    //    // 鐩爣
+    //    traverse ( placeOfProductionOfArrayList, Elements, placeOfProductionOfArray ) {
+    //      productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByPlaceOfProductionOfArray( rows, placeOfProductionOfArray );
+    //      this.CapacityAndSaleBudgeChartElement( relnew, 
+    //                                             TimeStringAndScenarioName := [String]year.YearNo() + "骞�-鐩爣",
+    //                                             BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
+    //                                             Quantity := ifexpr( saleOrCapacity = "閿�鍞",
+    //                                                                 Global_MappingAnnualBudgetData::GetSaleByYear( productCodeList, otdTable, year.YearNo() ),
+    //                                                                 Global_MappingForecast::GetQuantityByYear( productCodeList, otdTable, year.YearNo() ) )
+    //                                            );
+    //      // S&OP
+    //      traverse ( macroPlans, Elements, macroPlan ) {
+    //        this.CapacityAndSaleBudgeChartElement( relnew, 
+    //                                               TimeStringAndScenarioName := [String]year.YearNo() + "骞�-" + macroPlan.ScenarioName(),
+    //                                               BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
+    //                                               Quantity := ifexpr( saleOrCapacity = "閿�鍞",
+    //                                                                   Forecast::GetFulfilledBalanceByYear( productCodeList, macroPlan, year.YearNo() ),
+    //                                                                   Product_MP::GetNewSupplyByYear( productCodeList, macroPlan, year.YearNo() ) 
+    //                                                                   )
+    //                                               ); 
+    //      }                    
+    //    }
+    //  } 
+    //  if ( popoa = "闈㈡澘鍩哄湴" and groupBy = "鍗婂勾" ) {
+    //    for( halfNo := 1; halfNo <= 2; halfNo := halfNo + 1 ) {
+    //      traverse( placeOfProductionOfArrayList, Elements, placeOfProductionOfArray ) {
+    //        productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByPlaceOfProductionOfArray( rows, placeOfProductionOfArray );
+    //        this.CapacityAndSaleBudgeChartElement( relnew, 
+    //                                               TimeStringAndScenarioName := [String]year.YearNo() + "骞�-" + ifexpr( halfNo = 1, "涓�", "涓�" ) + "鍗婂勾-鐩爣",
+    //                                               BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
+    //                                               Quantity := ifexpr( saleOrCapacity = "閿�鍞",
+    //                                                                   Global_MappingAnnualBudgetData::GetSaleByHalfYear( productCodeList, otdTable, year.YearNo(), halfNo ),
+    //                                                                   Global_MappingForecast::GetQuantityByHalfYear( productCodeList, otdTable, year.YearNo(), halfNo ) )
+    //                                               );  
+    //        // S&OP
+    //        traverse( macroPlans, Elements, macroPlan ) {
+    //          this.CapacityAndSaleBudgeChartElement( relnew, 
+    //                                                 TimeStringAndScenarioName := [String]year.YearNo() + "骞�-" + ifexpr( halfNo = 1, "涓�", "涓�" ) + "鍗婂勾-" + macroPlan.ScenarioName(),
+    //                                                 BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
+    //                                                 Quantity := ifexpr( saleOrCapacity = "閿�鍞",
+    //                                                                     Forecast::GetFulfilledBalanceByHalfYear( productCodeList, macroPlan, year.YearNo(), halfNo ),
+    //                                                                     Product_MP::GetNewSupplyByHalfYear( productCodeList, macroPlan, year.YearNo(), halfNo )
+    //                                                                     )
+    //                                                 ); 
+    //        }                    
+    //      }
+    //    }
+    //  }
+    //  if ( popoa = "闈㈡澘鍩哄湴" and groupBy = "瀛e害" ) {
+    //    for( seasonNo := 1; seasonNo <= 4; seasonNo := seasonNo + 1 ) {
+    //      traverse( placeOfProductionOfArrayList, Elements, placeOfProductionOfArray ) {
+    //        productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByPlaceOfProductionOfArray( rows, placeOfProductionOfArray );
+    //        this.CapacityAndSaleBudgeChartElement( relnew, 
+    //                                               TimeStringAndScenarioName := [String]year.YearNo() + "骞�-绗�" + [String]seasonNo + "瀛e害-鐩爣",
+    //                                               BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
+    //                                               Quantity := ifexpr( saleOrCapacity = "閿�鍞",
+    //                                                                   Global_MappingAnnualBudgetData::GetSaleBySeason( productCodeList, otdTable, year.YearNo(), seasonNo ),
+    //                                                                   Global_MappingForecast::GetQuantityBySeason( productCodeList, otdTable, year.YearNo(), seasonNo ) )
+    //                                               );  
+    //  //      info( "productCodeList : " + [String]productCodeList.Size() );
+    //        // S&OP
+    //        traverse( macroPlans, Elements, macroPlan ) {
+    //          this.CapacityAndSaleBudgeChartElement( relnew, 
+    //                                                 TimeStringAndScenarioName := [String]year.YearNo() + "骞�-绗�" + [String]seasonNo + "瀛e害-" + macroPlan.ScenarioName(),
+    //                                                 BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
+    //                                                 Quantity := ifexpr( saleOrCapacity = "閿�鍞",
+    //                                                                     Forecast::GetFulfilledBalanceBySeason( productCodeList, macroPlan, year.YearNo(), seasonNo ) ,
+    //                                                                     Product_MP::GetNewSupplyBySeason( productCodeList, macroPlan, year.YearNo(), seasonNo )
+    //                                                                     )
+    //                                                 ); 
+    //        }                    
+    //      }
+    //    }
+    //  }
+    //  if ( popoa = "闈㈡澘鍩哄湴" and groupBy = "鏈�" ) {
+    //    traverse( months, Elements, month ) {
+    ////      info( "process month start : " + [String]month.MonthNo() );
+    //      monthNoString := ifexpr( month.MonthNo() <= 9, "0" + [String]month.MonthNo(), [String]month.MonthNo() );
+    //      traverse( placeOfProductionOfArrayList, Elements, placeOfProductionOfArray ) {
+    //        productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByPlaceOfProductionOfArray( rows, placeOfProductionOfArray );
+    //        this.CapacityAndSaleBudgeChartElement( relnew, 
+    //                                               TimeStringAndScenarioName := [String]year.YearNo() + "骞�-绗�" + monthNoString + "鏈�-鐩爣",
+    //                                               BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
+    //                                               Quantity := ifexpr( saleOrCapacity = "閿�鍞",
+    //                                                                   Global_MappingAnnualBudgetData::GetSaleByMonth( productCodeList, otdTable, year.YearNo(), month.MonthNo() ),
+    //                                                                   Global_MappingForecast::GetQuantityByMonth( productCodeList, otdTable, year.YearNo(), month.MonthNo() ) )
+    //                                               );  
+    //        // S&OP
+    //        traverse( macroPlans, Elements, macroPlan ) {
+    //          this.CapacityAndSaleBudgeChartElement( relnew, 
+    //                                                 TimeStringAndScenarioName := [String]year.YearNo() + "骞�-绗�" + monthNoString + "鏈�-" + macroPlan.ScenarioName(),
+    //                                                 BusinessTypeOrPlaceOfProductionOfArray := placeOfProductionOfArray, 
+    //                                                 Quantity := ifexpr( saleOrCapacity = "閿�鍞",
+    //                                                                     Forecast::GetFulfilledBalanceByMonth( productCodeList, macroPlan, year.YearNo(), month.MonthNo() ),
+    //                                                                     Product_MP::GetNewSupplyByMonth( productCodeList, macroPlan, year.YearNo(), month.MonthNo() ) 
+    //                                                                     )
+    //                                                 ); 
+    //        }
+    //      }
+    ////      info( "process month end : " + [String]month.MonthNo() );
+    //    }
+    //  }
+    //  if( popoa = "浜嬩笟閮�" and groupBy = "骞�" ) {
+    //    // 鐩爣
+    //    traverse( businessTypeList, Elements, businessType ) {
+    //      productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByBusinessType( rows, businessType );
+    //      this.CapacityAndSaleBudgeChartElement( relnew, 
+    //                                             TimeStringAndScenarioName := [String]year.YearNo() + "骞�-鐩爣",
+    //                                             BusinessTypeOrPlaceOfProductionOfArray := businessType, 
+    //                                             Quantity := ifexpr( saleOrCapacity = "閿�鍞",
+    //                                                                 Global_MappingAnnualBudgetData::GetSaleByYear( productCodeList, otdTable, year.YearNo() ),
+    //                                                                 Global_MappingForecast::GetQuantityByYear( productCodeList, otdTable, year.YearNo() ) )
+    //                                             );  
+    //      // S&OP
+    //      traverse( macroPlans, Elements, macroPlan ) {
+    //        this.CapacityAndSaleBudgeChartElement( relnew, 
+    //                                               TimeStringAndScenarioName := [String]year.YearNo() + "骞�-" + macroPlan.ScenarioName(),
+    //                                               BusinessTypeOrPlaceOfProductionOfArray := businessType, 
+    //                                               Quantity := ifexpr( saleOrCapacity = "閿�鍞",
+    //                                                                   Forecast::GetFulfilledBalanceByYear( productCodeList, macroPlan, year.YearNo() ) ,
+    //                                                                   Product_MP::GetNewSupplyByYear( productCodeList, macroPlan, year.YearNo() )
+    //                                                                   )
+    //                                               ); 
+    //      }                    
+    //    }
+    //  } 
+    //  if ( popoa = "浜嬩笟閮�" and groupBy = "鍗婂勾" ) {
+    //    for( halfNo := 1; halfNo <= 2; halfNo := halfNo + 1 ) {
+    //      traverse( businessTypeList, Elements, businessType ) {
+    //        productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByBusinessType( rows, businessType );
+    //        this.CapacityAndSaleBudgeChartElement( relnew, 
+    //                                               TimeStringAndScenarioName := [String]year.YearNo() + "骞�-" + ifexpr( halfNo = 1, "涓�", "涓�" ) + "鍗婂勾-鐩爣",
+    //                                               BusinessTypeOrPlaceOfProductionOfArray := businessType, 
+    //                                               Quantity := ifexpr( saleOrCapacity = "閿�鍞",
+    //                                                                   Global_MappingAnnualBudgetData::GetSaleByHalfYear( productCodeList, otdTable, year.YearNo(), halfNo ),
+    //                                                                   Global_MappingForecast::GetQuantityByHalfYear( productCodeList, otdTable, year.YearNo(), halfNo ) )
+    //                                               );  
+    //        // S&OP
+    //        traverse( macroPlans, Elements, macroPlan ) {
+    //          this.CapacityAndSaleBudgeChartElement( relnew, 
+    //                                                 TimeStringAndScenarioName := [String]year.YearNo() + "骞�-" + ifexpr( halfNo = 1, "涓�", "涓�" ) + "鍗婂勾-" + macroPlan.ScenarioName(),
+    //                                                 BusinessTypeOrPlaceOfProductionOfArray := businessType, 
+    //                                                 Quantity := ifexpr( saleOrCapacity = "閿�鍞",
+    //                                                                     Forecast::GetFulfilledBalanceByHalfYear( productCodeList, macroPlan, year.YearNo(), halfNo ) ,
+    //                                                                     Product_MP::GetNewSupplyByHalfYear( productCodeList, macroPlan, year.YearNo(), halfNo )
+    //                                                                     )
+    //                                                 ); 
+    //        }                    
+    //      }
+    //    }
+    //  }
+    //  if ( popoa = "浜嬩笟閮�" and groupBy = "瀛e害" ) {
+    //    for( seasonNo := 1; seasonNo <= 4; seasonNo := seasonNo + 1 ) {
+    ////      debuginfo( "process season start : " + [String]seasonNo );
+    //      traverse( businessTypeList, Elements, businessType ) {
+    //        productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByBusinessType( rows, businessType );
+    //        this.CapacityAndSaleBudgeChartElement( relnew, 
+    //                                               TimeStringAndScenarioName := [String]year.YearNo() + "骞�-绗�" + [String]seasonNo + "瀛e害-鐩爣",
+    //                                               BusinessTypeOrPlaceOfProductionOfArray := businessType, 
+    //                                               Quantity := ifexpr( saleOrCapacity = "閿�鍞",
+    //                                                                   Global_MappingAnnualBudgetData::GetSaleBySeason( productCodeList, otdTable, year.YearNo(), seasonNo ),
+    //                                                                   Global_MappingForecast::GetQuantityBySeason( productCodeList, otdTable, year.YearNo(), seasonNo ) )
+    //                                               );  
+    //        // S&OP
+    //        traverse( macroPlans, Elements, macroPlan ) {
+    //          this.CapacityAndSaleBudgeChartElement( relnew, 
+    //                                                 TimeStringAndScenarioName := [String]year.YearNo() + "骞�-绗�" + [String]seasonNo + "瀛e害-" + macroPlan.ScenarioName(),
+    //                                                 BusinessTypeOrPlaceOfProductionOfArray := businessType, 
+    //                                                 Quantity := ifexpr( saleOrCapacity = "閿�鍞",
+    //                                                                     Forecast::GetFulfilledBalanceBySeason( productCodeList, macroPlan, year.YearNo(), seasonNo ),
+    //                                                                     Product_MP::GetNewSupplyBySeason( productCodeList, macroPlan, year.YearNo(), seasonNo ) 
+    //                                                                     )
+    //                                                 ); 
+    //        }                    
+    //      }
+    ////      info( "process season end : " + [String]seasonNo );
+    //    }
+    //  }
+    //  if ( popoa = "浜嬩笟閮�" and groupBy = "鏈�" ) {
+    //    traverse( months, Elements, month ) {
+    ////      debuginfo( "process month start : " + [String]month.MonthNo() );
+    //      monthNoString := ifexpr( month.MonthNo() <= 9, "0" + [String]month.MonthNo(), [String]month.MonthNo() );
+    //      traverse( businessTypeList, Elements, businessType ) {
+    //        productCodeList := CapacityAndSaleBudgeChartRow::GetProductCodesByBusinessType( rows, businessType );
+    //        this.CapacityAndSaleBudgeChartElement( relnew, 
+    //                                               TimeStringAndScenarioName := [String]year.YearNo() + "骞�-绗�" + monthNoString + "鏈�-鐩爣",
+    //                                               BusinessTypeOrPlaceOfProductionOfArray := businessType, 
+    //                                               Quantity := ifexpr( saleOrCapacity = "閿�鍞",
+    //                                                                   Global_MappingAnnualBudgetData::GetSaleByMonth( productCodeList, otdTable, year.YearNo(), month.MonthNo() ),
+    //                                                                   Global_MappingForecast::GetQuantityByMonth( productCodeList, otdTable, year.YearNo(), month.MonthNo() ) )
+    //                                               );  
+    //        // S&OP
+    //        traverse( macroPlans, Elements, macroPlan ) {
+    //          this.CapacityAndSaleBudgeChartElement( relnew, 
+    //                                                 TimeStringAndScenarioName := [String]year.YearNo() + "骞�-绗�" + monthNoString + "鏈�-" + macroPlan.ScenarioName(),
+    //                                                 BusinessTypeOrPlaceOfProductionOfArray := businessType, 
+    //                                                 Quantity := ifexpr( saleOrCapacity = "閿�鍞",
+    //                                                                     Forecast::GetFulfilledBalanceByMonth( productCodeList, macroPlan, year.YearNo(), month.MonthNo() ) ,
+    //                                                                     Product_MP::GetNewSupplyByMonth( productCodeList, macroPlan, year.YearNo(), month.MonthNo() )
+    //                                                                     )
+    //                                                 ); 
+    //        }            
+    //      }
+    ////      debuginfo( "process month end : " + [String]month.MonthNo() );
+    //    }
+    //  }
+    //}
     ////info( "CapacityAndSaleBudgeChartElement : " + [String]selectset( this, CapacityAndSaleBudgeChartElement, item, true ).Size() );
     ////traverse( this, CapacityAndSaleBudgeChartRow, row ) {
     ////  info( "==鈫�==" );
diff --git a/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeCompare.qbl b/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeCompare.qbl
index 8b53f33..5215a43 100644
--- a/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeCompare.qbl
+++ b/_Main/BL/Type_GlobalOTDSOP/Method_CapacityAndSaleBudgeCompare.qbl
@@ -2,40 +2,41 @@
 #parent: #root
 Method CapacityAndSaleBudgeCompare (
   MacroPlans macroPlans,
-  CapacityAndSaleBudgeFilterItems items,
-  CapacityAndSaleBudgeFilterYears years,
-  CapacityAndSaleBudgeFilterMonths months,
+  owning CapacityAndSaleBudgeFilterItems items,
+  owning CapacityAndSaleBudgeFilterPlaceOfProductionOfArrays casbfpopoas,
+  owning CapacityAndSaleBudgeFilterBusinessTypes casbfbts,
+  owning CapacityAndSaleBudgeFilterYears years,
+  owning CapacityAndSaleBudgeFilterMonths months,
   const GlobalOTDTable globalOTDTable
 )
 {
   Description: 'todo : mappingParent鏀逛负mpSync, random鍒犱簡'
   TextBody:
   [*
-    if ( years.Size() = 0 ) {
-      years := selectset( this, CapacityAndSaleBudgeFilterYear, tempCASBFY, tempCASBFY.YearNo() = Date::ActualDate().Year() );
-    }
-    if ( months.Size() = 0 ) {
-      months := selectsortedset( this, CapacityAndSaleBudgeFilterMonth, item, item.MonthNo() );
-    }
-    
     this.CapacityAndSaleBudgeCompareItemRow( relflush );
     this.CapacityAndSaleBudgeCompareItemColumn( relflush );
     
-    CapacityAndSaleBudgeCompareItemCell::CreateData( globalOTDTable, this );
+    CapacityAndSaleBudgeCompareItemCell::SetFilterCriteria( this, &items, &casbfpopoas, &casbfbts, &years, &months );
     
-    if ( CapacityAndSaleBudgeFilterItem::Contains( items, "闈㈡澘鍒嗛厤閲�" ) ) {
-      traverse ( years, Elements, year ) {
-        CapacityAndSaleBudgeCompareItemCell::CreatePanelAllocationBudget( this, months, year, globalOTDTable );
-        CapacityAndSaleBudgeCompareItemCell::CreatePanelAllocationByScenario( macroPlans, this, months, year );
-      }
-    }
+    CapacityAndSaleBudgeCompareItemCell::GenerateBasicDataBasedOnFilteringCriteria( this, globalOTDTable, items, casbfpopoas, casbfbts );
     
-    if ( CapacityAndSaleBudgeFilterItem::Contains( items, "閿�鍞" ) ) {
-      traverse ( years, Elements, year ) {
-        CapacityAndSaleBudgeCompareItemCell::CreateSalesVolume( this, months, year, globalOTDTable );
-        CapacityAndSaleBudgeCompareItemCell::CreateSalesVolumeByScenario( macroPlans, this, months, year );
-      }
-    }
+    CapacityAndSaleBudgeCompareItemCell::CreateSalesVolumeData( macroPlans, globalOTDTable, this, items, years, months );
+    
+    CapacityAndSaleBudgeCompareItemCell::CreatePanelAllocation( macroPlans, globalOTDTable, this, items, years, months );
+    
+    //if ( CapacityAndSaleBudgeFilterItem::Contains( items, "闈㈡澘鍒嗛厤閲�" ) ) {
+    //  traverse ( years, Elements, year ) {
+    //    CapacityAndSaleBudgeCompareItemCell::CreatePanelAllocationBudget( this, months, year, globalOTDTable );
+    //    CapacityAndSaleBudgeCompareItemCell::CreatePanelAllocationByScenario( macroPlans, this, months, year );
+    //  }
+    //}
+    //
+    //if ( CapacityAndSaleBudgeFilterItem::Contains( items, "閿�鍞" ) ) {
+    //  traverse ( years, Elements, year ) {
+    //    CapacityAndSaleBudgeCompareItemCell::CreateSalesVolume( this, months, year, globalOTDTable );
+    //    CapacityAndSaleBudgeCompareItemCell::CreateSalesVolumeByScenario( macroPlans, this, months, year );
+    //  }
+    //}
     
     // 澶у紶鐩堝埄棰�
     //traverse ( years, Elements, year ) {
@@ -74,16 +75,16 @@
     //}
     
     // 璁剧疆rowNo鍜宑olumnNo
-    rowNo := 1;
-    rowSorted := selectsortedset( this, CapacityAndSaleBudgeCompareItemRow, item, item.PlaceOfProductionOfArray() + "_" + item.BusinessType() );
-    traverse( rowSorted, Elements, item ) {
-      item.RowNo( rowNo );
-      rowNo := rowNo + 1;
-    }
-    columnNo := 1;
-    traverse( this, CapacityAndSaleBudgeCompareItemColumn, item ) {
-      item.ColumnNo( columnNo );
-      columnNo := columnNo + 1;
-    }
+    //rowNo := 1;
+    //rowSorted := selectsortedset( this, CapacityAndSaleBudgeCompareItemRow, item, item.PlaceOfProductionOfArray() + "_" + item.BusinessType() );
+    //traverse( rowSorted, Elements, item ) {
+    //  item.RowNo( rowNo );
+    //  rowNo := rowNo + 1;
+    //}
+    //columnNo := 1;
+    //traverse( this, CapacityAndSaleBudgeCompareItemColumn, item ) {
+    //  item.ColumnNo( columnNo );
+    //  columnNo := columnNo + 1;
+    //}
   *]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_pButton_ButtonCreateData_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_pButton_ButtonCreateData_OnClick.def
index 55bdd70..fa3f604 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_pButton_ButtonCreateData_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_pButton_ButtonCreateData_OnClick.def
@@ -7,13 +7,7 @@
   DefinitionID: 'Responsedef_WebButton_OnClick'
   Precondition:
   [*
-    flag := true;
-    
-    flag := GlobalOTDSOP.CapacityAndSaleBudgeFilterYear( relsize ) > 0                     and
-            GlobalOTDSOP.CapacityAndSaleBudgeFilterBusinessType( relsize ) > 0             and
-            GlobalOTDSOP.CapacityAndSaleBudgeFilterPlaceOfProductionOfArray( relsize ) > 0;
-    
-    return flag;
+    return not isnull( GlobalOTDSOP ) and not isnull( GlobalOTDTable );
   *]
   QuillAction
   {
@@ -27,12 +21,10 @@
         if ( DataHolderCheckedProduct.Data().Size() = 0 ) {
           WebMessageBox::Error( "璇峰厛鍦ㄥ乏渚у鑸爮閫夋嫨瑕佺敓鎴愭祴璇曟暟鎹殑浜у搧锛�", true );
         } else {
-          GlobalOTDTable.InitTestDataByYear( MacroPlan, 
-                                             GlobalOTDSOP,
-                                             DataHolderCapacityAndSaleBudgeFilterYear.Data(),
-                                             DataHolderCapacityAndSaleBudgeFilterBusinessType.Data(),
-                                             DataHolderCapacityAndSaleBudgeFilterPlaceOfProductionOfArray.Data(),
-                                             DataHolderCheckedProduct.Data() );
+          GlobalOTDTable.CreateCapacityAndSaleBudgeTestData( GlobalOTDSOP,
+                                                             GlobalOTDTable,
+                                                             DataHolderCapacityAndSaleBudgeFilterYear.Data(),
+                                                             DataHolderCheckedProduct.Data() );
         }
       }
     *]
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_pButton_ButtonGenerateTestData_OnClick\04319.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_pButton_ButtonGenerateTestData_OnClick\04319.def"
index 6af89c3..a8c2ccc 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_pButton_ButtonGenerateTestData_OnClick\04319.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudge/Response_pButton_ButtonGenerateTestData_OnClick\04319.def"
@@ -18,8 +18,6 @@
       CapacityAndSaleBudgeFilterMonth::InitializedData( GlobalOTDSOP );
       CapacityAndSaleBudgeFilterBusinessType::InitializedData( GlobalOTDSOP, GlobalOTDTable );
       CapacityAndSaleBudgeFilterPlaceOfProductionOfArray::InitializedData( GlobalOTDSOP, GlobalOTDTable );
-      
-      GlobalOTDTable.Global_MappingAnnualBudgetData( relflush );
     *]
     GroupServerCalls: false
   }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeChart/Component_ChartCapacityAndSaleBudgeChart.def b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeChart/Component_ChartCapacityAndSaleBudgeChart.def
index f3f605d..09249e2 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeChart/Component_ChartCapacityAndSaleBudgeChart.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeChart/Component_ChartCapacityAndSaleBudgeChart.def
@@ -81,5 +81,6 @@
   [
     ContextMenu: 'chartContextMenuCapacityAndSaleBudge'
     Taborder: 4
+    Title: '骞村害浜ч攢棰勭畻澶嶇洏'
   ]
 }
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeChart/Response_pFilterCriteria_ButtonCapacityAndSaleBudgeChartTest_OnClick\043603.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeChart/Response_pFilterCriteria_ButtonCapacityAndSaleBudgeChartTest_OnClick\043603.def"
index 761a489..8ff52d7 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeChart/Response_pFilterCriteria_ButtonCapacityAndSaleBudgeChartTest_OnClick\043603.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeChart/Response_pFilterCriteria_ButtonCapacityAndSaleBudgeChartTest_OnClick\043603.def"
@@ -9,17 +9,32 @@
   {
     Body:
     [*
-      //CapacityAndSaleBudgeChartElement::TestData( GlobalOTDTable );
+      targetCapacityAndSaleBudgeFilterItem := selectset( GlobalOTDSOP, CapacityAndSaleBudgeFilterItem, tempCASBFI, 
+                                                         exists( DataHolderCapacityAndSaleBudgeFilterItem.Data(), Elements, tempCASBFI1, tempCASBFI1 = tempCASBFI ) );
+      
+      targetCapacityAndSaleBudgeFilterPlaceOfProductionOfArray := selectset( GlobalOTDSOP, CapacityAndSaleBudgeFilterPlaceOfProductionOfArray, tempCASBFPOPOA, 
+                                                         exists( DataHolderCapacityAndSaleBudgeFilterPlaceOfProductionOfArray.Data(), Elements, tempCASBFPOPOA1, tempCASBFPOPOA1 = tempCASBFPOPOA ) );
+      
+      targetCapacityAndSaleBudgeFilterBusinessType := selectset( GlobalOTDSOP, CapacityAndSaleBudgeFilterBusinessType, tempCASBFBT, 
+                                                         exists( DataHolderCapacityAndSaleBudgeFilterBusinessType.Data(), Elements, tempCASBFBT1, tempCASBFBT1 = tempCASBFBT ) );
+      
+      targetCapacityAndSaleBudgeFilterYear := selectset( GlobalOTDSOP, CapacityAndSaleBudgeFilterYear, tempCASBFY, 
+                                                         exists( DataHolderCapacityAndSaleBudgeFilterYear.Data(), Elements, tempCASBFY1, tempCASBFY1 = tempCASBFY ) );
+      
+      targetCapacityAndSaleBudgeFilterMonth := selectset( GlobalOTDSOP, CapacityAndSaleBudgeFilterMonth, tempCASBFM, 
+                                                         exists( DataHolderCapacityAndSaleBudgeFilterMonth.Data(), Elements, tempCASBFM1, tempCASBFM1 = tempCASBFM ) );
       
       GlobalOTDSOP.CapacityAndSaleBudgeChart( DataHolderMacroPlansForScenarioComparison.Data(), 
                                               DropDownSaleOrCapacity.Text(),
                                               DropDownTimeGroup.Text(),
                                               DropDownByBusinessTypeOrByOrgCode.Text(),
-                                              DataHolderCapacityAndSaleBudgeFilterBusinessType.Data(),
-                                              DataHolderCapacityAndSaleBudgeFilterPlaceOfProductionOfArray.Data(),
-                                              DataHolderCapacityAndSaleBudgeFilterYear.Data(),
-                                              DataHolderCapacityAndSaleBudgeFilterMonth.Data(),
-                                              GlobalOTDTable );
+                                              &targetCapacityAndSaleBudgeFilterItem,
+                                              &targetCapacityAndSaleBudgeFilterPlaceOfProductionOfArray,
+                                              &targetCapacityAndSaleBudgeFilterBusinessType,
+                                              &targetCapacityAndSaleBudgeFilterYear,
+                                              &targetCapacityAndSaleBudgeFilterMonth,
+                                              GlobalOTDTable 
+                                             );
     *]
     GroupServerCalls: false
   }
diff --git "a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Response_pButton_ButtonCapacityAndSaleBudgeCompare_OnClick\043231.def" "b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Response_pButton_ButtonCapacityAndSaleBudgeCompare_OnClick\043231.def"
index a683e63..2b22dca 100644
--- "a/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Response_pButton_ButtonCapacityAndSaleBudgeCompare_OnClick\043231.def"
+++ "b/_Main/UI/MacroPlannerWebApp/Component_FormCapacityAndSaleBudgeCompare/Response_pButton_ButtonCapacityAndSaleBudgeCompare_OnClick\043231.def"
@@ -9,10 +9,28 @@
   {
     Body:
     [*
+      targetCapacityAndSaleBudgeFilterItem := selectset( GlobalOTDSOP, CapacityAndSaleBudgeFilterItem, tempCASBFI, 
+                                                         exists( DataHolderCapacityAndSaleBudgeFilterItem.Data(), Elements, tempCASBFI1, tempCASBFI1 = tempCASBFI ) );
+      
+      targetCapacityAndSaleBudgeFilterPlaceOfProductionOfArray := selectset( GlobalOTDSOP, CapacityAndSaleBudgeFilterPlaceOfProductionOfArray, tempCASBFPOPOA, 
+                                                         exists( DataHolderCapacityAndSaleBudgeFilterPlaceOfProductionOfArray.Data(), Elements, tempCASBFPOPOA1, tempCASBFPOPOA1 = tempCASBFPOPOA ) );
+      
+      targetCapacityAndSaleBudgeFilterBusinessType := selectset( GlobalOTDSOP, CapacityAndSaleBudgeFilterBusinessType, tempCASBFBT, 
+                                                         exists( DataHolderCapacityAndSaleBudgeFilterBusinessType.Data(), Elements, tempCASBFBT1, tempCASBFBT1 = tempCASBFBT ) );
+      
+      targetCapacityAndSaleBudgeFilterYear := selectset( GlobalOTDSOP, CapacityAndSaleBudgeFilterYear, tempCASBFY, 
+                                                         exists( DataHolderCapacityAndSaleBudgeFilterYear.Data(), Elements, tempCASBFY1, tempCASBFY1 = tempCASBFY ) );
+      
+      targetCapacityAndSaleBudgeFilterMonth := selectset( GlobalOTDSOP, CapacityAndSaleBudgeFilterMonth, tempCASBFM, 
+                                                         exists( DataHolderCapacityAndSaleBudgeFilterMonth.Data(), Elements, tempCASBFM1, tempCASBFM1 = tempCASBFM ) );
+      
+      
       GlobalOTDSOP.CapacityAndSaleBudgeCompare( DataHolderMacroPlansForScenarioComparison.Data(), 
-                                                DataHolderCapacityAndSaleBudgeFilterItem.Data(), 
-                                                DataHolderCapacityAndSaleBudgeFilterYear.Data(), 
-                                                DataHolderCapacityAndSaleBudgeFilterMonth.Data(),
+                                                &targetCapacityAndSaleBudgeFilterItem,
+                                                &targetCapacityAndSaleBudgeFilterPlaceOfProductionOfArray,
+                                                &targetCapacityAndSaleBudgeFilterBusinessType,
+                                                &targetCapacityAndSaleBudgeFilterYear, 
+                                                &targetCapacityAndSaleBudgeFilterMonth,
                                                 GlobalOTDTable );
     *]
     GroupServerCalls: false
diff --git "a/_Main/UI/MacroPlannerWebApp/Views/Pegging\345\210\206\346\236\220.vw" "b/_Main/UI/MacroPlannerWebApp/Views/Pegging\345\210\206\346\236\220.vw"
index 8853861..7477409 100644
--- "a/_Main/UI/MacroPlannerWebApp/Views/Pegging\345\210\206\346\236\220.vw"
+++ "b/_Main/UI/MacroPlannerWebApp/Views/Pegging\345\210\206\346\236\220.vw"
@@ -239,7 +239,7 @@
           FormPeggingAllResult_DataSetLevelPeggingAllResult
           {
             groupDepth: 2
-            sort: 'StartDate'
+            sort: 'ProductID,StockingPointID,StartDate'
             column_PeggingProductInSalesDemandBase_SalesDemandBaseID
             {
               columnId: 'PeggingProductInSalesDemandBase.SalesDemandBaseID'
@@ -328,10 +328,10 @@
     userconfigurableinformation
     {
     }
-    image: 'VIEW'
     page: ''
     group: ''
     index: 0
+    image: 'VIEW'
     description: ''
   }
   formatversion: 2
diff --git "a/_Main/UI/MacroPlannerWebApp/Views/\345\271\264\345\272\246\344\272\247\351\224\200\345\244\215\347\233\230.vw" "b/_Main/UI/MacroPlannerWebApp/Views/\345\271\264\345\272\246\344\272\247\351\224\200\345\244\215\347\233\230.vw"
index 0516c1b..7558c72 100644
--- "a/_Main/UI/MacroPlannerWebApp/Views/\345\271\264\345\272\246\344\272\247\351\224\200\345\244\215\347\233\230.vw"
+++ "b/_Main/UI/MacroPlannerWebApp/Views/\345\271\264\345\272\246\344\272\247\351\224\200\345\244\215\347\233\230.vw"
@@ -156,7 +156,7 @@
           FormCapacityAndSaleBudgeFilterItem_DataSetLevelCapacityAndSaleBudgeFilterItem
           {
             groupDepth: -1
-            sort: 'ItemName'
+            sort: 'DESC:ItemName'
             column_ItemName
             {
               columnId: 'ItemName'
@@ -221,6 +221,7 @@
           FormCapacityAndSaleBudgeFilterPlaceOfProductionOfArray_DataSetLevelCapacityAndSaleBudgeFilterPlaceOfProductionOfArray
           {
             groupDepth: -1
+            sort: 'DESC:PlaceOfProductionOfArray'
             column_PlaceOfProductionOfArray
             {
               columnId: 'PlaceOfProductionOfArray'
@@ -287,6 +288,7 @@
           FormCapacityAndSaleBudgeFilterBusinessType_DataSetLevelCapacityAndSaleBudgeFilterBusinessType
           {
             groupDepth: -1
+            sort: 'DESC:BusinessType'
             column_BusinessType
             {
               columnId: 'BusinessType'
@@ -369,10 +371,10 @@
     userconfigurableinformation
     {
     }
-    image: 'PIG'
     page: ''
     group: ''
     index: 0
+    image: 'PIG'
     description: ''
   }
   formatversion: 2
diff --git "a/_var/_Main/ProjSettings/MacroPlanner/Views/X_\345\210\206\346\236\220\350\247\206\345\233\276_\133414702.1.50321581\135.vw" "b/_var/_Main/ProjSettings/MacroPlanner/Views/X_\345\210\206\346\236\220\350\247\206\345\233\276_\133414702.1.50321581\135.vw"
index 4035f35..2db39ee 100644
--- "a/_var/_Main/ProjSettings/MacroPlanner/Views/X_\345\210\206\346\236\220\350\247\206\345\233\276_\133414702.1.50321581\135.vw"
+++ "b/_var/_Main/ProjSettings/MacroPlanner/Views/X_\345\210\206\346\236\220\350\247\206\345\233\276_\133414702.1.50321581\135.vw"
@@ -16,7 +16,7 @@
   CREATIONUSER 'quintiq/hongjli'
   UPDATEDATETIME '2023-11-01T11:42:14'
   UPDATEUSER 'quintiq/hongjli'
-  LASTACCESSDATE '2023-11-02'
+  LASTACCESSDATE '2023-11-03'
   VIEWSCOPE 0
 }
 AUTHORIZATIONS

--
Gitblit v1.9.3