Hi Everyone,
I am trying to save proforma sales invoices to PDF using SRSPrintDestinationSettings. This is working fine. However, the issue is that it also save a duplicate pdf file into a new folder under the same folder. Can someone please point how can i solve this issue ?
My code is :
static void AK_ProformaInvoicesPrint(Args _args)
{
SalesFormLetter salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);
SalesParmLine parmLine;
SalesLine salesline;
SalesTable salesTable;
SRSPrintDestinationSettings printerSettings;
printerSettings = new SRSPrintDestinationSettings();
salesTable = salesTable::find("SOA00036974");
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.usePrintManagement(false);
//link the printer settings to the controller
//print to pdf and always overwrite if the file exists
printerSettings.printMediumType(SRSPrintMediumType::File);
printerSettings.fileFormat(SRSReportFileFormat::PDF);
printerSettings.overwriteFile(true);
printerSettings.fileName("\\\\10.20.10.7\\AXTestData\\AX\\Prints\\"+salesTable.SalesId+".pdf");
printerSettings.printerComment();
salesFormLetter.updatePrinterSettingsFormLetter(printerSettings.pack());
salesFormLetter.initParmSalesTable(salesTAble);
salesFormLetter.initParameters(salesFormLetter.salesParmUpdate(),Printout::Current);
salesFormLetter.initLinesQuery();
while select forUpdate parmLine where parmLine.ParmId == salesFormLetter.parmId()
{
salesLine = salesline::findInventTransId(parmLine.InventTransId);
if (salesline.ShippingDateRequested > today())
{
ttsBegin;
parmLine.delete();
ttsCommit;
}
}
salesFormLetter.run();
}
Best Regards,
*This post is locked for comments