yypsybs
2023-09-09 3cb5a54def670d97301f07170fcaad213bfc54f2
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
37
38
39
40
41
42
43
44
45
46
47
48
49
Quintiq file version 2.0
#parent: #root
Method GenerateMatrixData () id:Method_FormCostManagement_GenerateMatrixData
{
  #keys: '[127710.1.439019647]'
  Body:
  [*
    // Generate account cost in period shadow instances
    // Clear data holder
    DataHolderShadowGlobalParameters.Data( null( shadow[GlobalParameters_MP], owning ) );
    
    //Ownership on GP so that it is possible to show multi rows when multiple accounts are selected.
    owner := shadow( MacroPlan.GlobalParameters_MP() );
    
    DataHolderShadowGlobalParameters.Data( &owner );
    
    traverse( DataHolderMatrixEditorRows.Data(), Elements, rowheadercost ) // For each ROW
    {
      traverse ( DataHolderMatrixEditorColumns.Data(), Elements, p )
      {
        maxcost := maxselect( rowheadercost, AccountAssignment.AccountCost, ac,
                              ac.OwnerID() = rowheadercost.OwnerID()
                              and ac.Account_MP() = rowheadercost.Account_MP()
                              and ac.CostDriver() = rowheadercost.CostDriver()
                              and ac.Start() <= p.StartDate(),
                              ac.Start() );
    
        if( rowheadercost.istype( ProductValueAndCost ) )
        {
          maxcost := maxselect( rowheadercost.astype( ProductValueAndCost ),
                                Product_MP.ProductValueAndCost,
                                pc,
                                pc.OwnerID() = rowheadercost.OwnerID()
                                and pc.Account_MP() = rowheadercost.Account_MP()
                                and pc.CostDriver() = rowheadercost.CostDriver()
                                and pc.Start() <= p.StartDate(),
                                pc.Start() );
        }
    
        if( not isnull( maxcost ) )
        {
          this.CreateShadowAccountCostInPeriod( p,
                                                maxcost,
                                                rowheadercost );
        }
      }
    }
  *]
}