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 muestra(self, imp=True):
   dic  = Cliente.dic
   sMsj = ''
   for campo in dic:
       if dic[campo] and hasattr(self, campo):
           sMsj += COM.prepLnMsj(dic, self, campo)
   if sMsj: opc = ES.imprime(sMsj.rstrip(' \t\n\r'))
Ejemplo n.º 3
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.º 4
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.º 5
0
def totales():
  ''' 0:filas, 1:tPrecio, 2:tLados, 3:tCompartidoConIva,
      4:tFranquiciaSinIva, 5:tFranquiciaConIva, 6:tFranquiciaPagarR,
      7:tRegalia, 8:tSanaf5PorCiento, 9:tOficinaBrutoReal,
      10:tBaseHonorariosSo, 11:tBaseParaHonorari, 12:tCaptadorPrbr,
      13:tGerente, 14:tCerradorPrbr, 15:tBonificaciones,
      16:tComisionBancaria, 17:tIngresoNetoOfici, 18:tPrecioVentaReal,
      19:tPuntos, 20:tCaptadorPrbrSel, 21:tCerradorPrbrSel,
      22:tLadosCap, 23:tLadosCer, 24:tPvrCaptadorPrbrSel,
      25:tPvrCerradorPrbrSel, 26:tPuntosCaptador, 27:tPuntosCerrador
  '''
  global lTot

  if not lTot: return

  sMsj = ("%d %snegociaciones validas%s\n") % (lTot[0], CO.AZUL, CO.FIN)
  sMsj += ("%sTOTALES:%s\n") % (CO.CYAN, CO.FIN)
  sMsj += COM.prepLnNum("Precio", lTot[1], 2)
  sMsj += COM.prepLnNum("Compartido con IVA", lTot[3], 2)
  sMsj += COM.prepLnNum("Lados", lTot[2])
  sMsj += COM.prepLnNum("Franquicia a pagar reportada", lTot[6], 2)
  sMsj += COM.prepLnNum("Asesor captador PrBr", lTot[12], 2)
  sMsj += COM.prepLnNum("Gerente", lTot[13], 2)
  sMsj += COM.prepLnNum("Asesor cerrador PrBr", lTot[14], 2)
  sMsj += COM.prepLnNum("Bonificaciones", lTot[15], 2)
  sMsj += COM.prepLnNum("Comisiones bancarias", lTot[16], 2)
  sMsj += COM.prepLnNum("Ingreso neto de la oficina", lTot[17], 2)
  sMsj += COM.prepLnNum("Precio de venta real", lTot[18], 2)
  sMsj += COM.prepLnNum("Puntos", lTot[19], 2)
  opc = ES.imprime(sMsj.rstrip(' \t\n\r'))

  return opc
Ejemplo n.º 6
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.º 7
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.º 8
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.º 9
0
 def muestra(self, imp=True):
     dic = Turno.dic
     sMsj = ''
     for campo in dic:
         if dic[campo] and hasattr(self, campo):
             if (campo in ('user_id', 'user_creo')):
                 val = getattr(self, campo)
                 sMsj += COM.prepLnCad(dic[campo][0], '[' + str(val) + '] ' +\
                                       ASE.nombreAsesor(val))
             else:
                 sMsj += COM.prepLnMsj(dic, self, campo)
     if sMsj: opc = ES.imprime(sMsj.rstrip(' \t\n\r'))
Ejemplo n.º 10
0
def ganYperXmes():
  'Lee los datos de ganancias y perdidas por mes y los despliega'
  global lGyPxM

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

  sTitPrestamos = CO.AZUL + "MES" + "Ingresos".rjust(15) + "FACTOR".rjust(7) +\
            "Egresos".rjust(15) + "FACTOR".rjust(7) + "Resultado".rjust(15) +\
                                              "FACTOR".rjust(8) + CO.FIN + "\n"
  st = sTitPrestamos
  rTotIng = float(lGyPxM[len(lGyPxM)-1][1])
  rTotEgr = float(lGyPxM[len(lGyPxM)-1][2])
  for l in lGyPxM:
      nF += 1
      sColor, bImpar = ES.colorLinea(bImpar, CO.VERDE)
# 0:Mes,1:Ingresos,2:Egresos,3:Resultado
      if 0.00 != rTotIng: fcti = float(l[1])/rTotIng
      else: fcti = 0.00
      if 0.00 != rTotEgr: fcte = float(l[2])/rTotEgr
      else: fcte = 0.00
      if 0.00 != float(l[1]): fct = float(l[2])/float(l[1])
      else: fct = 0.00
      if 13 > int(l[0]): sMes = str(l[0])
      else: sMes = 'TO'
      if 1 >= abs(fct): sColorFactor = ''
      else: sColorFactor = CO.FIN + CO.ROJO
      st += sColor + sMes.rjust(2) + ' ' +\
		FG.formateaNumero(l[1], 2).rstrip().rjust(15) +\
		FG.formateaNumero(fcti, 3).rstrip().rjust(7) +\
		FG.formateaNumero(l[2], 2).rstrip().rjust(15) +\
		FG.formateaNumero(fcte, 3).rstrip().rjust(7) +\
		FG.formateaNumero(l[3], 2).rstrip().rjust(15) +\
		sColorFactor +\
		FG.formateaNumero(fct, 3).rstrip().rjust(8) +\
		CO.FIN + "\n"
# Fin for
  ES.imprime(st.rstrip(' \t\n\r'))
Ejemplo n.º 11
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.º 12
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.º 13
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.º 14
0
def totAsesor():
  ''' Agregar 1, correspondiente a el 'id' del asesor.
      0:filas, 1:tPrecio, 2:tLados, 3:tCompartidoConIva,
      4:tFranquiciaSinIva, 5:tFranquiciaConIva, 6:tFranquiciaPagarR,
      7:tRegalia, 8:tSanaf5PorCiento, 9:tOficinaBrutoReal,
      10:tBaseHonorariosSo, 11:tBaseParaHonorari, 12:tCaptadorPrbr,
      13:tGerente, 14:tCerradorPrbr, 15:tBonificaciones,
      16:tComisionBancaria, 17:tIngresoNetoOfici, 18:tPrecioVentaReal,
      19:tPuntos, 20:tCaptadorPrbrSel, 21:tCerradorPrbrSel,
      22:tLadosCap, 23:tLadosCer, 24:tPvrCaptadorPrbrSel,
      25:tPvrCerradorPrbrSel, 26:tPuntosCaptador, 27:tPuntosCerrador
  '''
  global lTAs

  st = titTotales('Asesor', 20)
  bImpar = True
  tLaCap = tLaCer = 0
  tPrVeReal = tCap = tCer = 0.00
  for l in lTAs:
    try:
      bImpar, cad = detTotales(ASE.nombreAsesor(l[0]), l[23]+l[24],
                          l[25]+l[26], l[21], l[22], l[23], l[24], bImpar, 20)
      st += cad
    except TypeError:
      print('ERROR detalle:')
      print(l)
    try:
      if (1 < int(l[0])):   # l[0] es el 'id' del asesor.
        tPrVeReal, tCap, tCer = tPrVeReal+l[25]+l[26], tCap+l[21], tCer+l[22]
        tLaCap, tLaCer = tLaCap+l[23], tLaCer+l[24]
    except:
      print('ERROR totales:', ASE.nombreAsesor(l[0]) + ' => ',
            'filas:', l[1], '; Precio:', l[2], '; lados:', l[3],
            '; PVR:', l[19], '; Puntos:', l[20], '; asesor Cap:', l[21],
            '; asesor Cer:', l[22], '; lados Cap:', l[23],
            '; lados Cer:', l[24], '; PVR Cap:', l[25],
            '; PVR Cer:', l[26], sep='')
  try:
    st += totTotales('Total Oficina', tLaCap + tLaCer, tPrVeReal,\
                          tCap, tCer, tLaCap, tLaCer, 20, False, False)
  except:
    print('ERROR linea totales:')
    print(tCap, tCer, tLaCap, tLaCer)
  opc = ES.imprime(st.rstrip(' \t\n\r'))
  return opc
Ejemplo n.º 15
0
 def muestra(self, imp=True):
     dic = Contacto.dic
     sMsj = ''
     for campo in dic:
         if dic[campo] and hasattr(self, campo):
             val = getattr(self, campo)
             if ('user_id' == campo):
                 sMsj += COM.prepLnCad(dic[campo][0], '[' + str(val) + '] ' +\
                                       ASE.nombreAsesor(val))
             elif (campo in ('deseo_id', 'tipo_id', 'zona_id', 'precio_id',\
                             'origen_id', 'resultado_id')):
                 func = 'COM.desc' + campo[0:campo.find('_id')].capitalize(
                 )  # Puedo usar'_', pero '_id' es mas descriptivo.
                 func += '(str(' + str(val) + '))'
                 sMsj += COM.prepLnCad(dic[campo][0], '[' + str(val) + '] ' +\
                                       eval(func))
             else:
                 sMsj += COM.prepLnMsj(dic, self, campo)
     if sMsj: opc = ES.imprime(sMsj.rstrip(' \t\n\r'))
Ejemplo n.º 16
0
def servicioEspecifico(sCodigo, sNombre):
  '''Muestra las indemnizaciones de ServiFun usando
    la lista con los parentesco.'''
  global lPa
  #  sTitulo = "Servifun"
  sMensaje = ''
  for l in lPa:
    if sCodigo != l[0]: continue			# Codigo del parentesco
    sMensaje  = "%sServicios p/(%s) %s: %s%s\n" % (CO.CYAN, l[0], l[1],
                        sNombre.lstrip().split('|')[0], CO.FIN)	# Codigo, descripcion del parentesco
    if 14 <= len(l): rLp = int(l[13]) * float(CO.UT)			# Lapida
    else: rLp = 0
    sLp = FG.formateaNumero(rLp, 2)		# Lapida formateado
    if 13 <= len(l): rCr = int(l[12]) * float(CO.UT)			# Cremacion
    else: rCr = 0
    sCr = FG.formateaNumero(rCr, 2)		# Cremacion formateado
    if 12 <= len(l): rFo = int(l[11]) * float(CO.UT)			# Fosa
    else: rFo = 0
    sFo = FG.formateaNumero(rFo, 2)		# Fosa formateado
    if 11 <= len(l): rTr = int(l[10]) * float(CO.UT)			# Traslado
    else: rTr = 0
    sTr = FG.formateaNumero(rTr, 2)		# Traslado formateado
    if 10 <= len(l): rSv = int(l[9]) * float(CO.UT)			# Servicio
    else: rSv = 0
    sSv = FG.formateaNumero(rSv, 2)		# Servicio formateado
    if 9 <= len(l): rAy = int(l[8]) * float(CO.UT)			# Ayuda
    else: rAy = 0
    sAy = FG.formateaNumero(rAy, 2)		# Ayuda formateado
    sMensaje += "%sAyuda:%s BsF. %*.*s (%-3s UT)\n" % (CO.AZUL, CO.FIN,
                                                len(sAy), len(sAy), sAy, l[8])
    sMensaje += "%sServicio:%s BsF. %*.*s (%-3s UT)\n" % (CO.AZUL, CO.FIN,
                                                len(sSv), len(sSv), sSv, l[9])
    sMensaje += "%sTraslado:%s BsF. %*.*s (%-3s UT)\n" % (CO.AZUL, CO.FIN,
                                                len(sTr), len(sTr), sTr, l[10])
    if 0 < rFo: sMensaje += "%sFosa (solo 1):%s BsF. %*.*s (%-3s UT)\n" %\
                              (CO.AZUL, CO.FIN, len(sFo), len(sFo), sFo, l[11])
    if 0 < rCr: sMensaje += "%sCremacion:%s BsF. %*.*s (%-3s UT)\n" %\
                              (CO.AZUL, CO.FIN, len(sCr), len(sCr), sCr, l[12])
    if 0 < rLp: sMensaje += "%sLapida:%s BsF. %*.*s (%-3s UT)\n" % (CO.AZUL,
                                        CO.FIN, len(sLp), len(sLp), sLp, l[13])
  # Fin for
  opc = ES.imprime(sMensaje.rstrip(' \t\n\r'))
  return opc
Ejemplo n.º 17
0
def totEst():
  ''' Agregar 1, correspondiente al 'estatus'.
      0:filas, 1:tPrecio, 2:tLados, 3:tCompartidoConIva,
      4:tFranquiciaSinIva, 5:tFranquiciaConIva, 6:tFranquiciaPagarR,
      7:tRegalia, 8:tSanaf5PorCiento, 9:tOficinaBrutoReal,
      10:tBaseHonorariosSo, 11:tBaseParaHonorari, 12:tCaptadorPrbr,
      13:tGerente, 14:tCerradorPrbr, 15:tBonificaciones,
      16:tComisionBancaria, 17:tIngresoNetoOfici, 18:tPrecioVentaReal,
      19:tPuntos, 20:tCaptadorPrbrSel, 21:tCerradorPrbrSel,
      22:tLadosCap, 23:tLadosCer, 24:tPvrCaptadorPrbrSel,
      25:tPvrCerradorPrbrSel, 26:tPuntosCaptador, 27:tPuntosCerrador
  '''
  global lTEs

  st = titTotales('Estatus', 20)
  bImpar = True
  tLados = tLaCap = tLaCer = 0
  tPrVeReal = tCap = tCer = 0.00
  for l in lTEs:
    try:
      bImpar, cad = detTotales(COM.descEstatus(l[0]), l[3], l[19],
                                l[13], l[15], l[23], l[24], bImpar,
                                20, CO.ROJO if ('S'==l[0]) else False)
      st += cad
    except TypeError:
      print('ERROR detalle:')
      print(l)
    try:
      if (l[0] in ('P', 'C')):
        tPrVeReal, tCap, tCer = tPrVeReal+l[19], tCap+l[13], tCer+l[15]
        tLaCap, tLaCer, tLados = tLaCap+l[23], tLaCer+l[24], tLados+l[3]
    except:
      print('ERROR totales:')
      print(l[1], l[3], l[19], l[13], l[15], l[23], l[24])
  try:
    st += totTotales('Total Oficina', tLados, tPrVeReal, tCap, tCer,\
                      tLaCap, tLaCer, 20)
  except:
    print('ERROR linea totales:')
    print(tPrVeReal, tCap, tCer, tLados, tLaCap, tLaCer)
  opc = ES.imprime(st.rstrip(' \t\n\r'))
  return opc
Ejemplo n.º 18
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.º 19
0
def lstXMes():

  agno, mes = COM.selMes(lTMe)
  if ('v' == agno): return -1
  
  nvaLst = []
  for l in lPro:
    if ('00' == mes) and (("" == l['fecRes']) or ("" == l['fecFir'])):
      nvaLst.append(l)
      continue
    if (("" != l['fecFir']) and (10 == len(l['fecFir'])) and\
        (agno == l['fecFir'][-4:]) and (mes == l['fecFir'][3:5])) or\
       (("" != l['fecRes']) and (10 == len(l['fecRes'])) and\
        (agno == l['fecRes'][-4:]) and (mes == l['fecRes'][3:5])):
      nvaLst.append(l)
  # for l in lPro
  nV = tLados = 0
  tPrecios = tPrVeReal = tNetos = 0.00
  bImpar = True
  st = CO.CYAN + agno + ' ' + CO.meses[int(mes)] + 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)
    if (l['estatus'] in ('P', 'C')):
      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 += CO.AMARI + FG.formateaNumero(len(nvaLst)) + ' negociaciones ['\
        + FG.formateaNumero(nV) + ' validas].' + CO.FIN
  return ES.imprime(st.rstrip(' \t\n\r'))
Ejemplo n.º 20
0
def resNominaN(lN=None):
    '''Maneja el resumen de todos los conceptos de IPASPUDO de la nomina
    recibida como parametro.'''
    global lNomN
    if None == lN: lN = lNomN

    st = CO.AMARI + COM.lFecha("Nomina", "Nomina") + ' (Descargado:' + CO.FIN +\
                                        COM.lFecha('nomina.txt', '') + ')' + "\n"
    ftValFi = 0.00
    ftValVa = 0.00
    ftTotal = 0.00
    bImpar = True

    sTitNomina  = CO.AZUL + "CON".ljust(4) + 'DESCRIPCION'.ljust(25) +\
                        "VALOR FIJO".rjust(16) + "VALOR VARIABLE".rjust(16) +\
                        "T O T A L".rjust(16) + CO.FIN + "\n"
    st += sTitNomina
    for l in lN:
        if 8 > len(l) or 0.00 == float(l[7]): continue
        sColor, bImpar = ES.colorLinea(bImpar, CO.VERDE)
        # 0:Concepto, 1:Descripcion, 2:Cta credito, 3:Cta Debito, 4:Cta Interese, 5:Valor fijo, 6: Valor variable, 7:Total
        stl = "%s%.3s %-25.25s %15.15s %15.15s %15.15s%s" % (
            sColor, l[0], l[1], FG.formateaNumero(l[5], 2).rstrip().rjust(15),
            FG.formateaNumero(l[6], 2).rstrip().rjust(15),
            FG.formateaNumero(l[7], 2).rstrip().rjust(15), CO.FIN)
        ftValFi += float(l[5])
        ftValVa += float(l[6])
        ftTotal += float(l[7])
        st += stl + '\n'
    # Fin for
    stValFi = FG.formateaNumero(ftValFi, 2)
    stValVa = FG.formateaNumero(ftValVa, 2)
    stTotal = FG.formateaNumero(ftTotal, 2)
    stl = CO.AZUL + "T O T A L E S".rjust(29) + stValFi.rjust(16) + \
                                  stValVa.rjust(16) + stTotal.rjust(16) + CO.FIN
    st += stl
    opc = ES.imprime(st.rstrip(' \t\n\r'))
    return opc
Ejemplo n.º 21
0
def todasPropiedades(bCaidas=True):
  '''Lee los datos de propiedades y los despliega
      fila['id']: numero incremental.
      fila['codigo']: Codigo casa nacional.
      fila['fecRes']: fecha de reserva.
      fila['fecFir']: fecha de firma.
      fila['negoc']: Negociacion: Venta o Alquiler.
      fila['nombre']: Nombre de la propiedad.
      fila['estatus']: Status.
      fila['moneda']: Moneda.
      fila['precio']: Precio.
  '''
  global lPro

  nV = tLados = 0
  tPrecios = tPrVeReal = tNetos = 0.00
  bImpar = True
  st = titulo("Neto ofic.", 11)
  for l in lPro:
    if (l['estatus'] in ('P', 'C')):
      nV += 1
      tLados += l['lados']
      tPrecios += l['precio']
      tPrVeReal += l['prVeRe']
      tNetos += l['ingNeOf']
    sColor, bImpar = ES.colorLinea(bImpar, CO.VERDE)
    st += detalles(l, sColor, bCaidas, 'ingNeOf', 11)
  # 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(tNetos, 2).rjust(11) + CO.FIN + "\n"
  st += FG.formateaNumero(len(lPro)) + ' negociaciones [' + \
        FG.formateaNumero(nV) + ' validas].'

  return ES.imprime(st.rstrip(' \t\n\r'))
Ejemplo n.º 22
0
def detallePrestamo(ced, sNombre, lPres, lDesc):
    '''Muestra el detalle de prestamo de un socio.'''

    #  sTitulo = "Detalle de un Prestamo"
    sMensaje = ''
    sMensaje = "%sSocio: %s %s%s\n" % (
        CO.CYAN, FG.formateaNumero(ced), sNombre.lstrip().split('|')[0], CO.FIN
    )  # Cedula, Nombre, Codigo y descripcion del concepto.
    sMoPre = FG.formateaNumero(lPres[2], 2)  # Monto concedido
    sTotal = FG.formateaNumero(lPres[3],
                               2)  # Monto total (Concedido + intereses)
    sSaldo = FG.formateaNumero(lPres[4], 2)  # Saldo
    sSdoTo = FG.formateaNumero(lPres[5], 2)  # Saldo total (Saldo + intereses)
    sCuota = FG.formateaNumero(lPres[6], 2)  # Cuota
    sMensaje += "%sCodigo del Prestamo:%s %s\n" % (CO.AZUL, CO.FIN, lPres[1])
    sMensaje += "%sDescripcion:%s %s\n" % (CO.AZUL, CO.FIN, lDesc)
    sMensaje += "%sMonto concedido:%s BsF. %*.*s\n" % (
        CO.AZUL, CO.FIN, len(sMoPre), len(sMoPre), sMoPre)
    if CO.bPantAmplia: sExtra = ' (Concedido + intereses)'
    else: sExtra = ''
    sMensaje += "%sMonto total%s:%s BsF. %*.*s\n" % (
        CO.AZUL, sExtra, CO.FIN, len(sTotal), len(sTotal), sTotal)
    sMensaje += "%sSaldo del Prestamo:%s BsF. %*.*s\n" % (
        CO.AZUL, CO.FIN, len(sSaldo), len(sSaldo), sSaldo)
    if CO.bPantAmplia: sExtra = ' (Saldo + intereses)'
    else: sExtra = ''
    sMensaje += "%sMonto total deuda%s:%s BsF. %*.*s\n" % (
        CO.AZUL, sExtra, CO.FIN, len(sSdoTo), len(sSdoTo), sSdoTo)
    sMensaje += "%sMonto de la cuota:%s BsF. %*.*s\n" % (
        CO.AZUL, CO.FIN, len(sCuota), len(sCuota), sCuota)
    sMensaje += "%sFecha de la solicitud:%s %s\n" % (CO.AZUL, CO.FIN, lPres[7])
    if 0 < len(lPres[8]):        sMensaje += "%sMes ult Actualizacion:%s %s\n" %\
                                  (CO.AZUL, CO.FIN, lPres[8])
    if 0 < len(lPres[9]):
        sMensaje += "%sNumero de cuotas:%s %s\n" % (CO.AZUL, CO.FIN, lPres[9])
    opc = ES.imprime(sMensaje.rstrip(' \t\n\r'))
    return opc
Ejemplo n.º 23
0
def comisiones(droid=None, bImp=True):
    rPr = rCom = rIva = lados = xPReCaNa = asCapSoc = asCerSoc = None
    xPorcBon = xPorcCap = xPorcCer = comBanca = None
    while (None == rPr):
        rPr = ES.entradaNumeroConLista(droid, 'Precio del inmueble',
                                       'Introduzca el monto', CO.lMonto, False)
    while (None == rCom):
        rCom = ES.entradaNumeroConLista(droid, 'Comision',
                                        'Introduzca el porc de comision',
                                        CO.lComis, False)
    while (None == rIva):
        rIva = ES.entradaNumeroConLista(droid, 'Impuesto al valor '
                                        'agregado', 'Introduzca el IVA',
                                        CO.lIva, False, True)
    while (None == lados):
        lados = ES.entradaNumero(droid, 'Numero de lados',
                                 'Cuantos lados, 1 o 2?', '2')
        if (None != lados):
            if (1 > lados) or (2 < lados): lados = None
    while (None == xPReCaNa):
        xPReCaNa = ES.entradaNumeroConLista(
            droid, 'Porcentaje reportada a Casa Nacional', '% Reportado a '
            'Casa Nacional?', [
                '5.0', '4.9', '4.8', '4.7', '4.6', '4.5', '4.4', '4.3', '4.2',
                '4.1', 'Otro'
            ], False, True)
    while (None == asCapSoc):
        resp = ES.siNo(droid, 'El asesor captador es socio',
                       'El Captador es socio PrBr?', CO.lNoSi)
        if ('S' == resp): asCapSoc = True
        else: asCapSoc = False
    while (None == asCerSoc):
        resp = ES.siNo(droid, 'El asesor cerrador es socio',
                       'El Cerrador es socio PrBr?', CO.lNoSi)
        if ('S' == resp): asCerSoc = True
        else: asCerSoc = False
    while (None == xPorcBon):
        xPorcBon = ES.entradaNumeroConLista(
            droid, 'Porcentaje de bonificacion', '% de bonificacion?',
            ['0.00', '2.5', '5.0', '10.0', 'Otro'], False, True)
    xPorcCap = ES.entradaNumero(droid, 'Comision captador',
                                '% de la comision del captador?', '20.00',
                                False, True)
    if (None == xPorcCap): xPorcCap = 20.00
    xPorcCer = ES.entradaNumero(droid, 'Comision cerrador',
                                '% de la comision del cerrador?', '20.00',
                                False, True)
    if (None == xPorcCer): xPorcCer = 20.00
    comBanca = ES.entradaNumero(droid, 'Comision bancaria',
                                'Monto de la comision bancaria?', '0.00',
                                False, True)
    if (None == comBanca): comBanca = 0.00
    xPorcGer = 10.0
    xPcFranq = 10.0
    xPorcReg = 80.0
    xPorcSan = 20.0
    (resSIva, resCIva, compSIva, compCIva, frnqSIva, frnqCIva,\
     frnqPaRe, regalia, sanfm5XC, ofBruRea, basHoSoc, basPaHon,\
     captador, gerente, cerrador, bonifica, netoOfic) =\
    calComisiones(rPr, rCom, rIva, lados, xPReCaNa, asCapSoc, asCerSoc,
        xPorcBon, xPorcCap, xPorcCer, comBanca, xPorcGer,
        xPcFranq, xPorcReg, xPorcSan)

    if bImp:
        if CO.bPantAmplia:
            sFormCuota = ("%sPrecio:%s %s, %sComision:%s %s%%, %sIVA:%s"
                          " %s%%, %d %slado(s)%s\n")
        else:
            sFormCuota = "%sPr:%s%s,%s%%Com:%s%s%%,%sIVA:%s%s%%\n"
        sMsj = sFormCuota % (CO.AZUL, CO.FIN, FG.formateaNumero(
            rPr, 2), CO.AZUL, CO.FIN, FG.formateaNumero(
                rCom, 2), CO.AZUL, CO.FIN, FG.formateaNumero(
                    rIva, 2), lados, CO.AZUL, CO.FIN)
        sMsj += ("%sReserva sin IVA:%s %s\n") % (CO.AZUL, CO.FIN,
                                                 FG.formateaNumero(resSIva, 2))
        sMsj += ("%sReserva con IVA:%s %s\n") % (CO.AZUL, CO.FIN,
                                                 FG.formateaNumero(resCIva, 2))
        sMsj += ("%sCompartido con otra oficina con IVA:%s %s\n") %\
          (CO.AZUL, CO.FIN, FG.formateaNumero(compCIva, 2))
        sMsj += ("%sCompartido con otra oficina sin IVA:%s %s\n") %\
          (CO.AZUL, CO.FIN, FG.formateaNumero(compSIva, 2))
        sMsj += ("%sFranquicia de reserva sin IVA:%s %s (%s%%)\n") %\
          (CO.AZUL, CO.FIN, FG.formateaNumero(frnqSIva, 2),
          FG.formateaNumero(xPcFranq, 2))
        sMsj += ("%sFranquicia de reserva con IVA:%s %s (%s%%)\n") %\
          (CO.AZUL, CO.FIN, FG.formateaNumero(frnqCIva, 2),
          FG.formateaNumero(xPcFranq, 2))
        sMsj += ("%sFranquicia a pagar reportada:%s %s (%s%%)\n") %\
          (CO.AZUL, CO.FIN, FG.formateaNumero(frnqPaRe, 2),
          FG.formateaNumero(xPReCaNa, 2))
        sMsj += ("%sRegalia:%s %s (%s%%)\n") % (CO.AZUL, CO.FIN,
                                                FG.formateaNumero(regalia, 2),
                                                FG.formateaNumero(xPorcReg, 2))
        sMsj += ("%sSanaf menos 5 por ciento:%s %s (%s%%)\n") % (
            CO.AZUL, CO.FIN, FG.formateaNumero(
                sanfm5XC, 2), FG.formateaNumero(xPorcSan, 2))
        sMsj += ("%sOficina bruto real:%s %s\n") % (
            CO.AZUL, CO.FIN, FG.formateaNumero(ofBruRea, 2))
        sMsj += ("%sBase honorarios socios:%s %s\n") % (
            CO.AZUL, CO.FIN, FG.formateaNumero(basHoSoc, 2))
        sMsj += ("%sBase para honorarios:%s %s\n") % (
            CO.AZUL, CO.FIN, FG.formateaNumero(basPaHon, 2))
        sMsj += ("%sComision del captador:%s %s (%s%%)\n") % (
            CO.AZUL, CO.FIN, FG.formateaNumero(
                captador, 2), FG.formateaNumero(xPorcCap, 2))
        sMsj += ("%sComision del gerente:%s %s (%s%%)\n") % (
            CO.AZUL, CO.FIN, FG.formateaNumero(
                gerente, 2), FG.formateaNumero(xPorcGer, 2))
        sMsj += ("%sComision del cerrador:%s %s (%s%%)\n") % (
            CO.AZUL, CO.FIN, FG.formateaNumero(
                cerrador, 2), FG.formateaNumero(xPorcCer, 2))
        if (0.00 != xPorcBon):
            sMsj += ("%sBonificacion:%s %s (%s%%)\n") % (
                CO.AZUL, CO.FIN, FG.formateaNumero(
                    bonifica, 2), FG.formateaNumero(xPorcBon, 2))
        if (0.00 != comBanca):
            sMsj += ("%sComision bancaria:%s %s\n") % (
                CO.AZUL, CO.FIN, FG.formateaNumero(comBanca, 2))
        sMsj += ("%sIngreso neto de la oficina:%s %s\n") % (
            CO.AZUL, CO.FIN, FG.formateaNumero(netoOfic, 2))
        opc = ES.imprime(sMsj.rstrip(' \t\n\r'))
        return opc
    return rPr, rCom, rIva, lados, resSIva, resCIva, compSIva,\
     compCIva, frnqSIva, frnqCIva, frnqPaRe, regalia, sanfm5XC,\
     ofBruRea, basHoSoc, basPaHon, captador, gerente, cerrador,\
     bonifica, comBanca, netoOfic
Ejemplo n.º 24
0
def nomina(ci=-1, bLN=True):
    '''Maneja la lista de conceptos de nomina de un socio y
    muestra la informacion.'''
    global lNom, lNomCNE

    if bLN: lN = lNom
    else: lN = lNomCNE
    if 0 >= ci: return -8

    st = CO.AMARI + COM.lFecha("Nomina", "Nomina") + ' (Descargado:' + CO.FIN +\
                                        COM.lFecha('nomina.txt', '') + ')' + "\n"
    nF = 0
    ftAsig = 0.00
    ftDed = 0.00
    bImpar = True

    nCarDesc = CO.nCarLin - 23 - 1  # Numero de caracteres (espacio total), donde se mostrara el campo. 23 es resto.
    maxLongCad = 28  # 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.
    sTitNomina = CO.AZUL + "CON " + CO.justIzqTituloCol(
        'DESCRIPCION', nCarDesc) + "  ValorFijo ValorVariab"
    if 25 <= (CO.nCarLin -
              nCarMostrar):  # 25 es la maxima longitud del 'saldo[cuota]'.
        sTitNomina += '          Saldo:[Cuota]'
        nCarMostrar += 25
        nCarSaldo = 15
        bSaldo = True
    else:
        nCarSaldo = 0
        bSaldo = False
    sTitNomina += CO.FIN + "\n"
    for l in lN:
        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:Valor fijo, 3: Valor variable, 4:Saldo, 5:Cuota
            stl = "%s%.3s %*.*s %.11s %.11s%s" % (
                sColor, l[1], nCarDesc, nCarDesc, COM.mConcepto(l[1]).ljust(
                    nCarDesc, " "), FG.formateaNumero(
                        l[2], 2).rstrip().rjust(11), FG.formateaNumero(
                            l[3], 2).rstrip().rjust(11), CO.FIN)
            if bSaldo:
                if (0.00 < float(l[4])):
                    stl += "%s%.*s[%s]%s" % (
                        sColor, nCarSaldo, FG.formateaNumero(
                            l[4], 2).rstrip().rjust(nCarSaldo),
                        FG.formateaNumero(l[5], 2).rstrip(), CO.FIN)
            try:
                if (500 > int(l[1])): ftAsig += float(l[2]) + float(l[3])
                else: ftDed += float(l[2]) + float(l[3])
            except Exception as ex:
                print('Tipo: ' + type(ex), ', ex: ', ex)
            if 1 == nF:
                stl = CO.CYAN + FG.formateaNumero(ci) + ':' + \
                    COM.nombreSocio(COM.mNombre(ci)) + CO.FIN + "\n" + sTitNomina + stl
            st += stl + '\n'
        else:
            break
    # Fin for
    if 0 >= nF: st = COM.noCedula(ci)
    elif (0.00 != ftAsig) or (0.00 != ftDed):
        fNeto = ftAsig - ftDed
        stAsig = FG.formateaNumero(ftAsig, 2)
        stDed = FG.formateaNumero(ftDed, 2)
        sNeto = FG.formateaNumero(fNeto, 2)
        if bSaldo:
            sFormato = ("%sAsignaciones:%s%-*.*s; %sDeducciones:%s%-*.*s; "
                        "%sNeto:%s %-*.*s")
        else:
            sFormato = "%sAs:%s%-*.*s;%sDs:%s%-*.*s;%sNeto:%s %-*.*s"
        stl = sFormato % (CO.AZUL, CO.FIN, len(stAsig),
                          len(stAsig) + 1, stAsig, CO.AZUL, CO.FIN, len(stDed),
                          len(stDed) + 1, stDed, CO.AZUL, CO.FIN, len(sNeto),
                          len(sNeto) + 1, sNeto)
        st += stl
    opc = ES.imprime(st.rstrip(' \t\n\r'))
    return opc
Ejemplo n.º 25
0
def totAsesorMes():
  ''' 0:'id' del asesor, 1:'agno-mes'.
      2:filas, 3:tPrecio, 4:tLados, 5:tCompartidoConIva,
      6:tFranquiciaSinIva, 7:tFranquiciaConIva, 8:tFranquiciaPagarR,
      9:tRegalia, 10:tSanaf5PorCiento, 11:tOficinaBrutoReal,
      12:tBaseHonorariosSo, 13:tBaseParaHonorari, 14:tCaptadorPrbr,
      15:tGerente, 16:tCerradorPrbr, 17:tBonificaciones,
      18:tComisionBancaria, 19:tIngresoNetoOfici, 20:tPrecioVentaReal,
      21:tPuntos, 22:tCaptadorPrbrSel, 23:tCerradorPrbrSel,
      24:tLadosCap, 25:tLadosCer, 26:tPvrCaptadorPrbrSel,
      27:tPvrCerradorPrbrSel, 28:tPuntosCaptador, 29:tPuntosCerrador
  '''
  global lTAM

# lNAs contiene listas de dos elementos: nombre y id real de cada asesor.
# id va a obtener 0 o 2, 3, 4, 5, ... # id del ultimo asesor.
  id  = FG.selOpcionMenu([['Todos', 0]] + ASE.lNAs + [['Volver', -2]],
                                                            'Asesor')
  if (0 > id): return id
  todos = (0 == id)

  st = titTotales('Agno Mes', 16)
  bImpar = True
  tAsLados = tAsLaCap = tAsLaCer = 0
  tLados = tLaCap = tLaCer = 0
  tAsPvr = tAsCap = tAsCer = tPvr = tCap = tCer = 0.00
  idAse = 0
  for l in lTAM:
    if not todos:
      if (id != l[0]): continue    
    try:
      if (idAse != l[0]):
        if (0 < idAse):
          st += totTotales('Total Asesor', tAsLaCap + tAsLaCer, tAsPvr,
                            tAsCap, tAsCer, tAsLaCap, tAsLaCer, 16)
        idAse = l[0]
        st += CO.CYAN + ASE.nombreAsesor(l[0]) + CO.FIN + '\n'
        tAsLados = tAsLaCap = tAsLaCer = 0
        tAsPvr = tAsCap = tAsCer = 0.00
      bImpar, cad = detTotales(l[1][0:4]+' '+CO.meses[int(l[1][5:])],
                              l[24] + l[25], l[26]+l[27], l[22],\
                              l[23], l[24], l[25], bImpar, 16)
      st += cad
    except TypeError:
      print('ERROR detalle:')
      print(l)
    try:
      tAsPvr, tAsCap, tAsCer = tAsPvr+l[26]+l[27], tAsCap+l[22],\
                                tAsCer+l[23]
      tAsLaCap, tAsLaCer, tAsLados = tAsLaCap+l[24], tAsLaCer+l[25],\
                                tAsLados+l[24]+l[25]
      if todos and (1 < int(l[0])):
        tPvr, tCap, tCer = tPvr+l[26]+l[27], tCap+l[22], tCer+l[23]
        tLaCap, tLaCer, tLados = tLaCap+l[24], tLaCer+l[25],\
                                  tLados+l[24]+l[25]
    except:
      print('ERROR totales:')
      print(l[0], l[1], l[2], l[3], l[22], l[23], l[24], l[25], l[26],\
            l[27])
  try:
    st += totTotales('Total Asesor', tAsLaCap + tAsLaCer, tAsPvr,
                      tAsCap, tAsCer, tAsLaCap, tAsLaCer, 16, todos)
    if todos:
      st += totTotales('Total Oficina', tLaCap + tLaCer, tPvr,
                      tCap, tCer, tLaCap, tLaCer, 16, False, False)
  except:
    print('ERROR linea totales:')
    print(tAsLaCap, tAsLaCer, tAsPvr, tAsCap, tAsCer, tLados, tPvr,
              tCap, tCer, tLaCap, tLaCer)
  opc = ES.imprime(st.rstrip(' \t\n\r'))
  return opc
Ejemplo n.º 26
0
def asesor(bImp=True):
  global droid
  global lNAs

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

  if __name__ != '__main__':    # No se ha creado la lista de Propiedades lPro. No he podido.
    resp = ES.siNo(droid, 'propiedades', 'Desea mostrar las propiedades'
                ' de '+ lAse[id-1]['name'], False)
    tCap = tCer = 0.00
    nF = nV = tLados = 0
    bImpar = True
    if ('S' == resp):
      st = PRO.titulo('Comision', 11)
      for l in PRO.lPro:
        if (40 < len(l)):
          if not (isinstance(l['asCapId'], int)) or\
              not (isinstance(l['asCerId'], int)):
            continue
          if (id != l['asCapId']) and (id != l['asCerId']): continue
          if (l['estatus'] in ('P', 'C')) and (id == l['asCapId']):
            try:
              tCap += float(l['capPrbr'])
            except: pass
          if (l['estatus'] in ('P', 'C')) and (id == l['asCerId']):
            try:
              tCer += float(l['cerPrbr'])
            except: pass
          nF += 1
          if (l['estatus'] in ('P', 'C')):
            nV += 1
            tLados += l['lados']
      #    if ('S' == resp):
          sColor, bImpar = ES.colorLinea(bImpar, CO.VERDE)
          st += PRO.detalles(l, sColor, True, 'capPrbr', 'asCapId',
                                'cerPrbr', 'asCerId', id, 11)
      # Fin for
      st += CO.AMARI + 'Tiene ' + FG.formateaNumero(nF) +\
            ' negociaciones [' + FG.formateaNumero(nV) + ' validas].' +\
            CO.FIN + '\n'
    # Fin if ('S' == resp):
    else: st = ''
  # Fin if __name__ != '__main__':

  if bImp:
    if __name__ == '__main__':
      sMsj = ("%sID:%s %2d\n") % (CO.AZUL, CO.FIN, id)
    else: sMsj = ''
    ind  = id - 1
    dic = lAse[ind]
    for ll in dMsj:
      if not dMsj[ll]: continue
      if 'tCap' == ll: break      # De aqui en adelante no son 'propiedades' (variables) del asesor.
      if 'pvrCaptador' == ll and __name__ != '__main__':    # No se ha creado la lista de Propiedades lPro. No he podido.
        if (0 < nF): sMsj += st    # Si la respuesta sobre las propiedades fue 'Si', Despliega las propiedades donde ha participado el asesor.
      if ll in ('tCap', 'tCer', 'tCapCer'): continue  # Solo para verificar valores.
      sMsj += COM.prepLnMsj(dMsj, dic, ll)

    if not bMovil and __name__ != '__main__':
      dic = {'tCap':tCap, 'tCer':tCer, 'tCaptCer':tCap+tCer}
      sMsj += COM.prepLnMsj(dMsj, dic, 'tCap', 'n', '22', 2)
      sMsj += COM.prepLnMsj(dMsj, dic, 'tCer', 'n', '22', 2)
      sMsj += COM.prepLnMsj(dMsj, dic, 'tCaptCer', 'n', '12', 2)
    opc = ES.imprime(sMsj.rstrip(' \t\n\r'))
  return opc, ind
Ejemplo n.º 27
0
def totMesAsesor():
  ''' 0:'agno-mes', 1:'id' del asesor,
      2:filas, 3:tPrecio, 4:tLados, 5:tCompartidoConIva,
      6:tFranquiciaSinIva, 7:tFranquiciaConIva, 8:tFranquiciaPagarR,
      9:tRegalia, 10:tSanaf5PorCiento, 11:tOficinaBrutoReal,
      12:tBaseHonorariosSo, 13:tBaseParaHonorari, 14:tCaptadorPrbr,
      15:tGerente, 16:tCerradorPrbr, 17:tBonificaciones,
      18:tComisionBancaria, 19:tIngresoNetoOfici, 20:tPrecioVentaReal,
      21:tPuntos, 22:tCaptadorPrbrSel, 23:tCerradorPrbrSel,
      24:tLadosCap, 25:tLadosCer, 26:tPvrCaptadorPrbrSel,
      27:tPvrCerradorPrbrSel, 28:tPuntosCaptador, 29:tPuntosCerrador
  '''
  global lTMA

  agno, mes = COM.selMes(lTMe, True)
  if ('v' == agno): return -1
  todos = ('t' == agno)
  
  st = titTotales('Asesor', 21)
  bImpar = True
  tMeLados = tMeLaCap = tMeLaCer = 0
  tLados = tLaCap = tLaCer = 0
  tMePvr = tMeCap = tMeCer = tPvr = tCap = tCer = 0.00
  idMes = ''
  for l in lTMA:
    if not todos:
      if (agno+'-'+mes.zfill(2)) != l[0]: continue
    try:
      if (idMes != l[0]):
        if ('' != idMes):
          st += totTotales('Total mes ' + idMes, tMeLaCap + tMeLaCer,
                        tMePvr, tMeCap, tMeCer, tMeLaCap, tMeLaCer, 20)
        idMes = l[0]
        st += CO.CYAN + l[0] + CO.FIN + '\n'
        tMeLados = tMeLaCap = tMeLaCer = 0
        tMePvr = tMeCap = tMeCer = 0.00
      bImpar, cad = detTotales(ASE.nombreAsesor(l[1]), l[24] + l[25],
                        l[26]+l[27], l[22], l[23], l[24], l[25], bImpar, 20)
      st += cad
    except TypeError:
      print('ERROR detalle:')
      print(l)
    try:
      if (1 < int(l[1])):
        tMePvr, tMeCap, tMeCer = tMePvr+l[26]+l[27], tMeCap+l[22],\
                                  tMeCer+l[23]
        tMeLaCap, tMeLaCer, tMeLados = tMeLaCap+l[24], tMeLaCer+l[25],\
                                  tMeLados+l[24]+l[25]
        if todos:
          tPvr, tCap, tCer = tPvr+l[26]+l[27], tCap+l[22], tCer+l[23]
          tLaCap, tLaCer, tLados = tLaCap+l[24], tLaCer+l[25],\
                                  tLados+l[24]+l[25]
    except:
      print('ERROR totales:')
      print(l[0], l[1], l[2], l[3], l[22], l[23], l[24], l[25], l[26],\
            l[27])
  try:
    st += totTotales('Total mes ' + idMes, tMeLaCap + tMeLaCer,
                  tMePvr, tMeCap, tMeCer, tMeLaCap, tMeLaCer, 20, todos)
    if todos:
      st += totTotales('Total Oficina', tLaCap + tLaCer, tPvr, tCap,
                        tCer, tLaCap, tLaCer, 20, False, False)
  except:
    print('ERROR linea totales:')
    print(tMeLaCap, tMeLaCer, tMePvr, tMeCap, tMeCer, tLados, tPvr,
          tCap, tCer, tLaCap, tLaCer)
  opc = ES.imprime(st.rstrip(' \t\n\r'))
  return opc
Ejemplo n.º 28
0
    else: sMsj = ''
    ind  = id - 1
    dic = lAse[ind]
    for ll in dMsj:
      if not dMsj[ll]: continue
      if 'tCap' == ll: break      # De aqui en adelante no son 'propiedades' (variables) del asesor.
      if 'pvrCaptador' == ll and __name__ != '__main__':    # No se ha creado la lista de Propiedades lPro. No he podido.
        if (0 < nF): sMsj += st    # Si la respuesta sobre las propiedades fue 'Si', Despliega las propiedades donde ha participado el asesor.
      if ll in ('tCap', 'tCer', 'tCapCer'): continue  # Solo para verificar valores.
      sMsj += COM.prepLnMsj(dMsj, dic, ll)

    if not bMovil and __name__ != '__main__':
      dic = {'tCap':tCap, 'tCer':tCer, 'tCaptCer':tCap+tCer}
      sMsj += COM.prepLnMsj(dMsj, dic, 'tCap', 'n', '22', 2)
      sMsj += COM.prepLnMsj(dMsj, dic, 'tCer', 'n', '22', 2)
      sMsj += COM.prepLnMsj(dMsj, dic, 'tCaptCer', 'n', '12', 2)
    opc = ES.imprime(sMsj.rstrip(' \t\n\r'))
  return opc, ind
# FIN funcion asesor

if __name__ == '__main__':
  prepararListaDeAsesores("../data/")
#  PRO.prepararListaDePropiedades("../data/")
  asesor()
  st = ''
  i  = 0
  for k in lAse[0].keys():
    i += 1
    st += str(i) + ') ' + k + '\n'
  ES.imprime(st.rstrip(' \t\n\r'))
Ejemplo n.º 29
0
			if 0 < len(lControl):
				sControl = ''
				bOtroDia = False
				for l in lControl:
					if 'Sinca' == l[0]:
						fechaControl = datetime.strptime(l[1],
								'ACTUALIZADO Al: %d/%m/%Y %H:%M:%S')
						sControl = "%sControl al: %s%s." % (CO.PURPURA, CO.FIN,
																fechaControl)
						if (dHoy != fechaControl.strftime('%Y%m%d')):
							bOtroDia = True
						break
					# if 1 < len(ll) and 'Sinca' == ll[0]
				# for l in lControl
				if bOtroDia:
					ES.imprime(sControl)
					ind = ES.entradaConLista(droid, 'Continuar', 'Seleccione',
												['Si', 'No'])		# Continuar.
					if (1 <= ind) or (0 > ind) or (None == ind):	# Se asegura de tener el indice correcto.
						ES.muestraFin()
						sys.exit()
				# FIN if bOtroDia
				for linea in lControl:
					if ES.esEntero(linea[0]):	# linea[0] sera el nuevo tiempo.
						dControl[linea[1]] = [
							dControl.get(linea[1], ['0', 0])[0], linea[0]
						]	# el tiempo anterior es el primer item de dControl o -1.
#						if linea[1] in dControl:
#							dControl[linea[1]] = [dControl[linea[1]][0],
#																	linea[0]]
#						else: dControl[linea[1]] = ['-1', linea[0]]
Ejemplo n.º 30
0
        print(("%sERROR: (Linea:%d{Corta:%d/Larga:%d})%s;%s(%d):%25.25s\n"
                "Nucleo: {Corta:%s|Larga:%s}; Cuenta: {Corta:%s|Larga:%s}") % \
                (CO.ROJO, iL, nC, nL, CO.FIN, dicc[v][0], len(dicc[v][0]),
                dicc[v][1], dicc[v][2], dicc[v][4], dicc[v][3], dicc[v][5]))
        break
    except:
      print(CO.ROJO + 'PROBABLEMENTE HAY UN ERROR (Linea:' + str(iL) + \
              '{Corta:' + str(nC) + '/Larga:' + str(nL) + '}' + ': ' + v + \
              '|' + dicc[v][1] + '|' + dicc[v][2] + '|' + dicc[v][3] + '|' + \
              dicc[v][4] + '|' + dicc[v][5] + '|' + ') CON EL ARCHIVO: ' + \
              nombArch + CO.FIN)
      break

  if 0 < nC: print("%5d: %8d %30.30s Nuc==>> %s Cta==>> %s" % \
                 (iL, int(dicc[v][0]), dicc[v][1], dicc[v][2], dicc[v][3]))
  else:
    sColor, bImpar = ES.colorLinea(bImpar, CO.AZUL, CO.CYAN)
    print("%s%5d: %8d %30.30s Nuc==>> %s Cta==>> %s%s" % (sColor, iL, \
                int(dicc[v][0]), dicc[v][1], dicc[v][4], dicc[v][5], CO.FIN))
  print("%s%d lineas; %d lineas cortas y %d lineas largas%s" % (CO.VERDE, iL, \
                                                            nC, nL, CO.FIN))
  f.close()
  if bMovil:
    ES.imprime('')
    indice = ES.entradaConLista(droid, 'Que desea hacer', 'Que desea hacer',
                                                    ['Otro archivo', 'Salir'])
    if None == indice or 0 > indice or 1 <= indice: break
  else:
    break

# FIN Principal