xiaoding721
2024-10-12 489022017f8b581ab413455b41ec841879a75e03
_Main/BL/Type_CCEngineLogisticsCostReport0/Method_Generate.qbl
@@ -12,35 +12,30 @@
    allunit          := '<All>';
    //清空之前存储的显示数据
    this.Clear();
    //年汇总
    yearcolumn := this.Column( relnew, Name := '汇总', StartDate := search.MacroPlan().StartOfPlanning().StartOfNextYear().Date() );
    //过滤后的产品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.Row( relnew, Name := 'SUM', RowNr := table.Row( relsize ) );
    sumyearcell      := sumrow.Initialize( yearcolumn );
    traverse( table, Row, row ){
      productid      := construct( Strings );
      productid.Add( row.Name() );
      
      if( productids.ContainsAll( productid ) ){
        showrow      := this.Row( relnew, Name := row.Name(), RowNr := row.RowNr() );
        yearcell     := showrow.Initialize( yearcolumn );
        
        traverse( row, Cell, cell ){
          column     := selectobject( this, Column, column, column.Name() = cell.Column().Name() );
          
          sumcell    := selectobject( column, Cell, c, c.Row() = sumrow );
          if( isnull( sumcell ) ){
            sumcell  := sumrow.Cell( relnew, CCRentInCost            := 0
                                     , CCRentOutOfCost               := 0
                                     , CCLongTransCost               := 0
                                     , CCShorTransCost               := 0
                                     , CCRentStorCost                := 0
                                     , DLRentInCost                  := 0
                                     , DLRentOutOfCost               := 0
                                     , WerkToDLRentTransCost         := 0
                                     , DLRentStorCost                := 0 );
            column.Cell( relinsert, sumcell );
            sumcell  := sumrow.Initialize( column );
          }
          //显示月单元格
          showcell   := showrow.Cell( relnew, CCRentInCost           := cell.CCRentInCost()
                                      , CCRentOutOfCost              := cell.CCRentOutOfCost()
                                      , CCLongTransCost              := cell.CCLongTransCost()
@@ -51,6 +46,27 @@
                                      , WerkToDLRentTransCost        := cell.WerkToDLRentTransCost()
                                      , DLRentStorCost            := cell.DLRentStorCost() );
          column.Cell( relinsert, showcell );
          //显示年单元格
          yearcell.CCRentInCost( cell.CCRentInCost() + yearcell.CCRentInCost() );
          yearcell.CCRentOutOfCost( cell.CCRentOutOfCost() + yearcell.CCRentOutOfCost() );
          yearcell.CCLongTransCost( cell.CCLongTransCost() + yearcell.CCLongTransCost() );
          yearcell.CCShorTransCost( cell.CCShorTransCost() + yearcell.CCShorTransCost() );
          yearcell.CCRentStorCost( cell.CCRentStorCost() + yearcell.CCRentStorCost() );
          yearcell.DLRentInCost( cell.DLRentInCost() + yearcell.DLRentInCost() );
          yearcell.DLRentOutOfCost( cell.DLRentOutOfCost() + yearcell.DLRentOutOfCost() );
          yearcell.WerkToDLRentTransCost( cell.WerkToDLRentTransCost() + yearcell.WerkToDLRentTransCost() );
          yearcell.DLRentStorCost( cell.DLRentStorCost() + yearcell.DLRentStorCost() );
          //显示合计年单元格
          sumyearcell.CCRentInCost( cell.CCRentInCost() + sumyearcell.CCRentInCost() );
          sumyearcell.CCRentOutOfCost( cell.CCRentOutOfCost() + sumyearcell.CCRentOutOfCost() );
          sumyearcell.CCLongTransCost( cell.CCLongTransCost() + sumyearcell.CCLongTransCost() );
          sumyearcell.CCShorTransCost( cell.CCShorTransCost() + sumyearcell.CCShorTransCost() );
          sumyearcell.CCRentStorCost( cell.CCRentStorCost() + sumyearcell.CCRentStorCost() );
          sumyearcell.DLRentInCost( cell.DLRentInCost() + sumyearcell.DLRentInCost() );
          sumyearcell.DLRentOutOfCost( cell.DLRentOutOfCost() + sumyearcell.DLRentOutOfCost() );
          sumyearcell.WerkToDLRentTransCost( cell.WerkToDLRentTransCost() + sumyearcell.WerkToDLRentTransCost() );
          sumyearcell.DLRentStorCost( cell.DLRentStorCost() + sumyearcell.DLRentStorCost() );
          //显示合计月单元格
          sumcell.CCRentInCost( cell.CCRentInCost() + sumcell.CCRentInCost() );
          sumcell.CCRentOutOfCost( cell.CCRentOutOfCost() + sumcell.CCRentOutOfCost() );
          sumcell.CCLongTransCost( cell.CCLongTransCost() + sumcell.CCLongTransCost() );