Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoices table changes #2

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import "bootstrap-sprockets";
@import "bootstrap";
@import "bootstrap-datepicker3";

@import "colors";
@import "scaffolds";
1 change: 1 addition & 0 deletions app/assets/stylesheets/colors.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$teal: #4ebdd7;
5 changes: 2 additions & 3 deletions app/assets/stylesheets/scaffolds.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ pre {
}

a {
color: #000;
color: $teal;

&:hover {
color: #fff;
background-color: #000;
text-decoration: underline;
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/invoices_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def update
def destroy
@invoice.destroy
respond_to do |format|
format.html { redirect_to invoices_url, notice: 'Factura eliminada' }
format.html { redirect_to [@namespace, :invoices], notice: 'Factura eliminada' }
format.json { head :no_content }
end
end
Expand Down
2 changes: 2 additions & 0 deletions app/models/invoice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ class Invoice < ActiveRecord::Base
monetize :exempt_cents
monetize :perception_cents

default_scope { order(date: 'DESC') }

def operator_namespace
operator.class.to_s.pluralize.downcase
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/invoices/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
</div>

<div class="form-actions">
<%= f.button :submit %>
<%= f.button :submit, 'Aceptar', class: 'btn btn-primary' %>
</div>
<% end %>
36 changes: 12 additions & 24 deletions app/views/invoices/_invoices.html.erb
Original file line number Diff line number Diff line change
@@ -1,46 +1,34 @@
<table class='table'>
<table class='table table-bordered'>
<thead>
<tr>
<th>Fecha</th>
<th>Operador</th>
<th>CUIT</th>
<th>Factura</th>
<th>Pto_d_Vta</th>
<th>Nro</th>
<th>Gravado 21%</th>
<th>IVA 21%</th>
<th>Gravado 10,5%</th>
<th>IVA 10,5%</th>
<th>No gravado</th>
<th>Exento</th>
<th>Percepcion AFIP</th>
<th>5% AFIP</th>
<th>Total</th>
<th colspan="3"></th>
</tr>
</thead>

<tbody>
<% @invoices.each do |invoice| %>
<tr>
<td><%= localize invoice.date, :format => '%d/%m/%Y' %></td>
<td><%= invoice.operator.name %></td>
<td><%= invoice.operator.cuit %></td>
<td><%= invoice.invoice_type %></td>
<td><%= invoice.sales_point %></td>
<td><%= invoice.number %></td>
<td><%= invoice.taxed_21 %></td>
<td><%= number_to_currency invoice.tax_21, unit: '' %></td>
<td><%= invoice.taxed_105 %></td>
<td><%= number_to_currency invoice.tax_105, unit: '' %></td>
<td><%= invoice.not_taxed %></td>
<td><%= invoice.exempt %></td>
<td><%= invoice.perception %></td>
<td><%= number_to_currency invoice.total, unit: '' %></td>
<td><%= link_to 'Detalles', [invoice.operator_namespace, invoice] %></td>
<td><%= link_to 'Editar',
[:edit, invoice.operator_namespace, invoice] %></td>
<td><%= link_to 'Borrar', [invoice.operator_namespace, invoice],
method: :delete, data: { confirm: '¿Seguro de borrar?' } %></td>
<td><%= invoice.operator.name.truncate 30 %></td>
<td><%= link_to invoice.full_number, invoice_path(invoice)%></td>
<td class="text-right"><%= invoice.taxed_21 %></td>
<td class="text-right"><%= number_to_currency invoice.tax_21, unit: '' %></td>
<td class="text-right"><%= invoice.taxed_105 %></td>
<td class="text-right"><%= number_to_currency invoice.tax_105, unit: '' %></td>
<td class="text-right"><%= invoice.not_taxed %></td>
<td class="text-right"><%= invoice.exempt %></td>
<td class="text-right"><%= invoice.perception %></td>
<td class="text-right"><%= number_to_currency invoice.total %></td>
</tr>
<% end %>
</tbody>
Expand Down
3 changes: 1 addition & 2 deletions app/views/invoices/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

<%= render partial: 'form', locals: { operators: @operators } %>

<%= link_to 'Detalles', [@invoice.operator_namespace, @invoice] %> |
<%= link_to 'Volver', [@invoice.operator_namespace, :invoices] %>
<%= link_to 'Cancelar', [@invoice.operator_namespace, :invoices], class: 'btn btn-default' %>
69 changes: 30 additions & 39 deletions app/views/invoices/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,41 +1,32 @@
<p id="notice"><%= notice %></p>

<p>
<strong>Fecha:</strong>
<%= @invoice.date.strftime('%d/%m/%Y')%>
</p>

<p>
<strong>Operador:</strong>
<%= @invoice.operator %>
</p>

<p>
<strong>Factura:</strong>
<%= @invoice.invoice_type %>
<%= @invoice.sales_point %>
<%= @invoice.number %>
</p>

<p>
<strong>Gravado IVA 21%</strong>
<%= @invoice.taxed_21 %>
</p>

<p>
<strong>Gravado IVA 10,5:</strong>
<%= @invoice.taxed_105 %>
</p>

<p>
<strong>No Gravado:</strong>
<%= @invoice.not_taxed %>
</p>

<p>
<strong>Exento:</strong>
<%= @invoice.exempt %>
</p>

<%= link_to 'Editar', [:edit, @invoice.operator_namespace, @invoice] %> |
<%= link_to 'Volver', [@invoice.operator_namespace, :invoices] %>
<dl class='dl-horizontal'>
<dt>Factura:</dt>
<dd><%= @invoice.full_number %></dd>
<dt>Fecha:</dt>
<dd><%= @invoice.date.strftime('%d/%m/%Y')%></dd>
<dt>Operador:</dt>
<dd><%= @invoice.operator %></dd>
<dt>CUIT:</dt>
<dd><%= @invoice.operator.cuit %></dd>
<dt>Gravado IVA 21%</dt>
<dd><%= @invoice.taxed_21 %></dd>
<dt>IVA 21%</dt>
<dd><%= @invoice.tax_21 %></dd>
<dt>Gravado IVA 10,5:</dt>
<dd><%= @invoice.tax_105 %></dd>
<dt>IVA 10,5:</dt>
<dd><%= @invoice.taxed_105 %></dd>
<dt>No Gravado:</dt>
<dd><%= @invoice.not_taxed %></dd>
<dt>Exento:</dt>
<dd><%= @invoice.exempt %></dd>
<dt>Percepcion AFIP:</dt>
<dd><%= @invoice.perception %></dd>
<dt>Total:</dt>
<dd><%= @invoice.total %></dd>
</dl>

<%= link_to 'Editar', [:edit, @invoice.operator_namespace, @invoice], class: 'btn btn-default' %>
<%= link_to 'Borrar', [@invoice.operator_namespace, @invoice], method: :delete,
data: { confirm: 'Desea eliminar la factura?' }, class: 'btn btn-danger' %>
2 changes: 1 addition & 1 deletion app/views/movements/_movements.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<table class="table">
<table class="table table-bordered">
<thead>
<tr>
<th>Monto</th>
Expand Down
2 changes: 1 addition & 1 deletion app/views/operators/_operators.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<table class="table">
<table class="table table-bordered">
<thead>
<tr>
<th>Nombre</th>
Expand Down
2 changes: 1 addition & 1 deletion app/views/passengers/_passengers.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<table class="table">
<table class="table table-bordered">
<thead>
<tr>
<th>Name</th>
Expand Down
2 changes: 1 addition & 1 deletion app/views/reservas/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</div><!-- /.row -->


<table class="table">
<table class="table table-bordered">
<thead>
<tr>
<th>Salida</th>
Expand Down