Friday, 7 September 2018

job for partial PO invoicing

here we are assuming that all the PO lines are packed but we are going to invoice single line of the PO.


static void partialPOWorking(Args _args)
{
    PurchTable purchTable,purchTablePartnerloc;
    PurchLine  purchLine;
    PurchFormLetter PurchFormLetter;

    str  invoicenumber;
   ;

   PurchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice);

   ttsBegin;

   purchTable = purchTable::find('00002564');

    select forupdate purchLine

     where purchLine.purchId == purchTable.PurchId
     && purchLine.LineNumber == 2;

   {
       purchLine.PurchReceivedNow = purchLine.PurchQty;//2;
       purchLine.modifiedField(fieldnum(purchLine,PurchReceivedNow));
       purchLine.update();

   }

////ttsBegin;
select forUpdate purchTablePartnerloc
where purchTablePartnerloc.PurchId == purchTable.PurchId;
purchTablePartnerloc.PaymMode = '';
purchTablePartnerloc.doUpdate();

  invoicenumber =   (strfmt(" %1_%2",purchLine.LineNumber,purchLine.PurchId));

//ttsCommit;

   PurchFormLetter.update(purchTable,invoicenumber,systemDateGet(),PurchUpdate::ReceiveNow);

     ttsCommit;

    info("done");

}

No comments:

Post a Comment

intercompany PO multiple product receipt by x++

public void processStampICPO(PackingSlipId _deliveryNote,                             Transdate _deliverydate,                             ...