Converting Reports to PDF Format

JBhavJBhav Member Posts: 32
Hi,
I have a current Customer Statement report which has No. and DateFilter as required fields. I have to convert this report into PDF format using BullzipPrinter.

I have created a new report[ Customer Statement - PDF] using Customer as Dataitem and entered all the codes for the conversion for the bullzip.

IF ISCLEAR(BullZipPDF) THEN
CREATE(BullZipPDF);


ReportID := REPORT::"Customer Statement";

FileDirectory := 'C:\stat\';

Window.OPEN('Processing Customer ######################1##');

Object.GET(Object.Type::Report,'',ReportID);
---- Customer - OnPredataitem()

LastFieldNo := FIELDNO("No.");

---Customer - OnAfterGetRecord()

Window.UPDATE(1,"No.");
PDFFileName := "No." + '.pdf';
BullZipPDF.Init;
BullZipPDF.LoadSettings;
RunOnceFile := BullZipPDF.GetSettingsFileName(TRUE);
BullZipPDF.SetValue('Output',FileDirectory+PDFFileName);
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);
CustHeader := Customer;
CustHeader.SETRECFILTER;
REPORT.RUNMODAL(ReportID,FALSE,FALSE,CustHeader);

TimeOut := 0;
WHILE EXISTS(RunOnceFile) AND (TimeOut < 10) DO BEGIN
SLEEP(3000);
TimeOut := TimeOut + 1;
END;

Window.CLOSE;

IF RecCustomer.GET("No.") THEN;
IF RecUserSetup.GET(USERID) THEN;
CLEAR(SMAIL);
SMAIL.CreateMessage(USERID,RecUserSetup."E-Mail",RecCustomer."E-Mail","No."+'Sub: Customer Statement',"No."+
'Customer Statement',FALSE);

SMAIL.AddAttachment(FileDirectory+"No."+'.pdf');
SMAIL.Send;
ERASE(FileDirectory+"No."+'.pdf');


When i run this report i get the following error message:

Please specify a filter for the date filter field in the customer table.

In fact, the report is calling the date filter found on the customer statement report.

Can you please advise how we can link these two reports so that the date filter entered in the customer statement - pdf is populated directly in the date filter field of the customer statement report.

Thanks in advance
Regards,
Bhavna :)

Comments

  • BeliasBelias Member Posts: 2,998
    can you explain it more clearly, please? in the meantime, i'm doing a guess :)
    ....
    CustHeader := Customer;
    CustHeader.SETRECFILTER;
    CustHeader.SETFILTER("date filter",somedatefilter); // add this
    REPORT.RUNMODAL(ReportID,FALSE,FALSE,CustHeader);
    
    PS: that report does not exist on my NAV, i guess it is a customized/localized version, isn't it?
    moreover...
    Can you please advise how we can link these two reports so that the date filter entered in the customer statement - pdf is populated directly in the date filter field of the customer statement report.
    ....what? i don't understand :-k
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • JBhavJBhav Member Posts: 32
    Yes, it is a customised report.

    I have added the following code:
    CustHeader.SETFILTER("date filter",somedatefilter); // add this.

    It does convert the Customer Statement report into pdf but it does not take the date into consideration. ](*,)


    What i meant by:
    Can you please advise how we can link these two reports so that the date filter entered in the customer statement - pdf is populated directly in the date filter field of the customer statement report.

    In the customised Customer statement report, there is a required filter field named Date Filter which is being used to setfilter on the posting date in the cust. ledger entry table.

    What i wanted to do was to remove the required filter field [Date Filter] from the Customer Statement report so that when i enter a date in the Customer Statement - PDF report, the customer statement report captures that date automatically to generate the report according to the date entered.
    Regards,
    Bhavna :)
  • JBhavJBhav Member Posts: 32
    I have been able to make it work \:D/

    I designed a new table with Date From and Date To as field. In the Customer Statement - PDF, the user has to input the date from and date to, and then inserts them in the table. On previewing the current report, the customer statement report gets the dates from the table.

    The report is then converted to PDF and emailed to each customer.
    Regards,
    Bhavna :)
Sign In or Register to comment.