Ejemplo n.º 1
0
def ganYperAcum():
  'Lee los datos de ganancias y perdidas acumulado y los despliega'
  global lGyPAc

#  st = AMARI + lFecha("Sinca", "GanyPerAcum") + ' (Descargado:' + FIN + lFecha('egyp.txt', '') + ')' + "\n"
  nF = 0
#  bImpar = True

  sTitPrestamos = CO.AZUL + "CTA " + "DESCRIPCION".ljust(35) + \
                    "Ingresos".rjust(15) + "Egresos".rjust(15) + CO.FIN + "\n"
  st = sTitPrestamos
  
  rTotIng = 0.00; rTotEgr = 0.00
  for l in lGyPAc:
    nF += 1
#    sColor, bImpar = ES.colorLinea(bImpar, VERDE)
# 0:Cuenta,1:Descripcion,2:Ingresos,3:Egresos
    if '4--' == l[0]: rTotIng = float(l[2])
    if '5--' == l[0]: rTotEgr = float(l[3])
    if '-' == l[0][2:3]: sColor = CO.VERDE
    else: sColor = ''
    if 0.00 != float(l[2]): sIng = FG.formateaNumero(l[2], 2).rstrip()
    else: sIng = ''
    if 0.00 != float(l[3]): sEgr = FG.formateaNumero(l[3], 2).rstrip()
    else: sEgr = ''
    st += sColor + l[0].ljust(3) + ' ' + l[1][0:35].ljust(35) +\
			sIng.rjust(15) + sEgr.rjust(15) + CO.FIN + "\n"
# Fin for
  sTotIng = FG.formateaNumero(rTotIng, 2)
  sTotEgr = FG.formateaNumero(rTotEgr, 2)
  sDif    = FG.formateaNumero(rTotIng + rTotEgr, 2)
  st += "%sTOT Ingresos: %s%s%s, Egresos: %s%s%s; Dif: %s%s" % (CO.CYAN,
          CO.VERDE, sTotIng, CO.CYAN, CO.ROJO, sTotEgr, CO.CYAN, CO.FIN, sDif)
  ES.imprime(st.rstrip(' \t\n\r'))
Ejemplo n.º 2
0
def detalles(l, sColor, bCaidas=True, *col):
#  print(l)    
  if (10 == len(l['fecRes'])): fr = l['fecRes'][0:6] + l['fecRes'][-2:]
  else: fr = ''.ljust(8)
  if (10 == len(l['fecFir'])): ff = l['fecFir'][0:6] +l['fecFir'][-2:]
  else: ff = ''.ljust(8)
#  print(col)
  if (l['estatus'] in ('S')):
    if not bCaidas: return ''
    sColor = CO.ROJO
# Cada columna a agregar podria tener dos o seis campos; dos:
# indice de la lista del campo a agregar, longitud de ese campo.
# Si se agregan 6 valores: se compara el segundo (indice de la lista)
# con el valor en el quinto parametro. Si la comparacion es verdadera;
# el campo identificacado en el 1er valor se sumara; luego, se compara
# el cuarto con el quinto. Si la comparacion es verdadera; el campo
# identificacado en 3er valor se sumara. El sexto valor es la longitud.
  sCol = ''
  if (2 == len(col)):
    sCol = FG.formateaNumero(l[col[0]], 2).rjust(col[1])
  elif (6 == len(col)):
    if (l['estatus'] in ('P', 'C')):
      comi = 0.00    
      if (col[4] == l[col[1]]): comi += l[col[0]]
      if (col[4] == l[col[3]]): comi += l[col[2]]
      sCol = FG.formateaNumero(comi, 2).rjust(col[5])
    else: sCol = '0.00'.rjust(col[5])
  return sColor + l['codigo'].ljust(7) + fr.ljust(9) + ff.ljust(9) +\
        l['nombre'][0:20].ljust(21) + str(l['lados']).rjust(2) +\
        (l['moneda'] + FG.formateaNumero(l['precio'])).rjust(11) +\
        FG.formateaNumero(l['prVeRe']).rjust(14) +\
        sCol + CO.FIN + "\n"
Ejemplo n.º 3
0
def selFuncion(ci, nOpcion=6):
    ''' Menu desplegado al suministrar una cedula o al encontrar la cedula de una
      parte de un nombre suministrado.
      Eliminados: ['Calcular cuota', 'cuota'], ['Cedula del socio', 'cedula'],
      ['Buscar cedula del socio', 'nombre'], ['Cheques', 'cheque'],
      ['Deposito por fecha', 'depositos'] '''

    lNuevoMenu = COM.lMenu[nOpcion:(len(COM.lMenu) - 1)] + [[
        'Volver', '-11'
    ]]  # lMenu sin las opciones generales + la opcion 'Volver'.
    sTitulo = str(ci) + ':' + COM.nombreSocio(
        COM.mNombre(ci))  # Titulo a desplegar con las opciones.
    while True:
        try:
            func = eval(
                FG.selOpcionMenu(lNuevoMenu, sTitulo)
            )  # Evaluar contenido de res['name']; el cual, debe ser una funcion conocida.
        except:
            return False
        while True:
            if isinstance(func, types.FunctionType):
                opc = func(
                    ci)  # Si la cadena evaluada es una funcion, ejecutela.
                if FG.esEntero(opc): opc = str(opc)
                if '' == opc or None == opc or not opc.isdigit() or (
                        opc.isdigit() and
                    (0 > int(opc) or len(lNuevoMenu) <= int(opc))):
                    break
                func = eval(lNuevoMenu[int(opc)][1])
            else:
                return False
Ejemplo n.º 4
0
def cargar(mostrar=False, esperar='Espere un momento, por favor...'):
    global control

    if mostrar:
        if droid:
            droid.dialogCreateHorizontalProgress('Century21 Puente Real',
                                                 esperar, 100)
            droid.dialogShow()
            droid.dialogSetCurrentProgress(15)
        else:
            print(esperar)
    Con.prepararListaDeContactos()
    Cli.prepararListaDeClientes()
    Age.prepararListaDeAgendas()
    Tur.prepararListaDeTurnos()
    ASE.prepararListaDeAsesores()
    PRO.prepararListaDePropiedades()
    PRO.prepararListas()  # totales en propiedades.
    if mostrar:
        if droid: droid.dialogSetCurrentProgress(60)
        else: print('Listas listas!')
    COM.prepararDiccionarios()
    fc = open(DIR + COM.CONTROL, 'r')
    if fc: control = fc.read()
    else: control = ''
    if mostrar:
        if droid: droid.dialogSetCurrentProgress(95)
        else: print('Diccionarios listos!')
    if droid and mostrar: FG.limpiarPantalla()
Ejemplo n.º 5
0
def detalleConcepto(ci, sNombre, lCon, lDesc):
    'Muestra el detalle de Concepto de un socio.'
    #  sTitulo = "Detalle de un Concepto"
    sMensaje = ''
    # 0:Cedula, 1:Concepto, 2:Valor fijo, 3: Valor variable, 4:Saldo, 5:Cuota
    sMensaje = "%sSocio: %s %s%s\n" % (
        CO.CYAN, FG.formateaNumero(ci), sNombre.lstrip().split('|')[0], CO.FIN
    )  # Cedula, Nombre, Codigo y descripcion del concepto.
    sVaFij = FG.formateaNumero(lCon[2], 2)  # Valor fijo
    sVaVar = FG.formateaNumero(lCon[3], 2)  # Valor variable
    sSaldo = FG.formateaNumero(lCon[4], 2)  # Saldo
    sCuota = FG.formateaNumero(lCon[5], 2)  # Cuota
    sMensaje += "%sCodigo del Concepto:%s %s\n" % (CO.AZUL, CO.FIN, lCon[1])
    sMensaje += "%sDescripcion:%s %s\n" % (CO.AZUL, CO.FIN, lDesc)
    sMensaje += "%sValor fijo:%s BsF. %*.*s\n" % (CO.AZUL, CO.FIN, len(sVaFij),
                                                  len(sVaFij), sVaFij)
    sMensaje += "%sValor variable:%s BsF. %*.*s\n" % (
        CO.AZUL, CO.FIN, len(sVaVar), len(sVaVar), sVaVar)
    sMensaje += "%sSaldo del Concepto:%s BsF. %*.*s\n" % (
        CO.AZUL, CO.FIN, len(sSaldo), len(sSaldo), sSaldo)
    sMensaje += "%sMonto de la cuota:%s BsF. %*.*s\n" % (
        CO.AZUL, CO.FIN, len(sCuota), len(sCuota), sCuota)
    # Fin for
    opc = ES.imprime(sMensaje.rstrip(' \t\n\r'))
    return opc
Ejemplo n.º 6
0
def lstXEstatus():
  global lPro

  est = COM.selEstatus()
  if ('v' == est): return -1

  nvaLst = []
  for l in lPro:
    if (est != l['estatus']): continue
    nvaLst.append(l)
  # for l in lPro

  nV = tLados = 0
  tPrecios = tPrVeReal = tNetos = 0.00
  bImpar = True
  st = CO.CYAN + COM.dEst[est] + CO.FIN + '\n'
  st += titulo("Neto ofic.", 11)
  for l in nvaLst:
    sColor, bImpar = ES.colorLinea(bImpar, CO.VERDE)
    st += detalles(l, sColor, True, 'ingNeOf', 11)
    nV += 1
    tLados += l['lados']
    tPrecios += l['precio']
    tPrVeReal += l['prVeRe']
    tNetos += l['ingNeOf']
  # for l in nvaLst
  st += CO.AMARI + 'TOTALES:'.ljust(45) +\
        FG.formateaNumero(tLados).rjust(3) +\
        FG.formateaNumero(tPrecios).rjust(11) +\
        FG.formateaNumero(tPrVeReal).rjust(14) +\
        FG.formateaNumero(tNetos, 2).rjust(11) + CO.FIN + "\n"
  st += FG.formateaNumero(len(nvaLst)) + ' negociaciones'

  return ES.imprime(st.rstrip(' \t\n\r'))
Ejemplo n.º 7
0
def mostrarConceptos(dicc, dConc):
  lconc = []
  i = 0
  iMax = '000'
  for ld in dicc.items():
  	lconc.insert(i, ld[0])
  	if ld[0].isdigit() and ld[0] > iMax: iMax = ld[0]	# Concepto con el maximo valor, para saber donde subrayar.
  	i += 1
  lconc.sort()
  bImpar  = True
  st = "%s%s%3s %-20.20s %6.6s %15.15s %15.15s %15.15s %6.6s%s\n" % \
  		(CO.SUBRAYADO, CO.AMARI, 'CLV', 'DESCRIPCION', '#SOCI', 'VALOR FIJO',
                                'VALOR VARIABLE', 'TOTALES', 'PORCEN', CO.FIN)
  for v in lconc:
     if not ((0.00 == dicc[v][1]) and (0.00 == dicc[v][2]) and \
                                                        (0.00 == dicc[v][3])):
       if 'AHO' == v and dicc['AHO'][3] == dicc['TOT'][3]: continue
       if v.isdigit():
         if iMax > v: subrayar = ''
         else: subrayar = CO.SUBRAYADO
       else: subrayar = ''
       if ('TOT' == v): sColor = CO.VERDE
       elif v in ('AHO', 'OTR', 'PRE', 'PR0', 'PR1'): sColor = CO.PURPURA
       else: sColor, bImpar = ES.colorLinea(bImpar, CO.AZUL, CO.CYAN)
       fPorc = 100.00*dicc[v][3]/dicc['TOT'][3]
       st += "%s%s%3s %-20.20s %6.6s %15.15s %15.15s %15.15s %6.6s%s\n" %\
  				(subrayar, sColor, v, dConc.get(v,
            {'des':'NO TENGO DESCRIPCION'})['des'],
  				  FG.formateaNumero(dicc[v][0]),
            FG.formateaNumero(dicc[v][1], 2), 
  				  FG.formateaNumero(dicc[v][2], 2),
            FG.formateaNumero(dicc[v][3], 2),
  				  FG.formateaNumero(fPorc, 2), CO.FIN)
  return st
Ejemplo n.º 8
0
def prestamos(ci):
    '''Maneja la lista de conceptos de prestamos de un socio y
    muestra la informacion.'''
    global lPre

    if 0 >= ci: return -5

    st = CO.AMARI + COM.lFecha("Sinca", "Prestamos") + ' (Descargado:' + \
                          CO.FIN + COM.lFecha('prestamos.txt', '') + ')' + "\n"
    nF = 0
    bImpar = True

    nCarDesc = CO.nCarLin - 26 - 1  # Numero de caracteres (espacio total), donde se mostrara el campo. 26 es resto.
    maxLongCad = 30  # numero maximo de caracteres del campo especificado.
    if maxLongCad < nCarDesc:
        nCarDesc = maxLongCad  # > longitud maxima de la cadena a mostrar en el campo.
    nCarMostrar = 23 + nCarDesc  # Numero de caracteres, maximo, a mostrar por linea.
    sTitPrestamos = CO.AZUL + "CON " + CO.justIzqTituloCol('DESCRIPCION', \
                                            nCarDesc) + "    Saldo  Cuota FeSol"
    if 31 <= (CO.nCarLin - nCarMostrar
              ):  # 31 es la longitud de '     Saldo Saldo+Int Me  #CtCan'.
        sTitPrestamos += ' Monto Sol Saldo+Int Me  #CtCan'
        nCarMostrar += 31
        bExtra = True
    else:
        bExtra = False
    sTitPrestamos += CO.FIN + "\n"
    for l in lPre:
        if 0 == nF and ('' == l[0] or ci > int(l[0])): continue
        elif l[0] in ('', '0', str(ci)):
            nF += 1
            sColor, bImpar = ES.colorLinea(bImpar, CO.VERDE)
            # 0:Cedula,1:Concepto,2:monto solicitado,3:Monto total(Concedido + intereses);4:Saldo;5:Saldo total(Saldo + intereses);6:Cuota,7:Fecha inicial (mm/aa),8:ult actualizacion (mm),9:cuotas (pagadas/total)
            stl = sColor + l[1] + ' ' + \
                    COM.mConcepto(l[1])[0:nCarDesc].ljust(nCarDesc, " ") + ' ' + \
                  FG.formateaNumero(l[4]).rstrip().rjust(9) + \
                    FG.formateaNumero(l[6]).rstrip().rjust(7) + ' ' + \
                    l[7].rstrip().rjust(5)
            if bExtra:
                stl += ' ' + FG.formateaNumero(l[2]).rstrip().rjust(9) + ' ' + \
                   FG.formateaNumero(l[5]).rstrip().rjust(9) + ' ' + \
                        l[8].rstrip().rjust(2) + ' ' + l[9].rstrip().rjust(7)
            stl += CO.FIN
            if 1 == nF:
                stl = CO.CYAN + FG.formateaNumero(ci) + ':' + \
                        COM.nombreSocio(COM.mNombre(ci)) + CO.FIN + "\n" + \
                        sTitPrestamos + stl
            # if '0.00' != l[2].rstrip():		# Comparar, cuando agregar la linea. Solicitado = 0.00. Mes ult. act .vs. fecha.
            st += stl + '\n'
        else:
            break
    # Fin for
    if 0 >= nF: st = COM.noCedula(ci)
    opc = ES.imprime(st.rstrip(' \t\n\r'))
    return opc
Ejemplo n.º 9
0
def mCheque(lChe):
    st = CO.AMARI + COM.lFecha("Sinca", "Cheques")  + ' (Descargado:' + CO.FIN +\
                                      COM.lFecha('cheques.txt', '') + ')' + "\n"
    if '99' == lChe[0]: sDesc = 'TRA'
    elif 6 > len(lChe[1]): sDesc = 'CHQ'
    else: sDesc = 'DEP'
    st += ("Banco:%+10.9s (%-.6s [%s]); Est:%+7.6s\nBeneficiario: "
           "%-12.11s%-30.30s\nConcepto: %-31.30s\nFecha:%+11.10s Monto: "
           "%-15.14s") % (COM.mBanco(lChe[0]), lChe[1], sDesc,
                          COM.mEstado(lChe[7]), FG.formateaNumero(
                              lChe[2]), COM.extraeNombre(lChe[3]), lChe[5],
                          lChe[4], FG.formateaNumero(lChe[6], 2))
    opc = ES.imprime(st.rstrip(' \t\n\r'))
    return opc
Ejemplo n.º 10
0
def ubicacion(ci):
    '''Maneja la lista con los telefonos y correo electronico de cada socio.'''
    global lUb

    if 0 >= ci: return -9

    st = CO.AMARI + COM.lFecha('Sinca', 'Ubicacion') + ' (Descargado:' + CO.FIN \
                                  + COM.lFecha('ubicacion.txt', '') + ')' + "\n"
    nF = 0
    nJustDerecha = 21
    for l in lUb:
        if ci > int(l[0]): continue
        elif ci == int(l[0]):
            st += "%s%s:%-30.29s%s" % (CO.CYAN, FG.formateaNumero(ci),
                                       COM.nombreSocio(
                                           COM.mNombre(ci)), CO.FIN)
            if 1 < len(l) and '' != l[1]:
                st += "\n"
                st += CO.AZUL + "Telefono habitacion: ".rjust(nJustDerecha) + CO.FIN +\
                                                        FG.formateaNumeroTelefono(l[1])
            if 2 < len(l) and '' != l[2]:
                st += "\n"
                st += CO.AZUL + "Telefono trabajo: ".rjust(nJustDerecha) + CO.FIN +\
                                                        FG.formateaNumeroTelefono(l[2])
            if 3 < len(l) and '' != l[3]:
                st += "\n"
                st += CO.AZUL + "Celular: ".rjust(nJustDerecha) + CO.FIN +\
                                                        FG.formateaNumeroTelefono(l[3])
            if 4 < len(l) and '' != l[4]:
                st += "\n"
                st += CO.AZUL + "Celular: ".rjust(nJustDerecha) + CO.FIN +\
                                                        FG.formateaNumeroTelefono(l[4])
            if 5 < len(l) and '' != l[5]:
                if len(l[5].rstrip(' \t\n\r')) > (
                        CO.nCarLin - nJustDerecha - 1
                ):  # Cars a justificar derecha + 1 espacio despues ':'.
                    nJustDerecha = CO.nCarLin - len(l[5].rstrip(' \t\n\r')) - 1
                st += "\n"
                st += CO.AZUL + "Correo:".rjust(nJustDerecha) + CO.FIN + " %s" %\
                                                              l[5].rstrip(' \t\n\r')
            nF += 1
# Fin elif
        else:
            break
# Fin for
    if 0 >= nF: st = COM.noCedula(ci)
    opc = ES.imprime(st)
    return opc
Ejemplo n.º 11
0
def selFuncionInicial(
        nOpciones=7):  # nOpciones: Primeras opciones de lMenu a desplegar.
    ''' Menu desplegado al inicio. nOpciones = 6: <Cuota>, <Comisiones>,
    <Nombre> ..... y <Salir>. '''

    return FG.selOpcionMenu(lMenu[0:nOpciones] + lMenu[(len(lMenu) - 1):],
                            'Inicio')
Ejemplo n.º 12
0
def chequeXCedula(ci, llCh=None):
    'Maneja la lista de cheques y muestra los cheques en transito de un socio.'
    global lCh
    if None == llCh: llCh = lCh

    if 0 >= ci: return -2

    lCheq = [l for l in llCh
             if '' != l[2] and ci == int(l[2])]  # Nueva lista de cheques.
    if not lCheq:
        ES.alerta(
            droid, 'CHEQUE x CEDULA', "No hay cheque en transito con cedula "
            "%s!" % FG.formateaNumero(ci))
        return -2
    nCheques = len(lCheq)
    if 1 == nCheques:
        return mCheque(lCheq[0])
#  lCheq = map(creaOp, lCheq)  # En vez de list 'comprehensions', como en lCheques.
    lCheqO = list(
        map(COM.creaOp,
            lCheq))  # En vez de list 'comprehensions', como en lCheques.
    indice = ES.entradaConLista(droid, 'CHEQUES ENCONTRADOS: ' + str(nCheques),
                                'Seleccione cheque', lCheqO)
    if None == indice or 0 > indice: return -2
    mCheque(lCheq[indice])
Ejemplo n.º 13
0
def selEstatus():
    global dEst

    lEst = [(dEst[key], key) for key in dEst]
    st = FG.selOpcionMenu(lEst + [['Volver', 'v']], 'Estatus')

    return st
Ejemplo n.º 14
0
def mostrarConceptos(dicc, dConc):

    lconc = []
    i = 0
    sMax = '000-0-0-0'
    for ld in dicc.items(
    ):  # el metodo items(), devuelve una lista de dicc's (llave, valor) tupla pares
        lconc.insert(i, ld[0])
        if ld[0][0:3].isdigit() and ld[0] > sMax:
            sMax = ld[
                0]  # Concepto con el maximo valor, para saber donde subrayar.
        i += 1
    lconc.sort()
    bImpar = True
    st = "%s%s%9s %-20.20s %6.6s %15.15s %15.15s %6.6s%s\n" % \
        (CO.SUBRAYADO, CO.AMARI, 'CLAVE', 'DESCRIPCION', '#MOVI', '     Saldo',
                                              '         Cuota', 'PORCEN', CO.FIN)
    for v in lconc:
        if not ((0.00 == dicc[v][1]) and
                (0.00 == dicc[v][2])) or ('3' == v[6:7]):
            if v[0:3].isdigit() and v[4:5].isdigit() and v[6:7].isdigit() and \
                 v[8:].isdigit():
                if sMax == v: subrayar = CO.SUBRAYADO
                else: subrayar = ''
            else: subrayar = ''
            if ('TOT' == v): sColor = CO.VERDE
            elif ('AHO' == v): sColor = CO.PURPURA
            elif ('ELI' == v): sColor = CO.ROJO
            elif ('OTR' == v): sColor = CO.PURPURA
            else: sColor, bImpar = ES.colorLinea(bImpar, CO.AZUL, CO.CYAN)
            if 0 == dicc['TOT'][1]: fPorc = 0.00
            else: fPorc = 100.00 * dicc[v][1] / dicc['TOT'][1]
            sConc = v[0:3]
            if '3' == v[6:7]: sObs = CO.ROJO + 'Eli'
            elif '2' == v[6:7]: sObs = 'Mod'
            elif '1' == v[6:7]: sObs = 'Cre'
            else: sObs = ''
            st += "%s%s%9s %-20.20s %6.6s %15.15s %15.15s %6.6s %s%s\n" % (
                subrayar, sColor, v,
                dConc.get(sConc, {'des': 'NO TENGO DESCRIPCION'})['des'],
                FG.formateaNumero(dicc[v][0]), FG.formateaNumero(
                    dicc[v][1], 2), FG.formateaNumero(dicc[v][2], 2),
                FG.formateaNumero(fPorc, 2), sObs, CO.FIN)

    return st
Ejemplo n.º 15
0
def prepLnMon(desc, num, dec=0, ln='', mon='$'):
    try:
        if (0 != num):            return ("%s%s:%s %" + ln + "s\n")\
           % (CO.AZUL, desc, CO.FIN, FG.numeroMon(num, dec, mon))
        else:
            return ''
    except TypeError:
        muestraError('prepLnMon', desc, num, ln, dec)
        return ''
Ejemplo n.º 16
0
def prepLnTel(desc, tel, ln=''):
    try:
        if ('' != tel):            return ("%s%s:%s %" + ln + "s\n")\
        % (CO.AZUL, desc, CO.FIN, FG.formateaNumeroTelefono(tel))
        else:
            return ''
    except TypeError:
        muestraError('prepLnTel', desc, tel, ln)
        return ''
Ejemplo n.º 17
0
def prepLnPorc(desc, num, dec=0, ln=''):
    try:
        if (0 != num):            return ("%s%s:%s %" + ln + "s\n")\
                 % (CO.AZUL, desc, CO.FIN, FG.numeroPorc(num, dec))
        else:
            return ''
    except TypeError:
        muestraError('prepLnPorc', desc, num, ln, dec)
        return ''
Ejemplo n.º 18
0
def prepLnNum(desc, num, dec=0, ln=''):
    #  print(CO.ROJO + 'DESC EN <prepLnNum>:' + CO.FIN, desc, num, dec, ln)
    try:
        if (0 != num):            return ("%s%s:%s %" + ln + "s\n")\
                 % (CO.AZUL, desc, CO.FIN, FG.formateaNumero(num, dec))
        else:
            return ''
    except TypeError:
        muestraError('prepLnNum', desc, num, ln, dec)
        return ''
Ejemplo n.º 19
0
def mNombre(ci):

    try:
        sNombre = dPer.get(str(ci), "NO")
    except UnicodeError:
        sNombre = "UnicodeError: " + ci
    if ("NO" == sNombre):
        sNombre = "NO ENCONTRE EL NOMBRE"
        ES.alerta(droid, 'SOCIO ERROR', FG.formateaNumero(ci) + ', ' + sNombre)
    return sNombre
Ejemplo n.º 20
0
def lstXAsesor():
  global lPro

  id = FG.selOpcionMenu(ASE.lNAs + [['Volver', -2]], 'Asesor')
  if (0 > id): return id

  nvaLst = []
  for l in lPro:
    if not (isinstance(l['asCapId'], int)) or \
       not (isinstance(l['asCerId'], int)) or \
       ((id != l['asCapId']) and (id != l['asCerId'])):
      continue
    nvaLst.append(l)
  # for l in lPro

  tPrecios = tPrVeReal = tCap = tCer = 0.00
  nF = nV = tLados = 0
  bImpar = True
  st = CO.CYAN + ASE.lAse[id-1]['name'] + CO.FIN + '\n'
  st += titulo("Comision", 10)
  for l in nvaLst:
    sColor, bImpar = ES.colorLinea(bImpar, CO.VERDE)
    st += detalles(l, sColor, True, 'capPrbr', 'asCapId',
                        'cerPrbr', 'asCerId', id, 10)
    if (l['estatus'] not in ('P', 'C')): continue
    nV += 1
    tLados += l['lados']
    tPrecios += l['precio']
    tPrVeReal += l['prVeRe']
    if (id == l['asCapId']):
      try: tCap += float(l['capPrbr'])    
      except: pass
    if (id == l['asCerId']):
      try: tCer += float(l['cerPrbr'])    
      except: pass
  # Fin for
  st += CO.AMARI + 'TOTALES:'.ljust(45) +\
        FG.formateaNumero(tLados).rjust(3) +\
        FG.formateaNumero(tPrecios).rjust(11) +\
        FG.formateaNumero(tPrVeReal).rjust(14) +\
        FG.formateaNumero(tCap+tCer, 2).rjust(10) + CO.FIN + "\n"
  st += CO.AMARI + FG.formateaNumero(len(nvaLst)) +\
        ' negociaciones [' + FG.formateaNumero(nV) + ' validas]. ' +\
        'Total captado: ' + FG.formateaNumero(tCap, 2) +\
        ' y cerrado: ' + FG.formateaNumero(tCer, 2) + CO.FIN

  return ES.imprime(st.rstrip(' \t\n\r'))
Ejemplo n.º 21
0
def selMes(lTMe, incluirTodos=False):

    if incluirTodos: nvaLst = [['Todos', 't']]
    else: nvaLst = []
    for l in lTMe:
        nvaLst.append([l[0][0:4] + ' ' + CO.meses[int(l[0][5:])], l[0]])
    mes = FG.selOpcionMenu(nvaLst + [['Volver', 'v']], 'Mes')
    if ('v' == mes): return 'v', 'v'
    if ('t' == mes): return 't', 't'

    return mes[0:4], mes[5:]
Ejemplo n.º 22
0
    def __init__(self, file_name, sheetname):
        if file_name[:1] != '\\':
            self.filePath = General.get_absolute_path(file_name[:])
        else:
            self.filePath = file_name
        logger.info('\n' +self.filePath, False, True)

        'Loading the workbook'
        self.sheetName = sheetname
        self.wb = load_workbook(self.filePath, False)
        self.sheet = self.wb.get_sheet_by_name(self.sheetName)
Ejemplo n.º 23
0
def mSocio(Nombre, ci, bCadena=True):
    global dPer

    if (bCadena):
        l = Nombre.rstrip().split(
            '|'
        )  # Nombre, nucleo, fecha de nacimiento, Disponibilidad y Extension
    else:
        l = Nombre[1:]

    if (bCadena): sFecha = lFecha()
    else: sFecha = Nombre[len(Nombre) - 1]
    st = CO.AMARI + sFecha + ' (Descargado:' + CO.FIN +\
          lFecha('persona.txt', '') + ')' + "\n" + CO.AZUL +\
          "Cedula:".rjust(21) + CO.FIN
    if (bCadena): st += " %s" % (FG.formateaNumero(ci))
    else: st += " %s" % Nombre[0]
    nJustDerecha = 21
    if 0 < len(l) and '' != l[0]:
        if len(l[0].rstrip(' \t\n\r')) > (
                CO.nCarLin - nJustDerecha -
                1):  # Cars a justificar derecha + 1 espacio despues ':'.
            nJustDerecha = CO.nCarLin - len(l[0].rstrip(' \t\n\r')) - 1
        st += "\n"
        st += CO.AZUL + "Nombre:".rjust(nJustDerecha) + CO.FIN + " %s" %\
                                                          (l[0].rstrip(' \t\n\r'))
    nJustDerecha = 21
    if 1 < len(l) and '' != l[1]:
        st += "\n" + CO.AZUL + "Nucleo:".rjust(nJustDerecha) + CO.FIN
        if (bCadena):
            st += " %s" % (CO.dNucleo.get(l[1], 'ESTA ERRADO EN LA BD'))
        else:
            st += " %s" % (l[1])
    if 2 < len(l) and '' != l[2]:
        st += "\n" + CO.AZUL + "Fecha de nacimiento:".rjust(
            nJustDerecha) + CO.FIN
        if (bCadena): st += " %2s/%2s/%4s" % (l[2][0:2], l[2][2:4], l[2][4:])
        else: st += " %s" % (l[2])
    if 3 < len(l) and '' != l[3]:
        st += "\n"
        st += CO.AZUL + "Disponibilidad:".rjust(nJustDerecha) + CO.FIN + " %s" %\
                                                                            (l[3])
    if 4 < len(l) and '' != l[4]:
        st += "\n" + CO.AZUL + "Extension:".rjust(nJustDerecha) + CO.FIN
        if (bCadena): st += " %s" % (CO.dExtension.get(l[4], 'ERRADA'))
        else: st += " %s" % (l[4])
    if not bCadena:
        st += "\n" + CO.AZUL + "Fe ingreso IPASPUDO:".rjust(nJustDerecha) +\
                                                          CO.FIN + " %s" % (l[5])
        st += "\n" + CO.AZUL + "Servicio funerario:".rjust(nJustDerecha) +\
                                                          CO.FIN + " %s" % (l[6])
    opc = ES.imprime(st)
    return opc
Ejemplo n.º 24
0
def disponibilidad(ci):
    'Maneja la lista de conceptos de un socio y muestra la informacion.'
    global lSi

    dConc = CO.dConceptos
    sNombre = COM.mNombre(ci)
    if 0 >= ci: return -4

    st = CO.AMARI + COM.lFecha("Sinca", "Disponibilidad") + ' (Descargado:' + \
          CO.FIN + COM.lFecha('disponibilidad.txt', '') + ')' + "\n" # 'Conta' se refiere al sistema de contabilidad.
    nF = 0  # Numero de registros de una misma persona (socio)
    for l in lSi:
        if 0 == nF and ('' == l[0] or ci > int(l[0])): continue
        elif l[0] in ('', '0', str(ci)):
            nF += 1
            if l[1] in dConc:
                if '0' == l[1]:                    stl = CO.AZUL + dConc[l[1]].rstrip().rjust(20) + \
                                  CO.FIN + ': ' + l[2].rstrip().ljust(12)
                elif l[1] in ('D', 'E', 'F'):
                    stl = CO.AZUL
                    if 55 <= CO.nCarLin:
                        stl += ('NETO NOMINA ' +
                                dConc[l[1]]).rstrip().rjust(20)
                    else:
                        stl += dConc[l[1]].rstrip().rjust(9)
                    stl += CO.FIN + ': '
                    if (6 <= len(l)):
                        stl += FG.formateaNumero(l[2]) + '-' + FG.formateaNumero(l[3]) + \
                                ' = ' + FG.formateaNumero(l[4], 2) + '(' + \
                                                            FG.formateaNumero(l[5]) + '%)'
                else:
                    stl = CO.AZUL + dConc[l[1]].rstrip().rjust(20) + CO.FIN + ': ' + \
                                          FG.formateaNumero(l[2], 2).rstrip().ljust(12)
                if 1 == nF:
                    stl = CO.CYAN + FG.formateaNumero(ci) + ':' + \
                                          COM.nombreSocio(sNombre) + CO.FIN + "\n" + stl
#        if 'B' == l[1]: disp = l[2].rstrip().rjust(12)
            else:
                stl = l[2].rstrip() + ' DESCONOCIDO (' + l[1] + ')'
            if '0.00' != l[2].rstrip() or 'A' == l[1]:
                st += stl + '\n'
            if 'C' == l[1] and 55 > CO.nCarLin:
                st += CO.CYAN + 'N E T O S'.rjust(int((CO.nCarLin-9)/2)+9) + '\n' + \
                                                            CO.FIN # 9 es la longitud de 'N E T O S'
        else:
            break
# Fin for
    if 0 >= nF: st = COM.noCedula(ci)
    else:
        st += CO.AZUL + ('Dividendo ' + CO.anoDividendo).rjust(20) + CO.FIN + \
                  ': ' + FG.formateaNumero(COM.mDividendo(ci), 2).ljust(12) + '\n'
#    ES.alerta(droid, 'DISPONIBILIDAD', '%s: %12s' % (sNombre, FG.formateaNumero(disp, 2)))
    opc = ES.imprime(st.rstrip(' \t\n\r'))
    return opc
Ejemplo n.º 25
0
def xNegociacion():
  global lPro
  lNeg = [(COM.dNeg[key], key) for key in COM.dNeg]

  ng = FG.selOpcionMenu(lNeg + [['Volver', 'v']], 'Negociacion')
  if ('v' == ng): return ng

  lCod = []
  for l in lPro:
    if (ng != l['negoc']): continue
    lst = (l['codigo']+'-'+l['nombre'], l['id']-1)
    lCod.append(lst)
  # for l in lPro

  return mPropiedad(lCod, COM.dNeg[ng])
Ejemplo n.º 26
0
def detTotales(cad, lados, pvr, cap, cer, lCap, lCer, bImpar, tam=20,
                color=False):
  if (0 == lados) and (0 == cap) and (0 == cer) and (0 == lCap) and\
      (0 == lCer):
    return bImpar, ''
  (sColor, bImpar) = (color, not bImpar) if (color) else\
                                        ES.colorLinea(bImpar, CO.VERDE)
  return bImpar, sColor + cad[0:tam-1].ljust(tam) +\
        FG.formateaNumero(lados).rjust(4) +\
        FG.formateaNumero(pvr, 2).rjust(14) +\
        FG.formateaNumero(cap+cer, 2).rjust(12) +\
        (FG.formateaNumero(cap, 2) + '(' +\
        FG.formateaNumero(lCap) + ')').rjust(15) +\
        (FG.formateaNumero(cer, 2) + '(' +\
        FG.formateaNumero(lCer) + ')').rjust(15) + CO.FIN + "\n"
Ejemplo n.º 27
0
def totTotales(tipoTot, tLados, tPvr, tCap, tCer, tLaCap, tLaCer,
                tam=20, subrayar=False, mTPrecioVentaRea=True):
  '''
    Muestra la linea de totales de los totales. Se subraya antes
    del penultimo subtotal, si existe, antes del total de la oficina.
    mTPrecioVentaReal indica si se debe mostrar el precio de venta real
    de la oficina. En el caso de ambos lados en la oficina.
  '''
  return CO.AMARI + (CO.SUBRAYADO if subrayar else '') +\
        tipoTot.ljust(tam) + FG.formateaNumero(tLados).rjust(4) +\
        FG.formateaNumero(tPvr, 2).rjust(14) +\
        FG.formateaNumero(tCap+tCer, 2).rjust(12) +\
        (FG.formateaNumero(tCap, 2) + '(' +\
        FG.formateaNumero(tLaCap) + ')').rjust(15) +\
        (FG.formateaNumero(tCer, 2) + '(' +\
        FG.formateaNumero(tLaCer) + ')').rjust(15) + CO.FIN + "\n"
Ejemplo n.º 28
0
def selOpcion(Menu, descr):
    menu = Menu

    opc = FG.selOpcionMenu(menu + [['Volver', -1]], descr)
    if isinstance(opc, int) and 0 > int(opc): return opc
    else:
        if (0 == opc.find('PRO')): from c21 import Propiedades as PRO
        elif (0 == opc.find('Con')): from c21.Contacto import Contacto as Con
        elif (0 == opc.find('Cli')): from c21.Cliente import Cliente as Cli
        elif (0 == opc.find('Tur')): from c21.Turno import Turno as Tur
        elif (0 == opc.find('Age')): from c21.Agenda import Agenda as Age
        func = eval(
            opc
        )  # Evaluar contenido de opc; el cual, debe ser una funcion conocida.
        if isinstance(func, types.FunctionType):
            return func()  # Si la cadena evaluada es una funcion, ejecutela.
        else:
            return opc
Ejemplo n.º 29
0
def xAsesor():
  global lPro

  id = FG.selOpcionMenu(ASE.lNAs + [['Volver', -2]], 'Asesor')
  if (0 > id): return id

  lCod = []
  for l in lPro:
    if not (isinstance(l['asCapId'], int)) or \
       not (isinstance(l['asCerId'], int)):
      continue
    if (id != l['asCapId']) and (id != l['asCerId']): continue
    if ('S' == l['estatus']): caida = 'Caida: '
    else: caida = ''
    lst = (caida+l['codigo']+'-'+l['nombre'], l['id']-1)
    lCod.append(lst)
  # for l in lPro

  return mPropiedad(lCod, ASE.lAse[id-1]['name'])
Ejemplo n.º 30
0
def cumpleanos(mostrar=True):
  from datetime import date
  global lAse

  hoy = date.today()
  proxDia, proxMes, proxAno, enUnMes = calcProxMes()
  bImpar = True
  titulo = CO.CYAN + 'Proximos cumpleaneros' + CO.FIN + '\n'
  st = ''
  indices = []
#  lClas = sorted(lAse, key = lambda k: k['fecha_nacimiento'])  # Problemas con valures null.
  lClas = sorted(lAse, key = lambda k: (k['fecha_nacimiento'][5:10] \
                        if k['fecha_nacimiento'] else ''))
  for l in lClas:
    if not l['fecNac']: continue
    fecNac = l['fecNac']
    anoNac, mesNac, diaNac, dSemNac =\
                              FG.descomponeFecha(l['fecNac'])
    fecCump = date(proxAno, mesNac, diaNac)
    diaSem  = CO.semana[fecCump.weekday()]
    if fecCump == hoy:
      indices.append([l['id'], l['name'], fecCump])
      if mostrar:
        st += CO.AMARI + l['name'] + ': ' + 'HOY, ' + diaSem + ' ' +\
              fecNac[0:2] + ' de ' + CO.meses[mesNac] + CO.FIN + '\n'
      # FIN if mostrar
    elif hoy < fecCump <= enUnMes:
      if mostrar:
        sColor, bImpar = ES.colorLinea(bImpar, CO.VERDE)
        st += sColor + l['name'] + ': ' + diaSem + ' ' +\
              fecNac[0:2] + ' de ' + CO.meses[mesNac] + CO.FIN + '\n'
      # FIN if mostrar
    # FIN if fecCump == hoy
  # FIN for l in lClas
  if mostrar:
    if (st): st = titulo + st
    else: st = CO.CYAN + 'No hay cumpleaneros proximamente.' +\
                CO.FIN + '\n'
    return ES.imprime(st.rstrip(' \t\n\r'))
  else: return indices
Ejemplo n.º 31
0
def cargarFilas(lTot, nroReg, iNoReg1, iNoReg2, fMtoTot, iMtoTot1, iMtoTot2,
                sNumLote, sRif, sFechaValor):
    global bMerc, bMProv, bBan, bVzla, sCodCta

    st = ''
    if (bMerc or bMProv or bBan) and int(nroReg) != lTot[0]:
        st += ("%sError:%s El numero de registros de la primera(Mercantil)/"
               "ultima(Banesco) fila no concuerda con el numero de registros "
               "detalle.\n") % (CO.ROJO, CO.FIN)
        st += ("%sValor entre columnas %s y %s "
               "del primer/ultimo registro:%s %s%s%s.\n") % (
                   CO.AZUL, str(iNoReg1 + 1), str(iNoReg2), CO.FIN, CO.ROJO,
                   nroReg, CO.FIN)
        st += "%sNumero total de registros de detalle:%s %s%d%s.\n" % (
            CO.AZUL, CO.FIN, CO.ROJO, lTot[0], CO.FIN)
    if 0.005 < abs(fMtoTot - lTot[1]):
        st += (
            "%sError:%s El monto total de la primera fila no concuerda con la "
            "suma del monto total de depositos.\n") % (CO.ROJO, CO.FIN)
        st += "Valor entre columnas " + str(iMtoTot1) + " y " + str(iMtoTot2) + \
                " del primer registro: " + \
               (FG.formateaNumero(fMtoTot, 2) if FG.formateaNumero(fMtoTot, 2)
                else str(fMtoTot)) + '.\n'
        st += "Monto total de depositos en registros de detalle: " + \
                (FG.formateaNumero(lTot[1], 2) if FG.formateaNumero(lTot[1], 2)
                 else str(lTot[1])) + '.\n'
    if bMerc or bMProv or bBan:
        st += "%sNumero de lote:%s %s%s%s\n" % (CO.AZUL, CO.FIN, CO.CYAN,
                                                sNumLote, CO.FIN)
    if bMerc or bMProv or bBan:
        st += "%sRif:%s %s%s%s\n" % (CO.AZUL, CO.FIN, CO.CYAN,
                                     sRif[0:1] + '-' + sRif[1:], CO.FIN)
    if bMerc or bMProv or bBan:        st += "%sFecha valor:%s %s%s%s\n" % (CO.AZUL,
              CO.FIN, CO.CYAN, sFechaValor[6:] + '/' +\
              sFechaValor[4:6] + '/' +sFechaValor[0:4],
              CO.FIN)
    elif bVzla:
        st += "%sFecha valor:%s %s%s%s\n" % (CO.AZUL, CO.FIN, CO.CYAN,
                                             sFechaValor, CO.FIN)
    st += "%sCodigo de cuenta bancaria:%s %s%s%s.\n" % (
        CO.AZUL, CO.FIN, CO.CYAN, sCodCta[0:4] + '-' + sCodCta[4:8] + '-' +
        sCodCta[8:10] + '-' + sCodCta[10:], CO.FIN)
    st += "%sSe deposita a %d socios, la cantidad de %s bolivares.%s\n" % \
          (CO.VERDE, lTot[0],
           (FG.formateaNumero(lTot[1], 2) if FG.formateaNumero(lTot[1], 2)
            else lTot[1]), CO.FIN)
    return st
Ejemplo n.º 32
0
import os
import time
import random
from lib import General

USER = os.environ['USERNAME']
CURRENT_TIME = time.asctime()
UNIQUESTRING = time.time()

if time.localtime()[3] > 12:
    AFTERNOON = True
else:
    AFTERNOON = False
    
import math as _math

def _get_area(diameter):
    radius = diameter /2.0
    area = _math.pi * radius * radius
    return area
AREA1 = _get_area(1)
AREA2 = _get_area(2)

FF_PROFILE = General.get_absolute_path('Browser/ff_profile')
Ejemplo n.º 33
0
 def import_contact_by_uploading_file(self, file_path):
     abs_path = General.get_absolute_path(file_path)
     self._selenium2Library.choose_file(self.elements['txtImportFile'], abs_path)