title: How to render Html template with info from database in Services
body: <p>I am having dificulties to do the following:</p>
  
  <ul>
  <li><p>Having a job that runs from time to time (Done)</p></li>
  <li><p>Fetching some data from database inside that job (Done)</p></li>
  <li><p>Next step would be use that data with a template that I already created (HTML) and then render it to PDF</p></li>
  <li><p>Then send an email with that pdf in attachment</p></li>
  </ul>
  
  <p>This is my current job:</p>
  
  <pre><code>def execute() {
         println("Hi, I am a schedule Job triggering every half an hour from 7 AM to 22 PM that will never stop running until master jose tells me to :)")
  
         EventService.updateOffersdwh()
         EventService.getUncheckedOffers()
      }
  </code></pre>
  
  <p>which is working properly :)</p>
  
  <p>Those are my service's methods called in the previous job:</p>
  
  <pre><code>def updateOffersdwh(){
  
      def sql = Sql.newInstance("jdbc:postgresql://"+hostname+":5432/xyz", username, password, "org.postgresql.Driver")
      sql.rows(" Select From bird_admin.updt_offerorders('2018-03-07','2018-03-07','" + database + "') ");
  
      println('Updating Order and Offers datawarehouse...');      
  }
  
  def getUncheckedOffers(){
  
      def sql = sql.newInstance("jdbc:postgresql://"+hostname+":5432/xyz", username, password, "org.postgresql.Driver")
  
      def query = "select id, poo_id, b.name, b.address_line1, b.address_line2, b.zipcode, event_date::date, task_name, sku_id, sku_name, column_type, column_value, instance_name,checked FROM bird_admin.ooisdwh a LEFT JOIN sd_bel.cfg_point_of_operation b ON a.poo_id = b.id WHERE checked = false"
      def offers = sql.rows(query)
  
      println('DEBUG OFFERS FINAL:: '+offers)
  }
  </code></pre>
  
  <p>Can anyone please advice or guide me on the next steps?</p>
  
  <p>How can I use a template in html that I already have in my views\template folder?</p>
  
  <p>What is the best way to use the info from the database and render the html with that info?</p>
  
  <p>Should I use a controller? If so, how? I'm kinda lost now :|</p>