anchor.diff:  <%= link_to "edit", edit_admin_system_affiliate_path(@affiliate), class: "btn btn-sm btn-default pull-right" %>
   <h2><i class="fa fa-rocket"></i> <%= @affiliate.name %></h2>
  -<hr/>
  -
  +
  +
  +<% mods = Rails.configuration.modules %>
  +
  +<ul class="nav nav-tabs" role="tablist" style="margin-bottom: 12px;">
  +  <li role="presentation" class="<%= "active" if params[:q].blank? %>"><a href="<%= admin_system_affiliate_path(@affiliate)%>" role="tab">Summary</a></li>
  +  <% if mods.include? :marketing %>
  +    <% campaign_count = AffiliateCampaign.where(affiliate_id: @affiliate.id).count %>
  +    <li role="presentation" class="<%= "active" if params[:q] == "campaigns" %>">
  +      <a href="<%= admin_system_affiliate_path(@affiliate, q: "campaigns")%>" role="tab"><%= tab_count('Marketing Campaigns', campaign_count) %></a>
  +    </li>
  +  <% end %>
  +  <% if mods.include? :store %>
  +    <%
  +       ap_count = AffiliateProduct.where(affiliate_id: @affiliate.id).count 
  +       order_count = Order.where(affiliate_id: @affiliate.id).count
  +       po_count = PurchaseOrder.where(supplier_id: @affiliate.id).count
  +    %>
  +    <li role="presentation" class="<%= "active" if params[:q] == "products" %>"><a href="<%= admin_system_affiliate_path(@affiliate, q: "products")%>" role="tab"><%= tab_count('Products', ap_count) %></a></li>
  +    <li role="presentation" class="<%= "active" if params[:q] == "orders" %>"><a href="<%= admin_system_affiliate_path(@affiliate, q: "orders")%>" role="tab"><%= tab_count('Orders', order_count) %></a></li>
  +    <li role="presentation" class="<%= "active" if params[:q] == "po" %>"><a href="<%= admin_system_affiliate_path(@affiliate, q: "po")%>" role="tab"><%= tab_count("PO's", po_count) %></a></li>
  +  <% end %>
  +  <% if mods.include? :billing %>
  +    <li role="presentation" class="<%= "active" if params[:q] == "payments" %>"><a href="<%= admin_system_affiliate_path(@affiliate, q: "payments")%>" role="tab">Payments</a></li>
  +  <% end %>
  +</ul>
  +
  +
  +<% if params[:q].blank? %>
   <div class="arow">
   	
   	<div class="col-md-8">
  
positive.code:         <% for ap in ap_list %>
        	<tr>
            <td><input type="checkbox" name="affiliate_product_id[]" value="<%= ap.id %>"></td>
            <td><%= ap.product.sku %></td>
            <td><%= ap.product.title %></td>
            <td><%= ap.sku %></td>
            <td><%= ap.price %></td>
  
negative.code: 
      <% elsif params[:q] == "payments" %>
      
        <% payments = Payment.where(payable_type: "affiliate", payable_id: @affiliate.id).where("amount < 0.0").order(created_at: :desc).paginate(page: params[:page], per_page: 10) %>
  
        <%= will_paginate payments %>
        <table class="table table-striped table-condensed">
          <tr>
            <th>ID</th>
            <th>Date</th>
            <th>Memo</th>
            <th>Amount</th>
          </tr>
          <% payments.order('created_at DESC').each do |pmt| %>
          <tr>
            <td><%= pmt.id %></td>
            <td><%= systime pmt.created_at %></td>
            <td><%= pmt.memo%></td>
            <td><%= number_to_currency(pmt.amount, negative_format: "(%u%n)") %></td>
          </tr>
          <% end %>
        </table>
  
      <% elsif params[:q] == "campaigns" %>
          <% campaigns = AffiliateCampaign.where(affiliate_id: @affiliate.id).order(created_at: :desc)%>
  
      		<table class="table table-striped table-condensed">
  