def enter_virtual_purchase(purchase_order_id): id, supplier_code, purchase_date, end_date, visible_from, visible_to, system = get_data.get_virtual_purchase_order( purchase_order_id) purchase_date = dates.get_menu_date(purchase_date) end_date = dates.get_menu_date(end_date) visible_from_date = dates.get_menu_date(visible_from) visible_from_time = dates.get_time(visible_from) visible_to_date = dates.get_menu_date(visible_to) visible_to_hours = dates.get_time(visible_to) traverse.main_menu_purchase_default_insert_virtual_purchase_flowers_date( system, purchase_date) # time.sleep(1) # if '═Lot╦Description════' not in window.get_window(): # keyboard.enter() set_availability_dates(purchase_date, end_date, visible_from_date, visible_from_time, visible_to_date, visible_to_hours) keyboard.command('insert') keyboard.f12() keyboard.command('f10') purchases = get_data.get_virtual_purchases_from_order(id) for purchase in purchases: print(purchase) p_id, code, quantity, packing, fob, landed, order_id, entered = purchase if not entered: enter_purchase_normal(code, str(fob), str(landed), str(quantity), str(packing), supplier_code) update_data.update_purchase_orders_mark_entered(id, True)
def main_menu_stock_stock_per_location_edit_stock_date_flowers( system, from_date, to_date, attempt=0, virtual=False): if attempt > 10: return False if type(from_date) == datetime.datetime: from_date = dates.get_menu_date(from_date) if type(to_date) == datetime.datetime: to_date = dates.get_menu_date(to_date) if main_menu_stock_stock_per_location_edit_stock_date(system, from_date, to_date, attempt=0, virtual=virtual): keyword = "main_menu-stock-stock_per_location-edit_stock-date-flowers" window_data = VERIFICATION['screens'][keyword] cmd = VERIFICATION['navigation'][keyword] keyboard.write_mix(cmd) keyboard.enter(1) if not f2.verify(window_data, 50): return main_menu_stock_stock_per_location_edit_stock_date_flowers( system, from_date, to_date, attempt + 1) else: return True return False
def main_menu_purchase_default_purchase_distribute_flowers_purchase( system, purchase_date, attempts=0): if type(purchase_date) == datetime.datetime: purchase_date = dates.get_menu_date(purchase_date) if main_menu_purchase_default_purchase_distribute_flowers(system): keyboard.write_text(purchase_date) keyboard.enter() keyboard.f11()
def main_menu_purchase_default_input_purchases_flowers_date( system, purchase_date, attempts=0): if type(purchase_date) in (datetime.datetime, datetime.date): purchase_date = dates.get_menu_date(purchase_date) if main_menu_purchase_default_input_purchases_flowers(system): keyboard.write_text(purchase_date) keyboard.enter() keyboard.shift_f11() keyboard.home(3) return True
def main_menu_stock_stock_per_location_edit_stock_date(system, from_date, to_date, attempt=0, virtual=False): if attempt > 10: return False if type(from_date) == datetime.datetime: from_date = dates.get_menu_date(from_date) if type(to_date) == datetime.datetime: to_date = dates.get_menu_date(to_date) if virtual: menu = main_menu_stock_virtual_stock_location_edit_stock else: menu = main_menu_stock_stock_per_location_edit_stock if menu(system, attempt=0): keyboard.write_text(from_date) keyboard.enter() keyboard.write_text(to_date) keyboard.enter() window_data = copy.deepcopy( VERIFICATION['screens'] ['main_menu-stock-stock_per_location-edit_stock-date']) swaps = { '{from_date}': from_date, '{to_date}': to_date, } for w in window_data: w['target'] = swap_values(swaps, w['target']) # print(window_data) if not f2.verify(window_data, 50): return main_menu_stock_stock_per_location_edit_stock_date( system, from_date, to_date, attempt + 1) else: return True return False