public void ValidateWorkTypes(IEnumerable <DocumentDetails> documents)
        {
            Dictionary <int, RUTROTWorkType> availableWorkTypes = GetAvailableWorkTypes(this, this.Accessinfo.BusinessDate);
            bool haveUnavailableWorkTypes = false;

            for (int i = 0; i < documents.Count(); i++)
            {
                foreach (ARTran tran in documents.ElementAt(i).Lines)
                {
                    ARTranRUTROT tranRR = RUTROTHelper.GetExtensionNullable <ARTran, ARTranRUTROT>(tran);
                    if (tranRR?.IsRUTROTDeductible == true &&
                        (tranRR.RUTROTItemType == RUTROTItemTypes.MaterialCost || tranRR.RUTROTItemType == RUTROTItemTypes.Service))
                    {
                        if (!availableWorkTypes.ContainsKey(tranRR.RUTROTWorkTypeID.Value))
                        {
                            haveUnavailableWorkTypes = true;
                            PXProcessing.SetError(i, new PXException(RUTROTMessages.CannotClaimWorkType));
                        }
                    }
                }
            }
            if (haveUnavailableWorkTypes)
            {
                throw new PXException(RUTROTMessages.CannotClaimWorkType);
            }
        }
        protected virtual void HiddenInventoryItem_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            var item = (HiddenInventoryItem)e.Row;

            if (item == null)
            {
                return;
            }

            HiddenInventoryItemRUTROT itemRR = PXCache <HiddenInventoryItem> .GetExtension <HiddenInventoryItemRUTROT>(item);

            Branch branch = PXSelect <GL.Branch, Where <GL.Branch.branchID, Equal <Required <GL.Branch.branchID> > > > .Select(Base, PXAccess.GetBranchID());

            BranchRUTROT branchRR = RUTROTHelper.GetExtensionNullable <Branch, BranchRUTROT>(branch);

            bool allowRUTROT       = branchRR?.AllowsRUTROT == true;
            bool isOtherCostOrNull = itemRR.RUTROTItemType == null || itemRR.RUTROTItemType == RUTROTItemTypes.OtherCost;

            PXUIFieldAttribute.SetVisible <HiddenInventoryItemRUTROT.rUTROTItemType>(Base.Item.Cache, item, allowRUTROT);
            PXUIFieldAttribute.SetVisible <HiddenInventoryItemRUTROT.rUTROTType>(Base.Item.Cache, item, allowRUTROT);
            PXUIFieldAttribute.SetVisible <HiddenInventoryItemRUTROT.rUTROTWorkTypeID>(Base.Item.Cache, item, allowRUTROT);

            PXUIFieldAttribute.SetEnabled <HiddenInventoryItemRUTROT.rUTROTWorkTypeID>(sender, item, !isOtherCostOrNull);
            PXUIFieldAttribute.SetEnabled <HiddenInventoryItemRUTROT.rUTROTItemType>(sender, item, true);
            PXUIFieldAttribute.SetEnabled <HiddenInventoryItemRUTROT.rUTROTType>(sender, item, true);

            if (!isOtherCostOrNull && !RUTROTHelper.IsUpToDateWorkType(itemRR.RUTROTWorkTypeID, this.Base.Accessinfo.BusinessDate ?? DateTime.Now, this.Base))
            {
                sender.RaiseExceptionHandling <HiddenInventoryItemRUTROT.rUTROTWorkTypeID>(item, itemRR.RUTROTWorkTypeID, new PXSetPropertyException(RUTROTMessages.ObsoleteWorkTypeWarning, PXErrorLevel.Warning));
            }
            else
            {
                sender.RaiseExceptionHandling <HiddenInventoryItemRUTROT.rUTROTWorkTypeID>(item, itemRR.RUTROTWorkTypeID, null);
            }
        }
Esempio n. 3
0
        public virtual void CopyOrderProc(SOOrder order, CopyParamFilter copyFilter, CopyOrderProcDelegate baseMethod)
        {
            RUTROT rutrotRecord = null;
            PXResultset <RUTROTDistribution> rutrotDistribution = null;
            SOOrderRUTROT orderRR = RUTROTHelper.GetExtensionNullable <SOOrder, SOOrderRUTROT>(order);

            if (RUTROTHelper.IsRUTROTcompatibleType(order.OrderType) && orderRR?.IsRUTROTDeductible == true)
            {
                rutrotRecord       = Rutrots.SelectSingle();
                rutrotDistribution = RRDistribution.Select();
            }

            baseMethod(order, copyFilter);
            if (RUTROTHelper.IsRUTROTcompatibleType(copyFilter.OrderType) && rutrotRecord != null && rutrotDistribution != null)
            {
                rutrotRecord                      = (RUTROT)Rutrots.Cache.CreateCopy(rutrotRecord);
                rutrotRecord.RefNbr               = Base.Document.Current.OrderNbr;
                rutrotRecord.DocType              = Base.Document.Current.OrderType;
                rutrotRecord.CuryDistributedAmt   = 0m;
                rutrotRecord.CuryUndistributedAmt = 0m;
                rutrotRecord                      = Rutrots.Update(rutrotRecord);
                foreach (RUTROTDistribution distribution in rutrotDistribution)
                {
                    RUTROTDistribution new_distribution = (RUTROTDistribution)RRDistribution.Cache.CreateCopy(distribution);
                    new_distribution.RefNbr  = null;
                    new_distribution.DocType = null;
                    RRDistribution.Insert(new_distribution);
                }
            }
            else
            {
                Base.Document.Cache.SetValueExt <SOOrderRUTROT.isRUTROTDeductible>(Base.Document.Current, false);
                Base.Document.Update(Base.Document.Current);
            }
        }
Esempio n. 4
0
        protected virtual void ARInvoice_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            ARInvoiceRUTROT row    = RUTROTHelper.GetExtensionNullable <ARInvoice, ARInvoiceRUTROT>((ARInvoice)e.Row);
            ARInvoiceRUTROT oldRow = RUTROTHelper.GetExtensionNullable <ARInvoice, ARInvoiceRUTROT>((ARInvoice)e.OldRow);

            RRManager.RUTROTDeductibleUpdated(row, oldRow, Rutrots.SelectSingle());
        }
Esempio n. 5
0
        public void Doc_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            DocExt row    = RUTROTHelper.GetExtensionNullable <Doc, DocExt>((Doc)e.Row);
            DocExt oldRow = RUTROTHelper.GetExtensionNullable <Doc, DocExt>((Doc)e.OldRow);

            RUTROTDeductibleUpdated(row, oldRow, Rutrots.SelectSingle());
        }
Esempio n. 6
0
        public override void Initialize()
        {
            base.Initialize();

            Base.ARDocumentList.SetProcessDelegate(
                delegate(List <BalancedARDocument> list)
            {
                List <ARRegister> newlist = new List <ARRegister>(list.Count);
                foreach (BalancedARDocument doc in list)
                {
                    newlist.Add(doc);
                }

                foreach (ARRegister doc in newlist)
                {
                    using (PXTransactionScope ts = new PXTransactionScope())
                    {
                        ARInvoiceEntry graph = PXGraph.CreateInstance <ARInvoiceEntry>();

                        if (RUTROTHelper.IsNeedBalancing(graph, RUTROTBalanceOn.Release))
                        {
                            BalanceProc(graph, doc);
                        }

                        ARDocumentRelease.ReleaseDoc(new List <ARRegister> {
                            doc
                        }, true);

                        ts.Complete();
                    }
                }
            }
                );
        }
        public IEnumerable Release(PXAdapter adapter)
        {
            if (RUTROTHelper.IsNeedBalancing(Base, Base.Document.Current, RUTROTBalanceOn.Release))
            {
                Base.Save.Press();

                ARInvoice doc = Base.Document.Current;
                PXLongOperation.StartOperation(Base, delegate()
                {
                    RUTROT rutrot = PXSelect <RUTROT, Where <RUTROT.refNbr, Equal <Required <ARInvoice.refNbr> >,
                                                             And <RUTROT.docType, Equal <Required <ARInvoice.docType> > > > > .Select(Base, doc.RefNbr, doc.DocType);

                    ARInvoiceEntry invoiceEntryGraph = PXGraph.CreateInstance <ARInvoiceEntry>();

                    RUTROTHelper.BalanceARInvoiceRUTROT(invoiceEntryGraph, doc, OnRelease: true, rutrot: rutrot);

                    RUTROTHelper.CreateAdjustment(Base, doc, rutrot);

                    Base.ReleaseProcess(new List <ARRegister> {
                        doc
                    });
                });

                return(new List <ARInvoice> {
                    Base.Document.Current
                });
            }

            return(Base.Release(adapter));
        }
Esempio n. 8
0
        public void UpdateTranDeductibleFromInventory(IRUTROTableLine line, IRUTROTable document)
        {
            if (line == null)
            {
                return;
            }

            InventoryItem item = PXSelect <InventoryItem, Where <InventoryItem.inventoryID, Equal <Required <InventoryItem.inventoryID> > > > .Select(Base, line.GetInventoryID());

            InventoryItemRUTROT itemRR = RUTROTHelper.GetExtensionNullable <InventoryItem, InventoryItemRUTROT>(item);

            if (itemRR == null)
            {
                return;
            }

            if (document?.IsRUTROTDeductible == true)
            {
                line.IsRUTROTDeductible = itemRR.IsRUTROTDeductible == true;
            }
            else
            {
                line.IsRUTROTDeductible = false;
            }

            if (itemRR.RUTROTItemType != null)
            {
                line.RUTROTItemType = itemRR.RUTROTItemType;
            }
            if (itemRR.RUTROTWorkTypeID != null)
            {
                line.RUTROTWorkTypeID = itemRR.RUTROTWorkTypeID;
            }
        }
        public virtual void InvoiceCreated(ARInvoice invoice, SOOrder source, SOInvoiceEntry.InvoiceCreatedDelegate baseMethod)
        {
            baseMethod(invoice, source);

            SOOrderRUTROT orderRR = PXCache <SOOrder> .GetExtension <SOOrderRUTROT>(source);

            if (orderRR?.IsRUTROTDeductible == true && invoice != null)
            {
                ARInvoiceRUTROT invoiceRR = PXCache <ARInvoice> .GetExtension <ARInvoiceRUTROT>(invoice);

                Base.Document.SetValueExt <ARInvoiceRUTROT.isRUTROTDeductible>(invoice, true);
                Base.Document.Update(invoice);

                RUTROT rutrot = PXSelect <RUTROT,
                                          Where <RUTROT.docType, Equal <Required <SOOrder.orderType> >,
                                                 And <RUTROT.refNbr, Equal <Required <SOOrder.orderNbr> > > > > .Select(Base, source.OrderType, source.OrderNbr);

                rutrot = RUTROTHelper.CreateCopy(Base.Rutrots.Cache, rutrot, invoice.DocType, invoice.RefNbr);
                rutrot = Base.Rutrots.Update(rutrot);

                foreach (RUTROTDistribution rutrotDetail in PXSelect <RUTROTDistribution,
                                                                      Where <RUTROTDistribution.docType, Equal <Required <SOOrder.orderType> >,
                                                                             And <RUTROTDistribution.refNbr, Equal <Required <SOOrder.orderNbr> > > > > .Select(Base, source.OrderType, source.OrderNbr))
                {
                    RUTROTDistribution new_detail = (RUTROTDistribution)Base.RRDistribution.Cache.CreateCopy(rutrotDetail);
                    new_detail.RefNbr  = null;
                    new_detail.DocType = null;
                    Base.RRDistribution.Insert(new_detail);
                }
            }
        }
        protected virtual void InventoryItem_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            InventoryItem item = e.Row as InventoryItem;

            if (item == null)
            {
                return;
            }
            InventoryItemRUTROT itemRR = PXCache <InventoryItem> .GetExtension <InventoryItemRUTROT>(item);

            Branch       branch   = Base.CurrentBranch.SelectSingle(PXAccess.GetBranchID());
            BranchRUTROT branchRR = RUTROTHelper.GetExtensionNullable <Branch, BranchRUTROT>(branch);

            bool allowRUTROT       = branchRR?.AllowsRUTROT == true;
            bool isOtherCostOrNull = itemRR.RUTROTItemType == null || itemRR.RUTROTItemType == RUTROTItemTypes.OtherCost;

            PXUIFieldAttribute.SetVisible <InventoryItemRUTROT.isRUTROTDeductible>(sender, item, allowRUTROT);
            PXUIFieldAttribute.SetVisible <InventoryItemRUTROT.isRUTROTDeductible>(Base.Item.Cache, item, allowRUTROT);
            PXUIFieldAttribute.SetVisible <InventoryItemRUTROT.rUTROTItemType>(Base.Item.Cache, item, allowRUTROT);
            PXUIFieldAttribute.SetVisible <InventoryItemRUTROT.rUTROTType>(Base.Item.Cache, item, allowRUTROT);
            PXUIFieldAttribute.SetVisible <InventoryItemRUTROT.rUTROTWorkTypeID>(Base.Item.Cache, item, allowRUTROT);

            PXUIFieldAttribute.SetEnabled <InventoryItemRUTROT.rUTROTWorkTypeID>(sender, item, !isOtherCostOrNull && itemRR.IsRUTROTDeductible == true);
            PXUIFieldAttribute.SetEnabled <InventoryItemRUTROT.rUTROTItemType>(sender, item, itemRR.IsRUTROTDeductible == true);
            PXUIFieldAttribute.SetEnabled <InventoryItemRUTROT.rUTROTType>(sender, item, itemRR.IsRUTROTDeductible == true);
            if (!isOtherCostOrNull && !RUTROTHelper.IsUpToDateWorkType(itemRR.RUTROTWorkTypeID, this.Base.Accessinfo.BusinessDate ?? DateTime.Now, this.Base))
            {
                sender.RaiseExceptionHandling <InventoryItemRUTROT.rUTROTWorkTypeID>(item, itemRR.RUTROTWorkTypeID, new PXSetPropertyException(RUTROTMessages.ObsoleteWorkTypeWarning, PXErrorLevel.Warning));
            }
            else
            {
                sender.RaiseExceptionHandling <InventoryItemRUTROT.rUTROTWorkTypeID>(item, itemRR.RUTROTWorkTypeID, null);
            }
        }
Esempio n. 11
0
        protected virtual void SOOrder_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            SOOrderRUTROT row    = RUTROTHelper.GetExtensionNullable <SOOrder, SOOrderRUTROT>((SOOrder)e.Row);
            SOOrderRUTROT oldRow = RUTROTHelper.GetExtensionNullable <SOOrder, SOOrderRUTROT>((SOOrder)e.OldRow);

            RRManager.RUTROTDeductibleUpdated(row, oldRow, Rutrots.SelectSingle());
        }
Esempio n. 12
0
        public virtual void InsertSOAdjustments(SOOrder order, ARPaymentEntry docgraph, ARPayment payment, InsertSOAdjustmentsDelegate baseMethod)
        {
            baseMethod(order, docgraph, payment);
            SOOrderRUTROT orderRR = RUTROTHelper.GetExtensionNullable <SOOrder, SOOrderRUTROT>(order);

            if (orderRR.IsRUTROTDeductible == true)
            {
                RUTROT rutrot = PXSelect <RUTROT, Where <RUTROT.docType, Equal <Required <SOOrder.orderType> >,
                                                         And <RUTROT.refNbr, Equal <Required <SOOrder.orderNbr> > > > > .Select(Base, order.OrderType, order.OrderNbr);

                foreach (SOAdjust adj in docgraph.SOAdjustments.Select())
                {
                    SOAdjust other = PXSelectGroupBy <SOAdjust,
                                                      Where <SOAdjust.voided, Equal <False>,
                                                             And <SOAdjust.adjdOrderType, Equal <Required <SOAdjust.adjdOrderType> >,
                                                                  And <SOAdjust.adjdOrderNbr, Equal <Required <SOAdjust.adjdOrderNbr> >,
                                                                       And <Where <SOAdjust.adjgDocType, NotEqual <Required <SOAdjust.adjgDocType> >, Or <SOAdjust.adjgRefNbr, NotEqual <Required <SOAdjust.adjgRefNbr> > > > > > > >,
                                                      Aggregate <GroupBy <SOAdjust.adjdOrderType,
                                                                          GroupBy <SOAdjust.adjdOrderNbr, Sum <SOAdjust.curyAdjdAmt, Sum <SOAdjust.adjAmt> > > > > > .Select(Base, adj.AdjdOrderType, adj.AdjdOrderNbr, adj.AdjgDocType, adj.AdjgRefNbr);

                    if (other == null || other.AdjdOrderNbr == null)
                    {
                        docgraph.SOAdjustments.Cache.SetValueExt <SOAdjust.curyAdjgAmt>(adj, adj.CuryAdjgAmt - rutrot.CuryTotalAmt);
                        docgraph.SOAdjustments.Update(adj);
                    }
                }
            }
        }
Esempio n. 13
0
        protected virtual void SOLine_InventoryID_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
        {
            if (!e.ExternalCall)
            {
                e.Cancel = true;
            }
            SOLine tran = (SOLine)e.Row;

            if (tran == null)
            {
                return;
            }
            if (Base.Document.Current == null)
            {
                return;
            }
            if (e.NewValue == null)
            {
                return;
            }

            string              value  = Rutrots.Current?.RUTROTType;
            InventoryItem       item   = (InventoryItem)InventoryItem.Select((int)e.NewValue);
            InventoryItemRUTROT itemRR = RUTROTHelper.GetExtensionNullable <InventoryItem, InventoryItemRUTROT>(item);

            if (!RUTROTHelper.IsItemMatchRUTROTType(value, item, itemRR, itemRR?.IsRUTROTDeductible == true))
            {
                sender.RaiseExceptionHandling <SOLine.inventoryID>(tran, item.InventoryCD, new PXSetPropertyException <SOLine.inventoryID>(RUTROTMessages.LineDoesNotMatchDoc));
                e.NewValue = item.InventoryCD;
                throw new PXSetPropertyException <SOLine.inventoryID>(RUTROTMessages.LineDoesNotMatchDoc);
            }
        }
Esempio n. 14
0
        public void Update(Doc document)
        {
            if (document == null)
            {
                return;
            }
            RUTROT rutrot     = Rutrots.Current ?? Rutrots.SelectSingle();
            DocExt documentRR = PXCache <Doc> .GetExtension <DocExt>(document);

            Branch branch = PXSelect <Branch, Where <Branch.branchID, Equal <Required <Branch.branchID> > > > .Select(Base, documentRR.GetDocumentBranchID());

            BranchRUTROT branchRR   = RUTROTHelper.GetExtensionNullable <Branch, BranchRUTROT>(branch);
            PXErrorLevel errorLevel = documentRR.GetDocumentHold() != true ? PXErrorLevel.Error : PXErrorLevel.Warning;

            bool enableEdit         = documentRR.GetRUTROTCompleted() != true && RUTROTHelper.CurrenciesMatch(branchRR, documentRR);
            bool showSection        = documentRR.IsRUTROTDeductible == true;
            bool showROTSection     = showSection && rutrot?.RUTROTType == RUTROTTypes.ROT;
            bool isAutoDistribution = rutrot?.AutoDistribution == true;

            UpdateRUTROTCheckbox(enableEdit, RUTROTHelper.IsRUTROTAllowed(branchRR, documentRR));
            UpdateRUTROTSection(showSection, enableEdit, showROTSection);
            UpdateDistributionControls(showSection, enableEdit, isAutoDistribution);
            SetPersistingChecks(documentRR, rutrot);
            WarnOnDeductionExceedsAllowance(documentRR, rutrot, errorLevel);
            WarnUndistributedAmount(documentRR, rutrot, errorLevel, currencyinfo.Current ?? currencyinfo.SelectSingle());
        }
Esempio n. 15
0
        public virtual void SOLine_IsRUTROTDeductible_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
        {
            SOLine tran = (SOLine)e.Row;

            if (tran == null)
            {
                return;
            }
            if (Base.Document.Current == null)
            {
                return;
            }
            if (e.NewValue == null || (bool)e.NewValue == false)
            {
                return;
            }

            string              value  = Rutrots.Current?.RUTROTType;
            InventoryItem       item   = (InventoryItem)InventoryItem.Select(tran.InventoryID);
            InventoryItemRUTROT itemRR = RUTROTHelper.GetExtensionNullable <InventoryItem, InventoryItemRUTROT>(item);

            if (!RUTROTHelper.IsItemMatchRUTROTType(value, item, itemRR, (bool)e.NewValue))
            {
                sender.RaiseExceptionHandling <SOLineRUTROT.isRUTROTDeductible>(tran, false, new PXSetPropertyException <SOLineRUTROT.isRUTROTDeductible>(RUTROTMessages.LineDoesNotMatchDoc));
                e.NewValue = false;
                throw new PXSetPropertyException <SOLineRUTROT.isRUTROTDeductible>(RUTROTMessages.LineDoesNotMatchDoc);
            }
        }
Esempio n. 16
0
        protected virtual void RUTROT_RUTROTType_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
        {
            DocExt document = RUTROTHelper.GetExtensionNullable <Doc, DocExt>(Document.Current);
            RUTROT rutrot   = (RUTROT)e.Row;

            if (document != null && document.IsRUTROTDeductible == true)
            {
                string value = (string)e.NewValue;
                foreach (Tran tran in Transactions.Select())
                {
                    TranExt tranRR = RUTROTHelper.GetExtensionNullable <Tran, TranExt>(tran);
                    if (tranRR.GetInventoryID() != null)
                    {
                        InventoryItem item = PXSelect <InventoryItem, Where <InventoryItem.inventoryID, Equal <Required <InventoryItem.inventoryID> > > > .Select(Base, tranRR.GetInventoryID());

                        InventoryItemRUTROT itemRR = PXCache <InventoryItem> .GetExtension <InventoryItemRUTROT>(item);

                        if (!RUTROTHelper.IsItemMatchRUTROTType(value, item, itemRR, itemRR?.IsRUTROTDeductible == true))
                        {
                            sender.RaiseExceptionHandling <RUTROT.rUTROTType>(rutrot, rutrot.RUTROTType, new PXSetPropertyException <RUTROT.rUTROTType>(RUTROTMessages.LineDoesNotMatchDoc));
                            e.NewValue = rutrot.RUTROTType;
                            break;
                        }
                    }
                }
            }
        }
Esempio n. 17
0
        protected virtual void RUTROT_RUTROTType_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            DocExt document = RUTROTHelper.GetExtensionNullable <Doc, DocExt>(Document.Current);
            RUTROT rutrot   = (RUTROT)e.Row;

            ClearROTFields(rutrot);
            ClearWorkTypes(rutrot);
            RecalcFormulas(rutrot, document);
        }
Esempio n. 18
0
        protected virtual void ARTran_RUTROTType_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            ARTranRUTROT row = RUTROTHelper.GetExtensionNullable <ARTran, ARTranRUTROT>((ARTran)e.Row);

            if (row != null)
            {
                row.RUTROTWorkTypeID = null;
            }
        }
Esempio n. 19
0
        protected virtual void SOLine_RUTROTType_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            SOLineRUTROT row = RUTROTHelper.GetExtensionNullable <SOLine, SOLineRUTROT>((SOLine)e.Row);

            if (row != null)
            {
                row.RUTROTWorkTypeID = null;
            }
        }
Esempio n. 20
0
        protected virtual void InventoryItem_RUTROTType_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            InventoryItem       row    = (InventoryItem)e.Row;
            InventoryItemRUTROT itemRR = RUTROTHelper.GetExtensionNullable <InventoryItem, InventoryItemRUTROT>(row);

            if (row != null && itemRR?.RUTROTType != (string)e.OldValue)
            {
                sender.SetValueExt <InventoryItemRUTROT.rUTROTWorkTypeID>(row, null);
            }
        }
        protected virtual void HiddenInventoryItem_RUTROTItemType_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            var row = (HiddenInventoryItem)e.Row;
            HiddenInventoryItemRUTROT itemRR = RUTROTHelper.GetExtensionNullable <HiddenInventoryItem, HiddenInventoryItemRUTROT>(row);

            if (row != null && itemRR?.RUTROTItemType == RUTROTItemTypes.OtherCost)
            {
                sender.SetValueExt <HiddenInventoryItemRUTROT.rUTROTWorkTypeID>(row, null);
            }
        }
        private static void CheckProperUnitOfMeasure(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            InventoryItem       row    = (InventoryItem)e.Row;
            InventoryItemRUTROT itemRR = RUTROTHelper.GetExtensionNullable <InventoryItem, InventoryItemRUTROT>(row);

            if (row != null && itemRR?.RUTROTItemType == RUTROTItemTypes.Service)
            {
                sender.RaiseExceptionHandling <InventoryItemRUTROT.rUTROTItemType>(row, itemRR.RUTROTItemType, new PXSetPropertyException(RUTROTMessages.ServiceMustBeHour, PXErrorLevel.Warning));
            }
        }
Esempio n. 23
0
        public virtual void ARInvoiceCreated(ARInvoice invoice, ARRegister doc, ARInvoiceEntry.ARInvoiceCreatedDelegate baseMethod)
        {
            baseMethod(invoice, doc);

            RUTROT rutrot = PXSelect <RUTROT, Where <RUTROT.docType, Equal <Required <ARRegister.docType> >,
                                                     And <RUTROT.refNbr, Equal <Required <ARRegister.refNbr> > > > > .Select(Base, doc.DocType, doc.RefNbr);

            rutrot = RUTROTHelper.CreateCopy(Base.Rutrots.Cache, rutrot, invoice.DocType, invoice.RefNbr);
            rutrot = Base.Rutrots.Update(rutrot);
        }
Esempio n. 24
0
        protected virtual void InventoryItem_RUTROTItemType_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            InventoryItem       row    = (InventoryItem)e.Row;
            InventoryItemRUTROT itemRR = RUTROTHelper.GetExtensionNullable <InventoryItem, InventoryItemRUTROT>(row);

            if (row != null && itemRR?.RUTROTItemType == RUTROTItemTypes.OtherCost)
            {
                sender.SetValueExt <InventoryItemRUTROT.rUTROTWorkTypeID>(row, null);
            }
            CheckProperUnitOfMeasure(sender, e);
        }
Esempio n. 25
0
        protected virtual void RUTROT_RowInserted(PXCache sender, PXRowInsertedEventArgs e)
        {
            RUTROT rutrot = (RUTROT)e.Row;

            rutrot.CuryAllowedAmt   = 0m;
            rutrot.CuryMaterialCost = 0m;
            rutrot.CuryOtherCost    = 0m;
            rutrot.CuryWorkPrice    = 0m;

            RecalcFormulas(rutrot, RUTROTHelper.GetExtensionNullable <Doc, DocExt>(Document.Current));
        }
Esempio n. 26
0
        protected virtual void SOLine_RowInserting(PXCache sender, PXRowInsertingEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            var          row   = (SOLine)e.Row;
            SOLineRUTROT rowRR = RUTROTHelper.GetExtensionNullable <SOLine, SOLineRUTROT>(row);

            rowRR.CuryRUTROTTaxAmountDeductible = decimal.Zero;
        }
Esempio n. 27
0
        protected virtual void ARInvoice_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            ARInvoiceRUTROT doc = RUTROTHelper.GetExtensionNullable <ARInvoice, ARInvoiceRUTROT>(e.Row as ARInvoice);

            if (doc == null)
            {
                return;
            }

            RRManager.Update((ARInvoice)e.Row);
            UpdateLinesControls(doc.IsRUTROTDeductible == true);
        }
Esempio n. 28
0
        protected virtual void ARTran_RowInserting(PXCache sender, PXRowInsertingEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            ARTran       row   = e.Row as ARTran;
            ARTranRUTROT rowRR = RUTROTHelper.GetExtensionNullable <ARTran, ARTranRUTROT>(row);

            rowRR.CuryRUTROTTaxAmountDeductible = decimal.Zero;
        }
Esempio n. 29
0
        protected virtual void SOOrder_IsRUTROTDeductible_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            SOOrder row = (SOOrder)e.Row;

            if (row != null)
            {
                SOOrderRUTROT rowRR = RUTROTHelper.GetExtensionNullable <SOOrder, SOOrderRUTROT>(row);
                if (rowRR.IsRUTROTDeductible == true)
                {
                    row.BillSeparately = true;
                }
            }
        }
Esempio n. 30
0
        protected virtual void SOLine_RUTROTItemType_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            SOLine       row   = (SOLine)e.Row;
            SOLineRUTROT rowRR = RUTROTHelper.GetExtensionNullable <SOLine, SOLineRUTROT>(row);

            if (row != null)
            {
                PXUIFieldAttribute.SetEnabled <SOLineRUTROT.rUTROTWorkTypeID>(sender, row, rowRR.RUTROTItemType != RUTROTItemTypes.OtherCost);
                if (rowRR.RUTROTItemType == RUTROTItemTypes.OtherCost)
                {
                    sender.SetValueExt <SOLineRUTROT.rUTROTWorkTypeID>(row, null);
                }
            }
        }