Example #1
0
def sub(clientFile):
	global headers
	global headerGroupings	
	global tyCallers
	global clients

	CFL = getClientFileLists("tyReports/" + clientFile)
	tyClient = CFL.pop(0)[0].split(':')[1].strip()
	CFL = Transpose(CFL) 
	CFL = removePercents(CFL)
	print
	printCfl(CFL)
	headers = CFL.pop(0)
	headerGroupings = getGroupings(headers)
	
	tyCallers = []
	for row in CFL:
		tyCallers.append(TyCaller(row))
	#INSERT TOTALS
	CFL = insertTotals(CFL)
	
	#fill out workable field for each caller for later calculations
	print headers
	for caller in tyCallers:
		caller.workable = getWorkable(caller.data)	

	#grab the guts from qbReader, the fully updated caller list with clients under
	#should grab and sum up times from all listed clients, to deal with multiple qbClients
	# per only one tayrex file. multiple tyFiles per qbClient is kinda screwy at the moment.
	qbCallersList = qbReporterFinal.main()	
	for tyCaller in tyCallers:
		for qbCaller in qbCallersList:
			if tyCaller.qbName == qbCaller.name:
				for qbClient in qbCaller.clients:
					if qbClient.name in clients:
						tyCaller.qbTime += qbClient.time
						print tyCaller.qbName + " " + qbClient.name  + " " + str(tyCaller.qbTime)
						
	redoTimeCalculations()					
	
	headers.append("qbName")
	headers.append("qbTime")
	headers.append("Workable")
	headers.append("qbTime-tyTime")	

	for caller in tyCallers:
		caller.data.append(caller.qbName)
		caller.data.append(caller.qbTime)
		caller.data.append(caller.workable)
		caller.data.append(caller.qbTime - caller.tyTime) #fixed, Tayrex time was being used everywhere and qb time remained -1. no longer.


	#commented out for valerie format 
	#insertConversions()

	insertTimeCalculations()

	#populate caller Dict.
	for index in range(len(headers)):
		for caller in tyCallers:
			caller.dict[headers[index]] = caller.data[index]

	GuideHeader = populateGuideHeader()
	outputHeader = populateOutputHeader(GuideHeader)

	for caller in tyCallers:
		for entry in GuideHeader:
			caller.outputList.append(caller.dict[entry])

	with open("outputs/" + str(tyClient) + "_tyReport.csv", 'wb') as csvfile:
		spamwriter = csv.writer(csvfile, delimiter = ',', quotechar = '"', quoting = csv.QUOTE_MINIMAL)
		

		spamwriter.writerow(outputHeader)
		for caller in tyCallers:
			spamwriter.writerow(caller.outputList)

	print "DONE" 
def sub(clientFile):
	global headers
	global headerGroupings	
	global tyCallers
	global clients

	CFL = getClientFileLists("tyReports/" + clientFile)
	tyClient = CFL.pop(0)[0].split(':')[1].strip()
	CFL = Transpose(CFL) 
	CFL = removePercents(CFL)
	print
	printCfl(CFL)
	headers = CFL.pop(0)
	headerGroupings = getGroupings(headers)
	
	tyCallers = []
	for row in CFL:
		tyCallers.append(TyCaller(row))
	#INSERT TOTALS
	CFL = insertTotals(CFL)
	
	#fill out workable field for each caller for later calculations
	print headers
	for caller in tyCallers:
		caller.workable = getWorkable(caller.data)	

	#grab the guts from qbReader, the fully updated caller list with clients under
	#should grab and sum up times from all listed clients, to deal with multiple qbClients
	# per only one tayrex file. multiple tyFiles per qbClient is kinda screwy at the moment.
	qbCallersList = qbReporterFinal.main()	
	for tyCaller in tyCallers:
		for qbCaller in qbCallersList:
			if tyCaller.qbName == qbCaller.name:
				for qbClient in qbCaller.clients:
					if qbClient.name in clients:
						tyCaller.qbTime += qbClient.time
						print tyCaller.qbName + " " + qbClient.name  + " " + str(tyCaller.qbTime)
						

	headers.append("qbName")
	headers.append("qbTime")
	headers.append("Workable")
	headers.append("qbTime-tyTime")	

	for caller in tyCallers:
		caller.data.append(caller.qbName)
		caller.data.append(caller.qbTime)
		caller.data.append(caller.workable)
		caller.data.append(caller.qbTime - caller.tyTime) #VERY BROKEN FIX PLS


	insertConversions()
	insertTimeCalculations()
	with open("outputs/" + str(tyClient) + "_tyReport.csv", 'wb') as csvfile:
		spamwriter = csv.writer(csvfile, delimiter = ',', quotechar = '"', quoting = csv.QUOTE_MINIMAL)
		

		spamwriter.writerow(headers)
		for caller in tyCallers:
			spamwriter.writerow(caller.data)

	print "DONE" 
Example #3
0
def sub(clientFile):
    global headers
    global headerGroupings
    global tyCallers
    global clients

    CFL = getClientFileLists("tyReports/" + clientFile)
    tyClient = CFL.pop(0)[0].split(':')[1].strip()
    CFL = Transpose(CFL)
    CFL = removePercents(CFL)
    print
    printCfl(CFL)
    headers = CFL.pop(0)
    headerGroupings = getGroupings(headers)

    tyCallers = []
    for row in CFL:
        tyCallers.append(TyCaller(row))
    #INSERT TOTALS
    CFL = insertTotals(CFL)

    #fill out workable field for each caller for later calculations
    print headers
    for caller in tyCallers:
        caller.workable = getWorkable(caller.data)

    #grab the guts from qbReader, the fully updated caller list with clients under
    #should grab and sum up times from all listed clients, to deal with multiple qbClients
    # per only one tayrex file. multiple tyFiles per qbClient is kinda screwy at the moment.
    qbCallersList = qbReporterFinal.main()
    for tyCaller in tyCallers:
        for qbCaller in qbCallersList:
            if tyCaller.qbName == qbCaller.name:
                for qbClient in qbCaller.clients:
                    if qbClient.name in clients:
                        tyCaller.qbTime += qbClient.time
                        print tyCaller.qbName + " " + qbClient.name + " " + str(
                            tyCaller.qbTime)

    headers.append("qbName")
    headers.append("qbTime")
    headers.append("Workable")
    headers.append("qbTime-tyTime")

    for caller in tyCallers:
        caller.data.append(caller.qbName)
        caller.data.append(caller.qbTime)
        caller.data.append(caller.workable)
        caller.data.append(caller.qbTime - caller.tyTime)  #VERY BROKEN FIX PLS

    insertConversions()
    insertTimeCalculations()
    with open("outputs/" + str(tyClient) + "_tyReport.csv", 'wb') as csvfile:
        spamwriter = csv.writer(csvfile,
                                delimiter=',',
                                quotechar='"',
                                quoting=csv.QUOTE_MINIMAL)

        spamwriter.writerow(headers)
        for caller in tyCallers:
            spamwriter.writerow(caller.data)

    print "DONE"
def sub(clientFile):
	global headers
	global headerGroupings	
	global tyCallers
	global client
	CFL = getClientFileLists("tyReports/" + clientFile)
	tyClient = CFL.pop(0)[0].split(':')[1].strip()
	CFL = Transpose(CFL) 
	headers = CFL.pop(0)
	headerGroupings = getGroupings(headers)
	CFL = removePercents(CFL)
	printCfl(CFL)	

	
	tyCallers = []
	for row in CFL:
		tyCallers.append(TyCaller(row))
	#INSERT TOTALS
	CFL = insertTotals(CFL)
	
	#fill out workable field for each caller for later calculations
	#Broken how to fix.....
	print headers
	for caller in tyCallers:
		caller.workable = getWorkable(caller.data)	


	for header in headerGroupings:
		print header.name
		print header.locations
		print

	

	#grab the guts from qbReader, the fully updated caller list with clients under. blech
	qbCallersList = qbReporterFinal.main()	
	for tyCaller in tyCallers:
		for qbCaller in qbCallersList:
			if tyCaller.qbName == qbCaller.name:
				for client in qbCaller.clients:
					if client.name == tyClient:
						tyCaller.qbTime = client.time
						break

	headers.append("qbName")
	headers.append("qbTime")
	headers.append("Workable")
	headers.append("qbTime-tyTime")	

	for caller in tyCallers:
		caller.data.append(caller.qbName)
		caller.data.append(caller.qbTime)
		caller.data.append(caller.workable)
		caller.data.append(caller.qbTime - caller.tyTime)

	insertConversions()
	insertTimeCalculations()
	print "CLIENT" + str(client.name)
	with open("outputs/" + str(tyClient) + "_tyReport.csv", 'wb') as csvfile:
		spamwriter = csv.writer(csvfile, delimiter = ',', quotechar = '"', quoting = csv.QUOTE_MINIMAL)
		

		spamwriter.writerow(headers)
		for caller in tyCallers:
			
			spamwriter.writerow(caller.data)
	print "DONE" + str(datetime.datetime)