| Quintiq file version 2.0 | 
| #parent: #root | 
| Method New ( | 
|   FormStockingCosts formStockingCosts, | 
|   structured[StockingPoint_MP] stockingPoints, | 
|   Account_MP account | 
| ) id:Method_DialogCreateEditStockingCost_New | 
| { | 
|   #keys: '[145730.0.2100900206]' | 
|   Body: | 
|   [* | 
|     // Create new SP costs for one or more SPs | 
|     if( isnull( account ) ) | 
|     { | 
|       if( DataHolderSelectedAccounts.Data().Size() > 0 ) | 
|       { | 
|         account := DataHolderSelectedAccounts.Data().Element( 0 ); | 
|       } | 
|       else | 
|       { | 
|         account := MacroPlan.GetDefaultAccount( Form.GetCostType() ); | 
|       } | 
|     } | 
|      | 
|     // Create shadow obj & set default value when creating new cost | 
|     obj := stockingPoints.First().StockingPointCost( relshadow, | 
|                                                      ID := MacroPlan.IDHolder().GetStockingPointCostID(), | 
|                                                      AccountName := account.Name(), | 
|                                                      Account_MP := account, | 
|                                                      CostDriver := account.DefaultCostDriver(), | 
|                                                      Cost := account.DefaultCost(), | 
|                                                      LengthOfTime := account.DefaultLengthOfTime(), | 
|                                                      TimeUnit := account.DefaultTimeUnit(), | 
|                                                      Start := MacroPlan.StartOfPlanning().Date() ); | 
|                              | 
|     DataHolderDialogData.Data( &obj ); | 
|     DataHolderStockingPoint.Data( stockingPoints.Copy() ); | 
|     DataHolderForm.Data( formStockingCosts ); // Form that opens the dialog, to select the newly created object in list | 
|      | 
|     this.Initialize(); | 
|   *] | 
| } |