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)
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)
def create_project(bdo_id): """ Function to create a new project as assigned per the the norms by the bdo :param bdo_id: bdo_id :return: null """ table_name = "PROJECT" project_name = input(ct.Enter_name) project_area = input(ct.Enter_area) member_count = input(ct.Enter_total_member_required) project_cost = input(ct.Enter_project_cost_estimate) project_type = input(ct.Enter_project_type) while project_type not in ["RC", "ST", "BC"]: print(ct.Warning_wrong_project_type) project_type = input(ct.Enter_project_type) start_date = input(ct.Enter_start_date) end_date = input(ct.Enter_end_date) project_start_date = extras.convert_string_to_date(start_date) project_end_date = extras.convert_string_to_date(end_date) while project_end_date < project_start_date: print(ct.Warning_wrong_end_date) end_date = input(ct.Enter_end_date) project_end_date = extras.convert_string_to_date(end_date) qb.insert_project_table(table_name, project_name, project_area, member_count, project_cost, project_type, start_date, end_date, bdo_id)