xiaoding721
2024-10-12 489022017f8b581ab413455b41ec841879a75e03
_Main/BL/Type_CCEngineLogisticsCostReport/Method_Generate.qbl
@@ -12,32 +12,43 @@
    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, RentInCost            := 0
                                     , RentOutOfCost               := 0
                                     , WerkToRentTransCost         := 0
                                     , RentStorCost                := 0 );
            column.Cell( relinsert, sumcell );
            sumcell  := sumrow.Initialize( column );
          }
          //显示月单元格
          showcell   := showrow.Cell( relnew, RentInCost := cell.RentInCost(), RentOutOfCost := cell.RentOutOfCost(), WerkToRentTransCost := cell.WerkToRentTransCost(), RentStorCost := cell.RentStorCost() );
          column.Cell( relinsert, showcell );
          //显示年单元格
          yearcell.RentInCost( cell.RentInCost() + yearcell.RentInCost() );
          yearcell.RentOutOfCost( cell.RentOutOfCost() + yearcell.RentOutOfCost() );
          yearcell.WerkToRentTransCost( cell.WerkToRentTransCost() + yearcell.WerkToRentTransCost() );
          yearcell.RentStorCost( cell.RentStorCost() + yearcell.RentStorCost() );
          //显示合计年单元格
          sumyearcell.RentInCost( cell.RentInCost() + sumyearcell.RentInCost() );
          sumyearcell.RentOutOfCost( cell.RentOutOfCost() + sumyearcell.RentOutOfCost() );
          sumyearcell.WerkToRentTransCost( cell.WerkToRentTransCost() + sumyearcell.WerkToRentTransCost() );
          sumyearcell.RentStorCost( cell.RentStorCost() + sumyearcell.RentStorCost() );
          //显示合计月单元格
          sumcell.RentInCost( cell.RentInCost() + sumcell.RentInCost() );
          sumcell.RentOutOfCost( cell.RentOutOfCost() + sumcell.RentOutOfCost() );
          sumcell.WerkToRentTransCost( cell.WerkToRentTransCost() + sumcell.WerkToRentTransCost() );