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