| Quintiq file version 2.0 | 
| #parent: #root | 
| Method GetBaseCost ( | 
|   output Real accountcost, | 
|   ProductInStockingPointInPeriod pispip | 
| ) remote as Real | 
| { | 
|   Description: 'Returns base cost of a given period - used in designer' | 
|   TextBody: | 
|   [* | 
|     basecost := 0.0; | 
|      | 
|     if( not isnull( pispip ) ) | 
|     { | 
|       if( pispip.IsPlanning() ) | 
|       { | 
|         if( this.CostDriver() = Translations::MP_AccountAssignmentCostDriverSales() ) | 
|         { | 
|           basecost := sum( pispip, astype( ProductInStockingPointInPeriodPlanningLeaf ).PlanningBaseSalesDemandInPeriod, sdip, sdip.BasePrice() );    | 
|         } | 
|         else if( this.IsInventoryValue() )  //inventory value including WIP | 
|         { | 
|           accountcost := pispip.GetBaseInventoryValuePerQuantity( this ); | 
|           basecost := pispip.GetInventoryAndPreProcessingValue( this );  | 
|         } | 
|         else if( this.IsInventoryHolding() ) //inventory holding cost including WIP | 
|         {                                                         | 
|           accountcost := pispip.GetBaseInventoryHoldingCostPerQuantity( this ); | 
|           basecost := pispip.GetBaseInventoryHoldingCost( this ); | 
|         } | 
|         else if( this.IsInventorySupply() ) //inventory supply | 
|         { | 
|           basecost := pispip.GetBaseInventorySupplyCost( this ); | 
|         } | 
|       } | 
|       else if( pispip.IsBase() )  // Base, fraction the value from planning period | 
|       { | 
|         basecost := this.GetBaseCost( accountcost, pispip.astype( ProductInStockingPointInPeriodNonPlanningBase ).PlanningPISPIP() ) * pispip.Period_MP().PlanningSystemRatio(); | 
|       } | 
|       else                        // Non base non planning, retrieve the value of base periods | 
|       { | 
|         basecost := sum( pispip.GetChildrenOfPeriodDimension(), Elements, e, this.GetBaseCost( accountcost, e ) ) | 
|       } | 
|     } | 
|      | 
|     return basecost; | 
|   *] | 
| } |