示例#1
0
 def double_check_pid(self):
     sc.get_m2_coordinates()
     x, y = m2['title']
     pid_screenshot = ''
     conn = sqlite3.connect('sqlite.sqlite')
     c = conn.cursor()
     for i in range(7):
         screenshot = cf.take_screenshot_change_color(x + 74 + 6 * i, y + 48, 6, 9)
         c.execute("SELECT name FROM numbers WHERE screenshot=?", [screenshot])
         number = str(c.fetchone()[0])
         if number != 'nothing':
             pid_screenshot += number
         else:
             continue
     if pid_screenshot != self.pid:
         cf.pause('Is the pid correct?')
         return
示例#2
0
        # c.execute("SELECT screenshot FROM premiums WHERE name=?", ['Did Not Issue'])
        # did_not_issue = c.fetchone[0]
        if screenshot == 'nothing':
            return 'no'
        else:
            return 'yes'

    def refundable(self):
        if 'DEP' in self.name:
            return 'yes'
        else:
            return 'no'


if __name__ == "__main__":
    cf.pause('Minimize Pycharm')
    google_sheet = ConfirmationSheet("expired_packages")
    # Count number of rows
    list_of_rows = google_sheet.read_rows()
    number_of_rows = google_sheet.count_rows()
    progress = 1
    index = 1
    for row in list_of_rows:
        index += 1

        # Create a row object.
        row = Row(row['pid'], row['completed'])

        # Skips row if the completed column is checked off.
        if row.completed in ['x', 'X']:
            progress += 1
示例#3
0
def apply_to_mv(deposit_df):
    pyautogui.click(m3['tour_packages'])
    pyautogui.click(m3['deposit_1'])
    pyautogui.click(m3['change_deposit'])
    deposit_item_amount = count_items_in_deposit()
    sc.get_m6_coordinates()
    x, y = m6['deposit_1']
    y = y + 13 * (deposit_item_amount - 1)
    pyautogui.click(x, y)
    keyboard.send('alt + v')
    sc.get_m7_coordinates()
    pyautogui.doubleClick(m7['reference'])
    keyboard.press_and_release('ctrl + c')
    time.sleep(0.5)
    old_reference = clipboard.paste()
    old_reference = old_reference.upper()
    if old_reference[0] != 'D':
        sys.exit("Wrong Reference")
    new_reference = old_reference.replace("D-", "U-")
    clipboard.copy(str(new_reference))
    pyautogui.click(m7['cancel'])
    sc.get_m6_coordinates()
    pyautogui.click(m6['description'])
    keyboard.send('ctrl + z')
    keyboard.send('ctrl + c')
    r = Tk()
    old_description = r.selection_get(selection="CLIPBOARD")
    if 'AMS' in old_description:
        keyboard.write('AMS/Minivac')
    pyautogui.click(m6['payment'])
    sc.get_m8_coordinates()
    pyautogui.click(m8['transaction_code'])
    image = pyautogui.locateCenterOnScreen(
        'C:\\Users\\Jared.Abrahams\\Screenshots\\apply_to_mv.png',
        region=(136, 652, 392, 247))
    while image is None:
        image = pyautogui.locateCenterOnScreen(
            'C:\\Users\\Jared.Abrahams\\Screenshots\\apply_to_mv.png',
            region=(136, 652, 392, 247))
    pyautogui.click(image)
    pyautogui.click(m8['reference'])
    keyboard.write('APPLY TO MV')
    pyautogui.click(m8['ok'])
    time.sleep(0.3)
    pyautogui.click(880, 565)
    pyautogui.click(m6['payment'])
    sc.get_m8_coordinates()
    time.sleep(0.3)
    pyautogui.click(m8['transaction_code'])
    image = pyautogui.locateCenterOnScreen(
        'C:\\Users\\Jared.Abrahams\\Screenshots\\ams_credit_payment.png',
        region=(136, 652, 392, 247))
    while image is None:
        image = pyautogui.locateCenterOnScreen(
            'C:\\Users\\Jared.Abrahams\\Screenshots\\ams_credit_payment.png',
            region=(136, 652, 392, 247))
    pyautogui.click(image)
    pyautogui.doubleClick(m8['amount'])
    keyboard.write(deposit_df.Price[0])
    pyautogui.click(m8['reference'])
    keyboard.write(new_reference)
    cf.pause('Ok?')
    pyautogui.click(m8['ok'])
    sc.get_m6_coordinates()
    pyautogui.click(m6['ok'])
    print('Applied Refundable Deposit to Minivac')
    deposit_df.Deposit_Type[0] = 'Non_Refundable'
示例#4
0
def automatic_confirmation():
    global errors
    global sol
    errors = 0
    progress = 1
    scope = [
        'https://spreadsheets.google.com/feeds',
        'https://www.googleapis.com/auth/drive'
    ]
    creds = ServiceAccountCredentials.from_json_keyfile_name(
        'Phone-6ad41718c799.json', scope)
    client = gspread.authorize(creds)
    sheet = client.open("Confirmation Sheet").sheet1
    dictionaries = sheet.get_all_records()
    number_of_rows = len(sheet.get_all_records())
    index = 1
    for row in dictionaries:
        status = []
        index += 1
        pid, conf, rxl, cxl, ug, tav, completed = str(
            row['PID']), row['conf'], row['rxl'], row['cxl'], row['ug'], row[
                'tav'], row['Completed']
        if row['Sol'] != '':
            try:
                sol = sol_numbers[row['Sol']]
            except TypeError:
                print('Unrecognized Name - ' + sol)
                sol = 'SOL' + input('Type Sol number (just numbers):')
        if completed in ['x', 'X']:
            progress += 1
            continue
        if conf in ['x', 'X']:
            status.append('c')
        if rxl in ['x', 'X']:
            status.append('r')
        if cxl in ['x', 'X']:
            status.append('x')
        if ug in ['x', 'X']:
            status.append('u')
        if tav in ['x', 'X']:
            status.append('t')
        show_progress(pid, progress, number_of_rows)
        cf.search_pid(pid)
        cf.double_check_pid(pid)
        select_tour(status)
        number_of_tours, number_of_canceled_tours = count_accommodations()
        m3_tour_type, m3_tour_status, m3_tour_date = gather_m3_data()
        if (m3_tour_type == 'Open_Reservation' or m3_tour_type == 'No_Tour') and \
                m3_tour_date != datetime.datetime.strptime('1/1/1900', "%m/%d/%Y"):
            print(u"\u001b[31m" + 'DATE IS INCORRECT' + u"\u001b[0m")
        tour_type = check_tour_type(number_of_tours, status)

        # Deposit Stuff
        deposit_df, number_of_refundable_deposits = create_deposit_dataframe()
        try:
            rows, columns = deposit_df.shape
            # print(tabulate(deposit_df, headers='keys', tablefmt='psql'))
            if rows > 1 and deposit_df.Deposit_Type[0] == 'Refundable' and (
                    deposit_df.Price[1] == '9' or deposit_df.Price[1] == '19'
                    or deposit_df.Price[1] == '29'):
                apply_to_mv(deposit_df)
                number_of_refundable_deposits -= 1
            premiums = read_premiums(number_of_refundable_deposits)
            check_for_dep_premium(deposit_df, premiums)
        except AttributeError:
            rows, columns = 0, 0
            cf.print_colored_text('No deposits', 'green')
        if ug == "X" or ug == "x":
            enter_personnel(sol, 'u')
        if tav == "X" or tav == "x":
            enter_personnel(sol, 't')
        if 'c' in status and 'r' in status:
            tour_status = confirm_tour_status('c')
            notes('c')
            confirm_sol_in_userfields(sol, tour_status)
            enter_personnel(sol, 'c')
            enter_personnel(sol, 'r')
        elif 'r' in status and 'x' in status:
            tour_status = confirm_tour_status('x')
            notes('x')
            enter_personnel(sol, 'r')
            enter_personnel(sol, 'x')
        elif 'c' in status and 'r' not in status and 'x' not in status:
            tour_status = confirm_tour_status('c')
            notes('c')
            confirm_sol_in_userfields(sol, tour_status)
            enter_personnel(sol, 'c')
        elif 'r' in status and 'c' not in status and 'x' not in status:
            tour_status = confirm_tour_status('r')
            notes('r')
            enter_personnel(sol, 'r')
        elif 'x' in status and 'c' not in status and 'r' not in status:
            tour_status = confirm_tour_status('x')
            notes('x')
            enter_personnel(sol, 'x')
        #  check_for_duplicate_personnel(df, status)
        sheet.update_cell(index, 8, 'x')
        cf.pause("Everthing ok?")
        # if errors > 0 or tour_type == 'Minivac':
        # pause("Everything ok?")
        progress += 1
        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))
        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)
        errors = 0
示例#5
0
            number_of_refundable_premiums = len(
                premiums_df[(premiums_df['refundable'] == 'yes')
                            & (premiums_df['canceled'] == 'no')])
            if number_of_refundable_deposits == number_of_refundable_premiums:
                cf.print_colored_text(
                    f'{number_of_refundable_deposits} Refundable Deposit(s) - '
                    f'{number_of_refundable_premiums} Refundable Premium(s)',
                    'green')
            else:
                cf.print_colored_text(
                    f'{number_of_refundable_deposits} Refundable Deposit(s) - '
                    f'{number_of_refundable_premiums} Refundable Premium(s)',
                    'red')

        confirmation_sheet.sheet.update_cell(index, 8, 'x')
        cf.pause("Everything ok?")
        # if errors > 0 or tour_type == 'Minivac':
        # pause("Everything ok?")
        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))
        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: