Files
MBS/PROYECTO/PRDIR/prprrp003.4gl
T

1742 lines
60 KiB
Plaintext

{
------------------------------------------------------------------------
PROGRAMA : PRPRRP003
OBJETIVO : LISTAR FORMULARIO REPORTE PRODUCCION POR TIPO DE PILA
COMENTARIOS : ESTE REPORTE ES MUY PARTICULAR. HAY UNAS VARIABLES PARA
QUE EL DISENO DE ESTE REPORTE ESTE IGUAL AL REQUERIDO POR
EL USUARIO.
LAS VARIABLES SON:
ID - EL REPORTE ESTA DIVIDIDO EN
3 PARTES. LA 1RA PARTE ES HASTA
LAS HORAS EXTRAS INDIRECTAS DEL
DEPARTAMENTO -A-.
LA 2DA PARTE ES HASTA HORAS EXTRAS
DIRECTAS EMP. ESPECIAL
LA 3RA PARTE ES HASTA EL FINAL.
ESTA VARIABLE TOMA DOS VALORES:
1- CUBRE LA 1RA Y 2DA PARTE,
2- LA 3RA PARTE.
NUM - ESTA IDENTIFICA LA DESCRIPCION
GENERAL DE UN DEPARTAMENTO
ESPECIFICO. ESTOS CODIGOS SON:
1- HORAS NORMALES DIRECTAS
2- HORAS NORMALES INDIRECTAS
3- HORAS EXTRAS DIRECTAS
4- HORAS EXTRAS INDIRECTAS
5- PERSONAL DE
6- HORAS ADM.
7- PRODUCCION
CONTROL - ESTE ES EL ORDEN DENTRO DE LOS DE
LA VARIABLE NUM.
T_CONTROL - ESTE ES EL ORDEN QUE LOS RENGLONES
O SEA LOS 1- HORAS EXTRAS, ETC.
SE PRESENTARAN EN EL REPORTE
ESTE REPORTE BUSCA POR CADA RENGLON PRESENTADO EN EL, LAS
INFORMACIONES. ES DECIR, QUE SI VOY A BUSCAR LAS HORAS DIRECTAS
DEL DEPARTAMENTO -A- HAY UN SELECT DENTRO DE UN LOOP DE LOS DIAS.
PROGRAMADOR : Juan F. Soto
FECHA : Septiembre 22, 1994
------------------------------------------------------------------------
}
GLOBALS
"prprgb000.4gl"
DEFINE pilas RECORD LIKE intb00001.*
DEFINE dia1,fecha1,fecha2 DATE
DEFINE no_semana SMALLINT
DEFINE primera CHAR(1)
DEFINE arreglo ARRAY[5,8] OF RECORD
nombre CHAR(15),
sabado DECIMAL (12,2),
domingo DECIMAL (12,2),
lunes DECIMAL (12,2),
martes DECIMAL (12,2),
miercoles DECIMAL (12,2),
jueves DECIMAL (12,2),
viernes DECIMAL (12,2)
END RECORD
FUNCTION prprrp003()
DEFINE dpto CHAR(13)
DEFINE p_horas,k_horas DECIMAL(8,2)
DEFINE id,t_control,num SMALLINT
DEFINE control CHAR(2)
DEFINE dias1 DATE
OPTIONS
ERROR LINE 24,
FORM LINE 8
OPEN FORM prfmrp003 FROM "prfmrp003"
DISPLAY FORM prfmrp003
CALL pantalla()
DISPLAY "prprrp003" AT 4,3
DISPLAY "Resumen Semanal de Produccion" AT 6,25
LET tipo_papel = 1
CALL msgrp000(tipo_papel)
# Entrada del numero de semana correspondiente al periodo que el usuario quiera
# este control es para tener consistencia en la informacion de las fechas
INPUT BY NAME no_semana
AFTER FIELD no_semana
# Chequea que el codigo del numero de la semana este en la tabla donde estan
# almacenadas
SELECT semana_del,semana_al INTO fecha1,fecha2
FROM prtb00002
WHERE num_semana = no_semana
IF status = notfound THEN
LET numero_msg = 3
CALL msg(numero_msg)
NEXT FIELD no_semana
END IF
DISPLAY BY NAME fecha1,fecha2
END INPUT
# Cancela operacion
IF int_flag THEN
LET numero_msg = 2
CALL msg(numero_msg)
LET int_flag = false
RETURN
END IF
START REPORT reporte_3 TO "C:\\archivo"
LET primera = "S"
# Loop para buscar informacion diaria de las horas normales
LET dia1 = fecha1
LET id = 1
FOR idx =1 TO 7
# Busqueda de las k_horas directas de los empleados
# Empleados en depto 'A' (Horas normales Directas)
LET k_horas = 0
SELECT SUM(a.h_directa) INTO k_horas
FROM cttb00003 a,prtb00004 b
WHERE a.departamento = b.departamento and a.fecha = dia1 and
b.tipo = "A" and a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "A"
LET num = 1
LET control = "A1"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
LET dia1 = fecha1
FOR idx = 1 TO 7
# Empleados en depto 'B+C' (Horas normales Directas)
SELECT SUM(a.h_directa) INTO k_horas
FROM cttb00003 a,prtb00004 b
WHERE a.departamento = b.departamento and a.fecha = dia1 and
a.departamento != 6114 and b.tipo = "B+C" and a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "B+C"
LET num = 1
LET control = "B1"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
LET dia1 = fecha1
FOR idx = 1 TO 7
# Empleados en depto 'D' (Horas normales Directas)
SELECT SUM(a.h_directa) INTO k_horas
FROM cttb00003 a,prtb00004 b
WHERE a.departamento = b.departamento and a.fecha = dia1 and
b.tipo = "D" and a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "D"
LET num = 1
LET control = "D1"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
#==========================================================================
# Loop para buscar informacion diaria de las horas normales indirectas
LET dia1 = fecha1
FOR idx =1 TO 7
# Busqueda de las horas directas de los empleados
# Empleados en depto 'A' (HORAS NORMALES INDIRECTAS)
SELECT SUM(a.h_indirecta) INTO k_horas
FROM cttb00003 a,prtb00004 b
WHERE a.departamento = b.departamento and a.fecha = dia1 and
b.tipo = "A" and a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "A"
LET num = 2
LET control = "A2"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
LET dia1 = fecha1
FOR idx = 1 TO 7
# Empleados en depto 'B+C' (HORAS NORMALES INDIRECTAS)
SELECT SUM(a.h_indirecta) INTO k_horas
FROM cttb00003 a,prtb00004 b
WHERE a.departamento = b.departamento and a.fecha = dia1 and
a.departamento != 6114 and b.tipo = "B+C" and a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "B+C"
LET num = 2
LET control = "B2"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
LET dia1 = fecha1
FOR idx = 1 TO 7
# Empleados en depto 'D' (HORAS NORMALES INDIRECTAS)
SELECT SUM(a.h_indirecta) INTO k_horas
FROM cttb00003 a,prtb00004 b
WHERE a.departamento = b.departamento and a.fecha = dia1 and
b.tipo = "D" and a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "D"
LET num = 2
LET control = "D2"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
#==========================================================================
# Loop para buscar informacion dia1ria de las HORAS EXTRAS DIRECTAS
LET dia1 = fecha1
FOR idx =1 TO 7
# Busqueda de las k_horas directas de los empleados
# Empleados en depto 'A' (HORAS EXTRAS)
SELECT SUM(a.e_directa) INTO k_horas
FROM cttb00003 a,prtb00004 b
WHERE a.departamento = b.departamento and a.fecha = dia1 and
b.tipo = "A" and a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "A"
LET num = 3
LET control = "A3"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
LET dia1 = fecha1
FOR idx = 1 TO 7
# Empleados en depto 'B+C' (HORAS EXTRAS)
SELECT SUM(a.e_directa) INTO k_horas
FROM cttb00003 a,prtb00004 b
WHERE a.departamento = b.departamento and a.fecha = dia1 and
a.departamento != 6114 and b.tipo = "B+C" and a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "B+C"
LET num = 3
LET control = "B3"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
LET dia1 = fecha1
FOR idx = 1 TO 7
# Empleados en depto 'D' (HORAS EXTRAS)
SELECT SUM(a.e_directa) INTO k_horas
FROM cttb00003 a,prtb00004 b
WHERE a.departamento = b.departamento and a.fecha = dia1 and
b.tipo = "D" and a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "D"
LET num = 3
LET control = "D3"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
#===========================================================================
# Loop para buscar informacion dia1ria de las HORAS EXTRAS INDIRECTAS
LET dia1 = fecha1
FOR idx =1 TO 7
# Busqueda de las horas indirectas de los empleados
# Empleados en depto 'A' (HORAS EXTRAS)
SELECT SUM(a.e_indirecta) INTO k_horas
FROM cttb00003 a,prtb00004 b
WHERE a.departamento = b.departamento and a.fecha = dia1 and
b.tipo = "A" and a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "A"
LET num = 4
LET control = "A4"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
LET dia1 = fecha1
FOR idx = 1 TO 7
# Empleados en depto 'B+C' (HORAS EXTRAS)
SELECT SUM(a.e_indirecta) INTO k_horas
FROM cttb00003 a,prtb00004 b
WHERE a.departamento = b.departamento and a.fecha = dia1 and
a.departamento != 6114 and b.tipo = "B+C" and a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "B+C"
LET num = 4
LET control = "B4"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
LET dia1 = fecha1
FOR idx = 1 TO 7
# Empleados en depto 'D' (HORAS EXTRAS)
SELECT SUM(a.e_indirecta) INTO k_horas
FROM cttb00003 a,prtb00004 b
WHERE a.departamento = b.departamento and a.fecha = dia1 and
b.tipo = "D" and a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "D"
LET num = 4
LET control = "D4"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
{
=============================================================================
2DA PARTE DEL PROGRAMA PARA BUSCAR LOS DEPARTAMENTOS:
MANTENIMIENTO,SERV. GENERALES, RECUPERACION, EMP. ESPECIAL
==============================================================================
}
# Busqueda del departamento MANTENIMIENTO
# HORAS NORMALES
# HORAS NORMALES INDIRECTAS
LET dia1 = fecha1
FOR idx = 1 TO 7
SELECT SUM(a.hn_ind) INTO k_horas
FROM prtb00003 a,adtb00003 b
WHERE a.departamento in (6200,6400) and a.fecha = dia1 and
a.departamento = b.departamento and
a.num_emp = b.num_emp and
b.nivel_emp != 2 and
a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "MANTENIMIENTO"
LET num = 10
LET control = "A1"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
# HORAS NORMALES INDIRECTAS SERV. GENERALES
LET dia1 = fecha1
FOR idx = 1 TO 7
SELECT SUM(a.hn_ind) INTO k_horas
FROM prtb00003 a,adtb00003 b
WHERE a.departamento = 6500 and
a.num_emp = b.num_emp and
b.nivel_emp not in (2) and
a.fecha = dia1 and
a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "SERV. GENERALES"
LET num = 10
LET control = "A1"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
# HORAS EXTRAS INDIRECTAS
# CONTROL CALIDAD
LET dia1 = fecha1
FOR idx = 1 TO 7
SELECT SUM(a.he_ind) INTO k_horas FROM prtb00003 a,adtb00003 b
WHERE a.departamento = 6300 and b.departamento = 6300 and
a.num_emp = b.num_emp and b.nivel_emp != 1 and
a.fecha = dia1 and a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "CONT. CALIDAD"
LET num = 11
LET control = "A1"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
# HORAS NORMALES INDIRECTAS
# CONTROL CALIDAD
LET dia1 = fecha1
FOR idx = 1 TO 7
SELECT SUM(a.hn_ind) INTO k_horas FROM prtb00003 a,adtb00003 b
WHERE a.departamento = 6300 and b.departamento = 6300 and
a.num_emp = b.num_emp and b.nivel_emp != 1 and
a.fecha = dia1 and a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "CONT. CALIDAD"
LET num = 10
LET control = "A1"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
# HORAS EXTRAS INDIRECTAS
LET dia1 = fecha1
FOR idx = 1 TO 7
SELECT SUM(a.he_ind) INTO k_horas
FROM prtb00003 a,adtb00003 b
WHERE a.departamento in (6200,6400) and a.num_emp = b.num_emp and
b.nivel_emp != 2 and a.fecha = dia1 and a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "MANTENIMIENTO"
LET num = 11
LET control = "B1"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
# HORAS EXTRAS INDIRECTAS
LET dia1 = fecha1
FOR idx = 1 TO 7
SELECT SUM(a.he_ind) INTO k_horas
FROM prtb00003 a,adtb00003 b
WHERE a.departamento = 6500 and a.num_emp = b.num_emp and
b.nivel_emp != 2 and a.fecha = dia1 and a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "SERV. GENERALES"
LET num = 11
LET control = "B1"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
#-----------------------------------------------------------------------------
#Busqueda del departamento RECUPERACION
# HORAS NORMALES INDIRECTAS
LET dia1 = fecha1
FOR idx = 1 TO 7
SELECT SUM(a.h_indirecta) INTO k_horas
FROM cttb00003 a
WHERE a.departamento = 6114 and a.fecha = dia1 and
a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "RECUPERACION"
LET num = 10
LET control = "A1"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
# HORAS EXTRAS INDIRECTAS
# RECUPERACION
LET dia1 = fecha1
FOR idx = 1 TO 7
SELECT SUM(a.e_indirecta) INTO k_horas
FROM cttb00003 a
WHERE a.departamento = 6114 and a.fecha = dia1 and
a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "RECUPERACION"
LET num = 11
LET control = "B1"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
#--------------------------------------------------------------------------
#DEPARTAMENTO RECUPERACION
# HORAS NORMALES INDIRECTAS + HORAS EXTRAS INDIRECTAS
LET dia1 = fecha1
FOR idx = 1 TO 7
SELECT SUM(a.h_indirecta+a.e_indirecta) INTO k_horas
FROM cttb00003 a
WHERE a.departamento = 6114 and
a.fecha = dia1 and
a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "RECUPERACION"
LET num = 8
LET control = "C1"
LET dias1 = dia1
LET t_control = 6
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
#--------------------------------------------------------------------------
# EMPAQUE ESPECIAL
# HORAS EXTRAS INDIRECTAS + HORAS NORMALES INDIRECTAS
LET dia1 = fecha1
FOR idx = 1 TO 7
SELECT SUM(a.h_directa+a.h_indirecta+a.e_directa+a.e_indirecta) INTO k_horas
FROM cttb00003 a
WHERE a.departamento = 6117 and a.fecha = dia1 and a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "EMP. ESPECIAL"
LET num = 8
LET control = "C1"
LET dias1 = dia1
LET t_control = 6
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
{
=============================================================================
3RA PARTE DEL PROGRAMA PARA BUSCAR LA PRODUCCION DE PILAS:
D,C Y AA. LOS DEPARTAMENTOS MANTENIMIENTO, SERV. GENERALES, CONTROL
CALIDAD, RECUPERACION, EMP. ESPECIAL, GERENCIA PLANTA.
=============================================================================
}
LET id = 2
# PRODUCCION PILAS D
LET dia1 = fecha1
FOR idx = 1 TO 7
SELECT SUM(a.cantidad_2) INTO p_horas
FROM iptb00006 a
WHERE (a.cod_grupo = 1) and (a.cod_mov = 20) and
(a.fecha = dia1) and (a.status_t is null)
LET dpto = "D "
LET num = 7
LET control = "A1"
LET dias1 = dia1
LET t_control = 2
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,p_horas)
LET dia1 = dia1 + 1
END FOR
# PRODUCCION PILAS C
LET dia1 = fecha1
FOR idx = 1 TO 7
SELECT SUM(a.cantidad_2) INTO k_horas
FROM iptb00006 a
WHERE (a.cod_grupo = 2) and
(a.cod_mov = 20) and
(a.fecha = dia1) and
(a.status_t is null)
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "C "
LET num = 7
LET control = "A1"
LET dias1 = dia1
LET t_control = 2
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
# PRODUCCION PILAS AA
LET dia1 = fecha1
FOR idx = 1 TO 7
SELECT SUM(a.cantidad_2) INTO k_horas
FROM iptb00006 a
WHERE (a.cod_grupo = 3) and
(a.cod_mov = 20) and
(a.fecha = dia1) and
(a.status_t is null)
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "AA"
LET num = 7
LET control = "A1"
LET dias1 = dia1
LET t_control = 2
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
{
=============================================================================
4TA PARTE DEL PROGRAMA PARA BUSCAR LA PRODUCCION DE PILAS:
D,C Y AA. LOS DEPARTAMENTOS MANTENIMIENTO, SERV. GENERALES, CONTROL
CALIDAD, RECUPERACION, EMP. ESPECIAL, GERENCIA PLANTA.
=============================================================================
}
LET id = 3
# PERSONAL DE PRODUCCION
LET dia1 = fecha1
FOR idx = 1 TO 7
DECLARE busca20 CURSOR FOR
SELECT UNIQUE a.emp_no
FROM cttb00003 a
WHERE
(a.fecha = dia1) and
a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "PRODUCCION"
LET num = 5
LET control = "A1"
LET dias1 = dia1
LET t_control = 1
FOREACH busca20 INTO k_horas
SELECT unique cod_n FROM iptb00006
WHERE (fecha = dia1) and
(cod_mov = 20) and
status_t is null
IF status != notfound THEN
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
END IF
END FOREACH
LET dia1 = dia1 + 1
END FOR
# SUPERVISION
LET dia1 = fecha1
FOR idx = 1 TO 7
DECLARE busca1 CURSOR FOR
SELECT UNIQUE a.departamento,a.num_emp
FROM prtb00003 a,adtb00003 b
WHERE (a.departamento = b.departamento) and
(a.num_emp= b.num_emp) and
(b.nivel_emp = 2) and
a.fecha = dia1 and
a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "SUPERVISION"
LET num = 5
LET control = "A1"
LET dias1 = dia1
LET t_control = 1
FOREACH busca1 INTO k_horas,k_horas
SELECT unique cod_n FROM iptb00006
WHERE (fecha = dia1) and
(cod_mov = 20) and
status_t is null
IF status != notfound THEN
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
END IF
END FOREACH
LET dia1 = dia1 + 1
END FOR
# MANTENIMIENTO
LET dia1 = fecha1
FOR idx = 1 TO 7
DECLARE busca2 CURSOR FOR
SELECT UNIQUE a.departamento,a.num_emp INTO k_horas,k_horas
FROM prtb00003 a,adtb00003 b
WHERE (a.departamento = b.departamento) and
(a.departamento in (6200,6400)) and
(a.num_emp = b.num_emp) and
(b.nivel_emp not in (2)) and
a.fecha = dia1 and
a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "MANTENIMIENTO"
LET num = 5
LET control = "A1"
LET dias1 = dia1
LET t_control = 1
FOREACH busca2 INTO k_horas,k_horas
SELECT unique cod_n FROM iptb00006
WHERE (fecha = dia1) and
(cod_mov = 20) and
status_t is null
IF status != notfound THEN
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
END IF
END FOREACH
LET dia1 = dia1 + 1
END FOR
# SERV. GENERALES
LET dia1 = fecha1
FOR idx = 1 TO 7
DECLARE busca10 CURSOR FOR
SELECT UNIQUE a.departamento,a.num_emp INTO k_horas,k_horas
FROM prtb00003 a,adtb00003 b
WHERE (a.departamento = b.departamento) and
(a.departamento = 6500) and
(a.num_emp = b.num_emp) and
(b.nivel_emp not in (2)) and
a.fecha = dia1 and
a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "SERV. GENERALES"
LET num = 5
LET control = "A1"
LET dias1 = dia1
LET t_control = 1
FOREACH busca10 INTO k_horas
SELECT unique cod_n FROM iptb00006
WHERE (fecha = dia1) and
(cod_mov = 20) and
status_t is null
IF status != notfound THEN
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
END IF
END FOREACH
LET dia1 = dia1 + 1
END FOR
# CONTROL CALIDAD
LET dia1 = fecha1
FOR idx = 1 TO 7
DECLARE busca3 CURSOR FOR
SELECT UNIQUE a.departamento,a.num_emp INTO k_horas,k_horas
FROM prtb00003 a,adtb00003 b
WHERE (a.departamento = b.departamento) and
(a.departamento = 6300) and
(a.num_emp = b.num_emp) and
(b.nivel_emp not in (2)) and
a.fecha = dia1 and
a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "CONT. CALIDAD"
LET num = 5
LET control = "A1"
LET dias1 = dia1
LET t_control = 1
FOREACH busca3 INTO k_horas
SELECT unique cod_n FROM iptb00006
WHERE (fecha = dia1) and
(cod_mov = 20) and
status_t is null
IF status != notfound THEN
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
END IF
END FOREACH
LET dia1 = dia1 + 1
END FOR
# GERENCIA DE PLANTA
LET dia1 = fecha1
FOR idx = 1 TO 7
DECLARE busca13 CURSOR FOR
SELECT UNIQUE a.departamento,a.num_emp INTO k_horas,k_horas
FROM prtb00003 a,adtb00003 b
WHERE (a.departamento = b.departamento) and
(a.departamento = 6000) and
(a.num_emp = b.num_emp) and
(b.nivel_emp not in (2)) and
a.fecha = dia1 and
a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "GERENCIA PLANTA"
LET num = 5
LET control = "A1"
LET dias1 = dia1
LET t_control = 1
FOREACH busca13 INTO k_horas
SELECT unique cod_n FROM iptb00006
WHERE (fecha = dia1) and
(cod_mov = 20) and
status_t is null
IF status != notfound THEN
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
END IF
END FOREACH
LET dia1 = dia1 + 1
END FOR
#----------------------------------------------------------------------------
# HORAS ADM.
LET id = 4
# GERENCIA DE PLANTA
LET dia1 = fecha1
FOR idx = 1 TO 7
SELECT SUM(a.hn_ind+a.he_ind) INTO k_horas,k_horas
FROM prtb00003 a
WHERE (a.departamento = 6000) and a.fecha = dia1 and a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET k_horas = k_horas
LET dpto = "GERENCIA PLANTA"
LET num = 6
LET control = "A1"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
# SUPERVISOR
LET dia1 = fecha1
FOR idx = 1 TO 7
SELECT SUM(a.hn_ind+a.he_ind) INTO k_horas
FROM prtb00003 a,adtb00003 b
WHERE (a.departamento = b.departamento) and (a.num_emp = b.num_emp) and
(b.nivel_emp = 2 ) and a.fecha = dia1 and a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "SUPERVISOR"
LET num = 6
LET control = "A1"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
# HORAS NORMALES INDIRECTAS
# CONTROL CALIDAD
LET dia1 = fecha1
FOR idx = 1 TO 7
SELECT SUM(a.hn_ind+a.he_ind) INTO k_horas FROM prtb00003 a,adtb00003 b
WHERE a.departamento = 6300 and
b.departamento = 6300 and
a.num_emp = b.num_emp and
b.nivel_emp = 1 and
a.fecha = dia1 and
a.status_t is null
IF k_horas is null THEN
LET k_horas = 0
END IF
LET dpto = "CONT. CALIDAD"
LET num = 6
LET control = "A1"
LET dias1 = dia1
LET t_control = 1
OUTPUT TO REPORT reporte_3(id,t_control,dias1,dpto,control,num,k_horas)
LET dia1 = dia1 + 1
END FOR
#-------------------------------------------------------------------------
FINISH REPORT reporte_3
RUN "type C:\\archivo > %USPRINT%" END FUNCTION
REPORT reporte_3(x_id,k_control,x_dia,x_dpto,x_control,numero,x_horas)
DEFINE empleados,num_ant,x_id,k_control,numero,dias,p_sabado,p_domingo,
p_lunes,p_martes,p_miercoles,p_jueves,p_viernes SMALLINT,
nombre_prt CHAR(30)
DEFINE x_dpto CHAR(13)
DEFINE x_control CHAR(2)
DEFINE t_lunes,t_martes,t_miercoles,t_jueves,t_viernes,t_sabado,t_domingo,
lunes,martes,miercoles,jueves,viernes,sabado,domingo,
x_horas DECIMAL(8,2),
x_dia DATE,
t_planta,t_planta1,t_prod DECIMAL(12,2),
t_planta_l,t_planta_l1,t_planta_m,t_planta_m1,t_planta_ma,t_planta_ma1,
t_planta_j,t_planta_j1,t_planta_v,t_planta_v1,t_planta_s,t_planta_s1,
t_planta_d,t_planta_d1,total1,total2,total3,total4,total5,total6,total7,
total8,total11,total12,total13,total14,total15,total16,total17,total18
DECIMAL(8,2),
hora_lunes,hora_martes,hora_miercoles,hora_jueves,hora_viernes,
hora_sabado,hora_domingo,hora_t_prod SMALLINT
DEFINE doce_of,comprime,doce_on,negrillas_on,negrillas_off,doce CHAR(2)
OUTPUT
TOP MARGIN 3
LEFT MARGIN 5
ORDER BY x_id,k_control,numero,x_dpto DESC,x_control
FORMAT
PAGE HEADER
LET doce_on = ASCII 27, ASCII 77
LET comprime = ASCII 15
LET doce_of = ASCII 27, ASCII 80
LET negrillas_on = ASCII 27, ASCII 69
LET negrillas_off = ASCII 27, ASCII 70
PRINT comprime,negrillas_on
PRINT COLUMN 1,"prprrp003",
COLUMN 48, "R A Y .O. V A C D O M I N I C A N A, S. A.",
COLUMN 128, "PAG. ",pageno using "###"
PRINT COLUMN 48, " SISTEMA DE PRODUCCION",
COLUMN 128, TODAY USING "DD/MM/YY"
PRINT COLUMN 48, " RESUMEN SEMANAL DE PRODUCTIVIDAD",
COLUMN 128, TIME
PRINT negrillas_off
PRINT "FECHA: DEL ",fecha1 using "dd/mm/yy"," AL ",fecha2 using "dd/mm/yy"
PRINT
"=============================================================================",
"=========================================================="
PRINT COLUMN 1, "CONCEPTO",
COLUMN 30, "DEPTO",
COLUMN 51, "SABADO",
COLUMN 62, "DOMINGO",
COLUMN 69, " LUNES",
COLUMN 83, "MARTES",
COLUMN 93, "MIERCOLES",
COLUMN 105, "JUEVES",
COLUMN 114, "VIERNES",
COLUMN 128, " TOTAL"
PRINT
"=============================================================================",
"=========================================================="
SKIP 1 LINE
BEFORE GROUP OF x_control
IF num_ant != numero THEN
CASE
WHEN numero = 1
LET nombre_prt = "HORAS NORMALES DIRECTAS"
WHEN numero = 2
LET nombre_prt = "HORAS NORMALES INDIRECTAS"
WHEN numero = 3
LET nombre_prt = "HORAS EXTRAS DIRECTAS"
WHEN numero = 4
LET nombre_prt = "HORAS EXTRAS INDIRECTAS"
WHEN numero = 5
LET nombre_prt = "PERSONAL DE"
WHEN numero = 6
LET nombre_prt = "HORAS ADM."
WHEN numero = 7
LET nombre_prt = "PRODUCCION"
WHEN numero = 8
LET nombre_prt = "HORAS IND NO PRODUCTIVAS"
WHEN numero = 10
LET nombre_prt = "HORAS NORMALES INDIRECTAS"
WHEN numero = 11
LET nombre_prt = "HORAS EXTRAS INDIRECTAS "
END CASE
LET num_ant = numero
PRINT COLUMN 1, nombre_prt clipped," ";
END IF
PRINT COLUMN 27, x_dpto;
ON EVERY ROW
IF x_horas is null THEN
LET x_horas = 0
END IF
IF x_id != 3 THEN
PRINT COLUMN 47, x_horas using "###,###.##"," ";
END IF
AFTER GROUP OF x_dpto
IF x_id != 3 THEN
PRINT COLUMN 104, GROUP SUM(x_horas)
WHERE numero = numero using "#,###,###.##"
END IF
IF x_id = 3 THEN
IF x_dpto = "PRODUCCION" THEN
LET arreglo[3,8].nombre="PRODUCCION"
LET arreglo[3,1].sabado= GROUP COUNT(*) WHERE weekday(x_dia) = 6
LET arreglo[3,2].domingo= GROUP COUNT(*) WHERE weekday(x_dia) = 0
LET arreglo[3,3].lunes= GROUP COUNT(*) WHERE weekday(x_dia) = 1
LET arreglo[3,4].martes= GROUP COUNT(*) WHERE weekday(x_dia) = 2
LET arreglo[3,5].miercoles= GROUP COUNT(*) WHERE weekday(x_dia) = 3
LET arreglo[3,6].jueves= GROUP COUNT(*) WHERE weekday(x_dia) = 4
LET arreglo[3,7].viernes= GROUP COUNT(*) WHERE weekday(x_dia) = 5
END IF
LET dias = 0
LET empleados = 0
LET p_sabado = GROUP COUNT(*)
WHERE weekday(x_dia) = 6
IF p_sabado > 0 THEN
LET dias = dias + 1
END IF
LET empleados = empleados + p_sabado
LET p_domingo =GROUP COUNT(*)
WHERE weekday(x_dia) = 0
IF p_domingo > 0 THEN
LET dias = dias + 1
END IF
LET empleados = empleados + p_domingo
LET p_lunes = GROUP COUNT(*)
WHERE weekday(x_dia) = 1
IF p_lunes > 0 THEN
LET dias = dias + 1
END IF
LET empleados = empleados + p_lunes
LET p_martes = GROUP COUNT(*)
WHERE weekday(x_dia) = 2
IF p_martes > 0 THEN
LET dias = dias + 1
END IF
LET empleados = empleados + p_martes
LET p_miercoles =
GROUP COUNT(*)
WHERE weekday(x_dia) = 3
IF p_miercoles > 0 THEN
LET dias = dias + 1
END IF
LET empleados = empleados + p_miercoles
LET p_jueves = GROUP COUNT(*)
WHERE weekday(x_dia) = 4
IF p_jueves > 0 THEN
LET dias = dias + 1
END IF
LET empleados = empleados + p_jueves
LET p_viernes =GROUP COUNT(*)
WHERE weekday(x_dia) = 5
IF p_viernes > 0 THEN
LET dias = dias + 1
END IF
LET empleados = empleados + p_viernes
IF dias = 0 THEN
LET dias = 1
END IF
PRINT COLUMN 47, p_sabado using "###,###.##"," ",
p_domingo using "###,###.##"," ",
p_lunes using "###,###.##"," ",
p_martes using "###,###.##"," ",
p_miercoles using "###,###.##"," ",
p_jueves using "###,###.##"," ",
p_viernes using "###,###.##"," ",
empleados/dias using "####,###,###"," "
END IF
AFTER GROUP OF numero
PRINT negrillas_on
IF x_id != 3 THEN
PRINT COLUMN 1, "TOTAL: ",
COLUMN 47, GROUP SUM(x_horas) WHERE weekday(x_dia) = 6
using "###,###.##"," ",
GROUP SUM(x_horas) WHERE weekday(x_dia) = 0
using "###,###.##"," ",
GROUP SUM(x_horas) WHERE weekday(x_dia) = 1
using "###,###.##"," ",
GROUP SUM(x_horas) WHERE weekday(x_dia) = 2
using "###,###.##"," ",
GROUP SUM(x_horas) WHERE weekday(x_dia) = 3
using "###,###.##"," ",
GROUP SUM(x_horas) WHERE weekday(x_dia) = 4
using "###,###.##"," ",
GROUP SUM(x_horas) WHERE weekday(x_dia) = 5
using "###,###.##"," ",
GROUP SUM(x_horas) using "#,###,###.##"
PRINT negrillas_off
END IF
IF x_id = 3 THEN
LET dias = 0
LET empleados = 0
LET p_sabado = GROUP COUNT(*)
WHERE weekday(x_dia) = 6
IF p_sabado > 0 THEN
LET dias = dias + 1
END IF
LET empleados = empleados + p_sabado
LET p_domingo =GROUP COUNT(*) WHERE weekday(x_dia) = 0
IF p_domingo > 0 THEN
LET dias = dias + 1
END IF
LET empleados = empleados + p_domingo
LET p_lunes = GROUP COUNT(*) WHERE weekday(x_dia) = 1
IF p_lunes > 0 THEN
LET dias = dias + 1
END IF
LET empleados = empleados + p_lunes
LET p_martes = GROUP COUNT(*) WHERE weekday(x_dia) = 2
IF p_martes > 0 THEN
LET dias = dias + 1
END IF
LET empleados = empleados + p_martes
LET p_miercoles =
GROUP COUNT(*) WHERE weekday(x_dia) = 3
IF p_miercoles > 0 THEN
LET dias = dias + 1
END IF
LET empleados = empleados + p_miercoles
LET p_jueves = GROUP COUNT(*) WHERE weekday(x_dia) = 4
IF p_jueves > 0 THEN
LET dias = dias + 1
END IF
LET empleados = empleados + p_jueves
LET p_viernes =GROUP COUNT(*) WHERE weekday(x_dia) = 5
IF p_jueves > 0 THEN
LET dias = dias + 1
END IF
LET empleados = empleados + p_viernes
IF dias = 0 THEN
LET dias = 1
END IF
PRINT negrillas_on
PRINT "TOTAL: ",
COLUMN 47, p_sabado using "###,###.##"," ",
p_domingo using "###,###.##"," ",
p_lunes using "###,###.##"," ",
p_martes using "###,###.##"," ",
p_miercoles using "###,###.##"," ",
p_jueves using "###,###.##"," ",
p_viernes using "###,###.##"," ",
empleados/dias using "####,###,###"
display "PASE 1"
PRINT negrillas_off
PRINT "HORAS NO PRODUCTIVAS"
PRINT arreglo[3,8].nombre;
PRINT COLUMN 47, arreglo[3,1].sabado * .5 USING "###,###.##"," ",
arreglo[3,2].domingo * .5 USING "###,###.##"," ",
arreglo[3,3].lunes * .5 USING "###,###.##"," ",
arreglo[3,4].martes * .5 USING "###,###.##"," ",
arreglo[3,5].miercoles * .5 USING "###,###.##"," ",
arreglo[3,6].jueves * .5 USING "###,###.##"," ",
arreglo[3,7].viernes * .5 USING "###,###.##"," ",
(arreglo[3,1].sabado*.5) +(arreglo[3,2].domingo*.5) +
(arreglo[3,3].lunes*.5)+(arreglo[3,4].martes*.5) +
(arreglo[3,5].miercoles*.5) +(arreglo[3,6].jueves*.5) +
(arreglo[3,7].viernes*.5) using "###,###.##"
END IF
AFTER GROUP OF k_control
IF x_id = 1 THEN
IF primera = "S" THEN
LET primera = "N"
LET total11 = GROUP SUM(x_horas)
WHERE weekday(x_dia) = 6 and (numero = 2 or
numero = 4)
LET total12 = GROUP SUM(x_horas)
WHERE weekday(x_dia) = 0 and (numero = 2 or
numero = 4)
LET total13 = GROUP SUM(x_horas)
WHERE weekday(x_dia) = 1 and (numero = 2 or
numero = 4)
LET total14 = GROUP SUM(x_horas)
WHERE weekday(x_dia) = 2 and (numero = 2 or
numero = 4)
LET total15 = GROUP SUM(x_horas)
WHERE weekday(x_dia) = 3 and (numero = 2 or
numero = 4)
LET total16 = GROUP SUM(x_horas)
WHERE weekday(x_dia) = 4 and (numero = 2 or
numero = 4)
LET total17 = GROUP SUM(x_horas)
WHERE weekday(x_dia) = 5 and (numero = 2 or
numero = 4)
LET total18 = total11+total12+total13+total14+total15+total16+total17
PRINT "HORAS IND. NO PRODUCTIVAS",
COLUMN 47, total11 using "###,###.##"," ",
total12 using "###,###.##"," ",
total13 using "###,###.##"," ",
total14 using "###,###.##"," ",
total15 using "###,###.##"," ",
total16 using "###,###.##"," ",
total17 using "###,###.##"," ",
total18 using "###,###.##"
END IF
PRINT negrillas_on
PRINT "TOTAL GENERAL: ",
COLUMN 47, GROUP SUM(x_horas)
WHERE weekday(x_dia) = 6 using "###,###.##"," ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 0 using "###,###.##"," ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 1 using "###,###.##"," ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 2 using "###,###.##"," ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 3 using "###,###.##"," ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 4 using "###,###.##"," ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 5 using "###,###.##"," ",
GROUP SUM(x_horas) using "#,###,###.##"
END IF
PRINT negrillas_off
AFTER GROUP OF x_id
IF x_id = 1 THEN
PRINT COLUMN 1, "HORAS NORMALES"," ";
PRINT COLUMN 47, GROUP SUM(x_horas)
WHERE weekday(x_dia) = 6 and (numero = 1 or
numero = 2 or numero = 10)
using "###,###.##"," ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 0 and (numero = 1 or
numero = 2 or numero = 10)
using "###,###.##"," ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 1 and (numero = 1 or
numero = 2 or numero = 10)
using "###,###.##"," ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 2 and (numero = 1 or
numero = 2 or numero = 10)
using "###,###.##"," ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 3 and (numero = 1 or
numero = 2 or numero = 10)
using "###,###.##"," ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 4 and (numero = 1 or
numero = 2 or numero = 10)
using "###,###.##"," ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 5 and (numero = 1 or
numero = 2 or numero = 10)
using "###,###.##"," ",
GROUP SUM(x_horas)
WHERE numero = 1 or numero = 2 or
numero = 10 using "###,###.##"
PRINT COLUMN 1, "HORAS EXTRAS "," ";
PRINT COLUMN 47, GROUP SUM(x_horas)
WHERE weekday(x_dia) = 6 and (numero = 3 or
numero = 4 or numero = 11)
using "###,###.##", " ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 0 and (numero = 3 or
numero = 4 or numero = 11)
using "###,###.##", " ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 1 and (numero = 3 or
numero = 4 or numero = 11)
using "###,###.##", " ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 2 and (numero = 3 or
numero = 4 or numero = 11)
using "###,###.##", " ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 3 and (numero = 3 or
numero = 4 or numero = 11)
using "###,###.##", " ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 4 and (numero = 3 or
numero = 4 or numero = 11)
using "###,###.##", " ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 5 and (numero = 3 or
numero = 4 or numero = 11)
using "###,###.##", " ",
GROUP SUM(x_horas)
WHERE numero = 3 or numero = 4 or numero = 11
using "###,###.##"," "
PRINT COLUMN 1, "HORAS GENERALES"," ";
PRINT COLUMN 47, GROUP SUM(x_horas)
WHERE weekday(x_dia)=6 and (numero=3 or numero = 1 or
numero=2 or numero=4 or numero = 10 or
numero = 11) using "###,###.##"," ",
GROUP SUM(x_horas)
WHERE weekday(x_dia)=0 and (numero = 3 or numero = 1 or
numero = 2 or numero = 4 or numero = 10 or
numero = 11) using "###,###.##",
" ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 1 and (numero=3 or numero = 1 or
numero = 2 or numero = 4 or numero = 10 or
numero = 11) using "###,###.##",
" ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 2 and (numero=3 or numero = 1 or
numero = 2 or numero = 4 or numero = 10 or
numero = 11) using "###,###.##",
" ",
GROUP SUM(x_horas)
WHERE weekday(x_dia)=3 and (numero=3 or numero = 1 or
numero=2 or numero=4 or numero = 10 or
numero = 11) using "###,###.##", " ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 4 and (numero=3 or numero=1 or
numero=2 or numero=4 or numero = 10 or
numero = 11) using "###,###.##", " ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 5 and (numero=3 or numero=1 or
numero=2 or numero=4 or numero = 10 or
numero = 11) using "###,###.##", " ",
GROUP SUM(x_horas)
WHERE numero=3 or numero=1 or numero=2 or numero=4 or
numero = 10 or numero = 11 using "###,###.##"," "
PRINT COLUMN 1, "HORAS DIRECTAS"," ";
PRINT COLUMN 47, GROUP SUM(x_horas)
WHERE weekday(x_dia) = 6 and (numero = 3 or
numero = 1) using "###,###.##", " ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 0 and (numero = 3 or
numero = 1) using "###,###.##", " ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 1 and (numero = 3 or
numero = 1) using "###,###.##", " ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 2 and (numero = 3 or
numero = 1) using "###,###.##", " ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 3 and (numero = 3 or
numero = 1) using "###,###.##", " ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 4 and (numero = 3 or
numero = 1) using "###,###.##", " ",
GROUP SUM(x_horas)
WHERE weekday(x_dia) = 5 and (numero = 3 or
numero = 1) using "###,###.##", " ",
GROUP SUM(x_horas)
WHERE (numero = 3 or numero = 1) using "###,###.##"
END IF
PRINT "==================================================================",
"====================================================================="
ON LAST ROW
LET lunes = SUM(x_horas) WHERE weekday(x_dia) = 1 and numero = 7
LET martes =SUM(x_horas) WHERE weekday(x_dia) = 2 and numero = 7
LET miercoles = SUM(x_horas) WHERE weekday(x_dia) = 3 and numero = 7
LET jueves = SUM(x_horas) WHERE weekday(x_dia) = 4 and numero = 7
LET viernes = SUM(x_horas) WHERE weekday(x_dia) = 5 and numero = 7
LET sabado = SUM(x_horas) WHERE weekday(x_dia) = 6 and numero = 7
LET domingo = SUM(x_horas) WHERE weekday(x_dia) = 0 and numero = 7
CASE
WHEN lunes is null LET lunes = 0 EXIT CASE
WHEN martes is null LET martes = 0 EXIT CASE
WHEN miercoles is null LET miercoles = 0 EXIT CASE
WHEN jueves is null LET jueves = 0 EXIT CASE
WHEN viernes is null LET viernes = 0 EXIT CASE
WHEN sabado is null LET sabado = 0 EXIT CASE
WHEN domingo is null LET domingo = 0 EXIT CASE
END CASE
LET t_prod = lunes + martes + miercoles + jueves + viernes + sabado +
domingo
PRINT "UNIDADES/HORAS DIRECTAS ";
LET hora_sabado = SUM(x_horas)
WHERE weekday(x_dia) = 6 and (numero = 3 or
numero = 1)
LET hora_domingo = SUM(x_horas)
WHERE weekday(x_dia) = 0 and (numero = 3 or
numero = 1)
LET hora_lunes = SUM(x_horas)
WHERE weekday(x_dia) = 1 and (numero = 3 or
numero = 1)
LET hora_martes = SUM(x_horas)
WHERE weekday(x_dia) = 2 and (numero = 3 or
numero = 1)
LET hora_jueves = SUM(x_horas)
WHERE weekday(x_dia) = 4 and (numero = 3 or
numero = 1)
LET hora_viernes = SUM(x_horas)
WHERE weekday(x_dia) = 5 and (numero = 3 or
numero = 1)
LET hora_t_prod = SUM(x_horas)
WHERE numero = 3 or numero = 1
IF hora_sabado = 0 THEN
LET hora_sabado = 1
END IF
IF hora_domingo = 0 THEN
LET hora_domingo = 1
END IF
IF hora_lunes = 0 THEN
LET hora_lunes = 1
END IF
IF hora_martes = 0 THEN
LET hora_martes = 1
END IF
IF hora_miercoles = 0 THEN
LET hora_miercoles = 1
END IF
IF hora_jueves = 0 THEN
LET hora_jueves = 1
END IF
IF hora_viernes = 0 THEN
LET hora_viernes = 1
END IF
IF hora_t_prod = 0 THEN
LET hora_t_prod = 1
END IF
PRINT COLUMN 47,sabado/ hora_sabado using "###,###.##"," ",
domingo/ hora_domingo using "###,###.##", " ",
lunes/hora_lunes using "###,###.##"," ",
martes/hora_martes using "###,###.##"," ",
miercoles/hora_miercoles using "###,###.##"," ",
jueves/hora_jueves using "###,###.##"," ",
viernes/hora_viernes using "###,###.##"," ",
t_prod/hora_t_prod using "###,###.##"," "
display "PASE 2"
LET hora_sabado = SUM(x_horas)
WHERE weekday(x_dia) = 6 and (numero = 3 or
numero =10 or numero =11 or numero = 1) and
x_dpto = "MANTENIMIENTO"
LET hora_domingo = SUM(x_horas)
WHERE weekday(x_dia) = 0 and (numero = 3 or
numero =10 or numero =11 or numero = 1) and
x_dpto = "MANTENIMIENTO"
LET hora_lunes = SUM(x_horas)
WHERE weekday(x_dia) = 1 and (numero = 3 or
numero =10 or numero =11 or numero = 1) and
x_dpto = "MANTENIMIENTO"
LET hora_martes = SUM(x_horas)
WHERE weekday(x_dia) = 2 and (numero = 3 or
numero =10 or numero =11 or numero = 1) and
x_dpto = "MANTENIMIENTO"
LET hora_miercoles = SUM(x_horas)
WHERE weekday(x_dia) = 3 and (numero = 3 or
numero =10 or numero =11 or numero = 1) and
x_dpto = "MANTENIMIENTO"
LET hora_jueves = SUM(x_horas)
WHERE weekday(x_dia) = 4 and (numero = 3 or
numero =10 or numero =11 or numero = 1) and
x_dpto = "MANTENIMIENTO"
LET hora_viernes = SUM(x_horas)
WHERE weekday(x_dia) = 5 and (numero = 3 or
numero =10 or numero =11 or numero = 1) and
x_dpto = "MANTENIMIENTO"
LET hora_t_prod = SUM(x_horas)
WHERE (numero = 3 or numero =10 or numero =11 or
numero = 1) and x_dpto = "MANTENIMIENTO"
IF hora_sabado = 0 THEN
LET hora_sabado = 1
END IF
IF hora_domingo = 0 THEN
LET hora_domingo = 1
END IF
IF hora_lunes = 0 THEN
LET hora_lunes = 1
END IF
IF hora_martes = 0 THEN
LET hora_martes = 1
END IF
IF hora_miercoles = 0 THEN
LET hora_miercoles = 1
END IF
IF hora_jueves = 0 THEN
LET hora_jueves = 1
END IF
IF hora_viernes = 0 THEN
LET hora_viernes = 1
END IF
IF hora_t_prod = 0 THEN
LET hora_t_prod = 1
END IF
PRINT "UNIDADES/HR. MANTENIMIENTO ";
PRINT COLUMN 47, sabado/hora_sabado using "###,###.##"," ",
domingo/hora_domingo using "###,###.##"," ",
lunes/hora_lunes using "###,###.##"," ",
martes/hora_martes using "###,###.##"," ",
miercoles/hora_miercoles using "###,###.##"," ",
jueves/hora_jueves using "###,###.##"," ",
viernes/hora_viernes using "###,###.##"," ",
t_prod/hora_t_prod using "###,###.##"," "
display "PASE 3"
LET hora_sabado = SUM(x_horas)
WHERE weekday(x_dia) = 6 and (numero=3 or numero = 1 or
numero=2 or numero=4 or numero = 10 or
numero = 11)
LET hora_domingo = SUM(x_horas)
WHERE weekday(x_dia) = 0 and (numero=3 or numero = 1 or
numero=2 or numero=4 or numero = 10 or
numero = 11)
LET hora_lunes = SUM(x_horas)
WHERE weekday(x_dia) = 1 and (numero=3 or numero = 1 or
numero=2 or numero=4 or numero = 10 or
numero = 11)
LET hora_martes = SUM(x_horas)
WHERE weekday(x_dia) = 2 and (numero=3 or numero = 1 or
numero=2 or numero=4 or numero = 10 or
numero = 11)
LET hora_miercoles = SUM(x_horas)
WHERE weekday(x_dia) = 3 and (numero=3 or numero = 1 or
numero=2 or numero=4 or numero = 10 or
numero = 11)
LET hora_jueves = SUM(x_horas)
WHERE weekday(x_dia) = 4 and (numero=3 or numero = 1 or
numero=2 or numero=4 or numero = 10 or
numero = 11)
LET hora_viernes = SUM(x_horas)
WHERE weekday(x_dia) = 5 and (numero=3 or numero = 1 or
numero=2 or numero=4 or numero = 10 or
numero = 11)
LET hora_t_prod = SUM(x_horas)
WHERE (numero = 3 or numero = 1 or numero = 2 or
numero = 4 or numero = 10 or
numero = 11)
IF hora_sabado = 0 THEN
LET hora_sabado = 1
END IF
IF hora_domingo = 0 THEN
LET hora_domingo = 1
END IF
IF hora_lunes = 0 THEN
LET hora_lunes = 1
END IF
IF hora_martes = 0 THEN
LET hora_martes = 1
END IF
IF hora_miercoles = 0 THEN
LET hora_miercoles = 1
END IF
IF hora_jueves = 0 THEN
LET hora_jueves = 1
END IF
IF hora_viernes = 0 THEN
LET hora_viernes = 1
END IF
IF hora_t_prod = 0 THEN
LET hora_t_prod = 1
END IF
PRINT "UNIDADES/HORAS GENERALES";
PRINT COLUMN 47, sabado/hora_sabado using "###,###.##"," ",
domingo/hora_domingo using "###,###.##"," ",
lunes/hora_lunes using "###,###.##"," ",
martes/hora_martes using "###,###.##"," ",
miercoles/hora_miercoles using "###,###.##"," ",
jueves/hora_jueves using "###,###.##"," ",
viernes/hora_viernes using "###,###.##"," ",
t_prod/hora_t_prod using "###,###.##"
#---------------------------------------------------------------------------
display "PASE 4"
LET t_planta_l = SUM(x_horas)
WHERE weekday(x_dia) = 1 and
(numero = 3 or numero = 1 or numero = 2 or
numero = 4 or numero = 10 or numero = 11)
LET t_planta_l1 = SUM(x_horas)
WHERE weekday(x_dia) = 1 and
numero = 6
LET t_planta_ma = SUM(x_horas)
WHERE weekday(x_dia) = 2 and
(numero = 3 or numero = 1 or numero = 2 or
numero = 4 or numero = 10 or numero = 11)
LET t_planta_ma1 = SUM(x_horas)
WHERE weekday(x_dia) = 2 and
numero = 6
LET t_planta_m = SUM(x_horas)
WHERE weekday(x_dia) = 3 and
(numero = 3 or numero = 1 or numero = 2 or
numero = 4 or numero = 10 or numero = 11)
LET t_planta_m1 = SUM(x_horas)
WHERE weekday(x_dia) = 3 and
numero = 6
LET t_planta_j = SUM(x_horas)
WHERE weekday(x_dia) = 4 and
(numero = 3 or numero = 1 or numero = 2 or
numero = 4 or numero = 10 or numero = 11)
LET t_planta_j1 = SUM(x_horas)
WHERE weekday(x_dia) = 4 and
numero = 6
LET t_planta_v = SUM(x_horas)
WHERE weekday(x_dia) = 5 and
(numero = 3 or numero = 1 or numero = 2 or
numero = 4 or numero = 10 or numero = 11)
LET t_planta_v1 = SUM(x_horas)
WHERE weekday(x_dia) = 5 and
numero = 6
LET t_planta_s = SUM(x_horas)
WHERE weekday(x_dia) = 6 and
(numero = 3 or numero = 1 or numero = 2 or
numero = 4 or numero = 10 or numero = 11)
LET t_planta_s1 = SUM(x_horas)
WHERE weekday(x_dia) = 6 and
numero = 6
LET t_planta_d = SUM(x_horas)
WHERE weekday(x_dia) = 0 and
(numero = 3 or numero = 1 or numero = 2 or
numero = 4 or numero = 10 or numero = 11)
LET t_planta_d1 = SUM(x_horas)
WHERE weekday(x_dia) = 0 and
numero = 6
#---------------------------------------------------------------------------
LET t_planta = SUM(x_horas)
WHERE (numero = 3 or numero = 1 or numero = 2 or
numero = 4 or numero = 10 or numero = 11)
LET t_planta1 = SUM(x_horas)
WHERE numero = 6
PRINT "UNIDADES/HR. PLANTA ";
PRINT COLUMN 47, sabado/(t_planta_s + t_planta_s1)
using "###,###.##"," ",
domingo/(t_planta_d + t_planta_d1)
using "###,###.##"," ",
lunes/(t_planta_l + t_planta_l1)
using "###,###.###"," ",
martes/(t_planta_ma + t_planta_ma1)
using "###,###.##"," ",
miercoles/(t_planta_m + t_planta_m1)
using "###,###.##"," ",
jueves/(t_planta_j + t_planta_j1) using "###,###.##",
viernes/(t_planta_v + t_planta_v1)
using "###,###.##"," ",
t_prod/(t_planta + t_planta1)
using "###,###.##"
PRINT doce_of
display "PASE 5"
END REPORT