Class: OpenShip::Label::BigCartonLabel

Inherits:
CartonLabel show all
Defined in:
lib/open-ship/label/big_carton_label.rb

Instance Attribute Summary collapse

Attributes inherited from CartonLabel

#origin, #product, #quantity, #sku, #style, #upc

Class Method Summary collapse

Methods inherited from CartonLabel

#gtin, #to_pdf

Instance Attribute Details

#bolObject

Returns the value of attribute bol.



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

def bol
  @bol
end

#facility_codeObject

Returns the value of attribute facility_code.



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

def facility_code
  @facility_code
end

#from1Object

Returns the value of attribute from1.



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

def from1
  @from1
end

#from2Object

Returns the value of attribute from2.



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

def from2
  @from2
end

#from3Object

Returns the value of attribute from3.



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

def from3
  @from3
end

#po_numberObject

Returns the value of attribute po_number.



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

def po_number
  @po_number
end

#scacObject

Returns the value of attribute scac.



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

def scac
  @scac
end

#ssccObject

Returns the value of attribute sscc.



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

def sscc
  @sscc
end

#store_numberObject

Returns the value of attribute store_number.



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

def store_number
  @store_number
end

#to1Object

Returns the value of attribute to1.



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

def to1
  @to1
end

#to2Object

Returns the value of attribute to2.



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

def to2
  @to2
end

#to3Object

Returns the value of attribute to3.



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

def to3
  @to3
end

#trackingObject

Returns the value of attribute tracking.



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

def tracking
  @tracking
end

#vendor_numberObject

Returns the value of attribute vendor_number.



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

def vendor_number
  @vendor_number
end

#zipObject

Returns the value of attribute zip.



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

def zip
  @zip
end

Class Method Details

.to_pdf(cl, filename) ⇒ Object



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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/open-ship/label/big_carton_label.rb', line 14

def self.to_pdf(cl, filename)

  Prawn::Document.generate(filename, :page_size   => [4.in, 6.6.in],
    :right_margin => 0.0.cm,
    :left_margin => 0.0.cm,
    :top_margin => 0.0.cm,
    :bottom_margin => 0.0.cm,
    :page_layout => :portrait) do


    # Field A
    bounding_box [0,6.6.in], :width => 1.75.in, :height => 1.in do
      indent(5) do
        move_down 5
        self.font_size = 12
        text "FROM:"
      end
      indent(10) do
        move_down 5
        self.font_size = 8
        text cl.from1
        text cl.from2
        text cl.from3
      end
      stroke_bounds
    end
    
    # Field B
    bounding_box [1.75.in,6.6.in], :width => 2.25.in, :height => 1.in do
      indent(5) do
        move_down 5
        self.font_size = 12
        text "TO:"
      end
      indent(10) do
        move_down 5
        self.font_size = 8
        text cl.to1
        text cl.to2
        text cl.to3
      end

      stroke_bounds
    end

    # Field C
    bounding_box [0.in,5.6.in], :width => 1.5.in, :height => 1.in do
      indent(5) do
        move_down 5
        self.font_size = 12
        text "CARRIER INFO:"
      end

      indent(10) do
        move_down 5
        self.font_size = 10
        if cl.bol
          text "B/L: #{cl.bol}"
        end
        if cl.scac
          text "SCAC: #{cl.scac}"
        end
        if cl.tracking
          text "PRO: #{cl.tracking}"
        end
      end


      stroke_bounds
    end

    # Field D
    bounding_box [1.5.in,5.6.in], :width => 2.5.in, :height => 1.in do
      if cl.zip.nil?
        raise "Zip must not be nil!"
      end
      the_zip = ("420" + cl.zip.to_s)
      indent(5) do
        move_down 5
        self.font_size = 12
        text "POSTAL ZIP:"
      end

      indent(10) do
        self.font_size = 12
        text the_zip
      end

      barcode = Barby::Code128A.new(the_zip)

      barcode.annotate_pdf(self, {:x => 10, :y => 5, :xdim => 0.010.in, :height => 0.5.in})



      stroke_bounds
    end

    # Field E
    bounding_box [0.in,4.6.in], :width => 4.in, :height => 1.in do
      indent(100) do
        move_down 20
        self.font_size = 12
        text "PO Number: #{cl.po_number}"
        if cl.vendor_number
          text  ("Vendor Number: " + cl.vendor_number.to_s)
        end
      end

      barcode = Barby::Code128A.new(cl.po_number)

      barcode.annotate_pdf(self, {:x => 10, :y => 20, :xdim => 0.010.in, :height => 0.5.in})

      stroke_bounds
    end

    # Field F
    bounding_box [0.in,3.6.in], :width => 4.in, :height => 1.in do

      indent(10) do
        move_down 10
        self.font_size = 12
        if cl.quantity
          text "QTY: #{cl.quantity}"
        end
        if cl.upc
          text "UPC: #{cl.upc}"
          barcode = Barby::Code128A.new(cl.upc)

          barcode.annotate_pdf(self, {:x => 130, :y => 20, :xdim => 0.010.in, :height => 0.5.in})

        end
        if cl.style
          text "Description: #{cl.style}"
        end
      end

      stroke_bounds
    end

    # Field G
    bounding_box [0.in,2.6.in], :width => 2.5.in, :height => 1.in do
      stroke_bounds
    end

    # Field H
    bounding_box [2.5.in,2.6.in], :width => 1.5.in, :height => 1.in do

      indent(5) do
        move_down 5
        self.font_size = 12
        text "STORE:"
      end
      indent(10) do
        move_down 10
        self.font_size = 16
        text(("<b>" + cl.store_number.to_s + "</b>"), :inline_format => true)
      end


      stroke_bounds
    end

    # Field I
    bounding_box [0.in,1.6.in], :width => 4.in, :height => 1.6.in do

      indent(5) do
        move_down(5)
        self.font_size = 10
        text "SSCC-18"
      end
      
      indent(60) do
        move_down 5
        self.font_size = 12
        text ("(00) " + cl.sscc)
      end

      barcode = Barby::GS1128.new(cl.sscc, "A", "00")

      barcode.annotate_pdf(self, {:x => 40, :y => 5, :xdim => 0.010.in, :height => 1.in})

      stroke_bounds
    end



  end

end