Exemplo n.º 1
0
def test_screenshot():
    sc.get_m3_coordinates()
    x, y = m3['title']
    assert take_screenshot(x + 431, y + 256 + 13 * 6, 55,
                           10) == sc.day_drive_event
    assert take_screenshot(x + 751, y + 256 + 13 * 6, 55,
                           10) == sc.minivac_event
Exemplo n.º 2
0
def check_for_dep_premium(deposit_df, premiums):
    sc.get_m3_coordinates()
    global errors
    for index, row in deposit_df.iterrows():
        if row['Deposit_Type'] == 'Refundable' and row['Price'] == '40':
            if any(i in premiums for i in ['DEP $40 CC', 'DEP $40 Cash']):
                print(u"\u001b[32m" + '$40 DEP is present' + u"\u001b[0m")
            else:
                print(u"\u001b[31m" + 'Missing $40 DEP' + u"\u001b[0m")
                errors += 1
        elif row['Deposit_Type'] == 'Refundable' and row['Price'] == '50':
            if any(i in premiums for i in
                   ['DEP $50 CC', 'DEP $50 Cash', 'CS $50 CC Deposit']):
                print(u"\u001b[32m" + '$50 DEP is present' + u"\u001b[0m")
            else:
                print(u"\u001b[31m" + 'Missing $50 DEP' + u"\u001b[0m")
                errors += 1
        elif row['Deposit_Type'] == 'Refundable' and row['Price'] == '20':
            if 'DEP $20 CC' in premiums:
                print(u"\u001b[32m" + '$20 DEP is present' + u"\u001b[0m")
            else:
                print(u"\u001b[31m" + 'Missing $20 DEP' + u"\u001b[0m")
                errors += 1
        elif row['Deposit_Type'] == 'Refundable' and row['Price'] == '99':
            if 'DEP $99 CC' in premiums:
                print(u"\u001b[32m" + '$99 DEP is present' + u"\u001b[0m")
            else:
                print(u"\u001b[31m" + 'Missing $99 DEP' + u"\u001b[0m")
                errors += 1
        elif row['Deposit_Type'] == 'Refundable' and row['Price'] == '100':
            if 'DEP $100 CC' in premiums:
                print(u"\u001b[32m" + '$100 DEP is present' + u"\u001b[0m")
            else:
                print(u"\u001b[31m" + 'Missing $100 DEP' + u"\u001b[0m")
                errors += 1
Exemplo n.º 3
0
def read_premiums(number_of_refundable_deposits):
    global premium_dict
    list_of_premiums = []
    number_of_dep_premiums = 0
    number_of_premiums = 0
    sc.get_m3_coordinates()
    x, y = m3['title']
    pyautogui.click(m3['premiums'])
    image = pyautogui.locateCenterOnScreen(
        'C:\\Users\\Jared.Abrahams\\Screenshots\\issued.png',
        region=(514, 245, 889, 566))
    while image is None:
        image = pyautogui.locateCenterOnScreen(
            'C:\\Users\\Jared.Abrahams\\Screenshots\\issued.png',
            region=(514, 245, 889, 566))
    while True:
        screenshot_2 = cf.take_screenshot_change_color(x + 433, y + 60, 10, 8)
        premium = sqlite_select(
            cf.take_screenshot_change_color(x + 342, y + 60, 80, 11),
            'premiums')
        if premium == 'nothing':
            break
        else:
            if screenshot_2 == sqlite_get_item(
                    "SELECT screenshot FROM premiums WHERE name=?",
                ['Did Not Issue']):
                premium = f'{premium} - Canceled'
            if 'DEP' in premium and 'Canceled' not in premium:
                number_of_dep_premiums += 1
                # if '20' in premium:
                #     screenshot = '20'
                # elif '40' in premium:
                #     screenshot = '40'
                # elif '$50 ' in premium:
                #     screenshot = '50'
                # elif '99' in premium:
                #     screenshot = '99'
            list_of_premiums.append(premium)
            number_of_premiums += 1
            y += 13
    if number_of_dep_premiums != number_of_refundable_deposits:
        log.info(
            str(number_of_dep_premiums) + ' DEP Premium(s) - ' +
            str(number_of_refundable_deposits) + ' Refundable Deposit(s)')
        print(u"\u001b[31m" + str(number_of_dep_premiums) +
              ' DEP Premium(s) - ' + str(number_of_refundable_deposits) +
              ' Refundable Deposit(s)' + u"\u001b[0m")
    else:
        print(u"\u001b[32m" + str(number_of_dep_premiums) +
              ' DEP Premium(s) - ' + str(number_of_refundable_deposits) +
              ' Refundable Deposit(s)' + u"\u001b[0m")
    if number_of_premiums != len(set(list_of_premiums)):
        print(u"\u001b[31m" + str(number_of_premiums) +
              ' Premium(s) - DUPLICATES' + u"\u001b[0m")
    else:
        print(u"\u001b[32m" + str(number_of_premiums) +
              ' Premium(s) - No Duplicates' + u"\u001b[0m")
    return list_of_premiums
Exemplo n.º 4
0
def create_deposit_dataframe():
    sc.get_m3_coordinates()
    x, y = m3['deposit_1']
    x_2, y_2 = m3['title']
    d = []
    number_of_deposits = count_deposits()
    if number_of_deposits == 0:
        number_of_refundable_deposits = 0
        return 'No Deposits', number_of_refundable_deposits
    for i in range(number_of_deposits):
        clipboard.copy('bad')
        hundreds = str(
            sqlite_select(
                cf.take_screenshot_change_color(x_2 + 467, y_2 + 69 + i * 13,
                                                6, 9), 'numbers'))
        tens = str(
            sqlite_select(
                cf.take_screenshot_change_color(x_2 + 473, y_2 + 69 + i * 13,
                                                6, 9), 'numbers'))
        ones = str(
            sqlite_select(
                cf.take_screenshot_change_color(x_2 + 479, y_2 + 69 + i * 13,
                                                6, 9), 'numbers'))
        if hundreds == 'nothing':
            hundreds = ''
        if tens == 'nothing':
            tens = ''
        price = hundreds + tens + ones
        pyautogui.click(x, y)
        y += 13
        pyautogui.click(m3['change_deposit'])
        sc.get_m6_coordinates()
        pyautogui.click(m6['description'])
        keyboard.send('ctrl + z')
        keyboard.send('ctrl + c')
        r = Tk()
        result = r.selection_get(selection="CLIPBOARD")
        while result == 'bad':
            pyautogui.click(m6['description'])
            keyboard.send('ctrl + z')
            keyboard.send('ctrl + c')
            result = r.selection_get(selection="CLIPBOARD")
        if 'refunded' in result.lower():
            deposit_type = 'Refunded'
        elif 'minivac' in result.lower() or 'apply' in result.lower():
            deposit_type = 'Non_Refundable'
        elif 'ref' in result.lower():
            deposit_type = 'Refundable'
        else:
            deposit_type = 'Non_Refundable'
        d.append({'Deposit_Type': deposit_type, 'Price': price})
        pyautogui.click(m6['ok'])
    df = pd.DataFrame(d)  # Turn d into a dataframe
    deposit_df = df[['Deposit_Type',
                     'Price']]  # Reorders the columns in the dataframe.
    number_of_refundable_deposits = len(df[(df.Deposit_Type == 'Refundable')])
    return deposit_df, number_of_refundable_deposits
Exemplo n.º 5
0
def add_premium_to_dictionary():
    global premium_dict
    sc.get_m3_coordinates()
    number_of_premiums = 0
    screenshot_number = 0
    pyautogui.click(m3['premiums'])
    x, y = m3['premium_1']
    image = pyautogui.locateCenterOnScreen(
        'C:\\Users\\Jared.Abrahams\\Screenshots\\issued.png',
        region=(514, 245, 889, 566))
    while image is None:
        image = pyautogui.locateCenterOnScreen(
            'C:\\Users\\Jared.Abrahams\\Screenshots\\issued.png',
            region=(514, 245, 889, 566))
    while True:
        screenshot = cf.take_screenshot(x - 223, y - 4, 90, 9)
        screenshot_number += 1
        try:
            screenshot = premium_dict[screenshot]
        except KeyError:
            pyautogui.click(x - 223, y - 4)
            pyautogui.click(m3['change_premium'])
            sc.get_m10_coordinates()
            time.sleep(1)
            pyautogui.doubleClick(m10['name'])
            keyboard.send('ctrl + z')
            keyboard.send('ctrl + c')
            # pyautogui.click(m3['change_premium'])
            copied_text = str(clipboard.paste())
            premium_dict[str(screenshot)] = copied_text
            f = open('text_files\\premiums.p', 'wb')
            pickle.dump(premium_dict, f)
            f.close()
            f = open('text_files\\premiums.p', 'rb')
            premium_dict = pickle.load(f)
            f.close()
            f = open('text_files\\premiums_backup.p', 'ab')
            pickle.dump(premium_dict, f)
            f.close()
            pyautogui.click(m10['ok'])
            image = pyautogui.locateCenterOnScreen(
                'C:\\Users\\Jared.Abrahams\\Screenshots\\Titles\\changingpremium.png',
                region=(514, 245, 889, 566))
            while image is None:
                image = pyautogui.locateCenterOnScreen(
                    'C:\\Users\\Jared.Abrahams\\Screenshots\\issued.png',
                    region=(514, 245, 889, 566))
            time.sleep(0.5)
        if screenshot == 'Nothing':
            return number_of_premiums
        else:
            number_of_premiums += 1
            y += 13
Exemplo n.º 6
0
def check_for_upgrade():
    sc.get_m3_coordinates()
    x, y = m3['title']
    pyautogui.click(m3['events'])
    while not pyautogui.pixelMatchesColor(x + 290, y + 260, (8, 36, 107)):
        pass
    n = 0
    for i in range(11):
        prior_value = take_screenshot(x + 431, y + 256 + 13 * n, 55, 10)
        new_value = take_screenshot(x + 751, y + 256 + 13 * n, 55, 10)
        if prior_value == sc.day_drive_event and new_value == sc.minivac_event:
            return 'upgrade'
        else:
            n += 1
Exemplo n.º 7
0
def enter_personnel(sol, row):
    sc.get_m3_coordinates()
    for i in row.type:
        pyautogui.click(m3['personnel'])
        pyautogui.click(m3['insert_personnel'])
        sc.get_m12_coordinates()
        x, y = m12['title']
        screenshot = cf.take_screenshot_change_color(x + 44, y + 16, 9, 27)
        screenshot_2 = sqlite_get_item(
            "SELECT screenshot FROM misc WHERE name=?",
            ['by_personnel_number_selected'])
        test = 0
        while screenshot != screenshot_2:
            pyautogui.click(m12['by_personnel_number'])
            screenshot = cf.take_screenshot_change_color(x + 44, y + 16, 9, 27)
            screenshot_2 = sqlite_get_item(
                "SELECT screenshot FROM misc WHERE name=?",
                ['by_personnel_number_selected'])
            test += 1
            if test >= 5:
                print(x, y, m12['by_personnel_number'])
        keyboard.write(sol)
        pyautogui.click(m12['select'])
        image = pyautogui.locateCenterOnScreen(
            'C:\\Users\\Jared.Abrahams\\Screenshots\\sc_personnel_titles_menu.png',
            region=(514, 245, 889, 566))
        while image is None:
            image = pyautogui.locateCenterOnScreen(
                'C:\\Users\\Jared.Abrahams\\Screenshots\\sc_personnel_titles_menu'
                '.png',
                region=(514, 245, 889, 566))
        x_3, y_3 = image
        pyautogui.click(x_3 + 75, y_3 + 150)  # Close
        sc.get_m13_coordinates()
        if cf.take_screenshot_change_color(m13['title'][0] + 26, m13['title'][1] + 73, 45, 15) != \
                sqlite_get_item("SELECT screenshot FROM misc WHERE name=?", ['confirmer']):
            pyautogui.click(m13['title_personnel'])
            keyboard.write("cc")
        pyautogui.click(m13['type'])
        if i == 'c':
            keyboard.write("cc")
        elif i == 'r':
            keyboard.write("r")
        elif i == 'x':
            keyboard.write("c")
        elif i == 'u':
            keyboard.write("u")
        elif i == 't':
            keyboard.write("t")
        pyautogui.click(m13['ok'])
Exemplo n.º 8
0
 def wave(self):
     sc.get_m3_coordinates()
     x, y = m3['title']
     conn = sqlite3.connect('sqlite.sqlite')
     c = conn.cursor()
     wave = ''
     for i in range(4):
         screenshot = cf.take_screenshot_change_color(x + 37 + 6 * i, y + 247, 6, 9)
         if screenshot != 'nothing':
             c.execute("SELECT name FROM numbers WHERE screenshot=?", [screenshot])
             number = str(c.fetchone()[0])
             wave += number
         else:
             continue
     return wave
Exemplo n.º 9
0
def add_note():
    sc.get_m3_coordinates()
    x, y = m3['title']
    pyautogui.click(x, y + 435)
    sc.get_m14_coordinates()
    sites_dictionary = read_pickle_file('sites.p')
    site = cf.take_screenshot(1517, 1036, 146, 17)
    if sites_dictionary[site] == 'Northstar':
        keyboard.write(' Blank')
    else:
        keyboard.write('Blank')
    pyautogui.click(m14['note'])
    keyboard.write(
        'Please refund by cash the charge is over 120 days and cannot be refunded back to CC.'
    )
    pyautogui.click(m14['ok'])
Exemplo n.º 10
0
def count_accommodations():
    sc.get_m3_coordinates()
    number_of_accommodations = 0
    number_of_canceled_accommodations = 0
    x, y = m3['title']
    while True:
        screenshot = cf.take_screenshot(x + 330, y + 64, 97, 7)
        if screenshot == sc.no_accommodations:
            return number_of_accommodations, number_of_canceled_accommodations
        else:
            screenshot_2 = cf.take_screenshot(x + 211, y + 66, 52, 5)
            if screenshot_2 == sc.canceled_accommodation:
                number_of_canceled_accommodations += 1
                y += 13
            else:
                number_of_accommodations += 1
                y += 13
Exemplo n.º 11
0
def count_premiums():
    number_of_premiums = 0
    sc.get_m3_coordinates()
    x, y = m3['title']
    pyautogui.click(m3['premiums'])
    image = pyautogui.locateCenterOnScreen('C:\\Users\\Jared.Abrahams\\Screenshots\\issued.png',
                                           region=(514, 245, 889, 566))
    while image is None:
        image = pyautogui.locateCenterOnScreen('C:\\Users\\Jared.Abrahams\\Screenshots\\issued.png',
                                               region=(514, 245, 889, 566))
    while True:
        premium = cf.take_screenshot_change_color(x + 342, y + 60, 80, 11)
        if premium == 'nothing':
            break
        else:
            number_of_premiums += 1
            y += 13
    return number_of_premiums
Exemplo n.º 12
0
def count_deposits():
    sc.get_m3_coordinates()
    number_of_deposits = 0
    pyautogui.click(m3['tour_packages'])
    x, y = m3['title']
    image = pyautogui.locateCenterOnScreen('C:\\Users\\Jared.Abrahams\\Screenshots\\balance.png',
                                           region=(700, 245, 850, 566))
    while image is None:
        image = pyautogui.locateCenterOnScreen('C:\\Users\\Jared.Abrahams\\Screenshots\\balance.png',
                                               region=(700, 245, 850, 566))
    while True:
        # Counts number of deposits.
        # Breaks 'while' loop once a returned screenshot is blank
        deposit_screenshot = cf.take_screenshot(x + 255, y + 69, 6, 9)
        if deposit_screenshot == sc.no_deposits:
            return number_of_deposits
        else:
            number_of_deposits += 1
            y += 13
Exemplo n.º 13
0
def gather_m3_data():
    sc.get_m3_coordinates()
    x, y = m3['title']
    tour_types_dict = cf.read_pickle_file('m3_tour_type.p')
    m3_tour_type = tour_types_dict[cf.take_screenshot(x + 36, y + 143, 89, 12)]
    m3_tour_status = sc.m3_tour_status[cf.take_screenshot(
        x + 37, y + 170, 94, 11)]
    month = cf.take_screenshot(x + 37, y + 196, 13, 10)
    day = cf.take_screenshot(x + 52, y + 196, 15, 10)
    year = cf.take_screenshot(x + 68, y + 196, 27, 10)
    m3_date = cf.turn_screenshots_into_date(month, day, year)
    try:
        m3_date = datetime.datetime.strptime(m3_date, "%m/%d/%Y")
    except ValueError:
        month = cf.take_screenshot(x + 40, y + 196, 13, 10)
        day = cf.take_screenshot(x + 55, y + 196, 15, 10)
        year = cf.take_screenshot(x + 71, y + 196, 27, 10)
        m3_date = cf.turn_screenshots_into_date(month, day, year)
        m3_date = datetime.datetime.strptime(m3_date, "%m/%d/%Y")
    return m3_tour_type, m3_tour_status, m3_date
Exemplo n.º 14
0
def check_tour_type(number_of_tours, status):
    global errors
    sc.get_m3_coordinates()
    x, y = m3['title']
    tour_types_dict = cf.read_pickle_file('m3_tour_type.p')
    tour_type = tour_types_dict[cf.take_screenshot(x + 36, y + 143, 89, 12)]
    if 'u' in status and tour_type != 'Minivac':
        cf.print_colored_text('Can\'t upgrade day drive', 'red')
        errors += 1
    if 't' in status and tour_type != 'Day_Drive':
        cf.print_colored_text('TAVS are only for Day Drives.', 'red')
        errors += 1
    if (tour_type == 'Day_Drive' or tour_type == 'Canceled'
            or tour_type == 'Open_Reservation') and number_of_tours > 0:
        cf.print_colored_text(tour_type + ' - ' + str(number_of_tours), 'red')
        errors += 1
    elif tour_type == 'Minivac' and 'x' not in status and number_of_tours < 1:
        cf.print_colored_text(tour_type + ' - ' + str(number_of_tours), 'red')
        errors += 1
    else:
        log.info(tour_type + ' - ' + str(number_of_tours))
        cf.print_colored_text(tour_type + ' - ' + str(number_of_tours),
                              'green')
    return tour_type
Exemplo n.º 15
0
def enter_m2_info():
    df = convert_excel_to_dataframe()
    switch_site(df.loc[0, 'Site'])
    insert_new_pid()
    sc.get_m2_coordinates(True)
    # Menu 2 - Prospect
    pyautogui.click(m2['last_name'])
    keyboard.write(df.loc[0, 'Last_Name'])
    pyautogui.click(m2['first_name'])
    keyboard.write(df.loc[0, 'First_Name'])
    pyautogui.click(m2['address'])
    keyboard.write(df.loc[0, 'Address'])
    pyautogui.click(m2['city'])
    keyboard.write(df.loc[0, 'City'])
    pyautogui.click(m2['state'])

    pyautogui.click(m2['postal_code'])
    keyboard.write(str(df.loc[0, 'Zip']))
    pyautogui.click(m2['country'])
    for i in range(5):
        keyboard.send('u')
    pyautogui.click(m2['phone1'])
    keyboard.write(df.loc[0, 'Phone'])
    if str(df.loc[0, 'Phone_2']) != 'nan':
        pyautogui.click(m2['phone2'])
        keyboard.write(df.loc[0, 'Phone_2'])
    if str(df.loc[0, 'Email']) != 'nan':
        pyautogui.click(m2['email'])
        keyboard.write(df.loc[0, 'Email'])
    pyautogui.click(m2['demographics'])
    # Menu 2 - Demographics
    pyautogui.click(m2['marital_status'])
    if df.loc[0, 'Marital_Status'] == 'sm':
        for i in range(2):
            keyboard.send('s')
    else:
        keyboard.send(df.loc[0, 'Marital_Status'])
        pyautogui.click(m2['marital_status'])
    pyautogui.click(m2['spouse'])
    keyboard.write(('{} {}'.format(df.loc[0, 'Spouse_First_Name'],
                                   df.loc[0, 'Spouse_Last_Name'])))
    pyautogui.click(m2['occupation'])
    keyboard.send('e')
    pyautogui.click(m2['income'])
    keyboard.write('70')
    x, y = m2['income']
    pyautogui.click(x, y + 25)
    keyboard.send('e')
    pyautogui.click(m2['notes_co'])
    pyautogui.click(m2['insert_coprospects'])
    # Menu 4 - Adding a co-prospect
    sc.get_m5_coordinates()
    pyautogui.click(m5['get_from_prospect'])
    pyautogui.click(m5['first'])
    keyboard.write(df.loc[0, 'Spouse_First_Name'])
    pyautogui.click(m5['ok'])
    sc.get_m2_coordinates(True)
    pyautogui.click(m2['insert_tour'])
    #  Menu 3 - Adding a Tour Record
    sc.get_m3_coordinates()
    pyautogui.click(m3['campaign'])
    #  Menu 4 - Select a Campaign
    sc.get_m4_coordinates()
    pyautogui.click(m4['clear'])
    pyautogui.click(m4['campaign'])
    keyboard.write('bttordm')
    pyautogui.click(m4['select'])
    # Menu 3 - Adding a Tour Record
    sc.get_m3_coordinates()
    pyautogui.click(m3['tour_type'])
    keyboard.send('m')
    pyautogui.click(m3['tour_status'])
    keyboard.write('b')
    pyautogui.click(m3['tour_date'])
    keyboard.write(df.loc[0, 'Tour_Date'])
    pyautogui.click(m3['tour_location'])
    for i in range(5):
        keyboard.send('down')
    pyautogui.click(m3['wave'])
    if df.loc[0, 'Tour_Time'] == "800":
        pyautogui.click(
            pyautogui.locateCenterOnScreen(
                'C:\\Users\\Jared.Abrahams\\Screenshots\\sc_800.png',
                region=(514, 245, 889, 566)))
    elif df.loc[0, 'Tour_Time'] == "815":
        pyautogui.click(
            pyautogui.locateCenterOnScreen(
                'C:\\Users\\Jared.Abrahams\\Screenshots\\sc_815.png',
                region=(514, 245, 889, 566)))
    elif df.loc[0, 'Tour_Time'] == "830":
        pyautogui.click(
            pyautogui.locateCenterOnScreen(
                'C:\\Users\\Jared.Abrahams\\Screenshots\\sc_830.png',
                region=(514, 245, 889, 566)))
    elif df.loc[0, 'Tour_Time'] == "900":
        pyautogui.click(
            pyautogui.locateCenterOnScreen(
                'C:\\Users\\Jared.Abrahams\\Screenshots\\sc_900.png',
                region=(514, 245, 889, 566)))
    elif df.loc[0, 'Tour_Time'] == "915":
        pyautogui.click(
            pyautogui.locateCenterOnScreen(
                'C:\\Users\\Jared.Abrahams\\Screenshots\\sc_915.png',
                region=(514, 245, 889, 566)))
    elif df.loc[0, 'Tour_Time'] == "930":
        pyautogui.click(
            pyautogui.locateCenterOnScreen(
                'C:\\Users\\Jared.Abrahams\\Screenshots\\sc_930.png',
                region=(514, 245, 889, 566)))
    elif df.loc[0, 'Tour_Time'] == "1030":
        pyautogui.click(
            pyautogui.locateCenterOnScreen(
                'C:\\Users\\Jared.Abrahams\\Screenshots\\sc_1030.png',
                region=(514, 245, 889, 566)))
    elif df.loc[0, 'Tour_Time'] == "1045":
        pyautogui.click(
            pyautogui.locateCenterOnScreen(
                'C:\\Users\\Jared.Abrahams\\Screenshots\\sc_1045.png',
                region=(514, 245, 889, 566)))
    elif df.loc[0, 'Tour_Time'] == "1130":
        pyautogui.click(
            pyautogui.locateCenterOnScreen(
                'C:\\Users\\Jared.Abrahams\\Screenshots\\sc_1130.png',
                region=(514, 245, 889, 566)))
    elif df.loc[0, 'Tour_Time'] == "1145":
        pyautogui.click(m3['scroll_bar_wave'])
        pyautogui.click(
            pyautogui.locateCenterOnScreen(
                'C:\\Users\\Jared.Abrahams\\Screenshots\\sc_1145.png',
                region=(514, 245, 889, 566)))
    elif df.loc[0, 'Tour_Time'] == "1230":
        pyautogui.click(m3['scroll_bar_wave'])
        pyautogui.click(
            pyautogui.locateCenterOnScreen(
                'C:\\Users\\Jared.Abrahams\\Screenshots\\sc_1230.png',
                region=(514, 245, 889, 566)))
    elif df.loc[0, 'Tour_Time'] == "1300":
        pyautogui.click(m3['scroll_bar_wave'])
        pyautogui.click(
            pyautogui.locateCenterOnScreen(
                'C:\\Users\\Jared.Abrahams\\Screenshots\\sc_1300.png',
                region=(514, 245, 889, 566)))
    elif df.loc[0, 'Tour_Time'] == "1315":
        pyautogui.click(m3['scroll_bar_wave'])
        pyautogui.click(
            pyautogui.locateCenterOnScreen(
                'C:\\Users\\Jared.Abrahams\\Screenshots\\sc_1315.png',
                region=(514, 245, 889, 566)))
Exemplo n.º 16
0
                                            region=(514, 245, 889, 566))
     while image is None:
         image = pyautogui.locateCenterOnScreen('C:\\Users\\Jared.Abrahams\\Screenshots\\sc_tour_menu.png',
                                                region=(514, 245, 889, 566))
     x, y = image
     pyautogui.click(x + 265, y + 475)
     image = pyautogui.locateCenterOnScreen('C:\\Users\\Jared.Abrahams\\Screenshots\\sc_tour_date.png',
                                            region=(514, 245, 889, 566))
     while image is None:
         image = pyautogui.locateCenterOnScreen('C:\\Users\\Jared.Abrahams\\Screenshots\\sc_tour_date.png',
                                                region=(514, 245, 889, 566))
     x, y = image
     pyautogui.click(x - 20, y + 425)
     pyautogui.click(1318, 420)
     continue
 sc.get_m3_coordinates()
 pyautogui.click(m3['tour_status'])
 keyboard.send('c')
 pyautogui.click(m3['notes'])
 x, y = m3['title']
 pyautogui.click(x, y + 435)
 sc.get_m14_coordinates()
 keyboard.write('P')
 pyautogui.click(m14['ok'])
 progress += 1
 google_sheet.sheet.update_cell(index, 2, 'x')
 image = pyautogui.locateCenterOnScreen('C:\\Users\\Jared.Abrahams\\Screenshots\\sc_tour_menu.png',
                                        region=(514, 245, 889, 566))
 while image is None:
     image = pyautogui.locateCenterOnScreen('C:\\Users\\Jared.Abrahams\\Screenshots\\sc_tour_menu.png',
                                            region=(514, 245, 889, 566))
Exemplo n.º 17
0
def change_deposit_title(price, cash=None):
    """
    Checks to make sure that the deposit price is correct. Ex: If the sheet says $50, then this makes sure that the
    deposit is also $50.
    Changes the title from 'Refundable' to 'Refunded'
    :rtype: 'prev', 'ams', 'ir', 'sol', 'ih'
    """
    sc.get_m3_coordinates()
    amount = 0
    old_title = 'old'
    x, y = m3['title']
    attempts = 0
    number_of_deposits = count_deposits()
    pyautogui.click(m3['tour_packages'])
    image = pyautogui.locateCenterOnScreen('C:\\Users\\Jared.Abrahams\\Screenshots\\balance.png',
                                           region=(700, 245, 850, 566))
    while image is None:
        image = pyautogui.locateCenterOnScreen('C:\\Users\\Jared.Abrahams\\Screenshots\\balance.png',
                                               region=(700, 245, 850, 566))
    for i in range(number_of_deposits):
        hundreds = str(sqlite_select(cf.take_screenshot_change_color(x + 467, y + 69 + i * 13, 6, 9), 'numbers'))
        tens = str(sqlite_select(cf.take_screenshot_change_color(x + 473, y + 69 + i * 13, 6, 9), 'numbers'))
        ones = str(sqlite_select(cf.take_screenshot_change_color(x + 479, y + 69 + i * 13, 6, 9), 'numbers'))
        if hundreds == 'nothing':
            hundreds = ''
        if tens == 'nothing':
            tens = ''
        amount = hundreds + tens + ones
        if amount == price:
            x_2, y_2 = m3['deposit_1']
            pyautogui.click(x_2, y_2 + i * 13)
            pyautogui.click(m3['change_deposit'])
            break
    while amount != price and attempts <= 2:
        pyautogui.click(m3['tour_packages'])
        image = pyautogui.locateCenterOnScreen('C:\\Users\\Jared.Abrahams\\Screenshots\\balance.png',
                                               region=(700, 245, 850, 566))
        while image is None:
            image = pyautogui.locateCenterOnScreen('C:\\Users\\Jared.Abrahams\\Screenshots\\balance.png',
                                                   region=(700, 245, 850, 566))
        pyautogui.click(x_2, y_2)
        pyautogui.click(m3['change_deposit'])

    sc.get_m6_coordinates()
    deposit_item_amount = count_deposit_items()
    x, y = m6['deposit_1']
    y = y + 13 * (deposit_item_amount - 1)
    pyautogui.click(x, y)
    time.sleep(0.3)
    with mss.mss() as sct:
        # Takes screenshot of lowest amount inside of the deposit
        x, y = m6['title']
        y = y + 13 * (deposit_item_amount - 1)
        monitor = {'top': y + 189, 'left': x + 185, 'width': 33, 'height': 8}
        im = sct.grab(monitor)
        try:
            amount = sc.deposit_item_amount[str(mss.tools.to_png(im.rgb, im.size))]
        except KeyError:
            amount = 0
            print('Don\'t recognize the amount')
            print(mss.tools.to_png(im.rgb, im.size))
            print(deposit_item_amount, x, y)
            output = 'monitor-1-crop.png'
            mss.tools.to_png(im.rgb, im.size, output=output)
        attempts += 1
    if amount != price:
        pyautogui.click(m3['ok'])
        return 'fail'
    attempts = 0
    while 'ref' not in old_title.lower() and attempts <= 3:
        pyautogui.click(m6['description'])
        keyboard.send('ctrl + z')
        keyboard.send('ctrl + c')
        old_title = clipboard.paste()
        attempts += 1
    if 'ref' not in old_title.lower():
        if old_title.lower() == 'ams dep':
            old_title = 'AMS/Refunded Deposit'
        else:
            sys.exit("Wrong Title")
    new_title = old_title.replace("able", "ed")
    new_title = new_title.replace("ABLE", "ED")
    new_title = new_title.replace(" /", "/")
    new_title = new_title.replace("/ ", "/")
    keyboard.write(new_title)
    if 'prev' in new_title.lower() and cash is None:
        return 'prev'
    elif 'ir' in new_title.lower() and 'refunded' in new_title.lower():
        return "ir"
    elif 'ams' in new_title.lower() and 'refunded' in new_title.lower():
        return "ams"
    elif 'sol' in new_title.lower() and 'refunded' in new_title.lower():
        return "sol"
    elif 'ih' in new_title.lower() and 'refunded' in new_title.lower():
        return 'ih'
Exemplo n.º 18
0
def check_for_duplicate_personnel(df, status):
    sc.get_m3_coordinates()
    pyautogui.click(m3['title'])
    sc.get_m2_coordinates()
    select_tour(df, status)
Exemplo n.º 19
0
def notes(status):
    global errors
    sc.get_m3_coordinates()
    pyautogui.click(m3['notes'])
    x, y = m3['title']
    number_of_notes = 0
    image = pyautogui.locateCenterOnScreen(
        'C:\\Users\\Jared.Abrahams\\Screenshots\\note.png',
        region=(1045, 515, 50, 30))
    while image is None:
        image = pyautogui.locateCenterOnScreen(
            'C:\\Users\\Jared.Abrahams\\Screenshots\\note'
            '.png',
            region=(1045, 515, 50, 30))
    while cf.take_screenshot(x - 54, y + 58, 25, 10) != sc.note_nothing:
        number_of_notes += 1
        y += 13
    x, y = m3['notes']
    if number_of_notes == 0:
        print(u"\u001b[31m" + 'NO NOTES' + u"\u001b[0m")
        errors += 1
        return
    for note in range(number_of_notes):
        copied = []
        pyautogui.click(x, y + 40)
        pyautogui.click(m3['notes_change'])
        sc.get_m11_coordinates()
        x_2, y_2 = m11['title']
        # Take screenshot of note title
        screenshot = cf.take_screenshot_change_color(x_2 + 25, y_2 + 47, 28,
                                                     13)
        # Drag mouse cursor to select text in note.
        pyautogui.click(x_2 + 25, y_2 + 75)
        pyautogui.dragTo(x_2 + 250, y_2 + 150, button='left')
        # Copy Note
        keyboard.send('ctrl + c')
        r = Tk()
        result = r.selection_get(selection="CLIPBOARD")
        if result in copied:
            print(u"\u001b[31m" + 'COULDN\'T FIND CORRECT NOTE' + u"\u001b[0m")
            errors += 1
            pyautogui.click(x_2 + 200, y_2 + 250)
            return
        # for key, value in sol_numbers.items():
        #     words = re.findall(r'\w+', key)
        #     if words[1].lower() in result.lower() and words[1].lower() != 'major':
        #         print(u"\u001b[31m" + 'IMPORTANT NOTE' + u"\u001b[0m")
        if status == 'c' and 'conf' in result.lower():
            print(u"\u001b[32m" + 'Confirm note is present' + u"\u001b[0m")
            pyautogui.click(x_2 + 200, y_2 + 250)
            return
        elif status == 'x' and screenshot == sc.note_canc:
            print(u"\u001b[32m" + 'Cancel note is present' + u"\u001b[0m")
            pyautogui.click(x_2 + 200, y_2 + 250)
            if 'nq' in result.lower():
                pyautogui.click(m3['tour'])
                if pyautogui.locateCenterOnScreen(
                        'C:\\Users\\Jared.Abrahams\\Screenshots\\tour_result.png',
                        region=(514, 400, 889, 500)) is None:
                    print(u"\u001b[32m" + 'Tour Result is correct' +
                          u"\u001b[0m")
                else:
                    print(u"\u001b[31m" + 'NO TOUR RESULT' + u"\u001b[0m")
                    errors += 1
            return
        elif status == 'r' and any(
                i in result.lower()
                for i in ['rxl', 'reschedule', 'od', 'open', 'new date']):
            print(u"\u001b[32m" + 'Reschedule note is present' + u"\u001b[0m")
            pyautogui.click(x_2 + 200, y_2 + 250)
            return
        else:
            pyautogui.click(x_2 + 200, y_2 + 250)
            y += 13
    # If the for loop ends that means none of the notes fit the criteria above. An error message is then printed.
    print(u"\u001b[31m" + 'COULDN\'T FIND CORRECT NOTE' + u"\u001b[0m")
    errors += 1
    return
Exemplo n.º 20
0
def select_premium(balance, index):
    premium_list = []
    sc.get_m3_coordinates()
    x, y = m3['title']
    pyautogui.click(m3['premiums'])
    pyautogui.click(m3['notes'])
    # action = input('What to do?')
    # if action not in ['note', '50', '40']:
    #     return 'good'
    # elif action == 'note':
    #     return 'note'
    # else:
    #     balance = action
    image = pyautogui.locateCenterOnScreen(
        'C:\\Users\\Jared.Abrahams\\Screenshots\\issued.png',
        region=(514, 245, 889, 566))
    while image is None:
        image = pyautogui.locateCenterOnScreen(
            'C:\\Users\\Jared.Abrahams\\Screenshots\\issued.png',
            region=(514, 245, 889, 566))
    while True:
        screenshot_2 = cf.take_screenshot_change_color(x + 433, y + 60, 10, 8)
        premium = sqlite_select(
            cf.take_screenshot_change_color(x + 342, y + 60, 80, 11),
            'premiums')
        if premium == 'nothing':
            break
        elif screenshot_2 == sqlite_get_item(
                "SELECT screenshot FROM premiums WHERE name=?",
            ['Did Not Issue']):
            premium = f'{premium} - Canceled'
            premium_list.append(premium)
            y += 13
            continue
        else:
            premium_list.append(premium)
            y += 13
    number_of_dep_premiums_50 = premium_list.count(
        'DEP $50 CC') + premium_list.count('$50 CC Dep')
    number_of_dep_premiums_40 = premium_list.count(
        'DEP $40 CC') + premium_list.count('$40 CC Dep')
    total_number_of_dep_premiums = number_of_dep_premiums_50 + number_of_dep_premiums_40
    if balance == '0' and total_number_of_dep_premiums == 0:
        return 'no note'
    elif balance != '0' and total_number_of_dep_premiums == 0:
        sheet.update_cell(index, 4, 'No DEPs')
        return 'no note'
    elif total_number_of_dep_premiums > 1:
        sheet.update_cell(index, 4, 'Multiple DEPs')
        return 'no note'
    elif total_number_of_dep_premiums == '0' and f"DEP ${balance} Cash" in premium_list:
        sheet.update_cell(index, 4, 'Already done')
        return 'no note'
    else:
        x, y = m3['title']
        for premium in premium_list:
            if premium in [
                    'DEP $50 CC', '$50 CC Dep', 'DEP $40 CC', '$40 CC Dep'
            ] and balance in premium:
                pyautogui.click(x + 342, y + 60)
                pyautogui.click(sc.m3['change_premium'])
                sc.get_m10_coordinates()
                x, y = sc.m10['title']
                pyautogui.click(x + 198, y + 423)
                pyautogui.dragTo(x - 100, y + 300, button='left')
                keyboard.send('backspace')
                keyboard.write(
                    'Please refund by cash the charge is over 120 days and cannot be refunded back to CC.'
                )
                pyautogui.click(x + 160, y + 80)
                image = pyautogui.locateCenterOnScreen(
                    'C:\\Users\\Jared.Abrahams\\Screenshots\\titles'
                    '\\premium_search.png',
                    region=(514, 245, 889, 566))
                while image is None:
                    image = pyautogui.locateCenterOnScreen(
                        'C:\\Users\\Jared.Abrahams\\Screenshots\\titles'
                        '\\premium_search.png',
                        region=(514, 245, 889, 566))
                x, y = image
                pyautogui.click(x + 189, y + 35)
                keyboard.write(f"Dep ${balance} cash")
                pyautogui.click(x + 267, y + 35)
                pyautogui.click(x + 129, y + 476)
                sc.get_m10_coordinates()
                x, y = sc.m10['title']
                pyautogui.click(x + 80, y + 503)
                return
            else:
                y += 13