| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod UpdateKPITotalValue ( | 
|   KPIValue kpivalue, | 
|   MacroPlan macroplan | 
| ) | 
| { | 
|   Description: | 
|   [* | 
|     Update the total kpi value. | 
|     Called to get the total value directly because not all kpis can retrieve calculation from KPIValueInPeriod | 
|   *] | 
|   TextBody: | 
|   [* | 
|     kpiname := kpivalue.KPI().Name(); | 
|      | 
|     // non financial kpis | 
|     // Target inventory level KPI | 
|     if( kpiname = Translations::MP_GlobalParameters_KPISafetyStock() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPITargetInventoryLevel() ); | 
|       kpivalue.Percentage( macroplan.GetKPITargetInventoryLevelInPecentage() ); | 
|     } | 
|     // Fulfillment KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPIFulfillmentName() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPIFulfillment() ); | 
|       kpivalue.Percentage( macroplan.GetKPIFulfillmentInPercentage() ); | 
|     } | 
|     // Sales demand priority KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPISalesDemandPriorityName() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPISalesDemandPriority() ); | 
|     } | 
|     // Minimum unit capacity KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPIMinimumUnitCapacityName() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPIMinimumUnitCapacity() ); | 
|     } | 
|     // Fulfillment target KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPIFulfillmentTargetName() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPIFulfillmentTarget() ); | 
|       kpivalue.Percentage( macroplan.GetKPIFulfillmentTargetPercentage() ); | 
|     } | 
|     // Volume KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPIVolumeName() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPIVolume() ); | 
|     } | 
|     // Unit capacity KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPIUnitCapacityName() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPIUnitCapacity() ); | 
|     } | 
|     // Stocking point capacity KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPIStockingPointCapacityName() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPIStockingPointCapacity() ); | 
|     } | 
|     // Postponement penalty KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPIPostponementPenaltyName() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPIPostponementPenalty() ) | 
|     } | 
|     // On time fulfillment KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPIOnTimeFulfillmentName() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPIOnTimeFulfillment() ); | 
|       kpivalue.Percentage( macroplan.GetKPIOnTimeFulfillmentInPercentage() ); | 
|     } | 
|     // On time in full KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPIOnTimeInFullName() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPIOnTimeInFull() ); | 
|       kpivalue.Percentage( macroplan.GetKPIOnTimeInFullInPercentage() ); | 
|     } | 
|     // Inventory turns KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPIInventoryTurnsName() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPIInventoryTurns() ); | 
|     } | 
|     // Supply target KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPISupplyTargetName() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPISupplyTarget() ); | 
|       kpivalue.Percentage( macroplan.GetKPISupplyTargetInPercentage() ); | 
|     } | 
|     // Minimum inventory KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPIMinimumInventoryLevelName() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPIMinimumInventoryLevel() ); | 
|     } | 
|     // Maximum inventory KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPIMaximumInventoryLevelName() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPIMaximumInventoryLevel() ); | 
|     } | 
|     // Campaign KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPICampaignName() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPICampaign() ); | 
|     } | 
|     // Lot size KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPILotSizeName() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPILotSize() ); | 
|     } | 
|     // Process minimum quantity KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPIProcessMinimumQuantity() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPIProcessMinimumQuantity() ); | 
|     } | 
|     // Process maximum quantity KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPIProcessMaximumQuantity() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPIProcessMaximumQuantity() ); | 
|     } | 
|     // Minimum supply KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPIMinimumSupplyName() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPIMinimumSupply() ); | 
|     } | 
|     // Maximum supply KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPIMaximumSupplyName() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPIMaximumSupply() ); | 
|     } | 
|     // Total expired quantity KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPITotalExpiredQuantity() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPITotalExpiredQuantity() ); | 
|     } | 
|     // Number of shelf-life violation KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPINumberOfShelfLifeViolation() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPINumberOfShelfLifeViolation() ); | 
|     } | 
|     // Sustainability - CO2 emission | 
|     else if(  kpiname = Translations::MP_GlobalParameters_KPICO2Emission() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPICO2Emission() ); | 
|     } | 
|     // Shift pattern changes penalty KPI | 
|     else if( kpiname = Translations::MP_GlobalParameters_KPIShiftPatternChangesPenalty() ) | 
|     { | 
|       kpivalue.Value( macroplan.GetKPIShiftPatternChangesPenalty() ); | 
|     } | 
|      | 
|     // account kpis | 
|     else if( kpivalue.KPI().IsAccount() ) | 
|     { | 
|       account := select( macroplan, Account_MP, a, a.Name() = kpiname ); | 
|       kpivalue.Value( guard( account.ValueWithinKPIHorizon(), 0.0 ) ); | 
|     } | 
|   *] | 
| } |