You are here

function _invoice_get_html in Invoice 6

Same name and namespace in other branches
  1. 7 invoice_helpers.inc \_invoice_get_html()

Helper function to get the invoice in HTML format

Parameters

integer $invoice_number:

object $node:

string $type:

1 call to _invoice_get_html()
invoice_view_pdf in ./invoice.module
Display the invoice in PDF format

File

./invoice_helpers.inc, line 268
Invoice module

Code

function _invoice_get_html($invoice_number, $node = null, $type = 'print') {
  if (is_null($node)) {
    $nid = db_result(db_query("SELECT nid FROM {invoice_invoices} WHERE iid=%d", $invoice_number));
    $node = node_load($nid);
  }
  $html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml" lang="nl" xml:lang="nl" dir="ltr">
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
  ';
  $html = '<html><head>';
  $html .= '<link type="text/css" rel="stylesheet" media="all" href="http://' . $_SERVER['HTTP_HOST'] . base_path() . drupal_get_path('module', 'invoice') . '/templates/' . $node->invoice['template'] . '.css" />';
  $html .= '</head><body><div class="' . $type . '">';
  $html .= theme('invoice_body', $node, $type);

  // The eurosign is not supported as applicable character, so replace it with a ascii code
  $html = str_replace('€', '&#0128;', $html);
  $html .= '</div></body></html>';
  return $html;
}