Kevin Kok Khah Whey
2023-11-07 5ae534ab606e6f2ba5ea60914224d665b0447d5a
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
33
34
35
36
Quintiq file version 2.0
#parent: #root
Method Copy (
  FormUnitCosts formUnitCosts,
  UnitCost unitCost
) id:Method_DialogCreateEditUnitCost_Copy
{
  #keys: '[144528.2.67597210]'
  Body:
  [*
    // Copy unit cost (only allow one)
    DataHolderForm.Data( formUnitCosts ); // Form that opens the dialog, to select the newly created object in list
    
    // Unit for the cost we are copying
    unit := unitCost.Unit();
    
    // Create new shadow based on the UnitCost we are copying
    shadowUnitCost := unit.UnitCost( relshadow,
                                     ID := MacroPlan.IDHolder().GetUnitCostID(),
                                     AccountName := unitCost.AccountName(),
                                     Account_MP := unitCost.Account_MP(),
                                     CostDriver := unitCost.CostDriver(),
                                     Cost := unitCost.Cost(),
                                     LengthOfTime := unitCost.LengthOfTime(),
                                     TimeUnit := unitCost.TimeUnit(),
                                     Start := unitCost.Start() );
    
    DataHolderDialogData.Data( &shadowUnitCost );
    
    unitForUnitCost := construct( Units );
    unitForUnitCost.Add( unit );
    DataHolderUnits.Data( &unitForUnitCost );
    
    this.Initialize();
  *]
}