51 lines
1.4 KiB
Python
51 lines
1.4 KiB
Python
from app import app
|
|
from flask import render_template, request, redirect, url_for, send_file
|
|
from main import *
|
|
import datetime
|
|
|
|
@app.route('/')
|
|
@app.route('/index')
|
|
|
|
def index():
|
|
ClientName = []
|
|
|
|
ClientName = loadClients()
|
|
|
|
|
|
return render_template('index.html', title='SFU', ClientName=ClientName)
|
|
|
|
|
|
@app.route('/runReport', methods=['GET', 'POST'])
|
|
def runReport():
|
|
|
|
ClientConfig = []
|
|
|
|
client = request.form['SelectedClient']
|
|
ClientConfig = GetClientConfig(client)
|
|
|
|
SF_URL = ClientConfig[0]
|
|
SF_HOST = ClientConfig[1]
|
|
REPORT_FIELDS = ClientConfig[2]
|
|
DETAIL_REPORT_FIELDS = ClientConfig[3]
|
|
summary_columnformat = ClientConfig[4]
|
|
headers = ClientConfig[5]
|
|
detail_columnformat = ClientConfig[6]
|
|
detail_headers = ClientConfig[7]
|
|
wb = ClientConfig[8]
|
|
ws = ClientConfig[9]
|
|
ws2 = ClientConfig[10]
|
|
|
|
ticket = Obtain_Ticket(SF_URL, SF_HOST)
|
|
|
|
Run_Report(ticket, SF_URL, SF_HOST, REPORT_FIELDS, wb, ws, ws2, DETAIL_REPORT_FIELDS, summary_columnformat, headers[0],
|
|
detail_columnformat, detail_headers[0], client)
|
|
|
|
Release_Ticket(ticket, SF_URL, SF_HOST)
|
|
|
|
date = datetime.datetime.now()
|
|
filename = str(client) + str(date) + "_report.xlsx"
|
|
|
|
return send_file('report.xlsx', as_attachment=True, attachment_filename = filename)
|
|
|
|
#return(str(client),SF_URL,SF_HOST,REPORT_FIELDS,DETAIL_REPORT_FIELDS,summary_columnformat,headers,detail_columnformat,detail_headers,wb, ws, ws2 )
|