2350 lines
74 KiB
Plaintext
2350 lines
74 KiB
Plaintext
{
|
|
-----------------------------------------------------------------------------
|
|
PROGRAMA : CGPRMT017
|
|
OBJETIVO : Mantenimiento Transferencias Dolares
|
|
REALIZADO POR : Ing. Juan F. Soto
|
|
FECHA : Septiembre 11, 1997.
|
|
100612
|
|
-----------------------------------------------------------------------------
|
|
}
|
|
GLOBALS "cgprgb000.4gl"
|
|
DEFINE k_tipo CHAR(3),
|
|
xcomentario VARCHAR(100),
|
|
imp_cxp BOOLEAN,
|
|
xdebito,xcredito DEC(12,2),
|
|
numdoc INT,autorizar,usada CHAR(2)
|
|
|
|
MAIN
|
|
DEFER INTERRUPT
|
|
CALL ARG_VAL(1) RETURNING usuarios
|
|
CALL ARG_VAL(2) RETURNING clave
|
|
CALL ARG_VAL(3) RETURNING impresor
|
|
|
|
|
|
CONNECT to "marmotech" AS "MSSQL" USER usuarios USING clave
|
|
SELECT a.* INTO p_compania.* FROM companias a
|
|
|
|
CALL cgprmt017()
|
|
END MAIN
|
|
|
|
|
|
###### Funcion que adiciona informacion referente a la aplicacion de un pago
|
|
FUNCTION cgprmt017()
|
|
|
|
OPTIONS
|
|
FORM LINE 8,
|
|
ERROR LINE 24,
|
|
COMMENT LINE 22,
|
|
PROMPT LINE 23
|
|
|
|
# CALL pantalla()
|
|
OPEN FORM cgfmmt017 FROM "cgfmmt017"
|
|
DISPLAY FORM cgfmmt017
|
|
DISPLAY "cgprmt017" AT 4,3 ATTRIBUTE(RED)
|
|
DISPLAY "Registro De Transferencias " AT 6,26 ATTRIBUTE(BLACK)
|
|
|
|
MENU "Mant."
|
|
ON action Adicionar
|
|
LET int_flag = FALSE
|
|
CALL cgprad017()
|
|
ON ACTION Consultar_Modificar
|
|
|
|
LET int_flag = FALSE
|
|
CALL cgprmd017()
|
|
ON ACTION Salir
|
|
LET int_flag = FALSE
|
|
EXIT MENU
|
|
END MENU
|
|
END FUNCTION
|
|
|
|
FUNCTION cgprad017()
|
|
LET hoy = today
|
|
LET k_tipo = "TR."
|
|
LABEL volver1:
|
|
INITIALIZE recibo.* TO NULL
|
|
#ERROR "Para Anular Un Cheque Presione <Ctrl-B>"
|
|
CLEAR FORM
|
|
|
|
LABEL volver:
|
|
IF opc = "S" or opc is null THEN
|
|
LET recibo.nom_sup = null
|
|
LET recibo.monto = null
|
|
LET opc = null
|
|
END IF
|
|
|
|
#### Aceptando los valores a insertar referentes al pago
|
|
INPUT BY NAME numdoc,recibo.*,xcomentario,preview WITHOUT DEFAULTS
|
|
|
|
{AFTER FIELD codigo
|
|
SELECT a.descripcion INTO p_descrip
|
|
FROM tetb00003 a
|
|
WHERE a.codigo = recibo.codigo
|
|
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD codigo
|
|
END IF
|
|
DISPLAY BY NAME p_descrip
|
|
}
|
|
AFTER FIELD numdoc
|
|
|
|
CALL busca_solicitud(numdoc) RETURNING recibo.cuenta_p,recibo.fecha,recibo.monto,recibo.cod_sp,
|
|
recibo.cod_sp_sec,recibo.nom_sup,xcomentario,autorizar,usada
|
|
|
|
IF autorizar IS NULL OR autorizar ="NO" THEN
|
|
CALL fgl_winmessage("ERROR","SOLICITUD NO ESTA AUTORIZADA","STOP")
|
|
NEXT FIELD numdoc
|
|
END IF
|
|
|
|
IF usada IS NULL OR usada ="S" THEN
|
|
CALL fgl_winmessage("ERROR","SOLICITUD YA HA SIDO PAGADA","STOP")
|
|
NEXT FIELD numdoc
|
|
END IF
|
|
|
|
DISPLAY BY NAME recibo.*,xcomentario
|
|
|
|
|
|
|
|
AFTER FIELD monto
|
|
IF recibo.monto is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD monto
|
|
END IF
|
|
|
|
AFTER FIELD cod_sp_sec
|
|
|
|
##### Selecionando datos referentes al suplidor
|
|
IF recibo.cod_sp_sec is not null THEN
|
|
IF recibo.cod_sp != 1 THEN
|
|
SELECT a.nom_sp INTO recibo.nom_sup FROM cotb00001 a
|
|
WHERE a.cod_sp = recibo.cod_sp AND
|
|
a.cod_sp_sec = recibo.cod_sp_sec
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_sp
|
|
END IF
|
|
|
|
DISPLAY BY NAME recibo.cod_sp,recibo.cod_sp_sec,recibo.nom_sup
|
|
NEXT FIELD nom_sup
|
|
END IF
|
|
END IF
|
|
|
|
IF recibo.cod_sp = 1 THEN
|
|
SELECT nom1_emp,apell1_emp,departamento,nomina
|
|
INTO nombre_emp,apellido_emp,depto,tipo_d FROM adtb00003
|
|
WHERE num_emp = recibo.cod_sp_sec
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_sp_sec
|
|
END IF
|
|
|
|
LET recibo.nom_sup = nombre_emp clipped," ",apellido_emp clipped
|
|
DISPLAY BY NAME recibo.nom_sup
|
|
END IF
|
|
|
|
BEFORE FIELD tipo_doc
|
|
LET recibo.tipo_doc = "TR"
|
|
DISPLAY BY NAME recibo.tipo_doc
|
|
|
|
BEFORE FIELD fecha
|
|
IF numdoc IS NULL THEN
|
|
LET recibo.fecha = hoy
|
|
END IF
|
|
DISPLAY BY NAME recibo.fecha
|
|
|
|
AFTER FIELD fecha
|
|
LET hoy = recibo.fecha
|
|
IF recibo.fecha is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD fecha
|
|
END IF
|
|
|
|
LET p_fechas = recibo.fecha
|
|
CALL prd(p_fechas,usuarios) RETURNING bandera
|
|
IF bandera = 1 THEN
|
|
LET bandera = 0
|
|
NEXT FIELD fecha
|
|
END IF
|
|
AFTER INPUT
|
|
|
|
####### Creando la facilidad para cancelar proceso mediante DELETE o SUPR
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
CLEAR FORM
|
|
RETURN
|
|
END IF
|
|
LET tipo_doc1 = recibo.tipo_doc
|
|
|
|
IF recibo.monto is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD monto
|
|
END IF
|
|
EXIT INPUT
|
|
END INPUT
|
|
|
|
# Funcion que captura 5 lineas de detalles
|
|
# CALL detallado()
|
|
|
|
IF opc = "S" or opc is null THEN
|
|
CALL arr_recibo.clear()
|
|
|
|
END IF
|
|
|
|
IF recibo.cod_sp = 1 THEN
|
|
GOTO vuelve
|
|
END IF
|
|
|
|
IF recibo.cod_sp_sec is not null THEN
|
|
# Entrada de documentos que se pagaran con este cheque si el usuario
|
|
LABEL vuelta:
|
|
PROMPT "Afecta Cuentas Por Pagar?(S/N) " FOR CHAR opcion
|
|
LET opcion = upshift(opcion)
|
|
|
|
IF opcion != "S" AND
|
|
opcion != "N" THEN
|
|
LET numero_msg = -1301
|
|
CALL msg(numero_msg)
|
|
GOTO vuelta
|
|
END IF
|
|
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
CLEAR FORM
|
|
RETURN
|
|
END IF
|
|
|
|
IF opcion = "N" THEN
|
|
CALL arr_recibo.clear()
|
|
|
|
END IF
|
|
|
|
IF opcion = "S" THEN
|
|
LET remanente = 0
|
|
LABEL arr2:
|
|
LET sale_arr = "N"
|
|
LET selec1=" SELECT a.tipo,a.num_oc,a.num_doc,a.valor_pendiente,a.valor_pagado ",
|
|
"FROM cgtb00039 a ",
|
|
"WHERE a.numdoc=",numdoc," and status_t is null "
|
|
|
|
PREPARE comand4 FROM selec1
|
|
DECLARE busca1 CURSOR FOR comand4
|
|
LET idx=1
|
|
FOREACH busca1 INTO arr_recibo[idx].tipo,arr_recibo[idx].orden_no,arr_recibo[idx].aplica_a,
|
|
arr_recibo[idx].valor_pen,arr_recibo[idx].valor_pag
|
|
|
|
DISPLAY arr_recibo[curr1].*
|
|
|
|
LET idx=idx+1
|
|
END FOREACH
|
|
|
|
{ DISPLAY arr_recibo[curr1].aplica_a TO s_recibo[scr_l].aplica_a
|
|
DISPLAY arr_recibo[curr1].orden_no TO s_recibo[scr_l].orden_no
|
|
DISPLAY arr_recibo[curr1].tipo TO s_recibo[scr_l].tipo
|
|
DISPLAY arr_recibo[curr1].valor_pen TO s_recibo[scr_l].valor_pen
|
|
DISPLAY arr_recibo[curr1].valor_pag TO s_recibo[scr_l].valor_pag}
|
|
INPUT ARRAY arr_recibo WITHOUT DEFAULTS FROM s_recibo.*
|
|
ON KEY (CONTROL-F)
|
|
LET sale_arr = "S"
|
|
EXIT INPUT
|
|
BEFORE INPUT
|
|
LET curr = arr_curr()
|
|
LET scr_l = scr_line()
|
|
|
|
|
|
ON ACTION busca_aplicacion
|
|
LET curr = arr_curr()
|
|
LET scr_l = scr_line()
|
|
|
|
###### Proceso para abrir window en caso de desconocer el numero de orden
|
|
###### perteneciente a la factura que se aplicara el pago.
|
|
CALL busca_aplicacion(recibo.cod_sp,recibo.cod_sp_sec) RETURNING arr_recibo[curr].aplica_a,arr_recibo[curr].valor_pen
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = false
|
|
NEXT FIELD aplica_a
|
|
END IF
|
|
IF existe = "N" THEN
|
|
LET existe = "S"
|
|
NEXT FIELD aplica_a
|
|
END IF
|
|
|
|
DISPLAY arr_recibo[curr].aplica_a to s_recibo[scr_l].aplica_a
|
|
DISPLAY arr_recibo[curr].valor_pen to s_recibo[scr_l].valor_pen
|
|
LET arr_recibo[curr].valor_pag = arr_recibo[curr].valor_pen
|
|
DISPLAY arr_recibo[curr].valor_pag to s_recibo[scr_l].valor_pag
|
|
NEXT FIELD valor_pag
|
|
LET verdad = "N"
|
|
CALL repetir1()
|
|
IF verdad = "S" THEN
|
|
NEXT FIELD aplica_a
|
|
END IF
|
|
BEFORE ROW
|
|
LET curr = arr_curr()
|
|
LET scr_l = scr_line()
|
|
|
|
|
|
AFTER FIELD orden_no
|
|
IF arr_recibo[curr].orden_no != 999999 THEN #IS NOT NULL THEN
|
|
IF recibo.cod_sp IS NULL THEN
|
|
|
|
##### Chequeando que el numero de orden a digitar exista en la maestra de pago[
|
|
|
|
SELECT UNIQUE a.tipo,a.orden_no,a.cod_sp,a.cod_sp_sec
|
|
INTO p_tipo,p_orden,recibo.cod_sp,recibo.cod_sp_sec
|
|
FROM cptb00001 a WHERE a.tipo = arr_recibo[curr].tipo AND
|
|
a.orden_no = arr_recibo[curr].orden_no
|
|
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD tipo
|
|
END IF
|
|
|
|
ELSE
|
|
|
|
###### Chequeando que el numero de orden exista en la maestra de orden
|
|
|
|
SELECT b.num_oc FROM cotb00014 b
|
|
WHERE b.tipo=arr_recibo[curr].tipo AND b.num_oc=arr_recibo[curr].orden_no
|
|
AND b.cod_sp = recibo.cod_sp AND b.cod_sp_sec = recibo.cod_sp_sec
|
|
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD tipo
|
|
END IF
|
|
END IF
|
|
ELSE
|
|
IF recibo.tipo_doc = "CP" THEN
|
|
LET arr_recibo[curr].tipo = "99"
|
|
NEXT FIELD valor_pag
|
|
END IF
|
|
END IF
|
|
|
|
AFTER FIELD aplica_a
|
|
IF arr_recibo[curr].orden_no is not null AND
|
|
arr_recibo[curr].aplica_a IS NULL THEN
|
|
LET tipo_doc1= "CP"
|
|
END IF
|
|
IF arr_recibo[curr].orden_no is not null and
|
|
arr_recibo[curr].aplica_a is not null THEN
|
|
LET numero_msg = 212
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD aplica_a
|
|
END IF
|
|
|
|
IF arr_recibo[curr].aplica_a IS NOT NULL THEN
|
|
IF recibo.cod_sp != 1 THEN
|
|
IF recibo.tipo_doc = "CP" THEN
|
|
IF arr_recibo[curr].orden_no IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD orden_no
|
|
ELSE
|
|
NEXT FIELD valor_pag
|
|
END IF
|
|
END IF
|
|
|
|
IF arr_recibo[curr].aplica_a IS NOT NULL THEN
|
|
# LET arr_recibo[curr].orden_no = null
|
|
# LET arr_recibo[curr].tipo = null
|
|
LET verdad = "N"
|
|
CALL repetir1()
|
|
IF verdad = "S" THEN
|
|
NEXT FIELD aplica_a
|
|
END IF
|
|
|
|
IF arr_recibo[curr].aplica_a IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD aplica_a
|
|
END IF
|
|
|
|
# Controla que la factura pertenezca al suplidor
|
|
|
|
SELECT a.tipo,a.orden_no,a.valor
|
|
INTO arr_recibo[curr].tipo,arr_recibo[curr].orden_no,valor_fac
|
|
FROM cptb00001 a
|
|
WHERE a.num_doc = arr_recibo[curr].aplica_a
|
|
AND a.cod_sp = recibo.cod_sp
|
|
AND a.cod_sp_sec = recibo.cod_sp_sec
|
|
AND a.tipo_doc = "FT"
|
|
AND a.status_t is null
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 126
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD aplica_a
|
|
END IF
|
|
|
|
# Busca el valor pendiente de la factura
|
|
|
|
SELECT sum(a.valor*-1) INTO valor_fac1 FROM cptb00001 a
|
|
WHERE a.cod_sp = recibo.cod_sp
|
|
AND a.cod_sp_sec = recibo.cod_sp_sec
|
|
AND a.aplica_a = arr_recibo[curr].aplica_a
|
|
AND a.tipo_doc not matches "*FT*"
|
|
AND a.status_t IS NULL
|
|
|
|
IF valor_fac1 IS NULL THEN
|
|
LET valor_fac1 = 0
|
|
END IF
|
|
|
|
IF valor_fac IS NULL THEN
|
|
LET valor_fac = 0
|
|
END IF
|
|
|
|
####### Calculando el valor pendiente de la factura
|
|
|
|
LET arr_recibo[curr].valor_pen = valor_fac - valor_fac1
|
|
IF numdoc IS NULL THEN
|
|
LET arr_recibo[curr].valor_pag = arr_recibo[curr].valor_pen
|
|
END IF
|
|
DISPLAY arr_recibo[curr].valor_pag to s_recibo[scr_l].valor_pag
|
|
DISPLAY arr_recibo[curr].valor_pen to s_recibo[scr_l].valor_pen
|
|
END IF
|
|
END IF
|
|
END IF
|
|
|
|
AFTER FIELD valor_pag
|
|
IF recibo.tipo_doc = "CP" THEN
|
|
IF arr_recibo[curr].orden_no IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD orden_no
|
|
END IF
|
|
END IF
|
|
|
|
IF arr_recibo[curr].aplica_a IS NOT NULL AND
|
|
arr_recibo[curr].valor_pen IS NOT NULL THEN
|
|
LET verdad = "N"
|
|
CALL repetir1()
|
|
IF verdad = "S" THEN
|
|
NEXT FIELD aplica_a
|
|
END IF
|
|
END IF
|
|
|
|
IF arr_recibo[curr].valor_pag IS NULL THEN
|
|
LET arr_recibo[curr].valor_pag = 0
|
|
END IF
|
|
|
|
IF arr_recibo[curr].aplica_a is not null or
|
|
arr_recibo[curr].orden_no is not null THEN
|
|
IF arr_recibo[curr].valor_pag = 0 THEN
|
|
LET numero_msg = 207
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD valor_pag
|
|
END IF
|
|
END IF
|
|
|
|
LET valor = 0
|
|
FOR idx = 1 TO arr_count()
|
|
IF arr_recibo[idx].valor_pag is null THEN
|
|
LET arr_recibo[idx].valor_pag = 0
|
|
END IF
|
|
LET valor = arr_recibo[idx].valor_pag + valor
|
|
LET remanente = recibo.monto - valor
|
|
DISPLAY BY NAME remanente attribute (bold)
|
|
END FOR
|
|
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = false
|
|
RETURN
|
|
END IF
|
|
|
|
IF arr_recibo[curr].aplica_a is not null or
|
|
arr_recibo[curr].orden_no is not null THEN
|
|
IF arr_recibo[curr].valor_pag = 0 THEN
|
|
LET numero_msg = 207
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD valor_pag
|
|
END IF
|
|
END IF
|
|
|
|
END INPUT
|
|
|
|
IF sale_arr = "S" THEN
|
|
LET opc = "N"
|
|
GOTO volver
|
|
END IF
|
|
|
|
# Sumariza el valor de las facturas para que sean iguales
|
|
LET valor_f = 0
|
|
LET ins_cp = arr_count()
|
|
|
|
FOR idx= 1 to arr_count()
|
|
IF arr_recibo[idx].aplica_a is null and
|
|
arr_recibo[idx].orden_no is null THEN
|
|
LET arr_recibo[idx].valor_pag = 0
|
|
END IF
|
|
|
|
IF arr_recibo[idx].valor_pag is null THEN
|
|
LET arr_recibo[idx].valor_pag = 0
|
|
END IF
|
|
LET valor_f = arr_recibo[idx].valor_pag + valor_f
|
|
END FOR
|
|
|
|
#------------------------------------------------------------------------
|
|
END IF
|
|
END IF
|
|
# Estas asignaciones estan en comentario por que los usuarios
|
|
# de contabilidad desean meter los numeros de documentos en el arreglo de
|
|
# arriba y el arreglo de las cuentas contables
|
|
{
|
|
FOR idx = 1 TO arr_count()
|
|
IF arr_recibo[idx].orden_no is not null THEN
|
|
LET arr_cuenta1[idx].num_doc = arr_recibo[idx].tipo,"-",
|
|
arr_recibo[idx].orden_no using "&&&&&&"
|
|
END IF
|
|
IF arr_recibo[idx].aplica_a is not null THEN
|
|
LET arr_cuenta1[idx].num_doc = arr_recibo[idx].aplica_a
|
|
END IF
|
|
END FOR
|
|
}
|
|
|
|
IF opc = "N" THEN
|
|
GOTO vuelve
|
|
END IF
|
|
CALL arr_cuenta1.clear()
|
|
|
|
LET arr_cuenta1[1].cod_aux = recibo.cod_sp
|
|
LET arr_cuenta1[1].cod_sec = recibo.cod_sp_sec
|
|
|
|
LABEL vuelve:
|
|
# Captura de la codificacion del cheque para contabilidad
|
|
LABEL arr3:
|
|
LET sale_arr = "N"
|
|
LET selec1 =
|
|
" SELECT a.cuenta_no,a.departamento,a.id_auxiliar,a.cod_sec,a.nom_cuenta,a.debito,a.credito ",
|
|
"FROM cgtb00041 a ",
|
|
"WHERE a.numdoc=",numdoc," and status_t is null "
|
|
|
|
PREPARE comand5 FROM selec1
|
|
DECLARE busca3 CURSOR FOR comand5
|
|
LET idx=1
|
|
FOREACH busca3 INTO arr_cuenta1[idx].cuenta_no,arr_cuenta1[idx].departamento,arr_cuenta1[idx].cod_aux,
|
|
arr_cuenta1[idx].cod_sec,arr_cuenta1[idx].nom_cuenta,arr_cuenta1[idx].debito,arr_cuenta1[idx].credito
|
|
|
|
LET idx=idx+1
|
|
END FOREACH
|
|
|
|
|
|
{DISPLAY arr_cuenta1[curr].cod_aux TO s_cuenta[scr_l].cod_aux
|
|
DISPLAY arr_cuenta1[curr].cod_sec TO s_cuenta[scr_l].cod_sec
|
|
DISPLAY arr_cuenta1[curr].credito TO s_cuenta[scr_l].credito
|
|
DISPLAY arr_cuenta1[curr].debito TO s_cuenta[scr_l].debito
|
|
DISPLAY arr_cuenta1[curr].cuenta_no TO s_cuenta[scr_l].cuenta_no
|
|
DISPLAY arr_cuenta1[curr].departamento TO s_cuenta[scr_l].departamento
|
|
DISPLAY arr_cuenta1[curr].nom_cuenta TO s_cuenta[scr_l].nom_cuenta }
|
|
|
|
DISPLAY BY NAME arr_cuenta1[curr].*
|
|
|
|
INPUT ARRAY arr_cuenta1 WITHOUT DEFAULTS FROM s_cuenta.*
|
|
ON KEY(CONTROL-F)
|
|
LET opc = "N"
|
|
LET sale_arr = "S"
|
|
EXIT INPUT
|
|
|
|
ON KEY(CONTROL-P)
|
|
NEXT FIELD cuenta_no
|
|
|
|
BEFORE ROW
|
|
LET curr = arr_curr()
|
|
LET scr_l = scr_line()
|
|
|
|
AFTER FIELD cuenta_no
|
|
IF arr_cuenta1[curr].cuenta_no is not null THEN
|
|
|
|
SELECT a.descripcion,a.origen,a.depto,a.nivel,a.ref,a.cata
|
|
INTO p_descripcion,p_origen,acept_dpto,p_nivel,p_ref,p_cata
|
|
FROM cgtb00001 a
|
|
WHERE a.cuenta_no = arr_cuenta1[curr].cuenta_no and
|
|
a.status_t is null
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
LET arr_cuenta1[curr].nom_cuenta = p_descripcion
|
|
DISPLAY arr_cuenta1[curr].nom_cuenta TO s_cuenta[scr_l].nom_cuenta
|
|
|
|
# Controla que si digitan las cuentas 2115,2117,2119 el programa controle
|
|
# que digiten el suplidor
|
|
IF arr_cuenta1[curr].cuenta_no = "2113-01" or
|
|
arr_cuenta1[curr].cuenta_no = "2116" or
|
|
arr_cuenta1[curr].cuenta_no = "2114"
|
|
THEN
|
|
IF recibo.cod_sp_sec IS NULL THEN
|
|
LET numero_msg = 217
|
|
CALL msg(numero_msg)
|
|
LET arr_cuenta1[curr].cuenta_no = NULL
|
|
DISPLAY arr_cuenta1[curr].cuenta_no TO
|
|
s_cuenta[scr_l].cuenta_no
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
END IF
|
|
|
|
# Controla que la cuenta del banco no sea igual a una cuenta digitada
|
|
# en el arreglo
|
|
LET cuenta_a = arr_cuenta1[curr].cuenta_no clipped
|
|
LET cuenta_b = recibo.cuenta_p clipped
|
|
|
|
IF cuenta_a = cuenta_b THEN
|
|
LET numero_msg = 192
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
IF arr_cuenta1[curr].cuenta_no = "2113-01" or
|
|
arr_cuenta1[curr].cuenta_no = "2116" or
|
|
arr_cuenta1[curr].cuenta_no = "2114" THEN
|
|
FOR idx = 1 TO arr_count()
|
|
CASE
|
|
WHEN arr_cuenta1[curr].cuenta_no = "2113-01"
|
|
IF arr_cuenta1[idx].cuenta_no = "2116" or
|
|
arr_cuenta1[idx].cuenta_no = "2114" THEN
|
|
LET numero_msg = 208
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
EXIT CASE
|
|
WHEN arr_cuenta1[curr].cuenta_no = "2116"
|
|
IF arr_cuenta1[idx].cuenta_no = "2113-01" or
|
|
arr_cuenta1[idx].cuenta_no = "2114" THEN
|
|
LET numero_msg = 208
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
EXIT CASE
|
|
WHEN arr_cuenta1[curr].cuenta_no = "2113-01"
|
|
IF arr_cuenta1[idx].cuenta_no = "2116" or
|
|
arr_cuenta1[idx].cuenta_no = "2114" THEN
|
|
|
|
LET numero_msg = 208
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
EXIT CASE
|
|
END CASE
|
|
END FOR
|
|
END IF
|
|
|
|
IF p_nivel < 3 THEN
|
|
LET numero_msg = 175
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
|
|
IF acept_dpto = "S" THEN
|
|
NEXT FIELD departamento
|
|
ELSE
|
|
LET arr_cuenta1[curr].departamento = null
|
|
DISPLAY arr_cuenta1[curr].departamento TO s_cuenta[scr_l].departamento
|
|
END IF
|
|
IF p_cata = "S" THEN
|
|
NEXT FIELD cod_aux
|
|
ELSE
|
|
LET arr_cuenta1[curr].cod_aux = null
|
|
LET arr_cuenta1[curr].cod_sec = null
|
|
DISPLAY arr_cuenta1[curr].cod_aux TO s_cuenta[scr_l].cod_aux
|
|
DISPLAY arr_cuenta1[curr].cod_sec TO s_cuenta[scr_l].cod_sec
|
|
IF p_ref = "S" THEN
|
|
NEXT FIELD num_doc
|
|
ELSE
|
|
LET arr_cuenta1[curr].num_doc = null
|
|
DISPLAY arr_cuenta1[curr].num_doc TO s_cuenta[scr_l].num_doc
|
|
END IF
|
|
NEXT FIELD debito
|
|
END IF
|
|
|
|
END IF
|
|
|
|
AFTER FIELD departamento
|
|
IF arr_cuenta1[curr].cuenta_no is not null THEN
|
|
IF acept_dpto = "S" THEN
|
|
IF arr_cuenta1[curr].departamento is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD departamento
|
|
END IF
|
|
|
|
SELECT a.nom_dpto INTO nombre_dpto FROM adtb00001 a
|
|
WHERE a.departamento = arr_cuenta1[curr].departamento and
|
|
a.status_t is null
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD departamento
|
|
END IF
|
|
DISPLAY BY NAME nombre_dpto ATTRIBUTE(BLUE)
|
|
ELSE
|
|
LET arr_cuenta1[curr].departamento = null
|
|
DISPLAY arr_cuenta1[curr].departamento TO s_cuenta[scr_l].departamento
|
|
IF p_cata = "S" THEN
|
|
NEXT FIELD cod_aux
|
|
ELSE
|
|
IF p_ref = "S" THEN
|
|
NEXT FIELD num_doc
|
|
END IF
|
|
END IF
|
|
END IF
|
|
END IF
|
|
NEXT FIELD debito
|
|
BEFORE FIELD cod_aux
|
|
IF p_cata != "S" THEN
|
|
LET arr_cuenta1[curr].cod_aux = null
|
|
LET arr_cuenta1[curr].cod_sec = null
|
|
DISPLAY arr_cuenta1[curr].cod_aux TO s_cuenta[scr_l].cod_aux
|
|
DISPLAY arr_cuenta1[curr].cod_sec TO s_cuenta[scr_l].cod_sec
|
|
NEXT FIELD num_doc
|
|
END IF
|
|
|
|
AFTER FIELD cod_aux
|
|
IF arr_cuenta1[curr].cuenta_no is not null THEN
|
|
IF p_cata = "S" THEN
|
|
IF arr_cuenta1[curr].cod_aux is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_aux
|
|
END IF
|
|
ELSE
|
|
LET arr_cuenta1[curr].cod_aux = null
|
|
LET arr_cuenta1[curr].cod_sec = null
|
|
DISPLAY arr_cuenta1[curr].cod_aux TO s_cuenta[scr_l].cod_aux
|
|
DISPLAY arr_cuenta1[curr].cod_sec TO s_cuenta[scr_l].cod_sec
|
|
NEXT FIELD num_doc
|
|
END IF
|
|
END IF
|
|
|
|
AFTER FIELD cod_sec
|
|
IF arr_cuenta1[curr].cuenta_no is not null THEN
|
|
IF p_cata = "S" THEN
|
|
IF arr_cuenta1[curr].cod_sec is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_aux
|
|
END IF
|
|
|
|
IF arr_cuenta1[curr].cod_aux != 1 THEN
|
|
SELECT a.nom_sp INTO nombre_cata FROM cotb00001 a
|
|
WHERE a.cod_sp = arr_cuenta1[curr].cod_aux AND
|
|
a.cod_sp_sec = arr_cuenta1[curr].cod_sec
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_aux
|
|
END IF
|
|
DISPLAY BY NAME nombre_cata ATTRIBUTE(BLUE)
|
|
END IF
|
|
|
|
IF arr_cuenta1[curr].cod_aux = 1 THEN
|
|
SELECT nom1_emp,apell1_emp,departamento,nomina INTO nombre_cata
|
|
FROM adtb00003
|
|
WHERE num_emp = arr_cuenta1[curr].cod_sec
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_aux
|
|
END IF
|
|
DISPLAY BY NAME nombre_cata
|
|
IF p_ref = "S" THEN
|
|
NEXT FIELD num_doc
|
|
ELSE
|
|
LET arr_cuenta1[curr].num_doc = null
|
|
DISPLAY arr_cuenta1[curr].num_doc TO s_cuenta[scr_l].num_doc
|
|
|
|
NEXT FIELD debito
|
|
END IF
|
|
END IF
|
|
END IF
|
|
END IF
|
|
|
|
BEFORE FIELD num_doc
|
|
IF p_ref != "S" THEN
|
|
NEXT FIELD debito
|
|
END IF
|
|
|
|
AFTER FIELD num_doc
|
|
IF arr_cuenta1[curr].cuenta_no is not null THEN
|
|
IF p_ref = "S" THEN
|
|
IF arr_cuenta1[curr].num_doc IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num_doc
|
|
END IF
|
|
ELSE
|
|
LET arr_cuenta1[curr].num_doc = null
|
|
DISPLAY arr_cuenta1[curr].num_doc TO s_cuenta[scr_l].num_doc
|
|
END IF
|
|
END IF
|
|
|
|
AFTER FIELD debito
|
|
|
|
IF arr_cuenta1[curr].debito is not null or
|
|
arr_cuenta1[curr].debito != 0 THEN
|
|
|
|
IF arr_cuenta1[curr].debito != 0 THEN
|
|
IF arr_cuenta1[curr].cuenta_no is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
END IF
|
|
|
|
END IF
|
|
|
|
AFTER ROW
|
|
IF arr_cuenta1[curr].cuenta_no is not null THEN
|
|
IF arr_cuenta1[curr].debito = 0 and
|
|
arr_cuenta1[curr].credito = 0 THEN
|
|
LET numero_msg = 207
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
END IF
|
|
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
CLEAR FORM
|
|
RETURN
|
|
END IF
|
|
IF valor_f is null THEN
|
|
LET valor_f = 0
|
|
END IF
|
|
IF arr_cuenta1[curr].debito is not null THEN
|
|
IF arr_cuenta1[curr].cuenta_no is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
END IF
|
|
|
|
IF arr_cuenta1[curr].credito is not null THEN
|
|
IF arr_cuenta1[curr].cuenta_no is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
END IF
|
|
# Controla que las facturas digitadas en el arreglo de cuentas por pagar
|
|
# sumen el mismo monto que las cuentas digitadas en contabilidad
|
|
IF recibo.cod_sp_sec is not null THEN
|
|
IF opcion = "S" THEN
|
|
LET valor_cxp = 0
|
|
LET chequea = "N"
|
|
FOR idx = 1 TO arr_count()
|
|
IF arr_cuenta1[idx].cuenta_no is not null THEN
|
|
IF arr_cuenta1[curr].cuenta_no = "2113-01" or
|
|
arr_cuenta1[curr].cuenta_no = "2116" or
|
|
arr_cuenta1[curr].cuenta_no = "2114" THEN
|
|
LET chequea = "S"
|
|
LET valor_cxp = valor_cxp + arr_cuenta1[idx].debito
|
|
END IF
|
|
END IF
|
|
END FOR
|
|
|
|
IF chequea = "S" THEN
|
|
IF valor_f != valor_cxp THEN
|
|
LET numero_msg = 206
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD debito
|
|
END IF
|
|
END IF
|
|
|
|
# Controla las cuentas por pagar si se digito una cuenta perteneciente
|
|
# a las cuentas por pagar y no se le dice al programa que no afecta
|
|
# las cuentas por pagar
|
|
LET ctrl_cxp = "N"
|
|
FOR idx = 1 TO arr_count()
|
|
IF arr_cuenta1[idx].cuenta_no is not null THEN
|
|
IF opcion = "S" THEN
|
|
IF arr_cuenta1[idx].cuenta_no = "2113-01" THEN
|
|
LET ctrl_cxp = "S"
|
|
END IF
|
|
IF arr_cuenta1[idx].cuenta_no = "2116" THEN
|
|
LET ctrl_cxp = "S"
|
|
END IF
|
|
IF arr_cuenta1[idx].cuenta_no = "2114" THEN
|
|
LET ctrl_cxp = "S"
|
|
END IF
|
|
END IF
|
|
END IF
|
|
END FOR
|
|
|
|
IF ctrl_cxp = "N" THEN
|
|
LET numero_msg = 210
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
END IF
|
|
|
|
# Controla las cuentas por cobrar si se digito una cuenta perteneciente
|
|
# a las cuentas por cobrar y no se le dice al programa que no afecta
|
|
# las cuentas por cobrar
|
|
LET ctrl_cxp = "N"
|
|
FOR idx = 1 TO arr_count()
|
|
IF arr_cuenta1[idx].cuenta_no is not null THEN
|
|
IF opcion is null or opcion = "N" THEN
|
|
IF arr_cuenta1[idx].cuenta_no = "2113-01" or
|
|
arr_cuenta1[idx].cuenta_no = "2116" or
|
|
arr_cuenta1[idx].cuenta_no = "2114" THEN
|
|
LET ctrl_cxp = "S"
|
|
END IF
|
|
END IF
|
|
END IF
|
|
END FOR
|
|
|
|
IF ctrl_cxp = "S" THEN
|
|
LET numero_msg = 209
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
END IF
|
|
|
|
LET tiene_cta = "N"
|
|
FOR idx = 1 TO arr_cuenta1.getLength()
|
|
IF arr_cuenta1[idx].cuenta_no is not null THEN
|
|
LET tiene_cta = "S"
|
|
END IF
|
|
END FOR
|
|
IF tiene_cta = "N" THEN
|
|
LET numero_msg = 84
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
|
|
LET monto = 0
|
|
LET valor = 0
|
|
|
|
FOR idx = 1 TO arr_cuenta1.getLength()
|
|
IF arr_cuenta1[idx].debito is null THEN
|
|
LET arr_cuenta1[idx].debito = 0
|
|
END IF
|
|
|
|
IF arr_cuenta1[idx].credito is null THEN
|
|
LET arr_cuenta1[idx].credito = 0
|
|
END IF
|
|
|
|
LET valor = valor + arr_cuenta1[idx].debito
|
|
LET monto = arr_cuenta1[idx].credito + monto
|
|
END FOR
|
|
LET xdebito = valor
|
|
LET xcredito = monto+recibo.monto
|
|
DISPLAY BY NAME xdebito,xcredito
|
|
LET monto = valor - monto
|
|
|
|
IF monto != recibo.monto THEN
|
|
LET numero_msg = 178
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD debito
|
|
END IF
|
|
END INPUT
|
|
|
|
IF sale_arr = "S" THEN
|
|
GOTO arr2
|
|
END IF
|
|
|
|
|
|
|
|
PROMPT "Toda la Informacion Esta Correcta (S/N) ?" FOR char opc
|
|
LET opc = upshift(opc)
|
|
LET limpia = "N"
|
|
IF opc = "S" THEN
|
|
LET limpia = "S"
|
|
|
|
# busca el numero secuencial
|
|
SELECT a.cheque_no INTO recibo.numero FROM cgtb00012 a
|
|
WHERE a.cuenta_no = recibo.cuenta_p AND a.tipo_Doc = recibo.tipo_doc
|
|
IF STATUS = NOTFOUND THEN
|
|
INSERT INTO cgtb00012 (cuenta_no,cheque_no,tipo_Doc,us_crea,fech_crea)
|
|
VALUES (recibo.cuenta_p,0,recibo.tipo_doc,usuarios,getdate())
|
|
LET recibo.numero =0
|
|
END IF
|
|
LET numero1 = recibo.numero +1
|
|
BEGIN WORK
|
|
|
|
UPDATE cgtb00012 SET cheque_no = numero1
|
|
WHERE tipo_Doc = recibo.tipo_doc AND cuenta_no = recibo.cuenta_p AND tipo_Doc = recibo.tipo_doc
|
|
|
|
DISPLAY numero1 TO numero
|
|
|
|
# Actualizacion de las tablas de cuentas por pagar y contabilidad general
|
|
IF recibo.cod_sp > 1 THEN
|
|
IF opcion = "S" THEN
|
|
LET opcion = NULL
|
|
LET imp_cxp = TRUE
|
|
IF arr_Recibo.getLength() > 0 THEN
|
|
FOR idx = 1 to ins_cp
|
|
IF arr_recibo[idx].valor_pag <> 0 and
|
|
arr_recibo[idx].valor_pag is not null THEN
|
|
|
|
##### Proceso para insertar valores en cuentas por pagar
|
|
IF arr_recibo[idx].valor_pag > 0 THEN
|
|
LET arr_recibo[idx].valor_pag = arr_recibo[idx].valor_pag * -1
|
|
END IF
|
|
|
|
IF arr_recibo[idx].aplica_a IS NOT NULL THEN
|
|
|
|
INSERT INTO cptb00001
|
|
(tipo_doc
|
|
,num_doc
|
|
,cod_sp
|
|
,cod_sp_sec
|
|
,fecha_orig
|
|
,fecha_proc
|
|
,orden_no
|
|
,tipo
|
|
,aplica_a
|
|
,cta_ctble
|
|
,valor
|
|
,detalle
|
|
,us_crea
|
|
,fech_crea
|
|
)
|
|
|
|
values (tipo_doc1,numero1,
|
|
recibo.cod_sp,recibo.cod_sp_sec,recibo.fecha,recibo.fecha,
|
|
arr_recibo[idx].orden_no,
|
|
arr_recibo[idx].tipo,arr_recibo[idx].aplica_a,recibo.cuenta_p,
|
|
arr_recibo[idx].valor_pag,detalle_1,usuarios,GETDATE())
|
|
|
|
END IF
|
|
|
|
|
|
IF arr_recibo[idx].aplica_a is not null THEN
|
|
IF idx < 6 THEN
|
|
LET factura1 = arr_recibo[idx].aplica_a CLIPPED
|
|
LET facturas = facturas CLIPPED,",",factura1 CLIPPED
|
|
END IF
|
|
END IF
|
|
|
|
IF arr_recibo[idx].orden_no is not null AND
|
|
arr_recibo[idx].orden_no != 999999 THEN
|
|
IF idx < 10 THEN
|
|
LET orden1 = arr_recibo[idx].orden_no USING "######"
|
|
LET ordenes = ordenes CLIPPED,",",orden1 CLIPPED
|
|
END IF
|
|
END IF
|
|
END IF
|
|
END FOR
|
|
ELSE
|
|
LET imp_cxp = FALSE
|
|
|
|
END IF
|
|
END IF
|
|
END IF
|
|
|
|
# Actualizacion de la tabla transacciones de contabildad general
|
|
LET referencia = recibo.tipo_doc,numero1 using "&&&&&&"
|
|
FOR idx = 1 TO arr_cuenta1.getLength()
|
|
IF arr_cuenta1[idx].cuenta_no is not null THEN
|
|
IF arr_recibo[idx].orden_no is not null THEN
|
|
LET refe[idx] = arr_recibo[idx].orden_no
|
|
END IF
|
|
|
|
IF arr_recibo[idx].orden_no is not null THEN
|
|
LET refe[idx] = arr_recibo[idx].tipo using "&&","-",
|
|
arr_recibo[idx].aplica_a using "&&&&&&"
|
|
END IF
|
|
|
|
IF arr_recibo[idx].aplica_a is not null THEN
|
|
LET refe[idx] = arr_recibo[idx].aplica_a
|
|
END IF
|
|
LET detalle_2 = xcomentario CLIPPED," ",recibo.cuenta_p," ",recibo.tasa using "##.##"
|
|
|
|
|
|
INSERT INTO cgtb00004 (fecha,tipo,ref,cuenta_no,departamento,num_doc,cod_aux,cod_sec,detalles,
|
|
detalle_1,detalle_2,debito,credito,us_crea,fech_crea )
|
|
|
|
values (recibo.fecha,3,referencia,
|
|
arr_cuenta1[idx].cuenta_no,arr_cuenta1[idx].departamento,
|
|
arr_cuenta1[idx].num_doc,arr_cuenta1[idx].cod_aux,
|
|
arr_cuenta1[idx].cod_sec,recibo.cuenta_p,recibo.nom_sup,detalle_2,
|
|
arr_cuenta1[idx].debito,
|
|
arr_cuenta1[idx].credito,usuarios,GETDATE())
|
|
|
|
END IF
|
|
|
|
END FOR
|
|
# Inserta los registros necesarios para la tabla de tesoreria
|
|
IF recibo.codigo IS NOT NULL THEN
|
|
|
|
|
|
INSERT INTO tetb00006
|
|
(cheque_no
|
|
,banco
|
|
,codigo
|
|
,us_crea
|
|
,fech_crea
|
|
)
|
|
values (numero1,recibo.cuenta_p,
|
|
recibo.codigo,usarios,getdate())
|
|
END IF
|
|
#----------------------------------------------------------------------------
|
|
|
|
INSERT INTO cgtb00004(fecha,tipo,ref,cuenta_no,detalles,detalle_1,detalle_2,debito,credito,us_crea,fech_crea)
|
|
values (recibo.fecha,3,referencia,
|
|
recibo.cuenta_p,recibo.cuenta_p,recibo.nom_sup,detalle_2,0,recibo.monto,
|
|
usuarios,GETDATE())
|
|
|
|
INSERT INTO cgtb00005 (cuenta_no,cheque_no,fecha,tipo_doc,portador,monto,cod_sp,cod_sp_sec,tasa,us_crea,fech_crea,comentario,solicitud)
|
|
VALUES (recibo.cuenta_p,numero1,recibo.fecha,recibo.tipo_doc,recibo.nom_sup,recibo.monto,recibo.cod_sp,recibo.cod_sp_sec,
|
|
recibo.tasa,usuarios,getdate(),xcomentario,numdoc)
|
|
DISPLAY "numdoc ",numdoc
|
|
UPDATE cgtb00040
|
|
SET usada="S"
|
|
WHERE @numdoc=numdoc
|
|
COMMIT WORK
|
|
LET idx = idx + 1
|
|
LET arr_cuenta1[idx].cuenta_no = recibo.cuenta_p
|
|
LET arr_cuenta1[idx].nom_cuenta = p_descripcion
|
|
LET arr_cuenta1[idx].debito = 0
|
|
LET arr_cuenta1[idx].credito = recibo.monto
|
|
|
|
LET r_filename ="cgprmt017.4rp"
|
|
LET r_output = "SVG"
|
|
#LET preview = 1
|
|
|
|
-- configure report engine; the functions prefixed fgl that are called here are part of the GRW API
|
|
IF fgl_report_loadCurrentSettings(r_filename) THEN -- load the .4rp file
|
|
CALL fgl_report_selectDevice(r_output) -- changing default
|
|
IF preview = 0 THEN
|
|
CALL fgl_report_selectPreview(1) -- changing default
|
|
CALL fgl_report_configureSVGPreview("PrintOnDefaultPrinter")
|
|
ELSE
|
|
CALL fgl_report_selectPreview(preview)
|
|
END if
|
|
|
|
LET handler = fgl_report_commitCurrentSettings() -- commit changes
|
|
ELSE
|
|
EXIT PROGRAM
|
|
END IF
|
|
|
|
START REPORT transferencia TO XML HANDLER handler
|
|
|
|
FOR idx = 1 TO arr_cuenta1.getLength()
|
|
IF arr_cuenta1[idx].cuenta_no IS NOT NULL THEN
|
|
OUTPUT TO REPORT transferencia(idx,referencia,arr_cuenta1[idx].cuenta_no,arr_cuenta1[idx].departamento,
|
|
arr_cuenta1[idx].cod_aux,arr_cuenta1[idx].cod_sec,arr_cuenta1[idx].num_doc,
|
|
arr_cuenta1[idx].debito,arr_cuenta1[idx].credito,xcomentario)
|
|
END IF
|
|
END FOR
|
|
FINISH REPORT transferencia
|
|
|
|
LET numero_msg = 1
|
|
CALL msg(numero_msg)
|
|
CLEAR FORM
|
|
CALL arr_cuenta1.clear()
|
|
END IF
|
|
IF opc = "N" THEN
|
|
GOTO volver
|
|
ELSE
|
|
GOTO volver1
|
|
END IF
|
|
|
|
END FUNCTION
|
|
|
|
FUNCTION cgprmd017()
|
|
CLEAR FORM
|
|
{
|
|
CONSTRUCT criterio ON a.ref[4,8],a.cuenta_no
|
|
FROM numero,cuenta_p
|
|
}
|
|
INITIALIZE recibo.* TO NULL
|
|
CONSTRUCT criterio ON a.cheque_no,a.portador,a.cuenta_no,a.fecha,a.tipo_Doc
|
|
FROM numero,nom_sup,cuenta_p,fecha,tipo_doc
|
|
|
|
LET selec_p =
|
|
"SELECT a.tipo_doc,a.cuenta_no,a.cheque_no,a.cod_sp,a.cod_sp_sec,a.portador,",
|
|
" CONVERT(CHAR(10),a.fecha,103),a.tasa,a.monto,c.codigo,b.descripcion,a.us_crea,a.fech_crea,a.comentario,a.solicitud ",
|
|
"FROM cgtb00005 a LEFT OUTER JOIN tetb00006 c ON a.cheque_no = c.cheque_no AND a.cuenta_no = c.banco ",
|
|
" LEFT OUTER JOIN tetb00003 b ON c.codigo = b.codigo ",
|
|
"WHERE a.status_t IS NULL AND ", criterio CLIPPED,
|
|
" ORDER BY a.tipo_Doc,a.cuenta_no "
|
|
|
|
PREPARE comando FROM selec_p
|
|
DECLARE accion5 SCROLL CURSOR FOR comando
|
|
OPEN accion5
|
|
|
|
FETCH FIRST accion5 INTO recibo.*,p_descrip,usuario,fecha_crea,xcomentario,numdoc
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
RETURN
|
|
END IF
|
|
LET referencia = recibo.tipo_doc CLIPPED,".",recibo.numero using "&&&&&&"
|
|
|
|
|
|
LET referencia = recibo.tipo_doc CLIPPED,".",recibo.numero USING "&&&&&&"
|
|
SELECT MAX(a.detalle_1),MAX(a.detalle_2) INTO detalle_1,detalle_2
|
|
FROM cgtb00004 a
|
|
WHERE a.ref = referencia AND a.status_t IS NULL AND
|
|
a.detalles = recibo.cuenta_p
|
|
|
|
DISPLAY BY NAME recibo.*,xcomentario,numdoc
|
|
|
|
MENU "Consulta"
|
|
COMMAND "Primero"
|
|
FETCH FIRST accion5 INTO recibo.*,p_descrip,usuario,fecha_crea,xcomentario,numdoc
|
|
|
|
|
|
LET referencia = recibo.tipo_doc,recibo.numero USING "&&&&&&"
|
|
SELECT UNIQUE a.detalle_1,a.detalle_2 INTO detalle_1,detalle_2
|
|
FROM cgtb00004 a
|
|
WHERE a.ref = referencia AND a.status_t IS NULL AND
|
|
a.detalles = recibo.cuenta_p
|
|
|
|
DISPLAY BY NAME recibo.*,p_descrip,xcomentario,numdoc
|
|
LET numero_msg = 5
|
|
CALL msg(numero_msg)
|
|
|
|
COMMAND "Siguiente"
|
|
FETCH NEXT accion5 INTO recibo.*,p_descrip,usuario,fecha_crea,xcomentario,numdoc
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 4
|
|
CALL msg(numero_msg)
|
|
END IF
|
|
|
|
|
|
LET referencia = recibo.tipo_doc,recibo.numero USING "&&&&&&"
|
|
SELECT UNIQUE a.detalle_1,a.detalle_2
|
|
INTO detalle_1,detalle_2
|
|
FROM cgtb00004 a
|
|
WHERE a.ref = referencia AND a.status_t IS NULL AND
|
|
a.detalles = recibo.cuenta_p
|
|
|
|
DISPLAY BY NAME recibo.*,p_descrip,usuario,fecha_crea,xcomentario,numdoc
|
|
|
|
COMMAND "Anterior"
|
|
FETCH PREVIOUS accion5 INTO recibo.*,p_descrip,usuario,fecha_crea,xcomentario,numdoc
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 5
|
|
CALL msg(numero_msg)
|
|
END IF
|
|
|
|
|
|
LET referencia = recibo.tipo_doc,recibo.numero USING "&&&&&&"
|
|
SELECT UNIQUE a.detalle_1,a.detalle_2
|
|
INTO detalle_1,detalle_2
|
|
FROM cgtb00004 a
|
|
WHERE a.ref = referencia AND a.status_t IS NULL AND
|
|
a.detalles = recibo.cuenta_p
|
|
|
|
DISPLAY BY NAME recibo.*,p_descrip,usuario,fecha_crea,xcomentario,numdoc
|
|
|
|
COMMAND "Ultimo"
|
|
FETCH LAST accion5 INTO recibo.*,p_descrip,usuario,fecha_crea,xcomentario,numdoc
|
|
|
|
LET referencia = recibo.tipo_doc,recibo.numero USING "&&&&&&"
|
|
SELECT UNIQUE a.detalle_1,a.detalle_2
|
|
INTO detalle_1,detalle_2
|
|
FROM cgtb00004 a
|
|
WHERE a.ref = referencia AND a.status_t IS NULL AND
|
|
a.detalles = recibo.cuenta_p
|
|
|
|
DISPLAY BY NAME recibo.*,p_descrip,usuario,fecha_crea
|
|
|
|
LET numero_msg = 4
|
|
CALL msg(numero_msg)
|
|
COMMAND "Visualizar"
|
|
CALL info_tr()
|
|
COMMAND "Escoger"
|
|
"Presione ESC Para Grabar Ctrl-C Cancela Ctrl-F Moverse Sobre Pantalla"
|
|
|
|
LET p_fechas = recibo.fecha
|
|
CALL prd(p_fechas,usuarios) RETURNING bandera
|
|
IF bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
END IF
|
|
LABEL vuelve10:
|
|
{
|
|
INPUT BY NAME recibo.*,xcomentario,preview WITHOUT DEFAULTS
|
|
AFTER FIELD codigo
|
|
IF recibo.codigo IS NOT NULL THEN
|
|
SELECT a.descripcion INTO p_descrip
|
|
FROM tetb00003 a
|
|
WHERE a.codigo = recibo.codigo
|
|
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD codigo
|
|
END IF
|
|
DISPLAY BY NAME p_descrip
|
|
END IF
|
|
AFTER FIELD monto
|
|
IF recibo.monto is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD monto
|
|
END IF
|
|
|
|
AFTER FIELD cuenta_p
|
|
IF recibo.cuenta_p is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_p
|
|
END IF
|
|
SELECT a.cheque_no INTO numero FROM cgtb00012 a
|
|
WHERE cuenta_no = recibo.cuenta_p AND tipo_doc = recibo.tipo_doc
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 205
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_p
|
|
END IF
|
|
DISPLAY BY NAME recibo.numero
|
|
AFTER FIELD cod_sp_sec
|
|
|
|
##### Selecionando datos referentes al suplidor
|
|
IF recibo.cod_sp_sec is not null THEN
|
|
IF recibo.cod_sp != 1 THEN
|
|
SELECT a.nom_sp INTO recibo.nom_sup FROM cotb00001 a
|
|
WHERE a.cod_sp = recibo.cod_sp AND
|
|
a.cod_sp_sec = recibo.cod_sp_sec
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_sp
|
|
END IF
|
|
|
|
DISPLAY BY NAME recibo.cod_sp,recibo.cod_sp_sec,recibo.nom_sup
|
|
NEXT FIELD nom_sup
|
|
END IF
|
|
END IF
|
|
|
|
IF recibo.cod_sp = 1 THEN
|
|
SELECT nom1_emp,apell1_emp,departamento,nomina
|
|
INTO nombre_emp,apellido_emp,depto,tipo_d FROM adtb00003
|
|
WHERE num_emp = recibo.cod_sp_sec
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_sp_sec
|
|
END IF
|
|
|
|
LET recibo.nom_sup = nombre_emp clipped," ",apellido_emp clipped
|
|
DISPLAY BY NAME recibo.nom_sup
|
|
END IF
|
|
|
|
|
|
AFTER FIELD fecha
|
|
IF recibo.fecha is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD fecha
|
|
END IF
|
|
|
|
LET p_fechas = recibo.fecha
|
|
CALL prd(p_fechas,usuarios) RETURNING bandera
|
|
IF bandera = 1 THEN
|
|
LET bandera = 0
|
|
NEXT FIELD fecha
|
|
END IF
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
RETURN
|
|
END IF
|
|
CALL arr_recibo.clear()
|
|
EXIT INPUT
|
|
END INPUT
|
|
|
|
####### Creando la facilidad para cancelar proceso mediante DELETE o SUPR
|
|
|
|
LET numero1 = recibo.numero USING "<<<<<<<"
|
|
|
|
DECLARE buscara CURSOR FOR
|
|
SELECT b.tipo,b.orden_no,b.aplica_a,b.valor*-1,b.valor*-1
|
|
FROM cptb00001 b
|
|
WHERE b.status_t IS NULL AND b.num_doc = numero1 AND
|
|
b.tipo_doc = recibo.tipo_doc AND
|
|
b.cta_ctble = recibo.cuenta_p
|
|
|
|
LET idx = 1
|
|
LET i = 0
|
|
FOREACH buscara INTO arr_recibo[idx].*
|
|
LET arr_recibo[idx].valor_pen = 0
|
|
LET idx = idx + 1
|
|
LET i = i + 1
|
|
END FOREACH
|
|
CALL SET_COUNT(idx -1)
|
|
|
|
IF i = 0 THEN
|
|
LET existe = "N"
|
|
END IF
|
|
|
|
IF recibo.cod_sp_sec is not null THEN
|
|
LABEL vuelta1:
|
|
PROMPT "Afecta Cuentas Por Pagar?(S/N) " FOR CHAR opcion
|
|
LET opcion = upshift(opcion)
|
|
|
|
IF opcion != "S" AND
|
|
opcion != "N" THEN
|
|
LET numero_msg = -1301
|
|
CALL msg(numero_msg)
|
|
GOTO vuelta1
|
|
END IF
|
|
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
CLEAR FORM
|
|
RETURN
|
|
END IF
|
|
|
|
IF opcion = "N" THEN
|
|
CALL arr_recibo.clear()
|
|
LET valor_f = 0
|
|
|
|
END IF
|
|
|
|
LABEL arr10:
|
|
IF opcion = "N" THEN
|
|
GOTO arr2
|
|
END IF
|
|
|
|
IF opcion = "S" THEN
|
|
#LET sale_arr = "N"
|
|
INPUT ARRAY arr_recibo WITHOUT DEFAULTS FROM s_recibo.*
|
|
ON KEY (CONTROL-F)
|
|
LET opc = "N"
|
|
LET sale_arr = "S"
|
|
EXIT INPUT
|
|
|
|
ON ACTION busca_aplicacion
|
|
LET curr = arr_curr()
|
|
LET scr_l = scr_line()
|
|
|
|
###### Proceso para abrir window en caso de desconocer el numero de orden
|
|
###### perteneciente a la factura que se aplicara el pago.
|
|
CALL busca_aplicacion(recibo.cod_sp,recibo.cod_sp_sec) RETURNING arr_recibo[curr].aplica_a,arr_recibo[curr].valor_pen
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = false
|
|
NEXT FIELD aplica_a
|
|
END IF
|
|
IF existe = "N" THEN
|
|
LET existe = "S"
|
|
NEXT FIELD aplica_a
|
|
END IF
|
|
|
|
DISPLAY arr_recibo[curr].aplica_a to s_recibo[scr_l].aplica_a
|
|
DISPLAY arr_recibo[curr].valor_pen to s_recibo[scr_l].valor_pen
|
|
LET arr_recibo[curr].valor_pag = arr_recibo[curr].valor_pen
|
|
DISPLAY arr_recibo[curr].valor_pag to s_recibo[scr_l].valor_pag
|
|
NEXT FIELD valor_pag
|
|
LET verdad = "N"
|
|
CALL repetir1()
|
|
IF verdad = "S" THEN
|
|
NEXT FIELD aplica_a
|
|
END IF
|
|
|
|
BEFORE ROW
|
|
LET curr = arr_curr()
|
|
LET scr_l = scr_line()
|
|
|
|
AFTER FIELD orden_no
|
|
IF arr_recibo[curr].orden_no != 999999 THEN #IS NOT NULL THEN
|
|
IF recibo.cod_sp IS NULL THEN
|
|
|
|
##### Chequeando que el numero de orden a digitar exista en la maestra de pago[
|
|
|
|
SELECT UNIQUE a.tipo,a.orden_no,a.cod_sp,a.cod_sp_sec
|
|
INTO p_tipo,p_orden,recibo.cod_sp,recibo.cod_sp_sec
|
|
FROM cptb00001 a WHERE a.tipo = arr_recibo[curr].tipo AND
|
|
a.orden_no = arr_recibo[curr].orden_no
|
|
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD tipo
|
|
END IF
|
|
|
|
ELSE
|
|
|
|
###### Chequeando que el numero de orden exista en la maestra de orden
|
|
|
|
SELECT b.num_oc
|
|
FROM cotb00014 b WHERE b.tipo = arr_recibo[curr].tipo AND
|
|
b.num_oc = arr_recibo[curr].orden_no AND
|
|
b.cod_sp = recibo.cod_sp AND
|
|
b.cod_sp_sec = recibo.cod_sp_sec
|
|
|
|
IF STATUS = NOTFOUND THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD tipo
|
|
END IF
|
|
END IF
|
|
ELSE
|
|
IF recibo.tipo_doc = "CP" THEN
|
|
LET arr_recibo[curr].tipo = "99"
|
|
NEXT FIELD valor_pag
|
|
END IF
|
|
END IF
|
|
|
|
AFTER FIELD aplica_a
|
|
IF arr_recibo[curr].orden_no is not null AND
|
|
arr_recibo[curr].aplica_a IS NULL THEN
|
|
LET tipo_doc1= "CP"
|
|
# LET nom_tipo = "PAGO ADELANTADO"
|
|
# DISPLAY BY NAME nom_tipo,recibo.tipo_doc attribute (bold)
|
|
ELSE
|
|
LET tipo_doc1 = recibo.tipo_doc
|
|
END IF
|
|
|
|
IF arr_recibo[curr].aplica_a IS NOT NULL THEN
|
|
IF recibo.cod_sp != 1 THEN
|
|
IF recibo.tipo_doc = "CP" THEN
|
|
IF arr_recibo[curr].orden_no IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD orden_no
|
|
ELSE
|
|
NEXT FIELD valor_pag
|
|
END IF
|
|
END IF
|
|
|
|
IF arr_recibo[curr].aplica_a IS NOT NULL THEN
|
|
# LET arr_recibo[curr].orden_no = null
|
|
# LET arr_recibo[curr].tipo = null
|
|
LET verdad = "N"
|
|
CALL repetir1()
|
|
IF verdad = "S" THEN
|
|
NEXT FIELD aplica_a
|
|
END IF
|
|
|
|
# Controla que la factura pertenezca al suplidor
|
|
|
|
SELECT a.tipo,a.orden_no,a.valor
|
|
INTO arr_recibo[curr].tipo,arr_recibo[curr].orden_no,valor_fac
|
|
FROM cptb00001 a
|
|
WHERE a.num_doc = arr_recibo[curr].aplica_a AND
|
|
a.cod_sp=recibo.cod_sp AND a.cod_sp_sec=recibo.cod_sp_sec
|
|
AND a.tipo_doc = "FT" AND a.status_t is null
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 126
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD aplica_a
|
|
END IF
|
|
|
|
# Busca el valor pendiente de la factura
|
|
LET valor_fac1 = 0
|
|
SELECT sum(a.valor) INTO valor_fac1 FROM cptb00001 a
|
|
WHERE a.cod_sp=recibo.cod_sp AND a.cod_sp_sec=recibo.cod_sp_sec
|
|
AND a.aplica_a = arr_recibo[curr].aplica_a
|
|
AND a.status_t IS NULL
|
|
|
|
IF valor_fac1 IS NULL THEN
|
|
LET valor_fac1 = 0
|
|
END IF
|
|
|
|
IF valor_fac IS NULL THEN
|
|
LET valor_fac = 0
|
|
END IF
|
|
|
|
####### Calculando el valor pendiente de la factura
|
|
|
|
LET arr_recibo[curr].valor_pen = valor_fac1
|
|
# LET arr_recibo[curr].valor_pag = arr_recibo[curr].valor_pen
|
|
|
|
# DISPLAY arr_recibo[curr].valor_pag to s_recibo[scr_l].valor_pag
|
|
DISPLAY arr_recibo[curr].valor_pen to s_recibo[scr_l].valor_pen
|
|
END IF
|
|
END IF
|
|
END IF
|
|
|
|
AFTER FIELD valor_pag
|
|
IF recibo.tipo_doc = "CP" THEN
|
|
IF arr_recibo[curr].orden_no IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD orden_no
|
|
END IF
|
|
END IF
|
|
|
|
IF arr_recibo[curr].aplica_a IS NOT NULL AND
|
|
arr_recibo[curr].valor_pen IS NOT NULL THEN
|
|
LET verdad = "N"
|
|
CALL repetir1()
|
|
IF verdad = "S" THEN
|
|
NEXT FIELD aplica_a
|
|
END IF
|
|
END IF
|
|
|
|
IF arr_recibo[curr].valor_pag IS NULL THEN
|
|
LET arr_recibo[curr].valor_pag = 0
|
|
END IF
|
|
|
|
IF arr_recibo[curr].aplica_a is not null THEN
|
|
IF arr_recibo[curr].valor_pag = 0 THEN
|
|
LET numero_msg = 207
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD valor_pag
|
|
END IF
|
|
END IF
|
|
|
|
IF arr_recibo[curr].aplica_a is not null THEN
|
|
IF arr_recibo[curr].valor_pag = 0 THEN
|
|
LET numero_msg = 207
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD valor_pag
|
|
END IF
|
|
END IF
|
|
|
|
LET valor_f = 0
|
|
FOR idx = 1 TO arr_count()
|
|
IF arr_recibo[idx].valor_pag is null THEN
|
|
LET arr_recibo[idx].valor_pag = 0
|
|
END IF
|
|
LET valor_f = arr_recibo[idx].valor_pag + valor_f
|
|
LET m = idx
|
|
END FOR
|
|
LET remanente = recibo.monto - valor_f
|
|
DISPLAY BY NAME remanente attribute (bold)
|
|
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = false
|
|
RETURN
|
|
END IF
|
|
|
|
LET valor_f = 0
|
|
FOR idx = 1 TO arr_count()
|
|
IF arr_recibo[idx].valor_pag is null THEN
|
|
LET arr_recibo[idx].valor_pag = 0
|
|
END IF
|
|
LET valor_f = arr_recibo[idx].valor_pag + valor_f
|
|
LET m = idx
|
|
END FOR
|
|
LET remanente = recibo.monto - valor_f
|
|
DISPLAY BY NAME remanente attribute (bold)
|
|
EXIT INPUT
|
|
END INPUT
|
|
END IF
|
|
|
|
IF sale_arr = "S" THEN
|
|
GOTO vuelve10
|
|
END IF
|
|
END IF
|
|
LET m = arr_count()
|
|
LABEL arr2:
|
|
CALL arr_cuenta1.clear()
|
|
|
|
LET referencia = recibo.tipo_doc,recibo.numero USING "&&&&&&"
|
|
DECLARE buscara1 CURSOR FOR
|
|
SELECT c.cuenta_no,c.departamento,c.cod_aux,c.cod_sec,c.num_doc,
|
|
d.descripcion,c.debito,c.credito
|
|
FROM cgtb00004 c,cgtb00001 d
|
|
WHERE c.cuenta_no = d.cuenta_no AND c.ref = referencia AND
|
|
d.status_t IS NULL AND c.cuenta_no NOT IN (recibo.cuenta_p) AND
|
|
c.detalles=recibo.cuenta_p
|
|
|
|
LET idx = 1
|
|
FOREACH buscara1 INTO arr_cuenta1[idx].*
|
|
LET idx = idx + 1
|
|
END FOREACH
|
|
CALL SET_COUNT(idx - 1)
|
|
LABEL err1:
|
|
# Captura de la codificacion del cheque para contabilidad
|
|
INPUT ARRAY arr_cuenta1 WITHOUT DEFAULTS FROM s_cuenta.*
|
|
ON KEY (CONTROL-F)
|
|
LET opc = "N"
|
|
LET sale_Arr = "S"
|
|
EXIT INPUT
|
|
|
|
ON KEY(CONTROL-P)
|
|
NEXT FIELD cuenta_no
|
|
|
|
BEFORE ROW
|
|
LET curr = arr_curr()
|
|
LET scr_l = scr_line()
|
|
|
|
AFTER FIELD cuenta_no
|
|
#LET arr_cuenta1[curr].cod_aux = recibo.cod_sp
|
|
#LET arr_cuenta1[curr].cod_sec = recibo.cod_sp_sec
|
|
DISPLAY arr_cuenta1[curr].cod_aux to s_cuenta[scr_l].cod_aux
|
|
DISPLAY arr_cuenta1[curr].cod_sec to s_cuenta[scr_l].cod_sec
|
|
IF arr_cuenta1[curr].cuenta_no is not null or
|
|
arr_cuenta1[curr].cuenta_no != " " THEN
|
|
|
|
SELECT a.descripcion,a.origen,a.depto,a.nivel,a.ref,a.cata
|
|
INTO p_descripcion,p_origen,acept_dpto,p_nivel,p_ref,p_cata
|
|
FROM cgtb00001 a
|
|
WHERE a.cuenta_no = arr_cuenta1[curr].cuenta_no and
|
|
a.status_t is null
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
LET arr_cuenta1[curr].nom_cuenta = p_descripcion
|
|
DISPLAY arr_cuenta1[curr].nom_cuenta TO s_cuenta[scr_l].nom_cuenta
|
|
|
|
# Controla que la cuenta del banco no sea igual a una cuenta digitada
|
|
# en el arreglo
|
|
|
|
LET cuenta_a = arr_cuenta1[curr].cuenta_no clipped
|
|
LET cuenta_b = recibo.cuenta_p clipped
|
|
|
|
IF cuenta_a = cuenta_b THEN
|
|
LET numero_msg = 192
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
#-----------------------------------------------------------------------------
|
|
|
|
IF arr_cuenta1[curr].cuenta_no = "2113-01" or
|
|
arr_cuenta1[curr].cuenta_no = "2116" or
|
|
arr_cuenta1[curr].cuenta_no = "2114" THEN
|
|
FOR idx = 1 TO arr_count()
|
|
CASE
|
|
WHEN arr_cuenta1[curr].cuenta_no = "2113-01"
|
|
IF arr_cuenta1[idx].cuenta_no = "2116" or
|
|
arr_cuenta1[idx].cuenta_no = "2114" THEN
|
|
LET numero_msg = 208
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
EXIT CASE
|
|
WHEN arr_cuenta1[curr].cuenta_no = "2116"
|
|
IF arr_cuenta1[idx].cuenta_no = "2113-01" or
|
|
arr_cuenta1[idx].cuenta_no = "2114" THEN
|
|
LET numero_msg = 208
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
EXIT CASE
|
|
WHEN arr_cuenta1[curr].cuenta_no = "2113-01"
|
|
IF arr_cuenta1[idx].cuenta_no = "2116" or
|
|
arr_cuenta1[idx].cuenta_no = "2114" THEN
|
|
|
|
LET numero_msg = 208
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
EXIT CASE
|
|
END CASE
|
|
END FOR
|
|
END IF
|
|
|
|
IF p_nivel < 3 THEN
|
|
LET numero_msg = 175
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
|
|
IF acept_dpto = "S" THEN
|
|
NEXT FIELD departamento
|
|
ELSE
|
|
LET arr_cuenta1[curr].departamento = null
|
|
DISPLAY arr_cuenta1[curr].departamento TO s_cuenta[scr_l].departamento
|
|
END IF
|
|
IF p_cata = "S" THEN
|
|
NEXT FIELD cod_aux
|
|
ELSE
|
|
LET arr_cuenta1[curr].cod_aux = null
|
|
LET arr_cuenta1[curr].cod_sec = null
|
|
DISPLAY arr_cuenta1[curr].cod_aux TO s_cuenta[scr_l].cod_aux
|
|
DISPLAY arr_cuenta1[curr].cod_sec TO s_cuenta[scr_l].cod_sec
|
|
IF p_ref = "S" THEN
|
|
NEXT FIELD num_doc
|
|
ELSE
|
|
LET arr_cuenta1[curr].num_doc = null
|
|
DISPLAY arr_cuenta1[curr].num_doc TO s_cuenta[scr_l].num_doc
|
|
END IF
|
|
NEXT FIELD debito
|
|
END IF
|
|
|
|
END IF
|
|
|
|
AFTER FIELD departamento
|
|
IF arr_cuenta1[curr].cuenta_no is not null THEN
|
|
IF acept_dpto = "S" THEN
|
|
IF arr_cuenta1[curr].departamento is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD departamento
|
|
END IF
|
|
SELECT a.nom_dpto INTO nombre_dpto FROM adtb00001 a
|
|
WHERE a.departamento = arr_cuenta1[curr].departamento and
|
|
a.status_t is null
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD departamento
|
|
END IF
|
|
DISPLAY BY NAME nombre_dpto ATTRIBUTE(BLUE)
|
|
END IF
|
|
ELSE
|
|
LET arr_cuenta1[curr].departamento = null
|
|
DISPLAY arr_cuenta1[curr].departamento TO s_cuenta[scr_l].departamento
|
|
|
|
NEXT FIELD cod_aux
|
|
END IF
|
|
|
|
AFTER FIELD cod_aux
|
|
IF arr_cuenta1[curr].cuenta_no is not null THEN
|
|
IF p_cata = "S" THEN
|
|
IF arr_cuenta1[curr].cod_aux is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_aux
|
|
END IF
|
|
ELSE
|
|
LET arr_cuenta1[curr].cod_aux = null
|
|
LET arr_cuenta1[curr].cod_sec = null
|
|
DISPLAY arr_cuenta1[curr].cod_aux TO s_cuenta[scr_l].cod_aux
|
|
DISPLAY arr_cuenta1[curr].cod_sec TO s_cuenta[scr_l].cod_sec
|
|
NEXT FIELD num_doc
|
|
END IF
|
|
END IF
|
|
|
|
AFTER FIELD cod_sec
|
|
IF arr_cuenta1[curr].cuenta_no THEN
|
|
IF p_cata = "S" THEN
|
|
IF arr_cuenta1[curr].cod_sec is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_aux
|
|
END IF
|
|
IF arr_cuenta1[curr].cod_aux != 1 THEN
|
|
SELECT a.nom_sp INTO nombre_cata FROM cotb00001 a
|
|
WHERE a.cod_sp = arr_cuenta1[curr].cod_aux AND
|
|
a.cod_sp_sec = arr_cuenta1[curr].cod_sec
|
|
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_aux
|
|
END IF
|
|
DISPLAY BY NAME nombre_cata ATTRIBUTE(BLUE)
|
|
END IF
|
|
|
|
IF arr_cuenta1[curr].cod_aux = 1 THEN
|
|
SELECT nom1_emp,apell1_emp,departamento,nomina INTO nombre_cata
|
|
FROM adtb00003
|
|
WHERE num_emp = arr_cuenta1[curr].cod_sec
|
|
IF status = notfound THEN
|
|
LET numero_msg = 3
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cod_aux
|
|
END IF
|
|
DISPLAY BY NAME nombre_cata
|
|
END IF
|
|
END IF
|
|
END IF
|
|
IF p_ref = "S" THEN
|
|
NEXT FIELD num_doc
|
|
ELSE
|
|
NEXT FIELD debito
|
|
END IF
|
|
AFTER FIELD num_doc
|
|
IF arr_cuenta1[curr].cuenta_no is not null THEN
|
|
IF p_ref = "S" THEN
|
|
IF arr_cuenta1[curr].num_doc IS NULL THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD num_doc
|
|
END IF
|
|
ELSE
|
|
LET arr_cuenta1[curr].num_doc = null
|
|
DISPLAY arr_cuenta1[curr].num_doc TO s_cuenta[scr_l].num_doc
|
|
END IF
|
|
END IF
|
|
|
|
AFTER FIELD debito
|
|
|
|
IF arr_cuenta1[curr].debito is not null or
|
|
arr_cuenta1[curr].debito != 0 THEN
|
|
|
|
IF arr_cuenta1[curr].debito != 0 THEN
|
|
IF arr_cuenta1[curr].cuenta_no is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
END IF
|
|
END IF
|
|
|
|
AFTER ROW
|
|
IF arr_cuenta1[curr].cuenta_no is not null THEN
|
|
IF arr_cuenta1[curr].debito = 0 and
|
|
arr_cuenta1[curr].credito = 0 THEN
|
|
LET numero_msg = 207
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
END IF
|
|
AFTER INPUT
|
|
IF int_flag THEN
|
|
LET numero_msg = 2
|
|
CALL msg(numero_msg)
|
|
LET int_flag = FALSE
|
|
CLEAR FORM
|
|
RETURN
|
|
END IF
|
|
|
|
IF valor_f is null THEN
|
|
LET valor_f = 0
|
|
END IF
|
|
|
|
IF arr_cuenta1[curr].debito is not null THEN
|
|
IF arr_cuenta1[curr].cuenta_no is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
END IF
|
|
|
|
IF arr_cuenta1[curr].credito is not null THEN
|
|
IF arr_cuenta1[curr].cuenta_no is null THEN
|
|
LET numero_msg = 16
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
END IF
|
|
|
|
IF recibo.cod_sp_sec IS NOT NULL THEN
|
|
LET valor_cxp = 0
|
|
LET chequea = "N"
|
|
FOR idx = 1 TO arr_cuenta1.getLength()
|
|
IF arr_cuenta1[idx].cuenta_no is not null THEN
|
|
IF arr_cuenta1[idx].cuenta_no = "2113-01" or
|
|
arr_cuenta1[idx].cuenta_no = "2116" or
|
|
arr_cuenta1[idx].cuenta_no = "2114" THEN
|
|
LET chequea = "S"
|
|
LET valor_cxp = valor_cxp + arr_cuenta1[idx].debito
|
|
END IF
|
|
END IF
|
|
END FOR
|
|
|
|
IF chequea = "S" THEN
|
|
|
|
IF valor_f != valor_cxp THEN
|
|
LET numero_msg = 206
|
|
CALL msg(numero_msg)
|
|
# DISPLAY "VALORES M ",valor_f,' ',valor_cxp
|
|
NEXT FIELD debito
|
|
END IF
|
|
END IF
|
|
|
|
# Controla las cuentas por cobrar si se digito una cuenta perteneciente
|
|
# a las cuentas por cobrar y no se le dice al programa que no afecta
|
|
# las cuentas por cobrar
|
|
LET ctrl_cxp = "N"
|
|
FOR idx = 1 TO arr_count()
|
|
IF arr_cuenta1[idx].cuenta_no is not null THEN
|
|
IF opcion = "S" THEN
|
|
IF arr_cuenta1[idx].cuenta_no = "2113-01" THEN
|
|
LET ctrl_cxp = "S"
|
|
END IF
|
|
IF arr_cuenta1[idx].cuenta_no = "2116" THEN
|
|
LET ctrl_cxp = "S"
|
|
END IF
|
|
IF arr_cuenta1[idx].cuenta_no = "2114" THEN
|
|
LET ctrl_cxp = "S"
|
|
END IF
|
|
END IF
|
|
END IF
|
|
END FOR
|
|
|
|
IF ctrl_cxp = "N" THEN
|
|
LET numero_msg = 210
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
END IF
|
|
|
|
# Controla las cuentas por cobrar si se digito una cuenta perteneciente
|
|
# a las cuentas por cobrar y no se le dice al programa que no afecta
|
|
# las cuentas por cobrar
|
|
LET ctrl_cxp = "N"
|
|
FOR idx = 1 TO arr_count()
|
|
IF arr_cuenta1[idx].cuenta_no is not null THEN
|
|
IF opcion is null or opcion = "N" THEN
|
|
IF arr_cuenta1[idx].cuenta_no = "2113-01" or
|
|
arr_cuenta1[idx].cuenta_no = "2116" or
|
|
arr_cuenta1[idx].cuenta_no = "2114" THEN
|
|
LET ctrl_cxp = "S"
|
|
END IF
|
|
END IF
|
|
END IF
|
|
END FOR
|
|
|
|
IF ctrl_cxp = "S" THEN
|
|
LET numero_msg = 209
|
|
CALL msg(numero_msg)
|
|
NEXT FIELD cuenta_no
|
|
END IF
|
|
|
|
END INPUT
|
|
|
|
IF sale_arr = "S" THEN
|
|
GOTO arr10
|
|
END IF
|
|
LET monto = 0
|
|
LET valor = 0
|
|
FOR idx = 1 TO arr_cuenta1.getLength()
|
|
IF arr_cuenta1[idx].debito is null THEN
|
|
LET arr_cuenta1[idx].debito = 0
|
|
END IF
|
|
IF arr_cuenta1[idx].credito is null THEN
|
|
LET arr_cuenta1[idx].credito = 0
|
|
END IF
|
|
|
|
LET valor = valor + arr_cuenta1[idx].debito
|
|
LET monto = arr_cuenta1[idx].credito + monto
|
|
END FOR
|
|
LET xdebito = valor
|
|
LET xcredito = monto +recibo.monto
|
|
DISPLAY BY NAME xdebito,xcredito
|
|
|
|
LET monto = valor - monto
|
|
IF monto != recibo.monto THEN
|
|
LET numero_msg = 178
|
|
CALL msg(numero_msg)
|
|
GOTO err1
|
|
END IF
|
|
|
|
LET tipo_doc1 = recibo.tipo_doc
|
|
PROMPT "Toda la Informacion Esta Correcta (S/N) ?" FOR char opc
|
|
|
|
|
|
LET opc = upshift(opc)
|
|
IF opc = "S" THEN
|
|
LET imp_cxp = TRUE
|
|
BEGIN WORK
|
|
# Actualizacion de las tablas de cuentas por pagar y contabilidad general
|
|
IF m > 0 or opcion = "S" THEN
|
|
|
|
LET numero1 = recibo.numero
|
|
|
|
IF arr_recibo.getLength()>0 THEN
|
|
DELETE FROM cptb00001
|
|
WHERE @tipo_doc = tipo_doc1 AND @num_doc = numero1 AND
|
|
@cod_sp = recibo.cod_sp AND @cod_sp_sec = recibo.cod_sp_sec AND
|
|
cta_ctble = recibo.cuenta_p
|
|
|
|
|
|
FOR idx = 1 to arr_recibo.getLength()
|
|
IF arr_recibo[idx].valor_pag <> 0 and
|
|
arr_recibo[idx].valor_pag is not null THEN
|
|
|
|
##### Proceso para insertar valores en cuentas por pagar
|
|
#IF arr_recibo[idx].valor_pag > 0 THEN
|
|
LET arr_recibo[idx].valor_pag = arr_recibo[idx].valor_pag * -1
|
|
#END IF
|
|
|
|
IF arr_recibo[idx].aplica_a IS NOT NULL THEN
|
|
|
|
INSERT INTO cptb00001
|
|
(tipo_doc
|
|
,num_doc
|
|
,cod_sp
|
|
,cod_sp_sec
|
|
,fecha_orig
|
|
,fecha_proc
|
|
,orden_no
|
|
,tipo
|
|
,aplica_a
|
|
,cta_ctble
|
|
,valor
|
|
,detalle
|
|
,us_crea
|
|
,fech_crea
|
|
)
|
|
|
|
values (tipo_doc1,numero1,
|
|
recibo.cod_sp,recibo.cod_sp_sec,recibo.fecha,recibo.fecha,
|
|
arr_recibo[idx].orden_no,
|
|
arr_recibo[idx].tipo,arr_recibo[idx].aplica_a,recibo.cuenta_p,
|
|
arr_recibo[idx].valor_pag,detalle_1,usuarios,GETDATE())
|
|
END IF
|
|
|
|
IF arr_recibo[idx].aplica_a is not null THEN
|
|
IF idx < 6 THEN
|
|
LET factura1 = arr_recibo[idx].aplica_a CLIPPED
|
|
LET facturas = facturas CLIPPED,",",factura1 CLIPPED
|
|
END IF
|
|
END IF
|
|
|
|
IF arr_recibo[idx].orden_no is not null and
|
|
arr_recibo[idx].orden_no != 999999 THEN
|
|
IF idx < 10 THEN
|
|
LET orden1 = arr_recibo[idx].orden_no USING "######"
|
|
LET ordenes = ordenes CLIPPED,",",orden1 CLIPPED
|
|
END IF
|
|
END IF
|
|
END IF
|
|
END FOR
|
|
ELSE
|
|
LET imp_cxp = FALSE
|
|
|
|
END IF
|
|
CALL integridad()
|
|
IF bandera = 1 THEN
|
|
LET bandera = 0
|
|
RETURN
|
|
END IF
|
|
END IF
|
|
|
|
# Actualizacion de la tabla transacciones de contabildad general
|
|
LET referencia = "TR",recibo.numero using "&&&&&&"
|
|
DELETE FROM cgtb00004 WHERE ref = referencia AND
|
|
detalles = recibo.cuenta_p
|
|
|
|
FOR idx = 1 TO arr_cuenta1.getLength()
|
|
IF arr_cuenta1[idx].cuenta_no is not null THEN
|
|
IF arr_recibo[idx].orden_no is not null THEN
|
|
LET refe[idx] = arr_recibo[idx].orden_no
|
|
END IF
|
|
IF arr_recibo[idx].orden_no is not null THEN
|
|
LET refe[idx] = arr_recibo[idx].tipo using "&&","-",
|
|
arr_recibo[idx].aplica_a using "&&&&&&"
|
|
END IF
|
|
IF arr_recibo[idx].aplica_a is not null THEN
|
|
LET refe[idx] = arr_recibo[idx].aplica_a
|
|
END IF
|
|
LET detalle_2 = xcomentario clipped,recibo.cuenta_p," ",recibo.tasa using "##.##"
|
|
|
|
|
|
INSERT INTO cgtb00004 (fecha,tipo,ref,cuenta_no,departamento,num_doc,cod_aux,cod_sec,detalles,
|
|
detalle_1,detalle_2,debito,credito,us_crea,fech_crea )
|
|
|
|
values (recibo.fecha,3,referencia,
|
|
arr_cuenta1[idx].cuenta_no,arr_cuenta1[idx].departamento,
|
|
arr_cuenta1[idx].num_doc,arr_cuenta1[idx].cod_aux,
|
|
arr_cuenta1[idx].cod_sec,recibo.cuenta_p,recibo.nom_sup,detalle_2,
|
|
arr_cuenta1[idx].debito,
|
|
arr_cuenta1[idx].credito,usuarios,GETDATE())
|
|
|
|
|
|
END IF
|
|
|
|
END FOR
|
|
|
|
# Agregar La Cuenta Contable del Banco
|
|
|
|
INSERT INTO cgtb00004(fecha,tipo,ref,cuenta_no,detalles,detalle_1,detalle_2,debito,credito,us_crea,fech_crea)
|
|
values (recibo.fecha,3,referencia, recibo.cuenta_p,
|
|
recibo.cuenta_p,recibo.nom_sup,detalle_2,0,recibo.monto,
|
|
usuarios,GETDATE())
|
|
|
|
#ESTE INSERT SE COLOCO EN COMENTARIO PORQUE SE DUPLICARIA LA TRANSACCION EN LA TABLA CGTB5
|
|
# INSERT INTO cgtb00005 (cuenta_no,cheque_no,fecha,tipo_doc,portador,monto,cod_sp,cod_sp_sec,tasa,us_crea,fech_crea,comentario)
|
|
# VALUES (recibo.cuenta_p,numero1,recibo.fecha,recibo.tipo_doc,recibo.nom_sup,recibo.monto,recibo.cod_sp,recibo.cod_sp_sec,
|
|
# recibo.tasa,usuarios,getdate(),xcomentario)
|
|
|
|
COMMIT WORK
|
|
|
|
LET r_filename ="cgprmt017.4rp"
|
|
LET r_output = "SVG"
|
|
#LET preview = 1
|
|
|
|
-- configure report engine; the functions prefixed fgl that are called here are part of the GRW API
|
|
IF fgl_report_loadCurrentSettings(r_filename) THEN -- load the .4rp file
|
|
CALL fgl_report_selectDevice(r_output) -- changing default
|
|
IF preview = 0 THEN
|
|
CALL fgl_report_selectPreview(1) -- changing default
|
|
CALL fgl_report_configureSVGPreview("PrintOnDefaultPrinter")
|
|
ELSE
|
|
CALL fgl_report_selectPreview(preview)
|
|
END if
|
|
|
|
LET handler = fgl_report_commitCurrentSettings() -- commit changes
|
|
ELSE
|
|
EXIT PROGRAM
|
|
END IF
|
|
|
|
START REPORT transferencia TO XML HANDLER handler
|
|
# busca el numero secuencial
|
|
|
|
|
|
LET idx = idx + 1
|
|
LET arr_cuenta1[idx].cuenta_no = recibo.cuenta_p
|
|
LET arr_cuenta1[idx].nom_cuenta = p_descripcion
|
|
LET arr_cuenta1[idx].debito = 0
|
|
LET arr_cuenta1[idx].credito = recibo.monto
|
|
|
|
FOR idx = 1 TO arr_cuenta1.getLength()
|
|
IF arr_cuenta1[idx].cuenta_no IS NOT NULL THEN
|
|
OUTPUT TO REPORT transferencia(idx,referencia,arr_cuenta1[idx].cuenta_no,arr_cuenta1[idx].departamento,
|
|
arr_cuenta1[idx].cod_aux,arr_cuenta1[idx].cod_sec,arr_cuenta1[idx].num_doc,
|
|
arr_cuenta1[idx].debito,arr_cuenta1[idx].credito,xcomentario)
|
|
END IF
|
|
END FOR
|
|
FINISH REPORT transferencia
|
|
|
|
|
|
LET numero_msg = 13
|
|
CALL msg(numero_msg)
|
|
CLEAR FORM
|
|
CALL arr_cuenta1.clear()
|
|
END IF
|
|
}
|
|
COMMAND "Retornar"
|
|
EXIT MENU
|
|
END MENU
|
|
END FUNCTION
|
|
|
|
REPORT transferencia(x)
|
|
DEFINE x RECORD
|
|
id INTEGER,
|
|
ref LIKE cgtb00004.ref,
|
|
cuenta_no LIKE cgtb00004.cuenta_no,
|
|
departamento LIKE cgtb00004.departamento,
|
|
cod_aux LIKE cgtb00004.cod_aux,
|
|
cod_sec LIKE cgtb00004.cod_sec,
|
|
num_doc LIKE cgtb00004.num_doc,
|
|
debito LIKE cgtb00004.debito,
|
|
credito LIKE cgtb00004.credito,
|
|
xcomentario VARCHAR(100)
|
|
END RECORD
|
|
|
|
DEFINE t_debito,t_credito,total_aplica DECIMAL(12,2)
|
|
DEFINE descripcion CHAR(30)
|
|
DEFINE hora CHAR(5),
|
|
total_registro SMALLINT,
|
|
fecha CHAR(40)
|
|
OUTPUT
|
|
LEFT MARGIN 0
|
|
TOP MARGIN 0
|
|
|
|
ORDER BY x.ref
|
|
|
|
FORMAT
|
|
FIRST PAGE HEADER
|
|
LET total_registro = 0
|
|
LET t_debito = 0
|
|
LET t_credito = 0
|
|
|
|
LET fecha = TODAY USING "dd/mm/yyyy",":",time
|
|
ON EVERY ROW
|
|
|
|
LET t_credito = t_credito + x.credito
|
|
LET t_debito = t_debito + x.debito
|
|
LET total_registro = total_registro + 1
|
|
|
|
SELECT a.descripcion INTO descripcion FROM cgtb00001 a
|
|
WHERE a.cuenta_no = x.cuenta_no AND a.status_t IS NULL
|
|
|
|
PRINTX x.*,descripcion,p_compania.*,recibo.*,
|
|
fecha,total_registro,t_credito,t_debito,detalle_1,imp_cxp,numdoc
|
|
|
|
AFTER GROUP OF x.ref
|
|
LET total_aplica = 0
|
|
FOR idx = 1 TO arr_recibo.getLength()
|
|
LET total_aplica = total_aplica + arr_recibo[idx].valor_pag
|
|
PRINTX arr_recibo[idx].aplica_a,arr_recibo[idx].orden_no,arr_recibo[idx].tipo,arr_recibo[idx].valor_pag
|
|
END FOR
|
|
|
|
PRINTX total_aplica
|
|
END REPORT
|
|
|
|
FUNCTION entradas()
|
|
DEFINE des_entra DYNAMIC ARRAY OF RECORD
|
|
procesa CHAR(2),
|
|
descripcion VARCHAR(60),
|
|
estado VARCHAR(30)
|
|
END RECORD
|
|
|
|
OPEN WINDOW win_entradas AT 10,10 WITH FORM "cgfmwd010" ATTRIBUTE
|
|
(BORDER,FORM LINE FIRST + 1,COMMENT LINE LAST)
|
|
|
|
DECLARE busca_Entrada CURSOR FOR
|
|
SELECT 'N',a.descripcion,a.prog_4gl FROM cgtb00011 a
|
|
WHERE referencia IS NULL
|
|
ORDER BY a.descripcion
|
|
|
|
LET idx = 1
|
|
FOREACH busca_entrada INTO des_entra[idx].*
|
|
LET des_Entra[idx].procesa = "N"
|
|
LET idx = idx + 1
|
|
END FOREACH
|
|
|
|
CALL set_count(idx-1)
|
|
INPUT ARRAY des_entra WITHOUT DEFAULTS FROM s_entradas.*
|
|
AFTER INPUT
|
|
LET idx = arr_curr()
|
|
# IF des_entra[idx].estado = 'funcion1' THEN
|
|
|
|
# END IF
|
|
END INPUT
|
|
CLOSE WINDOW win_entradas
|
|
|
|
END FUNCTION
|
|
|
|
FUNCTION info_tr()
|
|
LET numero1 = recibo.numero USING "<<<<<<<"
|
|
|
|
DECLARE info_cxp CURSOR FOR
|
|
SELECT b.tipo,b.orden_no,b.aplica_a,b.valor*-1,b.valor*-1
|
|
FROM cptb00001 b
|
|
WHERE b.status_t IS NULL AND b.num_doc = numero1 AND
|
|
b.tipo_doc = recibo.tipo_doc AND
|
|
b.cta_ctble = recibo.cuenta_p
|
|
|
|
LET idx = 1
|
|
FOREACH info_cxp INTO arr_recibo[idx].*
|
|
LET idx = idx + 1
|
|
END FOREACH
|
|
DISPLAY ARRAY arr_recibo TO s_recibo.*
|
|
|
|
LET referencia = recibo.tipo_doc,recibo.numero USING "&&&&&&"
|
|
|
|
DECLARE cuentas CURSOR FOR
|
|
SELECT c.cuenta_no,c.departamento,c.cod_aux,c.cod_sec,c.num_doc,
|
|
d.descripcion,c.debito,c.credito
|
|
FROM cgtb00004 c,cgtb00001 d
|
|
WHERE c.cuenta_no = d.cuenta_no AND c.ref = referencia AND
|
|
d.status_t IS NULL AND c.cuenta_no NOT IN (recibo.cuenta_p) AND
|
|
c.detalles=recibo.cuenta_p
|
|
|
|
LET idx = 1
|
|
FOREACH cuentas INTO arr_cuenta1[idx].*
|
|
LET idx = idx + 1
|
|
END FOREACH
|
|
|
|
DISPLAY ARRAY arr_cuenta1 TO s_cuenta.*
|
|
END FUNCTION
|
|
|
|
|
|
|