anchor.diff:      <% if @return_authorization.received? %>
         <%= money @return_authorization.amount %>
       <% else %>
  -      <%= f.text_field :amount, {:style => 'width:80px;'} %> <%= t(:rma_value) %>: <span id="rma_value"></span>
  +      <%= f.text_field :amount, {:style => 'width:80px;'} %> <%= t(:rma_value) %>: <span id="rma_value">0.00</span>
         <%= f.error_message_on :amount %>
       <% end %>
     <% end %>
  
positive.code:             <% elsif units.select(&:shipped?).empty? %>
                0
              <% else %>
                <%= text_field_tag "return_quantity[#{variant.id}]",
                    @return_authorization.inventory_units.group_by(&:variant)[variant].try(:size) || 0, {:style => 'width:30px;'} %>
              <% end %>
            </td>
          </tr>
  
negative.code:     variant_prices[<%= variant.id.to_s %>] = <%= variant.price %>;
    <% end %>
  
    $(document).ready(function(){
      var rma_amount = 0;
      $("td.return_quantity input").on('change', function() {
        var rma_amount = 0;
        $.each($("td.return_quantity input"), function(i, input) {
          var variant_id = $(input).attr('id').replace("return_quantity_", "");
           rma_amount += variant_prices[variant_id] * $(input).val()
        });
  
        if(!isNaN(rma_amount)){
          $("span#rma_value").html(rma_amount.toFixed(2));
        }
      })
    });
  </script>
  