Class: OpenShip::Label::TextLabel

Inherits:
Object
  • Object
show all
Defined in:
lib/open-ship/label/text_label.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#address1Object

Returns the value of attribute address1.



11
12
13
# File 'lib/open-ship/label/text_label.rb', line 11

def address1
  @address1
end

#address2Object

Returns the value of attribute address2.



11
12
13
# File 'lib/open-ship/label/text_label.rb', line 11

def address2
  @address2
end

#address3Object

Returns the value of attribute address3.



11
12
13
# File 'lib/open-ship/label/text_label.rb', line 11

def address3
  @address3
end

#address4Object

Returns the value of attribute address4.



11
12
13
# File 'lib/open-ship/label/text_label.rb', line 11

def address4
  @address4
end

#lineObject

Returns the value of attribute line.



11
12
13
# File 'lib/open-ship/label/text_label.rb', line 11

def line
  @line
end

#poObject

Returns the value of attribute po.



11
12
13
# File 'lib/open-ship/label/text_label.rb', line 11

def po
  @po
end

#quantityObject

Returns the value of attribute quantity.



11
12
13
# File 'lib/open-ship/label/text_label.rb', line 11

def quantity
  @quantity
end

#skuObject

Returns the value of attribute sku.



11
12
13
# File 'lib/open-ship/label/text_label.rb', line 11

def sku
  @sku
end

#total_cartonsObject

Returns the value of attribute total_cartons.



11
12
13
# File 'lib/open-ship/label/text_label.rb', line 11

def total_cartons
  @total_cartons
end

Instance Method Details

#to_pdfObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/open-ship/label/text_label.rb', line 14

def to_pdf
  document = Prawn::Document.new(:page_size   => [20.cm, 15.cm],
    :page_layout => :portrait)


  document.text_box(self.address1, :size => 16, :align => :left, :at => [0.2.cm, 11.cm], :width => 12.cm, :height => 0.75.cm)
  document.text_box(self.address2, :size => 16, :align => :left, :at => [0.2.cm, 10.25.cm], :width => 12.cm, :height => 0.75.cm)
  document.text_box(self.address3, :size => 16, :align => :left, :at => [0.2.cm, 9.5.cm], :width => 12.cm, :height => 0.75.cm)
  document.text_box(self.address4, :size => 16, :align => :left, :at => [0.2.cm, 8.75.cm], :width => 12.cm, :height => 0.75.cm)


  po_line = "PO#: #{self.po}"
  document.text_box(po_line, :size => 16, :align => :left, :at => [0.2.cm, 7.25.cm], :width => 12.cm, :height => 0.75.cm)

  line_no = "Line #: #{self.line}"
  document.text_box(line_no, :size => 16, :align => :left, :at => [0.2.cm, 6.5.cm], :width => 12.cm, :height => 0.75.cm)

  style_line = "Mfg Style #: #{self.sku}"
  document.text_box(style_line, :size => 16, :align => :left, :at => [0.2.cm, 5.75.cm], :width => 12.cm, :height => 0.75.cm)

  quantity_line = "Inner Pk Qty: #{self.quantity}"
  document.text_box(quantity_line, :size => 16, :align => :left, :at => [0.2.cm, 5.cm], :width => 12.cm, :height => 0.75.cm)

  total_cartons_line = "Total Master Pk. Cartons per Line Item: #{self.total_cartons}"
  document.text_box(total_cartons_line, :size => 16, :align => :left, :at => [0.2.cm, 4.25.cm], :width => 15.cm, :height => 0.75.cm)


  document.text_box("Pre-Priced: NO", :size => 20, :align => :left, :at => [0.2.cm, 3.cm], :width => 12.cm, :height => 1.cm)
  document.text_box("FRAGILE: NO", :size => 20, :align => :left, :at => [0.2.cm, 2.cm], :width => 12.cm, :height => 1.cm)


  document
end