1347${year}${company.party.tax_identifier.es_code()}${justify(company.party.name.upper(), 40)}T${format_phone(company.es_aeat_contact_phone)}${justify(company.party.name.upper(), 40)}347${year}000001  0000000000000${format_integer(len(records), 9)}${format_decimal(records_amount)}${format_integer(0, 9)}${format_decimal(0)}${justify('', 315)}
{% for record in records %}\
2347${year}${justify(identifier_code(record.company_tax_identifier), 9)}${justify(identifier_code(record.party_tax_identifier), 9)}${justify('', 9)}${justify(strip_accents(record.party.name.upper()), 40)}D${justify(record.province_code, 2)}${justify(country_code(record), 2)} ${record.code}${format_decimal(record.amount)}  000000000000000${format_decimal(0)}0000${format_decimal(record.first_period_amount or 0)}${format_decimal(0)}${format_decimal(record.second_period_amount or 0)}${format_decimal(0)}${format_decimal(record.third_period_amount or 0)}${format_decimal(0)}${format_decimal(record.fourth_period_amount or 0)}${format_decimal(0)}${justify('', 20)}${format_decimal(0)}${justify('', 201)}
{% end %}\
