Пример #1
0
def start(parser, dia, inprema=True, cotizacion=2):
    """Inicia el proceso de actualización de las aportaciones utilizando la
    planilla recibida"""

    print(u"Iniciando proceso de Actualizacion, esto puede tardar mucho tiempo")

    accounts = {}
    for account in database.get_accounts():
        accounts[account] = {'number': 0, 'amount': Decimal()}

    updater = core.Actualizador(database.get_obligation(dia.year, dia.month,
                                                        inprema), accounts, dia)

    updater.registrar_cuenta(database.get_loan_account(), 'prestamo')
    updater.registrar_cuenta(database.get_cuota_account(), 'cuota')
    updater.registrar_cuenta(database.get_incomplete_account(), 'incomplete')
    updater.registrar_cuenta(database.get_exceding_account(), 'excedente')

    # Cambiar por un par de acciones que muestren progreso
    parsed = parser.parse()

    conn = sqlhub.getConnection()
    transaction = conn.transaction()
    sqlhub.processConnection = transaction
    try:
        [updater.update(i, True) for i in parsed]
        transaction.commit()
    except Exception:
        transaction.rollback()
        transaction.begin()
        raise

    print(u"Proceso de actualización Exitoso!")
Пример #2
0
def test_setup():
    try:
        conn = sqlhub.getConnection()
        conn.close()
    except AttributeError:
        # Unhelpfully, we receive an `AttributeError` when the connection
        # wasn't estabilished before rather than a return value.
        pass

    lasertag.prepare(lasertag.IN_MEMORY_SQLITE)
Пример #3
0
def test_setup():
    try:
        conn = sqlhub.getConnection()
        conn.close()
    except AttributeError:
        # Unhelpfully, we receive an `AttributeError` when the connection
        # wasn't estabilished before rather than a return value.
        pass

    lasertag.prepare(lasertag.IN_MEMORY_SQLITE)
Пример #4
0
    accounts = {}
    for account in database.get_accounts():
        accounts[account] = {'number': 0, 'amount': Decimal()}

    Parser = getattr(parsers, banco.parser)
    parser = Parser(fecha, archivo, banco)
    parsed = parser.output()

    updater = parsers.ActualizadorBancario(
        database.get_obligation(fecha.year, fecha.month),
        accounts, fecha, banco, cobro,
        database.get_compliment(fecha.year, fecha.month, True),
        database.get_compliment(fecha.year, fecha.month, False))

    updater.registrar_cuenta(database.get_loan_account(), 'prestamo')
    updater.registrar_cuenta(database.get_cuota_account(), 'cuota')
    updater.registrar_cuenta(database.get_incomplete_account(), 'incomplete')
    updater.registrar_cuenta(database.get_exceding_account(), 'excedente')
    updater.registrar_cuenta(database.get_inprema_account(), 'complemento')
    print(u"Actualizando {0}".format(banco.nombre))

    conn = sqlhub.getConnection()
    transaction = conn.transaction()
    sqlhub.processConnection = transaction
    try:
        [updater.update(i, banco.cuota) for i in parsed]
        transaction.commit()
    except Exception:
        transaction.rollback()
        raise
 def deleteColumn(self, objectClass, columnName):
     print '--> remove column %s from %s' % (columnName,
                                             objectClass.sqlmeta.table)
     sqlhub.getConnection().delColumn(
         objectClass.sqlmeta,
         self.getColumnDefinition(objectClass, columnName))
 def addColumn(self, objectClass, columnName):
     print '--> add column %s to %s' % (columnName,
                                        objectClass.sqlmeta.table)
     sqlhub.getConnection().addColumn(
         objectClass.sqlmeta.table,
         self.getColumnDefinition(objectClass, columnName))
 def runSqlFile(self, fileName):
     print '--> run sql from %s' % fileName
     read_data = None
     with open(fileName, 'r') as f:
         read_data = f.read()
     sqlhub.getConnection().query(read_data)
Пример #8
0
 def deleteColumn(self, objectClass, columnName):
     print '--> remove column %s from %s' % (columnName, objectClass.sqlmeta.table)
     sqlhub.getConnection().delColumn(objectClass.sqlmeta, self.getColumnDefinition(objectClass, columnName))
Пример #9
0
 def addColumn(self, objectClass, columnName):
     print '--> add column %s to %s' % (columnName, objectClass.sqlmeta.table)
     sqlhub.getConnection().addColumn(objectClass.sqlmeta.table, self.getColumnDefinition(objectClass, columnName))
Пример #10
0
 def runSqlFile(self, fileName):
     print '--> run sql from %s' % fileName
     read_data = None
     with open(fileName, 'r') as f:
         read_data = f.read()
     sqlhub.getConnection().query(read_data)