yanweiyuan3
2023-09-11 7804ec7a70a7ffe3116daec64154c15842f8c513
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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 );
  *]
}