{ ----------------------------------------------------------------------------- PROGRAMA : CGPRMT003 OBJETIVO : Capturar e imprimir los volantes de caja chica, tanto provisional como definitivo. PROGRAMADOR : Ing. Juan F. Soto FECHA : Septiembre 29, 1993. ----------------------------------------------------------------------------- } GLOBALS "cgprgb000.4gl" DEFINE c_entra RECORD LIKE intb00001.* DEFINE codigo_zap,encontre CHAR(1) DEFINE unidad CHAR(3) DEFINE descripcion,nombre_req,nombre_ctrl,nombre_n CHAR(30) DEFINE p_valor DECIMAL(12,2) DEFINE bien ARRAY[200] OF RECORD cod_n SMALLINT, cod_grupo SMALLINT, cod_tipo SMALLINT, cod_sec SMALLINT, descrip_esp CHAR(30), unidad CHAR(3) END RECORD DEFINE p_volante RECORD fecha DATE, departamento_ctrl SMALLINT, departamento_req SMALLINT, numero INTEGER, tipo CHAR(1), monto DECIMAL(12,2), preparado_por CHAR(20), recibido_por CHAR(20), autorizado_por CHAR(20) END RECORD DEFINE arr_volante ARRAY[3] OF RECORD cod_n SMALLINT, cod_grupo SMALLINT, cod_tipo SMALLINT, cod_sec SMALLINT, descripcion CHAR(30), unidad CHAR(3), valor DECIMAL(12,2) END RECORD DEFINE desc_volante CHAR(15) FUNCTION cgprmt003() OPTIONS FORM LINE 9, PROMPT LINE 22, COMMENT LINE 23, ERROR LINE 24 CALL pantalla() DISPLAY "cgprmt003" AT 4,3 DISPLAY "Volante Caja Chica" AT 6,30 OPEN FORM cgfmmt003 FROM "cgfmmt003" DISPLAY FORM cgfmmt003 MENU "OPCION:" COMMAND "Adicionar" " Adiciona Registro Cancela Operacion" LET int_flag = false CALL cgpcad03() COMMAND "Consultar-Modificar" " Busca informacion Cancela operacion" LET int_flag = false CALL cgpcmod03() COMMAND "Salir" "Retorna al menu Anterior" EXIT MENU END MENU END FUNCTION FUNCTION cgpcad03() INITIALIZE p_volante.* TO NULL LET hoy = today ERROR "WARNING:NO PUEDES AGREGAR MAS DE 3 REQUERIMIENTOS EN UN SOLO VOLANTE" INPUT BY NAME p_volante.* WITHOUT DEFAULTS ATTRIBUTE (BOLD) # Pantallas de consultas departamentales ON KEY (CONTROL-W) IF INFIELD(departamento_ctrl) THEN CALL busca_depto() LET p_volante.departamento_ctrl = ws[curr].departamento LET nombre_ctrl = ws[curr].nombre END IF IF INFIELD(departamento_req) THEN CALL busca_depto() LET p_volante.departamento_req = ws[curr].departamento LET nombre_req = ws[curr].nombre END IF AFTER FIELD preparado_por IF p_volante.preparado_por is null THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD preparado_por END IF AFTER FIELD recibido_por IF p_volante.recibido_por is null THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD recibido_por END IF AFTER FIELD autorizado_por IF p_volante.autorizado_por is null THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD autorizado_por END IF # Desplegue de la fecha en todo momento BEFORE FIELD fecha LET p_volante.fecha = hoy DISPLAY BY NAME p_volante.fecha AFTER FIELD fecha LET hoy = p_volante.fecha AFTER FIELD departamento_ctrl # Controla la numeracion por departamento IF p_volante.departamento_ctrl is not null THEN SELECT @numero INTO p_volante.numero FROM cgtb00008 WHERE @departamento = p_volante.departamento_ctrl IF status = notfound THEN LET numero_msg = 169 CALL msg(numero_msg) NEXT FIELD departamento_ctrl END IF LET p_volante.numero = p_volante.numero + 1 SELECT nom_dpto INTO nombre_ctrl FROM adtb00001 WHERE departamento = p_volante.departamento_ctrl and status_t is null IF status = notfound THEN LET numero_msg = 3 CALL msg(numero_msg) NEXT FIELD departamento_ctrl END IF DISPLAY BY NAME p_volante.numero,nombre_ctrl END IF AFTER FIELD departamento_req SELECT nom_dpto INTO nombre_req FROM adtb00001 WHERE departamento = p_volante.departamento_req and status_t is null IF status = notfound THEN LET numero_msg = 3 CALL msg(numero_msg) NEXT FIELD departamento_req END IF DISPLAY BY NAME nombre_req AFTER FIELD tipo CASE WHEN p_volante.tipo = "P" LET desc_volante = "PROVISIONAL" WHEN p_volante.tipo = "D" LET desc_volante = "DEFINITIVO" WHEN p_volante.tipo = "R" LET desc_volante = "REPOSICION" END CASE DISPLAY BY NAME desc_volante AFTER INPUT IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = false RETURN END IF EXIT INPUT END INPUT # Captura del detalle del volante INPUT ARRAY arr_volante FROM s_volante.* ON KEY (CONTROL-B) LET curr = arr_curr() LET scr_l = scr_line() CALL busca_bienes() LET arr_volante[curr].cod_n = bien[curr1].cod_n LET arr_volante[curr].cod_grupo = bien[curr1].cod_grupo LET arr_volante[curr].cod_tipo = bien[curr1].cod_tipo LET arr_volante[curr].cod_sec = bien[curr1].cod_sec DISPLAY arr_volante[curr].cod_n to s_volante[scr_l].cod_n DISPLAY arr_volante[curr].cod_grupo to s_volante[scr_l].cod_grupo DISPLAY arr_volante[curr].cod_tipo to s_volante[scr_l].cod_tipo DISPLAY arr_volante[curr].cod_sec to s_volante[scr_l].cod_sec LET descripcion = bien[curr1].descrip_esp LET unidad = bien[curr1].unidad AFTER FIELD cod_n LET curr = arr_curr() LET scr_l = scr_line() IF arr_volante[curr].cod_n is not null THEN LET verdad = "N" CALL repite() IF verdad = "S" THEN LET verdad = "N" NEXT FIELD cod_grupo END IF END IF AFTER FIELD cod_grupo IF arr_volante[curr].cod_grupo is not null THEN LET verdad = "N" CALL repite() IF verdad = "S" THEN LET verdad = "N" NEXT FIELD cod_tipo END IF END IF AFTER FIELD cod_tipo IF arr_volante[curr].cod_tipo is not null THEN LET verdad = "N" CALL repite() IF verdad = "S" THEN LET verdad = "N" NEXT FIELD cod_sec END IF END IF AFTER FIELD cod_sec LET codigo_zap = "N" IF arr_volante[curr].cod_n = 9 and arr_volante[curr].cod_grupo = 9 and arr_volante[curr].cod_tipo = 99 and arr_volante[curr].cod_sec = 999 THEN LET codigo_zap = "S" END IF IF arr_volante[curr].cod_sec is not null THEN IF arr_volante[curr].cod_n is null or arr_volante[curr].cod_grupo is null or arr_volante[curr].cod_tipo is null THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD cod_n END IF SELECT descrip_esp,unidad_med INTO descripcion,unidad FROM intb00001 WHERE cod_n = arr_volante[curr].cod_n and cod_grupo = arr_volante[curr].cod_grupo and cod_tipo = arr_volante[curr].cod_tipo and cod_sec = arr_volante[curr].cod_sec and status_t is null IF status = notfound THEN LET numero_msg = 3 CALL msg(numero_msg) CALL busca_bienes() LET arr_volante[curr].cod_n = bien[curr1].cod_n LET arr_volante[curr].cod_grupo = bien[curr1].cod_grupo LET arr_volante[curr].cod_tipo = bien[curr1].cod_tipo LET arr_volante[curr].cod_sec = bien[curr1].cod_sec DISPLAY arr_volante[curr].cod_n to s_volante[scr_l].cod_n DISPLAY arr_volante[curr].cod_grupo to s_volante[scr_l].cod_grupo DISPLAY arr_volante[curr].cod_tipo to s_volante[scr_l].cod_tipo DISPLAY arr_volante[curr].cod_sec to s_volante[scr_l].cod_sec LET descripcion = bien[curr1].descrip_esp LET unidad = bien[curr1].unidad END IF LET arr_volante[curr].descripcion = descripcion LET arr_volante[curr].unidad = unidad DISPLAY arr_volante[curr].descripcion to s_volante[scr_l].descripcion DISPLAY arr_volante[curr].unidad to s_volante[scr_l].unidad END IF BEFORE FIELD descripcion IF codigo_zap = "N" THEN NEXT FIELD valor END IF AFTER FIELD descripcion IF codigo_zap = "S" THEN IF arr_volante[curr].descripcion is null THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD descripcion END IF END IF AFTER FIELD valor IF arr_volante[curr].cod_sec is not null THEN IF arr_volante[curr].valor is null THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD valor END IF END IF # Chequea que el valor de los items no exceda el valor del volante LET p_valor = 0 FOR idx = 1 TO arr_count() LET p_valor = arr_volante[idx].valor + p_valor END FOR IF p_valor > p_volante.monto THEN LET numero_msg = 168 CALL msg(numero_msg) NEXT FIELD cod_n END IF AFTER INPUT IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = false RETURN END IF IF arr_volante[curr].cod_sec is not null THEN IF arr_volante[curr].valor is null THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD valor END IF END IF EXIT INPUT END INPUT START REPORT volante TO "C:\\archivo" # Actualiza el ultimo numero del volante UPDATE cgtb00008 set numero = p_volante.numero WHERE departamento = p_volante.departamento_ctrl # Actualizacion de la tabla volantes de pago FOR idx = 1 TO arr_count() IF arr_volante[idx].cod_n is not null and arr_volante[idx].cod_grupo is not null and arr_volante[idx].cod_tipo is not null and arr_volante[idx].cod_sec is not null THEN # Inserta los datos a la tabla que controla los datos de caja chica # e imprime volante de caja chica INSERT INTO cgtb00007 VALUES (p_volante.fecha,p_volante.numero,arr_volante[idx].cod_n, arr_volante[idx].cod_grupo,arr_volante[idx].cod_tipo, arr_volante[idx].cod_sec,arr_volante[idx].descripcion, arr_volante[idx].unidad,p_volante.monto,arr_volante[idx].valor, null, p_volante.departamento_ctrl,p_volante.departamento_req, p_volante.preparado_por,p_volante.recibido_por, p_volante.autorizado_por,p_volante.tipo,null,user,current,null, null) OUTPUT TO REPORT volante(p_volante.*,arr_volante[idx].*) END IF END FOR CALL integridad() IF bandera = 1 THEN LET bandera = 0 RETURN END IF LET numero_msg = 1 CALL msg(numero_msg) DISPLAY " " AT 1,50 FINISH REPORT volante RUN "TYPE C:\\ARCHIVO > %USPRINT%" END FUNCTION FUNCTION cgpcmod03() # Captura de informacion para busqueda del documento ERROR "WARNING:NO PUEDES AGREGAR MAS DE 3 REQUERIMIENTOS EN UN SOLO VOLANTE" CONSTRUCT BY NAME criterio ON cgtb00007.numero,cgtb00007.departamento_ctrl, cgtb00007.departamento_req LET selec = "SELECT fecha,departamento_ctrl,departamento_req,numero,status_volante, ", " monto,preparado_por,recibido_por,autorizado_por,status_volante, ", " monto ", "FROM cgtb00007 WHERE ",criterio clipped," ORDER BY numero" PREPARE comando FROM selec DECLARE busca SCROLL CURSOR FOR comando OPEN busca FETCH FIRST busca INTO p_volante.* IF status = notfound THEN RETURN END IF # Busqueda del nombre del departamento que posee el control de los volantes # de caja chica SELECT nom_dpto INTO nombre_ctrl FROM adtb00001 WHERE departamento = p_volante.departamento_ctrl and status_t is null # Busqueda del nombre del departamento que requiere el volante SELECT nom_dpto INTO nombre_req FROM adtb00001 WHERE departamento = p_volante.departamento_req and status_t is null DISPLAY BY NAME nombre_ctrl,nombre_req CASE WHEN p_volante.tipo = "P" LET desc_volante = "PROVISIONAL" WHEN p_volante.tipo = "D" LET desc_volante = "DEFINITIVO" WHEN p_volante.tipo = "R" LET desc_volante = "REPOSICION" END CASE DISPLAY BY NAME p_volante.*,desc_volante MENU "OPCION" COMMAND "Siguiente" FETCH NEXT busca INTO p_volante.* IF status = notfound THEN LET numero_msg = 4 CALL msg(numero_msg) END IF SELECT nom_dpto INTO nombre_ctrl FROM adtb00001 WHERE departamento = p_volante.departamento_ctrl and status_t is null # Busqueda del nombre del departamento que requiere el volante SELECT nom_dpto INTO nombre_req FROM adtb00001 WHERE departamento = p_volante.departamento_req and status_t is null DISPLAY BY NAME nombre_ctrl,nombre_req CASE WHEN p_volante.tipo = "P" LET desc_volante = "PROVISIONAL" WHEN p_volante.tipo = "D" LET desc_volante = "DEFINITIVO" WHEN p_volante.tipo = "R" LET desc_volante = "REPOSICION" END CASE DISPLAY BY NAME p_volante.*,desc_volante COMMAND "Anterior" FETCH PREVIOUS busca INTO p_volante.* IF status = notfound THEN LET numero_msg = 5 CALL msg(numero_msg) END IF SELECT nom_dpto INTO nombre_ctrl FROM adtb00001 WHERE departamento = p_volante.departamento_ctrl and status_t is null # Busqueda del nombre del departamento que requiere el volante SELECT nom_dpto INTO nombre_req FROM adtb00001 WHERE departamento = p_volante.departamento_req and status_t is null DISPLAY BY NAME nombre_ctrl,nombre_req CASE WHEN p_volante.tipo = "P" LET desc_volante = "PROVISIONAL" WHEN p_volante.tipo = "D" LET desc_volante = "DEFINITIVO" WHEN p_volante.tipo = "R" LET desc_volante = "REPOSICION" END CASE DISPLAY BY NAME p_volante.*,desc_volante COMMAND "Primero" FETCH FIRST busca INTO p_volante.* LET numero_msg = 4 CALL msg(numero_msg) SELECT nom_dpto INTO nombre_ctrl FROM adtb00001 WHERE departamento = p_volante.departamento_ctrl and status_t is null # Busqueda del nombre del departamento que requiere el volante SELECT nom_dpto INTO nombre_req FROM adtb00001 WHERE departamento = p_volante.departamento_req and status_t is null DISPLAY BY NAME nombre_ctrl,nombre_req CASE WHEN p_volante.tipo = "P" LET desc_volante = "PROVISIONAL" WHEN p_volante.tipo = "D" LET desc_volante = "DEFINITIVO" WHEN p_volante.tipo = "R" LET desc_volante = "REPOSICION" END CASE DISPLAY BY NAME p_volante.*,desc_volante COMMAND "Ultimo" FETCH LAST busca INTO p_volante.* LET numero_msg = 5 CALL msg(numero_msg) SELECT nom_dpto INTO nombre_ctrl FROM adtb00001 WHERE departamento = p_volante.departamento_ctrl and status_t is null # Busqueda del nombre del departamento que requiere el volante SELECT nom_dpto INTO nombre_req FROM adtb00001 WHERE departamento = p_volante.departamento_req and status_t is null DISPLAY BY NAME nombre_ctrl,nombre_req CASE WHEN p_volante.tipo = "P" LET desc_volante = "PROVISIONAL" WHEN p_volante.tipo = "D" LET desc_volante = "DEFINITIVO" WHEN p_volante.tipo = "R" LET desc_volante = "REPOSICION" END CASE DISPLAY BY NAME p_volante.*,desc_volante COMMAND "Escoger" INPUT BY NAME p_volante.preparado_por THRU p_volante.autorizado_por WITHOUT DEFAULTS # Busca el detalle del volante de caja chica DECLARE busca1 CURSOR FOR SELECT b.cod_n,b.cod_grupo,b.cod_tipo,b.cod_sec,b.descripcion,b.unidad, b.valor FROM cgtb00007 b WHERE b.numero = p_volante.numero and b.status_t is null ORDER BY 1,2,3,4 LET idx = 1 FOREACH busca1 INTO arr_volante[idx].* LET idx = idx + 1 END FOREACH CALL set_count(idx-1) INPUT ARRAY arr_volante WITHOUT DEFAULTS FROM s_volante.* ON KEY (CONTROL-B) LET curr = arr_curr() LET scr_l = scr_line() CALL busca_bienes() LET arr_volante[curr].cod_n = bien[curr1].cod_n LET arr_volante[curr].cod_grupo = bien[curr1].cod_grupo LET arr_volante[curr].cod_tipo = bien[curr1].cod_tipo LET arr_volante[curr].cod_sec = bien[curr1].cod_sec DISPLAY arr_volante[curr].cod_n to s_volante[scr_l].cod_n DISPLAY arr_volante[curr].cod_grupo to s_volante[scr_l].cod_grupo DISPLAY arr_volante[curr].cod_tipo to s_volante[scr_l].cod_tipo DISPLAY arr_volante[curr].cod_sec to s_volante[scr_l].cod_sec LET arr_volante[curr].descripcion = bien[curr1].descrip_esp LET arr_volante[curr].unidad = bien[curr1].unidad DISPLAY arr_volante[curr].descripcion to s_volante[scr_l].descripcion DISPLAY arr_volante[curr].unidad to s_volante[scr_l].unidad AFTER FIELD cod_n LET curr = arr_curr() LET scr_l = scr_line() IF arr_volante[curr].cod_n is not null THEN LET verdad = "N" CALL repite() IF verdad = "S" THEN LET verdad = "N" NEXT FIELD cod_grupo END IF END IF AFTER FIELD cod_grupo IF arr_volante[curr].cod_grupo is not null THEN LET verdad = "N" CALL repite() IF verdad = "S" THEN LET verdad = "N" NEXT FIELD cod_tipo END IF END IF AFTER FIELD cod_tipo IF arr_volante[curr].cod_tipo is not null THEN LET verdad = "N" CALL repite() IF verdad = "S" THEN LET verdad = "N" NEXT FIELD cod_sec END IF END IF AFTER FIELD cod_sec LET codigo_zap = "N" IF arr_volante[curr].cod_n = 9 and arr_volante[curr].cod_grupo = 9 and arr_volante[curr].cod_tipo = 99 and arr_volante[curr].cod_sec = 999 THEN LET codigo_zap = "S" END IF IF arr_volante[curr].cod_sec is not null THEN IF arr_volante[curr].cod_n is null or arr_volante[curr].cod_grupo is null or arr_volante[curr].cod_tipo is null THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD cod_n END IF SELECT descrip_esp INTO descripcion FROM intb00001 WHERE cod_n = arr_volante[curr].cod_n and cod_grupo = arr_volante[curr].cod_grupo and cod_tipo = arr_volante[curr].cod_tipo and cod_sec = arr_volante[curr].cod_sec and status_t is null IF status = notfound THEN LET numero_msg = 3 CALL msg(numero_msg) CALL busca_bienes() LET arr_volante[curr].cod_n = bien[curr1].cod_n LET arr_volante[curr].cod_grupo = bien[curr1].cod_grupo LET arr_volante[curr].cod_tipo = bien[curr1].cod_tipo LET arr_volante[curr].cod_sec = bien[curr1].cod_sec DISPLAY arr_volante[curr].cod_n to s_volante[scr_l].cod_n DISPLAY arr_volante[curr].cod_grupo to s_volante[scr_l].cod_grupo DISPLAY arr_volante[curr].cod_tipo to s_volante[scr_l].cod_tipo DISPLAY arr_volante[curr].cod_sec to s_volante[scr_l].cod_sec LET descripcion = bien[curr1].descrip_esp LET unidad = bien[curr1].unidad NEXT FIELD valor END IF DISPLAY arr_volante[curr].descripcion to s_volante[scr_l].descripcion DISPLAY arr_volante[curr].unidad to s_volante[scr_l].unidad END IF BEFORE FIELD descripcion IF codigo_zap = "N" THEN NEXT FIELD valor END IF AFTER FIELD descripcion IF codigo_zap = "S" THEN IF arr_volante[curr].descripcion is null THEN LET numero_msg = 16 CALL msg(numero_msg) NEXT FIELD descripcion END IF END IF AFTER INPUT IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = false RETURN END IF EXIT INPUT END INPUT # Actualizacion de la tabla volantes de caja chica DELETE FROM cgtb00007 WHERE numero = p_volante.numero and departamento_ctrl = p_volante.departamento_ctrl START REPORT volante TO "C:\\ARCHIVO" FOR idx = 1 TO arr_count() IF arr_volante[idx].cod_n is not null and arr_volante[idx].cod_grupo is not null and arr_volante[idx].cod_tipo is not null and arr_volante[idx].cod_sec is not null THEN # Inserta los datos a la tabla que controla los datos de caja chica INSERT INTO cgtb00007 values (p_volante.fecha,p_volante.numero,arr_volante[idx].cod_n, arr_volante[idx].cod_grupo,arr_volante[idx].cod_tipo, arr_volante[idx].cod_sec,arr_volante[idx].descripcion, arr_volante[idx].unidad, p_volante.monto,arr_volante[idx].valor, null, p_volante.departamento_ctrl,p_volante.departamento_req, p_volante.preparado_por,p_volante.recibido_por, p_volante.autorizado_por,p_volante.tipo, null,user,current,null,null) # Impresion del volante de caja chica OUTPUT TO REPORT volante(p_volante.*,arr_volante[idx].*) END IF END FOR CALL integridad() IF bandera = 1 THEN LET bandera = 0 RETURN END IF LET numero_msg = 13 CALL msg(numero_msg) DISPLAY " " AT 1,50 FINISH REPORT volante RUN "TYPE C:\\ARCHIVO > %USPRINT%" COMMAND KEY ("N") "aNular" PROMPT "Esta seguro de querer anular este documento" FOR CHAR opt4 LET opt4 = upshift(opt4) IF opt4 = "S" THEN UPDATE cgtb00007 set status_t = "E" WHERE numero = p_volante.numero END IF COMMAND "Retornar" EXIT MENU END MENU END FUNCTION # Funcion para la consulta alfabetica de los bienes y servicios FUNCTION busca_bienes() OPEN WINDOW servicio AT 5,3 WITH FORM "cgfmwd003" ATTRIBUTE (BORDER, FORM LINE FIRST + 1,COMMENT LINE LAST -1,PROMPT LINE LAST -2) LABEL vuelve: CONSTRUCT BY NAME criterio ON intb00001.cod_n,intb00001.cod_grupo, intb00001.cod_tipo, intb00001.cod_sec, intb00001.descrip_esp IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) LET int_flag = false GOTO salir END IF LET selec1 = "SELECT COUNT(*) FROM intb00001 ", "WHERE ",criterio clipped," AND status_t is null" PREPARE comando30 FROM selec1 DECLARE busca4 CURSOR FOR comando30 OPEN busca4 FETCH busca4 INTO regi IF regi > 200 THEN LET numero_msg = 235 CALL msg(numero_msg) GOTO vuelve END IF LET selec = "SELECT cod_n,cod_grupo,cod_tipo,cod_sec,descrip_esp,unidad_med ", "FROM intb00001 ", "WHERE ",criterio clipped," AND status_t is null ORDER BY 5" PREPARE comando1 FROM selec DECLARE busca2 CURSOR FOR comando1 OPEN busca2 LET encontre = "S" LET idx = 1 WHILE status != notfound FETCH busca2 INTO bien[idx].* IF status = notfound THEN IF idx = 1 THEN LET encontre = "N" END IF EXIT WHILE END IF LET idx = idx + 1 END WHILE # Si no encuentra en la tabla ningun registro con el criterio dado se pregunta # si desea agregar registros IF encontre = "N" THEN LET encontre = "S" LET numero_msg = 3 CALL msg(numero_msg) GOTO salir END IF # Desplegue de informacion CALL set_count(idx-1) DISPLAY ARRAY bien TO s_bien.* LET curr1 = arr_curr() IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) END IF LABEL salir: CLOSE WINDOW servicio END FUNCTION #Funcion para agregar articulos a la tabla de bienes y servicios FUNCTION bienes() OPEN WINDOW captura AT 7,3 WITH FORM "cgfmwd002" ATTRIBUTE (BORDER, FORM LINE FIRST +1 ,COMMENT LINE LAST -1,PROMPT LINE LAST -2) INITIALIZE c_entra.* TO NULL INPUT BY NAME c_entra.* WITHOUT DEFAULTS AFTER FIELD cod_sec SELECT * INTO c_entra.* FROM intb00001 WHERE cod_n = c_entra.cod_n and cod_grupo = c_entra.cod_grupo and cod_tipo = c_entra.cod_tipo and cod_sec = c_entra.cod_sec IF c_entra.status_t = "E" THEN LET numero_msg = 36 CALL msg(numero_msg) NEXT FIELD cod_n END IF IF status != notfound THEN LET numero_msg = 12 CALL msg(numero_msg) DISPLAY BY NAME c_entra.* NEXT FIELD cod_n END IF AFTER INPUT IF int_flag THEN LET numero_msg = 2 CALL msg(numero_msg) EXIT INPUT END IF END INPUT IF int_flag THEN LET int_flag = false GOTO sale END IF # Inserta los datos en la tabla de bienes y servicios INSERT INTO intb00001 values (c_entra.cod_n,c_entra.cod_grupo,c_entra.cod_tipo,c_entra.cod_sec, c_entra.descrip_esp,c_entra.descrip_ing,c_entra.unidad_med,null, USER,CURRENT,null,null) CALL integridad() IF bandera = 1 THEN LET bandera = 0 RETURN END IF LABEL sale: CLOSE WINDOW captura LET arr_volante[curr].cod_n = c_entra.cod_n LET arr_volante[curr].cod_grupo = c_entra.cod_grupo LET arr_volante[curr].cod_tipo = c_entra.cod_tipo LET arr_volante[curr].cod_sec = c_entra.cod_sec LET arr_volante[curr].descripcion = c_entra.descrip_esp LET arr_volante[curr].unidad = c_entra.unidad_med DISPLAY arr_volante[curr].cod_n to s_volante[scr_l].cod_n DISPLAY arr_volante[curr].cod_grupo to s_volante[scr_l].cod_grupo DISPLAY arr_volante[curr].cod_tipo to s_volante[scr_l].cod_tipo DISPLAY arr_volante[curr].cod_sec to s_volante[scr_l].cod_sec DISPLAY arr_volante[curr].descripcion to s_volante[scr_l].descripcion DISPLAY arr_volante[curr].unidad to s_volante[scr_l].unidad END FUNCTION FUNCTION repite() DEFINE ant_art RECORD cod_n SMALLINT, cod_grupo SMALLINT, cod_tipo SMALLINT, cod_sec SMALLINT END RECORD IF arr_volante[curr].cod_n != 9 and arr_volante[curr].cod_grupo != 9 and arr_volante[curr].cod_tipo != 99 and arr_volante[curr].cod_sec != 999 THEN LET verdad = null LET ant_art.cod_n = arr_volante[curr].cod_n LET ant_art.cod_grupo = arr_volante[curr].cod_grupo LET ant_art.cod_tipo = arr_volante[curr].cod_tipo LET ant_art.cod_sec = arr_volante[curr].cod_sec FOR idx = 1 TO arr_count() IF idx != curr THEN IF arr_volante[idx].cod_n IS NOT NULL AND arr_volante[idx].cod_grupo IS NOT NULL AND arr_volante[idx].cod_tipo IS NOT NULL AND arr_volante[idx].cod_sec IS NOT NULL THEN IF arr_volante[idx].cod_n = ant_art.cod_n AND arr_volante[idx].cod_grupo = ant_art.cod_grupo AND arr_volante[idx].cod_tipo = ant_art.cod_tipo AND arr_volante[idx].cod_sec = ant_art.cod_sec THEN LET numero_msg = 21 CALL msg(numero_msg) LET verdad = "S" ELSE IF verdad != "S" THEN LET verdad = "N" END IF END IF END IF END IF END FOR END IF END FUNCTION # Impresion del volante de caja chica REPORT volante(x,z) DEFINE x RECORD fecha DATE, departamento_ctrl SMALLINT, departamento_req SMALLINT, numero INTEGER, tipo CHAR(1), monto DECIMAL(12,2), preparado_por CHAR(20), recibido_por CHAR(20), autorizado_por CHAR(20) END RECORD DEFINE z RECORD cod_n SMALLINT, cod_grupo SMALLINT, cod_tipo SMALLINT, cod_sec SMALLINT, descripcion CHAR(30), unidad CHAR(3), valor DECIMAL(12,2) END RECORD DEFINE comp_on,comp_off,negras_on,negras_off,doble CHAR(2) OUTPUT LEFT MARGIN 0 PAGE LENGTH 33 TOP MARGIN 0 ORDER BY x.numero FORMAT BEFORE GROUP OF x.numero LET negras_on = ASCII 27, ASCII 69 LET negras_off = ASCII 27, ASCII 70 LET comp_on = ASCII 15 LET comp_off = ASCII 18 LET doble = ASCII 14 PRINT COLUMN 1,negras_on,doble, "RAYOVAC",negras_off PRINT COLUMN 60, "No. ",negras_on,doble,x.numero using "&&&&&&" SKIP 1 LINE PRINT COLUMN 20, "Comprobante de Caja Chica", COLUMN 60, x.fecha using "dd/mmm/yyyy" SKIP 1 LINE PRINT COLUMN 27, negras_on,desc_volante,negras_off PRINT PRINT COLUMN 1, "Vale por RD$",x.monto using "##,###.##", COLUMN 25, "Cargo a: ",x.departamento_req using "####", " ",nombre_req PRINT COLUMN 1, "Para Cubrir lo Siguente:" SKIP 1 LINE ON EVERY ROW PRINT COLUMN 1, z.cod_n using "&","-",z.cod_grupo using "&","-", z.cod_tipo using "&&","-",z.cod_sec using "&&&", COLUMN 12, z.descripcion," ",z.unidad, COLUMN 40, z.valor using "$$,$$#.##" AFTER GROUP OF x.numero PRINT comp_on PRINT COLUMN 22, "____________________________________" PRINT COLUMN 22, "| A Contabilizar |", COLUMN 93, "Preparado Por: ",x.preparado_por PRINT COLUMN 1, "=========================================================================", "============" PRINT COLUMN 1, "|", COLUMN 49, "| Deber", COLUMN 67, "| Haber |" PRINT COLUMN 1, "|Cuenta |", COLUMN 11, "depto |", COLUMN 22, "Catalogo |", COLUMN 33, "Referencia |", COLUMN 44, " Pesos |", COLUMN 53, " Ctvs. |", COLUMN 63, " Pesos |", COLUMN 73, " Ctvs. |", COLUMN 93, "Recibido Por: ",x.recibido_por PRINT COLUMN 1, "=========================================================================", "============" PRINT COLUMN 1, "| |", COLUMN 11, " |", COLUMN 21, " |", COLUMN 31, " |", COLUMN 43, " |", COLUMN 53, " |", COLUMN 63, " |", COLUMN 73, " |" PRINT COLUMN 1, "| |", COLUMN 11, " |", COLUMN 21, " |", COLUMN 31, " |", COLUMN 43, " |", COLUMN 53, " |", COLUMN 63, " |", COLUMN 73, " |" PRINT COLUMN 1, "| |", COLUMN 11, " |", COLUMN 21, " |", COLUMN 31, " |", COLUMN 43, " |", COLUMN 53, " |", COLUMN 63, " |", COLUMN 73, " |" PRINT COLUMN 1, "| |", COLUMN 11, " |", COLUMN 21, " |", COLUMN 31, " |", COLUMN 43, " |", COLUMN 53, " |", COLUMN 63, " |", COLUMN 73, " |", COLUMN 93, "Autorizado Por: ",x.autorizado_por clipped PRINT COLUMN 1, "-----------------------------------------------------------------------------", "--------" PRINT COLUMN 1, "|Fecha |", COLUMN 30, "Concepto", COLUMN 73, " |" PRINT COLUMN 1, "| |", COLUMN 73, " |" PRINT COLUMN 1, "| |", COLUMN 73, " |" PRINT COLUMN 1, "-----------------------------------------------------------------------------", "--------" PRINT comp_off END REPORT