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

[WIP] #1

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
801d2dd
New documents: credit and debit notes
nan-apps Nov 7, 2018
dbcccce
New bill attribute: custom text
nan-apps Nov 7, 2018
0d2ca8c
path fix
nan-apps Nov 7, 2018
d539408
ajustando algunos margenes
nan-apps Nov 8, 2018
6d52034
Ajuste en nombre de fantasia en encabezado
nan-apps Nov 9, 2018
28faad5
Fixed margins and zoom level WOMM
ceneon Nov 9, 2018
a4af56c
Merge branch 'develop' of github.com:wecodeio/afip_bill into develop
ceneon Nov 9, 2018
af71fc7
Main margin improvements
ceneon Nov 12, 2018
f7d81b2
Compress items' lines to fit more of them
ceneon Nov 12, 2018
9a0d972
Improve alignment for unit prices
ceneon Nov 12, 2018
c83bdec
Merge remote-tracking branch 'origin/develop' into develop
nan-apps Nov 12, 2018
2c8e20e
some width and alignment fixes
nan-apps Nov 13, 2018
02a8a84
different iva's in lines and totals
nan-apps Nov 13, 2018
27df05d
Alignment fix in B notes
nan-apps Nov 13, 2018
fbff3a8
Some small fixes
nan-apps Nov 14, 2018
e4845ab
configuration fix
nan-apps Dec 11, 2018
1301416
condition sale configurable and with default value "Otra" for backwar…
nan-apps Dec 14, 2018
8c3a697
missing space
nan-apps Dec 14, 2018
02d6ce7
fix in logo size
nan-apps Dec 14, 2018
dcde884
preparing for c invoicing
nan-apps Dec 24, 2018
5af2f91
more description space in A invoices lines
nan-apps Jan 9, 2019
67969c7
more descripcion space in all documents and some other adjustments
nan-apps Jan 17, 2019
2e76403
css fix in client address
nan-apps Jan 17, 2019
1ae14b3
adding code parameter to line item
nan-apps Jan 21, 2019
e6bf0dd
small codefix
nan-apps Jan 23, 2019
4c9ad82
gaining more space for companies bank information
nan-apps Jan 30, 2019
3923eeb
lines number formating
nan-apps Jan 30, 2019
2979175
adjusting totals in notes A with new template image
nan-apps Feb 14, 2019
84e38ff
ganing code space from amount and using smaller font when code too long
nan-apps Mar 3, 2019
8eab777
quantity position fix in b template
nan-apps Mar 3, 2019
1b6ab03
fixed width for line descriptions
nan-apps Apr 29, 2019
c0b12f8
related invoice data for notes
nan-apps Sep 29, 2020
86c8ff3
Reorganized footer to display AFIP QR code
Feb 28, 2021
866350e
removed trash css
Feb 28, 2021
c9ffb24
Addes header_obs to invoices (remit number etc)
ceneon Jul 5, 2021
728d715
Added invoice discounts mode
ceneon Sep 10, 2021
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
8 changes: 4 additions & 4 deletions lib/afip_bill/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ def barcode

def pdfkit_options
{
zoom: '1.65',
'margin-bottom': '0.05in',
'margin-top': '0.05in',
'margin-left': '0.2in',
zoom: '1.65',
'margin-bottom': '0.05in',
'margin-top': '0.05in',
'margin-left': '0.2in',
'margin-right': '0.2in'
}
end
Expand Down
9 changes: 5 additions & 4 deletions lib/afip_bill/line_item.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
module AfipBill
class LineItem
attr_reader :name, :quantity, :imp_unitario
IVA = 21.freeze
attr_reader :name, :quantity, :imp_unitario, :iva
#IVA = 21.freeze

def initialize(name, quantity, imp_unitario)
def initialize(name, quantity, imp_unitario, iva=nil)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

por compatibilidad si esto se va a volver una serie de PRs en el repo original, el default de iva acá debería ser 21

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hecho!

@name = name
@quantity = quantity
@imp_unitario = imp_unitario
@iva = iva
end

def imp_total_unitario
quantity * imp_unitario
end

def imp_iva
imp_total_unitario * IVA / 100
imp_total_unitario * iva / 100
end

def imp_total_unitario_con_iva
Expand Down
8 changes: 4 additions & 4 deletions lib/afip_bill/views/bills/factura_a.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div style="left:380px;top:<%= top %>px" class="cls_008"><span class="cls_008" style="position:absolute;right:0"><%= line_item.imp_unitario.to_s.tr(".", ",") %></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"><%= line_item.imp_total_unitario.round(2).to_s.tr(".", ",") %></span></div>
<div style="left:490.00px;top:<%= top %>px" class="cls_008"><span class="cls_008">21%</span></div>
<div style="left:490.00px;top:<%= top %>px" class="cls_008"><span class="cls_008"><%= line_item.iva %>%</span></div>
<div style="width:60px;left:87%;top:<%= top %>px" class="cls_008"><span style="position:absolute;right:0" class="cls_008"><%= line_item.imp_total_unitario_con_iva.round(2).to_s.tr(".", ",") %></span></div>
<% top += 15 %>
<% end %>
Expand Down Expand Up @@ -49,11 +49,11 @@
<div style="left:18.00px;top:589.63px" class="cls_008"><span class="cls_008">Impuestos Municipales</span></div>
<div style="left:331.43px;top:589.63px" class="cls_008"><span class="cls_008">0,00</span></div>
<div style="left:456.98px;top:577.41px" class="cls_002"><span class="cls_002">IVA 21%: $</span></div>
<div style="width:60px;left:86.6%;top:577.41px" class="cls_002"><span style="position:absolute;right:0" class="cls_002"><%= afip_bill["imp_iva"] %></span></div>
<div style="width:60px;left:86.6%;top:577.41px" class="cls_002"><span style="position:absolute;right:0" class="cls_002"><%= afip_bill["imp_iva_21"] %></span></div>
<div style="left:186.97px;top:602.91px" class="cls_006"><span class="cls_006">Importe Otros Tributos: $</span></div>
<div style="left:329.49px;top:602.91px" class="cls_006"><span class="cls_006">0,00</span></div>
<div style="left:449.48px;top:590.41px; width: 60px;" class="cls_002"><span class="cls_002">IVA 10.5%: $</span></div>
<div style="left:557.49px;top:590.41px" class="cls_002"><span class="cls_002">0,00</span></div>
<div style="width:60px; left:449.48px;top:590.41px;" class="cls_002"><span class="cls_002">IVA 10.5%: $</span></div>
<div style="width:60px;left:86.6%;top:590.41px" class="cls_002"><span style="position:absolute;right:0" class="cls_002"><%= afip_bill["imp_iva_105"] %></span></div>
<div style="left:461.99px;top:603.41px" class="cls_002"><span class="cls_002">IVA 5%: $</span></div>
<div style="left:557.49px;top:603.41px" class="cls_002"><span class="cls_002">0,00</span></div>
<div style="left:454.48px;top:616.41px" class="cls_002"><span class="cls_002">IVA 2.5%: $</span></div>
Expand Down
8 changes: 4 additions & 4 deletions lib/afip_bill/views/notes/nota_a.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<div style="left:360.54px;top:<%= top %>px" class="cls_008"><span class="cls_008"><%= line_item.imp_unitario.to_s.tr(".", ",") %></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"><%= line_item.imp_total_unitario.round(2).to_s.tr(".", ",") %></span></div>
<div style="left:490.00px;top:<%= top %>px" class="cls_008"><span class="cls_008">21%</span></div>
<div style="left:490.00px;top:<%= top %>px" class="cls_008"><span class="cls_008"><%= line_item.iva %>%</span></div>
<div style="width:60px;left:87%;top:<%= top %>px" class="cls_008"><span style="position:absolute;right:0" class="cls_008"><%= line_item.imp_total_unitario_con_iva.round(2).to_s.tr(".", ",") %></span></div>
<% top += 25 %>
<% end %>
Expand All @@ -45,11 +45,11 @@
<div style="left:18.00px;top:589.63px" class="cls_008"><span class="cls_008">Impuestos Municipales</span></div>
<div style="left:331.43px;top:589.63px" class="cls_008"><span class="cls_008">0,00</span></div>
<div style="left:456.98px;top:577.41px" class="cls_002"><span class="cls_002">IVA 21%: $</span></div>
<div style="width:60px;left:86.6%;top:577.41px" class="cls_002"><span style="position:absolute;right:0" class="cls_002"><%= afip_bill["imp_iva"] %></span></div>
<div style="width:60px;left:86.6%;top:577.41px" class="cls_002"><span style="position:absolute;right:0" class="cls_002"><%= afip_bill["imp_iva_21"] || '0,00' %></span></div>
<div style="left:186.97px;top:602.91px" class="cls_006"><span class="cls_006">Importe Otros Tributos: $</span></div>
<div style="left:329.49px;top:602.91px" class="cls_006"><span class="cls_006">0,00</span></div>
<div style="left:449.48px;top:590.41px" class="cls_002"><span class="cls_002">IVA 10.5%: $</span></div>
<div style="left:557.49px;top:590.41px" class="cls_002"><span class="cls_002">0,00</span></div>
<div style="width:60px;left:449.48px;top:590.41px" class="cls_002"><span class="cls_002">IVA 10.5%: $</span></div>
<div style="width:60px;left:86.6%;top:590.41px" class="cls_002"><span style="position:absolute;right:0" class="cls_002"><%= afip_bill["imp_iva_105"] || '0,00' %></span></div>
<div style="left:461.99px;top:603.41px" class="cls_002"><span class="cls_002">IVA 5%: $</span></div>
<div style="left:557.49px;top:603.41px" class="cls_002"><span class="cls_002">0,00</span></div>
<div style="left:454.48px;top:616.41px" class="cls_002"><span class="cls_002">IVA 2.5%: $</span></div>
Expand Down
21 changes: 16 additions & 5 deletions lib/afip_bill/views/shared/_factura_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,22 @@
<div style="left:341.00px;top:147.41px; width: 140px;" class="cls_002"><span class="cls_002">Fecha de Inicio de Actividades:</span></div>
<div style="left:482.00px;top:147.41px" class="cls_006"><span class="cls_006"><%= AfipBill.configuration[:business_start_date] %></span></div>
<div style="left:21.00px;top:150.41px; width: 270px;" class="cls_002"><span class="cls_002">Condición frente al IVA: <%= AfipBill.configuration[:iva] %></span></div>
<div style="left:21.00px;top:169.29px" class="cls_005"><span class="cls_005">Período Facturado Desde:</span></div>
<div style="left:159.00px;top:169.29px" class="cls_007"><span class="cls_007"><%= Date.parse(afip_bill["fch_serv_desde"]).strftime("%d/%m/%Y") %></span></div>
<div style="left:232.44px;top:169.29px" class="cls_005"><span class="cls_005">Hasta:</span><span class="cls_007"><%= Date.parse(afip_bill["fch_serv_hasta"]).strftime("%d/%m/%Y") %></span></div>
<div style="left:362.96px;top:169.29px" class="cls_005"><span class="cls_005">Fecha de Vto. para el pago:</span></div>
<div style="left:495.00px;top:169.29px" class="cls_007"><span class="cls_007"><%= Date.parse(afip_bill["fch_serv_hasta"]).strftime("%d/%m/%Y") %></span></div>

<% if afip_bill["fch_serv_desde"].present? and afip_bill["fch_serv_hasta"].present? %>
<div style="left:21.00px;top:169.29px" class="cls_005"><span class="cls_005">Período Facturado Desde:</span></div>
<div style="left:159.00px;top:169.29px" class="cls_007"><span class="cls_007"><%= Date.parse(afip_bill["fch_serv_desde"]).strftime("%d/%m/%Y") %></span></div>
<div style="left:232.44px;top:169.29px" class="cls_005"><span class="cls_005">Hasta:</span><span class="cls_007"><%= Date.parse(afip_bill["fch_serv_hasta"]).strftime("%d/%m/%Y") %></span></div>
<div style="left:362.96px;top:169.29px;" class="cls_005">
<span class="cls_005">Fecha de Vto. para el pago:</span>
<span class="cls_007"><%= Date.parse(afip_bill["fch_vto_pago"]).strftime("%d/%m/%Y") %></span>
</div>
<% else %>
<div style="left:21.00px;top:169.29px;" class="cls_005">
<span class="cls_005">Fecha de Vto. para el pago:</span>
<span class="cls_007"><%= Date.parse(afip_bill["fch_vto_pago"]).strftime("%d/%m/%Y") %></span>
</div>
<% end %>
<div style="left:495.00px;top:169.29px" class="cls_007"></div>
<div style="left:21.00px;top:192.59px" class="cls_002"><span class="cls_002">CUIT:</span></div>
<div style="left:52.00px;top:192.59px" class="cls_006"><span class="cls_006"><%= afip_bill["doc_num"] %></span></div>
<div style="left:205.97px;top:192.59px" class="cls_002"><span class="cls_002">Apellido y Nombre / Razón Social:</span></div>
Expand Down