Acumatica,根据发票修改生成的总帐批次以处理多次付款

时间:2019-11-03 14:01:15

标签: acumatica

i在“发票”屏幕中添加了“混合付款”选项卡以处理现金销售中的多付款问题 So Invoice with Multi Payments 然后,我在SoInvoice屏幕中自定义了Released按钮,以在生成的GL批次中进行修改 但是我还有下一个问题。 1-发行发票后发行不会自动发行。 2-我仅在总帐批处理中添加了一些记录,但无法删除任何记录。 (我需要从生成的GL批次中删除一条记录) 3-在数据库表(GlTran)中添加一些记录后,我注意到四列具有不同的值 Sql pic

namespace PX.Objects.SO

{

public class SOInvoiceEntry_Extension : PXGraphExtension<SOInvoiceEntry>
{
    public delegate IEnumerable ReleaseDelegate(PXAdapter adapter);
    [PXOverride]
    public IEnumerable Release(PXAdapter adapter, ReleaseDelegate baseMethod)
    {
        PXGraph.InstanceCreated.AddHandler<JournalEntry>((JournalEntry graph) =>
        {
            graph.GetExtension<JournalEntry_Extension>().RefNbrmix = this.Base.Document.Current.RefNbr;
            graph.GetExtension<JournalEntry_Extension>().DocTypemix = this.Base.Document.Current.DocType;
            graph.GetExtension<JournalEntry_Extension>().ModifyBatchFromAP = true;

        });

        return baseMethod(adapter);
    }

}

}

命名空间PX.Objects.GL {

public class JournalEntry_Extension : PXGraphExtension<JournalEntry>
{
    [PXOverride]
    public void Persist(Action del)
    {

        if (ModifyBatchFromAP)
        {
            string RefNbr = RefNbrmix;
            string DocType = DocTypemix;
            decimal? Total = 0;
            ArrayList tran = new ArrayList();
            PXSelectBase<MixPayments> nonStk = new PXSelectReadonly<MixPayments, Where<MixPayments.refNbr, Equal<Required<MixPayments.refNbr>>, And<MixPayments.docType, Equal<Required<MixPayments.docType>>>>>(this.Base);
            nonStk.Cache.ClearQueryCache();
            PXResultset<MixPayments> resultNonStk = nonStk.Select(RefNbr, DocType);
            foreach (MixPayments nonStkItem in resultNonStk)
            {
                var glTran = Base.GLTranModuleBatNbr.Insert();
                Base.GLTranModuleBatNbr.SetValueExt<GLTran.accountID>(glTran, nonStkItem.AccountID);
                glTran = Base.GLTranModuleBatNbr.Update(glTran);
                Base.GLTranModuleBatNbr.SetValueExt<GLTran.subID>(glTran, nonStkItem.SubId);
                Base.GLTranModuleBatNbr.SetValueExt<GLTran.curyDebitAmt>(glTran, nonStkItem.LineAmount);
                Base.GLTranModuleBatNbr.SetValueExt<GLTran.debitAmt>(glTran, nonStkItem.LineAmount);
                Base.GLTranModuleBatNbr.SetValueExt<GLTran.tranType>(glTran, DocType);
                Base.GLTranModuleBatNbr.SetValueExt<GLTran.refNbr>(glTran, RefNbr);
                Base.GLTranModuleBatNbr.Update(glTran);
                Total = Total + nonStkItem.LineAmount;
            }

            var glTran2 = Base.GLTranModuleBatNbr.Insert();
            Base.GLTranModuleBatNbr.SetValueExt<GLTran.accountID>(glTran2, "1301056");
            glTran2 = Base.GLTranModuleBatNbr.Update(glTran2);
            Base.GLTranModuleBatNbr.SetValueExt<GLTran.subID>(glTran2, "HDM0000");
            glTran2.CuryCreditAmt = Total;
            glTran2.CreditAmt = Total;
            glTran2.TranType = DocType;
            glTran2.RefNbr = RefNbr;
            Base.GLTranModuleBatNbr.Update(glTran2);
        }

        del();
    }

}

0 个答案:

没有答案