Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method GetBaseCost ( 
 | 
  AccountCost accountcost, 
 | 
  UnitPeriod unitperiod 
 | 
) remote as Real 
 | 
{ 
 | 
  Description: 'Returns base cost of a given period - used in designer' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // Returns base cost of a given period - used in designer 
 | 
    basecost := 0.0; 
 | 
    if( not isnull( unitperiod ) ) 
 | 
    { 
 | 
      if( unitperiod.IsPlanning() ) 
 | 
      { 
 | 
       
 | 
        // costs are of type fixed 
 | 
        if( this.CostDriver() = Translations::MP_AccountAssignmentCostDriverFixed() ) 
 | 
        { 
 | 
          basecost := unitperiod.GetFixedBaseCost( this, accountcost ); 
 | 
        } 
 | 
        // costs are of type staffing 
 | 
        else if( this.CostDriver() = Translations::MP_AccountAssignmentCostDriverStaffing() ) 
 | 
        { 
 | 
          basecost := unitperiod.GetStaffingBaseCost( this, accountcost ); 
 | 
        } 
 | 
        // costs are of type NrOfUnits 
 | 
        else if( this.CostDriver() = Translations::MP_AccountAssignmentCostDriverNrOfUnits() ) 
 | 
        { 
 | 
          basecost := unitperiod.GetNrOfUnitsBaseCost( this, accountcost ); 
 | 
        } 
 | 
        // costs are of type volume, which require a bit more work 
 | 
        else if( this.CostDriver() = Translations::MP_AccountAssignmentCostDriverVolume() ) 
 | 
        { 
 | 
          uaip := select( this, UnitAccountInPeriodForVolume, aip, true, aip.UnitPeriod() = unitperiod ); 
 | 
          if( not isnull( uaip ) ) 
 | 
          { 
 | 
            basecost := uaip.TotalBaseCost(); 
 | 
          } 
 | 
        } 
 | 
        // costs are of type Time, which requires a bit more work 
 | 
        else if( this.CostDriver() = Translations::MP_AccountAssignmentCostDriverTime() ) 
 | 
        { 
 | 
          uaip := select( this, UnitAccountInPeriodForTime, aip, true, aip.UnitPeriod() = unitperiod ); 
 | 
          if( not isnull( uaip ) ) 
 | 
          { 
 | 
            basecost := uaip.TotalBaseCost(); 
 | 
          } 
 | 
        } 
 | 
        // costs are of type lot, with requires a bit more work 
 | 
        else if( this.CostDriver() = Translations::MP_AccountAssignmentCostDriverLot() ) 
 | 
        {  
 | 
          uaip := select( this, UnitAccountInPeriodForLot, aip, true, aip.UnitPeriod() = unitperiod ); 
 | 
          if( not isnull( uaip ) ) 
 | 
          { 
 | 
            basecost := uaip.TotalBaseCost(); 
 | 
          } 
 | 
        } 
 | 
        // costs are of type One time cost, which requires a bit more work 
 | 
        else if( this.CostDriver() = Translations::MP_AccountAssignmentCostDriverOneTime() ) 
 | 
        {  
 | 
          uaip := select( this, UnitAccountInPeriodForOneTimeCost, aip, true, aip.UnitPeriod() = unitperiod ); 
 | 
          if( not isnull( uaip ) ) 
 | 
          { 
 | 
            basecost := uaip.TotalBaseCost(); 
 | 
          } 
 | 
        } 
 | 
        else if( this.CostDriver() = Translations::MP_AccountAssignmentCostDriverChangeover() ) 
 | 
        { 
 | 
          uaip := select( this, UnitAccountInPeriodForChangeover, aip, true, aip.UnitPeriod() = unitperiod ); 
 | 
          basecost := uaip.TotalBaseCost(); 
 | 
        } 
 | 
      } 
 | 
      else if( unitperiod.IsBase() )  // Base, fraction the value from planning period 
 | 
      { 
 | 
        basecost := this.GetBaseCost( accountcost, unitperiod.PlanningUP() ) * unitperiod.PlanningSystemRatio(); 
 | 
      } 
 | 
      else                            // Non base non planning, retrieve the value of base periods 
 | 
      { 
 | 
        basecost := sum( unitperiod.GetChildrenOfPeriodDimension(), Elements, up, this.GetBaseCost( accountcost, up ) ) 
 | 
      } 
 | 
    } 
 | 
     
 | 
    return basecost; 
 | 
  *] 
 | 
} 
 |