Acumatica - 无法执行的方法

时间:2015-07-24 02:55:04

标签: acumatica

我遇到了这个困境,我在ARPaymentEntry中复制了PaymentCharges数据视图并将其命名为OtherCharges。除了VoidCheckProc方法之外,我覆盖与财务费用数据视图相关的所有方法以避免错误。当我取消付款时,会发生错误,原始的VoidCheckProc方法正在执行此代码。

foreach (PXResult<ARPaymentChargeTran> paycharge in PXSelect<ARPaymentChargeTran, Where<ARPaymentChargeTran.docType, Equal<Required<ARPayment.docType>>, And<ARPaymentChargeTran.refNbr, Equal<Required<ARPayment.refNbr>>>>>.Select(this, doc.DocType, doc.RefNbr))
    {
        ARPaymentChargeTran charge = PXCache<ARPaymentChargeTran>.CreateCopy((ARPaymentChargeTran)paycharge);
        charge.DocType = Document.Current.DocType;
        charge.CuryTranAmt = -1 * charge.CuryTranAmt;
        charge.Released = false;
        charge.CuryInfoID = Document.Current.CuryInfoID;
            charge.CashTranID = null;
        PaymentCharges.Insert(charge);
    }
  

这是我的覆盖方法。我的目标是,如果它是CWT,这就是我的可信预扣税(CWT)和基于税率的自动计算,因此OtherCharges数据视图存储所有CWT条目类型和PaymentCharges非CWT或常规财务电荷

 public delegate void VoidCheckProcDelegate(ARPayment doc);
    [PXOverride]
    public void VoidCheckProc(ARPayment doc, VoidCheckProcDelegate baseMethod)
    {
        baseMethod(doc);

        foreach (PXResult<ARPaymentChargeTran> paycharge in PXSelect<ARPaymentChargeTran, Where<ARPaymentChargeTran.docType, Equal<Required<ARPayment.docType>>, And<ARPaymentChargeTran.refNbr, Equal<Required<ARPayment.refNbr>>, And<ARPaymentChargeTranExt.usrIsCWT, Equal<Required<ARPaymentChargeTranExt.usrIsCWT>>>>>>.Select(this.Base, doc.DocType, doc.RefNbr, false))
        {
            ARPaymentChargeTran charge = PXCache<ARPaymentChargeTran>.CreateCopy((ARPaymentChargeTran)paycharge);
            ARPaymentChargeTranExt chargeExt = PXCache<ARPaymentChargeTran>.GetExtension<ARPaymentChargeTranExt>(charge);
            charge.DocType = Base.Document.Current.DocType;
            charge.CuryTranAmt = -1 * charge.CuryTranAmt;
            chargeExt.UsrCustEntryTypeID = charge.EntryTypeID;
            chargeExt.UsrIsCWT = charge.GetExtension<ARPaymentChargeTranExt>().UsrIsCWT; ;
            chargeExt.UsrTaxRate = charge.GetExtension<ARPaymentChargeTranExt>().UsrTaxRate;
            charge.Released = false;
            charge.CuryInfoID = Base.Document.Current.CuryInfoID;
            charge.CashTranID = null;
            PaymentCharges.Insert(charge);
        }


        foreach (PXResult<ARPaymentChargeTran> paycharge in PXSelect<ARPaymentChargeTran, Where<ARPaymentChargeTran.docType, Equal<Required<ARPayment.docType>>, And<ARPaymentChargeTran.refNbr, Equal<Required<ARPayment.refNbr>>, And<ARPaymentChargeTranExt.usrIsCWT, Equal<Required<ARPaymentChargeTranExt.usrIsCWT>>>>>>.Select(this.Base, doc.DocType, doc.RefNbr, true))
        {
            ARPaymentChargeTran charge = PXCache<ARPaymentChargeTran>.CreateCopy((ARPaymentChargeTran)paycharge);
            ARPaymentChargeTranExt chargeExt = PXCache<ARPaymentChargeTran>.GetExtension<ARPaymentChargeTranExt>(charge);
            charge.DocType = Base.Document.Current.DocType;
            charge.CuryTranAmt = -1 * charge.CuryTranAmt;
            charge.Released = false;
            chargeExt.UsrCustEntryTypeID = charge.EntryTypeID;
            chargeExt.UsrIsCWT = charge.GetExtension<ARPaymentChargeTranExt>().UsrIsCWT; ;
            chargeExt.UsrTaxRate = charge.GetExtension<ARPaymentChargeTranExt>().UsrTaxRate;
            charge.CuryInfoID = Base.Document.Current.CuryInfoID;
            charge.CashTranID = null;
            OtherCharges.Insert(charge);
        }

    }

0 个答案:

没有答案