Sale Order Batch Invoicing reprints invoices from prior runs, when “Print” is set to ‘After’ on AR >> Periodic >> Sales Update >> Invoice form
The issue is occurring because Sales Orders, to be invoiced, are retrieved based on "ParmId" from the CustInvoiceJour table and one "ParmId" is maintained by a Batch Job.
Fix is to add a condition based on ‘PrintedOriginals’, while building the Journal List for Invoices. ‘PrintedOriginals’ is the field on CustInvoiceJour table, which indicates the count of invoice printed
Note: This recommendation is for invoices only. Similar issue can exist for confirmations/picking list/packing slip documents.
This fix is applied in \Classes\SalesFormLetterEndMultiThread\method\buildJournalList
case classnum(SalesFormLetter_Invoice),
classnum(SalesFormLetter_InvoiceProject),
classnum(SalesFormLetter_FreeText) :
while select custInvoiceJour
where custInvoiceJour.ParmId == updateParmId
&& !custInvoiceJour.PrintedOriginals //Condition added
{
journalList.ins(custInvoiceJour);
}
break;
If the print medium is PrintArchive, following code changes need to be included in \Reports\SalesInvoice\Methods\fetch Line
If (salesFormLetterReport.getCurrentPrintSetting().parmType() == PrintMgmtDocInstanceType::Original &&
(element.printJobSettings().getTarget() == PrintMedium::Printer ||
element.printJobSettings().getTarget() == PrintMedium::PrintArchive)) //Condition added
{
CustInvoiceJour::updatePrinted(custInvoiceJour, element.printJobSettings().copies());
}