| Quintiq file version 2.0 | 
| #parent: #root | 
| Method SetShadowUnitCostWithDefaultAccountInfo ( | 
|   Unit unit_i, | 
|   Account_MP account_i | 
| ) id:Method_DialogCreateEditUnitCost_SetShadowUnitCostWithDefaultAccountInfo | 
| { | 
|   #keys: '[145730.0.2099470506]' | 
|   Body: | 
|   [* | 
|     // Create unit cost shadow object & set default values from Account_MP | 
|     createCostForSingleUnit := DataHolderUnits.Data().Size() = 1; | 
|      | 
|     obj := unit_i.UnitCost( relshadow, | 
|                             ID := MacroPlan.IDHolder().GetUnitCostID(), | 
|                             AccountName := account_i.Name(), | 
|                             Account_MP := account_i, | 
|                             CostDriver := account_i.DefaultCostDriver(), | 
|                             Cost := account_i.DefaultCost(), | 
|                             LengthOfTime := account_i.DefaultLengthOfTime(), | 
|                             TimeUnit := account_i.DefaultTimeUnit(), | 
|                             Start := MacroPlan.StartOfPlanning().Date() ); | 
|                              | 
|     DataHolderDialogData.Data( & obj ); | 
|      | 
|     // Only if single unit cost creation, we want to replace the unit in dataholder (e.g on change unit in dropdown) | 
|     if( createCostForSingleUnit ) | 
|     { | 
|       DataHolderUnits.Data().Flush(); | 
|       DataHolderUnits.Data().Add( unit_i ); | 
|     } | 
|   *] | 
| } |