Skip to content

Commit

Permalink
ganing code space from amount and using smaller font when code too long
Browse files Browse the repository at this point in the history
  • Loading branch information
nan-apps committed Mar 3, 2019
1 parent 2979175 commit 84e38ff
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 30 deletions.
Binary file modified lib/afip_bill/assets/images/factura_a.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/afip_bill/assets/images/factura_b.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified lib/afip_bill/assets/images/factura_c.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions lib/afip_bill/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ class Generator
FOOTER_PATH = File.dirname(__FILE__) + '/views/shared/_factura_footer.html.erb'.freeze
BRAVO_CBTE_TIPO = {
'01' => { directory: 'bills', template: 'factura_a', doc_name: 'factura', doc_type: 'a' },
'02' => { directory: 'notes', template: 'nota_a', doc_name: 'Nota de débito', doc_type: 'a' },
'03' => { directory: 'notes', template: 'nota_a', doc_name: 'Nota de crédito', doc_type: 'a' },
'02' => { directory: 'bills', template: 'factura_a', doc_name: 'Nota de débito', doc_type: 'a' },
'03' => { directory: 'bills', template: 'factura_a', doc_name: 'Nota de crédito', doc_type: 'a' },
'06' => { directory: 'bills', template: 'factura_b', doc_name: 'factura', doc_type: 'b' },
'07' => { directory: 'notes', template: 'nota_b', doc_name: 'Nota de débito', doc_type: 'b' },
'08' => { directory: 'notes', template: 'nota_b', doc_name: 'Nota de crédito', doc_type: 'b' },
'07' => { directory: 'bills', template: 'factura_b', doc_name: 'Nota de débito', doc_type: 'b' },
'08' => { directory: 'bills', template: 'factura_b', doc_name: 'Nota de crédito', doc_type: 'b' },
'11' => { directory: 'bills', template: 'factura_b', doc_name: 'factura', doc_type: 'c' },
'12' => { directory: 'notes', template: 'nota_b', doc_name: 'Nota de débito', doc_type: 'c' },
'13' => { directory: 'notes', template: 'nota_b', doc_name: 'Nota de crédito', doc_type: 'c' }
'12' => { directory: 'bills', template: 'factura_b', doc_name: 'Nota de débito', doc_type: 'c' },
'13' => { directory: 'bills', template: 'factura_b', doc_name: 'Nota de crédito', doc_type: 'c' }
}.freeze

This comment has been minimized.

Copy link
@nan-apps

nan-apps Mar 3, 2019

Author Collaborator

cuando agregue las notas, cree nuevos templates para ellas, pero me doy cuenta que no hay diferencia entre los templates de las notas y las facturas. No vale la pena seguir manteniendo tantos templates, asi que pase a usar los de las facturas para notas tmb. En un proximo commit los borro, quedan temporalmente por las dudas.

IVA = 21.freeze
DEFAULTS = {
Expand Down
28 changes: 14 additions & 14 deletions lib/afip_bill/views/bills/factura_a.html.erb
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<%= @template_header %>

<div style="left:484.19px;top:259.63px" class="cls_011"><span class="cls_011">Alicuota</span></div>
<div style="left:19.00px;top:263.04px" class="cls_010"><span class="cls_010">Código</span></div>
<div style="left:59.00px;top:263.04px" class="cls_010"><span class="cls_010">Producto / Servicio</span></div>
<div style="left:325.77px;top:263.04px" class="cls_010"><span class="cls_010">Cant.</span></div>
<div style="left:80.00px;top:263.04px" class="cls_010"><span class="cls_010">Producto / Servicio</span></div>
<div style="left:390px;top:263.04px" class="cls_010"><span class="cls_010">Cant.</span></div>
<!--<div style="left:285.77px;top:263.66px" class="cls_011"><span class="cls_011">U. medida</span></div>-->
<div style="left:365.05px;top:263.66px" class="cls_011"><span class="cls_011">Precio Unit.</span></div>
<div style="left:420.05px;top:263.66px" class="cls_011"><span class="cls_011">Precio Unit.</span></div>
<!--<div style="left:388.47px;top:263.66px" class="cls_011"><span class="cls_011">% Bonif</span></div>-->
<div style="left:434.50px;top:263.66px" class="cls_011"><span class="cls_011">Subtotal</span></div>
<div style="left:524.27px;top:263.66px" class="cls_011"><span class="cls_011">Subtotal c/IVA</span></div>
<div style="left:492.17px;top:267.68px" class="cls_011"><span class="cls_011">IVA</span></div>
<div style="left:468.50px;top:263.66px" class="cls_011"><span class="cls_011">Subtotal</span></div>
<div style="left:508.19px;top:261px" class="cls_011"><span class="cls_011">Alicuota <br/> IVA</span></div>
<div style="left:544.27px;top:261px" class="cls_011"><span class="cls_011">Subtotal <br/> c/IVA</span></div>

<% top = 283 %>
<% @line_items.each_with_index do |line_item, index|
item_code = line_item.code || (index + 1).to_s.rjust(3, "0")
small_code = item_code.length > 8

This comment has been minimized.

Copy link
@nan-apps

nan-apps Mar 3, 2019

Author Collaborator

con esto decido si usar fuente chica

precio_unitario = ('%.2f' % line_item.imp_unitario).to_s.tr(".", ",")
subtotal = ('%.2f' % line_item.imp_total_unitario).to_s.tr(".", ",")
alic_iva = ('%.2f' % line_item.iva).to_s.tr(".", ",")
subtotal_con_iva = ('%.2f' % line_item.imp_total_unitario_con_iva).to_s.tr(".", ",")
%>
<div style="left:18.00px;top:<%= top %>px" class="cls_008"><span class="cls_008"><%= item_code %></span></div>
<div style="left:57.00px;top:<%= top %>px" class="cls_008"><span class="cls_008"><%= line_item.name %></span></div>
<div style="width:60px;left:290.30px;top:<%= top %>px" class="cls_008"><span style="position:absolute;right:0" class="cls_008"><%= line_item.quantity.to_s.tr(".", ",") %> </span></div>
<div style="word-break: break-word; width:52px; left:18.00px;top:<%= top %>px;" class="cls_008"><span class="cls_008" style="<%= "font-size:5px" if small_code %>"><%= item_code %></span></div>
<div style="left:80.00px;top:<%= top %>px" class="cls_008"><span class="cls_008"><%= line_item.name %></span></div>
<div style="width:29px;left:388px;top:<%= top %>px" class="cls_008"><span style="position:absolute;right:0" class="cls_008"><%= line_item.quantity.to_s.tr(".", ",") %> </span></div>
<!--<div style="left:288.30px;top:<%= top %>px" class="cls_012"><span class="cls_012">unidades</span></div>-->
<div style="left:413px;top:<%= top %>px" class="cls_008"><span class="cls_008" style="position:absolute;right:0"><%= precio_unitario %></span></div>
<div style="width:40px; left:420px;top:<%= top %>px" class="cls_008"><span class="cls_008" style="position:absolute;right:0"><%= precio_unitario %></span></div>
<!--<div style="left:398.43px;top:<%= top %>px" class="cls_008"><span class="cls_008">0,00</span></div>-->
<div style="width:60px;left:70.4%;top:<%= top %>px" class="cls_008"><span style="position:absolute;right:0" class="cls_008"><%= subtotal %></span></div>
<div style="left:490.00px;top:<%= top %>px" class="cls_008"><span class="cls_008"><%= alic_iva %>%</span></div>
<div style="width:60px;left:87%;top:<%= top %>px" class="cls_008"><span style="position:absolute;right:0" class="cls_008"><%= subtotal_con_iva %></span></div>
<div style="width:40px;left:462px;top:<%= top %>px" class="cls_008"><span style="position:absolute;right:0" class="cls_008"><%= subtotal %></span></div>
<div style="left:508px;top:<%= top %>px" class="cls_008"><span class="cls_008"><%= alic_iva %>%</span></div>
<div style="width:40px;left:540;top:<%= top %>px" class="cls_008"><span style="position:absolute;right:0" class="cls_008"><%= subtotal_con_iva %></span></div>
<% top += 15 %>
<% end %>

Expand Down
23 changes: 13 additions & 10 deletions lib/afip_bill/views/bills/factura_b.html.erb
Original file line number Diff line number Diff line change
@@ -1,28 +1,31 @@
<%= @template_header %>

<div style="left:19.00px;top:270.04px" class="cls_010"><span class="cls_010">Código</span></div>
<div style="left:60.00px;top:270.04px" class="cls_010"><span class="cls_010">Producto / Servicio</span></div>
<div style="left:372.39px;top:270.04px" class="cls_010"><span class="cls_010">Cantidad</span></div>
<div style="left:80.00px;top:270.04px" class="cls_010"><span class="cls_010">Producto / Servicio</span></div>
<div style="left:465.39px;top:270.04px" class="cls_010"><span class="cls_010">Cant.</span></div>
<!-- <div style="left:263.61px;top:270.04px" class="cls_010"><span class="cls_010">U. Medida</span></div> -->
<div style="left:428.05px;top:270.66px" class="cls_011"><span class="cls_011">Precio Unit.</span></div>
<div style="left:494px;top:270.66px" class="cls_011"><span class="cls_011">Precio Unit.</span></div>
<!-- <div style="left:386.97px;top:270.66px" class="cls_011"><span class="cls_011">% Bonif</span></div>
<div style="left:434.42px;top:270.66px" class="cls_011"><span class="cls_011">Imp. Bonif.</span></div> -->
<div style="left:520.50px;top:270.66px" class="cls_011"><span class="cls_011">Subtotal</span></div>
<div style="left:542.50px;top:270.66px" class="cls_011"><span class="cls_011">Subtotal</span></div>

<% top = 293 %>
<% top = 288 %>
<% @line_items.each_with_index do |line_item, index|
item_code = line_item.code || (index + 1).to_s.rjust(3, "0")
small_code = item_code.length > 8
precio_unitario = ('%.2f' % line_item.imp_unitario).to_s.tr(".", ",")
subtotal = ('%.2f' % line_item.imp_total_unitario).to_s.tr(".", ",")
%>
<div style="left:18.00px;top:<%= top %>px" class="cls_008"><span class="cls_008"><%= item_code %></span></div>
<div style="left:57.00px;top:<%= top %>px" class="cls_008"><span class="cls_008"><%= line_item.name %></span></div>
<div style="width:60px;left:392px;top:<%= top %>px" class="cls_008"><span class="cls_008"><%= line_item.quantity.round(2).to_s.tr(".", ",") %></span></div>
<div style="word-break: break-word; width: 55px; left:18.00px;top:<%= top %>px" class="cls_008">
<span class="cls_008" style="<%= "font-size:5px" if small_code %>"><%= item_code %></span>
</div>
<div style="left:80.00px;top:<%= top %>px" class="cls_008"><span class="cls_008"><%= line_item.name %></span></div>
<div style="width:29px;left:478px;top:<%= top %>px" class="cls_008"><span class="cls_008"><%= line_item.quantity.round(2).to_s.tr(".", ",") %></span></div>
<!-- <div style="left:268.30px;top:<%= top %>px" class="cls_012"><span class="cls_012">unidades</span></div> -->
<div style="left:478px;top:<%= top %>px" class="cls_008"><span class="cls_008" style="position:absolute;right:0"><%= precio_unitario %></span></div>
<div style="width:40px; left:495px;top:<%= top %>px" class="cls_008"><span class="cls_008" style="position:absolute;right:0"><%= precio_unitario %></span></div>
<!-- <div style="left:392.22px;top:<%= top %>px" class="cls_008"><span class="cls_008">0,00</span></div>
<div style="left:471.43px;top:<%= top %>px" class="cls_008"><span class="cls_008">0,00</span></div> -->
<div style="width:60px;left:91%;top:<%= top %>px" class="cls_008"><span class="cls_008"><%= subtotal %></span></div>
<div style="width:40px;left:91%;top:<%= top %>px" class="cls_008"><span class="cls_008" style="position:absolute;right:0"><%= subtotal %></span></div>
<% top += 15 %>
<% end %>

Expand Down

0 comments on commit 84e38ff

Please sign in to comment.