Custom Reporting -- Creating an Establishment Report - 4.0.9 - ES

From IHRIS Wiki

Éste tutorial aplica para la versión 4.0.9 y posteriores de iHRIS Manage. Para ver este tutorial para versiones distintas del software vea:

. También pondremos algo sobre funciones de agregación a las relaciones que es un tema nuevo presentado aquí.

En este tutorial discutimos como hacer un informe de establecimientos. Este informe mostrará el número total de personal por puesto y localidad en un establecimiento especifico.

Tal vez desee leer las instrucciones acerca de fijar un establecimiento antes de proceder.

Para los fines de este tutorial, asumiremos que nos interesan los establecimientos de "Nomas de Personal" para el año 2010.

Nota: En esta relación, asumimos que ha fijado el establecimiento/normas de personal de forma consistente en (job,facility).


Generalidades

Primero iniciamos creando una relación de desacuerdo. Asumiremos que ya está familiarizado con la creación de informes personalizados, como por ejemplo en Creating A Staff List.

A continuación necesitamos seleccionar los campos que deseamos incluir en el informe. Finalmente creamos una visualización de reporte para mostrar el total de puestos en el establecimiento.

Al crear esta relación, seria de ayuda conocer las diferencias entre JOIN, LEFT JOIN y RIGHT JOIN en SQL. Estos son algunos lugares donde puede leer sobre esto:

Crear la Relación Base

Solo nos interesan los puestos actuales en el sistema. Necesitamos crear una relación de formulario de la siguiente manera:

  • Cree una relación de formulario nueva llamada "staff_norms_2010" con el formulario primario "establishment"
    • Ahora limite el formulario "establishment", para que el campo "establishemnt_period" sea igual a "Staffing Norm - 2010" o a cualquiera que sea el establecimiento con el que desea trabajar.
    • Bajo el formulario "establishment" vamos a join en el formulario "facility" vinculado por el campo "establishment+location".
      Nota: Es importante que este formulario este adjuntado como Left Join y que permita múltiples adjuntos. De esta manera obtenemos una copia del formulario establishment apropiado para cada "facility" en el sistema.
    • Bajo el "establishment" vamos a join el formulario "job" vinculado por el campo "establishment+job_cadre".
      Nota: Es importante que este formulario este adjuntado como Left Join y que permita múltiples adjuntos. De esta manera obtenemos una copia del formulario establishment de cada empleo en el sistema. Combinando con lo adjunto para la localidad, obtendremos una copia del formulario establishment apropiado para cada par único de (facility,job) en el sistema.
      • Bajo el formulario "job", haremos un join en el formulario "position" a través del campo "position+job".
        Nota: Es importante que este formulario este adjuntado como Left Join y que permita múltiples adjuntos. De esta manera obtenemos una copia del formulario job para cadapuesto en el sistema que se vincule con ese empleo. Combinando con lo adjunto para la localidad y empleo para el formulario de establishment, y una vez que hayamos hecho la vinculación en el próximo paso, obtendremos una copia del formulario establishment apropiado para cada trio único de (facility,job,position) en el sistema.
        • Vamos a link el formulario de "position" para que el campo "position+facility" sea igual que el campo "facility+id". Esto es para asegurarse que el puesto coincida con la localidad y empleo al que el formulario establishment está haciendo referencia.
        • A continuación necesitamos join el "person_position" al formulario "position" para que "person_position+position" = "position+id."
          Nota: Es importante que este sea un JOIN con un límite de uno. (si es left join, recibirá todos los puestos aun si no están ocupados)
          • Sea cual sea el número de personas que hayan tenido este puesto durante los años, queremos escoger el puesto más reciente. También queremos asegurarnos que estén empleados actualmente. Así que necesitamos agregar dos límites al formulario "person_position" para que:
            • start_date no es nulo (para indicar que alguien tuvo ese puesto)
            • end_date es nulo (para indicar que el puesto aun está siendo ocupado por alguien)

La relación resultante debería verse como la mitad superior de this


Linking a Form

To explain a bit about the linking, the "establishment" module has two fields:

  1. The "location" field which is a mapped field that can either be a "facility" or a "facility_type"
  2. The "job_cadre" field which is a mapped field that can be either a "job" or a "cadre"

Linking the position form to the ancestral "facility" form will result that you only populate the report where the "position" form has its "facility" mapping to the facility form in the relationship

Adding the Relationship Functions

Now that we have created our base relationship, we need to create two relationship functions.

Aggregate Total Positions

Recall, that when we joined in the base relationship has a copy of the establishment form for each triple of (facility,job,position). We really only want to have a copy of the establishment form once for each pair (facility,job) and we only want the total number of positions for each pair (facility,job), not the positions themselves. Thus our first step is to create an "aggregating" function:

  • Under "Functions" create a new function called "filled_positions" that has:
    • SQL Query: count(`position+id`)
    • Description: Filled Positions
    • Form Field: I2CE_FormField_INT
    • Aggregate: position,person_position
      Note: you can only set the aggregate once you have created "filled_positions." Edit it and set it so that it aggregates on the position form as indicated.

Variance

Now that we have a function to get the total number of positions for each pair of (facility,job) we want to display the variance -- the difference between the establishment and the filled positions. Since we will have needed to do the count(`position+id`) first, we will need to make the 'variance' a dependent function of the 'filled_positions'. The actual establishment number is stored in the "amount" field of the "establishment" form which is the primary form in the relationship. So to create the function we do:

  • Go under 'filled_positions'
  • Click 'Dependent Functions'
  • Click 'Add a new function' and add a function with these properties:
    • SQL Query: `primary_form+amount` - `+filled_positions`
    • Description: Variance Between Establishment and Filled Positions
    • Form Field: I2CE_FormField_INT

Note here that all functions in the SQL query have a + automatically added to the beginning of their name


The resulting functions should look like the lower half of this

Creating The Report

We create a report view based on the "staff_norm_2010" relationship with the following forms and field settings:

  • The primary form (establishment)'s amount field is enabled with header "Establishment"
  • The job form has the field title enabled with header "Job"
  • The facility form has the field title enabled with header "Facility"
  • The function 'filled_position' is enabled with header "Filled Positions"
  • The function 'variance' is enabled with header "Variance"

Creating The Report View

You may now create a report view based on the staff_norm_2010 report


Variations of the Relationship

In the above we assume that you have set the establishment on the pairs (job,facility). However, you may have set the establishment differently.

  • If you set it on the pairs (cadre,facility) then in the relationship, instead of joining job to the establishment form, you would join cadre (right join with multiples). Then under the cadre form you would join job (right join with multiples). The rest would proceed as before.
  • If you set in on the pairs (job,facility_type) then in the relationship, instead of joining facility to the establishment form, you would join facility_type (right join with multiples). The under the facility_type form you would join facility (right join with multiples). The rest would proceed as before.
  • If you set it on the pairs (cadre,facility_type) then in the relationship, instead of joining job to the establishment form, you would join cadre (right join with multiples). Then under the cadre form you would join job (right join with multiples). Also, instead of joining facility to the establishment form, you would join facility_type (right join with multiples). The under the facility_type form you would join facility (right join with multiples). The rest would proceed as before.

Ancestor Forms

An "ancestor" form in a relationship is any form at a higher level in the current form in the relationship hierarchy. In the above example we have the hierarchy:

  • person_position
    • position
      • facility
        • facility_type
          • establishment
      • job
        • cadre

In this hierarchy, we have the following ancestors:

  • person_position: has no ancestors
  • position: has person_position as an ancestor
  • facility:has person_position and position as ancestors
  • job:has person_position and position as ancestors
  • facility_type: has person_position, position, facility, and job as ancestors
  • cadre: has person_position, position, job, and facility as ancestors
  • establishment: has person_position, position, job, facility, cadre and facility_type as ancestors