Commit inicial: fuentes MBS ERP (Genero 6) + .gitignore + docs/SETUP_PC_MBS.md
This commit is contained in:
@@ -0,0 +1,626 @@
|
||||
{
|
||||
-------------------------------------------------------------------------------
|
||||
PROGRAMA : EDPRRP080
|
||||
OBJETIVO : Entrada automatica codigo movimientos Inventarios
|
||||
PROGRAMADOR : Ing. Juan Fco. Soto
|
||||
FECHA REALIZACION : Marzo 2020
|
||||
-------------------------------------------------------------------------------
|
||||
}
|
||||
GLOBALS "cgprgb000.4gl"
|
||||
DEFINE nombre_v CHAR(20)
|
||||
DEFINE
|
||||
ventas CHAR(1),
|
||||
r_filename VARCHAR(80),
|
||||
preview BOOLEAN,
|
||||
entrada_d VARCHAR(25),
|
||||
ultimo INT,
|
||||
numero_ent CHAR(2),
|
||||
p_ano CHAR(4),
|
||||
tiempo CHAR(4),
|
||||
xdetalle VARCHAR(100),
|
||||
cod_mov SMALLINT
|
||||
|
||||
MAIN
|
||||
DEFER INTERRUPT
|
||||
CALL ARG_VAL(1) RETURNING usuarios
|
||||
CALL ARG_VAL(2) RETURNING clave
|
||||
CALL ARG_VAL(3) RETURNING impresor
|
||||
|
||||
CONNECT TO "smarmotech" USER usuarios USING clave
|
||||
SELECT * INTO p_compania.* FROM companias
|
||||
CALL ipprrp004()
|
||||
END MAIN
|
||||
|
||||
FUNCTION ipprrp004()
|
||||
|
||||
DEFINE select_ac STRING
|
||||
DEFINE ano_act CHAR(4)
|
||||
|
||||
DEFINE acumulado_ac RECORD
|
||||
cod_mov SMALLINT,
|
||||
cod_n SMALLINT,
|
||||
cod_grupo SMALLINT,
|
||||
cod_Tipo SMALLINT,
|
||||
cod_Sec SMALLINT,
|
||||
consumo DECIMAL(30, 5),
|
||||
descripcion VARCHAR(180),
|
||||
material, labor, gasto DEC(30, 5),
|
||||
cod_cia SMALLINT,
|
||||
descrip_cia VARCHAR(60),
|
||||
cuenta_origen, cuenta_1, cuenta_2, cuenta_3, cuenta_imp_material
|
||||
VARCHAR(14),
|
||||
departamento INT,
|
||||
descripcion_depto VARCHAR(80),
|
||||
descripcion_mov VARCHAR(80),
|
||||
descripcion_bodega VARCHAR(30)
|
||||
END RECORD
|
||||
|
||||
DEFINE
|
||||
acumulado RECORD
|
||||
cod_cia LIKE iptb00002.cod_cia,
|
||||
cod_n LIKE iptb00002.cod_n,
|
||||
cod_grupo LIKE iptb00002.cod_grupo,
|
||||
cod_tipo LIKE iptb00002.cod_tipo,
|
||||
cod_sec LIKE iptb00002.cod_sec,
|
||||
descrip_esp CHAR(100),
|
||||
descrip_ing LIKE iptb00002.descrip_ing,
|
||||
unidad_med LIKE iptb00002.unidad_med,
|
||||
cod_mov LIKE iptb00006.cod_mov,
|
||||
descrip_mov LIKE iptb00005.descrip_mov,
|
||||
consumo DECIMAL(30, 5),
|
||||
material DECIMAL(30, 3),
|
||||
labor DECIMAL(30, 3),
|
||||
gastos DECIMAL(30, 3),
|
||||
descripcion_bodega VARCHAR(30),
|
||||
descripcion_origen VARCHAR(30),
|
||||
cuenta_material VARCHAR(14),
|
||||
cuenta_labor VARCHAR(14),
|
||||
cuenta_gasto VARCHAR(14),
|
||||
cuenta_imp_material VARCHAR(14),
|
||||
cuenta_origen VARCHAR(14),
|
||||
detalle VARCHAR(80),
|
||||
entrada_d VARCHAR(25),
|
||||
nombre_Cia VARCHAR(100),
|
||||
departamento INT,
|
||||
descripcion_depto VARCHAR(80),
|
||||
id_orden VARCHAR(25),
|
||||
afecta VARCHAR(2),
|
||||
valor_material, valor_labor, valor_gasto DEC(30, 2),
|
||||
usuario VARCHAR(50)
|
||||
END RECORD,
|
||||
nombre_mes CHAR(25)
|
||||
|
||||
# WHENEVER ERROR CONTINUE
|
||||
|
||||
OPTIONS FORM LINE 8, ERROR LINE 23, COMMENT LINE 21
|
||||
|
||||
OPEN FORM ipfmrp004 FROM "edfmrp080"
|
||||
DISPLAY FORM ipfmrp004
|
||||
|
||||
DISPLAY "edprrp080" AT 4, 3
|
||||
DISPLAY "Entrada Automatica Movimiento 44" AT 6, 18
|
||||
|
||||
INPUT BY NAME cod_mov,
|
||||
fecha_inicial,
|
||||
fecha_final,
|
||||
entrada_d,
|
||||
xdetalle,
|
||||
afecta
|
||||
BEFORE INPUT
|
||||
CALL cmovimientos()
|
||||
AFTER FIELD cod_mov
|
||||
IF cod_mov IS NULL THEN
|
||||
CALL msg(16)
|
||||
NEXT FIELD cod_mov
|
||||
END IF
|
||||
AFTER FIELD fecha_inicial
|
||||
IF fecha_inicial IS NULL THEN
|
||||
LET numero_msg = 16
|
||||
CALL msg(numero_msg)
|
||||
NEXT FIELD fecha_inicial
|
||||
END IF
|
||||
|
||||
AFTER FIELD fecha_final
|
||||
IF fecha_final IS NULL THEN
|
||||
LET numero_msg = 16
|
||||
CALL msg(numero_msg)
|
||||
NEXT FIELD fecha_final
|
||||
END IF
|
||||
LET numero_ent = 25
|
||||
LET ano_act = YEAR(fecha_final)
|
||||
LET acumulado.descrip_mov =
|
||||
ui.ComboBox.forName("iptb00006.cod_mov").getTextOf(cod_mov)
|
||||
IF fecha_final > TODAY THEN
|
||||
CALL msg(57)
|
||||
NEXT FIELD fecha_final
|
||||
END IF
|
||||
IF fecha_inicial > fecha_final THEN
|
||||
CALL msg(57)
|
||||
NEXT FIELD fecha_inicial
|
||||
END IF
|
||||
CALL prd(fecha_final, usuarios) RETURNING bandera
|
||||
IF bandera = 1 THEN
|
||||
LET bandera = 0
|
||||
NEXT FIELD fecha_final
|
||||
END IF
|
||||
|
||||
CALL controlNumericoED(
|
||||
numero_ent, fecha_final, NULL)
|
||||
RETURNING entrada_d
|
||||
|
||||
DISPLAY BY NAME entrada_d
|
||||
|
||||
SELECT a.descrip
|
||||
INTO nombre_mes
|
||||
FROM mestable a
|
||||
WHERE a.mes = MONTH(fecha_final)
|
||||
|
||||
LET xdetalle =
|
||||
'PARA REGISTRAR MOV ',
|
||||
acumulado.descrip_mov CLIPPED,
|
||||
' DEL MES DE ',
|
||||
nombre_mes CLIPPED,
|
||||
' DEL ',
|
||||
YEAR(fecha_final)
|
||||
LET numero_ent = "25"
|
||||
LET p_ano = YEAR(fecha_inicial)
|
||||
|
||||
AFTER INPUT
|
||||
IF int_flag THEN
|
||||
CALL msg(2)
|
||||
LET int_flag = FALSE
|
||||
RETURN
|
||||
END IF
|
||||
IF fecha_final > TODAY THEN
|
||||
CALL msg(57)
|
||||
NEXT FIELD fecha_final
|
||||
END IF
|
||||
IF fecha_inicial > fecha_final THEN
|
||||
CALL msg(57)
|
||||
NEXT FIELD fecha_inicial
|
||||
END IF
|
||||
|
||||
CALL controlNumericoED(
|
||||
numero_ent, fecha_final, NULL)
|
||||
RETURNING entrada_d
|
||||
|
||||
DISPLAY BY NAME entrada_d
|
||||
|
||||
IF afecta = "SI" THEN
|
||||
CALL prd(fecha_final, usuarios) RETURNING bandera
|
||||
IF bandera = 1 THEN
|
||||
LET bandera = 0
|
||||
NEXT FIELD fecha_inicial
|
||||
END IF
|
||||
|
||||
END IF
|
||||
|
||||
END INPUT
|
||||
# ORIGINALMENTE TENIA EN EL QUERY LA COLUMNA f.cuenta_costo, pero con un analisis debio cambiar a
|
||||
# k.cuenta_imp_costo
|
||||
LET select_ac =
|
||||
"SELECT c.cod_mov,c.cod_n,c.cod_grupo,c.cod_tipo,c.cod_sec, ",
|
||||
" SUM(c.cantidad_2),e.descrip_esp,AVG(d.material),AVG(d.labor),AVG(d.gastos), ",
|
||||
" e.cod_cia,f.descripcion,f.cuenta_no,k.cuenta_1,k.cuenta_2,k.cuenta_3,k.cuenta_imp_material, ",
|
||||
" ISNULL(c.departamento,0),ISNULL(x.nom_dpto,'SIN DEPARTAMENTO'),k.descrip_mov ",
|
||||
"FROM iptb00006 c LEFT OUTER JOIN adtb00001 x ON c.departamento = x.departamento LEFT OUTER JOIN iptb00004 d ON c.cod_n = d.cod_n AND c.cod_grupo = d.cod_grupo AND ",
|
||||
" c.cod_tipo = d.cod_tipo AND c.cod_sec = d.cod_sec and d.ano = ? and d.mes_fin = 12 ",
|
||||
",iptb00002 e,iptb00022 f,iptb00005 k ",
|
||||
"WHERE c.fecha between ? and ? ",
|
||||
" AND c.cod_n = e.cod_n and c.cod_grupo =e.cod_grupo AND c.cod_tipo = e.cod_tipo AND ",
|
||||
" c.cod_sec = e.cod_sec ",
|
||||
" AND e.cod_cia = f.cod_cia and c.cod_mov = k.cod_mov ",
|
||||
" AND c.status_t is NULL and c.cod_mov = ",
|
||||
cod_mov, #" c.cod_mov = 44 ",
|
||||
# " AND c.departamento = 2407 ",
|
||||
"GROUP BY c.cod_mov,c.cod_n,c.cod_grupo,c.cod_tipo,c.cod_sec,e.descrip_esp,e.cod_cia,f.descripcion,c.departamento,x.nom_dpto, ",
|
||||
" k.cuenta_1,k.cuenta_2,k.cuenta_3,k.cuenta_imp_material,f.cuenta_no,k.descrip_mov ",
|
||||
"HAVING SUM(c.cantidad_2) <> 0 ",
|
||||
"ORDER BY e.cod_cia,c.departamento,c.cod_n "
|
||||
|
||||
DISPLAY "<< Estoy Buscando Acumulado Del Periodo Dado >>"
|
||||
AT 19, 14
|
||||
ATTRIBUTE(REVERSE, BOLD)
|
||||
|
||||
IF int_flag THEN
|
||||
LET numero_msg = 2
|
||||
CALL msg(numero_msg)
|
||||
LET int_flag = FALSE
|
||||
RETURN
|
||||
END IF
|
||||
|
||||
PREPARE busca_ant FROM select_ac
|
||||
DECLARE actual CURSOR FOR busca_ant
|
||||
OPEN actual USING ano_act, fecha_inicial, fecha_final
|
||||
|
||||
LET idx = 1
|
||||
LET acumulado.nombre_Cia = p_compania.nombre
|
||||
|
||||
CALL controlNumericoED(
|
||||
numero_ent, fecha_final, usuarios)
|
||||
RETURNING entrada_d
|
||||
DISPLAY "entrada real: ", entrada_d
|
||||
|
||||
DISPLAY BY NAME entrada_d
|
||||
|
||||
FOREACH actual INTO acumulado_ac.*
|
||||
|
||||
IF int_flag THEN
|
||||
LET numero_msg = 2
|
||||
CALL msg(numero_msg)
|
||||
LET int_flag = FALSE
|
||||
RETURN
|
||||
END IF
|
||||
IF idx = 1 THEN
|
||||
CALL seleccionarsalida() RETURNING r_output
|
||||
# CALL configureoutput(r_output) RETURNING handler
|
||||
LET r_filename = "edprrp080m.4rp"
|
||||
LET preview = 1
|
||||
|
||||
IF fgl_report_loadCurrentSettings(
|
||||
r_filename) THEN -- load the .4rp file
|
||||
|
||||
CALL fgl_report_selectDevice(r_output) -- changing default
|
||||
CALL fgl_report_selectPreview(preview) -- changing default
|
||||
LET handler =
|
||||
fgl_report_commitCurrentSettings() -- commit changes
|
||||
START REPORT opera TO XML HANDLER HANDLER
|
||||
END IF
|
||||
END IF
|
||||
LET idx = idx + 1
|
||||
LET acumulado.consumo = acumulado_ac.consumo
|
||||
LET acumulado.cod_mov = acumulado_ac.cod_mov
|
||||
|
||||
# Buscando Los Costos de Los Materiales
|
||||
LET acumulado.descrip_esp = NULL
|
||||
LET acumulado.unidad_med = NULL
|
||||
LET acumulado.cod_cia = NULL
|
||||
LET acumulado.descripcion_origen = NULL
|
||||
LET acumulado.detalle = NULL
|
||||
LET acumulado.descrip_mov = NULL
|
||||
|
||||
LET acumulado.material = 0
|
||||
LET acumulado.labor = 0
|
||||
LET acumulado.gastos = 0
|
||||
|
||||
LET acumulado.descripcion_origen = acumulado_ac.descrip_cia
|
||||
LET acumulado.cod_cia = acumulado_ac.cod_cia
|
||||
LET acumulado.descrip_esp = acumulado_ac.descripcion
|
||||
LET acumulado.material = acumulado_ac.material
|
||||
LET acumulado.labor = acumulado_ac.labor
|
||||
LET acumulado.gastos = acumulado_ac.gasto
|
||||
LET acumulado.valor_material =
|
||||
acumulado_ac.material * acumulado_ac.consumo
|
||||
LET acumulado.valor_labor = acumulado_ac.labor * acumulado_ac.consumo
|
||||
LET acumulado.valor_gasto = acumulado_ac.gasto * acumulado_ac.consumo
|
||||
LET acumulado.descrip_mov = acumulado_ac.descripcion_mov
|
||||
|
||||
LET acumulado.cuenta_origen = acumulado_ac.cuenta_origen
|
||||
LET acumulado.usuario = usuarios
|
||||
|
||||
LET acumulado.departamento = acumulado_ac.departamento
|
||||
LET acumulado.descripcion_depto = acumulado_ac.descripcion_depto
|
||||
|
||||
LET acumulado.cuenta_material = acumulado_ac.cuenta_1
|
||||
LET acumulado.cuenta_labor = acumulado_ac.cuenta_2
|
||||
LET acumulado.cuenta_gasto = acumulado_ac.cuenta_3
|
||||
# LET acumulado.cuenta_imp_material = acumulado_ac.cuenta_imp_material
|
||||
LET acumulado.entrada_d = entrada_d
|
||||
IF acumulado.cod_cia = 3 OR acumulado.cod_cia = 2 THEN
|
||||
LET acumulado.cuenta_material = acumulado_ac.cuenta_imp_material
|
||||
LET acumulado.cuenta_imp_material = NULL
|
||||
END IF
|
||||
LET acumulado.cod_n = acumulado_ac.cod_n
|
||||
LET acumulado.cod_grupo = acumulado_ac.cod_grupo
|
||||
LET acumulado.cod_tipo = acumulado_ac.cod_tipo
|
||||
LET acumulado.cod_sec = acumulado_ac.cod_sec
|
||||
LET acumulado.detalle = xdetalle
|
||||
|
||||
IF int_flag THEN
|
||||
LET numero_msg = 2
|
||||
CALL msg(numero_msg)
|
||||
LET int_flag = FALSE
|
||||
RETURN
|
||||
END IF
|
||||
OUTPUT TO REPORT opera(acumulado.*)
|
||||
|
||||
END FOREACH
|
||||
IF idx > 1 THEN
|
||||
FINISH REPORT opera
|
||||
ELSE
|
||||
CALL fgl_winmessage(
|
||||
"INFO", "NO EXISTEN INFORMACIONES CON ESTA CONDICION", "INFO")
|
||||
RETURN
|
||||
END IF
|
||||
PREPARE busca_ant1 FROM select_ac
|
||||
DECLARE actual1 CURSOR FOR busca_ant1
|
||||
OPEN actual1 USING ano_act, fecha_inicial, fecha_final
|
||||
LET idx = 1
|
||||
|
||||
FOREACH actual1 INTO acumulado_ac.*
|
||||
|
||||
IF idx = 1 THEN
|
||||
BEGIN WORK
|
||||
LET r_filename = "edprrp080.4rp"
|
||||
#LET r_output = "SVG"
|
||||
LET preview = 1
|
||||
|
||||
IF fgl_report_loadCurrentSettings(
|
||||
r_filename) THEN -- load the .4rp file
|
||||
|
||||
CALL fgl_report_selectDevice(r_output) -- changing default
|
||||
CALL fgl_report_selectPreview(preview) -- changing default
|
||||
LET handler =
|
||||
fgl_report_commitCurrentSettings() -- commit changes
|
||||
|
||||
START REPORT entrada TO XML HANDLER HANDLER
|
||||
END IF
|
||||
END IF
|
||||
LET idx = idx + 1
|
||||
LET acumulado.consumo = acumulado_ac.consumo
|
||||
LET acumulado.cod_mov = acumulado_ac.cod_mov
|
||||
|
||||
# Buscando Los Costos de Los Materiales
|
||||
LET acumulado.descrip_esp = NULL
|
||||
LET acumulado.unidad_med = NULL
|
||||
LET acumulado.cod_cia = NULL
|
||||
LET acumulado.descripcion_origen = NULL
|
||||
LET acumulado.detalle = NULL
|
||||
|
||||
LET acumulado.material = 0
|
||||
LET acumulado.labor = 0
|
||||
LET acumulado.gastos = 0
|
||||
|
||||
LET acumulado.descripcion_origen = acumulado_ac.descrip_cia
|
||||
LET acumulado.cod_cia = acumulado_ac.cod_cia
|
||||
LET acumulado.descrip_esp = acumulado_ac.descripcion
|
||||
LET acumulado.material = acumulado_ac.material
|
||||
LET acumulado.labor = acumulado_ac.labor
|
||||
LET acumulado.gastos = acumulado_ac.gasto
|
||||
LET acumulado.id_orden =
|
||||
acumulado_ac.cuenta_origen CLIPPED,
|
||||
'-',
|
||||
acumulado_ac.cuenta_1 CLIPPED,
|
||||
'-',
|
||||
acumulado_ac.departamento USING "&&&&"
|
||||
|
||||
LET acumulado.valor_material =
|
||||
acumulado_ac.material * acumulado_ac.consumo
|
||||
LET acumulado.valor_labor = acumulado_ac.labor * acumulado_ac.consumo
|
||||
LET acumulado.valor_gasto = acumulado_ac.gasto * acumulado_ac.consumo
|
||||
|
||||
LET acumulado.cuenta_origen = acumulado_ac.cuenta_origen
|
||||
|
||||
LET acumulado.departamento = acumulado_ac.departamento
|
||||
|
||||
LET acumulado.cuenta_material = acumulado_ac.cuenta_1
|
||||
LET acumulado.cuenta_labor = acumulado_ac.cuenta_2
|
||||
LET acumulado.cuenta_gasto = acumulado_ac.cuenta_3
|
||||
LET acumulado.cuenta_imp_material = acumulado_ac.cuenta_imp_material
|
||||
|
||||
LET acumulado.entrada_d = entrada_d
|
||||
IF acumulado.cod_cia = 3 THEN
|
||||
LET acumulado.cuenta_material = acumulado.cuenta_imp_material
|
||||
|
||||
END IF
|
||||
LET acumulado.cod_n = acumulado_ac.cod_n
|
||||
LET acumulado.cod_grupo = acumulado_ac.cod_grupo
|
||||
LET acumulado.cod_tipo = acumulado_ac.cod_tipo
|
||||
LET acumulado.cod_sec = acumulado_ac.cod_sec
|
||||
LET acumulado.detalle = xdetalle
|
||||
LET acumulado.afecta = afecta
|
||||
|
||||
OUTPUT TO REPORT entrada(acumulado.*, usuarios)
|
||||
|
||||
END FOREACH
|
||||
IF idx > 1 THEN
|
||||
FINISH REPORT entrada
|
||||
|
||||
IF NOT verificaCuadre(entrada_d) THEN
|
||||
CALL fgl_winmessage(
|
||||
"Info", "Entrada descuadrada, no actualice entrada", "Info")
|
||||
ROLLBACK WORK
|
||||
ELSE
|
||||
COMMIT WORK
|
||||
END IF
|
||||
END IF
|
||||
|
||||
END FUNCTION
|
||||
|
||||
REPORT opera(x)
|
||||
DEFINE
|
||||
x RECORD
|
||||
cod_cia LIKE iptb00002.cod_cia,
|
||||
cod_n LIKE iptb00002.cod_n,
|
||||
cod_grupo LIKE iptb00002.cod_grupo,
|
||||
cod_tipo LIKE iptb00002.cod_tipo,
|
||||
cod_sec LIKE iptb00002.cod_sec,
|
||||
descrip_esp CHAR(100),
|
||||
descrip_ing LIKE iptb00002.descrip_ing,
|
||||
unidad_med LIKE iptb00002.unidad_med,
|
||||
cod_mov LIKE iptb00006.cod_mov,
|
||||
descrip_mov LIKE iptb00005.descrip_mov,
|
||||
consumo DECIMAL(30, 5),
|
||||
material DECIMAL(30, 3),
|
||||
labor DECIMAL(30, 3),
|
||||
gastos DECIMAL(30, 3),
|
||||
descripcion_bodega VARCHAR(30),
|
||||
descripcion_origen VARCHAR(30),
|
||||
cuenta_material VARCHAR(14),
|
||||
cuenta_labor VARCHAR(14),
|
||||
cuenta_gasto VARCHAR(14),
|
||||
cuenta_imp_material VARCHAR(14),
|
||||
cuenta_origen VARCHAR(14),
|
||||
detalle VARCHAR(80),
|
||||
entrada_d VARCHAR(25),
|
||||
nombre_Cia VARCHAR(100),
|
||||
departamento INT,
|
||||
descripcion_depto VARCHAR(80),
|
||||
id_orden VARCHAR(25),
|
||||
afecta VARCHAR(2),
|
||||
valor_material, valor_labor, valor_gasto DEC(30, 2),
|
||||
usuario VARCHAR(50)
|
||||
END RECORD,
|
||||
producto VARCHAR(200)
|
||||
|
||||
DEFINE hora CHAR(25)
|
||||
|
||||
DEFINE
|
||||
total_costo_st,
|
||||
total_material,
|
||||
total_labor,
|
||||
total_gasto,
|
||||
total_costo,
|
||||
total_cantidad,
|
||||
tt_total_costo_st,
|
||||
t_total_costo_st,
|
||||
t_cantidad,
|
||||
tt_cantidad,
|
||||
ttt_cantidad,
|
||||
tt_valor_material,
|
||||
tt_valor_labor,
|
||||
tt_valor_gasto,
|
||||
ttt_valor_material,
|
||||
ttt_valor_labor,
|
||||
ttt_valor_gasto,
|
||||
tttt_valor_material,
|
||||
tttt_valor_labor,
|
||||
tttt_valor_gasto
|
||||
DECIMAL(30, 2),
|
||||
descrip_nivel CHAR(15)
|
||||
|
||||
ORDER BY x.cod_cia, x.departamento, x.cod_n
|
||||
|
||||
FORMAT
|
||||
|
||||
FIRST PAGE HEADER
|
||||
LET hora = TODAY, TIME
|
||||
LET total_material = 0
|
||||
LET total_labor = 0
|
||||
|
||||
BEFORE GROUP OF x.cod_cia
|
||||
LET x.descripcion_origen =
|
||||
x.cuenta_imp_material CLIPPED, " ", x.descripcion_origen
|
||||
PRINTX x.descripcion_origen, x.cuenta_origen
|
||||
LET tt_valor_material = 0
|
||||
LET tt_valor_labor = 0
|
||||
LET tt_valor_gasto = 0
|
||||
LET t_cantidad = 0
|
||||
|
||||
BEFORE GROUP OF x.departamento
|
||||
PRINTX x.departamento, x.descripcion_depto
|
||||
LET ttt_valor_material = 0
|
||||
LET ttt_valor_labor = 0
|
||||
LET ttt_valor_gasto = 0
|
||||
LET tt_cantidad = 0
|
||||
BEFORE GROUP OF x.cod_n
|
||||
|
||||
LET tttt_valor_material = 0
|
||||
LET tttt_valor_labor = 0
|
||||
LET tttt_valor_gasto = 0
|
||||
LET ttt_cantidad = 0
|
||||
|
||||
ON EVERY ROW
|
||||
LET t_cantidad = t_cantidad + x.consumo
|
||||
LET total_costo_st = 0
|
||||
LET total_costo_st = (x.material + x.labor + x.gastos) * x.consumo
|
||||
|
||||
LET t_total_costo_st = t_total_costo_st + total_costo_st
|
||||
LET producto =
|
||||
x.cod_n USING "&&&&",
|
||||
"-",
|
||||
x.cod_grupo USING "&&&&",
|
||||
"-",
|
||||
x.cod_tipo USING "&&&&",
|
||||
"-",
|
||||
x.cod_sec USING "&&&&&&",
|
||||
" ",
|
||||
x.descrip_esp
|
||||
|
||||
PRINTX codigo,
|
||||
x.consumo,
|
||||
x.material,
|
||||
x.valor_material,
|
||||
x.labor,
|
||||
x.valor_labor,
|
||||
x.gastos,
|
||||
x.valor_gasto,
|
||||
total_costo_st,
|
||||
producto,
|
||||
p_compania.nombre,
|
||||
hora,
|
||||
fecha_inicial,
|
||||
fecha_final,
|
||||
x.descrip_mov
|
||||
|
||||
LET tt_cantidad = tt_cantidad + x.consumo
|
||||
|
||||
LET ttt_valor_material = ttt_valor_material + x.valor_material
|
||||
LET ttt_valor_labor = ttt_valor_labor + x.valor_labor
|
||||
LET ttt_valor_gasto = ttt_valor_gasto + x.valor_gasto
|
||||
|
||||
AFTER GROUP OF x.cod_n
|
||||
LET descrip_nivel = NULL
|
||||
SELECT a.producto
|
||||
INTO descrip_nivel
|
||||
FROM iptb00020 a
|
||||
WHERE a.cod_n = x.cod_n
|
||||
|
||||
LET ttt_cantidad = GROUP SUM(x.consumo)
|
||||
LET tttt_valor_material = GROUP SUM(x.valor_material)
|
||||
LET tttt_valor_labor = GROUP SUM(x.valor_labor)
|
||||
LET tttt_valor_gasto = GROUP SUM(x.valor_gasto)
|
||||
|
||||
PRINTX descrip_nivel,
|
||||
ttt_cantidad,
|
||||
tttt_valor_material,
|
||||
tttt_valor_labor,
|
||||
tttt_valor_gasto,
|
||||
t_total_costo_st
|
||||
|
||||
LET tt_total_costo_st = t_total_costo_st + tt_total_costo_st
|
||||
AFTER GROUP OF x.departamento
|
||||
|
||||
LET tt_cantidad = GROUP SUM(x.consumo)
|
||||
LET ttt_valor_material = GROUP SUM(x.valor_material)
|
||||
LET ttt_valor_labor = GROUP SUM(x.valor_labor)
|
||||
LET ttt_valor_gasto = GROUP SUM(x.valor_gasto)
|
||||
LET t_total_costo_st =
|
||||
ttt_valor_material + ttt_valor_labor + ttt_valor_gasto
|
||||
PRINTX x.departamento,
|
||||
x.descripcion_depto,
|
||||
tt_cantidad,
|
||||
ttt_valor_material,
|
||||
ttt_valor_labor,
|
||||
ttt_valor_gasto,
|
||||
t_total_costo_st
|
||||
|
||||
AFTER GROUP OF x.cod_cia
|
||||
|
||||
LET t_cantidad = GROUP SUM(x.consumo)
|
||||
LET tt_valor_material = GROUP SUM(x.valor_material)
|
||||
LET tt_valor_labor = GROUP SUM(x.valor_labor)
|
||||
LET tt_valor_gasto = GROUP SUM(x.valor_gasto)
|
||||
LET t_total_costo_st =
|
||||
tt_valor_material + tt_valor_labor + tt_valor_gasto
|
||||
|
||||
PRINTX x.descripcion_origen,
|
||||
t_cantidad,
|
||||
tt_valor_material,
|
||||
tt_valor_labor,
|
||||
tt_valor_gasto,
|
||||
t_total_costo_st
|
||||
ON LAST ROW
|
||||
LET total_material = SUM(x.valor_material)
|
||||
LET total_labor = SUM(x.valor_labor)
|
||||
LET total_gasto = SUM(x.valor_gasto)
|
||||
LET total_costo = total_material + total_labor + total_gasto
|
||||
LET total_cantidad = SUM(x.consumo)
|
||||
|
||||
PRINTX total_material,
|
||||
total_labor,
|
||||
total_gasto,
|
||||
total_costo,
|
||||
total_cantidad
|
||||
|
||||
END REPORT
|
||||
Reference in New Issue
Block a user