AX 2012 PurchPrepayTable作成

    PurchPrepayTable PurchPrepayTable;
    PurchTable purchTable = purchTable::find(Z_PurchId);
    PurchFormLetter purchFormLetter;
    ;
    ttsBegin;
    delete_from purchPrepayTable where purchPrepayTable.PurchTable == purchTable.PurchId;

    PurchPrepayTable.Description = "";
    PurchPrepayTable.Type = PurchPrepayType::Percent;
    purchPrepayTable.Value = 100.00;
    PurchPrepayTable.Currency = purchTable.CurrencyCode;
    PurchPrepayTable.PrepayCategoryId= Z_PurchPrepayCategoryId;
    PurchPrepayTable.PurchTable = purchTable.PurchId;
    purchPrepayTable.recalculatePrepayLimit();
    purchPrepayTable.recalculateAmounts(false);
    purchPrepayTable.insert();

    //Posting PO Confirmation
    purchFormLetter = PurchFormLetter::construct(DocumentStatus::PurchaseOrder);
    purchFormLetter.update(purchTable, Z_HachuId);
    //Posting PO Invoice
    purchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice);
   
    PurchFormLetter.parmInvoiceType(PurchInvoiceType::VendorAdvance);
    purchFormLetter.update(purchTable, Z_HachuId);
    ttsCommit;

posted @ 2016-12-08 12:19  Fog-Fog  阅读(225)  评论(0编辑  收藏  举报