     return false
 
   # when updating any field
-  $(document).on 'change', "*", ->
+  $(document).on 'change emulated:change keyup cocoon:after-remove', "*", ->
     calculate()
     return false
   return

  calculate = () ->
    # calculations
    # item calculation
    $("tr.budget_nested_fields").each ->
      $(this).find("[data-budget-item-value]").each (index) ->
        quantity = $(this).parent().find("input").val()
        unit_amount         = $(this).closest("tr.budget_nested_fields").find("input[type='number'][id$='unit_amount']").val()
        computation_method  = $(this).closest("tr.budget_nested_fields").find("select[id$='computation_method']").val()

          working_indicator_value = parseFloat($(working_indicator_value).text())
        $(this).text(quantity * unit_amount * working_indicator_value)
    #total per budget
    $("tr.budget_nested_fields").filter(':visible').each ->
      sum = 0.0
      $(this).find("[data-budget-item-value]").filter(':visible').each ->
        sum = sum + parseFloat($(this).text())
      $(this).find("[data-budget-global-amount]").text(sum)
    #global amount for revenues/expenses
    $("[data-budgets-global-amount]").filter(':visible').each ->
      sum = 0.0
      direction = $(this).attr('data-budgets-global-amount')
      $("[data-budget-global-amount=#{direction}]").filter(':visible').each ->
        sum = sum + parseFloat($(this).text())
      $(this).text(sum)
    # global balance
