Extend Tax Calculation Precision

Hi All, A while ago I got a question about extract from document tax calculations in Acumatica. In Thailand there is requirement by law to calculate tax from Document Amount, however in Acumatica we have only option to extract tax from item amount. However this calculation is not aways correct due to rounding differences between line amounts and document amount. For example if you have 7% tax and 3 lines (47000, 18000, 9000) with total 74000 than: If you calc taxes from each line and sum it than you get Taxable Amt = 69,158.87, Tax Amt = 4,841.13 If we calc if using excel (Amt – Amt*1.07), than Taxable Amt… Read more

Tenant Selector In Acumatica

Hi All, Quick trick for you. If you need to link several tenants together, you can use the code from this article Tenant selector attribute: #region NeuralCompanySelectorAttribute public class CompanySelectorAttribute : PXCustomSelectorAttribute { public CompanySelectorAttribute() : base(typeof(UPCompany.companyID)) { DescriptionField = typeof(UPCompany.loginName); } protected virtual IEnumerable GetRecords() { PXCache cache = _Graph.Caches[typeof(UPCompany)]; Int32 current = PX.Data.Update.PXInstanceHelper.CurrentCompany; foreach (UPCompany info in PXCompanyHelper.SelectCompanies(PXCompanySelectOptions.Visible)) { if (current != info.CompanyID) yield return info; } } public override void DescriptionFieldSelecting(PXCache sender, PXFieldSelectingEventArgs e, string alias) { if (e.Row == null || (sender.GetValue(e.Row, _FieldOrdinal) == null)) base.DescriptionFieldSelecting(sender, e, alias); else { UPCompany item = null; Object value = sender.GetValue(e.Row, _FieldOrdinal); Int32 key = (Int32)value; foreach (UPCompany info… Read more

Put Document on Hold with Code

Hi All May Acumatica documents have an imbedded workflow. Hold/Unhold is usually a part of this worflow. Sometimes we may want to emulate user behavior thought the code, but there is a trick here. Acumatica’s Hold checkbox usually adds a hidden button that is triggered automatically when you check/uncheck hold. When you work thought the code you need to consider it and call button as well. Here is example on how to call hold on Purchase Order: public PXAction<POOrder> PutOnHold; [PXButton()] [PXUIField(DisplayName = “Put On Hold”)] public void putOnHold() { POOrder row = Base.Document.Current; if (row != null) { //row.Status = POOrderStatus.Hold; row.Hold = true; row = Base.Document.Update(row); Base.hold.Press(); }… Read more

Dashboards based on Real Screen

Hi All, You may know that it is easy to do a dashboard in Acumatica based on Generic Inquiry. But you also can enable your custom real screen to be a dashboard source. To do this you actually need only 3 things: Mark your Graph as dashboard source: [PX.Objects.GL.TableAndChartDashboardType] Mark you Data View as Filterable: [PXFilterable] Add a Data View delegate. For some reason dashboard does not work without it. I hope this issue will be solved soon. Full code source: using System; using System.Collections; using System.Collections.Generic; using PX.Data; using PX.Objects.AR; namespace CUrrentBranch { [PX.Objects.GL.TableAndChartDashboardType] public class CurrentBranchInvoices : PXGraph<CurrentBranchInvoices> { public PXCancel<ARInvoice> Cancel; [PXFilterable] public PXSelect<ARInvoice> MasterView; public virtual… Read more

Override Action – Confirmation Dialog

Hi Everyone, Want to give you an example of how to modify an action in Acumatica. specifically I’ll customize a Release action on Payments and Applications with adding a Confirmation Dialog with conditions. To customize an action we should follow the Acumatica customization guide. In simple words we should do following: Find the original action. Create a graph extension. Redefine the original action with the same parameters. Add own logic in the new action. Call base action code. Base Action Code To find the original Action you can use Source Code browser. Custom Code Your code will be called instead of the base action. You can put your custom code… Read more

Selecting data though Acumatica PXSelectorAttribute

Hi everyone, Today, I would like to share with you small tip to work with PXSelectorAttribute base on my experiences. Here is the story, let me image that you have the DAC and you want to add more information which is just supporting information and you dont want to save it. Please take a look on my DAC bellow. And now I would like to get the value of Default Price to display after I choose the Inventory Item. I will create code in the in the FieldUpdatedEvent like bellow In the conclusion, depends on your scenario you can use PXSelectorAttribute to get data from the cache. It would be… Read more

Custom field on CR Quote screen

Hi Everyone, If you try to add a custom field on CR Quotes in Acumatica 2018 R2 you may face very weird behavior – field is added, can be saved to database but as soon as you refresh screen or record valued disappears. The reason of this issues is PXProjection that is described in my separate article: PXProjection – SQL Views using BQL  This image show you how projection is defined in Acumatica CRM PXProjection uses 2 Data Access Classes for quotes: One class represents the table – PX.Objects.CR.Standalone.CRQuote Another represents view as combination of DACs in select – PX.Objects.CR.CRQuote And to correctly work, custom field needs to be added in… Read more

Use Split Container from Customization Browser

Hi Everyone, You may know that in Acumatica you can put several large containers (like grids and forms) together. But to controls or optimize space usage on small screen Acumatica uses special Split Container control. Basically this is the panel that you can drag and drop to reallocate space used by nested controls. To handle it Acumatica ASPX markup has special element: <px:PXSplitContainer runat=”server” ID=”PXSplitContainer1″ Orientation=”Horizontal”>   <AutoSize Enabled=”true” Container=”Window” />   <Template1> </Template1>   <Template2> </Template2> </px:PXSplitContainer> Under the Template1 and Template2 elements you can place other container controls like Form and Grid.  Here I have an example for putting grid into the Template1. <Template1>   <px:PXGrid runat=”server” ID=”grid11″ Height=”150px” SkinID=”DetailsInTab”  Width=”100%” SyncPosition=”True”>     <AutoSize Enabled=”True” MinHeight=”150″ />     <Levels>       <px:PXGridLevel DataMember=”DataMember1″>         <Columns></Columns>       </px:PXGridLevel>     </Levels>   </px:PXGrid> </Template1> Do not forget… Read more

Toggle List as Entry Point

Hi All, List as entry point is very nice feature that allows yoг to see multiple documents together. However in some cases you may want to get document faster and eliminate unnecessary clicks. Luckily Acumatica gives your options to choose if you want to enable it or now. You can control this for Modern UI and Classic UI separately.  Just go to screen Lists as Entry Points (SM208500) In the end to make my life few seconds easier I have created a simple button that can toggle On and Off lists as entry point wherever I need them or not. View the code on Gist. Have a easy UI.

Auto-Numbering Customization

Hi All, In Acumatica PX.Objects.CS.AutoNumberAttribute is responsible for almost all auto-numbering. However sometimes you may want to have control on it. For example change sequence depend on conditions or add specific numbers related to vendor or customer. These things quite easy to do with customization. Here I’m going to show you 2 scenarios: How to change numbering sequence How to change new number Change Numbering Sequence on the fly. AutoNumber Attribute generates new number on RowPersisting event. As you may remember from T200 Development Training guide RowPersisting of graph will be executed prior to attributes, so we can control what Attributes will do. This is correct for all  *ing events… Read more

Extend Address Line length

Hi Everyone, Extending of field length in Acumatica is not a trivial task, so here I want to publish guidance on how I usually do that. To extend field we need to do 2 things: Extend allowed length in DAC attribute Extend length of Database Column Welcome under the cut for more details Extend Field in the DAC Here you need to find PXDBStringAttribute and redefine it. Allowed field length is passed in constructor so unfortunately you cannot easily change it with PXCustomizeBaseAttribute. In the end you have 2 ways: Redefine all attributes – [PXDBString(200, IsUnicode = true)] [PXUIField(DisplayName = “Address Line 1”, Visibility = PXUIVisibility.SelectorVisible)] [PXMassMergableField] Remove Specific attribute… Read more

Apply Customization to all Graphs

Hi All, Today want to share with you one tip how can you add customization to all graphs at once. You know that you can define graph extension with specific graph – PXGraphExtension<PX.Objects.GL.JournalEntry>. However, all graphs are inherited from one base class ether PXGraph<TGraph> or PXGraph<TGraph, TPrimaryView>. In that case PXGraph is normal class and can be used as standalone object. In terms of our customizations that means that we can create an extension for parent PXGraph and it will be used with any graph in the system automatically. Here we have an example how can you add a special setup to any graph in Acumatica. Please note that we… Read more

Custom Code on AP Invoice Release

Hi Everyone, What to share example with you how to call custom code during AP invoice release. In general process for AP is very similar to what is described in Acumatica T300 Customization Guide in Lesson 7: Customizing the Logic of the Release Action. Here you also need to find the best place where you can put your custom code and than write it there. Similar to guide above the best place is actually persisting method of APReleaseProcess graph. Lets check check how to investigate code first and when write a logic. Preparation From APInvoiceEntry graph you can find the method that release the invoice. Relese method is easy to find… Read more

Cases Escalation

Hi All, Have you faced the need of escalation process in Acumatica CRM? In general it is not so complicated to do with work-groups – when you need escalation you just change work-group. Support engineers can monitor a queue (or get a notifications) and work on case. But here we have quite some manual processes: add escalation note, change status, change work-group. However we can easily solve it with customization. Let me show you the scenario where you have 2 (or more) buttons: Escalate to L2, Escalate to L3 and so on. Each button will show you pop-up form that you need to feel before escalation and do other automation.… Read more

Generate IN Receipt from the Code

Hi All, In my experience I have quite a lot of questions like – how to create a document on the fly. The answer is rather simple – we need to use the same objects as user interface and emulate user interface behavior. As the main object that contains a business logic and validation is Grpah, we need to create it from the code and use for calling actions and pushing data. INReceiptEntry graph = PXGraph.CreateInstance<INReceiptEntry>() To create a new object we can use PXCache. INRegister header = (INRegister)graph.CurrentDocument.Cache.CreateInstance(); Every container control form UI is linked with Data View that is linked with DACs and tables. As you may know… Read more

Link Between GL And AP or AR

Hi There, In case you have not seen that before, Acumatica has links between GL Batch lines and AP/AR Invoices lines – Following conditions should be applied: GLTrain,TranType = ARTran.TranType; GLTrain,RefNbr = ARTran.RefNbr; GLTrain,LineNbr= ARTran.TranLineNbr; TranLineNbr is populated on release of a document in another module with the number of the corresponding line in that document. Please note that TranLineNbr can be empty in some cases. For example if you have consolidation posting to GL, than multiple AP/AR trans will be combined in one GL line, in that case TranLineNbr cannot be evaluated. Specially this field is not populated when PX.Objects.GL.GLTran.SummPost is ON. Using that knowledge you can update something in GL… Read more

Calling Base Actions by example of Generating Time Cards

Hi All, Just a short article where I can share with you customization that can generate time cards from uploaded time activities. Customization doing following: Selects the first and the last unreported (where no time-cards assigned) activity from currently selected employee. Goes week by week between first and last activities Create a new time card for every week using TimeCardMaint graph Code also automatically submit time card for approval In case there is unreported activity for already submitted or released time card, code can automatically generate time card correction and submit it again. It is not very useful customization, but it can be used as good example of calling actions in… Read more

Multi-Company Drop-Down

Hi All, Today want to show you how to have different values of drop-down in different companies: Company One Values 1, 2, 3 Labels “1”, “2”, “3” Company Two Values 3, 4, 5 Labels “1”, “2”, “3” To do this we can use following nice features in Acumatica Platform: PX.Data.Update.PXInstanceHelper.CurrentCompany – to get ID of current company FieldSelecting – Event where you can change/adjust value just before it will be included in response to browser. e.ReturnState = PXStringState.CreateInstance(…) – State contains full description of control that should be generated in the user interface with app UI properties and configurations. By adjusting state on the fly you can change list of… Read more

Adding new Report Button on Invoices and Memos screen

Hi All, Today want to share with you the case how to add a new button to print alternative Invoice Form right from Invoices and Memos screen. Lets check how does that work and check how original button “Print Invoice/Memo” is configured. Automation Steps Fist of all if you check the code, there is no handler for “Print Invoice/Memo”. That is some sort of virtual button defined through Acumatica Automation Workflow. If you check Automation Steps for “Invoices and Memos” screen you can find that menu “Print Invoice/Memo” is added to action “Report”. That is exactly action that will be executed in the code. If you click “Fill With Values”… Read more