def sendLO(textPath5, textPath6): today = getNow() thisHour = today.strftime('%H') #make data LO and LO open loOpen(thisHour, textPath6) dataLO(thisHour, textPath5) #mail thingy fromAddr, toAddr, pswd = eAddress('PLP_LO') msg = content(textPath5, textPath6) logIn(fromAddr, toAddr, pswd, msg)
def nota(tableList, opt_perihal, imageList): today = getNow() # 1.interpolasi nomor nota thisMonth = today.strftime('%m') romanizing = rome(thisMonth) notaYear = today.strftime('%Y') nomerNota = tableList[0] noNota = '{0}/PLP-MNJ/{1}/{2}'.format(nomerNota, romanizing, notaYear) tempatTanggal = 'Jakarta, {0}'.format(today.strftime('%d %B %Y')) #docPath = "..\..\\template\\nota\\NOTA.docx" #doc = docx.Document(docPath) #doc.paragraphs[0].runs[3].text = noNota del tableList[0] # 2.interpolasi Perihal (conditional) # 2.1 trip number baru if opt_perihal == 'Trip Number tanpa LO': perihal = 'Ada pengisian yang menyebabkan Temperature is inconsistent with given Temperature in Metered Qty sehingga harus dibuatkan trip number baru dengan data sebagai berikut : ' #doc.paragraphs[7].text = tripBaru pdFile = toDocx(nomerNota, noNota, perihal, tableList, tempatTanggal, imageList) fromAddr, toAddr, pswd = eAddress('PLP_NOTA') msg = mailContentNota(pdFile, nomerNota) logIn(fromAddr, toAddr, pswd, msg) # 2.2 MT ASU elif opt_perihal == 'MT UNIK': mobilAsu = tableList[1] perihal = 'Terdapat pengisian pada MT {0} (MT Unik) yang menyebabkan schedule tersebut tidak dapat masuk secara otomatis ke Omega:'.format( mobilAsu) #doc.paragraphs[7].text = mtAsu pdFile = toDocx(nomerNota, noNota, perihal, tableList, tempatTanggal, imageList) fromAddr, toAddr, pswd = eAddress('PLP_NOTA') #test msg = mailContentNota(pdFile, nomerNota) logIn(fromAddr, toAddr, pswd, msg) # 2.3 DO pecah di bawah kapasitas elif opt_perihal == 'DO Pecah': noMT = tableList[1] perihal = 'Terdapat pengisian do pecah dibawah kapasitas pada MT {0}, yang menyebabkan schedule tersebut tidak dapat masuk secara otomatis ke Omega :'.format( noMT) #doc.paragraphs[7].text = doPe pdFile = toDocx(nomerNota, noNota, perihal, tableList, tempatTanggal, imageList) fromAddr, toAddr, pswd = eAddress('PLP_NOTA') msg = mailContentNota(pdFile, nomerNota) logIn(fromAddr, toAddr, pswd, msg) # 2.4 Konsinyasi dan Reservasi elif opt_perihal == 'Konservasi': perihal = 'Terdapat pengisian konsinyasi/reservasi yang menyebabkan schedule tersebut tidak dapat masuk secara otomatis ke MPV :' #doc.paragraphs[7].text = konservasi pdFile = toDocx(nomerNota, noNota, perihal, tableList, tempatTanggal, imageList) fromAddr, toAddr, pswd = eAddress('PLP_NOTA') msg = mailContentNota(pdFile, nomerNota) logIn(fromAddr, toAddr, pswd, msg)
def testNota(tableList, opt_perihal, imageList, site): today = getNow() # 1.interpolasi nomor nota thisMonth = today.strftime('%m') romanizing = rome(thisMonth) notaYear = today.strftime('%Y') nomerNota = tableList[0] namaNota, kota, SM, eAd = siteProfile(site) noNota = '{0}/{3}/{1}/{2}'.format(nomerNota, romanizing, notaYear, namaNota) tempatTanggal = '{1}, {0}'.format(today.strftime('%d %B %Y'), kota) del tableList[0] # 2.interpolasi Perihal (conditional) # 2.1 trip number baru if opt_perihal == 'Trip Number tanpa LO': perihal = 'Ada pengisian yang menyebabkan Temperature is inconsistent with given Temperature in Metered Qty sehingga harus dibuatkan trip number baru dengan data sebagai berikut : ' #doc.paragraphs[7].text = tripBaru pdFile = toDocx(nomerNota, noNota, perihal, tableList, tempatTanggal, imageList, site, SM) fromAddr, toAddr, pswd = testAddr(eAd) msg = mailContentNota(pdFile, nomerNota, site) logIn(fromAddr, toAddr, pswd, msg) # 2.2 MT ASU elif opt_perihal == 'MT UNIK': mobilAsu = tableList[1] perihal = 'Terdapat pengisian pada MT {0} (MT Unik) yang menyebabkan schedule tersebut tidak dapat masuk secara otomatis ke Omega:'.format( mobilAsu) #doc.paragraphs[7].text = mtAsu pdFile = toDocx(nomerNota, noNota, perihal, tableList, tempatTanggal, imageList, site, SM) fromAddr, toAddr, pswd = testAddr(eAd) msg = mailContentNota(pdFile, nomerNota, site) logIn(fromAddr, toAddr, pswd, msg) # 2.3 DO pecah di bawah kapasitas elif opt_perihal == 'DO Pecah': noMT = tableList[1] perihal = 'Terdapat pengisian do pecah dibawah kapasitas pada MT {0}, yang menyebabkan schedule tersebut tidak dapat masuk secara otomatis ke Omega :'.format( noMT) #doc.paragraphs[7].text = doPe pdFile = toDocx(nomerNota, noNota, perihal, tableList, tempatTanggal, imageList, site, SM) fromAddr, toAddr, pswd = testAddr(eAd) msg = mailContentNota(pdFile, nomerNota, site) logIn(fromAddr, toAddr, pswd, msg) # 2.4 Konsinyasi dan Reservasi elif opt_perihal == 'Konservasi': perihal = 'Terdapat pengisian konsinyasi/reservasi yang menyebabkan schedule tersebut tidak dapat masuk secara otomatis ke MPV :' #doc.paragraphs[7].text = konservasi pdFile = toDocx(nomerNota, noNota, perihal, tableList, tempatTanggal, imageList, site, SM) fromAddr, toAddr, pswd = testAddr(eAd) msg = mailContentNota(pdFile, nomerNota, site) logIn(fromAddr, toAddr, pswd, msg)
def structFolder(folderName, site): now = getNow() thisYear = now.strftime('%Y') thisMonth = now.strftime('%B') thisDay = now.strftime('%d') # makeStructuredFolder ddPath = '%s/%s/%s/%s/%s' % (folderName, site, thisYear, thisMonth, thisDay) if not os.path.exists(ddPath): os.makedirs(ddPath) print('Folders created successfully\n{}'.format(ddPath)) return ddPath
def content(textPath5, textPath6): today = getNow() dataLOFormat = today.strftime('%d%b%Y') thisHour = today.strftime('%H') namaFile = 'DATA_LO DAN LO_OPEN {0} Pukul {1}.00'.format( dataLOFormat, thisHour) msg = MIMEMultipart() msg['Subject'] = namaFile # xlsxAttachment # attach dataLO att1 = mailAttachment(textPath5, os.path.basename(textPath5)) att2 = mailAttachment(textPath6, os.path.basename(textPath6)) attachment = [att1, att2] [msg.attach(i) for i in attachment] return msg
def exeJbb(): if cats.get() == 'TODAY': site = 'BLG' strObjd = getNow() fromAddr, toAddr, pswd = eAddress(site) subs = 'JBB Closing %s' % strObjd.strftime('%d-%m-%Y') msg = mailContent(site, subs, pathEntry7.get(), cats.get()) logIn(fromAddr, toAddr, pswd, msg) pathEntry7.delete(0, END) elif cats.get() == 'YESTERDAY': site = 'BLG' strObjd = getYesterday() fromAddr, toAddr, pswd = eAddress(site) subs = 'JBB Closing %s' % strObjd.strftime('%d-%m-%Y') msg = mailContent(site, subs, pathEntry7.get(), cats.get()) logIn(fromAddr, toAddr, pswd, msg) pathEntry7.delete(0, END)