Tuesday, December 31, 2013

Post sales invoice based on packing slip using X++

static void D_SalesInvoicePosting(Args _args)
{
    List            il = new List(Types::Record);
    List            newList;
    container    packedList;


    SalesTable                 salesTable;
    TmpFrmVirtual           tmpFrmVirtual;
    CustPackingSlipJour   custPackingSlipJour;
   
    SalesFormLetter_Invoice SalesFormLetter;
    ;
   
    ttsBegin;
    select custPackingSlipJour
        where custPackingSlipJour.SalesId == "SO13-1325"
           && custPackingSlipJour.PackingSlipId == "ND13-1261";

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


    il.addEnd(tmpFrmVirtual);

    packedList = il.pack();

    salesTable = SalesTable::find('SO13-1325');

    salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);

    salesFormLetter.hideProgress(true);

    salesFormLetter.printFormLetter(false);

    salesFormLetter.update(salesTable, systemDateGet(), SalesUpdate::PackingSlip, AccountOrder::None, false, false, false, false, packedList);

    ttsCommit;
}

4 comments:

  1. If you want to create an invoice without any software, there are hundreds of tools available on internet. But I am not sure, all tools are best and free. But here is the best online invoice creator tools for free. Project Management Software

    ReplyDelete
  2. Thanks Paul, you saved my life whit this code. Congratulations!! (y)

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete