How to create method to print a report - java

Asked

Viewed 170 times

0

How do I create a way to print a DB report. Follow my method below.

public void printReport (Date initialDate, Date endDate){

        list<Sale> sales = getSales (initialDate, endDate);

        for (Sale s:sales){

            Store st = s.getStore(); // Recura a Loja

            CreditCard cc = s.getCreditCard(); // Recupera o Cartão

            System.out.println(st.getNome() + ";" + cc.getName() + s.getValue());
        }
} 
  • 1

    Print on which Ireport ? What kind of report Is it? Web application or DESKTOP ?

  • take the community tour: https://answall.com/tour and mark the other questions you have already asked as answered

  • It is a simple print, run the database query, without using frameworks. It is in DESKTOP. Here is a statement: -- Build a code to print the report. Consider that the Sale, Creditcard and Store templates contain the attributes and relationships that represent the columns of the tables. The code will receive as parameter the dates for generating the report. &#xA;Considere também que já existe o método getSales(initialDate, endDate), que irá executar&#xA;a query elaborada na questão 1.&#xA;public void printReport(Date initialDate, Date endDate) {&#xA;List<Sale> sales = getSales(initialDate, endDate);&#xA;...&#xA;}

  • Your method is ok, what’s your doubt ?

  • My question is if I need to put this in a DAO class. But from the statement I think not, are just asking the same method. o/

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.