Customer (Record) - Customer File1 (Automation) - 'Microsoft Scripting Runtime'.FileSystemObject Filename1(Text200) RunOnceFile (Text250) TimeOut (Integer ) SalesStat (Report) - Statement report
SMTPSetup.GET; Customer.SETRANGE("No.",CustNo); IF Customer.FINDSET THEN BEGIN IF ISCLEAR(File1) THEN CREATE(File1); IF ISCLEAR(BullZipPDF) THEN CREATE(BullZipPDF); IF NOT File1.FolderExists(SMTPSetup."Path to Save Report") THEN File1.CreateFolder(SMTPSetup."Path to Save Report"); Filename1:= SMTPSetup."Path to Save Report" +'Statement' + '.pdf'; IF EXISTS(Filename1) THEN ERASE(Filename1); BullZipPDF.Init; BullZipPDF.LoadSettings; RunOnceFile := BullZipPDF.GetSettingsFileName(TRUE); BullZipPDF.SetValue('ShowSaveAs','never'); BullZipPDF.SetValue('OwnerPassword','abc'); BullZipPDF.SetValue('UserPassword', CustNo); BullZipPDF.SetValue('KeyLength', 'Standard128bit'); BullZipPDF.SetValue('Output',Filename1); BullZipPDF.SetValue('ShowSaveAS','never'); BullZipPDF.SetValue('Showsettings', 'never'); BullZipPDF.SetValue('ShowPDF', 'no'); BullZipPDF.SetValue('ShowProgress', 'no'); BullZipPDF.SetValue('ShowProgressFinished', 'no'); BullZipPDF.SetValue('SuppressErrors', 'yes'); BullZipPDF.SetValue('ConfirmOverwrite', 'no'); BullZipPDF.WriteSettings(TRUE); SalesStat.SETTABLEVIEW(Customer); SalesStat.USEREQUESTFORM(FALSE); SalesStat.RUNMODAL; TimeOut := 0; WHILE EXISTS(RunOnceFile) AND (TimeOut < 30) DO BEGIN SLEEP(1000); TimeOut += 1; END; CLEAR(File1); CLEAR(BullZipPDF); END; EXIT(Filename1);
Comments
if i remember correctly you have to select the printer before doing the settingsfile
something along the lines of
BullZipPDF.PrinterName := PrinterName;
before the init
See more at wiki.bullzip.com/pdf-printer/documentation/reference/configuration-files
|To-Increase|
Function: SendMailToRegOpenInvoices
Coding..
SendMailToRegOpenInvoices(CustNo : Code[20])
Can anybody let me know where I made mistake?
Thanks.
You need to build a filtrer for all the invoice Nos you need to be included in one PDF file and call the SalesInv.RUNMODAL only once.
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
PdfFile.CREATE('D:\Invoice.pdf');
PDFSecurity := PDFSecurity.PdfSettings;
PDFSecurity.PrinterName('Bullzip PDF Printer');
PDFSecurity.SetValue('Output',PdfFile.NAME);
PDFSecurity.SetValue('ShowSaveAs', 'never');
PDFSecurity.SetValue('ShowSettings', 'never');
PDFSecurity.SetValue('ShowPDF', 'no');
PDFSecurity.SetValue('ShowProgress', 'no');
PDFSecurity.SetValue('ShowProgressFinished', 'no');
PDFSecurity.SetValue('ConfirmOverwrite', 'no');
PDFSecurity.SetValue('UserPassword','1234');
PDFSecurity.SetValue('OwnerPassword','12345');
PDFSecurity.WriteSettings(TRUE);
CLEAR(SalesInvHeader);
SalesInvoiceHeader.SETRANGE("No.","No.");
IF SalesInvoiceHeader.FINDSET THEN;
REPORT.RUNMODAL(REPORT::"Sales - Invoice", FALSE,FALSE,SalesInvHeader);
PdfFile.CLOSE;
Looking your code I think on REPORT.RUNMODAL you have to pass System printer as false if you are defining different printer for this report on printer selection else it is going to take default printer of Windows.
you can use a text variable for this and fill it with numbers split by the "|" sign. like invoiceno1|Invoiceno2 and so on.
After the loop you then set the filter on salesinvoiceheader with a setfilter and run the report once
Refer This Link- You can use .net Variable and re-create this functionality.