lazhen
2024-07-03 db432910aeb08e46f68bcf1183b3ead703e208b0
_Main/BL/Type_FinancialSalesSource/StaticMethod_Initialize.qbl
@@ -23,7 +23,7 @@
    table                     := source.FinancialSalesReport( relnew, ID := source.Name(), Name := source.Name(), IsImport := false );
    showtable                 := source.FinancialSalesReport( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsImport := false, IsShow := true );
    startofplanning           := owner.StartOfPlanning();
    startofyear               := startofplanning.StartOfYear();
    //startofyear               := startofplanning.StartOfYear();
    startofnextyear           := startofplanning.StartOfNextYear();
    
    search                    := source.FinancialSalesSearch( relnew, Unit := allsalessegment, Generation := allsalessegment, MqbMlb := allsalessegment, Power := allsalessegment );
@@ -34,7 +34,7 @@
    traverse( owner, SalesDemand.astype( Forecast ), forecast, forecast.StartDate() < startofnextyear.Date() and ( ( forecast.SalesSegmentName() = ccsalessegment and forecast.Product_MP().MQBMLB() = 'MLB' ) 
              or forecast.SalesSegmentName() = tjsalessegment or forecast.SalesSegmentName() = fssalessegment ) ){
      product    := forecast.Product_MP();
      allrow     := table.GetRow( allsalessegment, product.ID(), startofyear, startofnextyear );
      allrow     := table.GetRow( allsalessegment, product.ID() );
      periodtime := forecast.StartDate().StartOfMonth();
      periodname := periodtime.Format( "M2/D2/Y" );
      
@@ -47,13 +47,13 @@
      //Forecast的Sales Segment为长春,识别出MLB的所有产品汇总
      if( forecast.SalesSegmentName() = ccsalessegment and product.MQBMLB() = 'MLB' ){
    //    info( '------------------------', column.Name() );
        ccrow := table.GetRow( ccsalessegment, product.ID(), startofyear, startofnextyear );
        ccrow := table.GetRow( ccsalessegment, product.ID() );
    //    info( '------------------------', ccrow.FinancialSalesCell( relsize ), column.FinancialSalesCell( relsize ) );
        ccrow.Initialize( column, forecast.Quantity() );
      }else if( forecast.SalesSegmentName() = tjsalessegment or forecast.SalesSegmentName() = fssalessegment ){
        //大连财务销量:首先在forecast界面查找Sales Segment是天津和佛山的所有需求,每个产品按月汇总需求数量
    //    info( '------------------------', column.Name() );
        dlrow := table.GetRow( dlsalessegment, product.ID(), startofyear, startofnextyear );
        dlrow := table.GetRow( dlsalessegment, product.ID() );
    //    info( '------------------------', dlrow.FinancialSalesCell( relsize ), column.FinancialSalesCell( relsize ) );
        dlrow.Initialize( column, forecast.Quantity() );
      }
@@ -67,10 +67,10 @@
          periodtime := pispip.Start().StartOfMonth().Date();
          periodname := periodtime.Format( "M2/D2/Y" );
          column    := selectobject( table, FinancialSalesColumn, column, column.Name() = periodname and column.Period() = periodtime );
          ccrow := table.GetRow( ccsalessegment, product.ID(), startofyear, startofnextyear );
          ccrow := table.GetRow( ccsalessegment, product.ID() );
          ccrow.Initialize( column, pispip.DependentDemandAndSalesDemandQuantity() );//取Total Demand字段按月汇总需求数量
          
          allrow     := table.GetRow( allsalessegment, product.ID(), startofyear, startofnextyear );
          allrow     := table.GetRow( allsalessegment, product.ID() );
          allrow.Initialize( column, pispip.DependentDemandAndSalesDemandQuantity() );
        }
      }
@@ -84,10 +84,10 @@
        
        column    := selectobject( table, FinancialSalesColumn, column, column.Name() = periodname and column.Period() = periodtime );
        traverse( trip, ProductInTrip, pit ){
          dlrow      := table.GetRow( dlsalessegment, pit.ProductID(), startofyear, startofnextyear );
          dlrow      := table.GetRow( dlsalessegment, pit.ProductID() );
          dlrow.Initialize( column, pit.Quantity() );//取Total Demand字段按月汇总需求数量
          
          allrow     := table.GetRow( allsalessegment, pit.ProductID(), startofyear, startofnextyear );
          allrow     := table.GetRow( allsalessegment, pit.ProductID() );
          allrow.Initialize( column, pit.Quantity() );
        }
      }