Monday, 14 August 2017

Number to Words Localization

Good Day.

Today want to give you an idea on how can you customize amount to words transcription in Acumatica.That might be required for any language localization.
Here you can find simple example, but real complexity might be related to your language rules.

All the main work around that feature is done by [PX.Objects.AP.ToWordsAttribute]
It can be defined on virtual field, and upon accessing by UI or Report will do automatic transcription from number to text.
e.ReturnValue = LangEN.ToWords((decimal)((PXDecimalState)DecimalVal).Value, ((PXDecimalState)DecimalVal).Precision);

If you need you can apply that attribute to other amounts and reuse transcription for other reports.
You can read more about it on StackOverflow.

Wednesday, 9 August 2017

Printing Two Reports at Once

Hi All,

Want to share with you one trick that I just discovered with help of one of our great partners in Africa region.

If you need to print 3 copies of the invoice (Customer Copy; Finance Copy; and Distribution Copy) at one click, you can use this trick:
All you need is just create 2 reports and include copy into the main one as sub-report.

See steps here:

1) Have 2 reports. I'm using here 2 invoice formats form Sales Demo data.

2) Open main (of first) report in report designer and add new sub-report in the last (report footer) section.

Do not forget to do following there:
  • Specify Second report name in the sub-report configuration.
  • Pass parameters from main report to sub-report
  • Add a page break before printing a copy
3) Now you can save report to Acumatica and test it.


Have a nice reporting!

Monday, 7 August 2017

Redirecting to External Page from Button

Hi There,

Want to share with you my experience with working with redirects from Acumatica.

You may know that due to security issues and stability of software, redirect to external web site in the iFrame is forbidden in Acumatica.
So every time when you use "PXRedirectToUrlException" for url like "http://acumatica.com" system will open url in separate window/tab. That is OK in mane cases, but sometimes you really need that functionality.

One way to solve that issue is well described in a separate article - Redirect on Page Load 
But that one is applicable only if you want to have a menu item in Acumatica SiteMap.

If you want to redirect use based on internal logic/code, that this way may not be the best.
To understand how to solve that issue, I want to explain how redirects works in Acumatica first

You know there there are multiple redirect exceptions available:
  • PXRedirectRequiredException
  • PXRedirectToUrlException
  • PXRedirectWithReportException
  • PXRedirectToGIException
  • And many others.
Architecture
But basically all of them are different only in how system search for required URL and with cache of items (if you redirect to another screen). So for example "PXRedirectRequiredException" will find URL from sitemap based on graph type to what you do redirect.

After url is determined, system cancel current round trip and returns a special message back to JavaScript in the page. This message is "eRedirect<CODE>:<URL>" keyword with url and no other data.
<CODE> - is a number from 1 to 8 that defines how system should open new page
  • Redirect0 - open page in the same iFrame with no keeping session
  • Redirect1 - same as above but with keeping session
  • Redirect5, Redirect6 - same as above but with new popup
  • Redirect3 - will open new frame-set
  • Redirect7, Redirect8 - will open a new window

Solution
So as soon as you know how does it work, there is simple solution - throw your own exception with specific code instead of standard one:

    public PXAction<PX.Objects.PO.POReceiptRedirect;
  
    [PXButton(CommitChanges true)]
    [PXUIField(DisplayName "Redirect")]
    protected void redirect()
    {
       throw new Exception("Redirect0:" "http://acumatica.com");
    }

That code will open Acumatica page in the same frameset, just as an inner page.

Have a nice redirection!

Tuesday, 1 August 2017

Copy Dashboard using SQL

Hi There

In case you need it, in Acumatica 6.0 and later all dashboards are located in just 2 tables - Dashboard and Widget.
We planning to add ability to copy dashboard soon, but until it is not available, you can use that SQL stored procedure.

There is procedure and code to execute it.

SQL Script:

Have a nice dashboard designing!

Monday, 24 July 2017

Actions and Primary View

Hi There,

Today we are going to speak about Actions in Acumatica, as well known as Buttons.

When you creating a button you basically just need to write a simple code snippet like here:
#region Event Handlers
public PXAction<PX.Objects.GL.BatchMyButton;  
[PXButton(CommitChanges true)]
[PXUIField(DisplayName "My Button")]
protected void myButton()
{
}
#endregion

As soon as you add this button as extension and publish it, you will see button appeared on the screen.
But from platform standpoint there is much more than button handler, let check how does it work:

Wednesday, 19 July 2017

Getting Report PDF through Web Servies

Hi All,

Today want to show you very simple example of getting printing report and getting it's PDF representation thought Screen Based API.

For doing this we need:
  1. Screen-based Endpoint to Report.
  2. Import Web services References to our project
  3. Fill report parameters using Value command.
  4. Request Report to be formatted as PDF (schema.ReportResults.PdfContent). Please note that you also can get a HTML representation of report.
  5. Receive report binary data from Acumatica using Submit command from Web Services.
  6. Save data somewhere. In my case i'm just saving report as a file to file system, but you can process it however you need.

Full Code Sample:

Have a nice Integration.

Monday, 17 July 2017

Negative Number Representation in Reports

Hi There,

Just want to share with you short tip: if you want to have a different representations of negative numbers in the report, it is easy to do using format file in control properties.

So if you have negative numbers with "-" sign, like here:

You can change format in control Properties.

For that example, if you want to show it in brackets (1) instead of -1, than just use following mask:
 #,##0.00;(#,##0.00)
As you can see here, negative representation is specified after ";" sign.
Masks are related to standard .NET formatting rules.

And than you can check it in browser.


Have a fast reporting!

Monday, 10 July 2017

Fast Attaching to IIS Process

Hi Everyone,

What to share with you one more cool trick - how to save few seconds on attaching Visual Studio for debugging Acumatica ERP or Customization Library.

Visual Studio has really good Extensions Market, where you can easily find something developed by other great guys. You can find in under "Tools -> Extensions and Updated"

And one of the apps I really like there is "Attach To" plugin.

It is super simple and has just few buttons, but in the same time it does essential thing - attaching to IIS process with one click!

May be it is really big deal, but as less routine operations you have, as more interesting you work becomes!

Have a nice debugging!

Friday, 7 July 2017

SQL Formating Tools

Hi There,

If you are working with Generic Inquiries or Reports or doing a lot of development on Acumatica you most probably have seen already such big and nice queries.

And that one is just simple invoice form with one record :)
Even if you copy it to SQL Management Studio, it will not be better.

But fortunately there are few tools that can help you a lot!

1) Apex SQL Refactor ( https://www.apexsql.com/sql_tools_refactor.aspx )
Even better free plugin to SQL Management Studio that can immediately format query right in place with one button click.

2) Instant SQL Formatter ( http://www.dpriver.com/pp/sqlformat.htm )
Great free cloud app that can format SQL query right in the browser for you.


Personally I like Apex SQL refactor more, as works in Management Studio and gives me much more nice options, that is really great for any developer.

Have a nice formatting!

Tuesday, 4 July 2017

Discovery and Demo Preparation

Hi Everyone.

Past some time I have a great opportunity to participate and even run some product presentations with end prospects. And it was really great.

One think that I have noticed from day first there is that even if demo not always go as planned, but it still mostly depend on proper preparations. So here we have logical conclusion - as more prepared you are as more chances to win you have.

But when it really comes to demo preparation how are you doing that? If you are doing your demo number 100 than may be you already have your own strategy and you definitely knows what you need to do. However, if you are a new guy as me, that might be a very complicated question.

Just as an example - I'm a technical guy and before my first demo i thought, that i just need to collect as much benefits of my product as I can. Than my client take/accept all the benefits and make a decision by them self. Easy right? Just give them as much cool and super cool stuff as possible and that is all!

Unfortunately that is totally wrong. Yes, you are selling logical and algorithmic software, but you are selling it to real humans in the social and emotional world. Everyone has own mood, motivation and even vision. Just as for example -when I see a new car, I think about power, my wife thinks about color. The same is about software.
So when I understand that, I really have realized how important is preparation before selling any thing. You need to know how to use or/and manipulate your buyers. Like if you are clever child and you want to have a new toy, you will try to manipulate your mother, so she can buy it for you. But in that example you already knows your mom, that that is much easier :)

That preparation and investigation in sales process calls - discovery session. You should always have it in any case before each demo. And when you are there try to think that you are not a engineer, consultant, developer - feel yourself as detective, psychologist to understand clients needs and problems.
And do not forget about multiple different guys that you will have on demo, that means that you need to do that multiple times.