Skip to content

report

report

format_line

format_line(content: str, width: int = 119) -> str

Formats a line with '*' borders and padded content.

Source code in source/src/report.py
def format_line(content: str, width: int = 119) -> str:
    """Formats a line with '*' borders and padded content."""
    content = content[:width - 4]  # Trim content if too long
    return f"* {content.ljust(width - 4)} *\n"

unparse_salary_rlc_result_delay

unparse_salary_rlc_result_delay(content, args)

Número de nómines d´endarreriments trobades i de quin mes.

Source code in source/src/report.py
def unparse_salary_rlc_result_delay(content, args):
    """
    Número de nómines d´endarreriments trobades i de quin mes.
    """
    msg = ""
    salaries_found = 0
    for key in content.keys():
        if content[key][0]:
            salaries_found += 1
            msg += ("A delay salary for NAF " + str(args.naf) + " was found for month "
                    + unparse_date(key, "-") + "\n")
            if not content[key][1]:
                msg += ("The corresponding RLC L03 N for the delay salary for NAF "
                        + str(args.naf) + " was not found during month " + unparse_date(key, "-") + "\n")
            if not content[key][2]:
                msg += ("The corresponding RLC L03 P for the delay salary for NAF " + str(args.naf)
                        + " was not found during month " + unparse_date(key, "-") + "\n")

    msg += ("In the period from " + unparse_date(args.begin, "-") + " to " +
            unparse_date(args.end, "-") + " there are " + str(salaries_found) +
            " delay salaries.\n")
    return msg

unparse_salary_rlc_result_regular

unparse_salary_rlc_result_regular(content, args)

Numero de Nomines totals que hi ha en el periode, és a dir, si fem una busqueda de gener de 2024 a desembre de 2024 hi ha d´haver 12 nómines una per cada mes, les d´endarreriments no compten. Aleshores hi ha d´haver comparativa de número de nomines trobades en el periode i número de nomines no trobades (de les no trobades el mes que no ha trobat)

Source code in source/src/report.py
def unparse_salary_rlc_result_regular(content, args):
    """
    Numero de Nomines totals que hi ha en el periode, és a dir, si fem una busqueda de gener de 2024 a desembre de 2024
    hi ha d´haver 12 nómines una per cada mes, les d´endarreriments no compten. Aleshores hi ha d´haver comparativa de
    número de nomines trobades en el periode  i número de nomines no trobades (de les no trobades el mes que no ha
    trobat)
    """
    msg = ""
    something_wrong = False
    salaries_found = 0
    for key in content.keys():
        if content[key][0]:
            salaries_found += 1
            if not content[key][1]:
                something_wrong = True
                msg += ("The corresponding RLC L00 N for the regular monthly salary for NAF "
                        + str(args.naf) + " was not found during month " + unparse_date(key, "-") + "\n")
            if not content[key][2]:
                something_wrong = True
                msg += ("The corresponding RLC L00 P for the regular monthly salary for NAF " + str(args.naf)
                        + " was not found during month " + unparse_date(key, "-") + "\n")
        if not content[key][0]:
            something_wrong = True
            msg += ("Regular monthly salary for NAF " + str(args.naf) + " was not found during month "
                    + unparse_date(key, "-") + "\n")

    if salaries_found != len(content.keys()):
        something_wrong = True
        msg += ("In the period from " + unparse_date(args.begin, "-") + " to " +
                unparse_date(args.end, "-") + " there are " + str(len(content.keys())) +
                " months, but only " + str(salaries_found) + " regular salaries were found.\n")

    if not something_wrong:
        msg += "All regular monthly salaries and their requested RLC L00 N and RLC L00 P have been found :D\n"
    return msg