155 lines
4.5 KiB
Plaintext
155 lines
4.5 KiB
Plaintext
{
|
|
--------------------------------------------------------------------------
|
|
PROGRAMA : CCPRRP033
|
|
OBJETIVO : Relacion de notas de creditos aplicadas
|
|
PROGRAMADOR : Juan F. Soto
|
|
FECHA : Agosto 31, 1994
|
|
---------------------------------------------------------------------------
|
|
}
|
|
GLOBALS
|
|
"ccprgb000.4gl"
|
|
DEFINE re_pag RECORD LIKE cctb00001.*
|
|
DEFINE fecha_inicial,fecha_final DATE
|
|
|
|
FUNCTION ccprrp033()
|
|
DEFINE selec1 CHAR(300)
|
|
DEFINE p_vend SMALLINT
|
|
|
|
OPTIONS
|
|
ERROR LINE 24,
|
|
COMMENT LINE 23,
|
|
FORM LINE 8
|
|
|
|
# Llama la pantalla general que esta en el modulo del menu principal
|
|
CALL pantalla()
|
|
|
|
DISPLAY "ccprrp033" AT 4,3
|
|
DISPLAY "Relacion de Aplicacion de Notas de credito" AT 6,18
|
|
|
|
# Abre el formulario para la captura de las fechas
|
|
OPEN FORM ccfmrp033 FROM "ccfmrp033"
|
|
DISPLAY FORM ccfmrp033
|
|
|
|
LET tipo_papel = 1
|
|
CALL msgrp000(tipo_papel)
|
|
# Captura de rango de fecha para el reporte
|
|
INPUT BY NAME fecha_inicial,fecha_final
|
|
|
|
# Control de ruptura de la funcion para la cancelacion de la operacion
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = false
|
|
RETURN
|
|
END IF
|
|
|
|
CONSTRUCT BY NAME criterio ON cod_emp_sec,num_doc
|
|
|
|
# Inicializa las operaciones del printer
|
|
START REPORT recibe TO "C:\\archivo"
|
|
|
|
# Busqueda de las informaciones dependiendo del rango de fecha
|
|
LET selec1 =
|
|
"SELECT * FROM cctb00001 ",
|
|
"WHERE (fecha_orig between ? and ? and tipo_cliente = 12 and ",
|
|
" sec_cliente is not null and status_t is null and ",
|
|
" tipo_doc = 'DE') and valor < 0 and ( ",criterio clipped," ) ",
|
|
"ORDER BY cod_emp_sec,num_doc,fecha_orig"
|
|
|
|
DISPLAY "Buscando Notas de Creditos... Espere Por Favor" AT 19,14
|
|
|
|
PREPARE comando FROM selec1
|
|
DECLARE busca CURSOR FOR comando
|
|
OPEN busca USING fecha_inicial,fecha_final
|
|
|
|
DISPLAY "Reporte Generandose... Espere Por Favor" AT 19,14
|
|
WHILE STATUS != NOTFOUND
|
|
FETCH busca INTO re_pag.*
|
|
IF status = notfound THEN
|
|
EXIT WHILE
|
|
END IF
|
|
# Control de ruptura de la funcion para la cancelacion de la operacion
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = false
|
|
RETURN
|
|
END IF
|
|
LET p_vend = re_pag.cod_emp_sec
|
|
|
|
OUTPUT TO REPORT recibe(p_vend)
|
|
END WHILE
|
|
|
|
FINISH REPORT recibe
|
|
CLEAR SCREEN
|
|
RUN "type C:\\archivo > %USPRINT%" END FUNCTION
|
|
|
|
REPORT recibe(x_vend)
|
|
DEFINE x_vend SMALLINT
|
|
DEFINE nombre,apellido CHAR(20)
|
|
|
|
OUTPUT
|
|
LEFT MARGIN 1
|
|
|
|
FORMAT
|
|
PAGE HEADER
|
|
|
|
LET lj = (77 - LENGTH(p_companias.nombre CLIPPED))/2
|
|
PRINT COLUMN 1, "ccprrp033",
|
|
COLUMN lj, p_companias.nombre CLIPPED,
|
|
COLUMN 70, "Pag. ",pageno using "###"
|
|
PRINT COLUMN 26, "SISTEMA DE CUENTAS POR COBRAR",
|
|
COLUMN 70, today using "dd/mm/yy"
|
|
PRINT COLUMN 20, "RELACION DE APLICACION DE NOTAS DE CREDITO",
|
|
COLUMN 70, time
|
|
SKIP 1 LINE
|
|
PRINT COLUMN 1, "DESDE: ",fecha_inicial using "dd/mm/yy"," ",
|
|
"HASTA: ",fecha_final using "dd/mm/yy"
|
|
|
|
BEFORE GROUP OF x_vend
|
|
|
|
SELECT nom1_emp,apell1_emp INTO nombre,apellido
|
|
FROM adtb00003
|
|
WHERE num_emp = x_vend
|
|
SKIP 1 LINE
|
|
PRINT COLUMN 1, "Vendedor: ",x_vend using "####"," ",
|
|
nombre clipped,",",apellido
|
|
|
|
PRINT "---------------------------------------------------------------",
|
|
"---------------"
|
|
|
|
PRINT COLUMN 10, "NUM DE",
|
|
COLUMN 18, "APLICACION",
|
|
COLUMN 30, "FECHA",
|
|
COLUMN 40, "VALOR APLICADO",
|
|
COLUMN 60, "RECIBO DE PAGO"
|
|
|
|
PRINT "---------------------------------------------------------------",
|
|
"---------------"
|
|
|
|
ON EVERY ROW
|
|
SELECT UNIQUE a.tipo_doc INTO re_pag.tipo_doc
|
|
FROM cctb00001 a
|
|
WHERE a.num_doc = re_pag.aplica_a and a.tipo_doc not in ("PG")
|
|
|
|
IF status = notfound THEN
|
|
LET re_pag.tipo_doc = null
|
|
LET status = 0
|
|
END IF
|
|
|
|
PRINT COLUMN 10, re_pag.num_doc using "&&&&&&",
|
|
COLUMN 18, re_pag.tipo_doc,"-",re_pag.aplica_a using "&&&&&&",
|
|
COLUMN 30, re_pag.fecha_orig using "dd/mm/yy",
|
|
COLUMN 40, re_pag.valor+re_pag.monto_desc using "###,###.##",
|
|
COLUMN 60, re_pag.num_cheque
|
|
|
|
AFTER GROUP OF x_vend
|
|
PRINT COLUMN 36, "--------------"
|
|
PRINT "TOTAL REGISTROS :",GROUP COUNT(*) using "###",
|
|
COLUMN 36, GROUP SUM(re_pag.valor+re_pag.monto_Desc)
|
|
using "###,###,###.##"
|
|
ON LAST ROW
|
|
SKIP 1 LINE
|
|
PRINT "TOTAL REGISTROS: ",COUNT(*) using "###"
|
|
END REPORT
|