要将“Acumatica - 操作“反转并应用备忘录”默认的过账期间为活动财务期间”应用于Acumatica系统,可以按照以下步骤进行操作:
public PXAction reverseAndApplyMemo;
[PXButton(CommitChanges = true)]
[PXUIField(DisplayName = "Reverse and Apply Memo", MapEnableRights = PXCacheRights.Update, MapViewRights = PXCacheRights.Select)]
protected virtual IEnumerable ReverseAndApplyMemo(PXAdapter adapter)
{
// code to reverse and apply memo
return adapter.Get();
}
// code to reverse and apply memo
// Set the posting period to the active financial period
GLTran tran = adapter.Get().FirstOrDefault();
if (tran != null)
{
GLTranEntry graph = PXGraph.CreateInstance();
graph.Clear();
graph.FindGLTranBatch.Current = graph.FindGLTranBatch.Search(tran.BatchNbr, tran.Module);
graph.GLTranModuleBatNbr.Current = graph.GLTranModuleBatNbr.Search(tran.Module, tran.BatchNbr);
graph.Period.HeaderRowType = typeof(FinPeriod.headerRowType);
graph.Period.Defaults = false;
graph.Period.Current = graph.Period.Search(tran.FinPeriodID);
tran.TranDate = Accessinfo.BusinessDate;
tran.TranPeriodID = graph.Period.Current.FinPeriodID;
}
以上代码会在执行“反转并应用备忘录”操作时,将过账期间设置为活动财务期间。请确保在应用更改之前进行适当的测试,并在生产环境之前备份系统。