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'))
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'))
def depositos(): '''Maneja la lista de cheques y muestra los depositos de una fecha especifica.''' global lCh sFecha = ES.entradaFechaLocal(droid) lDep = [ l for l in lCh if '' != l[2] and 6 <= len(l[1]) and sFecha == l[4] ] # Nueva lista de cheques. Solo depositos (# cheque > 100000) if not lDep: ES.alerta(droid, 'DEPOSITOS X FECHA', "No hay depositos en esa fecha %s!" % sFecha) return -3 nlDep = len(lDep) if 1 == nlDep: return mCheque(lDep[0]) # print("Numero de item en arreglo: %5d\n" % nlDep) # lCheq = map(creaOp, lDep) # En vez de list 'comprehensions', como en lCheques. lCheq = list( map(COM.creaOp, lDep)) # En vez de list 'comprehensions', como en lCheques. indice = ES.entradaConLista(droid, 'DEPOSITOS ENCONTRADOS: ' + str(nlDep), 'Seleccione deposito', lCheq) if None == indice or 0 > indice: return -3 mCheque(lDep[indice])
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])
def cheque(): '''Maneja la lista de cheques y muestra la informacion de uno o varios cheque(s).''' global lCh ch = ES.entradaNumero(droid, "CHEQUE", "Numero de cheque", "0", True, True) if None == ch or 0 > ch: ES.alerta(droid, 'CHEQUE', "Cheque no encontrado!") return None if 0 == ch: nCh = lCheques() if not nCh: return None else: mCheque(nCh) return None bEnc = False for l in lCh: if ch > int(l[1]): continue elif ch == int(l[1]): bEnc = True mCheque(l) # return # Comentada para poder mostrar mas de un cheque con el mismo numero. else: break # Fin for if not bEnc: ES.alerta(droid, 'CHEQUE', "El cheque %5d no fue encontrado." % ch) return None
def prepararListasDeTrabajo(): global lCgE, lCgS, lPa lCgE = ES.cargaLista("extension.txt") # [0]Cedula; [1]Cedula carga; # [2]Nombre(Nombre|Disponibilidad|A/N); [3]Parentesco; [4]#UT; [5]Costo poliza lCgS = ES.cargaLista("servifun.txt") # [0]Cedula; [1]Cedula carga; # [2]Nombre(Nombre|Disponibilidad|A/N); [3]Parentesco; # [4]Fecha ingreso a servifun lPa = ES.cargaLista("parentesco.txt") # [0]Codigo; [1]Descripcion;
def prepararDiccionariosDeTrabajo(): global dBanco, dConcepto, dFecha, dPer, dDiv dBanco = ES.cargaDicc("bancos.txt") # [0]Codigo; [1]Descripcion dConcepto = ES.cargaDicc("conceptos.txt") # [0]Codigo; [1]Descripcion dFecha = ES.cargaDicc( "control.txt") # [0]Identificacion del proceso; [1]Fecha dPer = ES.cargaDicc("persona.txt") # [0]Cedula; # [1]Nombre(Nombre|Nucleo|Fecha de nacimiento o P:personal|disponibilidad o No|A/N:extension) dDiv = ES.cargaDicc("dividendos.txt") # [0]Cedula; [1]Monto
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
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
def cargarNombres(nombArch='IPER*.TXT'): rutaDatos = DIR lFiles = [f for f in listdir(rutaDatos) if isfile(join(rutaDatos, f)) and fnmatch.fnmatch(f, nombArch)] lFiles.sort() if not lFiles: ES.alerta(droid, nombArch, "No hubo coincidencias!") return None return lFiles
def prepararListasDeTrabajo(): global lCh, lHeute, lSi, lPre, lUb lHeute = ES.cargaLista("heute.txt") # [0]Banco; [1]Numero; [2]Cedula; # [3]Nombre; [4]Fecha(d/m/a); [5]descripcion; [6]monto; [7]estado lCh = ES.cargaLista("cheques.txt") # [0]Banco; [1]Numero; [2]Cedula; # [3]Nombre; [4]Fecha(d/m/a); [5]descripcion; [6]monto; [7]estado lSi = ES.cargaLista("disponibilidad.txt") # [0]Cedula; # [1]Codigo identificador proximo campo; [2] Campo(Fecha, Monto, etc) lPre = ES.cargaLista("prestamos.txt") # [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) lUb = ES.cargaLista("ubicacion.txt") # [0]Cedula;
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
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'))
def buscarArchivo(lFiles): if None == lFiles or 1 > len(lFiles): return None if 1 == len(lFiles): return (lFiles[0]) indice = ES.entradaConLista(droid, 'ARCHIVOS ENCONTRADOS', 'Seleccione nombre', lFiles) if None == indice or 0 > indice: return None return (lFiles[indice])
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
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
def concepto(ci=-1, bLN=True): '''Maneja la lista de los conceptos de un socio en Nomina y muestra el detalle de cualquiera de los conceptos.''' global lNom, lNomCNE if bLN: lN = lNom else: lN = lNomCNE sNombre = COM.mNombre(ci) if 0 >= ci: return -21 nF = 0 lCodigo = [] lConcepto = [] lDescripcion = [] for l in lN: if 0 == nF and ('' == l[0] or ci > int(l[0])): continue elif l[0] in ('', '0', str(ci)): lCodigo.append(l[1]) # Codigo del concepto lDescripcion.append( l[1] + ':' + COM.mConcepto(l[1])) # Descripcion del concepto lConcepto.append(l) # Lista del concepto nF += 1 else: break # Fin for if 0 >= nF: return None else: indice = ES.entradaConLista(droid, 'Conceptos', '', lDescripcion) if None == indice or 0 > indice: return None # if indice < len(lCodigo): detalleConcepto(ci, sNombre, lConcepto[indice], lDescripcion[indice].lstrip().split(':')[1]) if indice < len(lCodigo): return detalleConcepto(ci, sNombre, lConcepto[indice], COM.mConcepto(lCodigo[indice])) else: return None
def prestamo(ci): '''Maneja la lista de los prestamos de un socio en Prestamos y muestra el detalle de cualquiera de los prestamos.''' global lPre sNombre = COM.mNombre(ci) if 0 >= ci: return -21 nF = 0 lCodigo = [] lPrestamo = [] lDescripcion = [] for l in lPre: if 0 == nF and ('' == l[0] or ci > int(l[0])): continue elif l[0] in ('', '0', str(ci)): lCodigo.append(l[1]) # Codigo del prestamo lDescripcion.append( l[1] + ':' + COM.mConcepto(l[1])) # Descripcion del prestamo lPrestamo.append(l) # Lista del prestamo nF += 1 else: break # Fin for if 0 >= nF: return None else: indice = ES.entradaConLista(droid, 'Prestamos', '', lDescripcion) if None == indice or 0 > indice: return None # if indice < len(lCodigo): detallePrestamo(ci, sNombre, lPrestamo[indice], lDescripcion[indice].lstrip().split(':')[1]) if indice < len(lCodigo): return detallePrestamo(ci, sNombre, lPrestamo[indice], COM.mConcepto(lCodigo[indice])) else: return None
def servicio(ci=-1): '''Maneja la lista de la carga de un socio en ServiFun y muestra la cobertura a cualquiera de la carga.''' global lCgS, lPa if 0 >= ci: return -7 nF = 0 lCodigo = [] lParentesco = [] lNombre = [] for l in lCgS: if 0 == nF and ('' == l[0] or ci > int(l[0])): continue elif l[0] in ('','0',str(ci)): lPar = l[3].rstrip().split('-') # Parentesco: codigo-descripcion if 1 < len(lPar): lCod = lPar[0] else: lCod = '0' lCodigo.append(lCod) # Titular lNombre.append(l[2]) for lp in lPa: if lCod != lp[0]: continue # Codigo del parentesco lParentesco.append(lp[1]) nF += 1 else: break # Fin for if 0 >= nF: return None else: indice = ES.entradaConLista(droid, 'Parentesco', '', lParentesco) if None == indice or 0 > indice: return None if indice < len(lCodigo): return servicioEspecifico(lCodigo[indice], lNombre[indice]) else: return None
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'))
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
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
def cedulaI(ciAnt): while True: ci = ES.entradaNumero(droid, "CEDULA DE IDENTIDAD", "Cedula de identidad del socio", str(ciAnt), True, True, True) if 0 == ci: return -1 if ci < 100000: print('Debe introducir un número entero de 6 o más dígitos') else: break return ci
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'))
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
def escValXDefecto(sUXD, sCXD, cog): lC21 = [sUXD, sCXD, cog] fC21 = ES.abrir("c21pr.txt", 'w') if fC21: try: fC21.write(json.dumps(lC21)) except: pass finally: fC21.close() else: print("No se grabaron los valores por defecto!")
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'))
def escValXDefecto(sUXD, sCXD, cig): lIpa = [sUXD, sCXD, cig] fIpa = ES.abrir("ipaspudo.txt", 'w') if fIpa: try: fIpa.write(json.dumps(lIpa)) except: pass finally: fIpa.close() else: print("No se grabaron los valores por defecto!")
def prepararListaDeAsesores(dir=''): global lAse, lNAs lAse = ES.cargaListaJson(dir+'asesores.txt') if not lAse: lAse = [] # Lista de asesores. return lNAs = [] for l in lAse: if (1 == l['id']): continue lNAs.append([l['name'], l['id']]) return
def buscarNombre(): global dPer nombre = ES.entradaNombre(droid, 'Nombre del socio') if None == nombre: return -10, None nombres = [] cedulas = [] try: for k, v in dPer.items(): if 0 <= v.lower().find(nombre.lower()): nombres.append(v) cedulas.append(k) except UnicodeError: pass if not nombres: ES.alerta(droid, nombre, "No hubo coincidencias!") return -10, None indice = ES.entradaConLista(droid, 'SOCIOS ENCONTRADOS', 'Seleccione socio(a)', nombres) if None == indice or 0 > indice: return -10, None return int(cedulas[indice]), nombres[indice]