From 19e23a072fd48b81abb745cb5c8e8cd406cab9c9 Mon Sep 17 00:00:00 2001
From: lazhen <17772815105@139.com>
Date: 星期五, 18 十月 2024 12:34:20 +0800
Subject: [PATCH] 财务产量/销量,库存汇总的导出bug

---
 _Main/BL/Type_FinancialSalesSource/StaticMethod_Download.qbl |   95 +++++++++++++++++++++++++++--------------------
 1 files changed, 54 insertions(+), 41 deletions(-)

diff --git a/_Main/BL/Type_FinancialSalesSource/StaticMethod_Download.qbl b/_Main/BL/Type_FinancialSalesSource/StaticMethod_Download.qbl
index 1bdd2e2..6edd436 100644
--- a/_Main/BL/Type_FinancialSalesSource/StaticMethod_Download.qbl
+++ b/_Main/BL/Type_FinancialSalesSource/StaticMethod_Download.qbl
@@ -12,32 +12,32 @@
   TextBody:
   [*
     
-    table := selectobject( macroPlan, FinancialSalesSource.FinancialSalesReport, table, not table.IsImport() and table.IsShow() );
+    table                         := selectobject( macroPlan, FinancialSalesSource.FinancialSalesReport, 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>' );
+    xmlDOMI                       := XMLDOMImplementation::Create();
+    xmlDOM                        := xmlDOMI.CreateDocumentFromString( '<?xml version="1.0" encoding="UTF-16"?><table><name>' + table.Name() + '</name></table>' );
     
-    tableElement := xmlDOM.GetElementByTagName( "table", 0 );
+    tableElement                  := xmlDOM.GetElementByTagName( "table", 0 );
     //Search
-    searchcolumnelement := xmlDOM.CreateElement( "column" );
-    searchnameelement   := xmlDOM.CreateElement( "name" );
-    searchtypeelement   := xmlDOM.CreateElement( "type" );
+    searchcolumnelement           := xmlDOM.CreateElement( "column" );
+    searchnameelement             := xmlDOM.CreateElement( "name" );
+    searchtypeelement             := xmlDOM.CreateElement( "type" );
     searchnameelement.TextContent( 'Search' );
     searchtypeelement.TextContent( "String" );
     searchcolumnelement.AppendChild( searchnameelement );
     searchcolumnelement.AppendChild( searchtypeelement );
     //Product
-    productcolumnelement := xmlDOM.CreateElement( "column" );
-    productnameelement   := xmlDOM.CreateElement( "name" );
-    producttypeelement   := xmlDOM.CreateElement( "type" );
+    productcolumnelement          := xmlDOM.CreateElement( "column" );
+    productnameelement            := xmlDOM.CreateElement( "name" );
+    producttypeelement            := xmlDOM.CreateElement( "type" );
     productnameelement.TextContent( 'Product' );
     producttypeelement.TextContent( "String" );
     productcolumnelement.AppendChild( productnameelement );
     productcolumnelement.AppendChild( producttypeelement );
     //Unit
-    unitcolumnelement := xmlDOM.CreateElement( "column" );
-    unitnameelement   := xmlDOM.CreateElement( "name" );
-    unittypeelement   := xmlDOM.CreateElement( "type" );
+    unitcolumnelement             := xmlDOM.CreateElement( "column" );
+    unitnameelement               := xmlDOM.CreateElement( "name" );
+    unittypeelement               := xmlDOM.CreateElement( "type" );
     unitnameelement.TextContent( 'Unit' );
     unittypeelement.TextContent( "String" );
     unitcolumnelement.AppendChild( unitnameelement );
@@ -46,44 +46,51 @@
     tableElement.AppendChild( searchcolumnelement ); 
     tableElement.AppendChild( productcolumnelement ); 
     tableElement.AppendChild( unitcolumnelement ); 
-    searchtotal     := factorys.Size() + generations.Size() + powers.Size() + mlbmqls.Size() + 4 ;
-    searchunitElement := xmlDOM.CreateElement( "cell" );
+    searchtotal                   := factorys.Size() + generations.Size() + powers.Size() + mlbmqls.Size() + 4 ;
+    searchunitElement             := xmlDOM.CreateElement( "cell" );
     searchunitElement.SetAttribute( "value", 'Unit' );
     searchcolumnelement.AppendChild( searchunitElement );
     traverse( factorys, Elements, factory ){
-      searchunitcellElement := xmlDOM.CreateElement( "cell" );
+      searchunitcellElement       := xmlDOM.CreateElement( "cell" );
       searchunitcellElement.SetAttribute( "value", factory.Name() );
       searchcolumnelement.AppendChild( searchunitcellElement );
     }
-    searchgenerationElement := xmlDOM.CreateElement( "cell" );
+    searchgenerationElement       := xmlDOM.CreateElement( "cell" );
     searchgenerationElement.SetAttribute( "value", 'Generation' );
     searchcolumnelement.AppendChild( searchgenerationElement );
     traverse( generations, Elements, generation ){
-      generationcellElement := xmlDOM.CreateElement( "cell" );
+      generationcellElement       := xmlDOM.CreateElement( "cell" );
       generationcellElement.SetAttribute( "value", generation.Generation() );
       searchcolumnelement.AppendChild( generationcellElement );
     }
-    searchpowerElement := xmlDOM.CreateElement( "cell" );
+    searchpowerElement            := xmlDOM.CreateElement( "cell" );
     searchpowerElement.SetAttribute( "value", 'Power' );
     searchcolumnelement.AppendChild( searchpowerElement );
     traverse( powers, Elements, power ){
-      searchpowercellElement := xmlDOM.CreateElement( "cell" );
+      searchpowercellElement      := xmlDOM.CreateElement( "cell" );
       searchpowercellElement.SetAttribute( "value", power.Power() );
       searchcolumnelement.AppendChild( searchpowercellElement );
     }
-    searchmlbmqlElement := xmlDOM.CreateElement( "cell" );
+    searchmlbmqlElement           := xmlDOM.CreateElement( "cell" );
     searchmlbmqlElement.SetAttribute( "value", 'MQBMLB' );
     searchcolumnelement.AppendChild( searchmlbmqlElement );
     traverse( mlbmqls, Elements, mlbmql ){
-      searchmlbmqlcellElement := xmlDOM.CreateElement( "cell" );
+      searchmlbmqlcellElement     := xmlDOM.CreateElement( "cell" );
       searchmlbmqlcellElement.SetAttribute( "value", mlbmql.MLBMQB() );
       searchcolumnelement.AppendChild( searchmlbmqlcellElement );
     }
+    
+    for( i := searchtotal; i < table.FinancialSalesRow( relsize ); i := i + 1 ){
+      searchcellElement           := xmlDOM.CreateElement( "cell" );
+      searchcellElement.SetAttribute( "value", '' );
+      searchcolumnelement.AppendChild( searchcellElement );
+    }
+    
     minindex        := min( table, FinancialSalesColumn, column, not column.IsDay(), column.Index() );
     traverse ( table, FinancialSalesColumn, column, not column.IsDay() ) {
-      columnelement := xmlDOM.CreateElement( "column" );
-      nameelement   := xmlDOM.CreateElement( "name" );
-      typeelement   := xmlDOM.CreateElement( "type" );
+      columnelement               := xmlDOM.CreateElement( "column" );
+      nameelement                 := xmlDOM.CreateElement( "name" );
+      typeelement                 := xmlDOM.CreateElement( "type" );
       nameelement.TextContent( column.Name() );
       typeelement.TextContent( "String" );
       columnelement.AppendChild( nameelement );
@@ -93,46 +100,52 @@
     
       traverse ( cells, Elements, c ) {
         if( column.Index() = minindex ){
-          row := c.FinancialSalesRow();
+          row                     := c.FinancialSalesRow();
           //Product
-          productcellElement := xmlDOM.CreateElement( "cell" );
+          productcellElement      := xmlDOM.CreateElement( "cell" );
           productcellElement.SetAttribute( "value", row.Name() );
           productcolumnelement.AppendChild( productcellElement );
           //Unit
-          unitcellElement := xmlDOM.CreateElement( "cell" );
+          unitcellElement         := xmlDOM.CreateElement( "cell" );
           unitcellElement.SetAttribute( "value", row.Unit() );
           unitcolumnelement.AppendChild( unitcellElement );
           if( cells.Size() > searchtotal ){
             for( i := searchtotal; i < cells.Size(); i := i + 1 ){
-              searchcellElement1 := xmlDOM.CreateElement( "cell" );
+              searchcellElement1  := xmlDOM.CreateElement( "cell" );
               searchcellElement1.SetAttribute( "value", '' );
               searchcolumnelement.AppendChild( searchcellElement1 );
             }
           }
         }
-        cellElement := xmlDOM.CreateElement( "cell" );
+        cellElement               := xmlDOM.CreateElement( "cell" );
         cellElement.SetAttribute( "value", c.Value() ); 
         columnelement.AppendChild( cellElement );
       }
-      if( cells.Size() < searchtotal ){
-        for( i := cells.Size(); i < searchtotal; i := i + 1 ){
-          searchcellElement1 := xmlDOM.CreateElement( "cell" );
-          searchcellElement1.SetAttribute( "value", '' );
-          searchcolumnelement.AppendChild( searchcellElement1 );
+      for( i := cells.Size(); i < searchtotal; i := i + 1 ){
+        searchcellElement         := xmlDOM.CreateElement( "cell" );
+        searchcellElement.SetAttribute( "value", '' );
+        columnelement.AppendChild( searchcellElement );
+        
+        if( column.Index() = minindex ){
+          productcellElement      := xmlDOM.CreateElement( "cell" );
+          productcellElement.SetAttribute( "value", '' );
+          productcolumnelement.AppendChild( productcellElement );
+          //Unit
+          unitcellElement         := xmlDOM.CreateElement( "cell" );
+          unitcellElement.SetAttribute( "value", '' );
+          unitcolumnelement.AppendChild( unitcellElement );
         }
       }
       tableElement.AppendChild( columnelement );  
     }
     
-    xmlString := xmlDOMI.CreateSerializer().WriteToString( xmlDOM );
+    xmlString                     := xmlDOMI.CreateSerializer().WriteToString( xmlDOM );
     
-    //info( xmlString );
-    
-    tableGroupHandle := TableGroupHandle::Create( FinancialSalesReport::GetDefaultName() );
-    tableHandle      := TableHandle::ImportXML( BinaryValue::Construct( xmlString ) );
+    tableGroupHandle              := TableGroupHandle::Create( FinancialSalesReport::GetDefaultName() );
+    tableHandle                   := TableHandle::ImportXML( BinaryValue::Construct( xmlString ) );
     tableGroupHandle.Add( tableHandle );
     
-    binaryData := XLS::SaveTableGroupToBinaryData( tableGroupHandle, true );
+    binaryData                    := XLS::SaveTableGroupToBinaryData( tableGroupHandle, true );
     
     return binaryData.AsBinaryValue();
   *]

--
Gitblit v1.9.3