Borrar RFC

This commit is contained in:
Mauricio Baeza 2017-10-22 15:23:22 -05:00
parent 7a2ea36b12
commit ac9e066f8b
1 changed files with 35 additions and 0 deletions

View File

@ -1703,6 +1703,24 @@ def _add_emisor(rfc, args):
return True
def _delete_emisor(rfc):
con = sqlite3.connect(COMPANIES)
cursor = con.cursor()
sql = """
DELETE FROM names
WHERE rfc = '?'"""
try:
cursor.execute(sql, (rfc,))
except Exception as e:
log.error(e)
return False
con.commit()
cursor.close()
con.close()
return True
def _iniciar_bd():
rfc = input('Introduce el RFC: ').strip().upper()
if not rfc:
@ -1750,6 +1768,23 @@ def _agregar_rfc():
return
def _borrar_rfc():
rfc = input('Introduce el RFC a borrar: ').strip().upper()
if not rfc:
msg = 'El RFC es requerido'
log.error(msg)
return
confirm = input('¿Estás seguro de borrar el RFC?')
if _delete_emisor(rfc):
log.info('RFC borrado correctamente...')
return
log.error('No se pudo borrar el RFC')
return
def _listar_rfc():
data = util.get_rfcs()
for row in data: