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() ); 
 | 
    } 
 | 
  *] 
 | 
} 
 |