Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method NewUnit ( 
 | 
  Unit parentUnit, 
 | 
  FormEntities formEntities 
 | 
) id:Method_DialogCreateEditUnit_NewUnit 
 | 
{ 
 | 
  #keys: '[135040.0.213312472]' 
 | 
  Body: 
 | 
  [* 
 | 
    // To create a new unit 
 | 
    owner := MacroPlan; 
 | 
    obj   := owner.Unit( relshadow,  
 | 
                         Parent           := parentUnit, 
 | 
                         Currency_MP      := MacroPlan.BaseCurrency(), 
 | 
                         UnitOfMeasure_MP := MacroPlan.DefaultUnitOfMeasure(), 
 | 
                         StartDate        := Date::MinDate(), 
 | 
                         EndDate          := Date::MaxDate(), 
 | 
                         ID               := '', 
 | 
                         CapacityType     := GlobalParameters_MP::GetCapacityTypeInfinite() 
 | 
                        ); 
 | 
     
 | 
    DataHolderForm.Data( formEntities ); 
 | 
     
 | 
    // Set data to dataholder because Form cannot bind to shadow yet 
 | 
    DataHolderDialogData.Data( &obj ); 
 | 
     
 | 
    Form.SetDefaultValue(); 
 | 
     
 | 
    ApplicationMacroPlanner.ShowFormModal( this ); 
 | 
  *] 
 | 
} 
 |