Пример #1
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'))
Пример #2
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