过账采购发票

Posted Farseer

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了过账采购发票相关的知识,希望对你有一定的参考价值。

大多数场景下,开票前一般都会跟供应商进行收货单的对账,准确无误后,根据协商的金额将所对账的采购订单开一个发票。
在PurchFormLetter中增加一个方法用于根据对账单明细生成对应的Parm表记录(AX2009)。

public void ERM_CreateParmByStatement(ERM_VendStatementTable _statementTable)
{
    ERM_PurchTableInvoice           purchTableInvoice;
    ERM_PurchInvoice                purchInvoice;
    PurchLine                       purchLineLocal;
    ;

    ttsbegin;

    select firstonly purchTableInvoice
    where purchTableInvoice.StatementId == _statementTable.StatementId;

    select firstonly purchInvoice
    where purchInvoice.StatementId == _statementTable.StatementId;

    this.createParmUpdate();

    purchParmUpdate.SpecQty     = PurchUpdate::ReceiveNow;
    purchParmUpdate.SumBy       = AccountOrder::Order;
    purchParmUpdate.SumNum      = _statementTable.StatementId;
    purchParmUpdate.SumPurchId  = purchTableInvoice.PurchId;
    purchParmUpdate.update();

    while select purchTableInvoice
    where purchTableInvoice.StatementId == _statementTable.StatementId
    {
        //info(purchTableInvoice.PurchId);
        purchParmTable.clear();
        purchParmTable.ParmId       = purchParmUpdate.ParmId;
        purchParmTable.PurchId      = purchTableInvoice.PurchId;
        purchParmTable.initFromPurchTable(PurchTable::find(purchParmTable.PurchId));
        purchParmTable.Approved     = NoYes::Yes;
        purchParmTable.Num          = _statementTable.StatementId;
        purchParmTable.TransDate    = purchInvoice.InvoiceDate;
        purchParmTable.insert();

        while select purchLineLocal
        where purchLineLocal.PurchId == purchTableInvoice.PurchId
        {
            if(purchLineLocal.receivedInTotalServer())
            {
                purchParmLine.clear();
                purchParmLine.ParmId = purchParmTable.ParmId;
                purchParmLine.TableRefId    = purchParmTable.TableRefId;
                purchParmLine.initFromPurchLine(purchLineLocal);
                purchParmLine.ReceiveNow = purchLineLocal.receivedInTotalServer();
                purchParmLine.InventNow  = purchLineLocal.receivedInventInTotal();
                purchParmLine.RemainAfter   = 0;
                purchParmLine.RemainAfterInvent = 0;
                purchParmLine.RemainBefore = purchParmLine.ReceiveNow;
                purchParmLine.RemainBeforeInvent    = purchParmLine.InventNow;
                purchParmLine.LineAmount = purchParmLine.calcLineAmountForced();

                purchParmLine.insert();

            }
        }
    }

    this.initParameters();

    this.editLinesChanged(false);
    this.reArrangeNow(true);

    this.validateAll(false);
    this.reArrange(true);
    this.validateAll(true);

    ttscommit;


}

放在这里做备份。

以上是关于过账采购发票的主要内容,如果未能解决你的问题,请参考以下文章

SAP如何查看采购发票是不是过帐?如何审批没有过帐发票?

sap中凭证已过账,生成财务凭证,发现有错,有啥办发可以冲销

002 MIRO发票校验采购订单项目科目分配类别检查增强-20150819

sap软件里发票校验跳出来借贷不相等是怎么回事

SAP系统采购发票校验要点

[易飞]自动生产采购发票开票数量翻倍(缺乏事务管理缺陷)