<?php

/**
 *
 * INDEXU
 * Copyright(C), Nicecoder, 2000-2006, All Rights Reserved.
 *
 * INDEXU(tm) is protected by Indonesia and International copyright laws.
 * Unauthorized use or distribution of INDEXU(tm) is strictly prohibited,
 * violators will be prosecuted. To obtain a license for using INDEXU(tm),
 * please register at Nicecoder home page at http://www.nicecoder.com
 *
 * Author:
 *    Dody Rachmat Wicaksono (dody@nicecoder.com)
 *    M. Zuber (zubby@nicecoder.com)
 *
 */
 
  /*===================================================
    main
  ===================================================*/

  include "application.php";
  
  RemoveFilter('runtime');
  RunPreFilter(__FILE__);

  $query                     = "select * from idx_invoice_config";
  $result                    = $dbConn->execute($query);
  $company                   = $result->Fields('company');
  $contact                   = $result->Fields('contact');
  $address                   = $result->Fields('address');
  $phone                     = $result->Fields('phone');
  $email                     = $result->Fields('email');
  $currency                  = $result->Fields('currency_symbol');

  $query                     = "select * from idx_invoice where invoice_id = '$id'";
  $result                    = $dbConn->execute($query);
  $invoice_date              = $result->Fields('invoice_date');
  $due_date                  = $result->Fields('due_date');
  $invoiced_to               = $result->Fields('invoiced_to');
  $email                     = $result->Fields('email');
  $service                   = $result->Fields('service');
  $description               = $result->Fields('description');
  $total                     = $result->Fields('total');
  $comment                   = $result->Fields('comment');
  $paid                      = $result->Fields('paid');
  $invoice_id                = $id;

  $available_payment_systems = GetPaymentSystems('image');

  DisplayTemplate($theme_path . "/invoice.html",
                  "\$company,\$contact,\$address,\$phone,\$email,\$currency,"
                    . "\$invoice_date,\$due_date,\$invoiced_to,\$email,\$service,"
                    . "\$invoice_id,\$description,\$total,\$comment,\$paid,\$available_payment_systems");

  RunPostFilter(__FILE__);

?>