Afip 0.8.6 → 0.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/Afip/bill.rb +43 -19
- data/lib/Afip/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f38c5d249e07d139a44b89411affbde3b26f350047ec158cb3d40e200e186235
|
4
|
+
data.tar.gz: 7c07f89926ae9ca1c62c450586feb6e7ba01caf7bd1b1e62571a548097063cd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa409090e458ec9a7b2f77bda111a0b39bd03ff1ee62988a40115df2a756ab02d2051ee56914a0079da3d86141b0137f03efbca60f9cb373d2f4db97e36a6633
|
7
|
+
data.tar.gz: 38337f51436a8e0c54b4be71ec7a713d1d46b5068cb99e7112018c8578c40f4f356d3ccd2e6d72309c99b12cae4192b10ab8a384b8d3912e13849a147c755867
|
data/Gemfile.lock
CHANGED
data/lib/Afip/bill.rb
CHANGED
@@ -3,24 +3,29 @@ 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,
|
5
5
|
:due_date, :fch_serv_desde, :fch_serv_hasta, :fch_emision,
|
6
|
-
:ivas, :sale_point
|
6
|
+
:ivas, :sale_point, :cant_reg, :no_gravado, :gravado, :exento, :otros_imp
|
7
7
|
|
8
8
|
def initialize(attrs={})
|
9
9
|
@client = Bill.set_client
|
10
10
|
@sale_point = attrs[:sale_point]
|
11
11
|
@body = { "Auth" => Afip.auth_hash }
|
12
12
|
@net = attrs[:net] || 0
|
13
|
-
@documento
|
14
|
-
@moneda
|
15
|
-
@iva_cond
|
16
|
-
@concepto
|
17
|
-
@ivas
|
18
|
-
@fecha_emision
|
13
|
+
@documento = attrs[:documento] || Afip.default_documento
|
14
|
+
@moneda = attrs[:moneda] || Afip.default_moneda
|
15
|
+
@iva_cond = attrs[:iva_cond]
|
16
|
+
@concepto = attrs[:concepto] || Afip.default_concepto
|
17
|
+
@ivas = attrs[:ivas] || Array.new # [ 1, 100.00, 10.50 ], [ 2, 100.00, 21.00 ]
|
18
|
+
@fecha_emision = attrs[:fch_emision] || Time.new
|
19
19
|
@fch_serv_hasta = attrs[:fch_serv_hasta]
|
20
20
|
@fch_serv_desde = attrs[:fch_serv_desde]
|
21
|
-
@due_date
|
22
|
-
@cbte_type
|
23
|
-
@
|
21
|
+
@due_date = attrs[:due_date]
|
22
|
+
@cbte_type = Afip::BILL_TYPE[Afip.own_iva_cond][iva_cond]
|
23
|
+
@cant_reg = attrs[:cant_reg] || 1
|
24
|
+
@no_gravado = attrs[:no_gravado] || 0.0
|
25
|
+
@gravado = attrs[:gravado] || 0.0
|
26
|
+
@exento = attrs[:exento] || 0.0
|
27
|
+
@otros_imp = attrs[:otros_imp] || 0.0
|
28
|
+
@total = net.zero? ? 0 : net + iva_sum
|
24
29
|
end
|
25
30
|
|
26
31
|
def self.get_ptos_vta
|
@@ -64,9 +69,25 @@ module Afip
|
|
64
69
|
array_ivas = Array.new
|
65
70
|
ivas.each{ |i|
|
66
71
|
array_ivas << {
|
67
|
-
|
68
|
-
|
69
|
-
|
72
|
+
"AlicIva" => {
|
73
|
+
"Id" => i[0],
|
74
|
+
"BaseImp" => i[1].round(2),
|
75
|
+
"Importe" => i[2].round(2)
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
array_tributos = Array.new
|
81
|
+
tributos.each{ |t|
|
82
|
+
array_tributos << {
|
83
|
+
"Tributo" => {
|
84
|
+
"id" => t[0],
|
85
|
+
"Desc" => t[1],
|
86
|
+
"BaseImp" => t[2],
|
87
|
+
"Alic" => t[3],
|
88
|
+
"Importe" => t[4]
|
89
|
+
}
|
90
|
+
}
|
70
91
|
}
|
71
92
|
|
72
93
|
fecaereq = {
|
@@ -78,12 +99,12 @@ module Afip
|
|
78
99
|
"DocTipo" => Afip::DOCUMENTOS[documento],
|
79
100
|
"DocNro" => doc_num,
|
80
101
|
"CbteFch" => fecha_emision.strftime('%Y%m%d'),
|
81
|
-
"ImpTotConc" =>
|
102
|
+
"ImpTotConc" => no_gravado,
|
82
103
|
"ImpNeto" => net.to_f,
|
83
104
|
"MonId" => Afip::MONEDAS[moneda][:codigo],
|
84
105
|
"MonCotiz" => exchange_rate,
|
85
|
-
"ImpOpEx" =>
|
86
|
-
"ImpTrib" =>
|
106
|
+
"ImpOpEx" => exento,
|
107
|
+
"ImpTrib" => otros_imp,
|
87
108
|
"ImpTotal" => (Afip.own_iva_cond == :responsable_monotributo ? net : total).to_f.round(2),
|
88
109
|
"CbteDesde" => next_bill_number,
|
89
110
|
"CbteHasta" => next_bill_number
|
@@ -96,9 +117,12 @@ module Afip
|
|
96
117
|
|
97
118
|
if (Afip.own_iva_cond == :responsable_inscripto)
|
98
119
|
detail["ImpIVA"] = iva_sum
|
99
|
-
detail["Iva"] = {
|
120
|
+
detail["Iva"] = { array_ivas }
|
100
121
|
end
|
101
122
|
|
123
|
+
if !tributos.empty?
|
124
|
+
detail["Tributos"] = { array_tributos }
|
125
|
+
end
|
102
126
|
unless concepto == "Productos" # En "Productos" ("01"), si se mandan estos parámetros la afip rechaza.
|
103
127
|
detail.merge!({"FchServDesde" => fch_serv_desde.strftime("%Y%m%d"),
|
104
128
|
"FchServHasta" => fch_serv_hasta.strftime("%Y%m%d"),
|
@@ -109,8 +133,8 @@ module Afip
|
|
109
133
|
pp body
|
110
134
|
end
|
111
135
|
|
112
|
-
def self.header(cbte_type, sale_point)
|
113
|
-
{"CantReg" =>
|
136
|
+
def self.header(cant_reg, cbte_type, sale_point)
|
137
|
+
{"CantReg" => cant_reg.to_s, "CbteTipo" => cbte_type, "PtoVta" => sale_point}
|
114
138
|
end
|
115
139
|
|
116
140
|
def exchange_rate
|
data/lib/Afip/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Afip
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Facundo A. Díaz Martínez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|