Sha256: bd573525192611f19043ad488b796c9b7d9dd71b76927845106a30d7b81143a8

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

#!/usr/bin/env ruby
# This is an example of a very simple invoice.

lib = File.expand_path('../../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'invoice_printer'

provider_address = <<ADDRESS
5th Avenue
747 05  NYC
ADDRESS

purchaser_address = <<ADDRESS
7th Avenue
747 70  NYC
ADDRESS

item = InvoicePrinter::Document::Item.new(
  name: 'Programming',
  quantity: '10',
  unit: 'hr',
  price: '$ 90',
  amount: '$ 900'
)

invoice = InvoicePrinter::Document.new(
  number: 'NO. 198900000001',
  provider_name: 'John White',
  provider_lines: provider_address,
  purchaser_lines: purchaser_address,
  issue_date: '05/03/2016',
  due_date: '19/03/2016',
  total: '$ 900',
  bank_account_number: '156546546465',
  items: [item],
  note: "This is a note at the end.\nA note with two lines."
)

InvoicePrinter.print(
  document: invoice,
  logo: File.expand_path('../prawn.png', __FILE__),
  file_name: 'simple_invoice.pdf'
)

InvoicePrinter.print(
  document: invoice,
  logo: File.expand_path('../prawn.png', __FILE__),
  file_name: 'simple_invoice_a4.pdf',
  page_size: :a4
)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
invoice_printer-2.2.0 examples/simple_invoice.rb
invoice_printer-2.2.0.alpha1 examples/simple_invoice.rb
invoice_printer-2.1.0 examples/simple_invoice.rb
invoice_printer-2.1.0.rc1 examples/simple_invoice.rb