Exemplo n.º 1
0
        public virtual void Test()
        {
            if (Plugin.Current != null)
            {
                Save.Press();

                var provider = CreateTaxProvider(this, Plugin.Current);
                if (provider != null)
                {
                    var result = provider.Ping();
                    if (result.IsSuccess)
                    {
                        Plugin.Ask(Plugin.Current, Messages.ConnectionTaxAskSuccessHeader, Messages.ConnectionTaxAskSuccess, MessageButtons.OK, MessageIcon.Information);
                    }
                    else
                    {
                        StringBuilder errorMessages = new StringBuilder();

                        foreach (var message in result.Messages)
                        {
                            errorMessages.AppendLine(message);
                        }

                        if (errorMessages.Length > 0)
                        {
                            throw new PXException(PXMessages.LocalizeFormatNoPrefixNLA(Messages.TestFailed, errorMessages.ToString()));
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
 private static void CheckValue(object val, string fieldName)
 {
     if (val == null)
     {
         throw new PXSetPropertyException(PXMessages.LocalizeFormatNoPrefixNLA(Messages.IncorrectDataInField, fieldName));
     }
 }
Exemplo n.º 3
0
        public bool ValidateImportCard(CCSynchronizeCard card, int cardIndex)
        {
            bool ret = true;

            if (card.BAccountID == null)
            {
                PXProcessing <CCSynchronizeCard> .SetError(cardIndex, CA.Messages.CustomerNotDefined);

                ret = false;
            }

            if (card.PaymentMethodID == null)
            {
                PXProcessing <CCSynchronizeCard> .SetError(cardIndex, Messages.PaymentMethodNotDefined);

                ret = false;
            }

            if (card.CashAccountID != null)
            {
                IEnumerable <CashAccount> availableCA = PXSelectorAttribute.SelectAll <CCSynchronizeCard.cashAccountID>(this.CustomerCardPaymentData.Cache, card)
                                                        .RowCast <CashAccount>();
                bool exists = availableCA.Any(i => i.CashAccountID == card.CashAccountID);

                if (!exists)
                {
                    PXProcessing <CCSynchronizeCard> .SetError(cardIndex,
                                                               PXMessages.LocalizeFormatNoPrefixNLA(AR.Messages.CashAccountIsNotConfiguredForPaymentMethodInAR, card.PaymentMethodID));

                    ret = false;
                }
            }
            return(ret);
        }
Exemplo n.º 4
0
 private static void CheckText(string subject, string fieldName)
 {
     if (string.IsNullOrEmpty(subject))
     {
         throw new PXSetPropertyException(PXMessages.LocalizeFormatNoPrefixNLA(Messages.IncorrectDataInField, fieldName));
     }
 }
Exemplo n.º 5
0
        public virtual IEnumerable delete(PXAdapter adapter)
        {
            GLVoucherBatch batch = VoucherBatches.Current;

            if (batch == null)
            {
                throw new PXException(Messages.NoBatchesForDelete);
            }
            if (VoucherBatches.Ask(PXMessages.LocalizeFormatNoPrefixNLA(Messages.BatchDeleteConfirmation, batch.VoucherBatchNbr), MessageButtons.OKCancel) == WebDialogResult.OK)
            {
                if (batch.Released == true)
                {
                    throw new PXException(Messages.BatchDeleteReleased);
                }
                List <GLVoucherBatch> fullList = new List <GLVoucherBatch>();
                foreach (GLVoucherBatch voucherBatch in VoucherBatches.Select())                //create list to show all records during processing
                {
                    fullList.Add(voucherBatch);
                }
                PXLongOperation.ClearStatus(this.UID);
                PXLongOperation.StartOperation(this, delegate() { DeleteBatch(batch, fullList.ToArray <object>()); });
                VoucherBatches.View.RequestRefresh();
            }
            return(adapter.Get());
        }
Exemplo n.º 6
0
        protected virtual void Users_OverrideADRoles_FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e)
        {
            Users user   = (Users)e.Row;
            bool  oldval = user.OverrideADRoles == true;
            bool  newval = e.NewValue != null?Convert.ToBoolean(e.NewValue) : false;

            if (oldval != newval && !newval &&
                user.Source == PXUsersSourceListAttribute.ActiveDirectory &&
                RolesByUser.SelectSingle() != null)
            {
                if (UserList.Ask(PX.Objects.CR.Messages.Confirmation,
                                 PXMessages.LocalizeFormatNoPrefixNLA(PX.Objects.CR.Messages.DeleteLocalRoles, user.Username),
                                 MessageButtons.YesNo, MessageIcon.Warning) != WebDialogResult.Yes)
                {
                    e.NewValue = true;
                    e.Cancel   = true;
                }
                else
                {
                    //delete UsersInRoles records if overridead is disabled.
                    foreach (UsersInRoles role in RolesByUser.Select())
                    {
                        RolesByUser.Delete(role);
                    }
                }
            }
        }
 private static void CheckActionExisting(SubcontractEntry graph)
 {
     if (!graph.Actions.Contains(ActionsMessages.Action))
     {
         throw new PXException(PXMessages.LocalizeFormatNoPrefixNLA(EpMessages.AutomationNotConfigured, graph));
     }
 }
Exemplo n.º 8
0
        public void SendMessage(object message)
        {
            if (message == null)
            {
                throw new ArgumentNullException(nameof(message), PXMessages.LocalizeNoPrefix(Messages.Message));
            }

            if (!(message is SMEmail))
            {
                string errorText = PXMessages.LocalizeFormatNoPrefixNLA(Messages.CanNotProcessMessage, message.GetType().Name,
                                                                        typeof(SMEmail).Name);
                throw new ArgumentException(errorText, PXMessages.LocalizeNoPrefix(Messages.Message));
            }

            SMEmail email = message as SMEmail;

            if (email.MailAccountID != null && PX.Objects.CS.Email.PXEmailSyncHelper.IsExchange(email.MailAccountID.Value))
            {
                CRSMEmail emailProjection =
                    PXSelect <CRSMEmail, Where <CRSMEmail.noteID, Equal <Required <SMEmail.refNoteID> > > > .Select(new PXGraph(), email.RefNoteID);

                CS.Email.PXEmailSyncHelper.SendMessage(emailProjection);
            }
            else
            {
                using (var processor = new MessageProcessor(email.MailAccountID))
                {
                    processor.Process(email);
                }
            }
        }
Exemplo n.º 9
0
        public virtual void Test()
        {
            if (Plugin.Current != null)
            {
                Save.Press();

                ICarrierService plugin = CreateCarrierService(this, Plugin.Current);
                if (plugin != null)
                {
                    CarrierResult <string> result = plugin.Test();
                    if (result.IsSuccess)
                    {
                        Plugin.Ask(Plugin.Current, Messages.ConnectionCarrierAskSuccessHeader, Messages.ConnectionCarrierAskSuccess, MessageButtons.OK, MessageIcon.Information);
                    }
                    else
                    {
                        StringBuilder errorMessages = new StringBuilder();

                        foreach (Message message in result.Messages)
                        {
                            errorMessages.AppendLine(message.Description);
                        }

                        if (errorMessages.Length > 0)
                        {
                            throw new PXException(PXMessages.LocalizeFormatNoPrefixNLA(Messages.TestFailed, errorMessages.ToString()));
                        }
                    }
                }
            }
        }
Exemplo n.º 10
0
        private string GetTextFromReloadTaxZonesResult(List <TaxReportLine> addedLines, List <TaxReportLine> deletedLines)
        {
            if (addedLines.Count == 0 && deletedLines.Count == 0)
            {
                return(PXLocalizer.Localize(Messages.TheTaxZonesReloadSummaryNoChangesOnReload, typeof(TX.Messages).FullName));
            }

            string resultsText = PXLocalizer.Localize(Messages.TheTaxZonesReloadSummaryBeginning, typeof(TX.Messages).FullName) + Environment.NewLine;

            if (deletedLines.Count > 0)
            {
                string delLineNumbersString = CreateTextToDisplayFromLineNumbers(deletedLines);
                string localizedDeletedInfo = PXMessages.LocalizeFormatNoPrefixNLA(Messages.TheTaxZonesReloadSummaryDeletedLinesFormat,
                                                                                   delLineNumbersString);

                resultsText += Environment.NewLine + localizedDeletedInfo;
            }

            if (addedLines.Count > 0)
            {
                string addedLineNumbersString = CreateTextToDisplayFromLineNumbers(addedLines);
                string localizedAddedInfo     = PXMessages.LocalizeFormatNoPrefixNLA(Messages.TheTaxZonesReloadSummaryCreatedLinesFormat,
                                                                                     addedLineNumbersString);

                resultsText += Environment.NewLine + localizedAddedInfo;
            }

            return(resultsText);
        }
Exemplo n.º 11
0
 public UniqueBoolAttribute(Type key, Type groupByField) : this(key)
 {
     if (!(groupByField.IsNested && typeof(IBqlField).IsAssignableFrom(groupByField)))
     {
         throw new PXArgumentException("scope", PXMessages.LocalizeFormatNoPrefixNLA(Messages.IsNotBqlField, groupByField.Name));
     }
     _groupByField = groupByField;
 }
        public virtual RollupQty CalculateRollupQty <T>(T row, PMBudget status, decimal?quantity) where T : IBqlTable, IQuantify
        {
            string  UOM       = null;
            decimal rollupQty = 0;

            if (status == null)
            {
                //Status does not exist for given Inventory and <Other> is not present.
            }
            else
            {
                if (status.InventoryID == PMInventorySelectorAttribute.EmptyInventoryID)
                {
                    //<Other> item is present. Update only if UOMs are convertable.
                    decimal convertedQty;
                    if (IN.INUnitAttribute.TryConvertGlobalUnits(graph, row.UOM, status.UOM, quantity.GetValueOrDefault(), IN.INPrecision.QUANTITY, out convertedQty))
                    {
                        rollupQty = convertedQty;
                        UOM       = status.UOM;
                    }
                }
                else
                {
                    UOM = status.UOM;

                    //Item matches. Convert to UOM of ProjectStatus.
                    if (status.UOM != row.UOM && !string.IsNullOrEmpty(status.UOM) && !string.IsNullOrEmpty(row.UOM))
                    {
                        if (PXAccess.FeatureInstalled <FeaturesSet.multipleUnitMeasure>())
                        {
                            decimal inBase = IN.INUnitAttribute.ConvertToBase(graph.Caches[typeof(T)], row.InventoryID, row.UOM, quantity ?? 0, IN.INPrecision.QUANTITY);
                            try
                            {
                                rollupQty = IN.INUnitAttribute.ConvertFromBase(graph.Caches[typeof(T)], row.InventoryID, status.UOM, inBase, IN.INPrecision.QUANTITY);
                            }
                            catch (PX.Objects.IN.PXUnitConversionException ex)
                            {
                                IN.InventoryItem item = PXSelectorAttribute.Select(graph.Caches[typeof(T)], row, "inventoryID") as IN.InventoryItem;
                                string           msg  = PXMessages.LocalizeFormatNoPrefixNLA(Messages.UnitConversionNotDefinedForItemOnBudgetUpdate, item?.BaseUnit, status.UOM, item?.InventoryCD);

                                throw new PXException(msg, ex);
                            }
                        }
                        else
                        {
                            rollupQty = IN.INUnitAttribute.ConvertGlobalUnits(graph, row.UOM, status.UOM, quantity ?? 0, IN.INPrecision.QUANTITY);
                        }
                    }
                    else if (!string.IsNullOrEmpty(status.UOM))
                    {
                        rollupQty = quantity ?? 0;
                    }
                }
            }

            return(new RollupQty(UOM, rollupQty));
        }
Exemplo n.º 13
0
        private void UpdatePhysicalQty()
        {
            INBarCodeItem item = AddByBarCode.Current;
            INPIHeader    d    = this.PIHeader.Current;

            this.SelectTimeStamp();

            using (PXTransactionScope sc = new PXTransactionScope())
            {
                INPIDetail detail =
                    PXSelectReadonly <INPIDetail,
                                      Where <INPIDetail.pIID, Equal <Current <INPIHeader.pIID> >,
                                             And <INPIDetail.inventoryID, Equal <Current <INBarCodeItem.inventoryID> >,
                                                  And <INPIDetail.subItemID, Equal <Current <INBarCodeItem.subItemID> >,
                                                       And <INPIDetail.locationID, Equal <Current <INBarCodeItem.locationID> >,
                                                            And <Where <INPIDetail.lotSerialNbr, IsNull,
                                                                        Or <INPIDetail.lotSerialNbr, Equal <Current <INBarCodeItem.lotSerialNbr> > > > > > > > > > .SelectWindowed(this, 0, 1);

                if (detail == null)
                {
                    INPIEntry entry = PXGraph.CreateInstance <INPIEntry>();
                    entry.PIHeader.Current = entry.PIHeader.Search <INPIHeader.pIID>(d.PIID);
                    detail = PXCache <INPIDetail> .CreateCopy(entry.PIDetail.Insert(new INPIDetail()));

                    detail.InventoryID = item.InventoryID;
                    detail             = PXCache <INPIDetail> .CreateCopy(entry.PIDetail.Update(detail));

                    detail.SubItemID    = item.SubItemID;
                    detail.LocationID   = item.LocationID;
                    detail.LotSerialNbr = item.LotSerialNbr;
                    detail.PhysicalQty  = item.Qty;
                    detail.ExpireDate   = item.ExpireDate;
                    entry.PIDetail.Update(detail);
                    entry.Save.Press();
                    this.PIHeader.View.RequestRefresh();
                }
                else
                {
                    detail = PXCache <INPIDetail> .CreateCopy(detail);

                    detail.PhysicalQty = detail.PhysicalQty.GetValueOrDefault() + item.Qty.GetValueOrDefault();
                    this.PIDetail.Update(detail);
                }
                sc.Complete();

                item.Description = PXMessages.LocalizeFormatNoPrefixNLA(Messages.PILineUpdated,
                                                                        AddByBarCode.GetValueExt <INBarCodeItem.inventoryID>(item).ToString().Trim(),
                                                                        Setup.Current.UseInventorySubItem == true ? ":" + AddByBarCode.GetValueExt <INBarCodeItem.subItemID>(item) : string.Empty,
                                                                        AddByBarCode.GetValueExt <INBarCodeItem.qty>(item),
                                                                        item.UOM,
                                                                        detail.LineNbr);
            }
            AddByBarCode.Reset(true);
            this.AddByBarCode.View.RequestRefresh();
            this.SelectTimeStamp();
        }
Exemplo n.º 14
0
        public virtual ARInvoice CommitExternalTax(ARInvoice doc)
        {
            if (doc != null && doc.IsTaxValid == true && doc.NonTaxable == false && IsExternalTax(doc.TaxZoneID) && doc.InstallmentNbr == null)
            {
                if (TaxPluginMaint.IsActive(Base, doc.TaxZoneID))
                {
                    var service = ExternalTax.TaxProviderFactory(Base, doc.TaxZoneID);

                    CommitTaxRequest request = new CommitTaxRequest();
                    request.CompanyCode = ExternalTax.CompanyCodeFromBranch(Base, doc.TaxZoneID, doc.BranchID);
                    request.DocCode     = string.Format("AR.{0}.{1}", doc.DocType, doc.RefNbr);

                    if (doc.DocType == ARDocType.CreditMemo)
                    {
                        request.DocType = TaxDocumentType.ReturnInvoice;
                    }
                    else
                    {
                        request.DocType = TaxDocumentType.SalesInvoice;
                    }


                    CommitTaxResult result = service.CommitTax(request);
                    if (result.IsSuccess)
                    {
                        doc.IsTaxPosted = true;
                    }
                    else
                    {
                        //Avalara retuned an error - The given document is already marked as posted on the avalara side.
                        if (!result.IsSuccess && result.Messages.Any(t => t.Contains("Expected Posted")))
                        {
                            //ignore this error - everything is cool
                        }
                        else
                        {
                            //show as warning.
                            StringBuilder sb = new StringBuilder();
                            foreach (var msg in result.Messages)
                            {
                                sb.AppendLine(msg);
                            }

                            if (sb.Length > 0)
                            {
                                doc.WarningMessage = PXMessages.LocalizeFormatNoPrefixNLA(Messages.PostingToExternalTaxProviderFailed, sb.ToString());
                            }
                        }
                    }
                }
            }

            return(doc);
        }
        public string PXMessagesFormat()
        {
            string localizedString;
            object parameter = new object();

            localizedString = PXMessages.LocalizeFormat(InnerNamespace.NonLocalizableMessagesInNamespace.StringToFormat, parameter);
            localizedString = PXMessages.LocalizeFormat(NonLocalizableMessages.StringToFormat, out string prefix, parameter);
            localizedString = PXMessages.LocalizeFormatNoPrefix(NonLocalizableMessages.StringToFormat, parameter);
            localizedString = PXMessages.LocalizeFormatNoPrefixNLA(NonLocalizableMessages.StringToFormat, parameter);

            return(localizedString);
        }
 public UniqueBoolAttribute(Type key)
 {
     if (key == null)
     {
         throw new PXArgumentException("scope", Messages.ParameterShouldNotNull);
     }
     if (!(key.IsNested && typeof(IBqlField).IsAssignableFrom(key)))
     {
         throw new PXArgumentException("scope", PXMessages.LocalizeFormatNoPrefixNLA(Messages.IsNotBqlField, key.Name));
     }
     _key = key;
 }
        public string PXMessagesFormat()
        {
            string localizedString;
            object parameter = new object();

            localizedString = PXMessages.LocalizeFormat("Text with placeholder {0}", parameter);
            localizedString = PXMessages.LocalizeFormat("Text with placeholder {0}", out string prefix, parameter);
            localizedString = PXMessages.LocalizeFormatNoPrefix("Text with placeholder {0}", parameter);
            localizedString = PXMessages.LocalizeFormatNoPrefixNLA("Text with placeholder {0}", parameter);

            return(localizedString);
        }
        public string All()
        {
            string localizedString;
            object parameter = new object();

            localizedString = PXLocalizer.LocalizeFormat(MyMessages.CommasInUserName, parameter);
            localizedString = PXMessages.LocalizeFormat(MyMessages.CommasInUserName, parameter);
            localizedString = PXMessages.LocalizeFormat(MyMessages.CommasInUserName, out string refix, parameter);
            localizedString = PXMessages.LocalizeFormatNoPrefix(MyMessages.CommasInUserName, parameter);
            localizedString = PXMessages.LocalizeFormatNoPrefixNLA(MyMessages.CommasInUserName, parameter);

            return(localizedString);
        }
        protected virtual void Segment_RowDeleting(PXCache cache, PXRowDeletingEventArgs e)
        {
            var row         = (Segment)e.Row;
            var dimensionID = row.DimensionID;
            var segmentID   = row.SegmentID;

            if (Header.Current.ParentDimensionID != null && row.Inherited == true)
            {
                throw new PXException(Messages.SegmentNotOverridden, segmentID);
            }
            if (PXSelectReadonly <Segment, Where <Segment.parentDimensionID, Equal <Current <Segment.dimensionID> >,
                                                  And <Segment.segmentID, Equal <Current <Segment.segmentID> > > > > .SelectMultiBound(this, new object[] { row }).Count > 0)
            {
                throw new PXException(Messages.SegmentHasChilds, segmentID);
            }
            Segment lastSegmeent = PXSelect <Segment, Where <Segment.dimensionID, Equal <Current <Segment.dimensionID> > >,
                                             OrderBy <Desc <Segment.segmentID> > > .SelectSingleBound(this, new object[] { row });

            if (lastSegmeent != null && lastSegmeent.SegmentID > segmentID)
            {
                throw new PXException(Messages.SegmentIsNotLast, segmentID);
            }
            if (((SegmentValue)PXSelect <SegmentValue,
                                         Where <SegmentValue.dimensionID, Equal <Optional <Segment.dimensionID> >,
                                                And <SegmentValue.segmentID, Equal <Optional <Segment.segmentID> > > > > .
                 Select(this, dimensionID, segmentID)) != null)
            {
                if (row.ParentDimensionID == null)
                {
                    throw new PXException(Messages.SegmentHasValues, segmentID);
                }

                var answer = Header.Ask(Messages.Warning,
                                        PXMessages.LocalizeFormatNoPrefixNLA(Messages.SegmentHasValuesQuestion, segmentID),
                                        MessageButtons.YesNoCancel,
                                        MessageIcon.Warning);
                switch (answer)
                {
                case WebDialogResult.Yes:
                    break;

                case WebDialogResult.Cancel:
                    e.Cancel = true;
                    break;

                case WebDialogResult.No:
                default:
                    throw new PXException(Messages.SegmentHasValues, segmentID);
                }
            }
        }
            private T GetProcessor <T>() where T : class
            {
                V2SettingsGenerator seetingsGen = new V2SettingsGenerator(_provider);
                T processor = _plugin.CreateProcessor <T>(seetingsGen.GetSettings());

                if (processor == null)
                {
                    string errorMessage = PXMessages.LocalizeFormatNoPrefixNLA(
                        Messages.FeatureNotSupportedByProcessing,
                        CCProcessingFeature.ExtendedProfileManagement);
                    throw new PXException(errorMessage);
                }
                return(processor);
            }
Exemplo n.º 21
0
    //---------------------------------------------------------------------------
    /// <summary>
    /// The About panel load event handler.
    /// </summary>
    protected void pnlAbout_LoadContent(object sender, EventArgs e)
    {
        PXLabel lbl = (PXLabel)pnlAbout.FindControl("lblVersion");

        lbl.Text = this.GetVersion(false);

        lbl      = (PXLabel)pnlAbout.FindControl("lblAcumatica");
        lbl.Text = "Acumatica " + PXVersionInfo.ProductVersion;

        if (PX.SM.UpdateMaint.CheckForUpdates())
        {
            lbl                  = (PXLabel)pnlAbout.FindControl("lblUpdates");
            lbl.Text             = PXMessages.LocalizeFormatNoPrefix(PX.AscxControlsMessages.PageTitle.Updates, PXVersionInfo.Version);
            lbl.Style["display"] = "";
        }

        var lastRestoredSnapshot = CompanyMaint.GetLastRestoredSnapshot();

        if (lastRestoredSnapshot != null &&
            lastRestoredSnapshot.IsSafe != null &&
            !lastRestoredSnapshot.IsSafe.Value &&
            lastRestoredSnapshot.Dismissed != null &&
            !lastRestoredSnapshot.Dismissed.Value)
        {
            lbl      = (PXLabel)pnlAbout.FindControl("lblRestoredSnapshotIsUnsafe");
            lbl.Text = PXMessages.LocalizeFormatNoPrefixNLA(PX.Data.Update.Messages.UnsafeSnapshotRestoredShort,
                                                            lastRestoredSnapshot.CreatedDateTime != null ? lastRestoredSnapshot.CreatedDateTime.ToString() : "uknown date");
            lbl.ForeColor        = System.Drawing.Color.Red;
            lbl.Style["display"] = "";
        }

        lbl      = (PXLabel)pnlAbout.FindControl("lblCopyright2");
        lbl.Text = PXMessages.LocalizeFormatNoPrefix(PX.AscxControlsMessages.PageTitle.Copyright2);

        lbl = (PXLabel)pnlAbout.FindControl("lblInstallationID");
        // hiding InstallationID if it is empty
        if (String.IsNullOrEmpty(PXVersionInfo.InstallationID))
        {
            lbl.Visible = false;
        }
        lbl.Text = PXMessages.LocalizeFormatNoPrefix(PX.AscxControlsMessages.PageTitle.InstallationID, PXLicenseHelper.InstallationID);

        string copyR = PXVersionInfo.Copyright;

        lbl = (PXLabel)pnlAbout.FindControl("lblCopyright1");
        if (!string.IsNullOrEmpty(copyR))
        {
            lbl.Text = copyR;
        }
    }
Exemplo n.º 22
0
        public ReportNotificationGenerator(string reportId)
        {
            if (string.IsNullOrEmpty(reportId))
            {
                throw new ArgumentNullException("reportId");
            }

            _report = PXReportTools.LoadReport(reportId, null);

            if (_report == null)
            {
                throw new ArgumentException(PXMessages.LocalizeFormatNoPrefixNLA(Messages.ReportCannotBeFound, reportId), "reportId");
            }
        }
Exemplo n.º 23
0
        public string PXMessagesLocalizationFormatMethods()
        {
            string localizedString;
            object parameter = new object();

            localizedString = PXMessages.LocalizeFormat(MyMessages.StringToFormat, parameter);
            localizedString = PXMessages.LocalizeFormat(MyMessages.StringToFormat, out string prefix, parameter);
            localizedString = PXMessages.LocalizeFormatNoPrefix(MyMessages.StringToFormat, parameter);
            localizedString = PXMessages.LocalizeFormatNoPrefixNLA(MyMessages.StringToFormat, parameter);
            localizedString = PXMessages.LocalizeFormatNoPrefix(ComplexMessages.DocDiscountExceedLimit, parameter);
            localizedString = PXMessages.LocalizeFormatNoPrefix(ComplexMessages.DateTimeStr, DateTime.Now);

            return(localizedString);
        }
Exemplo n.º 24
0
            private V2.ICCProfileProcessor GetProcessor()
            {
                V2SettingsGenerator settingsGen = new V2SettingsGenerator(_provider);

                V2.ICCProfileProcessor processor = _plugin.CreateProcessor <V2.ICCProfileProcessor>(settingsGen.GetSettings());
                if (processor == null)
                {
                    string errorMessage = PXMessages.LocalizeFormatNoPrefixNLA(
                        Messages.FeatureNotSupportedByProcessing,
                        CCProcessingFeature.ProfileManagement);
                    throw new PXException(errorMessage);
                }
                return(processor);
            }
        private void HandleSetDescriptionRefName(ARPaymentEntry graph)
        {
            graph.FieldUpdated.AddHandler <ARPayment.customerID>((cache, e) =>
            {
                var pmt     = (ARPayment)e.Row;
                var cust    = (BAccountR)PXSelectorAttribute.Select <ARPayment.customerID>(cache, pmt);
                pmt.DocDesc = PXMessages.LocalizeFormatNoPrefixNLA(Messages.PaymentFrom, cust.AcctName);
            });

            //PaymentRefNumberAttribute behave so nicely that we only get it at the time of persisting
            graph.RowPersisting.AddHandler <ARPayment>((cache, e) =>
            {
                ((ARPayment)e.Row).ExtRefNbr = String.Empty; //Don't even think putting null here
            });
        }
Exemplo n.º 26
0
        private decimal CalculateRollupQty <T>(T row, IQuantify budget, decimal quantity) where T : IBqlTable, IQuantify
        {
            if (string.IsNullOrEmpty(budget.UOM) || string.IsNullOrEmpty(row.UOM) || quantity == 0)
            {
                return(0);
            }

            if (budget.UOM == row.UOM)
            {
                return(quantity);
            }

            decimal result = 0;

            if (budget.InventoryID == PMInventorySelectorAttribute.EmptyInventoryID)
            {
                //<Other> item is present. Update only if UOMs are convertable.
                decimal convertedQty;
                if (IN.INUnitAttribute.TryConvertGlobalUnits(graph, row.UOM, budget.UOM, quantity, IN.INPrecision.QUANTITY, out convertedQty))
                {
                    result = convertedQty;
                }
            }
            else
            {
                //Item matches. Convert to UOM of Project Budget.
                if (PXAccess.FeatureInstalled <FeaturesSet.multipleUnitMeasure>())
                {
                    decimal inBase = IN.INUnitAttribute.ConvertToBase(graph.Caches[typeof(T)], row.InventoryID, row.UOM, quantity, IN.INPrecision.QUANTITY);
                    try
                    {
                        result = IN.INUnitAttribute.ConvertFromBase(graph.Caches[typeof(T)], row.InventoryID, budget.UOM, inBase, IN.INPrecision.QUANTITY);
                    }
                    catch (IN.PXUnitConversionException ex)
                    {
                        IN.InventoryItem item = PXSelectorAttribute.Select(graph.Caches[typeof(T)], row, "inventoryID") as IN.InventoryItem;
                        string           msg  = PXMessages.LocalizeFormatNoPrefixNLA(Messages.UnitConversionNotDefinedForItemOnBudgetUpdate, item?.BaseUnit, budget.UOM, item?.InventoryCD);

                        throw new PXException(msg, ex);
                    }
                }
                else
                {
                    result = IN.INUnitAttribute.ConvertGlobalUnits(graph, row.UOM, budget.UOM, quantity, IN.INPrecision.QUANTITY);
                }
            }
            return(result);
        }
Exemplo n.º 27
0
        private static void _createPayments(List <ARInvoice> list, PayBillsFilter filter, CurrencyInfo info)
        {
            bool           failed = false;
            ARPaymentEntry pe     = PXGraph.CreateInstance <ARPaymentEntry>();

            list.Sort((in1, in2) =>
            {
                if (in1.CustomerID != in2.CustomerID)
                {
                    return(((IComparable)in1.CustomerID).CompareTo(in2.CustomerID));
                }
                return(((IComparable)in1.PMInstanceID).CompareTo(in2.PMInstanceID));
            }
                      );
            for (int i = 0; i < list.Count; i++)
            {
                ARInvoice doc       = list[i];
                ARPayment pmt       = null;
                bool      docFailed = false;
                try
                {
                    pe.CreatePayment(doc, info, filter.PayDate, filter.PayFinPeriodID, false);
                    pmt = pe.Document.Current;
                    if (pmt != null)
                    {
                        pmt.Hold = false;

                        FinPeriodIDAttribute.SetPeriodsByMaster <ARPayment.finPeriodID>(pe.Document.Cache, pmt, filter.PayFinPeriodID);
                    }
                    pe.Save.Press();
                }
                catch (Exception e)
                {
                    PXFilteredProcessing <ARInvoice, PayBillsFilter> .SetError(i, e.Message);

                    docFailed = failed = true;
                }

                if (!docFailed)
                {
                    PXFilteredProcessing <ARInvoice, PayBillsFilter> .SetInfo(i, PXMessages.LocalizeFormatNoPrefixNLA(Messages.ARPaymentIsCreatedProcessingINProgress, pmt.RefNbr));
                }
            }
            if (failed)
            {
                throw new PXException(Messages.CreationOfARPaymentFailedForSomeInvoices);
            }
        }
 public static IExtendedProfileProcessingWrapper GetExtendedProfileProcessingWrapper(object pluginObject, CCProcessingContext context)
 {
     if (pluginObject is V1.ICCPaymentProcessing)
     {
         string errorMessage = PXMessages.LocalizeFormatNoPrefixNLA(
             Messages.FeatureNotSupportedByProcessing,
             CCProcessingFeature.ExtendedProfileManagement);
         throw new PXException(errorMessage);
     }
     if (pluginObject is V2.ICCProcessingPlugin)
     {
         return(new V2ExtendedProfileProcessor((V2.ICCProcessingPlugin)pluginObject,
                                               Repositories.CardProcessingReadersProvider.GetCardProcessingProvider(context)));
     }
     throw new PXException(V1.Messages.UnknownPluginType, pluginObject.GetType().Name);
 }
Exemplo n.º 29
0
 private V1.ICCTokenizedPaymentProcessing GetProcessor()
 {
     _plugin.Initialize(
         _provider.GetProcessingCenterSettingsStorage(),
         _provider.GetCardDataReader(),
         _provider.GetCustomerDataReader());
     V1.ICCTokenizedPaymentProcessing profileProcessor = _plugin as V1.ICCTokenizedPaymentProcessing;
     if (profileProcessor == null)
     {
         string errorMessage = PXMessages.LocalizeFormatNoPrefixNLA(
             Messages.FeatureNotSupportedByProcessing,
             CCProcessingFeature.ProfileManagement);
         throw new PXException(errorMessage);
     }
     return(profileProcessor);
 }
Exemplo n.º 30
0
        public virtual IEnumerable CancelInvoice(PXAdapter adapter)
        {
            if (Base.Document.Current == null)
            {
                return(adapter.Get());
            }
            Base.Save.Press();

            EnsureCanCancel(Base.Document.Current, false);

            var reverseArgs = new ReverseInvoiceArgs {
                ApplyToOriginalDocument = true
            };

            if (this.CancellationInvoiceCreationOnRelease)
            {
                var existingCorrectionInvoiceSet = (PXResult <ARInvoice, CurrencyInfo>)
                                                   PXSelectReadonly2 <ARInvoice,
                                                                      InnerJoin <CurrencyInfo, On <CurrencyInfo.curyInfoID, Equal <ARInvoice.curyInfoID> > >,
                                                                      Where <ARInvoice.origDocType, Equal <Current <ARInvoice.docType> >,
                                                                             And <ARInvoice.origRefNbr, Equal <Current <ARInvoice.refNbr> >,
                                                                                  And <ARInvoice.isCorrection, Equal <True> > > > >
                                                   .Select(Base);

                ARInvoice    existingCorrectionInvoice = existingCorrectionInvoiceSet;
                CurrencyInfo currencyInfo = existingCorrectionInvoiceSet;

                if (existingCorrectionInvoice == null)
                {
                    throw new RowNotFoundException(Base.Document.Cache, Base.Document.Current.DocType, Base.Document.Current.RefNbr);
                }
                reverseArgs.DateOption           = ReverseInvoiceArgs.CopyOption.Override;
                reverseArgs.DocumentDate         = existingCorrectionInvoice.DocDate;
                reverseArgs.DocumentFinPeriodID  = existingCorrectionInvoice.FinPeriodID;
                reverseArgs.CurrencyRateOption   = ReverseInvoiceArgs.CopyOption.Override;
                reverseArgs.CurrencyRate         = currencyInfo;
                reverseArgs.OverrideDocumentHold = false;
                using (new PXLocaleScope(Base.customer.Current.LocaleName))
                {
                    reverseArgs.OverrideDocumentDescr = PXMessages.LocalizeFormatNoPrefixNLA(Messages.CorrectionOfInvoice, Base.Document.Current.RefNbr);
                }
            }

            return(Base.ReverseDocumentAndApplyToReversalIfNeeded(adapter, reverseArgs));
        }