예제 #1
0
def set_status(status):
    # print('IN set_status1')
    purchase2set_status = get_object()
    # print(purchase2set_status)
    # status = 1
    purchase = Purchase()
    purchase.set_status(purchase2set_status, status)
예제 #2
0
def set_status0():
    print('IN set_status0')
    purchase2set_status = get_object()
    print(purchase2set_status)
    status = 0
    purchase = Purchase()
    purchase.set_status(purchase2set_status, status)
예제 #3
0
def delete_position():
    # print('IN delete_position')
    purchase2deleted = get_object_name()
    # print(purchase2deleted)
    purchase = Purchase()
    purchase.delete_position(purchase2deleted)
    get_all_positions()  # LifeHack!!! AutoUpdate)))
예제 #4
0
def delete_position():
    print('IN delete_position')
    purchase2deleted = get_object()
    print(purchase2deleted)
    # new_quantity = window.lineEdit_set_quantity.text()
    purchase = Purchase()
    # print(new_quantity)
    purchase.delete_position(purchase2deleted)
예제 #5
0
def set_status(status):
    # print('IN set_status1')
    purchase2set_status = get_object_name()
    # print(purchase2set_status)
    # status = 1
    purchase = Purchase()
    purchase.set_status(purchase2set_status, status)
    get_all_positions()
예제 #6
0
def set_quantity():
    print('IN set_quantity')
    if check_object() and check_quantity():
        purchase2edit = get_object()
        print(purchase2edit)
        new_quantity = window.lineEdit_set_quantity.text()
        purchase = Purchase()
        print(new_quantity)
        purchase.set_quantity(purchase2edit, new_quantity)
    else:
        pass
예제 #7
0
def set_quantity():
    # print('IN set_quantity')
    if check_object() and check_quantity():
        purchase2edit = get_object()
        # print(purchase2edit)
        new_quantity = window.lineEdit_set_quantity.text()
        purchase = Purchase()
        # print(new_quantity)
        purchase.set_quantity(purchase2edit, new_quantity)
    else:
        pass  # TODO: необходимо задать количество
예제 #8
0
def set_purchase_date():
    print('IN set_purchase_date')
    validated_data = valid_data()
    if check_object() and validated_data:
        purchase2edit = get_object()
        print(purchase2edit)
        new_date = window.lineEdit_set_purchase_date.text()
        purchase = Purchase()
        print(new_date)
        purchase.set_purchase_date(purchase2edit, new_date)
    else:
        pass
예제 #9
0
def get_object():
    selected_object_number = window.listWidget_purchase_list.currentRow()
    if selected_object_number >= 0:
        # print(selected_object_number)
        # print(window.listWidget_purchase_list.currentItem().text())
        purchase = Purchase()
        selected_object_name = purchase.get_all_positions()[selected_object_number]['name']
        # print(str(selected_object_name))
        # print('*' * 10)
        return selected_object_name
    else:
        pass  # TODO: необходимо выделить объект для редактирования
예제 #10
0
def get_all_positions():
    purchase = Purchase()
    window.listWidget_purchase_list.clear()
    for purchase in purchase.get_all_positions():
        item = QListWidgetItem(f'{str(purchase["name"])} : {str(purchase["quantity"])} '
                               f'{str(purchase["unit_of_measurement"])} (Purchased date: '
                               f'{str(purchase["purchase_date"])}) : '
                               f'Status: {str(purchase["status"])}')
        if str(purchase["status"]) == '1':
            item.setBackground(QColor('#7fc97f'))
            window.listWidget_purchase_list.addItem(item)
        else:
            window.listWidget_purchase_list.addItem(item)
예제 #11
0
def get_object():
    selected_object_number = window.listWidget_purchase_list.currentRow()
    if selected_object_number >= 0:
        print(selected_object_number)
        print(window.listWidget_purchase_list.currentItem().text())
        purchase = Purchase()
        selected_object_name = purchase.get_all_positions(
        )[selected_object_number]['name']
        print(str(selected_object_name))
        print('*' * 10)
        # selected_purchase = selected_object_name
        return selected_object_name
    else:
        pass
예제 #12
0
def add_new_position():
    check = line_edit_checking()
    purchase = Purchase()
    if check:
        my_dict = {
            "name": window.lineEdit_name.text(),
            "quantity": window.lineEdit_quantity.text(),
            "unit_of_measurement": window.lineEdit_unit_of_measurement.text(),
            "purchase_date": window.lineEdit_purchase_date.text(),
            "status": 0
        }
        purchase.add_new_position(my_dict)
    else:
        pass
예제 #13
0
def delete_position():
    # print('IN delete_position')
    purchase2deleted = get_object()
    # print(purchase2deleted)
    purchase = Purchase()
    purchase.delete_position(purchase2deleted)