def sendJBBReport(): if cats2.get() == 'TODAY': likeRightnow = getDashDate() jbbReport(likeRightNow) elif cats2.get() == 'YESTERDAY': likeRightNow = getYesterdayStr() jbbReport(likeRightNow)
def toDocx(nomerNota, noNota, perihal, tableList, tempatTanggal, imageList, site, SM): docPath = "..\..\\template\\nota\\NOTA.docx" doc = docx.Document(docPath) doc.paragraphs[0].runs[3].text = noNota # doc.paragraphs[7].text = perihal # # 3.interpolasi Tabel for j in range(6): doc.tables[0].cell(1, j).text = tableList[j] doc.tables[0].cell(2, j).text = tableList[j + 6] doc.tables[0].cell(3, j).text = tableList[j + 12] doc.tables[0].cell(4, j).text = tableList[j + 18] doc.tables[0].cell(5, j).text = tableList[j + 24] doc.tables[0].cell(6, j).text = tableList[j + 30] doc.tables[0].cell(7, j).text = tableList[j + 36] doc.paragraphs[11].runs[0].text = tempatTanggal doc.paragraphs[15].text = SM for i in imageList: addPar = doc.add_paragraph() #from this addRun = addPar.add_run() addRun.add_picture(i, width=Inches(6.5)) #to this docxFolder = structFolderMan( os.environ['USERPROFILE'] + '\\NOTA TRIP NUMBER BARU', site, getDashDate()) docxSavedFilePath = docxFolder + '\\Nota %s.docx' % nomerNota doc.save(docxSavedFilePath) pdFile = docxToPdf(docxSavedFilePath, docxFolder, nomerNota) return pdFile
def mailContent2(subs,DLOPath,outPath,planPath): likeRightNow = getDashDate() msg = MIMEMultipart() msg['Subject'] = subs outName = 'Outstanding JBB %s.xlsx' % likeRightNow planName= 'Plan Ms2 JBB %s.xlsx' % likeRightNow DLOName = 'DataLO JBB %s.xls' % likeRightNow att1 = mailAttachment(outPath,outName) att2 = mailAttachment(planPath,planName) att3 = mailAttachment(DLOPath,DLOName) attachment = [att1,att2,att3] [msg.attach(i) for i in attachment] return msg
def fetchSender(): if cats2.get() == 'TODAY': rightNow = getDashDate() notif = fetchSite(rightNow) if len(notif) != 0: for i in notif: print(i) else: print('Good to go, what are u waiting for!') elif cats2.get() == 'YESTERDAY': rightNow = getYesterdayStr() notif = fetchSite(rightNow) if len(notif) != 0: for i in notif: print(i) else: print('Good to go, what are u waiting for!')
def getAttName(site): tgl = getDashDate() if site == 'UJB': hMin1F= 'OutstandingUJB %s.xlsx' % tgl ms2F= 'PlanMs2UJB %s.xlsx' % tgl dLO = 'DataLO_UJB %s.xls' % tgl return hMin1F,ms2F,dLO elif site == 'TGR': hMin1F= 'OutstandingTG %s.xlsx' % tgl ms2F= 'PlanMs2TG %s.xlsx' % tgl dLO = 'DataLO_TG %s.xls' % tgl return hMin1F,ms2F,dLO elif site == 'PLP': hMin1F= 'OutstandingPLP %s.xlsx' % tgl ms2F= 'PlanMs2PLP %s.xlsx' % tgl dLO = 'DataLO_PLP %s.xls' % tgl return hMin1F,ms2F,dLO elif site == 'BLG': dLO = 'DATA_LO_BLG %s.xls' % tgl return dLO
def toDocx(nomerNota, noNota, perihal, tableList, tempatTanggal): docPath = "..\..\\template\\nota\\NOTA.docx" doc = docx.Document(docPath) doc.paragraphs[0].runs[3].text = noNota # doc.paragraphs[7].text = perihal # # 3.interpolasi Tabel for j in range(6): doc.tables[0].cell(1, j).text = tableList[j] doc.tables[0].cell(2, j).text = tableList[j + 6] doc.tables[0].cell(3, j).text = tableList[j + 12] doc.tables[0].cell(4, j).text = tableList[j + 18] doc.tables[0].cell(5, j).text = tableList[j + 24] doc.tables[0].cell(6, j).text = tableList[j + 30] doc.tables[0].cell(7, j).text = tableList[j + 36] doc.paragraphs[11].runs[0].text = tempatTanggal docxFolder = structFolderMan('NOTA TRIP NUMBER BARU', 'PLP', getDashDate()) docxSavedFilePath = docxFolder + '\\Nota %s.docx' % nomerNota doc.save(docxSavedFilePath) pdFile = docxToPdf(docxSavedFilePath, docxFolder, nomerNota) return pdFile