Hello Everyone,
Today we will be looking at how to invoice a Sales order line by line. We usually use "SalesFormLetter" class and "run" method to post and SO which will post the entire SO and all the lines in it. Recently I have come across a new requirement while posting an SO i.e.., to post the SO invoice line by line. So lets see how the code is build.
Today we will be looking at how to invoice a Sales order line by line. We usually use "SalesFormLetter" class and "run" method to post and SO which will post the entire SO and all the lines in it. Recently I have come across a new requirement while posting an SO i.e.., to post the SO invoice line by line. So lets see how the code is build.
Public static void salesOrderInvoiceByLine(SalesLine
_salesline)
{
salesFormLetter
salesFormLetter;
salesFormletterParmData
salesFormLetterParmData;
salesParmUpdate
salesParmUpdate;
salesParmTable
salesParmTable;
salesParmLine
salesParmLine;
salesTable
salesTable;
ttsbegin;
salesTable = salesTable::find(_salesline.SalesId);
salesFormLetterParmData = salesFormletterParmData::newData(DocumentStatus::Invoice, VersioningUpdateType::Initial);
salesFormLetterParmData.parmOnlyCreateParmUpdate(true);
salesFormLetterParmData.createData(false);
salesParmUpdate
= salesFormLetterParmData.parmParmUpdate();
salesParmTable.clear();
salesParmTable.TransDate
=
_salesline.ReceiptDateRequested;
salesParmTable.Ordering
= DocumentStatus::Invoice;
salesParmTable.ParmJobStatus
= ParmJobStatus::Waiting;
salesParmTable.salesId
= salesTable.salesId;