From a5b7c787696906ae51ed5e3f909c4581055944fe Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期三, 26 六月 2024 16:47:30 +0800
Subject: [PATCH] 财务产量报表合计显示完成

---
 _Main/BL/Type_FinancialProductionSource/Method_IsExistFutureMonthData.qbl                                                                            |   12 +++
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_ButtonExport_OnClick.def                                    |    2 
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelFinancialProductionReportOperation_ButtonProductionExport_OnCl.def |    2 
 _Main/BL/Type_FinancialProductionReport/Method_GenerateColumn.qbl                                                                                    |   20 +++++
 _Main/BL/InfoMessages.qbl                                                                                                                            |    4 +
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_OnCreated.def                                                           |    8 +-
 _Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl                                                                                  |   19 +++-
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelFinancialProductionReportOperation_ButtonProductionImport_OnCl.def |    6 +
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelUnit_ddslUnit_OnCreated.def                                        |    2 
 _Main/BL/Type_FinancialProductionReport/Method_Clear.qbl                                                                                             |   13 +++
 _Main/BL/Type_FinancialProductionSource/Method_AfterImport.qbl                                                                                       |   11 +-
 _Main/BL/Type_FinancialProductionReport/Method_Generate.qbl                                                                                          |   44 +++++++++++
 _Main/BL/Type_FinancialProductionSource/Method_ReadStructure.qbl                                                                                     |    2 
 _Main/BL/Type_FinancialProductionSource/StaticMethod_DownloadTemplate.qbl                                                                            |    4 
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Component_MatrixEditorTable.def                                                  |    4 
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelGeneration_ddslGeneration_OnSelectionChanged.def                   |    5 +
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelPower_ddslPower_OnSelectionChanged.def                             |    5 +
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelMQBMLB_ddslMQBMLB_OnSelectionChanged.def                           |    5 +
 _Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelUnit_ddslUnit_OnSelectionChanged.def                               |    5 +
 _Main/BL/Type_FinancialProductionSource/StaticMethod_Download.qbl                                                                                    |   18 +---
 _Main/BL/Type_FinancialProductionReport/Attribute_IsShow.qbl                                                                                         |    7 +
 21 files changed, 160 insertions(+), 38 deletions(-)

diff --git a/_Main/BL/InfoMessages.qbl b/_Main/BL/InfoMessages.qbl
index c2762b7..79e2d9c 100644
--- a/_Main/BL/InfoMessages.qbl
+++ b/_Main/BL/InfoMessages.qbl
@@ -98,6 +98,10 @@
   {
     DefaultText: 'The two products selected are the same.'
   }
+  InfoMessage MP_FinancialProductionReport_Question
+  {
+    DefaultText: '瀵煎叆妯℃澘鍖呭惈鏈潵鏈堜唤鐨勮储鍔℃暟鎹紝鏄惁瑕嗙洊绯荤粺璁$畻缁撴灉锛�'
+  }
   InfoMessage MP_LibCal_EventType_Exist
   {
     DefaultText: 'The ID or name is the same.'
diff --git a/_Main/BL/Type_FinancialProductionReport/Attribute_IsShow.qbl b/_Main/BL/Type_FinancialProductionReport/Attribute_IsShow.qbl
new file mode 100644
index 0000000..7d5bdf3
--- /dev/null
+++ b/_Main/BL/Type_FinancialProductionReport/Attribute_IsShow.qbl
@@ -0,0 +1,7 @@
+Quintiq file version 2.0
+#parent: #root
+Attribute IsShow
+{
+  #keys: '3[415136.0.853939545][415136.0.853939544][415136.0.853939546]'
+  ValueType: Boolean
+}
diff --git a/_Main/BL/Type_FinancialProductionReport/Method_Clear.qbl b/_Main/BL/Type_FinancialProductionReport/Method_Clear.qbl
new file mode 100644
index 0000000..a629770
--- /dev/null
+++ b/_Main/BL/Type_FinancialProductionReport/Method_Clear.qbl
@@ -0,0 +1,13 @@
+Quintiq file version 2.0
+#parent: #root
+Method Clear
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jun-25-2024 (created)
+    this.FinancialProductionColumn( relflush );
+    this.FinancialProductionRow( relflush );
+    
+    this.GenerateColumn( this.FinancialProductionSource().MacroPlan() );
+  *]
+}
diff --git a/_Main/BL/Type_FinancialProductionReport/Method_Generate.qbl b/_Main/BL/Type_FinancialProductionReport/Method_Generate.qbl
new file mode 100644
index 0000000..8ed085f
--- /dev/null
+++ b/_Main/BL/Type_FinancialProductionReport/Method_Generate.qbl
@@ -0,0 +1,44 @@
+Quintiq file version 2.0
+#parent: #root
+Method Generate (
+  FinancialProductionSearch search,
+  Product_MPs products
+)
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jun-25-2024 (created)
+    table      := selectobject( this, FinancialProductionSource.FinancialProductionReport, report, not report.IsShow() );
+    allunit    := '<All>';
+    //娓呯┖涔嬪墠瀛樺偍鐨勬樉绀烘暟鎹�
+    this.Clear();
+    //杩囨护鍚庣殑浜у搧id
+    productids := selectuniquevalues( products, Elements, product, ( search.Generation() = allunit or product.Generation() = search.Generation() )
+                                      and ( search.MqbMlb() = allunit or product.MQBMLB() = search.MqbMlb() )
+                                      and ( search.Power() = allunit or product.Power() = search.Power() ), product.ID() );
+    sumrow     := this.FinancialProductionRow( relnew, Name := 'SUM', Unit := search.Unit(), RowNr := table.FinancialProductionRow( relsize ) );
+    traverse( table, FinancialProductionRow, row, row.Unit() = search.Unit() ){
+      productid  := construct( Strings );
+      productid.Add( row.Name() );
+      
+      if( productids.ContainsAll( productid ) ){
+        showrow := this.FinancialProductionRow( relnew, Name := row.Name(), Unit := row.Unit(), RowNr := row.RowNr() );
+        
+        traverse( row, FinancialProductionCell, cell ){
+          column   := selectobject( this, FinancialProductionColumn, column, column.Name() = cell.FinancialProductionColumn().Name() );
+          
+          sumcell  := selectobject( column, FinancialProductionCell, c, c.FinancialProductionRow() = sumrow );
+          if( isnull( sumcell ) ){
+            sumcell := column.FinancialProductionCell( relnew, Value := '0' );
+            sumrow.FinancialProductionCell( relinsert, sumcell );
+          }
+          
+          showcell := column.FinancialProductionCell( relnew, Value := cell.Value() );
+          showrow.FinancialProductionCell( relinsert, showcell );
+          value := [Real]cell.Value() + [Real]sumcell.Value();
+          sumcell.Value( [String]value );
+        }
+      }
+    }
+  *]
+}
diff --git a/_Main/BL/Type_FinancialProductionReport/Method_GenerateColumn.qbl b/_Main/BL/Type_FinancialProductionReport/Method_GenerateColumn.qbl
new file mode 100644
index 0000000..85b473e
--- /dev/null
+++ b/_Main/BL/Type_FinancialProductionReport/Method_GenerateColumn.qbl
@@ -0,0 +1,20 @@
+Quintiq file version 2.0
+#parent: #root
+Method GenerateColumn (
+  MacroPlan owner
+)
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jun-25-2024 (created)
+    startofplanning           := owner.StartOfPlanning();
+    startofyear               := startofplanning.StartOfYear();
+    startofnextyear           := startofplanning.StartOfNextYear();
+    
+    for( start := startofyear; start < startofnextyear; start := start.StartOfNextMonth() ){
+      periodtime := start.Date();
+      periodname := periodtime.Format( "M2/D2/Y" );
+      this.FinancialProductionColumn( relnew, Name := periodname, Period := periodtime );
+    }
+  *]
+}
diff --git a/_Main/BL/Type_FinancialProductionSource/Method_AfterImport.qbl b/_Main/BL/Type_FinancialProductionSource/Method_AfterImport.qbl
index b5170ce..3d1ed85 100644
--- a/_Main/BL/Type_FinancialProductionSource/Method_AfterImport.qbl
+++ b/_Main/BL/Type_FinancialProductionSource/Method_AfterImport.qbl
@@ -6,24 +6,27 @@
   [*
     // 鐢勫叞楦� Jun-24-2024 (created)
     allunit := FinancialProductionReport::GetDefaultAllUnit();
-    table   := selectobject( this.MacroPlan(), FinancialProductionSource.FinancialProductionReport, table, not table.IsImport() );
+    table   := selectobject( this.MacroPlan(), FinancialProductionSource.FinancialProductionReport, table, not table.IsImport() and not table.IsShow() );
     //info( '--------------------------', table.Name() );
     traverse( this, FinancialProductionReport, report ){
       productcolumn := selectobject( report, FinancialProductionColumn, column, column.Name() = 'Product' );
       unitcolumn    := selectobject( report, FinancialProductionColumn, column, column.Name() = 'Unit' );
+    //  info( '----------------------1-----------------', productcolumn.Name(), unitcolumn.Name() );
       
       traverse( report, FinancialProductionRow, row ){
         product := selectobject( row, FinancialProductionCell, cell, cell.FinancialProductionColumn() = productcolumn );
         unit    := selectobject( row, FinancialProductionCell, cell, cell.FinancialProductionColumn() = unitcolumn );
+    //    info( '----------------------2-----------------', product.Value(), unit.Value() );
         
         unitrow := selectobject( table, FinancialProductionRow, unitrow, unitrow.Name() = product.Value() and unitrow.Unit() = unit.Value() );
         allrow  := selectobject( table, FinancialProductionRow, allrow, allrow.Name() = product.Value() and allrow.Unit() = allunit );
-        
-        traverse( row, FinancialProductionCell, cell, cell.FinancialProductionColumn() <> productcolumn and cell.FinancialProductionColumn() <> unitcolumn and product.Value() = '120 kW Rotor' and unit.Value() = 'Assembly Plant (Spain)' ){
+    //    info( '----------------------3-----------------', unitrow.Name(), unitrow.Unit() );
+        // and product.Value() = '120 kW Rotor' and unit.Value() = 'Assembly Plant (Spain)'
+        traverse( row, FinancialProductionCell, cell, cell.FinancialProductionColumn() <> productcolumn and cell.FinancialProductionColumn() <> unitcolumn ){
           column   := cell.FinancialProductionColumn();
           unitcell := selectobject( unitrow, FinancialProductionCell, unitcell, unitcell.FinancialProductionColumn().Name() = column.Name() );
           allcell  := selectobject( allrow, FinancialProductionCell, allcell, allcell.FinancialProductionColumn().Name() = column.Name() );
-          info( isnull( unitcell ), isnull( allcell ), cell.Value(), unitcell.Value(), allcell.Value() );
+    //      info( isnull( unitcell ), isnull( allcell ), cell.Value(), unitcell.Value(), allcell.Value() );
           if( not isnull( unitcell ) ){
             unitcell.Value( cell.Value() );
           }
diff --git a/_Main/BL/Type_FinancialProductionSource/Method_IsExistFutureMonthData.qbl b/_Main/BL/Type_FinancialProductionSource/Method_IsExistFutureMonthData.qbl
new file mode 100644
index 0000000..af99ca3
--- /dev/null
+++ b/_Main/BL/Type_FinancialProductionSource/Method_IsExistFutureMonthData.qbl
@@ -0,0 +1,12 @@
+Quintiq file version 2.0
+#parent: #root
+Method IsExistFutureMonthData () as Boolean
+{
+  TextBody:
+  [*
+    // 鐢勫叞楦� Jun-26-2024 (created)
+    startofplanning := this.MacroPlan().StartOfPlanning().Date().Format( 'M2/D2/Y' );
+    columns         := selectset( this, FinancialProductionReport.FinancialProductionColumn, column, column.Name() > startofplanning );
+    return exists( columns, Elements.FinancialProductionCell, cell, cell.Value() <> '' );
+  *]
+}
diff --git a/_Main/BL/Type_FinancialProductionSource/Method_ReadStructure.qbl b/_Main/BL/Type_FinancialProductionSource/Method_ReadStructure.qbl
index 9e66381..f5fdc53 100644
--- a/_Main/BL/Type_FinancialProductionSource/Method_ReadStructure.qbl
+++ b/_Main/BL/Type_FinancialProductionSource/Method_ReadStructure.qbl
@@ -26,6 +26,6 @@
       Transaction::Transaction().Propagate( attribute( FinancialProductionColumn, Index ) );
     }
     //瀵煎叆鍚庡鐞嗘暟鎹�
-    this.AfterImport();
+    //this.AfterImport();
   *]
 }
diff --git a/_Main/BL/Type_FinancialProductionSource/StaticMethod_Download.qbl b/_Main/BL/Type_FinancialProductionSource/StaticMethod_Download.qbl
index 102cea7..87f56b0 100644
--- a/_Main/BL/Type_FinancialProductionSource/StaticMethod_Download.qbl
+++ b/_Main/BL/Type_FinancialProductionSource/StaticMethod_Download.qbl
@@ -1,16 +1,14 @@
 Quintiq file version 2.0
 #parent: #root
 StaticMethod Download (
-  MacroPlan macroPlan,
-  Boolean istemplate
+  MacroPlan macroPlan
 ) as BinaryValue
 {
   Description: '涓嬭浇璐㈠姟鎶ヨ〃鏁版嵁'
   TextBody:
   [*
-    startofplanning := macroPlan.StartOfPlanning().Date();
-    allunit         := FinancialProductionReport::GetDefaultAllUnit();
-    table := selectobject( macroPlan, FinancialProductionSource.FinancialProductionReport, table, not table.IsImport() );
+    
+    table := selectobject( macroPlan, FinancialProductionSource.FinancialProductionReport, table, not table.IsImport() and table.IsShow() );
     
     xmlDOMI := XMLDOMImplementation::Create();
     xmlDOM  := xmlDOMI.CreateDocumentFromString( '<?xml version="1.0" encoding="UTF-16"?><table><name>' + table.Name() + '</name></table>' );
@@ -35,7 +33,7 @@
     
     tableElement.AppendChild( productcolumnelement ); 
     tableElement.AppendChild( unitcolumnelement ); 
-    traverse ( table, FinancialProductionColumn, column, not istemplate or column.Period() < startofplanning ) {
+    traverse ( table, FinancialProductionColumn, column ) {
       columnelement := xmlDOM.CreateElement( "column" );
       nameelement   := xmlDOM.CreateElement( "name" );
       typeelement   := xmlDOM.CreateElement( "type" );
@@ -44,7 +42,7 @@
       columnelement.AppendChild( nameelement );
       columnelement.AppendChild( typeelement );
       
-      cells := selectsortedset( column, FinancialProductionCell, cell, cell.FinancialProductionRow().Unit() <> allunit, cell.FinancialProductionRow().Name() );
+      cells := selectsortedset( column, FinancialProductionCell, cell, cell.FinancialProductionRow().RowNr() );
     
       traverse ( cells, Elements, c ) {
         if( column.Index() = 0 ){
@@ -59,11 +57,7 @@
           unitcolumnelement.AppendChild( unitcellElement );
         }
         cellElement := xmlDOM.CreateElement( "cell" );
-        if( istemplate ){
-          cellElement.SetAttribute( "value", '' );
-        }else{
-          cellElement.SetAttribute( "value", c.Value() ); 
-        }
+        cellElement.SetAttribute( "value", c.Value() ); 
         columnelement.AppendChild( cellElement );
       }
       tableElement.AppendChild( columnelement );  
diff --git a/_Main/BL/Type_FinancialProductionSource/StaticMethod_DownloadTemplate.qbl b/_Main/BL/Type_FinancialProductionSource/StaticMethod_DownloadTemplate.qbl
index 6952017..10e878b 100644
--- a/_Main/BL/Type_FinancialProductionSource/StaticMethod_DownloadTemplate.qbl
+++ b/_Main/BL/Type_FinancialProductionSource/StaticMethod_DownloadTemplate.qbl
@@ -12,9 +12,9 @@
     tableElement              := xmlDOM.GetElementByTagName( "table", 0 );
     
     startofyear               := macroPlan.StartOfPlanning().StartOfYear();
-    startofplanning           := macroPlan.StartOfPlanning();
+    startofnextyear           := macroPlan.StartOfPlanning().StartOfNextYear();
     
-    for( start := startofyear; start < startofplanning; start := start.StartOfNextMonth() ){
+    for( start := startofyear; start < startofnextyear; start := start.StartOfNextMonth() ){
       columnElement := xmlDOM.CreateElement( "column" );
       nameElement   := xmlDOM.CreateElement( "name" );
       typeElement   := xmlDOM.CreateElement( "type" );
diff --git a/_Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl b/_Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl
index 8f1db4a..7a5ef26 100644
--- a/_Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl
+++ b/_Main/BL/Type_FinancialProductionSource/StaticMethod_Initialize.qbl
@@ -13,12 +13,17 @@
     allunit                   := FinancialProductionReport::GetDefaultAllUnit();
     source                    := owner.FinancialProductionSource( relnew, IsImport := false, Name := FinancialProductionReport::GetDefaultName() );
     table                     := source.FinancialProductionReport( relnew, ID := source.Name(), Name := source.Name(), IsImport := false );
+    showtable                 := source.FinancialProductionReport( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsImport := false, IsShow := true );
     startofplanning           := owner.StartOfPlanning();
     startofnextmonth          := owner.StartOfPlanning().StartOfNextMonth();
     startofyear               := startofplanning.StartOfYear();
     startofnextyear           := startofplanning.StartOfNextYear();
     
-    source.FinancialProductionSearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit );
+    search                    := source.FinancialProductionSearch( relnew, Unit := allunit, Generation := allunit, MqbMlb := allunit, Power := allunit );
+    
+    products                  := construct( Product_MPs );
+    
+    table.GenerateColumn( owner );
     
     traverse( owner, Product_MP.ProductInStockingPoint_MP, pisp, pisp.Product_MP().IsLeaf() and ( pisp.StockingPoint_MP().UnitID() = ccunit or pisp.StockingPoint_MP().UnitID() = dlunit ) ){
       unit := pisp.StockingPoint_MP().UnitID();
@@ -32,6 +37,7 @@
         dlrow := table.FinancialProductionRow( relnew, Name := pisp.ProductID(), Unit := unit );
       }
       if( isnull( allrow ) ){
+        products.Add( pisp.Product_MP() );
         allrow := table.FinancialProductionRow( relnew, Name := pisp.ProductID(), Unit := allunit );
       }
       
@@ -39,10 +45,6 @@
         periodtime := start.Date();
         periodname := periodtime.Format( "M2/D2/Y" );
         column := selectobject( table, FinancialProductionColumn, column, column.Name() = periodname and column.Period() = periodtime );
-        
-        if( isnull( column ) ){
-          column := table.FinancialProductionColumn( relnew, Name := periodname, Period := periodtime );
-        }
         
         if( not isnull( ccrow ) ){
           ccrow.Initialize( column, ccunit );
@@ -72,5 +74,12 @@
         allrow.Initialize( column, pispip.NewSupplyProductionQuantity() );
       }
     }
+    rows := selectsortedset( table, FinancialProductionRow, row, row.Name() );
+    i    := 0;
+    traverse( rows, Elements, e ){
+      e.RowNr( i );
+      i := i + 1;
+    }
+    showtable.Generate( search, products );
   *]
 }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Component_MatrixEditorTable.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Component_MatrixEditorTable.def
index 8844548..2efd8dd 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Component_MatrixEditorTable.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Component_MatrixEditorTable.def
@@ -45,8 +45,6 @@
           Properties:
           [
             DataType: 'FinancialProductionReport'
-            FilterArguments: 'products:QLibMacroPlannerWebUI::ApplicationMacroPlanner.DataHolderProduct;search:QMacroPlanner::FormFinancialProductionReport.dhSearch'
-            FixedFilter: 'object.Filter( search, products )'
             Source: 'DataHolderTable'
             Taborder: 0
             Transformation: 'FinancialProductionRow'
@@ -56,7 +54,7 @@
       Properties:
       [
         Legend: 'Name'
-        SortCriteria: 'Name'
+        SortCriteria: 'RowNr'
         Taborder: 1
       ]
     }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_OnCreated.def
index e6d457a..62f7985 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_OnCreated.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_OnCreated.def
@@ -10,12 +10,12 @@
     Body:
     [*
       //鍒濆鍖�
-      //if( not exists( MacroPlan, FinancialProductionSource, source, not source.IsImport() ) ){
+      if( not exists( MacroPlan, FinancialProductionSource, source, not source.IsImport() ) ){
         FinancialProductionSource::Initialize( MacroPlan );
-      //}
+      }
       //info( '------------------1----------------' );
-      table := selectobject( MacroPlan, FinancialProductionSource.FinancialProductionReport, table, not table.IsImport() );
-      //info( '------------------2----------------' );
+      table := selectobject( MacroPlan, FinancialProductionSource.FinancialProductionReport, table, not table.IsImport() and table.IsShow() );
+      info( '------------------2----------------', table.IsImport(), table.IsShow() );
       DataHolderTable.Data( table );
       
       dhSearch.Data( table.FinancialProductionSource().FinancialProductionSearch() );
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_ButtonExport_OnClick.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_ButtonExport_OnClick.def
index 174cd83..13d7fd4 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_ButtonExport_OnClick.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelExport_ButtonExport_OnClick.def
@@ -13,7 +13,7 @@
   {
     Body:
     [*
-      binaryValue := FinancialProductionSource::Download( MacroPlan, false );
+      binaryValue := FinancialProductionSource::Download( MacroPlan );
       
       Application.Download( "Financial productions.xlsx", binaryValue.AsBinaryData() );
     *]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelFinancialProductionReportOperation_ButtonProductionExport_OnCl.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelFinancialProductionReportOperation_ButtonProductionExport_OnCl.def
index e78b4e0..176b03b 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelFinancialProductionReportOperation_ButtonProductionExport_OnCl.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelFinancialProductionReportOperation_ButtonProductionExport_OnCl.def
@@ -13,7 +13,7 @@
   {
     Body:
     [*
-      binaryValue := FinancialProductionSource::Download( MacroPlan, true );
+      binaryValue := FinancialProductionSource::DownloadTemplate( MacroPlan );
       
       Application.Download( "Financial productions.xlsx", binaryValue.AsBinaryData() );
     *]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelFinancialProductionReportOperation_ButtonProductionImport_OnCl.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelFinancialProductionReportOperation_ButtonProductionImport_OnCl.def
index eece9c0..53c7632 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelFinancialProductionReportOperation_ButtonProductionImport_OnCl.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelFinancialProductionReportOperation_ButtonProductionImport_OnCl.def
@@ -27,6 +27,12 @@
           source := FinancialProductionSource::Upload( MacroPlan, webFileBinaryData, fileName );
           source.ReadStructure();
           
+          if( not source.IsExistFutureMonthData() or 
+              ( source.IsExistFutureMonthData() and WebMessageBox::Question( this, Translations::MP_FinancialProductionReport_Question(), 'Yes|No' ) = 0 ) ){
+             source.AfterImport();
+             DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
+          }
+          
           WebMessageBox::Success( Translations::A_VWED_Success() );
           traverse( MacroPlan, FinancialProductionSource, psource, psource.IsImport() and psource <> source ){
             psource.Delete();
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelGeneration_ddslGeneration_OnSelectionChanged.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelGeneration_ddslGeneration_OnSelectionChanged.def
index 8ab2cf7..b299a53 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelGeneration_ddslGeneration_OnSelectionChanged.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelGeneration_ddslGeneration_OnSelectionChanged.def
@@ -9,7 +9,10 @@
   {
     Body:
     [*
-      dhSearch.Data().Generation( selection );
+      if( dhSearch.Data().Generation() <> selection ){
+        dhSearch.Data().Generation( selection );
+        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
+      }
     *]
     GroupServerCalls: false
   }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelMQBMLB_ddslMQBMLB_OnSelectionChanged.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelMQBMLB_ddslMQBMLB_OnSelectionChanged.def
index 7cfb83f..972e396 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelMQBMLB_ddslMQBMLB_OnSelectionChanged.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelMQBMLB_ddslMQBMLB_OnSelectionChanged.def
@@ -9,7 +9,10 @@
   {
     Body:
     [*
-      dhSearch.Data().MqbMlb( selection );
+      if( dhSearch.Data().MqbMlb() <> selection ){
+        dhSearch.Data().MqbMlb( selection );
+        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
+      }
     *]
     GroupServerCalls: false
   }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelPower_ddslPower_OnSelectionChanged.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelPower_ddslPower_OnSelectionChanged.def
index c87e89d..782939b 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelPower_ddslPower_OnSelectionChanged.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelPower_ddslPower_OnSelectionChanged.def
@@ -9,7 +9,10 @@
   {
     Body:
     [*
-      dhSearch.Data().Power( selection );
+      if( dhSearch.Data().Power() <> selection ){
+        dhSearch.Data().Power( selection );
+        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
+      }
     *]
     GroupServerCalls: false
   }
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelUnit_ddslUnit_OnCreated.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelUnit_ddslUnit_OnCreated.def
index a70ff22..f6c7ab5 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelUnit_ddslUnit_OnCreated.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelUnit_ddslUnit_OnCreated.def
@@ -10,7 +10,7 @@
     Body:
     [*
       
-      valueString := "<All>;Spider Assy Line 1;Body in White Line 3";
+      valueString := "<All>;" + FinancialProductionReport::GetDefaultCCUnit() + ";" + FinancialProductionReport::GetDefaultDLUnit();
       
       this.Strings( valueString );
     *]
diff --git a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelUnit_ddslUnit_OnSelectionChanged.def b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelUnit_ddslUnit_OnSelectionChanged.def
index 9e84672..7fbf5de 100644
--- a/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelUnit_ddslUnit_OnSelectionChanged.def
+++ b/_Main/UI/MacroPlannerWebApp/Component_FormFinancialProductionReport/Response_PanelUnit_ddslUnit_OnSelectionChanged.def
@@ -9,7 +9,10 @@
   {
     Body:
     [*
-      dhSearch.Data().Unit( selection );
+      if( dhSearch.Data().Unit() <> selection ){
+        dhSearch.Data().Unit( selection );
+        DataHolderTable.Data().Generate( dhSearch.Data(), DataHolderProduct.Data() );
+      }
     *]
     GroupServerCalls: false
   }

--
Gitblit v1.9.3