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()
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)
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)