我在ARTran,APTran和GLTran DAC中创建了一个名为股票编号的自定义数据库绑定字段:
public class ARTranExt : PXCacheExtension<PX.Objects.AR.ARTran>
{
public abstract class usrLineStockNbr : IBqlField { }
[PXDBString(10)]
[PXUIField(DisplayName = "Stock Number")]
public virtual string UsrLineStockNbr { get; set; }
}
public class APTranExt : PXCacheExtension<PX.Objects.AP.APTran>
{
public abstract class usrLineStockNbr : IBqlField { }
[PXDBString(10)]
[PXUIField(DisplayName = "Stock Number")]
public virtual string UsrLineStockNbr { get; set; }
}
public class GLTranExt : PXCacheExtension<PX.Objects.GL.GLTran>
{
public abstract class usrLineStockNbr : IBqlField { }
[PXDBString(10)]
[PXUIField(DisplayName = "Stock Number")]
public virtual string UsrLineStockNbr { get; set; }
}
如何将AR发票和AP账单详细信息中的自定义字段值直接粘贴到GL交易中?
答案 0 :(得分:0)
要将自定义字段值从ARTran粘贴到GLTran ,您应该为 ARReleaseProcess BLC创建一个扩展名,并覆盖 ReleaseInvoice 方法,如下所示在以下示例中:
public class ARReleaseProcess_Extension : PXGraphExtension<PX.Objects.AR.ARReleaseProcess>
{
public delegate List<ARRegister> ReleaseInvoiceDel(
JournalEntry je,
ref ARRegister doc,
PXResult<ARInvoice, CurrencyInfo, Terms, Customer, Account> res,
out PMRegister pmDoc);
[PXOverride]
public List<ARRegister> ReleaseInvoice(
JournalEntry je,
ref ARRegister doc,
PXResult<ARInvoice, CurrencyInfo, Terms, Customer, Account> res,
out PMRegister pmDoc,
ReleaseInvoiceDel del)
{
je.RowInserting.AddHandler<GLTran>((s, a) =>
{
var tran = (GLTran)a.Row;
var arTran = (ARTran)PXResult<ARTran>.Current;
if (tran != null && tran.TranLineNbr != null &&
arTran != null && arTran.TranType == tran.TranType &&
arTran.RefNbr == tran.RefNbr && arTran.LineNbr == tran.TranLineNbr)
{
var stockNbr = arTran.GetExtension<ARTranExt>().UsrLineStockNbr;
if (!string.IsNullOrEmpty(stockNbr))
tran.GetExtension<GLTranExt>().UsrLineStockNbr = stockNbr;
}
});
return del(je, ref doc, res, out pmDoc);
}
}
要将自定义字段值从APTran粘贴到GLTran ,您应该为 APReleaseProcess BLC创建一个扩展名,并覆盖 ReleaseInvoice 方法,如下所示在以下示例中:
public class APReleaseProcess_Extension : PXGraphExtension<PX.Objects.AP.APReleaseProcess>
{
public delegate List<APRegister> ReleaseInvoiceDel(
JournalEntry je,
ref APRegister doc,
PXResult<APInvoice, CurrencyInfo, Terms, Vendor> res,
bool isPrebooking,
out List<INRegister> inDocs);
[PXOverride]
public virtual List<APRegister> ReleaseInvoice(
JournalEntry je,
ref APRegister doc,
PXResult<APInvoice, CurrencyInfo, Terms, Vendor> res,
bool isPrebooking,
out List<INRegister> inDocs,
ReleaseInvoiceDel del)
{
je.RowInserting.AddHandler<GLTran>((s, a) =>
{
var tran = (GLTran)a.Row;
var apTran = (APTran)PXResult<APTran>.Current;
if (tran != null && tran.TranLineNbr != null &&
apTran != null && apTran.TranType == tran.TranType &&
apTran.RefNbr == tran.RefNbr && apTran.LineNbr == tran.TranLineNbr)
{
var stockNbr = apTran.GetExtension<APTranExt>().UsrLineStockNbr;
if (!string.IsNullOrEmpty(stockNbr))
tran.GetExtension<GLTranExt>().UsrLineStockNbr = stockNbr;
}
});
return del(je, ref doc, res, isPrebooking, out inDocs);
}
}