    <!-- BEGIN CONTAINER -->
    <div class="page-container">
      <!-- BEGIN CONTENT -->
      <div class="page-content-wrapper">
        <!-- BEGIN CONTENT BODY -->
        <!-- BEGIN PAGE HEAD-->
        <div class="page-head">
          <div class="container-fluid">
            <!-- BEGIN PAGE TITLE -->
            <div class="page-title">
              <h1>Comisión</h1>
            </div>
            <!-- END PAGE TITLE -->
          </div>
        </div>
        <!-- END PAGE HEAD-->
        <!-- BEGIN PAGE CONTENT BODY -->
        <div class="page-content">
          <div class="container-fluid">
            <div class="pull-right margin-bottom-10 ">
              <%= link_to  commissions_path(:filter => @filter, :current_page => @current_page), {:class=>"fr-space btn blue-hoki "} do %>
                <i class="fa fa-angle-left "></i>
                Regresar
              <% end %>
            </div>
            <!-- BEGIN PAGE BREADCRUMBS -->
            <ul class="page-breadcrumb breadcrumb">
              <%= render_breadcrumbs :tag => :li, :separator => ' <i class="fa fa-circle"></i> ' %>
            </ul>
            <!-- END PAGE BREADCRUMBS -->
            <!-- BEGIN PAGE CONTENT INNER -->
            <div class="page-content-inner">
              <div id="notice">
              <% if success %>
                <div class="alert alert-success">
                  <p><%= success %></p>
                </div>
              <% elsif warning %>
                <div class="alert alert-warning">
                  <p><%= warning %></p>
                </div>
              <% end %>
              </div>
              <div class="row">
                <div class="col-md-12">
                  <div class="portlet light ">
                    <div class="portlet-title">
                      <div class="caption">
                        <i class="fa fa-list "></i>
                        <span class="caption-subject bold uppercase">Detalles de comisión</span>
                      </div>
                    </div>
                    <div class="portlet-body">


                      <div class="row">
                        <div class="col-md-2 col-sm-3 col-xs-3">
                          <ul class="nav nav-tabs tabs-left">
                            <li class="active">
                                <a href="#detail" data-toggle="tab"> Detalle </a>
                            </li>
                            <li>
                                <a href="#enviados" data-toggle="tab"> Ventas </a>
                            </li>
                          </ul>
                        </div>
                        <div class="col-md-10 col-sm-9 col-xs-9">
                           <div class="tab-content">
                              <div class="tab-pane active" id="detail">
                                <div class="row">
                                  <div class="col-md-12">
                                    <table class="table table-striped table-bordered table-hover tableadvanced">
                                      <thead>
                                        <tr>
                                          <th>Vendedor</th>
                                          <th>Ventas en <br>el periodo</th>
                                          <th>Total <br>contado</th>
                                          <th>Total créditos y <br>apartados</th>
                                          <th>Total <br>vendido</th>
                                          <th>$ ingresado<br>contado</th>
                                          <th>$ ingresado<br>créditos <br>y apartados</th>
                                          <th>Total <br>ingresado</th>
                                          <th>Comisión <br>pagada</th>
                                        </tr>
                                      </thead>
                                      <tbody>
                                      <% @commission.sellerscommissions.each_with_index do |seller_commission| %>
                                          <tr>
                                            <td><%= seller_commission.seller.name %></td>
                                            <td><%= seller_commission.num_sales.round %></td>
                                            <td><%= number_to_currency(seller_commission.total_sold_cash, precision: 2) %></td>
                                            <td><%= number_to_currency(seller_commission.total_sold_credits_apartments, precision: 2) %></td>
                                            <td><%= number_to_currency(seller_commission.sales_total, precision: 2)  %></td>
                                            <td><%= number_to_currency(seller_commission.income_by_cash, precision: 2) %></td>
                                            <td><%= number_to_currency(seller_commission.income_by_reserved_and_credits, precision: 2) %></td>
                                            <td><%= number_to_currency(seller_commission.income_by_cash + seller_commission.income_by_reserved_and_credits, precision: 2) %></td>
                                            <td><%= number_to_currency(seller_commission.commission_paid, precision: 2) %></td>
                                          </tr>
                                      <% end %>
                                      </tbody>
                                    </table>
                                  </div>
                                </div>
                              </div>
                              <div class="tab-pane fade" id="enviados">
                                <div class="row">
                                  <div class="col-md-12">
                                    <table class="table table-striped table-bordered table-hover tableadvanced">
                                      <thead>
                                        <tr>
                                          <th>#</th>
                                          <th>Folio</th>
                                          <th>Fecha</th>
                                          <th>Total</th>
                                          <th>Tipo de venta</th>
                                          <th>Vendedor</th>
                                        </tr>
                                      </thead>
                                      <tbody>
                                      <% @sales.each_with_index do |sale, key| %>
                                          <tr>
                                            <td> <%= key + 1 %> </td>
                                            <td> <%= sale.sale_code %> </td>
                                            <td> <%= l(sale.date_sale, :format => '%d/%m/%Y') %> </td>
                                            <td>
                                              <%= number_to_currency(sale.total, precision: 2) %>
                                            </td>
                                            <td>
                                              <% if sale.saletype == "credit" && sale.credit_note.blank? %>
                                              Crédito
                                              <% elsif sale.saletype == "credit" && sale.credit_note.present? %>
                                              Crédito/vale
                                              <% elsif sale.saletype == "cash"%>
                                              Contado
                                              <% elsif sale.saletype == "reserved"%>
                                              Apartado
                                              <% end %>
                                            </td>
                                            <td> <%= sale.seller.name %> </td>
                                          </tr>
                                      <% end %>
                                      </tbody>
                                    </table>
                                  </div>
                                </div>
                              </div>
                           </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <!-- END PAGE CONTENT INNER -->
          </div>
        </div>
        <!-- END PAGE CONTENT BODY -->
        <!-- END CONTENT BODY -->
      </div>
      <!-- END CONTENT -->
    </div>
    <!-- END CONTAINER -->
