Archives

Archives / 2018 / August
  • Prediction customization

    Hello everybody,

    here I want to describe in more details what I mean when I say prediction customization.

    As name says by itself, I want to make something that will help you to make predictions. 

    Predictions for what? 

    Acumatica has plenty of entities: invoices, sales orders, employees, taxes, acounts payable, acounts receivable, fixed assets, etc. I want to make customization, that will use some machine learning techniques in order to say something like: in the next month based on history of your your sales, you'll have 2000 sales orders. Or based on your current history, you'll pay 300 000 taxes in the next two months. Or based on your history of hiring, in next three years you'll … more

  • Acumatica clipboard functionality

    Hello,

    today I want to drop few lines about working with copy/paste functionality of Acumatica.

    For full canceling insertion from Clipboard, you can use the following in your graph:

    public override bool CanClipboardCopyPaste()

    {

    return false;

    }

    Also you can use attribute PXCopyPasteHiddenFields. That attribute says that specified fields of the primary DAC of the data view will no be copied when the copy-paste feature is used.

    Another attribute which you can consider is PXCopyPasteHiddenView. This attribute says that cache corresponding to the primary DAC of the data view is not copied when the copy-paste feature is used.

    And one more useful fields in graph itself is … more

  • Make printing of one table per page with CSS

    Hello erybody,

    today I want to share one important note, which took significant amount of time from me to finish.

    I had page which as html output few tables. For me it was nessesary to make one page per table. In order to achieve it I've found following CSS:

    <style>

        table,

        table tr td,

        table tr th {

            page-break-inside: avoid;

        }

    </style>

    That was only one css that worked for me.

    more

  • How to add Database context to Filter in .Net Core 2.0

    Hello everybody,

    today I want to write a short description on how to add database context to IAuthorizationFilter.

    Imagine that you have following filter:

    public class HasApprovedFilter : Attribute, IAuthorizationFilter

    {

        private SomeDbContext _context;

        public HasApprovedFilter(SomeDbContext context)

        {

            this._context = context;

        }

        public void OnAuthorization(AuthorizationFilterContext context)

        {

            var user = context.HttpContext.User;

            if (!user.Identity.IsAuthenticated)

            {

                return;

            }

            var userAdd = _context.;

            //var um = context.HttpContext.RequestServices.GetService();

        }

    } … more

  • Types of fliters in .Net Core

    Hello everybody,

    today I want to make a short document about filters in .Net Core.

    There are by default four types of filters:

    Filters that implement IAuthorizationFilter which allow us to implement OnAuthorization method which allow us to add custom security logic.

    Filters that implement IActionFilter has two methods: OnActionExecuting, OnActionExecuted. Those two methods executed before and after action executing.

    Filters that implement IExceptionFilter has method OnException, which allows to handle exceptions.

    Filters that implement IResultFilter has two methods: OnResultExecuting, OnResultExecuted.

    Filters can be applied at controller or at action level. That gives following … more

  • How to override part of C# code in Automation Steps in Acumatica

    Hello everybody,

    today I want to share one interesting gotcha which took plenty of efforts from mine side in order to understand it.

    Recently I got an assignment to modify behaviour of Create Prepayment action at purchase orders. 

    If to look at CreatePreapyment implementation, it has following part of code:

    if (this.Document.Current == null)

      return;

    this.Save.Press();

    APInvoiceEntry instance = PXGraph.CreateInstance<APInvoiceEntry>();

    if (this.Document.Current.PrepaymentRefNbr == null)

    {

    if to put simply it checks if current purchase order already has a prepayment, and in case if it has, then give to a user error message. 

    Imagine, that you need to modify that behaviour for … more

  • How to override Create Prepayment in Acumatica without usage of custom delegate

    Hello everybody,

    today I want to share with you on how to override Action CreatePrepayment in Acumatica.

    General rule of overriding methods in Acumatica according to T300 manual is like this:

    Create delegate.

    Add [PXOverride] over your method which is named exactly as base method ( in our case CreatePrepayment )

    Add your implementation

    For example you can achieve it like this:

    //Create your delegate

    public delegate void CreatePrepaymentDelegate();

    [PXOverride]

    public void CreatePrepayment(CreatePrepaymentDelegate baseDel)

    {

        // your code of overriding

    }

    Way from manual T300 is perfectly workable, but  I propose you to use feature of .Net which is named Action, … more

  • Creating custom Autonumber which will be auto generated ID in Acumatica

    If you want to create custom Attribute for autonumbering field you need:

    Create Setup page for configuring autonumbering field or maybe you can use existing

    Create Attribute which you'll add to your entity

    Add attribute to field that you need increment 

    Create Setup page for configuration autonumbering field

    Setup.cs like this:

    [System.SerializableAttribute()]

        [PXPrimaryGraph(typeof(CurrencyMaint))]

        [PXCacheName("Your company Preferences")]

        public class Setup : PX.Data.IBqlTable

        {

            #region DocumentRefNbr

            public abstract class documentRefNbr : PX.Data.IBqlField

            {

            }

            protected string _DocumentRefNbr;

            [ … more

  • Entity Framework one to many relationship

    Hello everybody,

    today I want to make short post on how to confiugre one to many relationship in Entity Framework 6.

    Imagine following: One group can have multiple students. So one to many relationship. For this purpose you can use following convention configuration agreement:

    public class Student

    {

        public int StudentId { get; set; }

        public string StudentName { get; set; }

    }

    public class Group

    {

        public int GroupId { get; set; }

        public string GroupName { get; set; }

        public string Department { get; set; }

        public List<Student> Students { get; set; }

    }

    In presented example class group includes navigation property Students. 

    Another convention is … more