Esempio n. 1
0
def get_servidores(post_id=None):
       x = 'SELECT s.*,s.Id as codigo,s.name_servidor as valor FROM kpi.ws_servidores s;'
       rv = metodos.set_list(x,app.config['HOST'] ,app.config['USER'] ,app.config['PASSWORD'],app.config['DB'])
       if rv != None :
             
              return rv
       return jsonify({"type":"error","status":401,"data":None})
Esempio n. 2
0
def lista_report_detail(post_id=None):
      
       x = 'call kpi.sp_reports(2,'+str(post_id)+')'
       rv = metodos.set_list(x,app.config['HOST'] ,app.config['USER'] ,app.config['PASSWORD'],app.config['DB'])
       if rv != None :
             
              return rv
       return jsonify({"type":"error","status":401,"data":None})
Esempio n. 3
0
def lista_report_init():
      
       x = 'call kpi.sp_reports(1,0)'
       rv = metodos.set_list(x,app.config['HOST'] ,app.config['USER'] ,app.config['PASSWORD'],app.config['DB'])
       if rv != None :
             
              return rv
       return jsonify({"type":"error","status":401,"data":None})
Esempio n. 4
0
def lista_report(post_id=None):
      
       x = 'call kpi.sp_reports(1,'+str(post_id)+')'
       rv = metodos.set_list(x,app.config['HOST'] ,app.config['USER'] ,app.config['PASSWORD'],app.config['DB'])
       
       if rv != None :
              content = rv.json
              today = date.today()
              ruta_plantilla = content['data'][0]['ruta_plantilla']
              correos = content['data'][0]['correos'].split(",") if content['data'][0]['correos'] != None else []
              html = content['data'][0]['plantilla'].replace("@NOMBRE_CLIENTE",content['data'][0]['Razon'])
              html = html.replace("@DIA_REPORTE",str(today))
              html = html.replace("@NOMBRE_REPORTE",content['data'][0]['reporte'])
              html = html.replace("@CORREO_CLIENTE",content['data'][0]['correos'])
              plantilla = ''+html.encode('utf-8') if content['data'][0]['plantilla'] != None else ''
              sql='call sp_reports(2,'+str(content['data'][0]['Id'])+')' 
              metodos.modificar_Excel(sql,app.config['HOST'] ,app.config['USER'] ,app.config['PASSWORD'],app.config['DB'],ruta_plantilla)
              send_email(ruta_plantilla,correos,plantilla)
              return rv
       return jsonify({"type":"error","status":401,"data":None})
Esempio n. 5
0
def get_correos(post_id=None):
       x = 'SELECT c.*,c.Id as codigo,c.name_correo as valor FROM kpi.kpi_correos c'
       rv = metodos.set_list(x,app.config['HOST'] ,app.config['USER'] ,app.config['PASSWORD'],app.config['DB'])
       if rv != None :
            return rv
       return jsonify({"type":"error","status":401,"data":None})
Esempio n. 6
0
def get_plantillas(post_id=None):
       x = 'SELECT Id as codigo,name_plantilla as valor FROM kpi.kpi_plantillas'
       rv = metodos.set_list(x,app.config['HOST'] ,app.config['USER'] ,app.config['PASSWORD'],app.config['DB'])
       if rv != None :
            return rv
       return jsonify({"type":"error","status":401,"data":None})