| Quintiq file version 2.0 | 
| #parent: #root | 
| Method GenerateShow ( | 
|   FinancialSalesReport table, | 
|   FinancialSalesColumn yearcolumn, | 
|   Strings productids, | 
|   String factory | 
| ) | 
| { | 
|   TextBody: | 
|   [* | 
|     // 甄兰鸽 Oct-12-2024 (created) | 
|     allunit := FinancialProductionReport::GetDefaultAllUnit(); | 
|      | 
|     sumrow                    := this.FinancialSalesRow( relnew, Name := factory.Format( 'S(Len(10))' ).Concat( 'SUM' ), Factory := factory ); | 
|     sumyearcell               := yearcolumn.FinancialSalesCell( relnew, Value := '0' ); | 
|     sumrow.FinancialSalesCell( relinsert, sumyearcell ); | 
|     //error( '-----------------', productids.Size(), selectset( table, FinancialSalesRow, row, factory = allunit or row.Unit() = factory ).Size() ); | 
|     traverse( table, FinancialSalesRow, row, factory = allunit or row.Unit() = factory ){ | 
|       productid               := construct( Strings ); | 
|       productid.Add( row.Name() ); | 
|        | 
|       if( productids.ContainsAll( productid ) ){ | 
|         isupdate              := false; | 
|         showrow               := selectobject( this, FinancialSalesRow, fprow, fprow.Name() = factory.Format( 'S(Len(10))' ).Concat( row.Name() ) and fprow.Unit() = factory and factory = factory ); | 
|         if( isnull( showrow ) ){ | 
|           showrow             := this.FinancialSalesRow( relnew, Name := factory.Format( 'S(Len(10))' ).Concat( row.Name() ), Unit := factory, Factory := factory ); | 
|           row.Product_MP().FinancialSalesRow( relinsert, showrow ); | 
|         } | 
|         yearcell              := selectobject( yearcolumn, FinancialSalesCell, fpcell, fpcell.FinancialSalesRow() = showrow ); | 
|         if( isnull( yearcell ) ){ | 
|           yearcell            := yearcolumn.FinancialSalesCell( relnew, Value := '0' ); | 
|           showrow.FinancialSalesCell( relinsert, yearcell ); | 
|         } | 
|          | 
|         traverse( row, FinancialSalesCell, cell, not cell.FinancialSalesColumn().IsDay() ){ | 
|           column        := selectobject( this, FinancialSalesColumn, column, column.Name() = cell.FinancialSalesColumn().Name() and not column.IsDay()); | 
|           if( isnull( column ) ){ | 
|             column            := this.FinancialSalesColumn( relnew, Name := cell.FinancialSalesColumn().Name(), Period := cell.FinancialSalesColumn().Period() ); | 
|           } | 
|           sumcell       := selectobject( column, FinancialSalesCell, c, c.FinancialSalesRow() = sumrow ); | 
|           if( isnull( sumcell ) ){ | 
|             sumcell     := column.FinancialSalesCell( relnew, Value := '0' ); | 
|             sumrow.FinancialSalesCell( relinsert, sumcell ); | 
|           } | 
|            | 
|           showcell            := selectobject( showrow, FinancialSalesCell, fpcell, fpcell.FinancialSalesColumn() = column ); | 
|           if( isnull( showcell ) ){ | 
|             showcell          := column.FinancialSalesCell( relnew, Value := '0', IsUpdate := cell.IsUpdate()  ); | 
|             showrow.FinancialSalesCell( relinsert, showcell ); | 
|           } | 
|           if( cell.IsUpdate() ){ | 
|             isupdate          := true; | 
|             showcell.IsUpdate( cell.IsUpdate() ); | 
|           } | 
|           showcell.Value( [String]( [Real]showcell.Value() + [Real]cell.Value() ) ); | 
|           yearcell.Value( [String]( [Real]yearcell.Value() + [Real]cell.Value() ) ); | 
|           sumyearcell.Value( [String]( [Real]sumyearcell.Value() + [Real]cell.Value() ) ); | 
|           value         := [Real]cell.Value() + [Real]sumcell.Value(); | 
|           sumcell.Value( [String]value ); | 
|         } | 
|         if( isupdate ){ | 
|           yearcell.IsUpdate( isupdate ); | 
|         } | 
|       } | 
|     } | 
|     traverse( this, FinancialSalesColumn, column ){ | 
|       if( exists( column, FinancialSalesCell, cell, cell.IsUpdate() and cell.FinancialSalesRow().Factory() = factory ) ){ | 
|         sumcell         := selectobject( sumrow, FinancialSalesCell, sumcell, sumcell.FinancialSalesColumn() = column ); | 
|         sumcell.IsUpdate( true ); | 
|       } | 
|     } | 
|   *] | 
| } |