Afip 1.4.3 → 1.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/Afip/bill.rb +20 -7
- data/lib/Afip/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1e15bae23befe6c31d73deed6eb0c6b5810fc1476737fb33699843bb5130cc6
|
4
|
+
data.tar.gz: '0820e7288c7fdb7f9538019ab4c19b324018feecdc217ddbd010a686c9168c86'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f07cbdfa44a0c14f642219261b7192c0553c3ea65fad43f415cc5251d1cbd2ce886e272473817c507c84bd803893dd954771e887c9e60098affc11bf1cfc568
|
7
|
+
data.tar.gz: 714431bbbfbb2810e02bdb5a82c5677e7af7d2122de821ad006af5d7067ad7429e874a72a231212559299ce774d38ea7d9b96e7e811fcc45513bedef86627012
|
data/Gemfile.lock
CHANGED
data/lib/Afip/bill.rb
CHANGED
@@ -3,7 +3,7 @@ module Afip
|
|
3
3
|
attr_reader :cbte_type, :body, :response, :fecha_emision, :total, :client
|
4
4
|
attr_accessor :net, :doc_num, :iva_cond, :documento, :concepto, :moneda, :cbte_type,
|
5
5
|
:due_date, :fch_serv_desde, :fch_serv_hasta, :fch_emision,
|
6
|
-
:ivas, :sale_point, :cant_reg, :no_gravado, :gravado, :exento, :otros_imp, :tributos
|
6
|
+
:ivas, :sale_point, :cant_reg, :no_gravado, :gravado, :exento, :otros_imp, :tributos, :opcionales
|
7
7
|
|
8
8
|
def initialize(attrs={})
|
9
9
|
@client = Bill.set_client
|
@@ -27,6 +27,7 @@ module Afip
|
|
27
27
|
@otros_imp = attrs[:otros_imp] || 0.0
|
28
28
|
@total = net.to_f + iva_sum.to_f + exento.to_f + no_gravado.to_f + otros_imp.to_f
|
29
29
|
@tributos = attrs[:tributos] || []
|
30
|
+
@opcionales = attes[:opcionales] || []
|
30
31
|
end
|
31
32
|
|
32
33
|
def self.get_ptos_vta
|
@@ -88,25 +89,33 @@ module Afip
|
|
88
89
|
array_ivas["AlicIva"] = ivas.map{ |i| { "Id" => i[0], "BaseImp" => i[1].round(2), "Importe" => i[2].round(2)} unless ["01", "02"].include?(i[0])}.compact
|
89
90
|
|
90
91
|
array_tributos = {}
|
91
|
-
|
92
|
-
|
93
|
-
|
92
|
+
array_tributos["Tributo"] = tributos.map{ |t|
|
93
|
+
if t[1].blank?
|
94
|
+
{
|
94
95
|
"Id" => t[0],
|
95
96
|
"BaseImp" => t[2].to_f.round(2),
|
96
97
|
"Alic" => t[3].to_f.round(2),
|
97
98
|
"Importe" => t[4].to_f.round(2)
|
98
99
|
}
|
99
|
-
|
100
|
-
|
100
|
+
else
|
101
|
+
{
|
101
102
|
"Id" => t[0],
|
102
103
|
"Desc" => t[1],
|
103
104
|
"BaseImp" => t[2].to_f.round(2),
|
104
105
|
"Alic" => t[3].to_f.round(2),
|
105
106
|
"Importe" => t[4].to_f.round(2)
|
106
107
|
}
|
107
|
-
|
108
|
+
end
|
109
|
+
}
|
110
|
+
|
111
|
+
array_opcionales["Opcional"] = opcionales.map{ |t|
|
112
|
+
{
|
113
|
+
"Id" => t[:id],
|
114
|
+
"Valor" => t[:valor]
|
115
|
+
}
|
108
116
|
}
|
109
117
|
|
118
|
+
|
110
119
|
fecaereq = {
|
111
120
|
"FeCAEReq" => {
|
112
121
|
"FeCabReq" => Afip::Bill.header(cant_reg, cbte_type, sale_point),
|
@@ -141,6 +150,10 @@ module Afip
|
|
141
150
|
detail["Tributos"] = array_tributos
|
142
151
|
end
|
143
152
|
|
153
|
+
if !opcionales.empty?
|
154
|
+
detail["Opcionales"] = array_opcionales
|
155
|
+
end
|
156
|
+
|
144
157
|
unless concepto == "Productos" # En "Productos" ("01"), si se mandan estos parámetros la afip rechaza.
|
145
158
|
detail.merge!({"FchServDesde" => fch_serv_desde.strftime("%Y%m%d"),
|
146
159
|
"FchServHasta" => fch_serv_hasta.strftime("%Y%m%d"),
|
data/lib/Afip/version.rb
CHANGED