static void RB_PostSalesInvoice(Args _args)
{
SalesTable salesTable;
SalesFormLetter salesFormLetter;
Query query;
QueryRun queryRun;
QueryBuildDataSource qbds;
salesTable = SalesTable::find('20001');
query = new Query(QueryStr(SalesUpdatePackingSlip));
qbds = query.dataSourceTable(tableNum(SalesLine));
// Build query range to find those lines which needs to be posted.
qbds.addRange(fieldNum(SalesLine, SalesId)).value('20001');
qbds.addRange(fieldNum(SalesLine, SalesStatus)).value(queryValue(SalesStatus::Backorder));
qbds.addRange(fieldNum(SalesLine, itemId)).value('V12_IF');
queryRun = new queryRun(query);
salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
salesFormLetter.chooseLinesQuery(queryRun);
salesFormLetter.update(salesTable);
}
{
SalesTable salesTable;
SalesFormLetter salesFormLetter;
Query query;
QueryRun queryRun;
QueryBuildDataSource qbds;
salesTable = SalesTable::find('20001');
query = new Query(QueryStr(SalesUpdatePackingSlip));
qbds = query.dataSourceTable(tableNum(SalesLine));
// Build query range to find those lines which needs to be posted.
qbds.addRange(fieldNum(SalesLine, SalesId)).value('20001');
qbds.addRange(fieldNum(SalesLine, SalesStatus)).value(queryValue(SalesStatus::Backorder));
qbds.addRange(fieldNum(SalesLine, itemId)).value('V12_IF');
queryRun = new queryRun(query);
salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
salesFormLetter.chooseLinesQuery(queryRun);
salesFormLetter.update(salesTable);
}
How post multiple sales order for one invoice with selected lines through x++ code??
ReplyDelete