admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
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 CreateActualPISPIP (
  internal[GUIComponent] parent,
  ProductInStockingPointInPeriod selectedpispip
) as ActualProductInStockingPointInPeriod id:Method_DialogCreateEditActualPISPIP_CreateActualPISPIP
{
  #keys: '[137118.0.315917565]'
  Body:
  [*
    // Create from actual pispip list
    // Assign values/relations to ActualPISPIP to populate the dialog
    pispip := selectedpispip;
    pisp := selectedpispip.ProductInStockingPoint_MP();
    product := pisp.Product_MP();
    stockingpoint := pisp.StockingPoint_MP();
    actualdate := pispip.Period_MP().EndDate() - 1; // Default actual date will be the latest date for actual in the period (period's enddate - 1)
    manufactureDate := ifexpr( guard( product.HasShelfLifeOrMaturation(), false ), 
                                   ActualProductInStockingPointInPeriod::GetMinimumManufacturedDate( product, stockingpoint,actualdate ), Date::MinDate() );
      
    data := MacroPlan.Actual( relshadow, ActualProductInStockingPointInPeriod, ProductID := product.ID(), StockingPointID := stockingpoint.ID(), Date := actualdate, ManufacturedDate := manufactureDate );                 
    data.ProductInStockingPoint_MP( relset, pisp );
    
    Dialog.Data( data );
    
    ValueHolderIsBatchEdit.Value( [String] false );
    Dialog.ShowHideComponents( [Boolean] ValueHolderIsBatchEdit.Value() );
    
    result := this.DoModal( parent );
    
    newobj := null( ActualProductInStockingPointInPeriod );
    
    if( result > 0 )
    {
      //if manufactured date is restricted, default it to date of actual pispip
      manufactureddate := this.GetManufacturedDateWithUIRestriction( GUIDateSelectorManufacturedDate.DateTime().Date(), GUIDateTimeSelectorDate.DateTime().Date() );
      newobj := ActualProductInStockingPointInPeriod::Create( MacroPlan,
                                                              SelectionProduct.Data(),
                                                              SelectionStockingPoint.Data(),
                                                              GUIDateTimeSelectorDate.DateTime().Date(),
                                                              manufactureddate,
                                                              ApplicationLibMacroPlanner.FormatStringToReal( EditorInventoryLevelEnd.Text()),
                                                              EditorDescription.Text(),
                                                              false );
    }
    
    return newobj;
  *]
}