Hi All,
I'm trying to calling Sales Invoice report (206) from another report, whose data item is "Sales Invoice Header'.
I want to print each sales invoice report individually into PDF Format( according to Sales Invoice Header - "No." wise), but when i call Sales Invoice, the system is getting hang for printing report.
1) When i give the filters on report (say Invoice No. :01000..010010), it is printing only first Invoice no. & getting hang.
2) If i club all the Invoice No. & print into one file, it is printing fine.
3) i didn't get why it is getting hang for printing each individual file into PDF format.
4) DifferentFile is the boolean which accepts whether Sales invoice file is printed separately for each invoice into PDF format.
Below is the code:
IF gBlnSaveToPDF THEN BEGIN
FinvoiceSetup.TESTFIELD(FinvoiceSetup."Finvoice Invoice App. File");
IF ISCLEAR(gPDFCreator) THEN
CREATE(gPDFCreator);
IF ISCLEAR(gPDFCreatorError) THEN
CREATE(gPDFCreatorError);
lIntReportID :=REPORT::"Sales - Invoice";
lTxtFileDirectory :=FinvoiceSetup."Finvoice Invoice App. File";
gPDFCreatorError := gPDFCreator.cError;
IF gPDFCreator.cStart('/NoProcessingAtStartup',TRUE) = FALSE THEN
ERROR('Status: Error: ' + gPDFCreatorError.Description);
gPDFCreatorOption := gPDFCreator.cOptions;
gPDFCreatorOption.UseAutosave := 1;
gPDFCreatorOption.UseAutosaveDirectory := 1;
gPDFCreatorOption.AutosaveDirectory := lTxtFileDirectory;
gPDFCreatorOption.AutosaveFormat := 0;
gPDFCreatorOption.AutosaveFilename := iTxtFileName;
gPDFCreator.cOptions := gPDFCreatorOption;
gPDFCreator.cClearCache();
gTxtDefaultPrinter := gPDFCreator.cDefaultPrinter;
gPDFCreator.cDefaultPrinter := 'PDFCreator';
gPDFCreator.cPrinterStop := FALSE;
IF NOT DifferentFile THEN BEGIN
lRecSalesInvHead.INIT;
lRecSalesInvHead.RESET;
lRecSalesInvHead.SETFILTER(lRecSalesInvHead."No.","Sales Invoice Header".GETFILTER("Sales Invoice Header"."No."));
IF lRecSalesInvHead.FINDFIRST THEN
REPORT.RUNMODAL(lIntReportID,FALSE,TRUE,lRecSalesInvHead);
END ELSE BEGIN
lRecSalesInvHead.INIT;
lRecSalesInvHead.RESET;
lRecSalesInvHead.SETRANGE(lRecSalesInvHead."No.","Sales Invoice Header"."No.");
IF lRecSalesInvHead.FINDFIRST THEN
REPORT.RUNMODAL(lIntReportID,FALSE,TRUE,lRecSalesInvHead);
END;
gPDFCreator.cDefaultPrinter :=gTxtDefaultPrinter;
END;
Regards
Pushpraj
0
Comments
Does is work if you print just one invoice ?
If so I would suggest clearing the gPDFCreator variable.
Dynamics Nav Add-ons
http://www.simplydynamics.ie/Addons.html
viewtopic.php?f=5&t=18331