Class: SAPOCI::Item
Instance Attribute Summary collapse
-
#attachment ⇒ Object
Returns the value of attribute attachment.
-
#attachment_purpose ⇒ Object
Returns the value of attribute attachment_purpose.
-
#attachment_title ⇒ Object
Returns the value of attribute attachment_title.
-
#contract ⇒ Object
Returns the value of attribute contract.
-
#contract_item ⇒ Object
Returns the value of attribute contract_item.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#cust_field1 ⇒ Object
Returns the value of attribute cust_field1.
-
#cust_field2 ⇒ Object
Returns the value of attribute cust_field2.
-
#cust_field3 ⇒ Object
Returns the value of attribute cust_field3.
-
#cust_field4 ⇒ Object
Returns the value of attribute cust_field4.
-
#cust_field5 ⇒ Object
Returns the value of attribute cust_field5.
-
#description ⇒ Object
Returns the value of attribute description.
-
#ext_category ⇒ Object
Returns the value of attribute ext_category.
-
#ext_category_id ⇒ Object
Returns the value of attribute ext_category_id.
-
#ext_product_id ⇒ Object
Returns the value of attribute ext_product_id.
-
#ext_quote_id ⇒ Object
Returns the value of attribute ext_quote_id.
-
#ext_quote_item ⇒ Object
Returns the value of attribute ext_quote_item.
-
#ext_schema_type ⇒ Object
Returns the value of attribute ext_schema_type.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#leadtime ⇒ Object
Returns the value of attribute leadtime.
-
#longtext ⇒ Object
Returns the value of attribute longtext.
-
#manufactcode ⇒ Object
Returns the value of attribute manufactcode.
-
#manufactmat ⇒ Object
Returns the value of attribute manufactmat.
-
#matgroup ⇒ Object
Returns the value of attribute matgroup.
-
#matnr ⇒ Object
Returns the value of attribute matnr.
-
#price ⇒ Object
Returns the value of attribute price.
-
#priceunit ⇒ Object
Returns the value of attribute priceunit.
-
#quantity ⇒ Object
Returns the value of attribute quantity.
-
#service ⇒ Object
Returns the value of attribute service.
-
#sld_sys_name ⇒ Object
Returns the value of attribute sld_sys_name.
-
#unit ⇒ Object
Returns the value of attribute unit.
-
#vendor ⇒ Object
Returns the value of attribute vendor.
-
#vendormat ⇒ Object
Returns the value of attribute vendormat.
Instance Method Summary collapse
-
#initialize(index) ⇒ Item
constructor
Initializes the item.
- #leadtime_before_type_cast ⇒ Object
- #price_before_type_cast ⇒ Object
- #priceunit_before_type_cast ⇒ Object
- #quantity_before_type_cast ⇒ Object
- #service? ⇒ Boolean
-
#to_html(options = {}) ⇒ Object
Returns the item properties as HTML hidden field tags.
Constructor Details
#initialize(index) ⇒ Item
Initializes the item.
46 47 48 |
# File 'lib/sapoci/item.rb', line 46 def initialize(index) @index = index end |
Instance Attribute Details
#attachment ⇒ Object
Returns the value of attribute attachment.
32 33 34 |
# File 'lib/sapoci/item.rb', line 32 def @attachment end |
#attachment_purpose ⇒ Object
Returns the value of attribute attachment_purpose.
34 35 36 |
# File 'lib/sapoci/item.rb', line 34 def @attachment_purpose end |
#attachment_title ⇒ Object
Returns the value of attribute attachment_title.
33 34 35 |
# File 'lib/sapoci/item.rb', line 33 def @attachment_title end |
#contract ⇒ Object
Returns the value of attribute contract.
27 28 29 |
# File 'lib/sapoci/item.rb', line 27 def contract @contract end |
#contract_item ⇒ Object
Returns the value of attribute contract_item.
28 29 30 |
# File 'lib/sapoci/item.rb', line 28 def contract_item @contract_item end |
#currency ⇒ Object
Returns the value of attribute currency.
17 18 19 |
# File 'lib/sapoci/item.rb', line 17 def currency @currency end |
#cust_field1 ⇒ Object
Returns the value of attribute cust_field1.
39 40 41 |
# File 'lib/sapoci/item.rb', line 39 def cust_field1 @cust_field1 end |
#cust_field2 ⇒ Object
Returns the value of attribute cust_field2.
40 41 42 |
# File 'lib/sapoci/item.rb', line 40 def cust_field2 @cust_field2 end |
#cust_field3 ⇒ Object
Returns the value of attribute cust_field3.
41 42 43 |
# File 'lib/sapoci/item.rb', line 41 def cust_field3 @cust_field3 end |
#cust_field4 ⇒ Object
Returns the value of attribute cust_field4.
42 43 44 |
# File 'lib/sapoci/item.rb', line 42 def cust_field4 @cust_field4 end |
#cust_field5 ⇒ Object
Returns the value of attribute cust_field5.
43 44 45 |
# File 'lib/sapoci/item.rb', line 43 def cust_field5 @cust_field5 end |
#description ⇒ Object
Returns the value of attribute description.
12 13 14 |
# File 'lib/sapoci/item.rb', line 12 def description @description end |
#ext_category ⇒ Object
Returns the value of attribute ext_category.
37 38 39 |
# File 'lib/sapoci/item.rb', line 37 def ext_category @ext_category end |
#ext_category_id ⇒ Object
Returns the value of attribute ext_category_id.
36 37 38 |
# File 'lib/sapoci/item.rb', line 36 def ext_category_id @ext_category_id end |
#ext_product_id ⇒ Object
Returns the value of attribute ext_product_id.
31 32 33 |
# File 'lib/sapoci/item.rb', line 31 def ext_product_id @ext_product_id end |
#ext_quote_id ⇒ Object
Returns the value of attribute ext_quote_id.
29 30 31 |
# File 'lib/sapoci/item.rb', line 29 def ext_quote_id @ext_quote_id end |
#ext_quote_item ⇒ Object
Returns the value of attribute ext_quote_item.
30 31 32 |
# File 'lib/sapoci/item.rb', line 30 def ext_quote_item @ext_quote_item end |
#ext_schema_type ⇒ Object
Returns the value of attribute ext_schema_type.
35 36 37 |
# File 'lib/sapoci/item.rb', line 35 def ext_schema_type @ext_schema_type end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
11 12 13 |
# File 'lib/sapoci/item.rb', line 11 def index @index end |
#leadtime ⇒ Object
Returns the value of attribute leadtime.
19 20 21 |
# File 'lib/sapoci/item.rb', line 19 def leadtime @leadtime end |
#longtext ⇒ Object
Returns the value of attribute longtext.
20 21 22 |
# File 'lib/sapoci/item.rb', line 20 def longtext @longtext end |
#manufactcode ⇒ Object
Returns the value of attribute manufactcode.
23 24 25 |
# File 'lib/sapoci/item.rb', line 23 def manufactcode @manufactcode end |
#manufactmat ⇒ Object
Returns the value of attribute manufactmat.
24 25 26 |
# File 'lib/sapoci/item.rb', line 24 def manufactmat @manufactmat end |
#matgroup ⇒ Object
Returns the value of attribute matgroup.
25 26 27 |
# File 'lib/sapoci/item.rb', line 25 def matgroup @matgroup end |
#matnr ⇒ Object
Returns the value of attribute matnr.
13 14 15 |
# File 'lib/sapoci/item.rb', line 13 def matnr @matnr end |
#price ⇒ Object
Returns the value of attribute price.
16 17 18 |
# File 'lib/sapoci/item.rb', line 16 def price @price end |
#priceunit ⇒ Object
Returns the value of attribute priceunit.
18 19 20 |
# File 'lib/sapoci/item.rb', line 18 def priceunit @priceunit end |
#quantity ⇒ Object
Returns the value of attribute quantity.
14 15 16 |
# File 'lib/sapoci/item.rb', line 14 def quantity @quantity end |
#service ⇒ Object
Returns the value of attribute service.
26 27 28 |
# File 'lib/sapoci/item.rb', line 26 def service @service end |
#sld_sys_name ⇒ Object
Returns the value of attribute sld_sys_name.
38 39 40 |
# File 'lib/sapoci/item.rb', line 38 def sld_sys_name @sld_sys_name end |
#unit ⇒ Object
Returns the value of attribute unit.
15 16 17 |
# File 'lib/sapoci/item.rb', line 15 def unit @unit end |
#vendor ⇒ Object
Returns the value of attribute vendor.
21 22 23 |
# File 'lib/sapoci/item.rb', line 21 def vendor @vendor end |
#vendormat ⇒ Object
Returns the value of attribute vendormat.
22 23 24 |
# File 'lib/sapoci/item.rb', line 22 def vendormat @vendormat end |
Instance Method Details
#leadtime_before_type_cast ⇒ Object
78 79 80 |
# File 'lib/sapoci/item.rb', line 78 def leadtime_before_type_cast @leadtime end |
#price_before_type_cast ⇒ Object
62 63 64 |
# File 'lib/sapoci/item.rb', line 62 def price_before_type_cast @price end |
#priceunit_before_type_cast ⇒ Object
70 71 72 |
# File 'lib/sapoci/item.rb', line 70 def priceunit_before_type_cast @priceunit end |
#quantity_before_type_cast ⇒ Object
54 55 56 |
# File 'lib/sapoci/item.rb', line 54 def quantity_before_type_cast @quantity end |
#service? ⇒ Boolean
82 83 84 |
# File 'lib/sapoci/item.rb', line 82 def service? self.service == "X" end |
#to_html(options = {}) ⇒ Object
Returns the item properties as HTML hidden field tags.
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 |
# File 'lib/sapoci/item.rb', line 87 def to_html( = {}) html = [] html << hidden_field_tag("DESCRIPTION", self.description) unless self.description.blank? html << hidden_field_tag("MATNR", self.matnr) unless self.matnr.blank? html << hidden_field_tag("QUANTITY", "%015.3f" % self.quantity) html << hidden_field_tag("UNIT", self.unit) unless self.unit.blank? html << hidden_field_tag("PRICE", "%015.3f" % self.price) html << hidden_field_tag("CURRENCY", self.currency) unless self.currency.blank? html << hidden_field_tag("PRICEUNIT", self.priceunit.to_i) if self.priceunit.to_i > 0 html << hidden_field_tag("LEADTIME", "%05d" % self.leadtime) if self.leadtime.to_i > 0 html << hidden_field_tag("VENDOR", self.vendor) unless self.vendor.blank? html << hidden_field_tag("VENDORMAT", self.vendormat) unless self.vendormat.blank? html << hidden_field_tag("MANUFACTCODE", self.manufactcode) unless self.manufactcode.blank? html << hidden_field_tag("MANUFACTMAT", self.manufactmat) unless self.manufactmat.blank? html << hidden_field_tag("MATGROUP", self.matgroup) unless self.matgroup.blank? html << hidden_field_tag("SERVICE", "X") if self.service? html << hidden_field_tag("CONTRACT", self.contract) unless self.contract.blank? html << hidden_field_tag("CONTRACT_ITEM", self.contract_item) unless self.contract_item.blank? html << hidden_field_tag("EXT_QUOTE_ID", self.ext_quote_id) unless self.ext_quote_id.blank? html << hidden_field_tag("EXT_QUOTE_ITEM", self.ext_quote_item) unless self.ext_quote_item.blank? html << hidden_field_tag("EXT_PRODUCT_ID", self.ext_product_id) unless self.ext_product_id.blank? html << hidden_field_tag("ATTACHMENT", self.) unless self..blank? html << hidden_field_tag("ATTACHMENT_TITLE", self.) unless self..blank? html << hidden_field_tag("ATTACHMENT_PURPOSE", self.) unless self..blank? html << hidden_field_tag("EXT_SCHEMA_TYPE", self.ext_schema_type) unless self.ext_schema_type.blank? html << hidden_field_tag("EXT_CATEGORY_ID", self.ext_category_id) unless self.ext_category_id.blank? html << hidden_field_tag("EXT_CATEGORY", self.ext_category) unless self.ext_category.blank? html << hidden_field_tag("SLD_SYS_NAME", self.sld_sys_name) unless self.sld_sys_name.blank? html << hidden_field_tag("CUST_FIELD1", self.cust_field1) unless self.cust_field1.blank? html << hidden_field_tag("CUST_FIELD2", self.cust_field2) unless self.cust_field2.blank? html << hidden_field_tag("CUST_FIELD3", self.cust_field3) unless self.cust_field3.blank? html << hidden_field_tag("CUST_FIELD4", self.cust_field4) unless self.cust_field4.blank? html << hidden_field_tag("CUST_FIELD5", self.cust_field5) unless self.cust_field5.blank? html << "<input type=\"hidden\" name=\"NEW_ITEM-LONGTEXT_#{index + 1}:132[]\" value=\"#{escape_html(self.longtext)}\" />" unless self.longtext.blank? html.join end |