Class: XmlConv::I2::Position

Inherits:
Object
  • Object
show all
Defined in:
lib/xmlconv/i2/position.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#article_eanObject

Returns the value of attribute article_ean.



9
10
11
# File 'lib/xmlconv/i2/position.rb', line 9

def article_ean
  @article_ean
end

#customer_idObject

Returns the value of attribute customer_id.



9
10
11
# File 'lib/xmlconv/i2/position.rb', line 9

def customer_id
  @customer_id
end

#delivery_dateObject

Returns the value of attribute delivery_date.



11
12
13
# File 'lib/xmlconv/i2/position.rb', line 11

def delivery_date
  @delivery_date
end

#free_textObject

Returns the value of attribute free_text.



9
10
11
# File 'lib/xmlconv/i2/position.rb', line 9

def free_text
  @free_text
end

#numberObject

Returns the value of attribute number.



9
10
11
# File 'lib/xmlconv/i2/position.rb', line 9

def number
  @number
end

#pharmacodeObject

Returns the value of attribute pharmacode.



9
10
11
# File 'lib/xmlconv/i2/position.rb', line 9

def pharmacode
  @pharmacode
end

#priceObject

Returns the value of attribute price.



9
10
11
# File 'lib/xmlconv/i2/position.rb', line 9

def price
  @price
end

#qtyObject

Returns the value of attribute qty.



9
10
11
# File 'lib/xmlconv/i2/position.rb', line 9

def qty
  @qty
end

#unitObject

Returns the value of attribute unit.



9
10
11
# File 'lib/xmlconv/i2/position.rb', line 9

def unit
  @unit
end

Instance Method Details

#to_sObject



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
# File 'lib/xmlconv/i2/position.rb', line 16

def to_s
  output = "500:\#{@number}\n     EOS\n#        output << \"501:\#{@article_ean}\\n\"\n     [@customer_id, @pharmacode].compact.each { |id|\n       #output << sprintf(\"502:%s\\n\", id)\n       output << sprintf(\"501:%s\\n\", id)\n     }\n     output << sprintf(\"520:%s\\n\", @qty)\n     if(@unit)\n       output << sprintf(\"521:%s\\n\", @unit)\n     end\n  if(@delivery_date.is_a?(I2::Date))\n    output << @delivery_date.to_s\n  end\n     if(@price)\n       output << sprintf(\"604:%s\\n\", @price)\n     end\n     if(@free_text)\n       output << \"605:RS\\n\"\n       txt = @free_text[0,280] ## upper limit: 40 lines of 70 chars\n       while(!txt.empty?)\n         output << sprintf(\"606:%s\\n\", txt.slice!(0,70))\n       end\n     end\n  output\nend\n"