def ObligorReminder():
    df = pd.read_csv('PeopleList')
    names = df['Name']
    df = df[df['Name'] != 'Rudolf Mathar']
    emails = df['Email']
    balance = df['Balance']
    obligor_set = names[balance < 0]
    subj = "Coffee (Please Recharge)"
    for obligor in obligor_set:
        recipient = emails[names == obligor]
        credit = str(float(balance[names == obligor].values))
        tmp = str(recipient.values)
        recipient = str(tmp[2:len(tmp) - 2])
        msg = "Dear Colleague " + obligor + ", \n\n\nYour current balance for the coffee system is " + credit + "€. You are kindly requested to recharge your account. Please find the attachment"
        files = '../../../../python/Sheriff_of_Nottingham.pdf'
        reportFile = '../../../../python/tmp/' + obligor + '_report.pdf'
        CreatePersonReport(obligor)
        if os.path.isfile(reportFile):
            files = [reportFile, files]
            msg = msg + " for detailed information on your account"
        msg = msg + ".\n\n"
        msg = msg + "PS: This message is sent automatically and privately to you. :-)\n\nSincerely Yours,\nYour Coffee Team"
        snd(recipient, subj, msg, files)
        print(obligor + " was informed via email.\n")
    raw_input("Press any key! ")
Example #2
0
def EmailUponRecharge(person, amount):
    df = pd.read_csv('PeopleList')
    df = df[df['Name'] == person]
    recipient = str(df['Email'].values)
    recipient = str(recipient[2:len(recipient) - 2])
    credit = str(float(df['Balance'].values))
    subj = "Coffee (Recharge Successful)"
    msg = "Dear Colleague " + person + ",\n\nMany thanks to you for recharging your account. Now an amount of "
    msg = msg + str(
        amount
    ) + "€ is deposited into your account.\nYour current balance is " + str(
        credit) + "€"
    files = "../../../../python/Sheriff_of_Nottingham.pdf"
    reportFile = '../../../../python/tmp/' + person + '_report.pdf'
    try:
        CreatePersonReport(person)
        if os.path.isfile(reportFile):
            files = [reportFile, files]
            msg = msg + ". For detailed information on your account, please find the attachment"
    except:
        pass
    msg = msg + ".\n\n"
    msg = msg + "PS: This message is sent automatically and privately to you. :-)\n\nSincerely Yours,\nYour Coffee Team"
    snd(recipient, subj, msg, files)
    print(person + " was informed via email.\n")
    raw_input("Press any key! ")
def whoIsAccountant():
    email = str(keyring.get_password("coffee","email"))
    try:
      snd(email,"test","this is a test",[])
    except:
      print("The accountant info is missing!")
      getAccountantInfo()
def getAccountantInfo():
    email_wrong = True
    subj = "Accountant updated"
    while email_wrong:
        name = str(raw_input("Please insert your complete name: "))
        keyring.set_password("coffee","name",name)

        email = str(raw_input("Please insert your email address: "))
        keyring.set_password("coffee","email",email)

        username = str(raw_input("Please insert your logging name for the mail server: "))
        keyring.set_password("coffee","username",username)

        password = str(getpass.getpass("Please insert your mail server password. It will be stored in your keyring: "))
        keyring.set_password("coffee","password",password)

        msg = "The name of accountant: "+name+"\n"
        msg = msg + "The Email of accountant: "+email+"\n\n\n"
        msg = msg + "If this is wrong. Do it again."
        try:
            snd(email,subj,msg,[])
            email_wrong = False
            print("An email has been sent to the specified address, please check your inbox.")
            raw_input("Press any key to continue.")
        except:
            os.system("clear")
            email = raw_input("Something was wrong! Please give valid entires: ")
Example #5
0
def AddNewMember():
    os.system("clear")
    Today = time.strftime("%d.%m.%Y")
    wish = 'y'
    print "You are about to add a new person!"
    df = pd.read_csv('PeopleList')
    df['Last Termination'] = df['Balance']
    while wish == 'y':
        names = df['Name']
        NewPerson = raw_input("Please, insert the name you wish to be added: ")
        if (len(df[names == NewPerson])) > 0:
            print NewPerson + " already is in the system!"
            key = raw_input("\tWould you like to skip this? [Y/n] ")
            if key == 'n' or key == 'N':
                NewPerson = raw_input("Then, insert the name once more: ")
                email = raw_input("Insert the email address of this person: ")
                FirstMoney = raw_input("Now, insert the initial deposit: ")
                try:
                    FirstMoney = float(FirstMoney)
                except:
                    FirstMoney = 0
                #NewRow = pd.DataFrame([[NewPerson, FirstMoney, 0]], columns=['Name','Balance','Last Termination'])
                NewRow = pd.DataFrame(
                    [[NewPerson, 0, 0, email]],
                    columns=['Name', 'Balance', 'Last Termination', 'Email'])
                df = df.append(NewRow)
            else:
                pass
        else:
            email = raw_input("Insert the email address of this person: ")
            FirstMoney = raw_input("Now, insert the initial deposit: ")
            try:
                FirstMoney = float(FirstMoney)
            except:
                FirstMoney = 0
            NewRow = pd.DataFrame(
                [[NewPerson, 0, 0, email]],
                columns=['Name', 'Balance', 'Last Termination', 'Email'])
            df = df.append(NewRow)
        df = df.sort_values('Name')
        df.to_csv("PeopleList", index=False, header=True)
        #if FirstMoney > 0:
        body = "Dear Colleague " + NewPerson + ",\n\nWelcome to our coffee system. You have now " + str(
            FirstMoney
        ) + "€ in your account. Please enjoy your coffee and do not forget to put a mark on the list (in the kitchen) each time you drink a cup.\n\n"
        body = body + "PS: This message is sent automatically and privately to you. :-)\n\nSincerely Yours,\nYour Coffee Team"
        fileName = "../../../../python/Sheriff_of_Nottingham.pdf"
        subject = "Coffee (Welcome)"
        snd(email, subject, body, fileName)
        GetMoneyKernel(NewPerson, FirstMoney, Today)
        os.system("clear")
        key = raw_input("Do you like to add more people? [y/N] ")
        if key == 'y' or key == 'Y':
            pass
        else:
            wish = 'no'
Example #6
0
def EmailUponiTermination(person,in_msg):
		df = pd.read_csv('PeopleList')
		df = df[df['Name'] == person]
		recipient = str(df['Email'].values)
		recipient = str(recipient[2:len(recipient)-2])
		subj = "Coffee (Termination)"
		msg = "Dear Colleague "+person+",\n\nIt was good to have you as a member of our coffee team. "
		msg = msg + "We wish you all the best in future.\n"
		msg = msg+in_msg
		files = "../../../../python/Sheriff_of_Nottingham.pdf"
		reportFile = '../../../../python/tmp/'+person+'_report.pdf'
		CreatePersonReport(person)
		if os.path.isfile(reportFile):
				files = [reportFile,files]
				msg = msg + ".\nFor detailed information on your account, please find the attachment"
		msg = msg + ".\n\n"
		msg = msg + "PS: This message is sent automatically and privately to you. :-)\n\nSincerely Yours,\nYour Coffee Team"
		snd(recipient,subj, msg,files)
		print (person +" was informed via email.\n")
		raw_input("Press any key! ")
Example #7
0
def CreateAndEmailReport(Person):
    df = pd.read_csv('PeopleList')
    df = df[df['Name'] == Person]
    recipient = df['Email']
    balance = str(float(df['Balance']))
    subj = "Coffee (Personal Report)"
    tmp = str(recipient.values)
    recipient = str(tmp[2:len(tmp) - 2])
    msg = "Dear Colleague " + Person + ", \n\n\n"
    msg = msg + "This email includes your personal record of payments and drinking. Your current balance is " + balance + "€.\n"
    msg = msg + "For detailed information on your account, please find the attachment.\n\n"
    msg = msg + "PS: This message is sent automatically and privately to you. :-)\n\nSincerely Yours,\nYour Coffee Team"
    files = '../../../../python/Sheriff_of_Nottingham.pdf'
    reportFile = '../../../../python/tmp/' + Person + '_report.pdf'
    try:
        CreatePersonReport(Person)
    except:
        print("Report for " + Person + " failed.")
        os.system('echo "' + Person + ',' + str(datetime.datetime.now())[:19] +
                  '">> report_failure.log')
    if os.path.isfile(reportFile):
        files = [reportFile, files]
        snd(recipient, subj, msg, files)
        print(Person + " was informed via email.\n")