Class: Declaration232::Line

Inherits:
Data
  • Object
show all
Defined in:
app/services/declaration232.rb

Overview

One declaration line = one commercial-invoice line.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cooObject (readonly)

Returns the value of attribute coo

Returns:

  • (Object)

    the current value of coo



38
39
40
# File 'app/services/declaration232.rb', line 38

def coo
  @coo
end

#descriptionObject (readonly)

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



38
39
40
# File 'app/services/declaration232.rb', line 38

def description
  @description
end

#htsObject (readonly)

Returns the value of attribute hts

Returns:

  • (Object)

    the current value of hts



38
39
40
# File 'app/services/declaration232.rb', line 38

def hts
  @hts
end

#lnObject (readonly)

Returns the value of attribute ln

Returns:

  • (Object)

    the current value of ln



38
39
40
# File 'app/services/declaration232.rb', line 38

def ln
  @ln
end

#steel_melt_pourObject (readonly)

Returns the value of attribute steel_melt_pour

Returns:

  • (Object)

    the current value of steel_melt_pour



38
39
40
# File 'app/services/declaration232.rb', line 38

def steel_melt_pour
  @steel_melt_pour
end

#steel_valueObject (readonly)

Returns the value of attribute steel_value

Returns:

  • (Object)

    the current value of steel_value



38
39
40
# File 'app/services/declaration232.rb', line 38

def steel_value
  @steel_value
end

#steel_weight_kgObject (readonly)

Returns the value of attribute steel_weight_kg

Returns:

  • (Object)

    the current value of steel_weight_kg



38
39
40
# File 'app/services/declaration232.rb', line 38

def steel_weight_kg
  @steel_weight_kg
end

#valueObject (readonly)

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



38
39
40
# File 'app/services/declaration232.rb', line 38

def value
  @value
end

#weight_kgObject (readonly)

Returns the value of attribute weight_kg

Returns:

  • (Object)

    the current value of weight_kg



38
39
40
# File 'app/services/declaration232.rb', line 38

def weight_kg
  @weight_kg
end

Instance Method Details

#rowsObject

The template mandates a NON-STEEL/STEEL row pair per line, with the
steel share broken out of the entered value and metal weight.



42
43
44
45
46
47
48
49
# File 'app/services/declaration232.rb', line 42

def rows
  [
    { ln:, category: 'NON-STEEL CONTENT', description:, hts:, coo:,
      value: [(value - steel_value).round(2), 0].max, weight_kg: [(weight_kg - steel_weight_kg).round(2), 0].max, melt_pour: nil },
    { ln:, category: 'STEEL CONTENT', description:, hts:, coo:,
      value: steel_value, weight_kg: steel_weight_kg, melt_pour: steel_melt_pour }
  ]
end