You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
2.2 KiB
89 lines
2.2 KiB
--[[
|
|
{
|
|
"uid": "53935f27-5cf0-4281-9a29-a68f100ee981",
|
|
"execution_status": "Borrador",
|
|
"tipo_comprobante": "factura c",
|
|
"fecha_comprobante": "13/11/2025",
|
|
"tipo_concepto": "servicios",
|
|
"servicio_fecha_desde": "01/10/2025",
|
|
"servicio_fecha_hasta": "01/10/2025",
|
|
"servicio_fecha_vencimiento_pago": "13/11/2025",
|
|
"referencia": "",
|
|
"tipo_iva_receptor": "consumidor final",
|
|
"cuit_receptor": "",
|
|
"forma_pago": "contado",
|
|
"monto_unitario": "10000",
|
|
"cantidad": "1",
|
|
"descripcion": "Clase de apoyo"
|
|
}
|
|
--]]
|
|
|
|
|
|
log("Inicio afip_ingresar_datos_operacion from LUA!!")
|
|
local err
|
|
print("BEFORE JSON LOADING payload: " .. json_payload)
|
|
local json = require("json")
|
|
print("AFTER JSON LOADING")
|
|
-- Parse the JSON string
|
|
local obj, err = json.decode(json_payload)
|
|
if err then
|
|
message = "Error parsing JSON: " .. err
|
|
log(message)
|
|
error(message)
|
|
end
|
|
|
|
local error_on_page
|
|
|
|
descripcion = obj["descripcion"]
|
|
monto_unitario = obj["monto_unitario"]
|
|
tipo_comprobante = obj["tipo_comprobante"]
|
|
|
|
--[[
|
|
if string.match(tipo_comprobante, "factura") then
|
|
log("Setting tipo_comprobante to factura")
|
|
tipo_comprobante = "factura"
|
|
else
|
|
log("Setting tipo_comprobante to ")
|
|
tipo_comprobante = "recibo"
|
|
end
|
|
--]]
|
|
|
|
-- TODO: handle factura AND recibo!
|
|
log("Descripcion: " .. descripcion .. " Monto: " .. monto_unitario .. " Tipo: " .. tipo_comprobante)
|
|
|
|
descripcion_selector = "#detalle_descripcion1"
|
|
precio_selector = "#detalle_precio1"
|
|
|
|
err = waitVisibleByQuerySelector(descripcion_selector)
|
|
if err then
|
|
message = "Error waiting for detalle_descripcion1: " .. err
|
|
log(message)
|
|
error(message)
|
|
end
|
|
|
|
err = setTextFieldByQuerySelector(descripcion_selector, descripcion)
|
|
if err then
|
|
message = "Error setting detalle_descripcion1: " .. err
|
|
log(message)
|
|
error(message)
|
|
end
|
|
|
|
waitSecs(1)
|
|
|
|
err = waitVisibleByQuerySelector(precio_selector)
|
|
if err then
|
|
message = "Error waiting for detalle_precio1: " .. err
|
|
log(message)
|
|
error(message)
|
|
end
|
|
|
|
err = setTextFieldByQuerySelector(precio_selector, monto_unitario)
|
|
if err then
|
|
message = "Error setting detalle_precio1: " .. err
|
|
log(message)
|
|
error(message)
|
|
end
|
|
|
|
waitSecs(1)
|
|
|
|
log("Finishing afip_ingresar_datos_operacion from LUA!!")
|
|
|