static void partialInvoice(Args _args)
{
SalesFormLetter salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
SalesTable salesTAble;
SalesParmLine parmLine;
;
salesTable = SalesTable::find(‘INMF-000068’);
salesFormLetter.salesTable(salesTable);
salesFormLetter.transDate (systemDateGet());
salesFormLetter.specQty(SalesUpdate::All);
//If you want proforma you can enable the code
//salesFormLetter.proforma (true);
//salesFormLetter.printFormLetter (true);
//salesFormLetter.createParmUpdateFromParmUpdateRecord(salesFormLetter.salesParmUpdate());
salesFormLetter.initParmSalesTable(salesTAble);

salesFormLetter.initParameters(salesFormLetter.salesParmUpdate(),Printout::After);
salesFormLetter.initLinesQuery();

while select forUpdate parmLine where parmLine.ParmId == salesFormLetter.parmId()
{
ttsBegin;
parmLine.DeliverNow = 3;
parmLine.setQty(parmLine.salesParmTable().ordering, salesFormLetter.SalesParmUpdate().creditRemaining);
parmLine.setInventDeliverNow();
parmLine.setLineAmount();
parmLine.update();
ttsCommit;
}

salesFormLetter.run();
}