<commit_before><p><img src='<%= @invoice.site.logo.url(:thumb) %>' /></p>

<!-- <h1>Thank you for your invoice!</h1> -->
<h1>New Order Received</h1>

<h4><a href="http://<%= @invoice.site.primary_domain.domain %>/admin/invoices/<%= @invoice.id %>" target="_blank" title="View Order">View Order</a></h4>

<h2>Order Details</h2>

<p>Order #<%= @invoice.invoice_number %></p>

<table binvoice='1' style='binvoice-collapse: collapse;'>
  <tr>
    <th>Package</th>
    <th>Line Item</th>
    <th>Unit Price</th>
    <th>Quantity</th>
    <th>Subtotal</th>
  </tr>
  <% @invoice.invoice_packages.each do |op| %>
    <% op.line_items.each_with_index do |li, i| %>
      <% v = li.variant %>
      <% p = v.product %>
      <tr>
        <% if i == 0 %>
          <td rowspan="<%= op.line_items.count %>">
            <div><%= op.shipping_method.service_name %></div>
            <div><%= op.status %></div>
            <% if op.tracking_number %><div><%= op.tracking_number %></div><% end %>
          </td>
        <% end %>
        <td>
          <p><%= p.title %></p>
          <% if li.is_gift %>
            <p>This item is a gift.</p>
            <ul>
              <li><% if li.gift_wrap %>Gift wrap (<%= number_to_currency(p.gift_wrap_price) %>)<% else %>Do not gift wrap<% end %></li>
              <li><% if li.include_gift_message %>Gift message: <%= li.gift_message %><% else %>No gift message<% end %></li>
              <li><% if li.hide_prices %>Hide all prices<% else %>Show all prices<% end %></li>
            </ul>
          <% end %>
        </td>
        <td align='right'><%= number_to_currency(li.unit_price) %></td>
        <td align='right'><%= li.quantity %></td>
        <td align='right'><%= number_to_currency(li.subtotal) %></td>
      </tr>
    <% end %>
  <% end %>  
  <% @invoice.line_items.each do |li| %>
    <% next if li.invoice_package_id %>
    <% v = li.variant %>
    <% p = v.product %>
    <tr>
      <td>
        <% if v.downloadable %>
          <p>This item is downloadable.</p>          
          <p><a href='<%= @invoice.site.store_config.authnet_relay_domain %>/my-account/invoices/<%= @invoice.id %>/line-items/<%= li.id %>/download' target="_blank">Download</a></li>        
        <% else %>
          Not assigned to a package
        <% end %>
      </td>      
      <td>
        <p><%= p.title %></td></p>
        <% if li.is_gift %>
          <p>This item is a gift.</p>
          <ul>
            <li><% if li.gift_wrap %>Gift wrap (<%= number_to_currency(p.gift_wrap_price) %>)<% else %>Do not gift wrap<% end %></li>
            <li><% if li.include_gift_message %>Gift message: <%= li.gift_message %><% else %>No gift message<% end %></li>
            <li><% if li.hide_prices %>Hide all prices<% else %>Show all prices<% end %></li>
          </ul>
        <% end %>
      </td>
      <td align='right'><%= number_to_currency(li.unit_price) %></td>
      <td align='right'><%= li.quantity %></td>
      <td align='right'><%= number_to_currency(li.subtotal) %></td>
    </tr>  
  <% end %>
  <tr><td colspan="4" align='right'>Subtotal:               </td><td align='right'><%= number_to_currency(@invoice.subtotal) %></td></tr>
  <tr><td colspan="4" align='right'>Tax:                    </td><td align='right'><%= number_to_currency(@invoice.tax)      %></td></tr>
  <tr><td colspan="4" align='right'>Shipping and Handling:  </td><td align='right'><%= number_to_currency(@invoice.shipping + @invoice.handling) %></td></tr>
  <% if @invoice.gift_wrap && @invoice.gift_wrap > 0 %>  
    <tr><td colspan="4" align='right'>Gift wrap:            </td><td align='right'><%= number_to_currency(@invoice.gift_wrap) %></td></tr>
  <% end %>
  <% if @invoice.discounts %>
    <% @invoice.discounts.each do |d| %>
      <tr><td colspan="4" align='right'>"<%= d.gift_card.code %>" gift card: </td><td align='right'><%= number_to_currency(d.amount) %></td></tr>
    <% end %>
  <% end %>
  <% if @invoice.custom_discount %>
    <tr><td colspan="4" align='right'>Discount: </td><td align='right'><%= number_to_currency(@invoice.custom_discount) %></td></tr>
  <% end %>      
  <tr><td colspan="4" align='right'>Total:     </td><td align='right'><%= number_to_currency(@invoice.total) %></td></tr>
</table>

<% if @invoice.shipping_address %>
  <% sa = @invoice.shipping_address %>
  <h2>Shipping Address</h2>
  <p>
    <%= sa.first_name %> <%= sa.last_name %><br />
    <%= sa.address1 %><br />
    <% if sa.address2 && sa.address2.strip.length > 0 %><%= sa.address2 %><br /><% end %>
    <%= sa.city %>, <%= sa.state %> <%= sa.zip %>
  </p>
<% end %>

<% if @invoice.billing_address %>
  <% ba = @invoice.billing_address %>
  <h2>Billing Address</h2>
  <p>
    <%= ba.first_name %> <%= ba.last_name %><br />
    <%= ba.address1 %><br />
    <% if ba.address2 && ba.address2.strip.length > 0 %><%= ba.address2 %><br /><% end %>
    <%= ba.city %>, <%= ba.state %> <%= ba.zip %>
  </p>
<% end %><commit_msg>More changes<commit_after><p><img src='<%= @invoice.site.logo.url(:thumb) %>' /></p>

<!-- <h1>Thank you for your invoice!</h1> -->
<h1>New Order Received</h1>
<p><a href="http://<%= @invoice.site.primary_domain.domain %>/admin/invoices/<%= @invoice.id %>" target="_blank" title="View Order">View Order</a></p>

<p>Order #<%= @invoice.invoice_number %></p>

<% if @invoice.customer %>
  <h2>Customer</h2>
  <p>
    <%= @customer.first_name %> <%= @customer.last_name %><br />
    <a href='mailto:<%= @customer.email %>'><%= @customer.email %></a><br />
    <% if @customer.phone %><%= raw @customer.phone %><% end %>
  </p>
<% end %>

<% if @invoice.shipping_address %>
  <% sa = @invoice.shipping_address %>
  <h2>Shipping Address</h2>
  <p>
    <%= sa.first_name %> <%= sa.last_name %><br />
    <%= sa.address1 %><br />
    <% if sa.address2 && sa.address2.strip.length > 0 %><%= sa.address2 %><br /><% end %>
    <%= sa.city %>, <%= sa.state %> <%= sa.zip %>
  </p>
<% end %>

<h2>Order Details</h2>
<table binvoice='1' style='binvoice-collapse: collapse;'>
  <tr>
    <th>Package</th>
    <th>Line Item</th>
    <th>Unit Price</th>
    <th>Quantity</th>
    <th>Subtotal</th>
  </tr>
  <% @invoice.invoice_packages.each do |op| %>
    <% op.line_items.each_with_index do |li, i| %>
      <% v = li.variant %>
      <% p = v.product %>
      <tr>
        <% if i == 0 %>
          <td rowspan="<%= op.line_items.count %>">
            <div><%= op.shipping_method.service_name %></div>
            <div><%= op.status %></div>
            <% if op.tracking_number %><div><%= op.tracking_number %></div><% end %>
          </td>
        <% end %>
        <td>
          <p><%= p.title %></p>
          <% if li.is_gift %>
            <p>This item is a gift.</p>
            <ul>
              <li><% if li.gift_wrap %>Gift wrap (<%= number_to_currency(p.gift_wrap_price) %>)<% else %>Do not gift wrap<% end %></li>
              <li><% if li.include_gift_message %>Gift message: <%= li.gift_message %><% else %>No gift message<% end %></li>
              <li><% if li.hide_prices %>Hide all prices<% else %>Show all prices<% end %></li>
            </ul>
          <% end %>
        </td>
        <td align='right'><%= number_to_currency(li.unit_price) %></td>
        <td align='right'><%= li.quantity %></td>
        <td align='right'><%= number_to_currency(li.subtotal) %></td>
      </tr>
    <% end %>
  <% end %>  
  <% @invoice.line_items.each do |li| %>
    <% next if li.invoice_package_id %>
    <% v = li.variant %>
    <% p = v.product %>
    <tr>
      <td>
        <% if v.downloadable %>
          <p>This item is downloadable.</p>          
          <p><a href='<%= @invoice.site.store_config.authnet_relay_domain %>/my-account/invoices/<%= @invoice.id %>/line-items/<%= li.id %>/download' target="_blank">Download</a></li>        
        <% else %>
          Not assigned to a package
        <% end %>
      </td>      
      <td>
        <p><%= p.title %></td></p>
        <% if li.is_gift %>
          <p>This item is a gift.</p>
          <ul>
            <li><% if li.gift_wrap %>Gift wrap (<%= number_to_currency(p.gift_wrap_price) %>)<% else %>Do not gift wrap<% end %></li>
            <li><% if li.include_gift_message %>Gift message: <%= li.gift_message %><% else %>No gift message<% end %></li>
            <li><% if li.hide_prices %>Hide all prices<% else %>Show all prices<% end %></li>
          </ul>
        <% end %>
      </td>
      <td align='right'><%= number_to_currency(li.unit_price) %></td>
      <td align='right'><%= li.quantity %></td>
      <td align='right'><%= number_to_currency(li.subtotal) %></td>
    </tr>  
  <% end %>
  <tr><td colspan="4" align='right'>Subtotal:               </td><td align='right'><%= number_to_currency(@invoice.subtotal) %></td></tr>
  <tr><td colspan="4" align='right'>Tax:                    </td><td align='right'><%= number_to_currency(@invoice.tax)      %></td></tr>
  <tr><td colspan="4" align='right'>Shipping and Handling:  </td><td align='right'><%= number_to_currency(@invoice.shipping + @invoice.handling) %></td></tr>
  <% if @invoice.gift_wrap && @invoice.gift_wrap > 0 %>  
    <tr><td colspan="4" align='right'>Gift wrap:            </td><td align='right'><%= number_to_currency(@invoice.gift_wrap) %></td></tr>
  <% end %>
  <% if @invoice.discounts %>
    <% @invoice.discounts.each do |d| %>
      <tr><td colspan="4" align='right'>"<%= d.gift_card.code %>" gift card: </td><td align='right'><%= number_to_currency(d.amount) %></td></tr>
    <% end %>
  <% end %>
  <% if @invoice.custom_discount %>
    <tr><td colspan="4" align='right'>Discount: </td><td align='right'><%= number_to_currency(@invoice.custom_discount) %></td></tr>
  <% end %>      
  <tr><td colspan="4" align='right'>Total:     </td><td align='right'><%= number_to_currency(@invoice.total) %></td></tr>
</table>
{'fraction_non_alphanumeric': 0.2340014243564961, 'fraction_numerical': 0.005799165734052294, 'mean_word_length': 2.6569940476190474, 'pattern_counts': {'":': 0, '<': 501, '<?xml version=': 0, '>': 506, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4441508', 'n_tokens_mistral': 3916, 'n_tokens_neox': 3566, 'n_words': 714}