def switch_F2(target_system): send = SendData() send.activate_window() if target_system == "FleuraMetz Toronto": points = [('FleuraMetz Toronto', 1, 92)] if verify_fast(points): return True else: to_main() send.send("{F12}") send.send("y") time.sleep(2) send.send("07") time.sleep(2) send.send("1") time.sleep(1) elif target_system == "F2-NL": points = [('F2-NL', 1, 92)] if verify_fast(points): return True else: to_main() send.send("{F12}") send.send("y") time.sleep(.5) send.send("{F12}") time.sleep(.5) send.send("01") time.sleep(.5)
def to_order_category(cat_num, cat_name): send = SendData() send.activate_window() send.send(cat_num) for i in range(5): screen = parse.process_scene(window.get_window()) if parse.identify_screen(screen, cat_name, 4): return True time.sleep(.3) screen = parse.process_scene(window.get_window()) return False
def parse_sales_by_region(): send = SendData() send.activate_window() screen = process_scene(window.get_window())[8:-5] totals = {} for s in screen: row = s.split('║') code = row[3].strip() total = row[6].strip().replace(',', '.') if total: totals[code] = total return totals
def to_insert_virtual_purchases(date, delay=.5): match = False for i in range(20): send = SendData() send.activate_window() to_menu(('Purchase', 'Default', 'Insert virtual purchases')) send.send('{home}') time.sleep(delay) send.send('{enter}') send.send(date) send.send('{enter}') time.sleep(delay) time.sleep(.8) screen = parse.process_scene(window.get_window()) #input("break") time.sleep(.8) send.activate_window() screen = parse.process_scene(window.get_window()) if parse.identify_screen(screen, 'Insert virtual purchases Flowers'): screen = parse.process_scene(window.get_window()) match = True print(screen[-6]) #input("break") time.sleep(.8) send.activate_window() if 'Article' not in screen[-6]: send = SendData() send.send('{INSERT}') break return match
def to_margeanalyse_bld(from_date, to_date, product_type, dutch=False, depth=0): send = SendData() send.activate_window() if depth > 5: exit() if to_main(): time.sleep(0.2) menus = ('Financial', 'Margeanalyse bld') traverse(menus) send.send('CAN') send.send('{ENTER}') send.send(product_type) send.send('{ENTER}') if not verify([('Margeanalyse bld', 2, 92)]): return (to_margeanalyse_bld(from_date, to_date, product_type, dutch, depth + 1)) send.send(' ') send.send(from_date) send.send('{ENTER}') send.send(to_date) send.send('{ENTER}') send.send('{F11}') send.send('{ENTER}') targets = [('Bedr.', 5, 5), ('Marge %', 5, 63)] if not wait_for_load(targets): exit() send.send('{ENTER}') if dutch: pass else: send.send('+{F11 2}') targets = [('Gebied', 7, 12), ('Commissie', 7, 100)] if not wait_for_load(targets): exit() send.send('{HOME 3}') time.sleep(1)
def parse_sales_by_client(): send = SendData() send.activate_window() clients = {} old_screen = None screen = process_scene(window.get_window())[8:-5] while old_screen != screen: for s in screen: row = s.split('║') code = row[2].strip() total = row[5].strip().replace(',', '.') if total: if code not in clients: clients[code] = {} invoice_num = row[3].strip() clients[code][invoice_num] = total send.send("{PGDN}") time.sleep(.1) old_screen = screen screen = process_scene(window.get_window())[8:-5] return clients
def to_input_purchase(date): match = False for i in range(20): send = SendData() send.activate_window() to_menu(('Purchase', 'Default', 'Input purchases')) send.send('{home}') time.sleep(0.5) send.send('{enter}') send.send(date) send.send('{enter}') time.sleep(0.5) screen = parse.process_scene(window.get_window()) if parse.identify_screen(screen, 'Input purchases Flowers'): screen = parse.process_scene(window.get_window()) match = True if 'Article' not in screen[-6]: send = SendData() send.send('{INSERT}') break return match