Exemple #1
0
def assign_project(gpm_id, bdo_id):
    """
    function to assign project to a member
    :param gpm_id: gpm id
    :param bdo_id: bdo id
    :return: null
    """
    table_name_project_detail = 'PROJECT_MEMBER_DETAIL'
    table_name_project = "PROJECT"
    table_name_member = 'MEMBER'

    print(ct.Project_available_in_your_block)
    project_list = qb.get_item_for_asignee(table_name_project, bdo_id)
    print("-" * 60)
    for item in project_list:
        print('Project Id : {}  |   Project Name :{}'.format(item[0], item[1]))
        print("-" * 60)

    project_id = input(ct.Enter_the_project_id_to_be_member_allotted)
    project_data = qb.get_project_details(table_name_project, project_id)
    total_strength = project_data[0]
    start_date = str(project_data[1])
    end_date = str(project_data[2])
    current_strength = qb.get_project_allocated_strength(
        table_name_project_detail, project_id)

    if current_strength < total_strength:
        print(ct.Member_available_in_your_zone)
        member_list = qb.get_item_for_asignee(table_name_member, gpm_id)
        print("-" * 60)
        for item in member_list:
            print('Member Id : {}  |   Member Name :{}'.format(
                item[0], item[1]))
            print("-" * 60)

        item_id = input(ct.Enter_the_member_id_to_be_allotted)
        if qb.check_member_not_present(table_name_project_detail, item_id):
            onboarding_date = input(ct.Enter_project_assigned_date)
            while extras.convert_string_to_date(start_date) > extras.convert_string_to_date(str(onboarding_date)) \
                    or extras.convert_string_to_date(end_date) < extras.convert_string_to_date(str(onboarding_date)):
                print(ct.Warning_invalid_onboarding_date)
                onboarding_date = input(ct.Enter_project_assigned_date)
            qb.assign_member_to_project(table_name_project_detail, item_id,
                                        project_id, gpm_id, bdo_id,
                                        onboarding_date, end_date)
        else:
            print(ct.Member_already_in_list)
    else:
        print(ct.Project_slots_already_occupied)
Exemple #2
0
def raise_wage_request_for_all_members(gpm_id, bdo_id):
    """
    Function to raise the wage request for all the member lying under that gpm
    :param gpm_id: gpm id
    :param bdo_id: bdo id
    :return: null
    """
    table_name_wage_approval = 'WAGE_APPROVAL'
    table_name_project_details = "PROJECT_MEMBER_DETAIL"
    table_name_project = 'PROJECT'

    print(ct.Project_available_in_your_block)
    project_list = qb.get_item_for_asignee(table_name_project, bdo_id)
    print("-" * 60)
    for item in project_list:
        print('Project Id : {}  |   Project Name :{}'.format(item[0], item[1]))
        print("-" * 60)

    project_id = input(ct.Enter_the_project_id_for_wage_update)
    if qb.is_project_wage_not_pending(table_name_wage_approval, project_id):
        member_detail_list = qb.get_member_project_details(
            table_name_project_details, project_id, gpm_id)
        for item in member_detail_list:
            number_of_days_worked = int(
                (extras.convert_string_to_date(str(item[3]).strip()) -
                 extras.convert_string_to_date(str(item[2]).strip())).days)
            amount = number_of_days_worked * 100
            qb.insert_wage_table(table_name_wage_approval, item[0], item[1],
                                 amount, number_of_days_worked, bdo_id)
    else:
        print(ct.Request_for_project_still_pending)
Exemple #3
0
def approving_wages(bdo_id):
    """
    function to approve the pending wages
    :param bdo_id: bdo _id
    :return: null
    """
    table_name_project = "PROJECT"
    table_name_wage_approval = "WAGE_APPROVAL"
    table_name_member = 'MEMBER'
    print(ct.Project_available_in_your_block)
    project_list = qb.get_item_for_asignee(table_name_project, bdo_id)
    print("-" * 60)
    for item in project_list:
        print('Project Id : {}  |   Project Name :{}'.format(item[0], item[1]))
        print("-" * 60)

    project_id = input(ct.Enter_the_project_id_to_view_wage_request)
    member_wage_data = qb.fetch_wage_data_for_project(table_name_wage_approval, project_id, bdo_id)
    if len(member_wage_data) != 0:
        print('\t\t\t WAGE DATA FOR MEMBER \t\t\t')
        print('Member Id\t\tAmount\t\tDays Worked')
        for item in member_wage_data:
            print('\t\t{member_id}\t\t{amount}\t\t{days_worked}'.format(member_id=item[0],
                                                                        amount=item[1],
                                                                        days_worked=item[2]))

        member_id = input(ct.Enter_the_member_id_to_be_allotted)
        wage = input(ct.Enter_his_wage)
        days_worked = input(ct.Enter_days_worked)
        qb.delete_member_wage_data(table_name_wage_approval, member_id)
        qb.update_item_details(table_name_member, member_id, 'wage', wage)
        qb.update_item_details(table_name_member, member_id, 'days_worked', days_worked)
    else:
        print()
Exemple #4
0
def approving_projects(bdo_id):
    """
    function for the bdo to approve member into projects
    :param bdo_id:
    :return:
    """
    table_name_project = "PROJECT"
    table_name_project_details = "PROJECT_MEMBER_DETAIL"
    print(ct.Project_available_in_your_block)
    project_list = qb.get_item_for_asignee(table_name_project, bdo_id)
    print("-" * 60)
    if len(project_list) != 0:
        for item in project_list:
            print('Project Id : {}  |   Project Name :{}'.format(item[0], item[1]))
            print("-" * 60)

        project_id = input(ct.Enter_the_project_id_to_view_pending_request)
        result_data = qb.fetch_pending_request_for_project(table_name_project_details,
                                                           project_id,
                                                           bdo_id)
        if len(result_data) != 0:
            print('Choose the member id whom you wanna approve\n')
            print('Member Id\t\tProject Id\t\tOnboarding Date\n')
            for item in result_data:
                print('\t\t{member_id}\t\t\t{project_id}\t\t\t{onboarding_date}'.format(member_id=item[0],
                                                                                        project_id=item[1],
                                                                                        onboarding_date=item[2]))
            member_id = input(ct.Enter_the_member_id_to_be_allotted)
            qb.approve_pending_details_for_project(table_name_project_details, member_id, 'request_status', 1)
        else:
            print(' No Member Assigned Till now')

    else:
        print(" No Project Available")
Exemple #5
0
def issue_job_card(gpm_id):
    """
    Method to issue a job card for a member
    :param gpm_id: gpm id
    :return: null
    """
    table_name = 'MEMBER'
    print(ct.Member_available_in_your_zone)
    member_list = qb.get_item_for_asignee(table_name, gpm_id)
    print("-" * 60)
    for item in member_list:
        print('Member Id : {}  |   Member Name :{}'.format(item[0], item[1]))
        print("-" * 60)
    item_id = input(ct.Enter_the_member_id_to_be_deleted)
    member_job_data = qb.fetch_job_id_data(table_name, item_id)
    extras.display_job_card(member_job_data)
Exemple #6
0
def delete_project(bdo_id):
    """
    Function for the bdo to delete the project
    :param bdo_id: bdo _id
    :return: null
    """
    table_name = 'PROJECT'
    print(ct.Project_available_in_your_block)
    project_list = qb.get_item_for_asignee(table_name, bdo_id)
    print("-" * 60)
    for item in project_list:
        print('Project Id : {}  |   Project Name :{}'.format(item[0], item[1]))
        print("-" * 60)

    item_id = input(ct.Enter_the_project_id_to_be_deleted)
    qb.delete_item_from_table(table_name, item_id, 'id')
    qb.delete_item_from_table(ct.PROJECT_MEMBER_DETAIL_TABLE, item_id, 'project_id')
Exemple #7
0
def update_member(gpm_id):
    """
    Function to update the details of the member
    :param gpm_id: gpm id
    :return: null
    """
    table_name = 'MEMBER'
    print(ct.Member_available_in_your_zone)
    member_list = qb.get_item_for_asignee(table_name, gpm_id)
    print("-" * 60)
    for item in member_list:
        print('Member Id : {}  |   Member Name :{}'.format(item[0], item[1]))
        print("-" * 60)

    item_id = input(ct.Enter_the_member_id_to_be_deleted)
    print(ct.Choose_Update_Option_For_Member)
    choice = input(ct.Enter_choice)

    if int(choice) in [1, 2, 3, 4, 5, 6]:
        if int(choice) == 1:
            updated_name = input(ct.Enter_new_name)
            qb.update_item_details(table_name, item_id, 'name',
                                   "'{}'".format(updated_name))
        elif int(choice) == 2:
            update_password = input(ct.Enter_new_password)
            qb.update_item_details(table_name, item_id, 'password',
                                   update_password)
        elif int(choice) == 3:
            updated_area = input(ct.Enter_new_area)
            qb.update_item_details(table_name, item_id, 'area',
                                   "'{}'".format(updated_area))
        elif int(choice) == 4:
            update_address = input(ct.Enter_new_address)
            qb.update_item_details(table_name, item_id, 'address',
                                   "'{}'".format(update_address))
        elif int(choice) == 5:
            updated_pincode = input(ct.Enter_new_pincode)
            qb.update_item_details(table_name, item_id, 'pincode',
                                   updated_pincode)
        else:
            updated_age = input(ct.Enter_new_age)
            qb.update_item_details(table_name, item_id, 'age', updated_age)
    else:
        print(ct.Wrong_choice)
Exemple #8
0
def delete_member(gpm_id):
    """
     Function to delete a member form the table
    :param gpm_id: gpm id
    :return: null
    """
    table_name = 'MEMBER'
    print(ct.Member_available_in_your_zone)
    member_list = qb.get_item_for_asignee(table_name, gpm_id)
    print("-" * 60)
    for item in member_list:
        print('Member Id : {}  |   Member Name :{}'.format(item[0], item[1]))
        print("-" * 60)

    item_id = input(ct.Enter_the_member_id_to_be_deleted)
    qb.delete_item_from_table(table_name, item_id, 'id')
    qb.delete_item_from_table(ct.PROJECT_MEMBER_DETAIL_TABLE, item_id,
                              'member_id')
    qb.delete_item_from_table(ct.WAGE_APPROVAL_TABLE, item_id, 'member_id')
    qb.delete_item_from_table(ct.COMPLAINT_TABLE, item_id, 'member_id')
Exemple #9
0
def update_project(bdo_id):
    """
    Functions to update the project details by the bdo
    :param bdo_id: bdo_id
    :return: null
    """
    table_name = 'PROJECT'
    print(ct.Project_available_in_your_block)
    project_list = qb.get_item_for_asignee(table_name, bdo_id)
    print("-" * 60)
    for item in project_list:
        print('Project Id : {}  |   Project Name :{}'.format(item[0], item[1]))
        print("-" * 60)

    item_id = input(ct.Enter_the_project_id_to_be_updated)
    print(ct.Choose_Update_Option_For_Project)
    choice = input(ct.Enter_choice)

    if int(choice) in [1, 2, 3, 4, 5]:
        if int(choice) == 1:
            updated_name = input(ct.Enter_new_name)
            qb.update_item_details(table_name, item_id, 'name', "'{}'".format(updated_name))
        elif int(choice) == 2:
            updated_area = input(ct.Enter_new_area)
            qb.update_item_details(table_name, item_id, 'area', "'{}'".format(updated_area))
        elif int(choice) == 3:
            updated_member_count = input(ct.Enter_new_total_member_required)
            qb.update_item_details(table_name, item_id, 'total_member', updated_member_count)
        elif int(choice) == 4:
            updated_cost_estimate = input(ct.Enter_new_project_cost_estimate)
            qb.update_item_details(table_name, item_id, 'cost_estimate', updated_cost_estimate)
        else:
            updated_project_type = input(ct.Enter_new_project_type)
            while updated_project_type not in ["RC", "ST", "BC"]:
                print(ct.Warning_wrong_project_type)
                updated_project_type = input(ct.Enter_new_project_type)
            qb.update_item_details(table_name, item_id, 'type', "'{}'".format(updated_project_type))
    else:
        print(ct.Wrong_choice)