示例#1
0
        protected virtual void TaxTotal_CuryTaxableAmt_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            TaxTotal taxdetOrig = sender.GetExtension <TaxTotal>(e.Row);

            if (taxdetOrig == null)
            {
                return;
            }

            decimal newValue = (decimal)(sender.GetValue(e.Row, typeof(TaxTotal.curyTaxableAmt).Name) ?? 0m);
            decimal oldValue = (decimal)(e.OldValue ?? 0m);

            if (CurrentDocument.TaxCalc != TaxCalc.NoCalc && e.ExternalCall &&
                newValue != oldValue)
            {
                foreach (object taxrow in SelectTaxes <
                             Where <Tax.taxID, Equal <Required <Tax.taxID> > > >(sender.Graph, null, PXTaxCheck.RecalcTotals, taxdetOrig.RefTaxID))
                {
                    TaxTotal taxdet = sender.GetExtension <TaxTotal>(((PXResult)taxrow)[0]);
                    Tax      tax    = PXResult.Unwrap <Tax>(taxrow);
                    TaxRev   taxrev = PXResult.Unwrap <TaxRev>(taxrow);

                    CalculateTaxSumTaxAmt(taxdet, tax, taxrev);
                }
            }
        }
        protected virtual void TaxTotal_RowUpdated(PXCache sender, PXRowUpdatedEventArgs e)
        {
            TaxTotal taxSum    = sender.GetExtension <TaxTotal>(e.Row);
            TaxTotal taxSumOld = sender.GetExtension <TaxTotal>(e.OldRow);

            if (e.ExternalCall && (!TaxTotals.Cache.ObjectsEqual <TaxTotal.curyTaxAmt>(taxSum, taxSumOld) || !TaxTotals.Cache.ObjectsEqual <TaxTotal.curyExpenseAmt>(taxSum, taxSumOld)))
            {
                PXCache parentCache = Documents.Cache;

                if (parentCache.Current != null)
                {
                    decimal discrepancy = CalculateTaxDiscrepancy(parentCache.Current);
                    decimal discrepancyBase;
                    PXDBCurrencyAttribute.CuryConvBase(parentCache, CurrentDocument, discrepancy, out discrepancyBase);
                    ParentSetValue <Document.curyTaxRoundDiff>(discrepancy);
                    ParentSetValue <Document.taxRoundDiff>(discrepancyBase);
                }
            }

            if ((CurrentDocument.TaxCalc != TaxCalc.NoCalc && e.ExternalCall || CurrentDocument.TaxCalc == TaxCalc.ManualCalc))
            {
                if (e.OldRow != null && e.Row != null)
                {
                    if (taxSumOld.RefTaxID != taxSum.RefTaxID)
                    {
                        VerifyTaxID(taxSum, e.ExternalCall);
                    }
                    if (!TaxTotals.Cache.ObjectsEqual <TaxTotal.curyTaxAmt>(taxSum, taxSumOld) || !TaxTotals.Cache.ObjectsEqual <TaxTotal.curyExpenseAmt>(taxSum, taxSumOld))
                    {
                        CalcTotals(null, false);
                    }
                }
            }
        }
示例#3
0
        protected virtual void RQRequisitionLineBidding_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e)
        {
            RQRequisitionLineBidding newRow = (RQRequisitionLineBidding)e.Row;
            RQRequisitionLineBidding oldRow = (RQRequisitionLineBidding)e.OldRow;

            RQRequisitionLineBiddingExt newExt = (RQRequisitionLineBiddingExt)cache.GetExtension <RQRequisitionLineBiddingExt>(e.Row);
            RQRequisitionLineBiddingExt oldExt = (RQRequisitionLineBiddingExt)cache.GetExtension <RQRequisitionLineBiddingExt>(e.OldRow);

            if (newRow.MinQty != oldRow.MinQty || newRow.QuoteUnitCost != oldRow.QuoteUnitCost ||
                newRow.QuoteQty != oldRow.QuoteQty || newRow.QuoteNumber != oldRow.QuoteNumber)
            {
                RQBidding bidding = PXSelect <RQBidding,
                                              Where <RQBidding.reqNbr, Equal <Required <RQBidding.reqNbr> >,
                                                     And <RQBidding.lineNbr, Equal <Required <RQBidding.lineNbr> >,
                                                          And <RQBidding.vendorID, Equal <Required <RQBidding.vendorID> >,
                                                               And <RQBidding.vendorLocationID, Equal <Required <RQBidding.vendorLocationID> > > > > > >
                                    .SelectWindowed(Base, 0, 1,
                                                    Base.Vendor.Current.ReqNbr,
                                                    newRow.LineNbr,
                                                    Base.Vendor.Current.VendorID,
                                                    Base.Vendor.Current.VendorLocationID);

                if (bidding == null)
                {
                    bidding = new RQBidding
                    {
                        VendorID         = Base.Vendor.Current.VendorID,
                        VendorLocationID = Base.Vendor.Current.VendorLocationID,
                        ReqNbr           = Base.Vendor.Current.ReqNbr,
                        CuryInfoID       = Base.Vendor.Current.CuryInfoID,
                        LineNbr          = newRow.LineNbr
                    };
                }
                else
                {
                    bidding = (RQBidding)Base.Bidding.Cache.CreateCopy(bidding);
                }

                RQBiddingExt biddingExt = Base.Bidding.Cache.GetExtension <RQBiddingExt>(bidding);

                biddingExt.UsrInitialCost        = newExt.UsrInitialCost;
                biddingExt.UsrCuryInitialCost    = newExt.UsrCuryInitialCost;
                biddingExt.UsrCuryInitialExtCost = newExt.UsrCuryInitialExtCost;
                biddingExt.UsrInitialExtCost     = newExt.UsrInitialExtCost;

                Base.Bidding.Update(bidding);
            }
        }
        protected virtual void PMProject_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            PMProject      pmProjectRow      = (PMProject)e.Row;
            PMProjectSSExt pmProjectSSExtRow = PXCache <PMProject> .GetExtension <PMProjectSSExt>(pmProjectRow);

            pmProjectSSExtRow.SyncedInSmartsheet = pmProjectSSExtRow.UsrSmartsheetContractID != null;

            Dictionary <string, string> fields = new Dictionary <string, string>();

            foreach (PMTemplateListSS pmTemplateListSSRow in PXSelectJoinGroupBy <
                         PMTemplateListSS,
                         InnerJoin <PMSSMapping,
                                    On <PMSSMapping.templateSS, Equal <PMTemplateListSS.templateSS>,
                                        And <PMSSMapping.nameAcu, IsNotNull,
                                             And <PMSSMapping.nameAcu, NotEqual <Required <PMSSMapping.nameAcu> > > > > >,
                         Aggregate <
                             GroupBy <PMTemplateListSS.templateSS> > >
                     .Select(this.Base, ""))
            {
                fields.Add(pmTemplateListSSRow.TemplateSS, pmTemplateListSSRow.TemplateName);
            }
            PXStringListAttribute.SetList <PMProjectSSExt.usrTemplateSS>(sender, pmProjectRow, fields.Keys.ToArray(), fields.Values.ToArray());
            PXUIFieldAttribute.SetEnabled <PMProjectSSExt.usrTemplateSS>(sender, pmProjectRow, !(bool)pmProjectSSExtRow.SyncedInSmartsheet);
        }
示例#5
0
        private void UpdateRUTROTControlsState()
        {
            var branchBAcct      = Base.CurrentBAccount.Current;
            var branchBAcctCache = Base.CurrentBAccount.Cache;

            var showRUTROTFields = PXCache <BranchMaint.BranchBAccount> .GetExtension <BranchBAccountRUTROT>(branchBAcct).AllowsRUTROT == true;

            PXUIFieldAttribute.SetEnabled <BranchBAccountRUTROT.rUTROTCuryID>(branchBAcctCache, branchBAcct, showRUTROTFields);
            PXUIFieldAttribute.SetEnabled <BranchBAccountRUTROT.rOTPersonalAllowanceLimit>(branchBAcctCache, branchBAcct, showRUTROTFields);
            PXUIFieldAttribute.SetEnabled <BranchBAccountRUTROT.rOTExtraAllowanceLimit>(branchBAcctCache, branchBAcct, showRUTROTFields);
            PXUIFieldAttribute.SetEnabled <BranchBAccountRUTROT.rOTDeductionPct>(branchBAcctCache, branchBAcct, showRUTROTFields);
            PXUIFieldAttribute.SetEnabled <BranchBAccountRUTROT.rUTPersonalAllowanceLimit>(branchBAcctCache, branchBAcct, showRUTROTFields);
            PXUIFieldAttribute.SetEnabled <BranchBAccountRUTROT.rUTExtraAllowanceLimit>(branchBAcctCache, branchBAcct, showRUTROTFields);
            PXUIFieldAttribute.SetEnabled <BranchBAccountRUTROT.rUTDeductionPct>(branchBAcctCache, branchBAcct, showRUTROTFields);
            PXUIFieldAttribute.SetEnabled <BranchBAccountRUTROT.rUTROTClaimNextRefNbr>(branchBAcctCache, branchBAcct, showRUTROTFields);

            var persistingCheck = showRUTROTFields ? PXPersistingCheck.NullOrBlank : PXPersistingCheck.Nothing;

            PXDefaultAttribute.SetPersistingCheck <BranchBAccountRUTROT.rUTROTCuryID>(branchBAcctCache, branchBAcct, persistingCheck);
            PXDefaultAttribute.SetPersistingCheck <BranchBAccountRUTROT.rOTPersonalAllowanceLimit>(branchBAcctCache, branchBAcct, persistingCheck);
            PXDefaultAttribute.SetPersistingCheck <BranchBAccountRUTROT.rOTExtraAllowanceLimit>(branchBAcctCache, branchBAcct, persistingCheck);
            PXDefaultAttribute.SetPersistingCheck <BranchBAccountRUTROT.rOTDeductionPct>(branchBAcctCache, branchBAcct, persistingCheck);
            PXDefaultAttribute.SetPersistingCheck <BranchBAccountRUTROT.rUTPersonalAllowanceLimit>(branchBAcctCache, branchBAcct, persistingCheck);
            PXDefaultAttribute.SetPersistingCheck <BranchBAccountRUTROT.rUTExtraAllowanceLimit>(branchBAcctCache, branchBAcct, persistingCheck);
            PXDefaultAttribute.SetPersistingCheck <BranchBAccountRUTROT.rUTDeductionPct>(branchBAcctCache, branchBAcct, persistingCheck);
            PXDefaultAttribute.SetPersistingCheck <BranchBAccountRUTROT.rUTROTCuryID>(branchBAcctCache, branchBAcct, persistingCheck);
        }
示例#6
0
        public virtual void Contact_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            Contact contactRow = (Contact)e.Row;

            EPEmployee epEmployeeRow = Base.Employee.Current;

            FSxEPEmployee fsxEPEmployeeRow;

            if (epEmployeeRow != null)
            {
                fsxEPEmployeeRow = PXCache <EPEmployee> .GetExtension <FSxEPEmployee>(epEmployeeRow);

                if (fsxEPEmployeeRow.SendAppNotification == true && contactRow.EMail == null)
                {
                    if (cache.RaiseExceptionHandling <Contact.eMail>(contactRow, contactRow.EMail, new PXException(TX.Error.EMAIL_CANNOT_BE_NULL_IF_SENDAPPNOTIFICATION_IS_TRUE)))
                    {
                        throw new PXRowPersistingException(typeof(Contact.eMail).Name, contactRow.EMail, TX.Error.EMAIL_CANNOT_BE_NULL_IF_SENDAPPNOTIFICATION_IS_TRUE, typeof(Contact.eMail).Name);
                    }
                }
            }
        }
示例#7
0
        protected virtual void FinalizeDO()
        {
            SOOrder    row    = Base.Document.Current;
            SOOrderExt rowExt = PXCache <SOOrder> .GetExtension <SOOrderExt>(row);

            string soNumber           = row.OrderNbr;
            string actualEffortResult = actualEffort(row.OrderNbr);

            if (actualEffortResult != "OK")
            {
                throw new PXException(actualEffortResult);
            }

            string finalizeDOResult = finalizeEllipseProject(row.OrderNbr);

            if (finalizeDOResult != "OK")
            {
                throw new PXException(finalizeDOResult);
            }

            Base.Document.Cache.SetValueExt <SOOrderExt.usrFinalized>(row, true);
            Base.Document.Cache.Update(row);

            //Base.Caches[typeof(SOOrder)].SetValueExt<SOOrderExt.usrFinalized>(row, true);
            //Base.Caches[typeof(SOOrder)].Update(rowExt);
            Base.Save.Press();
        }
        protected virtual void _(Events.FieldDefaulting <CROpportunityProducts, FSxCROpportunityProducts.billingRule> e)
        {
            if (e.Row == null)
            {
                return;
            }

            CROpportunityProducts    crOpportunityProductsRow    = (CROpportunityProducts)e.Row;
            FSxCROpportunityProducts fsxCROpportunityProductsRow = e.Cache.GetExtension <FSxCROpportunityProducts>(crOpportunityProductsRow);

            if (crOpportunityProductsRow.InventoryID != null)
            {
                InventoryItem inventoryItemRow = SharedFunctions.GetInventoryItemRow(Base, crOpportunityProductsRow.InventoryID);

                if (inventoryItemRow.ItemType == INItemTypes.ServiceItem)
                {
                    FSxService fsxServiceRow = PXCache <InventoryItem> .GetExtension <FSxService>(inventoryItemRow);

                    e.NewValue = fsxServiceRow?.BillingRule;
                    e.Cancel   = true;
                }
                else
                {
                    e.NewValue = ID.BillingRule.FLAT_RATE;
                    e.Cancel   = true;
                }
            }
        }
        protected virtual void _(Events.RowSelected <CROpportunityProducts> e)
        {
            if (e.Row == null)
            {
                return;
            }

            CROpportunityProducts crOpportunityProductsRow = (CROpportunityProducts)e.Row;
            PXCache cache = e.Cache;

            FSxCROpportunityProducts fsxCROpportunityProductsRow = cache.GetExtension <FSxCROpportunityProducts>(crOpportunityProductsRow);

            if (fsxCROpportunityProductsRow != null)
            {
                InventoryItem inventoryItemRow = SharedFunctions.GetInventoryItemRow(Base, crOpportunityProductsRow.InventoryID);

                if (inventoryItemRow != null)
                {
                    PXUIFieldAttribute.SetEnabled <FSxCROpportunityProducts.billingRule>(cache, crOpportunityProductsRow, inventoryItemRow.ItemType == INItemTypes.ServiceItem);
                    PXUIFieldAttribute.SetEnabled <FSxCROpportunityProducts.estimatedDuration>(cache, crOpportunityProductsRow, inventoryItemRow.ItemType == INItemTypes.ServiceItem || inventoryItemRow.ItemType == INItemTypes.NonStockItem);
                    PXUIFieldAttribute.SetEnabled <CROpportunityProducts.curyUnitCost>(cache, crOpportunityProductsRow, crOpportunityProductsRow.POCreate == true);
                    PXUIFieldAttribute.SetEnabled <FSxCROpportunityProducts.vendorLocationID>(cache, crOpportunityProductsRow, crOpportunityProductsRow.POCreate == true);
                    PXUIFieldAttribute.SetEnabled <CROpportunityProducts.quantity>(cache, crOpportunityProductsRow, fsxCROpportunityProductsRow.BillingRule != ID.BillingRule.TIME);
                }
            }
        }
示例#10
0
 private void AddJointAmountsForJointCheckAdjustment(APAdjust adjustment)
 {
     if (Base1.JointPayees.AskExt().IsPositive())
     {
         adjustment.CuryAdjgAmt = PXCache <APAdjust> .GetExtension <ApAdjustExt>(adjustment).AmountToPayPerLine;
     }
 }
示例#11
0
        public virtual void InvoiceOrder(DateTime invoiceDate, PXResult <SOOrderShipment, SOOrder, CurrencyInfo, SOAddress, SOContact, SOOrderType> order, PXResultset <SOShipLine, SOLine> details, Customer customer, DocumentList <ARInvoice, SOInvoice> list, InvoiceOrderDelegate baseMethod)
        {
            baseMethod(invoiceDate, order, details, customer, list);
            SOOrder       soorder = (SOOrder)order;
            SOOrderRUTROT orderRR = PXCache <SOOrder> .GetExtension <SOOrderRUTROT>(soorder);

            if (orderRR?.IsRUTROTDeductible == true && Base.Document.Current != null)
            {
                Base.Document.SetValueExt <ARInvoiceRUTROT.isRUTROTDeductible>(Base.Document.Current, true);
                Base.Document.Update(Base.Document.Current);

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

                rutrot                      = (RUTROT)Base.Rutrots.Cache.CreateCopy(rutrot);
                rutrot.DocType              = Base.Document.Current.DocType;
                rutrot.RefNbr               = Base.Document.Current.RefNbr;
                rutrot.CuryDistributedAmt   = 0m;
                rutrot.CuryUndistributedAmt = 0m;
                rutrot                      = Base.Rutrots.Update(rutrot);
                RecalcFormulas(rutrot, PXCache <ARInvoice> .GetExtension <ARInvoiceRUTROT>(Base.Document.Current));
                foreach (RUTROTDistribution rutrotDetail in PXSelect <RUTROTDistribution, Where <RUTROTDistribution.docType, Equal <Required <SOOrder.orderType> >,
                                                                                                 And <RUTROTDistribution.refNbr, Equal <Required <SOOrder.orderNbr> > > > > .Select(Base, soorder.OrderType, soorder.OrderNbr))
                {
                    RUTROTDistribution new_detail = (RUTROTDistribution)Base.RRDistribution.Cache.CreateCopy(rutrotDetail);
                    new_detail.RefNbr  = null;
                    new_detail.DocType = null;
                    Base.RRDistribution.Insert(new_detail);
                }

                Base.Save.Press();
            }
        }
        public virtual ARInvoice InsertDocument(ARInvoiceEntry docgraph, ScheduleDet sdet, Customer customer, ARInvoice ardoc, CurrencyInfo info, InsertDocumentDelegate baseMethod)
        {
            ARInvoice new_ardoc = baseMethod(docgraph, sdet, customer, ardoc, info);

            if (PXCache <ARInvoice> .GetExtension <ARInvoiceRUTROT>(ardoc)?.IsRUTROTDeductible == true)
            {
                RUTROT rutrot = PXSelect <RUTROT,
                                          Where <RUTROT.docType, Equal <Required <ARInvoice.docType> >,
                                                 And <RUTROT.refNbr, Equal <Required <ARInvoice.refNbr> > > > > .Select(docgraph, ardoc.DocType, ardoc.RefNbr);

                RUTROT new_rutrot = PXCache <RUTROT> .CreateCopy(rutrot);

                new_rutrot.CuryDistributedAmt   = 0m;
                new_rutrot.CuryTotalAmt         = 0m;
                new_rutrot.CuryUndistributedAmt = 0m;
                new_rutrot.DistributedAmt       = 0m;
                new_rutrot.TotalAmt             = 0m;
                new_rutrot.UndistributedAmt     = 0m;
                new_rutrot.WorkPrice            = 0m;
                new_rutrot.MaterialCost         = 0m;
                new_rutrot.OtherCost            = 0m;
                new_rutrot.CuryWorkPrice        = 0m;
                new_rutrot.CuryMaterialCost     = 0m;
                new_rutrot.CuryOtherCost        = 0m;
                new_rutrot.RefNbr = null;
                new_rutrot.NoteID = null;
                docgraph.Rutrots.Insert(new_rutrot);
            }
            return(new_ardoc);
        }
        protected virtual void PayBillsFilter_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected del)
        {
            if (e.Row == null)
            {
                return;
            }
            var filter    = (PayBillsFilter)e.Row;
            var filterExt = PXCache <PayBillsFilter> .GetExtension <PayBillsFilterExt>(filter);

            //Direct Deposit only works with USD
            if (filterExt.PaymentType == PaymentChargeType.DirectDeposit && filter.CuryID != "USD")
            {
                cache.SetValueExt <PayBillsFilter.curyID>(filter, "USD");
            }
            PXUIFieldAttribute.SetEnabled <PayBillsFilter.curyID>(cache, filter, filterExt.PaymentType != PaymentChargeType.DirectDeposit);

            if (filterExt.PaymentType == PaymentChargeType.DirectDeposit)
            {
                PXGraph.InstanceCreated.AddHandler <ARPaymentEntry>(HandleSetDescriptionRefName);
            }
            else
            {
                PXGraph.InstanceCreated.RemoveHandler <ARPaymentEntry>(HandleSetDescriptionRefName);
            }
            if (del != null)
            {
                del(cache, e);
            }
        }
        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);
                }
            }
        }
示例#15
0
        protected void _(Events.RowPersisting <ARInvoice> e, PXRowPersisting InvokeBaseHandler)
        {
            InvokeBaseHandler?.Invoke(e.Cache, e.Args);

            if (e.Operation == PXDBOperation.Insert || e.Operation == PXDBOperation.Update)
            {
                ARRegisterExt regisExt = PXCache <ARRegister> .GetExtension <ARRegisterExt>(e.Row);

                //if (e.Row.CuryDocBal == decimal.Zero && string.IsNullOrEmpty(regisExt.UsrGUINbr))
                //{
                //    regisExt.UsrVATOutCode = string.Empty;
                //}
                //else
                if (string.IsNullOrEmpty(regisExt.UsrGUINbr) && (regisExt.UsrVATOutCode == TWGUIFormatCode.vATOutCode31 ||
                                                                 regisExt.UsrVATOutCode == TWGUIFormatCode.vATOutCode32 ||
                                                                 regisExt.UsrVATOutCode == TWGUIFormatCode.vATOutCode35))
                {
                    TWNGUIPreferences gUIPreferences = SelectFrom <TWNGUIPreferences> .View.Select(Base);

                    regisExt.UsrGUINbr = ARGUINbrAutoNumAttribute.GetNextNumber(e.Cache, e.Row, regisExt.UsrVATOutCode == TWGUIFormatCode.vATOutCode32 ? gUIPreferences.GUI2CopiesNumbering : gUIPreferences.GUI3CopiesNumbering,
                                                                                regisExt.UsrGUIDate);

                    tWNGUIValidation.CheckGUINbrExisted(Base, regisExt.UsrGUINbr, regisExt.UsrVATOutCode);
                }
            }
        }
示例#16
0
        protected void _(Events.RowSelected <ARInvoice> e, PXRowSelected baseHandler)
        {
            baseHandler?.Invoke(e.Cache, e.Args);

            ARInvoiceState state = Base.GetDocumentState(e.Cache, e.Row);

            ARRegisterExt registerExt = PXCache <ARRegister> .GetExtension <ARRegisterExt>(e.Row);

            bool taxNbrBlank  = string.IsNullOrEmpty(registerExt.UsrTaxNbr);
            bool statusClosed = e.Row.Status.Equals(ARDocStatus.Open) || e.Row.Status.Equals(ARDocStatus.Closed);

            //BuyPlasticBag.SetVisible(activateGUI);

            PXUIFieldAttribute.SetVisible <ARRegisterExt.usrGUIDate>     (e.Cache, null, activateGUI);
            PXUIFieldAttribute.SetVisible <ARRegisterExt.usrGUINbr>      (e.Cache, null, activateGUI);
            PXUIFieldAttribute.SetVisible <ARRegisterExt.usrOurTaxNbr>   (e.Cache, null, activateGUI);
            PXUIFieldAttribute.SetVisible <ARRegisterExt.usrTaxNbr>      (e.Cache, null, activateGUI);
            PXUIFieldAttribute.SetVisible <ARRegisterExt.usrVATOutCode>  (e.Cache, null, activateGUI);
            PXUIFieldAttribute.SetVisible <ARRegisterExt.usrB2CType>     (e.Cache, null, activateGUI);
            PXUIFieldAttribute.SetVisible <ARRegisterExt.usrCarrierID>   (e.Cache, null, activateGUI);
            PXUIFieldAttribute.SetVisible <ARRegisterExt.usrNPONbr>      (e.Cache, null, activateGUI);
            PXUIFieldAttribute.SetVisible <ARRegisterExt.usrCreditAction>(e.Cache, null, activateGUI &&
                                                                          !string.IsNullOrEmpty(registerExt.UsrVATOutCode) &&
                                                                          registerExt.UsrVATOutCode.IsIn(TWGUIFormatCode.vATOutCode33, TWGUIFormatCode.vATOutCode34));

            PXUIFieldAttribute.SetEnabled <ARRegisterExt.usrB2CType>     (e.Cache, e.Row, !statusClosed && taxNbrBlank);
            PXUIFieldAttribute.SetEnabled <ARRegisterExt.usrCarrierID>   (e.Cache, e.Row, !statusClosed && taxNbrBlank && registerExt.UsrB2CType == TWNB2CType.MC);
            PXUIFieldAttribute.SetEnabled <ARRegisterExt.usrNPONbr>      (e.Cache, e.Row, !statusClosed && taxNbrBlank && registerExt.UsrB2CType == TWNB2CType.NPO);
            PXUIFieldAttribute.SetEnabled <ARRegisterExt.usrVATOutCode>  (e.Cache, e.Row, string.IsNullOrEmpty(registerExt.UsrGUINbr));

            PXUIFieldAttribute.SetEnabled <ARRegisterExt.usrCreditAction>(e.Cache, e.Row, state.DocumentDescrEnabled);
        }
示例#17
0
        protected virtual void CRCase_SDEnabled_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            CRCase    crCaseRow    = (CRCase)e.Row;
            FSxCRCase fsxCRCaseRow = cache.GetExtension <FSxCRCase>(crCaseRow);

            if (fsxCRCaseRow.SDEnabled == true)
            {
                FSSetup fsSetupRow = GetFSSetup();

                if (fsSetupRow != null &&
                    fsSetupRow.DfltCasesSrvOrdType != null)
                {
                    fsxCRCaseRow.SrvOrdType = fsSetupRow.DfltCasesSrvOrdType;
                }

                SetBranchLocationID(Base, fsxCRCaseRow);
            }
            else
            {
                fsxCRCaseRow.SrvOrdType       = null;
                fsxCRCaseRow.BranchLocationID = null;
            }
        }
        public virtual void SetBranchLocationID(PXGraph graph, CROpportunity crOpportunityRow, FSxCROpportunity fsxCROpportunityRow)
        {
            if (crOpportunityRow.BranchID != null)
            {
                UserPreferences userPreferencesRow =
                    PXSelect <UserPreferences,
                              Where <
                                  UserPreferences.userID, Equal <CurrentValue <AccessInfo.userID> > > > .Select(graph);

                if (userPreferencesRow != null &&
                    userPreferencesRow.DefBranchID == crOpportunityRow.BranchID)
                {
                    FSxUserPreferences fsxUserPreferencesRow = PXCache <UserPreferences> .GetExtension <FSxUserPreferences>(userPreferencesRow);

                    if (fsxUserPreferencesRow != null)
                    {
                        fsxCROpportunityRow.BranchLocationID = fsxUserPreferencesRow.DfltBranchLocationID;
                    }
                }
                else
                {
                    fsxCROpportunityRow.BranchLocationID = null;
                }
            }
            else
            {
                fsxCROpportunityRow.BranchLocationID = null;
            }
        }
        protected virtual void CABatch_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            CABatch row = e.Row as CABatch;

            if (row == null)
            {
                return;
            }
            CABatchExt rowExt = PXCache <CABatch> .GetExtension <CABatchExt>(row);

            bool isReleased = (row.Released == true);


            PXUIFieldAttribute.SetEnabled(sender, row, false);
            PXUIFieldAttribute.SetEnabled <CABatch.batchNbr>(sender, row, true);

            bool isProcessing = row.Processing ?? false;

            PXUIFieldAttribute.SetEnabled <CABatch.processing>(sender, row, true);

            bool allowDelete = !isReleased;

            if (allowDelete)
            {
                allowDelete = !(this.ReleasedPayments.Select(row.BatchNbr).Count > 0);
            }
            sender.AllowDelete = allowDelete;

            CashAccount cashaccount  = (CashAccount)PXSelectorAttribute.Select <CABatch.cashAccountID>(sender, row);
            bool        clearEnabled = (row.Released != true) && (cashaccount != null) && (cashaccount.Reconcile == true);

            if (!isReleased)
            {
                PXUIFieldAttribute.SetEnabled <CABatch.hold>(sender, row, !isReleased);
                PXUIFieldAttribute.SetEnabled <CABatch.tranDesc>(sender, row, !isReleased);
                PXUIFieldAttribute.SetEnabled <CABatch.tranDate>(sender, row, !isReleased);
                PXUIFieldAttribute.SetEnabled <CABatch.batchSeqNbr>(sender, row, !isReleased);
                PXUIFieldAttribute.SetEnabled <CABatch.extRefNbr>(sender, row, !isReleased);
                PXUIFieldAttribute.SetEnabled <CABatch.released>(sender, row, true);

                bool hasDetails = this.BatchPayments.Select().Count > 0;
                PXUIFieldAttribute.SetEnabled <CABatch.paymentMethodID>(sender, row, !hasDetails && !isReleased);
                PXUIFieldAttribute.SetEnabled <CABatch.cashAccountID>(sender, row, !hasDetails && !isReleased);
                if (hasDetails)
                {
                    decimal?curyTotal = Decimal.Zero, total = Decimal.Zero;
                    this.CalcDetailsTotal(ref curyTotal, ref total);
                    row.DetailTotal = total;
                    row.CuryTotal   = curyTotal;
                }
            }
            PXUIFieldAttribute.SetVisible <CABatch.curyDetailTotal>(sender, row, isReleased);
            PXUIFieldAttribute.SetVisible <CABatch.curyTotal>(sender, row, !isReleased);
            PXUIFieldAttribute.SetEnabled <CABatch.exportFileName>(sender, row, isProcessing);
            PXUIFieldAttribute.SetEnabled <CABatch.exportTime>(sender, row, isProcessing);
            PXUIFieldAttribute.SetVisible <CABatch.dateSeqNbr>(sender, row, isReleased);

            this.Release.SetEnabled(!isReleased && (row.Hold == false));
            this.Export.SetEnabled(isReleased);
        }
示例#20
0
        protected void InventoryItem_RowSelected(PXCache sender, PXRowSelectedEventArgs e, PXRowSelected del)
        {
            // Event handler body before the base BLC event handler collection
            if (del != null)
            {
                del(sender, e);
            }
            // Event handler body after the base BLC event handler collection
            if (e.Row != null)
            {
                InventoryItemExt ext = PXCache <InventoryItem> .GetExtension <InventoryItemExt>((InventoryItem)e.Row);

                if (ext != null)
                {
                    if (ext.UsrIsAircraft != null)
                    {
                        PXUIFieldAttribute.SetEnabled <InventoryItemExt.usrTapeModelID>(sender, e.Row, (bool)ext.UsrIsAircraft);
                    }
                    else
                    {
                        PXUIFieldAttribute.SetEnabled <InventoryItemExt.usrTapeModelID>(sender, e.Row, false);
                    }
                }
            }
        }
示例#21
0
        protected virtual void EPEmployee_UsrSSUserID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            EPEmployee      epEmployeeRow    = (EPEmployee)e.Row;
            EPEmployeeSSExt epEmployeeExtRow = PXCache <EPEmployee> .GetExtension <EPEmployeeSSExt>(epEmployeeRow);

            if ((long?)e.OldValue != epEmployeeExtRow.UsrSSUserid)
            {
                PXCache <EPUsersListSS> usersListCache   = this.Base.Caches <EPUsersListSS>();
                EPUsersListSS           epUsersListSSRow = UserList.Select().Where(x => ((EPUsersListSS)x).Ssuserid == (long?)e.OldValue).FirstOrDefault();
                if (epUsersListSSRow != null)
                {
                    epUsersListSSRow.BAccountID = null;
                    usersListCache.Update(epUsersListSSRow);
                }

                if (epEmployeeExtRow.UsrSSUserid != null)
                {
                    epUsersListSSRow = UserList.Select().Where(x => ((EPUsersListSS)x).Ssuserid == epEmployeeExtRow.UsrSSUserid).FirstOrDefault();
                    if (epUsersListSSRow != null)
                    {
                        epUsersListSSRow.BAccountID = epEmployeeRow.BAccountID;
                        usersListCache.Update(epUsersListSSRow);
                    }
                }
            }
        }
示例#22
0
        /// <summary>
        /// Lien Waivers should be created on payment persisting only after <see cref="JointPayeePayment"/> records are
        /// already inserted in order to retrieve correct amounts.
        /// </summary>
        protected void MarkPaymentForLienWaiverGeneration(bool shouldCreateLienWaivers)
        {
            var paymentExtension = PXCache <APPayment> .GetExtension <ApPaymentExt>(PaymentEntry.Document.Current);

            paymentExtension.ShouldCreateLienWaivers = shouldCreateLienWaivers;
            PaymentEntry.Document.UpdateCurrent();
        }
        protected virtual void _(Events.RowSelected <CROpportunity> e)
        {
            if (e.Row == null)
            {
                return;
            }

            CROpportunity crOpportunityRow = (CROpportunity)e.Row;
            PXCache       cache            = e.Cache;

            FSxCROpportunity fsxCROpportunityRow = cache.GetExtension <FSxCROpportunity>(crOpportunityRow);

            FSServiceOrder fsServiceOrderRow = CRExtensionHelper.GetRelatedServiceOrder(Base, cache, crOpportunityRow, fsxCROpportunityRow.SOID);
            FSSrvOrdType   fsSrvOrdTypeRow   = null;

            if (fsServiceOrderRow != null)
            {
                fsSrvOrdTypeRow = CRExtensionHelper.GetServiceOrderType(Base, fsServiceOrderRow.SrvOrdType);
            }

            EnableDisableExtensionFields(cache, fsxCROpportunityRow, fsServiceOrderRow);
            EnableDisableActions(cache, crOpportunityRow, fsxCROpportunityRow, fsServiceOrderRow, fsSrvOrdTypeRow);
            SetPersistingChecks(cache, crOpportunityRow, fsxCROpportunityRow, fsSrvOrdTypeRow);

            HideOrShowFieldsActionsByInventoryFeature();
        }
示例#24
0
        protected virtual void ARInvoice_UsrContractID_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e, PXFieldUpdated del)
        {
            // Event handler body before the base BLC event handler collection
            if (del != null)
            {
                del(sender, e);
            }
            // Event handler body after the base BLC event handler collection
            if (e.Row != null)
            {
                ARRegister    row       = (ARRegister)e.Row;
                ARRegisterExt invoiceEX = PXCache <ARRegister> .GetExtension <ARRegisterExt>(row);

                if (invoiceEX.UsrContractID != null)
                {
                    MaxQ.Products.RBRR.XRBContrHdr contract = PXSelect <MaxQ.Products.RBRR.XRBContrHdr,
                                                                        Where <MaxQ.Products.RBRR.XRBContrHdr.contractID,
                                                                               Equal <Required <MaxQ.Products.RBRR.XRBContrHdr.contractID> > > > .Select(Base, invoiceEX.UsrContractID);

                    sender.SetValue <ARRegisterExt.usrContractCD>(e.Row, contract.ContractCD);
                    sender.SetValue <ARRegisterExt.usrRevisionNbr>(e.Row, contract.RevisionNbr);
                    sender.SetValue <ARInvoice.invoiceNbr>(e.Row, contract.ContractCDRevNbr);
                }
            }
        }
        protected virtual void _(Events.FieldDefaulting <CROpportunityProducts, FSxCROpportunityProducts.estimatedDuration> e)
        {
            if (e.Row == null)
            {
                return;
            }

            CROpportunityProducts    crOpportunityProductsRow    = (CROpportunityProducts)e.Row;
            FSxCROpportunityProducts fsxCROpportunityProductsRow = e.Cache.GetExtension <FSxCROpportunityProducts>(crOpportunityProductsRow);

            if (fsxCROpportunityProductsRow != null)
            {
                InventoryItem inventoryItemRow = SharedFunctions.GetInventoryItemRow(Base, crOpportunityProductsRow.InventoryID);

                if (inventoryItemRow != null)
                {
                    FSxService fsxServiceRow = PXCache <InventoryItem> .GetExtension <FSxService>(inventoryItemRow);

                    if (inventoryItemRow.ItemType == INItemTypes.ServiceItem ||
                        inventoryItemRow.ItemType == INItemTypes.NonStockItem)
                    {
                        e.NewValue = fsxServiceRow?.EstimatedDuration;
                        e.Cancel   = true;
                    }
                }
            }
        }
示例#26
0
        protected virtual void ARTran_ManualDisc_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e, PXFieldUpdated del)
        {
            // Event handler body before the base BLC event handler collection
            if (del != null)
            {
                del(sender, e);
            }
            // Event handler body after the base BLC event handler collection
            if (e.Row != null)
            {
                ARTran row = (ARTran)e.Row;
                if (row != null)
                {
                    if (!(bool)row.ManualDisc)
                    {
                        ARTranExt rowext = PXCache <ARTran> .GetExtension <ARTranExt>(row);

                        if (rowext != null)
                        {
                            rowext.UsrDiscountReasonID = null;
                        }
                    }
                }
            }
        }
示例#27
0
        protected virtual void EPEmployee_RowPersisting(PXCache cache, PXRowPersistingEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            EPEmployee    epEmployeeRow    = (EPEmployee)e.Row;
            FSxEPEmployee fsxEPEmployeeRow = PXCache <EPEmployee> .GetExtension <FSxEPEmployee>(epEmployeeRow);

            if (e.Operation != PXDBOperation.Delete)
            {
                LicenseHelper.CheckStaffMembersLicense(cache.Graph, epEmployeeRow.BAccountID, fsxEPEmployeeRow.SDEnabled, epEmployeeRow.Status);
            }

            fsxEPEmployeeRow.IsDriver = EmployeeDriverSkills.Select().Count > 0;

            Contact contactRow = Base.Contact.Current;

            if (contactRow != null)
            {
                if (fsxEPEmployeeRow.SendAppNotification == true && contactRow.EMail == null)
                {
                    if (Base.Contact.Cache.RaiseExceptionHandling <Contact.eMail>(contactRow, contactRow.EMail, new PXException(TX.Error.EMAIL_CANNOT_BE_NULL_IF_SENDAPPNOTIFICATION_IS_TRUE)))
                    {
                        throw new PXRowPersistingException(typeof(Contact.eMail).Name, contactRow.EMail, TX.Error.EMAIL_CANNOT_BE_NULL_IF_SENDAPPNOTIFICATION_IS_TRUE, typeof(Contact.eMail).Name);
                    }
                }
            }
        }
        private void SetSingleBillingSettings(PXCache cache, Customer customerRow)
        {
            if (customerRow.CustomerClassID == null)
            {
                return;
            }

            FSxCustomer      fsxCustomerRow      = cache.GetExtension <FSxCustomer>(customerRow);
            FSxCustomerClass fsxCustomerClassRow = Base.CustomerClass.Cache.GetExtension <FSxCustomerClass>(Base.CustomerClass.Current);

            if (fsxCustomerClassRow == null)
            {
                return;
            }

            if (fsxCustomerClassRow.DfltBillingCycleID != null)
            {
                fsxCustomerRow.BillingCycleID = fsxCustomerClassRow.DfltBillingCycleID;
            }

            if (fsxCustomerClassRow.SendInvoicesTo != null)
            {
                fsxCustomerRow.SendInvoicesTo = fsxCustomerClassRow.SendInvoicesTo;
            }

            if (fsxCustomerClassRow.BillShipmentSource != null)
            {
                fsxCustomerRow.BillShipmentSource = fsxCustomerClassRow.BillShipmentSource;
            }
        }
        protected int?GetSOIDRelated(ARTran tran)
        {
            int?SOID;

            FSxARTran fsxARTranRow = PXCache <ARTran> .GetExtension <FSxARTran>(tran);

            SOID = fsxARTranRow?.SOID;

            if (SOID == null)
            {
                var soLine = PXSelect <SOLine,
                                       Where <SOLine.orderType, Equal <Required <ARTran.sOOrderType> >,
                                              And <SOLine.orderNbr, Equal <Required <ARTran.sOOrderNbr> >,
                                                   And <SOLine.lineNbr, Equal <Required <ARTran.sOOrderLineNbr> > > > > >
                             .Select(Base, tran.SOOrderType, tran.SOOrderNbr, tran.SOOrderLineNbr)
                             .RowCast <SOLine>()
                             .FirstOrDefault();

                if (soLine != null)
                {
                    FSxSOLine fsxSOLineRow = PXCache <SOLine> .GetExtension <FSxSOLine>(soLine);

                    SOID = fsxSOLineRow?.SOID;
                }
            }

            return(SOID);
        }
        protected void Customer_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            if (e.Row == null)
            {
                return;
            }

            Customer    customerRow    = (Customer)e.Row;
            FSxCustomer fsxCustomerRow = cache.GetExtension <FSxCustomer>(customerRow);

            PXUIFieldAttribute.SetEnabled <FSxCustomer.sendInvoicesTo>(cache, customerRow, fsxCustomerRow.BillingCycleID != null);
            PXUIFieldAttribute.SetEnabled <FSxCustomer.billShipmentSource>(cache, customerRow, fsxCustomerRow.BillingCycleID != null);

            DisplayCustomerBillingOptions(cache, customerRow, fsxCustomerRow);

            viewServiceOrderHistory.SetEnabled(customerRow.BAccountID > 0);
            viewAppointmentHistory.SetEnabled(customerRow.BAccountID > 0);
            viewEquipmentSummary.SetEnabled(customerRow.BAccountID > 0);
            viewContractScheduleSummary.SetEnabled(customerRow.BAccountID > 0);

            openMultipleStaffMemberBoard.SetEnabled(customerRow.BAccountID > 0);
            openSingleStaffMemberBoard.SetEnabled(customerRow.BAccountID > 0);

            EnableDisableCustomerBilling(cache, customerRow, fsxCustomerRow);
        }