Quintiq file version 2.0
#parent: #root
Method SwitchLane (
  Lane selection,
  StockingPoint_MP origin,
  StockingPoint_MP destination
) id:Method_DialogCreateEditTransportationCost_SwitchLane
{
  #keys: '[145730.1.920081759]'
  Body:
  [*
    // Repopulate shadow laneleg origin & destination
    // Use default location if no origin or destination found
    useDefault := isnull( origin ) or isnull( destination );
    laneLeg := select( selection, LaneLeg, lg,
                       useDefault
                       or ( lg.AsOriginStockingPointLeg().StockingPoint_MP() = origin
                            and lg.AsDestinationStockingPointLeg().StockingPoint_MP() = destination ) );
    
    // Re-create shadow with different owner
    shadowCost := Form.GetShadowCost( laneLeg,
                                      DropDownListAccount.Data(),
                                      DropDownStringListCostDriver.Text(),
                                      DateSelectorCostStart.Date(),
                                      ApplicationMacroPlanner.FormatStringToReal( EditFieldCost.Text() ) );
    
    DataHolderDialogData.Data( &shadowCost );
    
    
    // Populate owner info during single create/edit/copy
    DataHolderFormLaneLeg.Data( Form.SetLaneLeg( laneLeg ) );
    
    // Set cost label
    Form.SetCostLabel( EditFieldLengthOfTime.Text(),
                       DropDownStringListTimeUnit.Text(),
                       DropDownStringListCostDriver.Text() );
  *]
}
