colppy 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/colppy/resources/invoice.rb +11 -3
- data/lib/colppy/resources/sell_invoice.rb +1 -1
- data/lib/colppy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c1494349b84dc91d119a20764c650f4c244811e
|
4
|
+
data.tar.gz: 49379b4d4b21e06108c0b62117e25470fb2c7bb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6d4302b8d43f6684dccb8f00f9cc0fe4574d4bf451744df86cada7e3e399ccebf27acacc3821b0c1c68359713d2d98ce75ad4ff136621cb7e1550ac022abe46
|
7
|
+
data.tar.gz: 8d440d82d6c11b887438901166948a83ef77c82eee995940577d04549fe7fb41cd138e9b0f7ed13fd87146efafa6a81e6b608fd060560ea9314f561933eb3445
|
@@ -80,6 +80,7 @@ module Colppy
|
|
80
80
|
Cantidad: :quantity, # required
|
81
81
|
ImporteUnitario: :unit_price,
|
82
82
|
IVA: :tax,
|
83
|
+
porcDesc: :discount_percentage,
|
83
84
|
subtotal: :subtotal,
|
84
85
|
idPlanCuenta: :sales_account_id,
|
85
86
|
Comentario: :comment
|
@@ -130,7 +131,14 @@ module Colppy
|
|
130
131
|
(@data[:tax] || product.tax || 21).to_f
|
131
132
|
end
|
132
133
|
def charged
|
133
|
-
(
|
134
|
+
if (percentage = discount_percentage.to_f) > 0
|
135
|
+
unit_price * ((100 - percentage) / 100)
|
136
|
+
else
|
137
|
+
unit_price
|
138
|
+
end
|
139
|
+
end
|
140
|
+
def unit_price
|
141
|
+
(@data[:unit_price] || product.sell_price || 0).to_f
|
134
142
|
end
|
135
143
|
def quantity
|
136
144
|
@data[:quantity] || 0
|
@@ -172,8 +180,8 @@ module Colppy
|
|
172
180
|
almacen: unhandle_data[:almacen] || "",
|
173
181
|
unidadMedida: measure_unit,
|
174
182
|
Cantidad: quantity,
|
175
|
-
ImporteUnitario:
|
176
|
-
porcDesc:
|
183
|
+
ImporteUnitario: unit_price.round(2),
|
184
|
+
porcDesc: discount_percentage || 0,
|
177
185
|
IVA: tax.to_s,
|
178
186
|
subtotal: total_charged,
|
179
187
|
idPlanCuenta: sales_account_id,
|
@@ -238,7 +238,7 @@ module Colppy
|
|
238
238
|
idCliente: customer_id,
|
239
239
|
idEmpresa: company_id,
|
240
240
|
idUsuario: @client.username,
|
241
|
-
descripcion: @data[:
|
241
|
+
descripcion: @data[:description] || "",
|
242
242
|
fechaFactura: valid_date(@data[:invoice_date]),
|
243
243
|
idCondicionPago: payment_condition_id,
|
244
244
|
fechaPago: valid_date(@data[:payment_date]),
|
data/lib/colppy/version.rb
CHANGED