<tr class="<%= purchase.cancelled? ? 'danger' : '' %>">
  <td><%= purchase.purchase_date %></td>
  <td><%= purchase.purchase_code %></td>
  <td><%= purchase.pointsale_id.present? ? purchase.pointsale.name : "" %></td>
  <td><%= purchase.warehouse_id.present? ? purchase.warehouse.name : "" %></td>
  <td><%= purchase.supplier.nick_name %></td>
  <td class="hidden"></td>
  <td><%= purchase.purchase_details.sum(:quantity).to_i %></td>
  <td><%= purchase_status(purchase) %></td>
  <td><%= number_to_currency(purchase.amount.round(2), precision: 2) %></td>
  <td><%= number_to_currency(purchase.tax.round(2), precision: 2) %></td>
  <td><% total = number_to_currency(purchase.total.round(2), precision: 2) %><%= purchase.exchange.present? ? total.to_s + " USD" : total.to_s + " MXN" %></td>
</tr>
