コード例 #1
0
def sendPRReports():
    def filteringLatin():
        excel.gotoCell("E10")
        time.sleep(5)
        pyautogui.hotkey("alt","down")

        pyautogui.press("down")
        pyautogui.press("right")
        pyautogui.press("right")
        pyautogui.press("t")
        pyautogui.press("enter")
        time.sleep(2)
        


    #  print(utils.msgbox("teste","teste",4))

    # sys.exit("")
    saveDir = r"C:\AlessandroBAM\2017m01 - Abbott DPE-PgM-PM\Client Support\Pipeline Management\Weekly PR Reports"   
    fileName = os.path.join(saveDir , utils.getStampedStr("Latin America PRs as of {}.xlsx","%b %d"))
    dateStr = utils.getStampedStr("{}","%b %d")
    
    excel.openPBR(pars.pbReportsABT,"")
    excel.runReportByName(reportName=RPT_LPR_BOTH)
    
    # filteringLatin()
    
    excel.saveReportToFile(fileName,excel.AutofitColumns)
    excel.copyReportToClipBoard()
    
    subject = "Latin America PR Report as of " + dateStr
    body = utils.getEmailTemplate("LatamPRs.txt")
    sendVerseEmail(subject, pars.distro02, body, fileName,11, True)
コード例 #2
0
def sendMissingRoster():
    def none():
        excel.AutofitColumns()
        excel.setColumnSize("E", 30)
        excel.setColumnSize("F", 30)
        excel.setColumnSize("G", 30)
    
    def file_massage():
        # Highlighting the columns
        excel.gotoCell("H13")
        pyautogui.keyDown("shift")
        pyautogui.press("right")
        pyautogui.press("right")
        pyautogui.keyUp("shift")

        pyautogui.keyDown("alt")
        pyautogui.press("h")
        pyautogui.press("h")
        pyautogui.keyUp("alt")

        
        pyautogui.press("right",presses=5,interval=1)
        pyautogui.press("enter")

    saveDir = r"C:\AlessandroBAM\2017m01 - Abbott DPE-PgM-PM\Governance\Plan & Build\Weekly Missing Roster Report"   
    fileName = os.path.join(saveDir , utils.getStampedStr("Roster Status as of {}.xlsx","%b %d"))
    dateStr = utils.getStampedStr("{}","%b %d")
    excel.openPBR(pars.pbReportsABT, "")
    excel.runReportByName(reportName=RPT_MRO_BOTH)
    file_massage()
    excel.saveReportToFile(fileName, none)
    excel.copyReportToClipBoard()   
    subject = "Roster Status as of " + dateStr
    body = utils.getEmailTemplate("Missing Roster.txt")
    sendVerseEmail(subject, pars.distro01, body, fileName, 11, True)
コード例 #3
0
    def updateDataSlide(self, area, file):
        self.cleanDataFile(file)

        # Copying Weekly Throughput
        self.openPBR()
        excel.runReportByName("Weekly Throughput")
        if area != "ALL":
            self.filteReport("E10", area)

        excel.copyTable("D15", lr_offsetY=-1)

        self.openDataSheet(file)
        excel.gotoCell("A56")
        excel.pasteValues()

        # Copying Aging
        self.openPBR()
        if area == "ALL":
            excel.runReportByName("Aging by Area")
        else:
            excel.runReportByName("Aging by Module")
            self.filteReport("E10", area)

    # Copying Aging

        excel.copyTable("D13", lr_offsetY=-1)

        self.openDataSheet(file)

        excel.gotoCell("B29")
        excel.pasteValues()
        excel.end("right", 0, 0)
        excel.deleteContent()

        self.openPBR()

        if area != "ALL":
            excel.runReportByName("Monthly Throughput")
            self.filteReport("E10", area)
            excel.copyTable("D13", lr_offsetY=-1)
            self.openDataSheet(file)
            excel.gotoCell("U54")
            excel.pasteValues()

        self.openPBR()
        excel.runReportByName("Monthly MTTR (INC, SR)")

        if area != "ALL":
            self.filteReport("E10", area)

        excel.copyTable("D13", lr_offsetY=-1)

        excel.copy()
        self.openDataSheet(file)

        excel.gotoCell("Z54")
        excel.pasteValues()
コード例 #4
0
def sendCPHoursCostRevProfit():
    saveDir = r"C:\AlessandroBAM\2017m01 - Abbott DPE-PgM-PM\Governance\Plan & Build\AUTO - Weekly CP - Hours, Cost, Rev, Profit report" 
    fileName = os.path.join(saveDir , utils.getStampedStr("{} - CP - Hours, Cost, Rev, Profit.xlsx",utils.YYmMM_DD, lastFriday=True))
    dateStr = utils.getStampedStr("{}","%b %d",lastFriday=True)
    excel.openPBR(pars.pbReportsABT, "")
    excel.runReportByName(reportName="CP - Hours, Cost, Rev, Profit")
    excel.saveReportToFile(fileName, excel.AutofitColumns)
    subject = "CP - Hours, Cost, Rev, Profit (Confirmed)  - WE " + dateStr
    body = utils.getEmailTemplate("IPPF vs Cost Email.txt").format(dateStr)
    sendVerseEmail(subject, ["*****@*****.**"], body, fileName,10,True)
コード例 #5
0
def sendWrongContractFlag():
    saveDir = r"C:\AlessandroBAM\2017m01 - Abbott DPE-PgM-PM\Governance\Plan & Build\2019m07 - Fixed Projects - Daily Report on Wrong Contract Type"   
    fileName = os.path.join(saveDir , utils.getStampedStr("{} - Possibly Wrong Contract Type.xlsx",utils.YYmMM_DD))
    excel.openPBR(pars.pbReportsABT, "")
    excel.runReportByName(reportName="FP Projects Possibly with Incorrect Contract Type on CP")
    excel.saveReportToFile(fileName,excel.AutofitColumns)
    excel.copyReportToClipBoard()
    subject = "Daily Report - Possibly Wrong Contract Type in CP"
    body = utils.getEmailTemplate("Wrong Contract.txt")
    sendVerseEmail(subject, pars.distroTest, body, fileName,11, True)
コード例 #6
0
def send2019DMCApprovedPRs():
    saveDir = r"C:\AlessandroBAM\2017m01 - Abbott DPE-PgM-PM\Client Support\Pipeline Management\Weekly PR Reports" 
    fileName = os.path.join(saveDir , utils.getStampedStr("{} - 2019 DMC Approved PRs.xlsx",utils.YYmMM_DD))
    dateStr = utils.getStampedStr("{}","%b %d",lastFriday=False)
    excel.openPBR(pars.pbReportsABT, "")
    excel.runReportByName(reportName="All 2019 DMC Approved PRs")
    excel.saveReportToFile(fileName, excel.AutofitColumns)
    # excel.copyReportToClipBoard()
    subject = "2019 DMC Approved PRs - " + dateStr
    body = utils.getEmailTemplate("Weekly 2019 DMC PRs.txt").format(dateStr)
    sendVerseEmail(subject, ["*****@*****.**"], body, fileName,11,True)
コード例 #7
0
def sendJNJBreachedTickets():
    saveDir = r"C:\Users\ALESSANDROAlves\Box\Ticket Data J&J Latam\Automation\00 - SLA Management\Daily Breached Tickets Report"   
    fileName = os.path.join(saveDir , utils.getStampedStr("{} - Breached tickets in Current Tableau Month.xlsx",utils.YYmMM_DD))
    dateStr = utils.getStampedStr("{}","%b %d")
    
    excel.openPBR(pars.pbReportsJNJ,"")
    excel.runReportByName(reportName="Breached Incidents  - Current Month")
    excel.saveReportToFile(fileName,excel.AutofitColumns)
    excel.copyReportToClipBoard()
    subject = "JnJ Breached Tickets for the Current Tableau Month as of " + dateStr
    body = utils.getEmailTemplate("JNJ Breached Tickets.txt")
    sendVerseEmail(subject, ["*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**","*****@*****.**"], body, fileName,20, True)
コード例 #8
0
def sendCNBReport():
    saveDir = r"C:\AlessandroBAM\2017m01 - Abbott DPE-PgM-PM\Staffing\Non Billable Hours\Weekly Update to Leadership (email)" 
    fileName = os.path.join(saveDir , utils.getStampedStr("CNB Weekly Report for {}.xlsx","%b %d", lastFriday=True))
    dateStr = utils.getStampedStr("{}","%b %d",lastFriday=True)
    excel.openPBR(pars.pbReportsABT, "")
    excel.runReportByName(reportName=RPT_CNB_ATTA)
    excel.saveReportToFile(fileName, excel.AutofitColumns)
    excel.runReportByName(reportName="Non Billable Hours Variance")
    pyautogui.press("enter")
    # time.sleep(10)
    excel.copyReportToClipBoard()
    subject = "Weekly CNB Variance Report - WE " + dateStr
    body = utils.getEmailTemplate("CNB.txt").format(dateStr)
    sendVerseEmail(subject, pars.distro01, body, fileName,11,True)
コード例 #9
0
def updateSLATrackerFile():
    excel.openPBR(pars.pbReportsJNJ)
    excel.runReportByName("SLA - Tracker")
    excel.copyTable("E14",ul_offsetX=1, lr_offsetX=-1)
    excel.openPBR(pars.slaTracker)
    excel.gotoCell("D5")
    excel.pasteValues()
    excel.openPBR(pars.pbReportsJNJ)
    excel.filterPivot("E9","All")
    excel.copyTable("E14",ul_offsetX=1, lr_offsetX=-1)
    excel.openPBR(pars.slaTracker)
    excel.gotoCell("H5")
    excel.pasteValues()
    excel.gotoCell("A17")
コード例 #10
0
def sendClaimWatingReport():
    saveDir = r"C:\AlessandroBAM\2017m01 - Abbott DPE-PgM-PM\Staffing\Non Billable Hours\Weekly Claim Waiting Variance Report - WE Month Day" 
    
    fileName = os.path.join(saveDir , utils.getStampedStr("Claim Waiting week of {}.xlsx","%b %d", lastFriday=True))
    dateStr = utils.getStampedStr("{}","%b %d",lastFriday=True)
    excel.openPBR(pars.pbReportsABT, "")

    excel.runReportByName(reportName=RPT_CWA_ATTA)
    excel.saveReportToFile(fileName, excel.AutofitColumns)
    excel.runReportByName(reportName=RPT_CWA_BODY)
    excel.copyReportToClipBoard()
    subject = "Weekly Claim Waiting Report - WE " + dateStr
    body = utils.getEmailTemplate("ClaimWaiting.txt").format(dateStr)
    sendVerseEmail(subject, pars.distro01, body, fileName,11,True)
コード例 #11
0
def sendPBReportsByEmail(pbrfile,
                         reportName,
                         emailSubject,
                         distro,
                         body,
                         saveExcelReportTo,
                         timeStampFileFormat="today",
                         IncludeReportInBodyReport=False):
    # timeStampFileFormat - today, last_friday, none

    excel.openPBR(pbrfile)
    fileName = excel.runReportByName(reportName, saveExcelReportTo,
                                     timeStampFileFormat)
    # utils.alert(fileName)
    if IncludeReportInBodyReport:
        excel.copyReportToClipBoard()

    emailSubject = emailSubject + " as of " + utils.getTimeStampStr(
        "%b %d", timeStampFileFormat)
    verse.sendVerseEmail(emailSubject, distro, body, fileName, True)


# sendPBReportsByEmail(pars.pbReportsABT,"CGP - Labor vs Non Labor","Test Report", ["*****@*****.**"],"This is a automatic email", r"C:\Temp\report01.xlsx","today", True)

# sendPBReportsByEmail(pbrfile = pars.pbReportsABT,
#                      reportName = "CP - Hours, Cost, Rev, Profit",
#                      emailSubject = "CP - Hours, Cost, Rev, Profit  - WE",
#                      distro = ["*****@*****.**"],
#                      body = utils.getEmailTemplate("IPPF vs Cost Email.txt"),
#                      saveExcelReportTo = r"C:\AlessandroBAM\2017m01 - Abbott DPE-PgM-PM\Governance\Plan & Build\AUTO - Weekly CP - Hours, Cost, Rev, Profit report\CP - Hours, Cost, Rev, Profit.xlsx",
#                      timeStampFileFormat = "last_friday",
#                      IncludeReportInBodyReport = True)

# excel.AutofitColumns()
コード例 #12
0
def sendBPCSCategorizationReport():
    template =r'"C:\AlessandroBAM\2017m01 - Abbott DPE-PgM-PM\CIC Brazil\Automation\F0001 - Create a automatic process for Ticket Categorization in BPCS\UncatTemplate.xlsx"'
    saveDir = r"C:\Users\ALESSANDROAlves\Box\Abbott Latam\Abbott Latam - Workspace\BPCS ITSM Categorization"   
    fileName = os.path.join(saveDir , utils.getStampedStr("{} - Uncategorized tickets.xlsx",utils.YYmMM_DD))
    dateStr = utils.getStampedStr("{}","%b %d")
    excel.openPBR(pars.pbReportsABT, "")
    excel.runReportByName(reportName=RPT_ITMS_CAT)
    # excel.saveReportToFile(fileName)
    
    excel.gotoCell("D14")                     #selecting data in the pivot table  
    excel.endSelect("down")                   #selecting data in the pivot table
    excel.endSelect("right")                  #selecting data in the pivot table
    pyautogui.hotkey("shift","left")          #selecting data in the pivot table
    excel.copy()                              #selecting data in the pivot table

    excel.open(template,4)
    excel.gotoCell("B2")    

    excel.pasteValues()
    excel.AutofitColumns()
    pyautogui.press("up")
    excel.endSelect("right")
    excel.activateAutoFilter()
    excel.gotoCell("A1")
    excel.setColumnSize("F",95)
    utils.moveFilesToArchive(fileName)
    excel.saveAs(fileName)
    excel.close()

    excel.runReportByName(reportName="ITSM - Uncategorized Tickets Summary - Latam")
    excel.findText("Grand Total",0)
    pyautogui.press("right")
    pyautogui.press("right")
    excel.copy()

    ticketCount = pyperclip.paste().replace('\n', '').replace('\r', '')
    excel.copyReportToClipBoard()
    subject = ("Weekly Ticket Categorization - There are {} tickets pending categorization as of " + dateStr).format(ticketCount)
    body = utils.getEmailTemplate("Categorized Tickets.txt")
    sendVerseEmail(subject, pars.distroBPCS+pars.distroADAM, body.format(ticketCount), "", 20,True)
コード例 #13
0
def updateRosterWithCGPRates():
    formulaCol = "" 
    ratesRange = ""
  
    def formatCGPReport():
        nonlocal formulaCol
        nonlocal ratesRange
        
        # excel.AutofitColumns()
        
        limitCol = excel.getlimitY("A2")
        excel.right()
        excel.enterFormula("New Rate")
        formulaCol = excel.getCurrentCol()       
        
        limitRow = int(excel.getlimitX("A2",1))-1
        rowRange = "A{}:{}{}".format(limitRow,limitCol,limitRow) 
        excel.gotoCell(limitCol+str(limitRow))
        excel.right()
        excel.enterFormula(r'=LOOKUP(2,1/({}<>""),{})'.format(rowRange,rowRange))   
        excel.copy()
        excel.up()
        excel.endSelect("up")
        pyautogui.hotkey("shift","down")
        excel.paste()
        excel.gotoCell("a2")
        ratesRange = "$A$3:${}${}".format(excel.nextColLetter(limitCol),limitRow)

    def applyRatesToRoster():
        nonlocal formulaCol
        nonlocal ratesRange
        excel.open(pars.pbRoster, r"excel\files\Roster.xlsx.PNG")
        time.sleep(2)
        

        excel.gotoCell("A2000")
        excel.end( "up",0,0)
        limitRow = excel.getCurrentRow()
        rateCol = 9
        excel.gotoCell("i2")
        excel.addCol()
        
        print ("formulaCol: " + formulaCol)
        
        lookupFormula = "=IFERROR(VLOOKUP(A{},{}{},{},FALSE),J{})".format(limitRow,formulaFileName,ratesRange,int(excel.colNameToNum(formulaCol)),limitRow) 
        print(lookupFormula)
        excel.gotoCell("i" + limitRow)

        # fill up
        excel.enterFormula(lookupFormula)
        excel.copy()
        excel.up()
        excel.endSelect("up")
        excel.paste()



        excel.addCol()
        excel.right()
        excel.end("down")
        excel.left()
        excel.enterFormula("=IF(J{}>0,J{},K{})".format(limitRow,limitRow,limitRow))

        # fill up
        excel.copy()
        excel.up()
        excel.endSelect("up")
        excel.paste()

        excel.gotoCell("i2")
        pyautogui.hotkey("ctrl", "shift","down")
        excel.copy()


        excel.gotoCell("K2")
        excel.pasteValues()
        excel.left()
        excel.deleteCol()
        excel.left()
        excel.deleteCol()
        
        
        # excel.addCol()
        # lookupFormula = "=IFERROR(VLOOKUP(A{},{}{},{},FALSE),J{})".format(limitRow,formulaFileName,ratesRange,int(excel.colNameToNum(formulaCol)),limitRow) 



        # excel.deleteCol()
    
    saveDir = r"C:\AlessandroBAM\2017m01 - Abbott DPE-PgM-PM\Governance\Plan & Build\AUTO - Update Roster Rates Based on Latest CGP" 
    fileName = utils.getStampedStr("{} - CGP Rates by Emp.xlsx",utils.YYmMM_DD)
    fullFileName = os.path.join(saveDir , fileName)
    formulaFileName =  os.path.join("' " + saveDir , "["+ fileName + "]Sheet1'!")
    dateStr = utils.getStampedStr("{}","%b %d",lastFriday=False)
    excel.openPBR(pars.pbReportsABT )
    excel.runReportByName(reportName="CGP - Cost Rates by Employee")
    excel.saveReportToFile(fullFileName, formatCGPReport)
    
    applyRatesToRoster()
コード例 #14
0
def postMonthlyReport(reportName, targetCell):
    excel.openPBR(pars.pbReportsJNJ)
    excel.runReportByName(reportName)
    excel.copyTable("D13")
    pasteValuesToSheet(pars.pbReportsJNJ, dataFile, targetCell)