Modify Grid footer information ("On Hand X, Available Y, ...") - acumatica

Is there any way with a customization to modify the information area at the footer of a grid particularly the Sales Order Entry > Document Details grid that displays On Hand & Availability information for the Current SOLine?

public virtual void SOLine_Availability_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e, PXFieldSelecting invokeBaseHandler)
{
invokeBaseHandler(sender, e);
e.ReturnValue = "Hey There!";
}
Availability seems to be a common descriptor/field for several line level DACs

Late to the party here, but to ADD onto the existing display, you simply need to add onto the e.ReturnValue, instead of replacing it.
public virtual void SOLine_Availability_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e, PXFieldSelecting invokeBaseHandler)
{
invokeBaseHandler(sender, e);
e.ReturnValue = e.ReturnValue + " My Added Text!";
}

Related

In the Bills and Adjustment screen I need to set Project and Task to be conditionally enabled

I have a customization to the Bills and Adjustments screen where I need the Project and Task in the grid section to be enabled beyond what is specified in the source code.
In order to do this, I've used an overridden RowSelected event, but this doesn't seem to work. The additional context here is that the Approval Map settings come into play.
Here is the code to override the RowSelected event that I thought would work but doesn't:
protected void APInvoice_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
if (InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
var apinv = (APInvoice)e.Row;
if (apinv != null)
{
APRegister apreg = PXSelect<APRegister, Where<APRegister.refNbr, Equal<Required<APRegister.refNbr>>>>.Select(Base, apinv.RefNbr);
if (apreg.Released != true)
{
PXUIFieldAttribute.SetEnabled<APTran.projectID>(Base.Transactions.Cache, null, true);
PXUIFieldAttribute.SetEnabled<APTran.taskID>(Base.Transactions.Cache, null, true);
}
}
}
Can someone explain why this doesn't enable these fields? Is there another way to do this (short of completely replicating the RowSelected event in the source code)?
Thanks much...
Not sure if the cache you're referring to is in the same 'state'(for a lack of a better word). try swaping out Base.tran.... with the PXCache that you are receiving "cache"
protected void APInvoice_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
try
{
if (InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
PXUIFieldAttribute.SetEnabled<APTran.projectID>(cache, null, true);
PXUIFieldAttribute.SetEnabled<APTran.taskID>(cache, null, true);
}
catch(System.Exception) {}
}
Per Acumatica support:
"I've tested this on 20R102 and 20R109.
It only worked on the later which means that this is most likely a bug.
I will check this with engineering but I am aware of some APInvoice bugs that were solved starting 20R104."

How to add condition for process buttons on Recognize Input VAT TX503500

I have to add a description field that is mandatory, so that the action of processing can be carried out, however I am a little confused, due to the fact that the field is in the filter area, to be copied later in the descriptions to be processed.
How can I customize the actions Process, ProcessAll?
I don't find these actions in Override Methods
thanks for helping me, I'm really new to this
sorry if my english is not so good
Basically, the Process/Process All actions are mapped to one method which is using the SetProcessDelegate method of the processing data view.
What you need to do is for first locating to the Graph(ProcessInputSVAT) of the Recognize Input VAT screen(TX503500). After opening the source code for that graph you can see that it's derived from the ProcessSVATBase class. And when you'll enter that class you'll see the mentioned SetProcessDelegate function called by Data View:
protected virtual void SVATTaxFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
SVATTaxFilter filter = (SVATTaxFilter)e.Row;
if (filter == null)
{
return;
}
this.SVATDocuments.SetProcessDelegate(delegate(List<SVATConversionHistExt> list)
{
ProcessSVATBase.ProcessPendingVATProc(list, filter);
});
}
So we've figured out which graph extension we should create. Now, it's necessary to override the RowSelected event of the SVATTaxFilter DAC in the extension graph.
public class ProcessSVATBaseExt : PXGraphExtension<ProcessSVATBase>
{
public virtual void SVATTaxFilter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
SVATTaxFilter filter = e.Row as SVATTaxFilter;
if (filter != null)
{
Base.SVATDocuments.SetProcessDelegate(delegate (List<SVATConversionHistExt> list)
{
// Here you can manage the list items and then call the base method
// ...
ProcessSVATBase.ProcessPendingVATProc(list, filter); // the base method
// Here you can manage the list items after the base method
// ...
});
}
}
}

Enable SOLine field after Order Completed

I need to enable the Salesperson ID and Commissionable fields of Sales Order Lines for Sales Orders in the Completed state.
I referenced the question here about enabling fields in the SOOrder header: How to enable CustomerOrderNbr field in Sales Order screen?
I added the two fields to the Automation Steps for the SO Complete step
And added customization code:
public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
public void SOOrderLine_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
SOOrderLine line = e.Row as SOOrderLine;
if (line == null) return;
PXUIFieldAttribute.SetEnabled<SOOrderLine.salesPersonID>(sender, line, true);
PXUIFieldAttribute.SetEnabled<SOOrderLine.commissionable>(sender, line, true);
}
}
However, the fields are still disabled. Is there something I'm missing?
I have a similar requirement with one of my clients. You're on the right track with automation steps, but you need something else to enable editing. Here are the two event handlers we use:
protected void SOOrder_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
// Make the promised on ship date field editable even after the order has been completed.
// This code is not enough to make the feature work - automation steps need to be modified for SO Completed and SO Invoiced to ensure the
// caches are not disabled.
sender.AllowUpdate = true;
Base.Transactions.Cache.AllowUpdate = true;
}
protected void SOLine_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
if (Base.Document.Current != null)
{
//Automation steps were modified to keep the transactions grid enabled for the completed status; we are manually disabling it here but leaving the promised on ship date field editable.
if(Base.Document.Current.Status == SOOrderStatus.Completed)
PXUIFieldAttribute.SetEnabled(sender, e.Row, false);
PXUIFieldAttribute.SetEnabled<SOLineExt.usrPromisedShipOnDate>(sender, e.Row, true);
PXUIFieldAttribute.SetEnabled<SOLineExt.usrLateReasonCode>(sender, e.Row, true);
}
}
To finish out the solution to this, in this case I found it was not necessary to Enable the full Sales Order Line via Automation Steps and then disable it via SOLine_RowSelect. It was, however, necessary to add the Sales Order > Order Nbr field to the automation steps (to make the document Save available after changing the Sales Order line). And strangely it was also necessary for us to give this Customization Project a higher Level than the others implementing it after other customizations that may have made changes to the same screen or objects.
public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
protected void SOOrder_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
sender.AllowUpdate = true;
Base.Transactions.Cache.AllowUpdate = true;
}
protected void SOLine_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
{
if (Base.Document.Current != null)
{
PXUIFieldAttribute.SetEnabled<SOLine.salesPersonID>(sender, e.Row, true);
PXUIFieldAttribute.SetEnabled<SOLine.commissionable>(sender, e.Row, true);
}
}
}

Updating ALL SOLine items unit prices dynamically when a new SOLine is added

I have a stored procedure that's called by a PXAction. I know it's against Acumatica's best practices to use a stored procedure, but I have yet find an alternative solution for my goal. The stored procedure evaluates each line item and the price class it's associated with depending on the breakQuantity that determines the unit price. If multiple items belong to the same price class == or exceed the break quantity the unit price is reduced.
What I started with was a row updating
protected virtual void SOLine_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
{
SOLine row = (SOLine)e.Row;
formalizeOrderTotal(row);
}
then in my formalizeOrderTotal function it performed a foreach loop on SOLine in lines.Select() to add up order quantity. As a test i just tried adding up all order quantities and applying it to every line item. This only updated after refreshing which negates the purpose of moving the stored procedure to a c# function/Acumatica event handler.
If anyone has some recommendations a good approach to updating all line items in cache it would be greatly appreciated if you could provide some input.
Try using Base.Transactions.View.RequestRefresh(); which will ask the grid to refresh itself. In this example, I am setting each line quantity to the number of SOLines present in the grid.
using PX.Data;
namespace PX.Objects.SO
{
public class SOOrderEntry_Extension:PXGraphExtension<SOOrderEntry>
{
protected virtual void SOLine_RowUpdating(PXCache sender, PXRowUpdatingEventArgs e)
{
SOLine row = (SOLine)e.Row;
formalizeOrderTotal(row);
}
private void formalizeOrderTotal(SOLine row)
{
foreach (SOLine line in Base.Transactions.Select())
{
if(line.Qty == Base.Transactions.Select().Count)
{
continue;
}
line.Qty = Base.Transactions.Select().Count;
Base.Transactions.Update(line);
Base.Transactions.View.RequestRefresh();
}
}
}
}

Page load of user control and parent page

I have a user control for showing message of actions. It is hidden on page load of user control, so that it disappears once a warning is acted upon. But in certain cases when a page loads, i want the user control to be visible, but doesn't due to hiding in page load of user control. How can I manage this?
usercontrol
protected void Page_Load(object sender, EventArgs e)
{
this.Visible = false;
}
public void SetMessage(string title, string desc)
{
this.Visible = true;
Title = title;
Description = desc;
}
parent page
protected void Page_Load(object sender, System.EventArgs e)
{
msgDialogue.SetMessage(a);
}
From what I understood, you need to show or hide a usercontrol depending on a property value in your page (or in a session variable). If this is the case, you would better add a placeholder in your page, then load the control (or not load it) depending on your condition.
if(condition)
{
_usercontrol ctrl = LoadControl("~/usercontrols/_usercontrol.ascx") as _usercontrol;
Placeholder1.Controls.Add(ctrl);
}
//otherwise, do not load the control
Hope it helps.

Resources