问题描述
我在自定义屏幕AR全部释放(AR501000)中遇到问题。问题是当我尝试通过使用复选框使用屏幕AR释放所有流程(AR501000)在屏幕发票和备忘(AR301000)中传递发票编号(客户订单的字段)的值时。
I have a problem in customize screen AR Relase All (AR501000). The problem was when I try to pass value of Invoice Number (Customer Order's Field) in screen Invoices And Memos (AR301000) by using screen AR Release All Process (AR501000) using checkbox.
首先,我如下创建GLTranExtension:
First, I create GLTranExtension like this below :
using System;
using PX.Data;
using PX.Objects.CM;
using PX.Objects.CS;
using PX.Objects.PM;
using PX.Objects.CR;
using PX.Objects.TX;
using System.Collections.Generic;
using PX.Objects;
using PX.Objects.GL;
namespace SGLCustomizeProject
{
[Serializable]
public class GLTranExtension: PXCacheExtension<PX.Objects.GL.GLTran>
{
#region UsrInvoiceNbr
public abstract class usrInvoiceNbr : IBqlTable { }
[PXDBString(60, IsFixed = true)]
[PXUIField(DisplayName = "Vendor Ref. / Customer Order")]
public string UsrInvoiceNbr { get; set; }
#endregion
}
}
然后我尝试创建自定义ARReleaseProcessExtension。
这是我的自定义代码下方:
And then I try to create customize ARReleaseProcessExtension.This below my customize code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PX.Data;
using PX.Objects.AR;
using PX.Objects.GL;
using PX.Objects.CM;
using PX.Objects.CA;
using PX.Objects.CR;
using PX.Objects.CS;
using PX.Objects.CT;
using PX.Objects.PM;
namespace SGLCustomizeProject
{
public class ARRelaseProcessExtension: PXGraphExtension<ARReleaseProcess>
{
public delegate List<ARRegister> ReleaseDocProcDel(JournalEntry je, ref ARRegister doc, PXResult<ARInvoice, CurrencyInfo, Terms, Customer, Account> res, out PMRegister pmDoc);
[PXOverride]
public List<ARRegister>ReleaseDocProc(JournalEntry je, ref ARRegister doc, PXResult<ARInvoice, CurrencyInfo, Terms, Customer, Account> res, out PMRegister pmDoc, ReleaseDocProcDel del)
{
je.RowInserting.AddHandler<GLTran>((sender, e) =>
{
GLTran glTran = e.Row as GLTran;
ARInvoice ari = PXResult<ARInvoice>.Current;
if (ari != null && ari.InvoiceNbr != null)
{
GLTranExtension glTex = PXCache<GLTran>.GetExtension<GLTranExtension>(glTran);
glTex.UsrInvoiceNbr = ari.InvoiceNbr;
}
});
return del(je, ref doc, res, out pmDoc);
}
}
}
如果进入屏幕,请释放AR文档(AR501000)和我只需要使用复选框按钮下达一笔交易即可。
但是,当我尝试使用复选框按钮释放多个交易时,我的第二个交易会在日记帐交易屏幕中填写相同的发票编号,因此我将使用这种条件进行描述:
If go to screen Release AR Documents (AR501000) and I only need to release one transaction using checkbox button. It works..But when I try to release more than one transactions using checkbox button also, my second transactions fill the same invoice number in journal transaction screen, I'll describe using this condition :
如果我下达两笔交易
- 参考号= 000012和发票号(在客户订单字段中)= inv1254
- 参考号= 000013和发票号(在客户订单字段中)= inv1255
然后我释放这两个事务,在日记帐事务中显示如下结果:
And then I Release this two transactions, and in journal transactions shows the result like this below :
- 参考号= 000012和发票号(在字段客户订单)= inv1254
- 参考号= 000013和发票编号(字段客户订单中)= inv1254
我不知道为什么第二次交易在日记帐交易屏幕中显示相同的发票编号值。
I don't know why in second transaction shows the same invoice number value in journal transaction screen.
推荐答案
在你的cas e这是由于
In you case it's happening because of
ARInvoice ari = PXResult<ARInvoice>.Current;
PXResult。当前金额可能与您正在处理的实际发票不同。
PXResult.Current can differ from the actual invoice you are processing.
在这种情况下,最好明确选择所需的发票:
It will be better to explicitly select required invoice in this case:
ARInvoice ari = PXSelect<ARInvoice, Where<ARInvoice.refNbr, Equal<Required<GLTran.refNbr>>, And<ARInvoice.docType, Equal<Required<GLTran.tranType>>>>>.Select(sender.Graph, glTran.RefNbr, glTran.TranType);
这篇关于如何在Acumatica ERP系统中自定义屏幕AP全部释放和AR全部释放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!