Helo,
Im a newbie to acumatica. I want to add last ordered date field for each stock item. So,whenever a new order arrives i want to update last ordered date of that ordered item. How could i do that? please reply asap….
Helo,
Im a newbie to acumatica. I want to add last ordered date field for each stock item. So,whenever a new order arrives i want to update last ordered date of that ordered item. How could i do that? please reply asap….
Hi
Where do you want to see the last ordered date? Also, are you talking about a Sales Order or a Purchase Order? It sounds like you’re talking about Sales Order from a customer, but just want to be sure.
Hi
I’m assuming that below is your requirement.
In the Stock Item screen, you have added a new customization field and you want to show the Last Ordered Date of that SKU in that field.
If this is your requirement, then yes, it more of customization, and below are the steps.
You need to extend the SOOrderEntry graph and add a logic to update the “LastOrderedDate” in the Stock Item screen of the 1st Save of the Sales Order (Persist Delegate).
Hope this helps!!
Hi
I’m assuming that below is your requirement.
In the Stock Item screen, you have added a new customization field and you want to show the Last Ordered Date of that SKU in that field.
If this is your requirement, then yes, it more of customization, and below are the steps.
You need to extend the SOOrderEntry graph and add a logic to update the “LastOrderedDate” in the Stock Item screen of the 1st Save of the Sales Order (Persist Delegate).
Hope this helps!!
hi,
Yes exactly i want the way you defined. I already added LastOrderedDate field in Stock Item Screen. And about to extend SOOrderEntry graph but didn’t understand how to save that field . Please Reply. Thanks in advance.
Hi
I wrote a sample example code just now, where I’m updating LastOrderedDate in the Stock Items screen for the particular SKUs.
Please modify according to your DAC field names.
public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{
public delegate void PersistDelegate();
PXOverride]
public void Persist(PersistDelegate del)
{
#region Check Del
try
{
if (Base.Document.Current != null)
{
if (Base.Document.Cache != null && Base.Document.Cache.GetStatus((object)Base.Document.Current) == PXEntryStatus.Inserted)
{
InventoryItemMaint itemMaint = PXGraph.CreateInstance<InventoryItemMaint>();
foreach (SOLine objSOLine in Base.Transactions.Select())
{
InventoryItem objInventoryItem = PXSelect<InventoryItem, Where<InventoryItem.inventoryID, Equal<Required<InventoryItem.inventoryID>>>>.Select(Base, objSOLine.InventoryID);
if (objInventoryItem != null)
{
InventoryItemExt itemExt = objInventoryItem.GetExtension<InventoryItemExt>();
itemExt.LastOrderedDate = Base.Document.Current?.OrderDate;
itemMaint.Item.Cache.Update(objInventoryItem);
}
}
itemMaint.Actions.PressSave();
}
del();
}
}
catch (Exception ex)
{
throw new PXException(ex.Message);
}
}
}
Hope this helps!!
Hi
I wrote a sample example code just now, where I’m updating LastOrderedDate in the Stock Items screen for the particular SKUs.
Please modify according to your DAC field names.
public class SOOrderEntryExt : PXGraphExtension<SOOrderEntry>
{
public delegate void PersistDelegate();
PXOverride]
public void Persist(PersistDelegate del)
{
#region Check Del
try
{
if (Base.Document.Current != null)
{
if (Base.Document.Cache != null && Base.Document.Cache.GetStatus((object)Base.Document.Current) == PXEntryStatus.Inserted)
{
InventoryItemMaint itemMaint = PXGraph.CreateInstance<InventoryItemMaint>();
foreach (SOLine objSOLine in Base.Transactions.Select())
{
InventoryItem objInventoryItem = PXSelect<InventoryItem, Where<InventoryItem.inventoryID, Equal<Required<InventoryItem.inventoryID>>>>.Select(Base, objSOLine.InventoryID);
if (objInventoryItem != null)
{
InventoryItemExt itemExt = objInventoryItem.GetExtension<InventoryItemExt>();
itemExt.LastOrderedDate = Base.Document.Current?.OrderDate;
itemMaint.Item.Cache.Update(objInventoryItem);
}
}
itemMaint.Actions.PressSave();
}
del();
}
}
catch (Exception ex)
{
throw new PXException(ex.Message);
}
}
}
Hope this helps!!
Thanks
It works.. :)
How to update all existing orders last updated date for stock items?
Create an updated SQL script to update the LastOrderDate in the Stock Items screen. This is a one-time activity and for the new orders, your customization will take care of.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.