Beispiel #1
0
 private int?GetSubcontractBillsGeneratedCount(POOrder purchaseOrder)
 {
     return(PXSelectGroupBy <APTran,
                             Where <APTran.pONbr, Equal <Required <POOrder.orderNbr> >,
                                    And <APTran.pOOrderType, Equal <Required <POOrder.orderType> > > >,
                             Aggregate <Count> > .Select(this, purchaseOrder.OrderNbr, purchaseOrder.OrderType).RowCount);
 }
        public static void Process(POOrder doc)
        {
            List <POOrder> list = new List <POOrder>();

            list.Add(doc);
            Process(list, false);
        }
        protected void POOrder_Status_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            POOrder pOOrder = (POOrder)e.Row;

            if (pOOrder.Status == POOrderStatus.Open)
            {
                string poNbr      = pOOrder.OrderNbr;
                bool   isPOExists = reviewPO(pOOrder);

                if (isPOExists)
                {
                    foreach (POLine pOLine in PXSelect <POLine, Where <POLine.orderNbr, Equal <Required <POLine.orderNbr> > > > .Select(Base, pOOrder.OrderNbr))
                    {
                        modifyPO(pOOrder, pOLine);
                    }
                }
                else
                {
                    foreach (POLine pOLine in PXSelect <POLine, Where <POLine.orderNbr, Equal <Required <POLine.orderNbr> > > > .Select(Base, pOOrder.OrderNbr))
                    {
                        int?pOLineNbr = pOLine.POLineNbr;
                        int?lineNbr   = pOLine.LineNbr;
                        createPO(pOOrder, pOLine);
                    }
                }
            }
        }
Beispiel #4
0
 private int?GetSubcontractReceiptsCount(POOrder purchaseOrder)
 {
     return(PXSelectGroupBy <POOrderReceipt,
                             Where <POOrderReceipt.pONbr, Equal <Required <POOrder.orderNbr> >,
                                    And <POOrderReceipt.pOType, Equal <Required <POOrder.orderType> > > >,
                             Aggregate <Count> > .Select(this, purchaseOrder.OrderNbr, purchaseOrder.OrderType).RowCount);
 }
Beispiel #5
0
        protected virtual void POOrder_RowPersisted(PXCache cache, PXRowPersistedEventArgs e)
        {
            if (e.TranStatus == PXTranStatus.Open && e.Operation == PXDBOperation.Update)
            {
                POOrder poOrderRow       = (POOrder)e.Row;
                string  poOrderOldStatus = (string)cache.GetValueOriginal <POOrder.status>(poOrderRow);

                PXCache poLineCache = Base.Caches[typeof(POLineUOpen)];

                bool          updateLines       = false;
                List <POLine> poLineUpdatedList = new List <POLine>();

                foreach (object row in poLineCache.Updated)
                {
                    if ((bool?)poLineCache.GetValue <POLineUOpen.completed>(row) != false)
                    {
                        updateLines = true;
                    }

                    poLineUpdatedList.Add(SharedFunctions.ConvertToPOLine((POLineUOpen)row));
                }

                if (poOrderOldStatus != poOrderRow.Status || updateLines == true)
                {
                    SharedFunctions.UpdateFSSODetReferences(cache.Graph, serviceOrderView.Cache, poOrderRow, poLineUpdatedList);
                }
            }
        }
Beispiel #6
0
        private static void UpdatePurchaseOrderBasedOnPreferences(PXCache cache, POOrder order, PoSetupExt setup)
        {
            order.RequestApproval = setup.SubcontractRequestApproval;
            var isControlTotalVisible = setup.RequireSubcontractControlTotal == true;

            PXUIFieldAttribute.SetVisible <POOrder.curyControlTotal>(cache, order, isControlTotalVisible);
        }
Beispiel #7
0
        public virtual void UpdateOrdersStatus(IEnumerable <Tuple <string, string> > orderCheckClosed)
        {
            foreach (Tuple <string, string> orderNbr in orderCheckClosed)
            {
                POLineUOpen minStatusLine =
                    PXSelect <POLineUOpen,
                              Where <POLineUOpen.orderType, Equal <Required <POLineUOpen.orderType> >,
                                     And <POLineUOpen.orderNbr, Equal <Required <POLineUOpen.orderNbr> >,
                                          And <POLineUOpen.lineType, NotEqual <POLineType.description> > > >,
                              OrderBy <Asc <POLineUOpen.completed, Asc <POLineUOpen.closed> > > >
                    .Select(_graph, orderNbr.Item1, orderNbr.Item2);

                string newStatus =
                    (minStatusLine == null || minStatusLine.Closed == true) ? POOrderStatus.Closed
                                        : (minStatusLine.Completed == true) ? POOrderStatus.Completed
                                        : POOrderStatus.Open;

                POOrder order = PXSelect <POOrder,
                                          Where <POOrder.orderType, Equal <Required <POOrder.orderType> >,
                                                 And <POOrder.orderNbr, Equal <Required <POOrder.orderNbr> > > > >
                                .Select(_graph, orderNbr.Item1, orderNbr.Item2);

                if (order != null && order.Status != newStatus && order.Hold != true)
                {
                    PXCache orderCache = _graph.Caches[typeof(POOrder)];
                    POOrder upd        = (POOrder)orderCache.CreateCopy(order);

                    upd.Status = newStatus;
                    orderCache.Update(upd);
                }
            }
        }
        protected override PMCommitment FromRecord(PXCache sender, object row)
        {
            POLineUOpen poline = (POLineUOpen)row;
            POOrder     order  = (POOrder)PXParentAttribute.SelectParent(sender.Graph.Caches[detailEntity], row, typeof(POOrder));

            PMCommitment commitment = new PMCommitment();

            commitment.Type               = PMCommitmentType.Internal;
            commitment.CommitmentID       = poline.CommitmentID ?? Guid.NewGuid();
            commitment.AccountGroupID     = GetAccountGroup(sender, row);
            commitment.ProjectID          = poline.ProjectID;
            commitment.ProjectTaskID      = poline.TaskID;
            commitment.UOM                = poline.UOM;
            commitment.Qty                = poline.OrderQty;
            commitment.Amount             = poline.ExtCost;
            commitment.OpenQty            = poline.OpenQty;
            commitment.OpenAmount         = poline.OpenAmt;
            commitment.ReceivedQty        = poline.ReceivedQty;
            commitment.InvoicedQty        = 0;
            commitment.InvoicedAmount     = 0;
            commitment.InvoicedIsReadonly = true;
            commitment.RefNoteID          = order.NoteID;
            commitment.InventoryID        = poline.InventoryID ?? PMInventorySelectorAttribute.EmptyInventoryID;
            commitment.CostCodeID         = poline.CostCodeID ?? CostCodeAttribute.GetDefaultCostCode();

            return(commitment);
        }
 private static void ApproveSingleSubcontract(SubcontractEntry graph, POOrder subcontract)
 {
     SetupGraphForApproval(graph, subcontract);
     CheckActionExisting(graph);
     PressApprove(graph, subcontract);
     graph.Persist();
 }
        private static string GetEntityDescription(EntityHelper entityHelper, POOrder commitment, PXGraph graph)
        {
            var status     = entityHelper.GetFieldString(commitment, commitment.GetType(), StatusFieldName);
            var vendorName = GetVendorName(commitment.VendorID, graph);

            return(string.Format(SubcontractDescription, commitment.OrderNbr, vendorName, commitment.OrderDate,
                                 status));
        }
        private static bool IsProjectUpdateRequired(POOrder subcontract, IReadOnlyCollection <POLine> subcontractLines)
        {
            var nonZeroOpenAmount          = subcontract.LineTotal > 0;
            var nonZeroNumberOfLines       = subcontractLines.Count > 0;
            var allLinesWithTheSameProject = subcontractLines.GroupBy(x => x.ProjectID).Count() == 1;

            return(nonZeroOpenAmount && nonZeroNumberOfLines && allLinesWithTheSameProject);
        }
        private List <POLine> GetSubcontractLines(POOrder subcontract)
        {
            var query = new PXSelect <POLine,
                                      Where <POLine.orderType, Equal <POOrderType.regularSubcontract>,
                                             And <POLine.orderNbr, Equal <Required <POLine.orderNbr> > > > >(Base);

            return(query.Select(subcontract.OrderNbr).FirstTableItems.ToList());
        }
Beispiel #13
0
        public virtual void AddPOOrderProc(POOrder order, bool createNew)
        {
            APInvoice prepayment;

            if (createNew)
            {
                prepayment = Base.Document.Insert(new APInvoice {
                    DocType = APDocType.Prepayment
                });
                prepayment.DocDesc = order.OrderDesc;
                if (PXAccess.FeatureInstalled <FeaturesSet.vendorRelations>())
                {
                    prepayment.VendorID                   = order.PayToVendorID;
                    prepayment.VendorLocationID           = (order.VendorID == order.PayToVendorID) ? order.VendorLocationID : null;
                    prepayment.SuppliedByVendorID         = order.VendorID;
                    prepayment.SuppliedByVendorLocationID = order.VendorLocationID;
                }
                else
                {
                    prepayment.VendorID =
                        prepayment.SuppliedByVendorID         = order.VendorID;
                    prepayment.VendorLocationID               =
                        prepayment.SuppliedByVendorLocationID = order.VendorLocationID;
                }
                prepayment.CuryID = order.CuryID;
                Base.Document.Update(prepayment);
                prepayment.TaxCalcMode = order.TaxCalcMode;
                prepayment.InvoiceNbr  = order.OrderNbr;
                prepayment.DueDate     = order.OrderDate;
                prepayment.TaxZoneID   = order.TaxZoneID;
                Base.Document.Update(prepayment);
            }
            else
            {
                prepayment = Base.Document.Current;
            }

            TaxBaseAttribute.SetTaxCalc <APTran.taxCategoryID, TaxAttribute>(Base.Transactions.Cache, null, TaxCalc.ManualCalc);

            var orderLines = PXSelectReadonly <POLineRS,
                                               Where <POLineRS.orderType, Equal <Required <POOrder.orderType> >,
                                                      And <POLineRS.orderNbr, Equal <Required <POOrder.orderNbr> > > >,
                                               OrderBy <Asc <POLineRS.sortOrder, Asc <POLineRS.lineNbr> > > >
                             .Select(Base, order.OrderType, order.OrderNbr)
                             .RowCast <POLineRS>()
                             .ToList();

            bool hasAdded = AddPOOrderLines(orderLines);

            if (!hasAdded)
            {
                throw new PXException(Messages.APInvoicePOOrderCreation_NoApplicableLinesFound);
            }

            Base.AddOrderTaxes(order);

            TaxBaseAttribute.SetTaxCalc <APTran.taxCategoryID, TaxAttribute>(Base.Transactions.Cache, null, TaxCalc.ManualLineCalc);
        }
Beispiel #14
0
 private void InitializePOOrderDocument(POOrderEntry graphPOOrderEntry, POOrder poOrderRow, POEnabledFSSODet firstPOEnabledFSSODetRow)
 {
     poOrderRow                  = new POOrder();
     poOrderRow                  = graphPOOrderEntry.Document.Current = graphPOOrderEntry.Document.Insert(poOrderRow);
     poOrderRow.OrderType        = POOrderType.RegularOrder;
     poOrderRow.VendorID         = firstPOEnabledFSSODetRow.POVendorID;
     poOrderRow.VendorLocationID = firstPOEnabledFSSODetRow.POVendorLocationID;
     graphPOOrderEntry.Document.Update(poOrderRow);
 }
Beispiel #15
0
        protected virtual void POOrder_RowDeleting(PXCache sender, PXRowDeletingEventArgs e)
        {
            POOrder doc = (POOrder)e.Row;

            if (doc.Hold != true && doc.Behavior == POBehavior.ChangeOrder)
            {
                throw new PXException(PX.Objects.PO.Messages.CanNotDeleteWithChangeOrderBehavior);
            }
        }
        private static PXAdapter CreateAdapter(SubcontractEntry graph, POOrder subcontract)
        {
            var dummyView = new DummyView(graph, subcontract);

            return(new PXAdapter(dummyView)
            {
                Menu = nameof(Approve)
            });
        }
        private void UpdateSubcontractIfRequired(POOrder subcontract)
        {
            var subcontractLines = GetSubcontractLines(subcontract);

            if (IsProjectUpdateRequired(subcontract, subcontractLines))
            {
                UpdateSubcontractProject(subcontract, subcontractLines);
            }
        }
Beispiel #18
0
        protected virtual void InsertUpdatePOAdjust(APAdjust apadjust)
        {
            if (Base.Document.Current?.DocType.IsNotIn(APDocType.Prepayment, APDocType.VoidCheck) == true ||
                apadjust?.AdjdDocType != APDocType.Prepayment)
            {
                return;
            }

            var prepaymentRequests = new PXSelectJoin <POOrderPrepayment,
                                                       InnerJoin <POOrder, On <POOrderPrepayment.orderType, Equal <POOrder.orderType>, And <POOrderPrepayment.orderNbr, Equal <POOrder.orderNbr> > > >,
                                                       Where <POOrderPrepayment.aPDocType, Equal <Required <APAdjust.adjdDocType> >,
                                                              And <POOrderPrepayment.aPRefNbr, Equal <Required <APAdjust.adjdRefNbr> >,
                                                                   And <POOrderPrepayment.aPDocType, Equal <APDocType.prepayment> > > > >(Base)
                                     .Select(apadjust.AdjdDocType, apadjust.AdjdRefNbr);

            foreach (PXResult <POOrderPrepayment, POOrder> row in prepaymentRequests)
            {
                POOrder           order             = row;
                POOrderPrepayment prepaymentRequest = row;

                POAdjust poadjustment = new PXSelect <POAdjust,
                                                      Where <POAdjust.adjgDocType, Equal <Current <APPayment.docType> >,
                                                             And <POAdjust.adjgRefNbr, Equal <Current <APPayment.refNbr> >,
                                                                  And <POAdjust.adjNbr, Equal <Current <APPayment.adjCntr> >,
                                                                       And <POAdjust.adjdDocType, Equal <Required <APInvoice.docType> >,
                                                                            And <POAdjust.adjdRefNbr, Equal <Required <APInvoice.refNbr> > > > > > > >(Base)
                                        .Select(apadjust.AdjdDocType, apadjust.AdjdRefNbr);

                if (poadjustment == null)
                {
                    poadjustment = POAdjustments.Insert(new POAdjust()
                    {
                        AdjgDocType   = Base.Document.Current.DocType,
                        AdjgRefNbr    = Base.Document.Current.RefNbr,
                        AdjdOrderType = prepaymentRequest.OrderType,
                        AdjdOrderNbr  = prepaymentRequest.OrderNbr,
                        AdjdDocType   = apadjust.AdjdDocType,
                        AdjdRefNbr    = apadjust.AdjdRefNbr,
                        AdjNbr        = Base.Document.Current.AdjCntr,
                        IsRequest     = true,
                    });
                }

                if (order.CuryID == Base.Document.Current.CuryID)
                {
                    POAdjustments.Cache.SetValueExt <POAdjust.curyAdjgAmt>(poadjustment, apadjust.CuryAdjgAmt);
                }
                else
                {
                    PXCurrencyAttribute.CuryConvCury(Base.Document.Cache, Base.Document.Current, apadjust.AdjAmt ?? 0, out decimal curyamount);
                    POAdjustments.Cache.SetValueExt <POAdjust.curyAdjgAmt>(poadjustment, curyamount);
                }

                POAdjustments.Update(poadjustment);
            }
        }
        private static void RedirectToSubcontractEntry(POOrder commitment)
        {
            var graph = PXGraph.CreateInstance <SubcontractEntry>();

            graph.Document.Current = commitment;
            throw new PXRedirectRequiredException(graph, string.Empty)
                  {
                      Mode = PXBaseRedirectException.WindowMode.NewWindow
                  };
        }
Beispiel #20
0
        private string GetSubcontractProjectName(POOrder subcontract)
        {
            var query = new PXSelectJoin <Contract,
                                          LeftJoin <POLine, On <POLine.projectID, Equal <Contract.contractID> > >,
                                          Where <POLine.orderNbr, Equal <Required <POLine.orderNbr> >,
                                                 And <POLine.orderType, Equal <POOrderType.regularSubcontract> > >,
                                          OrderBy <Asc <POLine.lineNbr> > >(Base);

            return(query.SelectSingle(subcontract.OrderNbr)?.ContractCD);
        }
Beispiel #21
0
        private string GetRewrittenEntityRowValues(POOrder subcontract)
        {
            var cache = Base.Caches <POOrder>();

            PXUIFieldAttribute.SetVisibility <POOrder.orderType>(cache, null, PXUIVisibility.Invisible);
            var description = entityHelper.DescriptionEntity(typeof(POOrder), subcontract);

            PXUIFieldAttribute.SetVisibility <POOrder.orderType>(cache, null, PXUIVisibility.SelectorVisible);
            return(description);
        }
        private static void PressApprove(SubcontractEntry graph, POOrder subcontract)
        {
            var action  = graph.Actions[ActionsMessages.Action];
            var adapter = CreateAdapter(graph, subcontract);

            // method Press is lazy, foreach needed for full completion
            foreach (var dummy in action.Press(adapter))
            {
            }
        }
 private void FillPurchaseOrderInfo(ComplianceDocument complianceDocument, POOrder poOrder, POLine poLine)
 {
     complianceDocument.VendorID   = poOrder.VendorID;
     complianceDocument.VendorName = GetVendorName(complianceDocument.VendorID);
     complianceDocument.ProjectID  = poLine?.ProjectID;
     complianceDocument.CostTaskID = poLine?.TaskID;
     complianceDocument.AccountID  = poLine?.ExpenseAcctID;
     complianceDocument.CostCodeID = poLine?.CostCodeID;
     SetComplianceDocumentReference(complianceDocument, poOrder);
 }
        private ComplianceDocumentReference CreateComplianceDocumentReference(POOrder pOrder)
        {
            var reference = new ComplianceDocumentReference
            {
                ComplianceDocumentReferenceId = Guid.NewGuid(),
                Type            = pOrder.OrderType,
                ReferenceNumber = pOrder.OrderNbr,
                RefNoteId       = pOrder.NoteID
            };

            return(DocumentReference.Insert(reference));
        }
Beispiel #25
0
 private void SetControlTotalIfRequired(PXCache cache, POOrder order)
 {
     if (order.Cancelled == false &&
         POSetup.Current.RequireOrderControlTotal == false &&
         order.CuryOrderTotal != order.CuryControlTotal)
     {
         var controlTotal = order.CuryOrderTotal.IsNullOrZero()
             ? decimal.Zero
             : order.CuryOrderTotal;
         cache.SetValueExt <POOrder.curyControlTotal>(order, controlTotal);
     }
 }
        public override void DocumentRowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            POOrder row    = e.Row as POOrder;
            POOrder oldRow = e.OldRow as POOrder;

            if (IsCommitmentSyncRequired(sender, row, oldRow))
            {
                var selectDetails = new PXSelect <POLine, Where <POLine.orderType, Equal <Current <POOrder.orderType> >, And <POLine.orderNbr, Equal <Optional <POOrder.orderNbr> > > >, OrderBy <Asc <POLine.orderType, Asc <POLine.orderNbr, Asc <POLine.lineNbr> > > > >(sender.Graph);
                foreach (POLine line in selectDetails.Select())
                {
                    this.SyncCommitment(sender, line);
                }
            }
        }
Beispiel #27
0
        private decimal?GetCurrencyUnitCost(POOrder subcontract, POLine subcontractLine, PXCache cache)
        {
            if (subcontractLine.ManualPrice == true || subcontractLine.UOM == null ||
                subcontractLine.InventoryID == null || subcontract?.VendorID == null)
            {
                return(subcontractLine.CuryUnitCost.GetValueOrDefault());
            }
            var currencyInfo = currencyinfo.Search <CurrencyInfo.curyInfoID>(subcontract.CuryInfoID);

            return(APVendorPriceMaint.CalculateUnitCost(
                       cache, subcontractLine.VendorID, subcontract.VendorLocationID, subcontractLine.InventoryID,
                       subcontractLine.SiteID, currencyInfo, subcontractLine.UOM, subcontractLine.OrderQty,
                       subcontract.OrderDate.GetValueOrDefault(), subcontractLine.CuryUnitCost));
        }
        protected override bool EraseCommitment(PXCache sender, object row)
        {
            POLineUOpen poline = (POLineUOpen)row;
            POOrder     order  = (POOrder)PXParentAttribute.SelectParent(sender.Graph.Caches[detailEntity], row, typeof(POOrder));

            if (order.OrderType == POOrderType.Blanket || order.OrderType == POOrderType.StandardBlanket || order.Hold == true || order.Approved != true || order.Cancelled == true || poline.Cancelled == true || poline.TaskID == null)
            {
                return(true);
            }
            else
            {
                return(GetAccountGroup(sender, row) == null);
            }
        }
        protected virtual void _(Events.RowPersisted <POOrder> e)
        {
            POOrder poOrderRow = (POOrder)e.Row;
            PXCache cache      = e.Cache;

            if (poOrderRow.OrderType != POOrderType.RegularOrder)
            {
                return;
            }

            if (e.TranStatus == PXTranStatus.Open)
            {
                if (e.Operation == PXDBOperation.Delete)
                {
                    ClearFSSODetReferences(cache.Graph, poOrderRow);
                }
                else if (e.Operation == PXDBOperation.Update)
                {
                    string poOrderOldStatus = (string)cache.GetValueOriginal <POOrder.status>(poOrderRow);

                    bool          updateLines       = false;
                    List <POLine> poLineUpdatedList = new List <POLine>();

                    foreach (object row in Base.Transactions.Cache.Updated)
                    {
                        if ((bool?)Base.Transactions.Cache.GetValue <POLine.completed>(row) != (bool?)Base.Transactions.Cache.GetValueOriginal <POLine.completed>(row))
                        {
                            updateLines = true;
                        }

                        poLineUpdatedList.Add((POLine)row);
                    }

                    if (poOrderOldStatus != poOrderRow.Status || updateLines == true)
                    {
                        if (poOrderRow.Status == POOrderStatus.Cancelled || poOrderRow.Status == POOrderStatus.Voided)
                        {
                            ClearFSSODetReferences(cache.Graph, poOrderRow);
                        }
                        else
                        {
                            SharedFunctions.UpdateFSSODetReferences(cache.Graph, serviceOrderView.Cache, poOrderRow, poLineUpdatedList);
                        }
                    }
                }
            }
        }
        public override INItemPlan DefaultValues(PXCache sender, INItemPlan plan_Row, object orig_Row)
        {
            string orderType   = (string)sender.GetValue <POLine.orderType>(orig_Row);
            string orderNbr    = (string)sender.GetValue <POLine.orderNbr>(orig_Row);
            int?   inventoryID = (int?)sender.GetValue <POLine.inventoryID>(orig_Row);
            int?   siteID      = (int?)sender.GetValue <POLine.siteID>(orig_Row);
            bool?  cancelled   = (bool?)sender.GetValue <POLine.cancelled>(orig_Row);
            bool?  completed   = (bool?)sender.GetValue <POLine.completed>(orig_Row);

            if (orderType.IsNotIn(POOrderType.RegularOrder, POOrderType.DropShip, POOrderType.Blanket) ||
                inventoryID == null || siteID == null ||
                cancelled == true || completed == true)
            {
                return(null);
            }
            PXCache parentCache  = sender.Graph.Caches[BqlCommand.GetItemType(_ParentNoteID)];
            POOrder currentOrder = (POOrder)parentCache.Current;
            POOrder order        =
                currentOrder?.OrderType == orderType && currentOrder.OrderNbr == orderNbr
                                ? currentOrder
                                : (POOrder)PXParentAttribute.SelectParent(sender, orig_Row, typeof(POOrder));;
            bool IsOnHold = IsOrderOnHold(order);

            string newPlanType;

            if (!TryCalcPlanType(sender, orig_Row, IsOnHold, out newPlanType))
            {
                return(null);
            }
            plan_Row.PlanType    = newPlanType;
            plan_Row.BAccountID  = (int?)sender.GetValue <POLine.vendorID>(orig_Row);
            plan_Row.InventoryID = inventoryID;
            plan_Row.SubItemID   = (int?)sender.GetValue <POLine.subItemID>(orig_Row);
            plan_Row.SiteID      = siteID;
            plan_Row.PlanDate    = (DateTime?)sender.GetValue <POLine.promisedDate>(orig_Row);
            plan_Row.PlanQty     = (decimal?)sender.GetValue <POLine.baseOpenQty>(orig_Row);

            plan_Row.RefNoteID = (Guid?)parentCache.GetValue(order, _ParentNoteID.Name);
            plan_Row.Hold      = IsOnHold;

            if (string.IsNullOrEmpty(plan_Row.PlanType))
            {
                return(null);
            }
            return(plan_Row);
        }