zoukankan      html  css  js  c++  java
  • 过账采购发票

    大多数场景下,开票前一般都会跟供应商进行收货单的对账,准确无误后,根据协商的金额将所对账的采购订单开一个发票。
    在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;
    
    
    }

    放在这里做备份。

  • 相关阅读:
    mysql数据库表中判断字段是否存在,如果不存在则创建该字段
    PHP同时操作两个mysql数据库
    Bootstrap-分页插件Paginator
    NLP--自然语言处理与机器学习会议
    对CURL的一些研究
    Nginx完整配置说明
    SecureCRT自动登陆到服务器的脚本以及脚本编写简单说明
    Fast CGI 工作原理
    FastCGI中文规范
    Linux +apache+fastcgi运行c/c++
  • 原文地址:https://www.cnblogs.com/Farseer1215/p/6995116.html
Copyright © 2011-2022 走看看