Quintiq file version 2.0
#parent: mbMainMenu/MenuExportMPSPlan
Response OnClick () id:Response_mbMainMenu_MenuExportMPSPlan_OnClick
{
  #keys: '[139394.1.905678296]'
  Body:
  [*
    // Export planned orders to destination folder
    filepath := Application.GetOpenFolderName();
    data := BinaryValue::Construct();       
    brokername := typeof( MP_ExportMPSPlanBroker ).Name();
    broker := select( Domain, EDIDefinitionManager.BrokerDefinitions, broker, broker.Name() = brokername );
    if( not isnull( broker ) )
    { 
      filename := broker.Destination().astype( EDIXLSLinkDefinition ).FileName();
      MacroPlan.ExportToMPSync( MPSync, data );
      filepath := filepath + "/" + filename + ".xlsx";
      Application.WriteBinaryFile( filepath, data.AsBinaryData() );
    }
  *]
  CanBindMultiple: false
  DefinitionID: 'Responsedef_Menu_OnClick'
  Precondition:
  [*
    return MacroPlan::HasMacroPlan( MacroPlan, feedback );
  *]
}
