Wednesday, March 13, 2013

Removig Artificial Intelligence from GL Journal Entry Screen.

Hi Guys,

GL Journal Entry screen has one controversial feature - auto balancing of Debit to Credit for the line entered in the grid.

Its like when you enter Debit 100$ then you move to the next line, system auto defaults Credit to be 100$. Well its nice to have but...would be great to be able to switch it off...when needed.

So after some browsing throught the code, just realised, the calculation is hidden into a Method PopulateSubDescr

So, if you do not like DR to be == to CR :) for each line, then just override that method in your customization code with this statment. Well what I did - just removed AI piece of code. So just leave this:


protected override void PopulateSubDescr(PXCache sender, GLTran Row, bool ExternalCall)
        {
            GLTran prevTran = null;
            foreach (GLTran tran in GLTranModuleBatNbr.Select())
            {
                if (Row == tran)
                {
                    break;
                }
                prevTran = tran;
            }
            if (prevTran != null)
            {
                if (prevTran.SubID != null)
                {
                    Sub sub = (Sub)PXSelectorAttribute.Select<GLTran.subID>(sender, prevTran);
                    if (sub != null)
                    {
                        sender.SetValueExt<GLTran.subID>(Row, sub.SubCD);
                        PXUIFieldAttribute.SetError<GLTran.subID>(sender, Row, null);
                    }
                }
                Row.TranDesc = prevTran.TranDesc;
                Row.RefNbr = prevTran.RefNbr;
            }
            else
            {
                Row.TranDesc = BatchModule.Current.Description;
            }
            Account account = (Account)PXSelectorAttribute.Select<GLTran.accountID>(sender, Row);
            if (account != null && account.CashSubID != null)
            {
                Row.SubID = account.CashSubID;
            }
            if (account != null && (bool)account.NoSubDetail && glsetup.Current.DefaultSubID != null)
            {
                Row.SubID = glsetup.Current.DefaultSubID;
            }
            
        }

Have a nice Day!
Sergey. :)

Adding Missing Columns to the grid Upload Data Import Function.

Hi Everyone,

We can upload data directly from Excel into Acumatica screens, as long as screen detail area (or grid) has Action Button "Upload". Like, for example, Journal Entry screen from GL module.


But not all the fields will be presented in the Screen Fields choice:


Like above, Transaction Date, that is present in the screen is missing in the Property Name choice.

In order to add it, a slight customization will be needed. This field is hidden on the form by the Business Logic code. And we have to re-enable it.

Adding the following code to Batch_RowSelected event will help to make the column visible.
Under normal circumstances you need to add an event in your Customization Manager if have not yet made so:

protected override void Batch_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
  base.Batch_RowSelected(sender, e);
  var row = (Batch)e.Row;

  PXUIFieldAttribute.SetVisible<GLTran.tranDate>(GLTranModuleBatNbr.Cache, null, true);
    
}
Here you can see that we made Transaction Date visible by changing it's property to True.

All the best,

Sergey.

Updating One Field from Another. Easy Customization.

Hi Everyone.

One of the most often called customization requests is to default (or update) a Field A, based on what was entered in a Field B. And now its time for me to post a memo article on standard technique for this customization.

Lets define a scope of work:

1. When we issue an invoice to a customer.
2. And then select a Project used by this customer.
3. We have to default a Customer Ref Number field with a Project Purchase Order Number.
4. Which is, in its own case, an Attribute of a Project, and has to be retrieved from there.
5. PO Number is defined in Project Module "Attributes" screen and entered into a "Project" Maintenance screen.

Something like this:



In the video below I comment on customization done. Please find the code for the customization below.



Here is the code:

using System;
using System.Collections;
using System.Collections.Generic;
using PX.Data;
using PX.Objects.GL;
using PX.Objects.CM;
using PX.Objects.CS;
using PX.Objects.CR;
using PX.Objects.TX;
using PX.Objects.IN;
using PX.Objects.BQLConstants;
using PX.Objects.EP;
using PX.TM;
using SOInvoice PX.Objects.SO.SOInvoice;
using SOInvoiceEntry PX.Objects.SO.SOInvoiceEntry;
using PX.Objects.SO;
using PX.Objects.DR;
using PX.Objects;
using PX.Objects.AR;
using PX.Objects.PM;

namespace PX.Objects.AR
{
  [PXCustomization]
  public class Cst_ARInvoiceEntryARInvoiceEntry
  {

    #region Event Handlers
protected override void ARInvoice_ProjectID_FieldUpdated(PXCache senderPXFieldUpdatedEventArgs e)
{
  base.ARInvoice_ProjectID_FieldUpdated(sendere);
  var row (ARInvoice)e.Row;
  var ProjectID row.ProjectID;
  var CustRefNbr row.InvoiceNbr;
  string EntityType "PR";
  string Attribute "PONUMBER";
  //CustRefNbr = CustRefNbr + 1;
     
  PMProject pm PXSelect<PMProject,
             Where<PMProject.baseTypeEqual<PMProject.ProjectBaseType>And<PMProject.nonProjectEqual<False>And<PMProject.contractIDEqual<Current<ARInvoice.projectID>>And<PMProject.isTemplateNotEqual<True>>>>>>.SelectSingleBound(thisnew object [e.Row });
  
  if (pm != null)
  {
  //CustRefNbr = pm.ContractCD;

  PXResultset<CSAnswersres PXSelectJoin<CSAnswers,
       InnerJoin<CSAttributeOn<CSAttribute.attributeIDEqual<CSAnswers.attributeID>>>,
       Where<CSAnswers.entityTypeEqual<Required<CSAnswers.entityType>>,
       And<CSAnswers.attributeIDEqual<Required<CSAnswers.attributeID>>,
       And<CSAnswers.entityIDEqual<Required<CSAnswers.entityID>>>>>>.Select(thisEntityTypeAttributepm.ContractID);
  
  CSAnswers ans res;

  if (ans.Value != null)
  {
    
  //CustRefNbr = ans.Value;

  ARInvoice line sender.CreateCopy(rowas ARInvoice;
  line.InvoiceNbr ans.Value;
  sender.Update(line);
  //string msg = CustRefNbr;
  //throw new PXSetPropertyException(msg);
  //row.InvoiceNbr = CustRefNbr;
}}}


    #endregion

  }


}

All the best,
Sergey.

Wednesday, February 20, 2013

Issues with Google Chrome embedded PDF viewer. Use workaround till Chromium team fixes it.

Hi Everyone,

Recently some of our customer started reporting an issue with Google Chrome, while printing reports it cuts the page and does not display details. Also it may hide images embedded into PDF report format. IE and Mozilla FireFox works perfectly fine.

We have checked with Chromium team, found that this issue is a known bug and they work on it. But until the fix is deployed you can use a workaround.

Main sense is to disable built in PDF Viewer and replace it with external plug-in from Adobe. System will still open PDF inside the browser, but without any glitches.

Chromium team, please hurry up :)

Ok, the workaround is to install Adobe PDF Reader on your PC.

Then, once you confirmed you are running the latest Chrome and Adobe Reader, and if issue is still there please try this:

1. Open Chrome and type this into address bar:  chrome://plugins/
It will open plugin page.

2. You should see a list of all the Plug-ins installed for Chrome, please find one called Chrome PDF Viewer plugin, it may look like this:


3. Please make this plugin grayed out (disabled) by clicking on Disable link:


4. After that it should show you this


5. It will now save you a file locally on your PC for viewing by ordinary PDF reader.

If saving a file locally is not preferred option you may do it another way.

1. Install Adobe PDF Reader. Open Chrome and type this into address bar:  chrome://plugins/
2. Find the Adobe Reader plugin.


3. And make it Enabled


4. Please note that Built In Chrome PDF Viewer should be disabled in this configuration:

All the best,

Sergey.