Exemple #1
0
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)
Exemple #2
0
def make_list(quantity, packing, price=None, selling=None):
    original_price = price
    items = []
    while True:
        try:
            assortment = add_article()
        except:
            assortment = lots.get_lot_info_assortment()
        if not original_price:
            price = input("FOB price")

        item = {
            'assortment_code': assortment['assortment_code'],
            'quantity': quantity,
            'packing': packing,
            'fob': price,
            'landed': price,
            'assortment': assortment
        }
        if selling:
            item['selling'] = selling
        items.append(item)
        window.drag_window()
        keyboard.f12()
        choice = input("next")
        if 'n' in choice.lower():
            return items
Exemple #3
0
def close_pricing():
    for i in range(10):
        screen = window.get_window()
        if not 'Val╦═Perc.' in screen:
            return True
        time.sleep(.02)
    keyboard.f12()
    close_pricing()
Exemple #4
0
def price_item(price):
    points = VERIFICATION['pricing']['f8-pricing']
    if True or f2.verify(points, attempts=10):
        keyboard.home()
        keyboard.enter()
        keyboard.paste_write(pricing.make_price_str(price))
        keyboard.f11()
        keyboard.f12()
    else:
        return False
Exemple #5
0
def verify_lot(lot_number):
    keyboard.command(('shift', 'f10'))
    text = f'Intern partijnummer  : {lot_number}'
    for i in range(20):
        if text in window.get_window():
            keyboard.f12()
            return True
        else:
            time.sleep(.05)
    keyboard.f12()
    return False
Exemple #6
0
def close_window(open_window):
    handle = open_window['handle']
    for i in range(8):
        try:
            window.maximize_window(handle)
            win32gui.SetForegroundWindow(handle)
            time.sleep(1)
            keyboard.f12(7)
            keyboard.enter()
        except:
            return True

    win32gui.PostMessage(open_window['handle'], win32con.WM_CLOSE, 0, 0)
Exemple #7
0
def main_menu_call(attempt=0):
    window_data = VERIFICATION['screens']['main_menu']
    if attempt > 20:
        return False
    if not f2.verify(window_data, 2):
        keyboard.f12(7)
        keyboard.write_text('n')
        keyboard.home(3)
        time.sleep(.01)
        return main_menu_call(attempt + 1)
    else:
        keyboard.home(3)
        return True
Exemple #8
0
def price_lot(system, lot, location, price, virtual=False):
    # window.drag_window()
    print(lot)
    keyboard.command(('shift', 'F10'))
    if f2_page.verify_lot_info(lot, virtual=virtual):
        print("on the right lot")
        keyboard.f12()

        if change_price_level(system, location, 0):
            print("price level correct")
            print('level changed')
            keyboard.command('f2')
            pricing.top_of_list()
            price_str = pricing.make_price_str(price)
            pricing.price_item(price)
Exemple #9
0
def get_stock_information(system, location, lot, virtual=False):
    print(virtual)
    print(f"going to lot: {lot}")
    print(system, location, lot)
    if not virtual:
        go_to = go_to_lot
    else:
        go_to = go_to_lot_virtual
    if go_to(system, location, lot):
        print(f"at lot: {lot}")
        keyboard.command(('shift', 'f10'))
        info = lots.get_lot_info()
        keyboard.f12()
        return info
    return False
Exemple #10
0
def easter_list(virtual_purchase_order_id, system, monday_date, quantity,
                packing):
    year = dates.get_pricing_year(monday_date)
    week = dates.get_pricing_week(monday_date)
    known_prices = dict()
    while True:
        try:
            assortment = add_article()
        except:
            assortment = lots.get_lot_info_assortment()
        if assortment['name'] == '':
            print('Blank')
            print(lots.get_lot_info_assortment())

        assortment_code = assortment['assortment_code']
        grade = assortment['grade']
        fob = input(f"What is the FOB price for {assortment['name']} {grade}")

        if float(fob) in known_prices:
            price = known_prices[float(fob)]
        else:
            price = input(
                f"What is the Selling price for {assortment['name']} {grade}")
            known_prices[float(fob)] = price

        if not get_data.check_assortment_price(assortment_code, week, year,
                                               system):
            insert_data.insert_weekly_price(system, week, year,
                                            assortment_code, price)
        else:
            print(price)
            update_data.update_weekly_price(system, year, week,
                                            assortment_code, price)

        landed = fob
        time.sleep(.5)
        window.drag_window()
        keyboard.f12()
        keyboard.command('down')
        insert_data.insert_virtual_purchase(assortment_code,
                                            quantity,
                                            packing,
                                            fob,
                                            landed,
                                            virtual_purchase_order_id,
                                            entered=False)
        input("next")
Exemple #11
0
def make_list_from_file(system, filename, po_id):
    variety = ''
    order_date = get_data.get_virtual_purchase_order(po_id)[2]
    week = dates.get_week(order_date)
    year = dates.get_year(order_date)

    df = import_ecuador_prices(filename)
    for index, row in df.iterrows():
        if not pd.isnull(row['$ fob']):
            if row['Variety'].strip() != variety:
                variety = row['Variety'].strip()
                window.drag_window()
                keyboard.write_text(variety)

            print_row_ecuador(row)
            answer = input("next")
            if answer == '':
                try:
                    assortment = add_article()
                except:
                    assortment = lots.get_lot_info_assortment()
                keyboard.f12()
                keyboard.command('down')
                insert_data.insert_virtual_purchase(
                    assortment_code=assortment['assortment_code'],
                    quantity=15,
                    packing=row['St/bx'],
                    fob="%0.2f" % row['$ fob'],
                    landed="%0.2f" % row['$ fob'],
                    virtual_purchase_order_id=po_id,
                    entered=False)
                try:
                    insert_data.insert_weekly_price(
                        system, week, year, assortment['assortment_code'],
                        row['selling'])
                except:
                    update_data.update_weekly_price(
                        system, year, week, assortment['assortment_code'],
                        row['selling'])

            elif 'q' in answer:
                break
            elif 'n' in answer:
                pass

    return df
Exemple #12
0
def Rosaprima_mday():
    while True:
        try:
            assortment = add_article()
        except:
            assortment = lots.get_lot_info_assortment()
        assortment_code = assortment['assortment_code']
        grade = assortment['grade']
        quantity = 20
        packing = 100
        if str(grade) == '40':
            fob = .69
            p = 125

        elif str(grade) == '50':
            fob = .82
            p = 100

        elif str(grade) == '60':
            fob = .89
            p = 100

        elif str(grade) == '70':
            fob = .92
            p = 75
        elif str(grade) == '80':
            fob = .92
            p = 75
        landed = calc_landed(fob, p)
        virtual_purchase_order_id = 26
        keyboard.f12()
        keyboard.command('down')
        print(assortment)
        input("next")
        time.sleep(.5)
        window.drag_window()
        insert_data.insert_virtual_purchase(assortment_code,
                                            quantity,
                                            packing,
                                            fob,
                                            landed,
                                            virtual_purchase_order_id,
                                            entered=False)
Exemple #13
0
def get_lot_data(lot, system):
    lot_number = lot[0]
    purchase_date = lot[1]
    window.drag_window()
    keyboard.command("f7")
    keyboard.write_text(lot_number)
    keyboard.enter()
    for i in range(5):
        try:
            lot_main = parse.get_input_purchase_lots(system, purchase_date)
            break
        except:
            lot_main = False
            time.sleep(.1)
    if not lot_main or lot_number not in lot_main:
        return False
    lot_main = lot_main[lot_number]
    supplier_code = lot_main['supplier_code']
    if not supplier_code or supplier_code[0] in (
            'M', '1') and 'f2_canada' in system:
        return False
    data = lots.get_lot_info_purchase(lot_number, purchase_date, supplier_code)
    keyboard.f12()
    return data