Esempio n. 1
0
    def date_totals(self):
        month = self.month.get()
        if len(month) < 2:
            month = '0{}'.format(month)
        day = self.day.get()
        if len(day) < 2:
            day = '0{}'.format(day)
        year = self.year.get()
        date = '{}-{}-{}'.format(year, month, day)

        conn = dbf.create_connection('totals.sqlite3')
        cur = conn.cursor()
        cur.execute('SELECT * FROM totals WHERE date=?', (date, ))
        rows = cur.fetchall()

        server1_total = 0
        server2_total = 0
        server3_total = 0

        for row in rows:
            server1_total += row[1]
            server2_total += row[2]
            server3_total += row[3]

        total = server1_total + server2_total + server3_total

        self.dis_window.delete(1.0, 'end')
        self.dis_window.insert('end', '          TOTAL'.format(server1_total))
        self.dis_window.insert('end', '\nServer 1: ${}'.format(server1_total))
        self.dis_window.insert('end', '\nServer 2: ${}'.format(server2_total))
        self.dis_window.insert('end', '\nServer 3: ${}'.format(server3_total))
        self.dis_window.insert('end', '\nTotal:    ${}'.format(total))

        conn.close()
Esempio n. 2
0
    def get_totals(self):
        conn = dbf.create_connection('totals.sqlite3')
        cur = conn.cursor()
        cur.execute('SELECT * FROM totals')
        rows = cur.fetchall()

        server1_total = 0
        server2_total = 0
        server3_total = 0

        for row in rows:
            server1_total += row[1]
            server2_total += row[2]
            server3_total += row[3]

        total = server1_total + server2_total + server3_total

        self.dis_window.delete(1.0, 'end')
        self.dis_window.insert('end', '          TOTAL'.format(server1_total))
        self.dis_window.insert('end', '\nServer 1: ${}'.format(server1_total))
        self.dis_window.insert('end', '\nServer 2: ${}'.format(server2_total))
        self.dis_window.insert('end', '\nServer 3: ${}'.format(server3_total))
        self.dis_window.insert('end', '\nTotal:    ${}'.format(total))

        conn.close()
Esempio n. 3
0
    def manager_total_day(self):
        dbf.total_day()
        conn = dbf.create_connection('totals.sqlite3')
        cur = conn.cursor()
        date = dt.datetime.now().strftime("%y-%m-%d")
        cur.execute('SELECT * FROM totals WHERE date=?', (date, ))

        rows = cur.fetchall()

        tipout = int(self.tipout.get())

        server1_total = 0
        server2_total = 0
        server3_total = 0

        for row in rows:
            server1_total += row[1]
            server2_total += row[2]
            server3_total += row[3]

        server1_tipout = server1_total * (tipout / 100)
        server2_tipout = server2_total * (tipout / 100)
        server3_tipout = server3_total * (tipout / 100)

        total = server1_total + server2_total + server3_total

        self.dis_window.delete(1.0, 'end')
        self.dis_window.insert(
            'end',
            '          SALES      TIP OUT'.format(server1_total,
                                                  server1_tipout))
        self.dis_window.insert(
            'end', '\nServer 1: ${}     ${}'.format(server1_total,
                                                    server1_tipout))
        self.dis_window.insert(
            'end', '\nServer 2: ${}     ${}'.format(server2_total,
                                                    server2_tipout))
        self.dis_window.insert(
            'end', '\nServer 3: ${}     ${}'.format(server3_total,
                                                    server3_tipout))
        self.dis_window.insert('end', '\nTotal:    ${}'.format(total))

        conn.close()
Esempio n. 4
0
    def delete(self, num):
        conn = dbf.create_connection('bar_orders.sqlite3')
        cur = conn.cursor()

        try:
            cur.execute("SELECT * FROM bar_orders WHERE number =?", (num, ))
            row = cur.fetchone()

            order_num = row[0]
            time = row[1]
            server = row[2]
            table = row[3]
            order = row[4]

            cur.execute('DELETE FROM bar_orders WHERE number =?', (num, ))
            conn.commit()
            dbf.finished_orders_db(order_num, time, server, table, order)
            self.update_boxes()
        except TypeError:
            print('no order')
Esempio n. 5
0
 def populate_boxes(self):
     conn = dbf.create_connection('kitchen_orders.sqlite3')
     cur = conn.cursor()
     try:
         cur.execute("SELECT * FROM kitchen_orders")
         rows = cur.fetchall()
         for i in rows[0]:
             self.window1.insert('end', i)
         for i in rows[1]:
             self.window2.insert('end', i)
         for i in rows[2]:
             self.window3.insert('end', i)
         for i in rows[3]:
             self.window4.insert('end', i)
         for i in rows[4]:
             self.window5.insert('end', i)
         for i in rows[5]:
             self.window6.insert('end', i)
         for i in rows[6]:
             self.window7.insert('end', i)
         for i in rows[7]:
             self.window8.insert('end', i)
         for i in rows[8]:
             self.window9.insert('end', i)
         for i in rows[9]:
             self.window10.insert('end', i)
         for i in rows[10]:
             self.window11.insert('end', i)
         for i in rows[11]:
             self.window12.insert('end', i)
         for i in rows[12]:
             self.window13.insert('end', i)
         for i in rows[13]:
             self.window14.insert('end', i)
         for i in rows[14]:
             self.window15.insert('end', i)
         for i in rows[15]:
             self.window16.insert('end', i)
     except IndexError:
         pass
Esempio n. 6
0
    convert_zillow_to_CSV(zillow_data)

    #Calling Census functions
    census_data = get_census_data(
        'https://api.census.gov/data/2019/acs/acs5?get=NAME,B15003_022E&for=state:*&key=3d095bab381ec8a891e05c0fe05da954f2710317'
    )
    census_data_parsed = parse_census_data(census_data=census_data)
    convert_census_to_csv(census_data_parsed)

    #Calling Wikipedia functions
    wikipedia_data = build_wikipedia_dictionary()
    wikipedia_data_cleaned = clean_wikipedia_dictionary(wikipedia_data)
    convert_wikipedia_to_csv(wikipedia_data_cleaned)

    #Calling SQLite functions
    database_functions.create_connection('project.db')
    database_functions.create_zillow_table()
    database_functions.create_census_table()
    database_functions.create_wikipedia_table()

    #Interactive Console
    interactive_elements.opening_statement()

    while True:

        #Provide initial options
        interactive_elements.provide_initial_options()
        entry = input(f"\nType a number (e.g. '1', '2') or 'exit': ")
        user_input = entry.lower().strip()

        #Option: Exit