Dynamics AX 2009/2012 İrsaliyeyi X++ ile Faturalaştırmak

Aşağıdaki örnek kodu kullanarak bir irsaliyenin birebir faturasını kesebilirsiniz.

// guvensahin.com
static void AYXCreateInvoice(Args _args)
{
    List                    il = new List(Types::Record);
    container               packedList;
    TmpFrmVirtual           tmpFrmVirtual;
    SalesFormLetter_Invoice SalesFormLetter;
    SalesTable              SalesTable          = SalesTable::find("SalesOrderNum");
    CustPackingSlipJour     CustPackingSlipJour = CustPackingSlipJour::findPrePackingSlipId("PrePackingSlipId");
    ;
   
    ttsBegin;

    tmpFrmVirtual.clear();
    tmpFrmVirtual.NoYes     = true;
    tmpFrmVirtual.TableNum  = CustPackingSlipJour.TableId;
    tmpFrmVirtual.RecordNo  = CustPackingSlipJour.RecId;
    tmpFrmVirtual.Id        = CustPackingSlipJour.SalesId;
    tmpFrmVirtual.insert();


    il.addEnd(tmpFrmVirtual);
    packedList = il.pack();

    salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
    salesFormLetter.printFormLetter(false);
    salesFormLetter.update(SalesTable, systemDateGet(), SalesUpdate::PackingSlip, AccountOrder::None, false, false, false, false, packedList);

    ttsCommit;
}

 

Bir Cevap Yazın