api.wk_expense do
  api.id @user.id
  api.name @user.name
  api.startday @startday
  api.status statusString(@wktime.status) unless @wktime.nil?
  api.total @wktime.amount unless @wktime.nil?
  if !@wktime.nil? && !@wktime.notes.blank? && @wktime.status == 'r'
	api.notes @wktime.notes
  end
  api.array :wk_expense_entries do
	  @entries.each do |wk_expense_entry|
		api.wk_expense_entry do
		  api.id wk_expense_entry.id
		  api.project(:id => wk_expense_entry.project_id, :name => wk_expense_entry.project.name) unless wk_expense_entry.project.nil?
		  api.issue(:id => wk_expense_entry.issue_id, :name => wk_expense_entry.issue.subject) unless wk_expense_entry.issue.nil?
		  api.user(:id => wk_expense_entry.user_id, :name => wk_expense_entry.user.name) unless wk_expense_entry.user.nil?
		  api.activity(:id => wk_expense_entry.activity_id, :name => wk_expense_entry.activity.name) unless wk_expense_entry.activity.nil?
		  api.amount wk_expense_entry.amount
		  api.currency wk_expense_entry.currency
		  api.comments wk_expense_entry.comments
		  api.spent_on wk_expense_entry.spent_on
      if wk_expense_entry.spent_for.present?
        api.spentFor(id: wk_expense_entry.spent_for.id, s_longitude: wk_expense_entry.spent_for.s_longitude, s_latitude: wk_expense_entry.spent_for.s_latitude, e_longitude: wk_expense_entry.spent_for.e_longitude, e_latitude: wk_expense_entry.spent_for.e_latitude, spent_on_time: wk_expense_entry.spent_for.spent_on_time, spent_for_type: wk_expense_entry.spent_for.spent_for_type, spent_for_id: wk_expense_entry.spent_for.spent_for_id, invoice_item_id: wk_expense_entry.spent_for.invoice_item_id)
      end
		end
	  end
  end
end
api.headers do
  api.currency options_for_currency
	api.default_currency number_currency_format_unit
end
