This document details the use ofvariableson the Buk platform for the dynamic creation of documents, facilitating the automation and customization of contracts, annexes, certificates, and settlements.
1. Requirements and Structure
To use variables in document templates, consider the following:
-
Required Modules:It is essential to have theDigital SignatureandDocument Managementmodules. You can request the activation of the "Enable customizable templates" setting from the Support and Customer Service (SAC) team once you have these modules.
-
Variable Format:All variables must always be enclosed in double curly braces
{{and}}. For example:{{empleado.nombre}}.
2. What is a Variable?
Avariableis a container that stores a specific value and represents relevant information in a document. These variables contain data such as dates, names, addresses, or identifiers, allowing information to be easily updated and personalized.
3. Available Variables
Below are the categories of variables available for document management, with examples of their use:
3.1. General Variables
These variables provide dynamic and general information:
-
Salary payment day:
{{dia_pago_sueldos}} -
Today's date (dynamic):
{{fecha_de_hoy}} -
Current date and time:
{{fecha_y_hora_actual}} -
First day of the current month:
{{fecha_primer_dia_mes}} -
Start of the open month:
{{inicio_mes_abierto}} -
End of the open month:
{{fin_mes_abierto}} -
First day of the next month:
{{fecha_primer_dia_mes_siguiente}} -
Date two months from today:
{{fecha_dos_meses_despues_de_fecha_actual}} -
Date three months from today:
{{fecha_tres_meses_despues_de_fecha_actual}} -
User generating the document:
{{documento_generado_por}}(the person who clicks "generate document")
3.2. Signature Variables
To include signer data in the document:
-
First Signer:
{{firma.primer_firmante.nombre}} -
Second Signer:
{{firma.segundo_firmante.nombre}} -
Full names of signers (who are not the employee) who need to sign the document.
3.3. Company Variables
Company data:
-
Company Name:
{{empresa.nombre}} -
Company RUT:
{{empresa.rut}} -
Business Activity:
{{empresa.giro}} -
Company Email:
{{empresa.email_empresa}} -
Logo URL:
{{empresa.logo}}(use with theimagenfilter) -
Address:
{{empresa.direccion}} -
District:
{{empresa.comuna}} -
City:
{{empresa.ciudad}} -
Representative Name:
{{empresa.representante.nombre}} -
Representative RUT:
{{empresa.representante.rut}} -
Representative Address:
{{empresa.representante.direccion}} -
Representative Nationality:
{{empresa.representante.nacionalidad}} -
Secondary Representative Name:
{{empresa.representante_secundario.nombre}} -
Secondary Representative RUT:
{{empresa.representante_secundario.rut}} -
Secondary Representative Address:
{{empresa.representante_secundario.direccion}} -
Secondary Representative Nationality:
{{empresa.representante_secundario.nacionalidad}}
3.4. Employee Variables
Detailed employee information:
-
Personal Data:
nombre,apellido,segundo_apellido,nombre_completo,sexo,rut,rut_limpio(no dots or hyphen),codigo_ficha,estado_civil,estado_civil_con_genero(e.g., Single),nacionalidad,profesion,fecha_nacimiento,edad,telefono_particular,telefono_oficina,universidad,titulo. -
Bank Details:
cuenta_corriente,banco,tipo_cuenta. -
Address:
numero_calle,calle,direccion,direccion_completa,region_empleado,comuna,ciudad. -
Contacts:
correo_electronico(institutional),correo_personal. -
Pension and Health:
fondo_cotizacion(AFP/IPS),institucion_salud(Isapre/Fonasa). -
Vacations:
saldo_vacaciones_legales,saldo_vacaciones_progresivas,vacaciones_legales_proporcionales,vacaciones_progresivas_proporcionales,vacaciones_legales_pendientes,vacaciones_progresivas_pendientes,fecha_reconocimiento_antiguedad. -
Work Data:
empleado.obra,fecha_ingreso_compania,fecha_ultimo_movimiento,fecha_termino_trabajo,tipo_contrato,periodicidad(Work Schedule),tipo_jornada,annos_servicio,fecha_termino_trabajo_anterior,fecha_vencimiento_contrato,fecha_vencimiento_contrato_2,area(Division),departamento(Area),sub_area,direccion_trabajo,comuna_trabajo,ciudad_trabajo,region_trabajo,region_zona_extrema_trabajo,comuna_zona_extrema_trabajo,nombre_del_cargo,descripcion_del_cargo,horas_semanales,sueldo(Base Salary),sueldo_liquido_teorico,forma_pago,centro_de_costo,dias_trabajo,comuna_trabajo,cargo_supervisor,localidad,cargo_anterior,sueldo_base_anterior.
3.5. Supervisor Variables
Employee supervisor information:
-
First Name:
{{supervisor.nombre}} -
Last Name:
{{supervisor.apellido}} -
Full Name:
{{supervisor.nombre_completo}} -
Supervisor RUT:
{{supervisor.rut}}
3.6. Custom Attributes (Collections)
These variables arecollectionsand require iteration (using the{%for%}structure) to access their elements.
General structure for iteration:
{%for [elemento_singular] in [coleccion]%}
Propiedad: {{[elemento_singular].[propiedad]}}
{%endfor%}
Available collections:
-
Overtime Hours:
{{empleado.horas_extras}}-
Properties:
horas,aprobada,tipo,proporcion.
-
-
Bonuses:
{{empleado.bonos}}-
Properties:
nombre,monto,codigo,monto_calculado. -
Totals:
{{empleado.total_bonos}}
-
-
Informative:
{{empleado.informativos}}-
Properties:
nombre,monto,codigo,monto_calculado. -
Totals:
{{empleado.total_informativos}}
-
-
Non-Taxable:
{{empleado.no_imponibles}}-
Properties:
nombre,monto. -
Totals:
{{empleado.total_no_imponibles}}
-
-
Deductions:
{{empleado.descuentos}}-
Properties:
nombre,monto. -
Totals:
{{empleado.total_descuentos}}
-
-
Dependents:
{{empleado.cargas}}-
Properties:
nombre,rut,rut_limpio,sexo,relacion,fecha_nacimiento,expiration_date,tipo_carga. -
Totals:
{{empleado.total_cargas}}
-
-
Cost Centers:
{{empleado.centro_costos}}-
Properties:
codigo.
-
-
Upper Sub Areas:
{{empleado.sub_areas_superiores}}-
Properties:
nombre,nivel.
-
-
Absences:
{{empleado.ausencias}}-
Properties:
nombre,codigo,dias_tomados,justificacion,estado,inicio_ausencia,termino_ausencia,inicio_aplicacion_ausencia,termino_aplicacion_ausencia. -
Totals:
{{empleado.total_ausencias}}
-
-
Leaves:
{{empleado.licencias}}-
Properties:
nombre,codigo,dias_tomados,justificacion,estado,inicio_licencia,termino_licencia,inicio_aplicacion_licencia,termino_aplicacion_licencia. -
Totals:
{{empleado.total_licencias}}
-
-
Permissions:
{{empleado.permisos}}-
Properties:
nombre,codigo,dias_tomados,justificacion,estado,inicio_permiso,termino_permiso,inicio_aplicacion_permiso,termino_aplicacion_permiso,goce_sueldo(With Payment?). -
Totals:
{{empleado.total_permisos}}
-
-
Earnings:
{{empleado.total_items_haberes}}(sum of bonuses and non-taxable).
4. Control Structures
Templates allow the use of conditional logic (if) and loops (for) for more advanced control.
4.1.if
structure
Allows you to evaluate the value of a variable and display content conditionally.
{%if empleado.nombre == "Pedro"%}
El empleado es Pedro.
{%endif%}
Example:for
4.2.
structure
{%for bono in empleado.bonos%}
Nombre: {{bono.nombre}} Monto: {{bono.monto}}
{%endfor%}
Used to iterate over collections of items, such as bonuses or deductions.
{%for permiso in empleado.permisos%}
{%if permiso.nombre == "Permiso"%}
Inicio del permiso: {{permiso.inicio_permiso}}
{%endif%}
{%endfor%}
Example (Bonuses):
Example (Permissions with condition):|5. Filters
-
palabrasFilters transform the value of variables to present them in a different format. They are applied using the-
symbol.
{{sueldo | palabras}}
-
-
imagen: Converts numbers or dates to their word version.-
Example:
{{empresa.logo | imagen: "200", "200"}}: Displays an image from its URL.
-
-
formato_fechaExample:-
(width, height in pixels)
{{empleado.fecha_ingreso_compania | formato_fecha: "dd/mm/yyyy"}}: Shows a date in a specific format.01/01/2023Example: -
(result:
yyyy)mmFormats:dd(year),hh(month),MM(day),ss(hour), -
(minutes),
'/'(seconds).'-'Separators:' ',
-
-
detalle_fecha,-
.
{{fecha_de_hoy | detalle_fecha: "A"}}: Gets the day, month, or year from a date. -
Example:
"A"(for year)"M"Elements:"D"(year),
-
-
fecha_en_palabras(month),-
(day).
{{fecha_de_hoy | fecha_en_palabras: "%A %d de %B de %Y"}}: Shows the date written in words.Lunes 04 de septiembre de 2023Example: -
(result:
%A)%dFormats:%b(Day name),%B(Day number),%Y(3-letter month),%y(Month name),
-
-
fecha_n_meses_al_futuro(4-digit year),-
(2-digit year).
{{fecha_de_hoy | fecha_n_meses_al_futuro: "3"}}
-
-
remove_zero: Shows the date "01/mm/yyyy" N months in the future..0Example:-
: Removes the
{{empleado.horas_semanales | remove_zero}}
-
-
monto_con_formatofrom a number.$ ###.###Example:-
: Displays an amount in monetary format (e.g.,
{{empleado.total_descuentos_ultima_liquidacion | monto_con_formato}}).$ 500.000Example:
-
-
monto_con_decimales_a_palabras(result:-
)
{{empleado.sueldo | monto_con_decimales_a_palabras}}
-
-
convertir_a_mayusculas: Converts a decimal number to words (decimals as fraction x/100).-
Example:
{{empleado.nombre_completo | convertir_a_mayusculas}}
-
: Transforms text to uppercase.
Example:if6. Operators
-
==You can use the following operators in conditional structures ( -
!=): -
greater_than(Equal to) -
less_than(Not equal to) -
greater_or_equal_than(Greater than) -
less_or_equal_than(Less than) -
or(Greater than or equal to) -
and(Less than or equal to)