Welcome to the Indigo Rose Software discussion forums! You will need to sign up for a forum account and login before you can post. Need help? View the Forum FAQ.
--SI ESTAMOS CREANDO UN NUEVO REGISTRO, INSERTAR EN LOS PRÓXIMOS DISPONIBLES
--POSICIÓN, DE LO CONTRARIO INSERTAR EN LA POSICIÓN DEL REGISTRO ACTUAL
if bNewRecord then
nSelection = SQLite.QueryToTable(db,"SELECT * FROM Info_List WHERE ApellidosNombres='"..sApellidosNombres.."'");
if nSelection == nil then -- Si no hay registros con el mismo Nombre y Apellidos inserta los datos
SQLite.Query(db,"insert into Info_List values(NULL, '"..sNumeroRecibo.."', '"..sApellidosNombres.."', '"..sDni.."', '"..sCodigoPuesto.."', '"..sCategoriaPuesto.."', '"..sDependencia.."', '"..sRetribucion.."', '"..sFechaRetribucion.."', '"..sEncargado.."', '"..sCobrador.."' )");
if Application.GetLastError() ~= SQLite.OK then
Dialog.Message("Error: " .. nLastError, SQLite.GetLastErrorString());
else
Dialog.TimedMessage("Registro-Aportador", "Estimado(a) "..sUsuario.." Se Registro la Información del Aportador con Éxito", 3000, MB_ICONEXCLAMATION);
Page.Jump("Rpd")
end
else -- Si hay registros con el Nombre y Apellidos entonces...
nData = nil;
rData = nil;
for nRow = 1, nSelection.Rows do
nData = nSelection.Data[nRow]["FechaRetribucion"];
if nData == sFechaRetribucion then
rData = true;
break
end
end
if not rData then
SQLite.Query(db,"insert into Info_List values(NULL, '"..sNumeroRecibo.."', '"..sApellidosNombres.."', '"..sDni.."', '"..sCodigoPuesto.."', '"..sCategoriaPuesto.."', '"..sDependencia.."', '"..sRetribucion.."', '"..sFechaRetribucion.."', '"..sEncargado.."', '"..sCobrador.."' )");
if Application.GetLastError() ~= SQLite.OK then
Dialog.Message("Error: " .. nLastError, SQLite.GetLastErrorString());
else
Dialog.TimedMessage("Registro-Aportador", "Estimado(a) "..sUsuario.." Se Registro la Información del Aportador con Éxito", 3000, MB_ICONEXCLAMATION);
Page.Jump("Rpd")
end
else
Dialog.Message("Error", "Este rentador ya aporto en esta fecha ");
end
end
else
SQLite.Query(db,"insert or replace into Info_List values('" .. nRecordID .."', '"..sNumeroRecibo.."', '"..sApellidosNombres.."', '"..sDni.."', '"..sCodigoPuesto.."', '"..sCategoriaPuesto.."', '"..sDependencia.."', '"..sRetribucion.."', '"..sFechaRetribucion.."', '"..sEncargado.."', '"..sCobrador.."' )");
nLastError = Application.GetLastError();
if nLastError ~= SQLite.OK then
Dialog.Message("Error: " .. nLastError, SQLite.GetLastErrorString());
Comment