Home RAP

Report.PrinterSetup.Copies

edited November 2011 in RAP
Hi!

I have small report that writes tickets. The dataset consists of
Date, Tickettype, Amount, Price

01012012 Adult 2 100.-
01012012 Child 1 100,-
01012010 Free 2 0.-

If the dataset['Amount']=2 or more i want it to write that number of
tickets. In this case i want 2 adult, 1 child and 2 free tickets.

I have attempted this in the BeforePrintEvent

begin
Report.PrinterSetup.Copies := Sale['Amount'];
end;

What happens here is that it write 2 tickets of every line in the dataset.
Is solution to this in RAP or do i have to do this in Delphi code?

Regards, Terje

Comments

  • edited November 2011
    Hi Terje,

    Rather than trying to adjust the printed copies, try adjusting the
    DetailBand.PrintCount property instead. This will print each record the
    number of times assigned.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2011
    Hi Nico,

    I have tried to set DetailBand.PrintCount property in these events (not at
    the same time)
    Report.BeforePrint, Report.DetailBand.BeforePrint,
    Report.DetailBand.BeforeGenerate
    but it still prints only one ticket of each. I print the value of
    DetailBand.PrintCount to see
    if it is set. And it is set correctly, but it still prints only one ticket
    although PrintCount is set
    to two or more.

    DetailBeforePrint
    begin
    Report.Detail.PrintCount := Sale['salin_amount'];
    lblAmount.Caption := IntToStr(Report.Detail.PrintCount);
    end;

    What is wrong? Should i use another event?
    The ticketprinter is a Zebra ZM400.

    Regards, Terje


  • edited November 2011

    Hi Terje,

    I think we have implemented something just like you mean.
    What we do is to set the BandsPerRecord property in the AfterPrint event.
    You could try and see if that works.

    Best regards,

    Benjamin
  • edited November 2011
    Hi Benjamin,

    I tried this but that did not work for me. Thanks for your effort.

    So the questions in my previous mail still stands.

    Regards,
    Terje

    "Benjamin Vrolijk" skrev i melding
  • edited November 2011
    Hi Terje,

    I apologize, Benjamin is correct. Rather than using the PrintCount
    property you need to use the BandsPerRecord property. This defines how
    many copies of the detail band will print for each record of the report.

    In my testing with the BandsPerRecord and the DetailBand.BeforeGenerate
    event, I was able to successfully change the number of copies generated.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2011
    Hi,

    I have tried this and the BandsPerRecord is set correctly in the
    BeforeGenerate event. I suspect that i probably have a printer problem as it
    insists on writing BandsPerRecord*4, which means that when i set BPR to 2 i
    get 8 copies. If i set device to screen i get the right number of copies in
    preview. I will try this on another printer on monday. Hope it works then.
    Regards,
    Terje


This discussion has been closed.