lazhen
2025-01-09 8afe90b633046db39042aada36b88193062f8cff
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
Quintiq file version 2.0
#parent: #root
Method EnableDisableManufacturedDate (
  Product_MP product,
  StockingPoint_MP stockingpoint,
  Boolean isbatchedit
) id:Method_PanelExternalSupply_EnableDisableManufacturedDate
{
  #keys: '[145730.1.1201001523]'
  Body:
  [*
    //Enable or Disable Manufacture date component
    data := DataHolderExternalSupply.Data();
    
    pispspec := select( product, PISPSpecification, pisp, pisp.StockingPoint_MP() = stockingpoint );
    
    hasshelflife := ( guard( product.HasShelfLife()
                      or product.HasMaturation(), false ) ) and guard( not pispspec.IsExcludeShelfLifeAndMaturation(), true );
    dsManufaturedDate.Enabled( hasshelflife and not isbatchedit, "" );
    
    // Always repopulate the manufactured date once switching products
    if ( not isnull( data ) )
    {
       dsManufaturedDate.Date( data.ManufacturedDate() );
    }
    
    // Switching products w or w/o shelf life will toggle the manufactured date data
    if( not hasshelflife )
    {
      dsManufaturedDate.Date( Date::MinDate() );
    }
    else if( data.ManufacturedDate().IsInfinite() ) // check empty date
    {
      dsManufaturedDate.Date( data.Date() );
    }
  *]
}