| Quintiq file version 2.0 | 
| #parent: #root | 
| Method ResetSalesDemand ( | 
|   MacroPlan macroplan | 
| ) | 
| { | 
|   Description: 'Reset all sales demand in demo data' | 
|   TextBody: | 
|   [* | 
|     // Multiply all sales demands to 0, reset all plan | 
|     SalesDemandBase::AdjustQuantity( macroplan.SalesDemand( relget ), SalesDemandBase::Adjust_Multiply(), 0.0 ); | 
|      | 
|     // Reset optimizer/manual plan | 
|     macroplan.ResetPeriodTasksAndResetKPI( true, true, null( OptimizerPuzzle ) ); | 
|      | 
|     // Reset all external supply | 
|     traverse( macroplan, Product_MP, e ) | 
|     { | 
|       e.InventorySupply( relflush ); | 
|     } | 
|      | 
|     // Reset all actuals | 
|     macroplan.Actual( relflush ); | 
|      | 
|     // Assert make sure all actuals are reset, all sales demands zero, all external supply are removed | 
|     hasActual := exists( macroplan, Actual, a, true ); | 
|     hasDemand := exists( macroplan, SalesDemand, e, e.Quantity() > 0 ); | 
|     hasExternalSupply := exists( macroplan, Product_MP, e, e.InventorySupply( relsize ) > 0 ); | 
|     // Check setup | 
|     this.Run().AssertFalse( hasActual, "One or more actual pispip exist" ); | 
|     this.Run().AssertFalse( hasDemand, "One or more sales demand is not zero" ); | 
|     this.Run().AssertFalse( hasExternalSupply, "One or more product external supply is not zero" ); | 
|   *] | 
|   InterfaceProperties { Accessibility: 'Module' } | 
| } |