Generación de Listados de Totales
De Wiki
Contenido
- 1 FORMULARIO
- 2 INFORME
- 3 CÓDIGO
- 3.1 Programa "listado_tot_procesos_xarea.prg"
- 3.2 Botón "Generar Listados" (btnProcesar)
- 3.3 Botón "Ver Listado y Generar PDF" (btnGenerarReporte)
- 3.4 Botón "Cancelar" (btnCancelar)
- 3.5 Combo "Tipo de Informe" (cmbTipoInforme)
- 3.6 Combo "Mes" (cmbMes)
- 3.7 Combo "Año" (cmbAnio)
- 3.8 Combo "Liquidación Barra" (cmbLiqBarra)
- 4 TABLAS
- 5 INFORMACIÓN RELACIONADA
- 6 MANUAL DEL USUARIO
FORMULARIO
frm_list_tot_proc.scx
INFORME
Total Universidad (totales_proc_gene.scx)
Detalle Total Universidad (tot_proc_det.scx)
Planilla de Totales Generales por Fuente (totales_proc_gene_dep.scx)
Planilla Detallada de Totales (tot_proc_dep.scx)
CÓDIGO
Programa "listado_tot_procesos_xarea.prg"
*-------------------------------------------------------------------------------------------------------- *--Parametros del programa------------------------------------------------------------------------------- *-------------------------------------------------------------------------------------------------------- PARAMETERS mesVigencia,anioVigencia,barraLiq,v_dep *-------------------------------------------------------------------------------------------------------- *****este programalista los totales *SET STEP ON *---------------------------------------------------------Seteos set date to french set talk off set safe off set delete on SET TALK OFF SET SAFETY OFF SET EXCLU ON SET DATE TO DMY SET CENT ON SET DELETED ON close table all *---------------------------------------------------------declaro variables public vm_conce,v_archivo,per,per2,v_periodo,vm_fuente,nom_base_det,nom_base,nom_base2 *------------------------------------------------------------------------------ *---------------armo periodo desde el nombre de la base v_periodo=anioVigencia+PADL(mesVigencia,2,"0") v_barra=ALLTRIM(barraLiq) *--Asignación de variables path-------------------------------------------------------- v_rutaInformes="t:\reportes\reportes\totales\"+v_periodo+"\" v_rutaTablas="T:\liquidaciones\"+v_periodo v_rutaBackUp="t:\reportes\reportes\totales\"+v_periodo+"\backup" *--Verificar existencia de carpeta v_periodo\aaaamm----------------------------------------- IF DIRECTORY(v_rutaInformes)=.F. MKDIR LEFT(v_rutaInformes,LEN(v_rutaInformes)-1)
MKDIR &v_rutaBackUp
ENDIF
*-----Seleccionar archivo dh21 de la liquidacion
IF DIRECTORY(v_rutaTablas)==.T.
v_rutaOriginal=SYS(5)+SYS(2003)
SET DEFAULT TO &v_rutaTablas
messagebox ("Seleccione el dh21x_mmaa.DBF para generar el total en transacciones\liquidaciones")
v_archivo = getfile("DBF"," ")
SET DEFAULT TO &v_rutaOriginal
ELSE
v_rutaOriginal=SYS(5)+SYS(2003)
SET DEFAULT TO T:\liquidaciones\
messagebox ("Seleccione el dh21x_mmaa.DBF para generar el total en transacciones\liquidaciones")
v_archivo = getfile("DBF"," ")
SET DEFAULT TO &v_rutaOriginal
ENDIF
if empty(v_archivo)= .f.
sele sele(1)
use &v_archivo
else
messagebox ("Usted no selecciona ningun archivo")
cancel
endif
***el archivo sin el camino
v_tabla_con_exte=substr(v_archivo,rat("\",v_archivo)+1,len(v_archivo)-rat("\",v_archivo))
***el archivo sin el camino y sin la extension
v_tabla=left(v_tabla_con_exte,len(v_tabla_con_exte)-4)
*---------------Bases--------------------------------------------------------------------
*----abro la vista de los conceptos
cadena1= "select *";
+ " from dh12 "
nom1=sys(3)
create sql view &nom1;
connection con_pampasql;
as &cadena1
**la paso a una tabla
sele sele (1)
use &nom1 alias v_12
tabla =vm_bases_informes+"dh12"
sele * from v_12 into table &tabla
if used ("dh12")
sele dh12
use
endif
sele sele(1)
use &tabla excl
index on codn_conce tag idx_conce
sele v_12
use
drop view &nom1
*------------------------------------------------------------------------------------------------------------
*-------------------------------------------base para listado de totales generales
tabla= vm_bases_informes + "lis_tot_gen"+"_"+barraLiq+v_periodo
create table &tabla free (codn_fuent n(4),tot_cap n(20,2),tot_sap n(20,2),;
tot_sal n(20,2),tot_ret n(20,2),tot_con n(20,2),nro_liqui n(4),;
tot_afip n(20,2),tot_tes1 n(20,2),tot_inssjp n(20,2),;
tot_tes2 n(20,2),tot_fdo1 n(20,2),tot_fdo2 n(20,2),tot_p1175 n(20,2),;
tot_daspu n(20,2),tot_c70 n(20,2),sijp_r n(20,2),inssjp_r n(20,2),apodif n(20,2),;
res33y41_r n(20,2),afip1_c n(20,2),afip2_c n(20,2),mes c(2),anio c(4),;
barra c(1),descbarra C(150))
index on codn_fuent tag id_fuente
*---------------------------------------
tabla= vm_bases_informes + "lis_tot_gen_dep"+"_"+barraLiq+v_periodo
create table &tabla free (codc_uacad c(4),codn_fuent n(4),tot_cap n(20,2),tot_sap n(20,2),;
tot_sal n(20,2),tot_ret n(20,2),tot_con n(20,2),nro_liqui n(4),;
tot_afip n(20,2),tot_tes1 n(20,2),tot_inssjp n(20,2),;
tot_tes2 n(20,2),tot_fdo1 n(20,2),tot_fdo2 n(20,2),tot_p1175 n(20,2),;
tot_daspu n(20,2),tot_c70 n(20,2),sijp_r n(20,2),inssjp_r n(20,2),apodif n(20,2),;
res33y41_r n(20,2),afip1_c n(20,2),afip2_c n(20,2),mes c(2),anio c(4),barra c(1),;
descbarra C(100))
index on alltrim(codc_uacad)+alltrim(str(codn_fuent)) tag id_depfu
*--------------------------------------base para listado de totales detallados
tabla= vm_bases_informes + "lis_tot_det"+"_"+barraLiq+v_periodo
create table &tabla free (codn_conce n(4),desc_conce c(100),;
impp_conce n(20,2),impp_supl n(20,2),tot_cod n(20,2),nro_liqui n(4),;
tipo c(1),orden n(1),desc_tipo c(50),cant n(6),mes c(2),anio c(4),barra c(1),;
descbarra C(100))
index on codn_conce tag id_conce
index on orden+codn_conce tag id_orden
*------------------------base con datos-para depe-------------------------------------
tabla= vm_bases_informes + "lis_tot_dep"+"_"+barraLiq+v_periodo
create table &tabla free (codn_conce n(4),desc_conce c(100),;
impp_conce n(20,2),impp_supl n(20,2),tot_cod n(20,2),nro_liqui n(4),;
tipo c(1),orden n(1),desc_tipo c(50),cant n(6),mes c(2),anio c(4),barra;
c(1),codc_uacd c(4),;
descbarra C(100))
index on alltrim(codc_uacd)+padl(alltrim(str(codn_conce)),3,"0") tag id_depo
index on alltrim(codc_uacd)+padl(alltrim(str(orden)),1,"0")+padl(alltrim(str(codn_conce)),4,"0");
tag id_tot_dep
index on orden+codn_conce tag id_orden
*--------------------------------------------------------------------------
*---------------------------------armo totales-----------------------------------------
*!* select &v_dep,codn_fuent,tipo_conce,sum(impp_conce),nro_liqui ;
*!* from &v_tabla;
*!* group by &v_dep,codn_fuent,tipo_conce,,nro_liqui having tipo_conce <>"O";
*!* into table vm_bases_informes+"tot_proc_dep_"+v_periodo
*----------armo totales generales---------------------------------------------------
nom_base="tot_proc_gen_"+v_periodo
tabla=vm_bases_informes+nom_base
select codn_fuent,tipo_conce,sum(impp_conce)as total,nro_liqui ;
from &v_tabla;
group by codn_fuent,tipo_conce,nro_liqui having tipo_conce <> "O" ;
into table &tabla
*-----------------------------------------------------------------
*--------------------------------armo totales generales por dep
nom_base_gd1="tot_proc_gen_dep_"+v_periodo
tabla=vm_bases_informes+nom_base_gd1
select &v_dep,codn_fuent,tipo_conce,sum(impp_conce)as total,nro_liqui ;
from &v_tabla;
group by &v_dep,codn_fuent,tipo_conce,nro_liqui having tipo_conce <> "O" ;
into table &tabla
*-----------------------------------------------------------------------------------
*--ARMO DETALLADO DE CONTRIBUCIONES EN TOTAL GENERAL
nom_base2="tot_proc_cont_"+v_periodo
tabla=vm_bases_informes+nom_base2
select codn_fuent,tipo_conce,codn_conce,sum(impp_conce)as tot_cont,nro_liqui ;
from &v_tabla ;
group by codn_fuent,tipo_conce,codn_conce,nro_liqui;
having (tipo_conce="A" or tipo_conce="D") ;
into table &tabla
*---------------------------------
*--ARMO DETALLADO DE CONTRIBUCIONES EN TOTAL GENERAL para dependencias
nom_base_gd2="tot_proc_cont_d"+v_periodo
tabla=vm_bases_informes+nom_base_gd2
select &v_dep,codn_fuent,tipo_conce,codn_conce,sum(impp_conce)as tot_cont,nro_liqui ;
from &v_tabla ;
group by &v_dep,codn_fuent,tipo_conce,codn_conce,nro_liqui ;
having (tipo_conce="A" or tipo_conce="D") ;
into table &tabla
*-------------armo totales detallados
nom_base_det="tot_proc_det_"+v_periodo
tabla=vm_bases_informes+nom_base_det
select tipo_conce,codn_conce,sum(impp_conce)as total,nro_liqui,mes_retro,ano_retro," " as tipo,;
" " as desc_conce, count(codn_conce) as cant ;
from &v_tabla where not inlist(codn_conce,-51,-52,-53,-54,-55,-56);
group by tipo_conce,codn_conce,nro_liqui,mes_retro,ano_retro;
having tipo_conce <>"O";
into table &tabla
*----------------------------------------------------------------------------
*--------armo totales por dep
nom_base_dep="tot_proc_dep_"+v_periodo
tabla=vm_bases_informes+nom_base_dep
select tipo_conce,codn_conce,sum(impp_conce)as total,&v_dep as dep,nro_liqui,mes_retro,ano_retro," " as tipo,;
" " as desc_conce, count(codn_conce) as cant ;
from &v_tabla where not inlist(codn_conce,-51,-52,-53,-54,-55,-56);
group by tipo_conce,codn_conce,&v_dep,nro_liqui,mes_retro,ano_retro;
having tipo_conce <>"O" order by dep,codn_conce ;
into table &tabla
*------------------------------------------------
*--------armo totales por dep para presupuesto
*!* nom_base_dep_presu="tot_p_dep_"+v_periodo
*!* tabla=vm_bases_informes+nom_base_dep_presu
*!* select tipo_conce,codn_conce,sum(impp_conce)as total,&v_dep as dep,nro_liqui,codn_fuent;
*!* from &v_tabla where not inlist(codn_conce,-51,-52,-53,-54,-55,-56);
*!* group by tipo_conce,codn_conce,&v_dep,nro_liqui,codn_fuent;
*!* having tipo_conce <>"O";
*!* into table &tabla
*!*
*---------armo base para listado general
sele &nom_base
scan
scatter memvar
tabla="lis_tot_gen"+"_"+barraLiq+v_periodo
sele &tabla
set order to id_fuente
go top
if seek(m.codn_fuent)
*--no abro uno nuevo
else
append blank
endif
repla codn_fuent with m.codn_fuent
repla nro_liqui with m.nro_liqui
if m.tipo_conce ="C"
repla tot_cap with m.total
endif
if m.tipo_conce ="F"
repla tot_sal with m.total
endif
if m.tipo_conce ="S"
repla tot_sap with m.total
endif
if m.tipo_conce ="D"
repla tot_ret with m.total
endif
if m.tipo_conce ="A"
repla tot_con with m.total
endif
endscan
*---------agrego en base para listar el total de contribuciones
sele &nom_base2
scan
scatter memvar
tabla="lis_tot_gen"+"_"+barraLiq+v_periodo
sele &tabla
set order to id_fuente
go top
if seek(m.codn_fuent)
*--no abro uno nuevo
else
append blank
endif
if m.codn_conce =901 or m.codn_conce =931
repla tot_afip with m.tot_cont
endif
if m.codn_conce =903 or m.codn_conce =933
repla tot_tes1 with m.tot_cont
endif
if m.codn_conce =900 or m.codn_conce =930
repla tot_inssjp with m.tot_cont
endif
if m.codn_conce =904 or m.codn_conce =934
repla tot_tes2 with m.tot_cont
endif
if m.codn_conce =905 or m.codn_conce =935
repla tot_fdo1 with m.tot_cont
endif
if m.codn_conce =906 or m.codn_conce =936
repla tot_fdo2 with m.tot_cont
endif
if m.codn_conce =921
repla tot_p1175 with m.tot_cont
endif
if m.codn_conce =920
repla tot_c70 with m.tot_cont
endif
if m.codn_conce =902 or m.codn_conce =932 or m.codn_conce =937
repla tot_daspu with m.tot_cont
endif
if m.codn_conce =200 OR m.codn_conce =201 or m.codn_conce =202
v_campo=tabla+".sijp_r"
repla sijp_r with &v_campo+m.tot_cont
endif
if m.codn_conce =220 or m.codn_conce =221 or m.codn_conce =222
v_campo=tabla+".inssjp_r"
repla inssjp_r with &v_campo+m.tot_cont
endif
if m.codn_conce =209
repla res33y41_r with m.tot_cont
endif
if m.codn_conce =206 or m.codn_conce =205 OR m.codn_conce =203
v_campo=tabla+".apodif"
repla apodif with &v_campo+m.tot_cont
endif
if m.codn_conce =901 or m.codn_conce =905 or m.codn_conce =931 or m.codn_conce =935
v_campo=tabla+".afip1_c"
repla afip1_c with &v_campo+m.tot_cont
endif
if m.codn_conce =900 or m.codn_conce =930
repla afip2_c with m.tot_cont
endif
endscan
*-----------------armo periodo y barra
tabla="lis_tot_gen"+"_"+barraLiq+v_periodo
sele &tabla
scan
scatter memvar
repla mes with left(alltrim(v_periodo),2)
repla anio with right(alltrim(v_periodo),2)
repla barra with v_barra
endscan
************************************************************************************************************** ***armo totales generales para dependencias
*---------armo base para listado general dep
sele &nom_base_gd1
scan
scatter memvar
fuente =alltrim(str(m.codn_fuent))
aux=&v_dep
* set step on
IF type('aux')=='C'
dep=padl(alltrim(aux),2,"0")
else
dep=padl(alltrim(str(aux)),2,"0")
ENDIF
tabla="lis_tot_gen_dep"+"_"+barraLiq+v_periodo
sele &tabla
set order to id_depfu
go top
if seek(dep+fuente)
*--no abro uno nuevo
else
append blank
endif
repla codc_uacad with dep
repla codn_fuent with m.codn_fuent
repla nro_liqui with m.nro_liqui
if m.tipo_conce ="C"
repla tot_cap with m.total
endif
if m.tipo_conce ="F"
repla tot_sal with m.total
endif
if m.tipo_conce ="S"
repla tot_sap with m.total
endif
if m.tipo_conce ="D"
repla tot_ret with m.total
endif
if m.tipo_conce ="A"
repla tot_con with m.total
endif
endscan
*---------agrego en base para listar el total de contribuciones por dependencia
sele &nom_base_gd2
scan
scatter memvar
fuente =alltrim(str(m.codn_fuent))
aux=&v_dep
* set step on
IF type('aux')=='C'
*-Si VAL() retorna 0 es porque el parametro es caracter.
dep=padl(alltrim(&v_dep),2,"0")
else
dep=padl(alltrim(str(&v_dep)),2,"0")
ENDIF
tabla="lis_tot_gen_dep"+"_"+barraLiq+v_periodo
sele &tabla
set order to id_depfu
go top
if seek(dep+fuente)
*--no abro uno nuevo
else
append blank
endif
if m.codn_conce =901 or m.codn_conce =931
repla tot_afip with m.tot_cont
endif
if m.codn_conce =903 or m.codn_conce =933
repla tot_tes1 with m.tot_cont
endif
if m.codn_conce =900 or m.codn_conce =930
repla tot_inssjp with m.tot_cont
endif
if m.codn_conce =904 or m.codn_conce =934
repla tot_tes2 with m.tot_cont
endif
if m.codn_conce =905 or m.codn_conce =935
repla tot_fdo1 with m.tot_cont
endif
if m.codn_conce =906 or m.codn_conce =936
repla tot_fdo2 with m.tot_cont
endif
if m.codn_conce =921
repla tot_p1175 with m.tot_cont
endif
if m.codn_conce =920
repla tot_c70 with m.tot_cont
endif
if m.codn_conce =902 or m.codn_conce =932 or m.codn_conce =937
repla tot_daspu with m.tot_cont
endif
if m.codn_conce =200 OR m.codn_conce =201 OR m.codn_conce =202
v_campo=tabla+".sijp_r"
repla sijp_r with &v_campo+m.tot_cont
endif
if m.codn_conce =220 or m.codn_conce =221 or m.codn_conce =221
v_campo=tabla+".inssjp_r"
repla inssjp_r with &v_campo+m.tot_cont
endif
if m.codn_conce =209
repla res33y41_r with m.tot_cont
endif
if m.codn_conce =206 or m.codn_conce =205 OR m.codn_conce =203
v_campo=tabla+".apodif"
repla apodif with &v_campo+m.tot_cont
endif
if m.codn_conce =901 or m.codn_conce =905 or m.codn_conce =931 or m.codn_conce =935
v_campo=tabla+".afip1_c"
repla afip1_c with &v_campo+m.tot_cont
endif
if m.codn_conce =900 or m.codn_conce =930
repla afip2_c with m.tot_cont
endif
endscan
*-----------------armo periodo y barra
tabla="lis_tot_gen_dep"+"_"+barraLiq+v_periodo
sele &tabla
scan
scatter memvar
repla mes with left(alltrim(v_periodo),2)
repla anio with right(alltrim(v_periodo),2)
repla barra with v_barra
endscan
*******************************************detallado**********************************************************
*----------------------reemplazo si es haber o retencion o contribucion y la descripcion
sele &nom_base_det
scan
scatter memvar
sele dh12
set order to idx_conce
if seek(m.codn_conce)
sele &nom_base_det
repla desc_conce with dh12.desc_conce
if inlist(m.tipo_conce,"C","F","S")
sele &nom_base_det
repla tipo with "H"
endif
if m.tipo_conce ="D"
sele &nom_base_det
repla tipo with "R"
endif
if m.tipo_conce ="A"
sele &nom_base_det
repla tipo with "C"
endif
endif
endscan
*-------------------------------------------------sumo suples
tabla="lis_tot_det"+"_"+barraLiq+v_periodo
sele &nom_base_det
scan
scatter memvar
vm_conce =m.codn_conce
sele &tabla
set order to id_conce
go top
if seek(vm_conce)
*--no abro uno nuevo
else
append blank
endif
repla codn_conce with m.codn_conce
repla tipo with m.tipo
repla nro_liqui with m.nro_liqui
repla desc_conce with m.desc_conce
v_campo=tabla+".cant"
repla cant with &v_campo+m.cant
if m.tipo="H"
repla orden with 1
repla desc_tipo with "REMUNERACIONES"
endif
if m.tipo ="R"
repla orden with 2
repla desc_tipo with "RETENCIONES"
endif
if m.tipo ="C"
repla orden with 3
repla desc_tipo with "CONTRIBUCIONES"
endif
if m.mes_retro =0
repla impp_conce with m.total
else
v_campo=tabla+".impp_supl"
repla impp_supl with &v_campo+m.total
endif
endscan
*----------------agrego mes,año y barra
sele &tabla
scan
scatter memvar
repla mes with left(alltrim(v_periodo),2)
repla anio with right(alltrim(v_periodo),2)
repla barra with v_barra
endscan
*----------------------------------------------------------------------------------
**AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaAAAAA
*--------------armo listado por dep
*----------------------reemplazo si es haber o retencion o contribucion y la descripcion
sele &nom_base_dep
scan
scatter memvar
sele dh12
set order to idx_conce
if seek(m.codn_conce)
sele &nom_base_dep
repla desc_conce with dh12.desc_conce
if inlist(m.tipo_conce,"C","F","S")
sele &nom_base_dep
repla tipo with "H"
endif
if m.tipo_conce ="D"
sele &nom_base_dep
repla tipo with "R"
endif
if m.tipo_conce ="A"
sele &nom_base_dep
repla tipo with "C"
endif
endif
endscan
*-------------------------------------------------sumo suples para dep
* set step on
sele &nom_base_dep
go top
scan
scatter memvar
vm_conce =padl(alltrim(str(m.codn_conce)),3,"0")
****************************************p=padl(alltrim(str(&v_dep)),2,"0")
aux=m.dep
* set step on
IF type('aux')=='C'
dep=padl(alltrim(aux),2,"0")
else
dep=padl(alltrim(str(aux)),2,"0")
ENDIF
tabla="lis_tot_dep"+"_"+barraLiq+v_periodo
sele &tabla
set order to id_depo
go top
if not seek(dep+vm_conce)
*--no abro uno nuevo
append blank
endif
repla codc_uacd with dep
repla codn_conce with m.codn_conce
repla tipo with m.tipo
repla nro_liqui with m.nro_liqui
repla desc_conce with m.desc_conce
v_campo=tabla+".cant"
repla cant with &v_campo+m.cant
if m.tipo="H"
repla orden with 1
repla desc_tipo with "REMUNERACIONES"
endif
if m.tipo ="R"
repla orden with 2
repla desc_tipo with "RETENCIONES"
endif
if m.tipo ="C"
repla orden with 3
repla desc_tipo with "CONTRIBUCIONES"
endif
if m.mes_retro =0
repla impp_conce with m.total
else
v_campo=tabla+".impp_supl"
repla impp_supl with &v_campo+m.total
endif
sele &nom_base_dep
endscan
*----------------agrego mes,año y barra
tabla="lis_tot_dep"+"_"+barraLiq+v_periodo
sele &tabla
scan
scatter memvar
repla mes with left(alltrim(v_periodo),2)
repla anio with right(alltrim(v_periodo),2)
repla barra with v_barra
endscan
**************************************************************************************************************
*------------copio bases------------------------------
tabla="lis_tot_gen"+"_"+barraLiq+v_periodo
sele &tabla
go top
v_desc=get_desc_liq()
replace all descbarra with v_desc
tabla_camino=v_rutaInformes+tabla
IF FILE(tabla_camino+".DBF")=.T.
***renombrar al archivo existente y luego copio el que acabo de crear
programa=vm_programas + "rename.prg"
DO &programa WITH v_rutaInformes,tabla,"dbf"
ENDIF
copy to v_rutaInformes+"lis_tot_gen_"+v_barra+v_periodo
tabla="lis_tot_det"+"_"+barraLiq+v_periodo
sele &tabla
go top
v_desc=get_desc_liq()
replace all descbarra with v_desc
tabla_camino=v_rutaInformes+tabla
IF FILE(tabla_camino+".DBF")=.T.
***renombrar al archivo existente y luego copio el que acabo de crear
programa=vm_programas + "rename.prg"
DO &programa WITH v_rutaInformes,tabla,"dbf"
*DO vm_programas+"rename" with v_rutaInformes,tabla,"dbf"
ENDIF
copy to v_rutaInformes+"lis_tot_det_"+v_barra+v_periodo
tabla="lis_tot_dep"+"_"+barraLiq+v_periodo
sele &tabla
go top
v_desc=get_desc_liq()
replace all descbarra with v_desc
tabla_camino=v_rutaInformes+tabla
IF FILE(tabla_camino+".DBF")=.T.
***renombrar al archivo existente y luego copio el que acabo de crear
programa=vm_programas + "rename.prg"
DO &programa WITH v_rutaInformes,tabla,"dbf"
*DO vm_programas+"rename" with v_rutaInformes,tabla,"dbf"
ENDIF
copy to v_rutaInformes+"lis_tot_dep_"+v_barra+v_periodo
tabla="lis_tot_gen_dep"+"_"+barraLiq+v_periodo
sele &tabla
go top
v_desc=get_desc_liq()
replace all descbarra with v_desc
tabla_camino=v_rutaInformes+tabla
IF FILE(tabla_camino+".DBF")=.T.
***renombrar al archivo existente y luego copio el que acabo de crear
programa=vm_programas + "rename.prg"
DO &programa WITH v_rutaInformes,tabla,"dbf"
*DO vm_programas+"rename" with v_rutaInformes,tabla,"dbf"
ENDIF
copy to v_rutaInformes+"lis_tot_gen_dep"+v_barra+v_periodo
MESSAGEBOX("Termino de procesar")
FUNCTION get_desc_liq
do case
case barra="0"
v_desc="General"
case barra="1"
v_desc="SAC GENERAL "
case barra="2"
v_desc="SAC CONTRATOS "
case barra="3"
v_desc="Incentivo Docente"
case barra="4"
v_desc="Horas Extras/Asig."
case barra="6"
v_desc="Becas/Pasantias"
case barra="8"
v_desc="Contratos"
case barra="C"
v_desc="Ajuste No Docente Abril 2011 "
case barra="D"
v_desc="Diferencia No Docente"
case barra="F"
v_desc="Fonid"
case lis_tot_gen.barra="H"
v_desc="Becas Fondo Unico"
case barra="M"
v_desc="Diferencia Docente Marzo 2011"
case barra="P"
v_desc="Incentivo No Docente a la Capacitacion"
case lis_tot_gen.barra="Z"
v_desc="Ajuste Docente Marzo 2011 "
case barra="Z"
v_desc="Ajuste Docente Marzo 2011 "
endcase
RETURN v_desc
ENDFUNC
Botón "Generar Listados" (btnProcesar)
*---------------------------------------------------------------------------------------------------------
*--Capturo los valores de los combo que serán pasados al programa como parametros-------------------------
*---------------------------------------------------------------------------------------------------------
mesVigencia=THISFORM.cmbMes.value
anioVigencia=THISFORM.cmbAnio.value
barraLiq=THISFORM.cmbLiqBarra.Value
IF(THISFORM.optDependencia.Value==1)
v_dep="codc_uacad"
ELSE
v_dep="codn_area"
ENDIF
*---------------------------------------------------------------------------------------------------------
*--Llamo al programa--------------------------------------------------------------------------------------
*---------------------------------------------------------------------------------------------------------
IF(ISNULL(tipoInforme)=.T. OR ISNULL(mesVigencia)=.T. OR ISNULL(anioVigencia)=.T.)
MESSAGEBOX("Faltan completar datos del formulario")
ELSE
programa=vm_programas + "listado_tot_procesos_xarea.prg"
DO &programa WITH PADL(ALLTRIM(mesVigencia),2,"0"),ALLTRIM(anioVigencia),ALLTRIM(barraLiq),v_dep
ENDIF
Botón "Ver Listado y Generar PDF" (btnGenerarReporte)
v_impre="PDFCreator"
set printer to name &v_impre
*--------------------------------------------------------------------------------------------------------
*--Defino variables--------------------------------------------------------------------------------------
*--------------------------------------------------------------------------------------------------------
tipoInforme=THISFORM.cmbTipoInforme.Value
v_origen="c:\anexo\pdfs\salida.pdf"
v_mes=PADL(ALLTRIM(THISFORM.cmbMes.value),2,"0")
v_anio=ALLTRIM(THISFORM.cmbAnio.value)
v_barra=alltrim(THISFORM.cmbLiqBarra.Value)
v_camino="t:\reportes\reportes\totales\"+v_anio+v_mes+"\"
v_rutaBackUp="t:\reportes\reportes\totales\"+v_anio+v_mes+"\backup"
*----------------------------------------------------------------------------------------------------------
*--Limpio las variables usadas para generar los reportes y archivos pfd------------------------------------
*----------------------------------------------------------------------------------------------------------
*tabla=""
*indice=""
*informe=""
*v_arch_pdf=""
*v_arch_pdf_conruta=""
*tabla_camino=""
*---------------------------------------------------------------------------------------------------------
*--Verificar existencia de carpeta donde se guardan los reportes-----------------------------------------
*--------------------------------------------------------------------------------------------------------
IF DIRECTORY(v_camino)=.f.
MKDIR LEFT(v_camino,LEN(v_camino)-1)
MKDIR &v_rutaBackUp
ENDIF
**Controlar seleccion de los check box
IF(THISFORM.optGrupoInformes.Value==1)
tabla="lis_tot_gen_"+v_barra+v_anio+v_mes
indice="id_fuente"
informe=vm_informes+"totales_proc_gene.frx"
v_arch_pdf="TGF_"+v_barra+v_mes+right(v_anio,2)
ENDIF
IF(THISFORM.optGrupoInformes.Value==2)
tabla="lis_tot_det_"+v_barra+v_anio+v_mes
indice="id_orden"
informe=vm_informes+"tot_proc_det.frx"
v_arch_pdf="TGD_"+v_barra+v_mes+right(v_anio,2)
ENDIF
IF(THISFORM.optGrupoInformes.Value==3)
tabla="lis_tot_gen_dep_"+v_barra+v_anio+v_mes
indice="id_depfu"
informe=vm_informes+"totales_proc_gene_dep.frx"
v_arch_pdf="TDF_"+v_barra+v_mes+right(v_anio,2)
ENDIF
IF(THISFORM.optGrupoInformes.Value==4)
tabla="lis_tot_dep_"+v_barra+v_anio+v_mes
indice="id_tot_dep"
informe=vm_informes+"tot_proc_dep.frx"
v_arch_pdf="TDD_"+v_barra+v_mes+right(v_anio,2)
ENDIF
v_arch_pdf_conruta=v_camino+v_arch_pdf+".pdf"
tabla_camino=vm_bases_informes+tabla
IF FILE(tabla_camino+".DBF")=.T.
if used (tabla)
sele &tabla
use
endif
sele sele(1)
use &tabla_camino excl
set order to &indice
**index on codn_conce tag idx_conce
IF FILE(v_arch_pdf_conruta)=.T.
***renombrar al archivo existente
DO vm_programas+"rename" with v_camino,v_arch_pdf,"pdf"
*v_archnue=v_camino+v_arch_pdf+"_bk_"+v_anio+v_mes+PADL(ALLTRIM(STR(DAY(DATE()))),2,"0");
+"_"+PADL(ALLTRIM(STR(H OUR(DATETIME()))),2,"0")+PADL(ALLTRIM(STR(MINUTE(DATETIME()))),2,"0")+".pdf"
*rename &v_arch_pdf_conruta to &v_archnue
ENDIF
*****Imprimir el reporte a Pdf*****
report form &informe to print noconsole
***Previsualizar el informe
REPORT FORM &informe preview
**Llamo al cartel de espera
procesando=vm_formularios+"frmprocesando.scx"
DO FORM &procesando
**termino de imprimir copio el archivo pdf
WAIT timeout 5
copy file &v_origen to &v_arch_pdf_conruta
**Cierro el cartel de espera
frmprocesando.release
MESSAGEBOX("Ya puede generar el siguiente reporte")
ELSE
MESSAGEBOX("Por favor ejecute el botón 'Generar Listados'")
ENDIF
Botón "Cancelar" (btnCancelar)
THISFORM.Release
Combo "Tipo de Informe" (cmbTipoInforme)
*---------------------------------------------------------------------------------------------------------
*--CARGA DE LAS OPCIONES DEL CMBTIPO----------------------------------------------------------------------
*---------------------------------------------------------------------------------------------------------
THISFORM.cmbTipoInforme.AddItem("Provisorio")
THISFORM.cmbTipoInforme.AddItem("Definitivo")
*---------------------------------------------------------------------------------------------------------
*--SELECCIONO POR DEFECTO EL PRIMER ITEM DEL COMBO--------------------------------------------------------
*---------------------------------------------------------------------------------------------------------
THISFORM.cmbTipoInforme.SelectedID(1)=.T.
Combo "Mes" (cmbMes)
*--------------------------------------------------------------------------------------------------------- *--CARGO EL COMBO DE LOS MESES---------------------------------------------------------------------------- *--------------------------------------------------------------------------------------------------------- FOR I=1 TO 12 THISFORM.cmbMes.AddItem(STR(I)) ENDFOR *--------------------------------------------------------------------------------------------------------- *--SELECCIONO EL PRIMERO DE LOS ELEMENTOS DEL COMBO POR DEFECTO------------------------------------------- *--------------------------------------------------------------------------------------------------------- THISFORM.cmbMes.SelectedID(MONTH(DATE()))=.T.
Combo "Año" (cmbAnio)
*--------------------------------------------------------------------------------------------------------- *--CARGO EL COMBO DE LOS AÑOS----------------------------------------------------------------------------- *--------------------------------------------------------------------------------------------------------- FOR I=(YEAR(DATE())-10) TO YEAR(DATE()) THISFORM.cmbAnio.AddItem(STR(I)) ENDFOR *--------------------------------------------------------------------------------------------------------- *--SELECCIONO EL PRIMERO DE LOS ELEMENTOS DEL COMBO POR DEFECTO------------------------------------------- *--------------------------------------------------------------------------------------------------------- THISFORM.cmbAnio.SelectedID(11)=.T.
Combo "Liquidación Barra" (cmbLiqBarra)
*---------------------------------------------------------------------------------------------------------
*--CARGA DE LAS OPCIONES DEL CMBTITULO--------------------------------------------------------------------
*---------------------------------------------------------------------------------------------------------
THISFORM.cmbLiqBarra.AddItem("0")
THISFORM.cmbLiqBarra.AddItem("1")
THISFORM.cmbLiqBarra.AddItem("3")
THISFORM.cmbLiqBarra.AddItem("4")
THISFORM.cmbLiqBarra.AddItem("6")
THISFORM.cmbLiqBarra.AddItem("8")
THISFORM.cmbLiqBarra.AddItem("E")
THISFORM.cmbLiqBarra.AddItem("F")
*---------------------------------------------------------------------------------------------------------
*--SELECCIONO POR DEFECTO EL PRIMER ITEM DEL COMBO--------------------------------------------------------
*---------------------------------------------------------------------------------------------------------
THISFORM.cmbLiqBarra.SelectedID(1)=.T.
TABLAS
Aquí se detallan las tablas con los campos utilizados de cada una.
| codn_conce |
| vig_coano |
| vig_comes |
| desc_conce |
| desc_corta |
| tipo_conce |
| codc_vige1 |
| desc_nove1 |
| tipo_nove1 |
| cant_ente1 |
| cant_deci1 |
| codc_vige2 |
| desc_nove2 |
| tipo_nove2 |
| cant_ente2 |
| cant_deci2 |
| flag_acumu |
| flag_grupo |
| nro_orcal |
| nro_orimp |
| sino_legaj |
| tipo_distr |
| tipo_ganan |
| chk_acumsac |
| chk_acumproy |
| chk_dcto3 |
| chkacumprhbrprom |
| subcicloliquida |
| chkdifhbrcargoasoc |
| chkptesubconcep |
| chkinfcuotasnovper |
| genconimp0 |
| sino_visible |
INFORMACIÓN RELACIONADA
| Descripción | Reporte | Tabla | Indice | Observación | |
|---|---|---|---|---|---|
| Total Universidad | totales_proc_gene | lis_tot_gen | id_fuente | TGF | |
| Detalle Total Universidad | tot_proc_det | lis_tot_det | id_orden | TGD | |
| Planilla de Totales Generales por Fuente | totales_proc_gene-dep | lis_tot_gen_dep | id_depfu | TDF | 1 hoja por dependencia |
| Planilla Detallada de Totales | tot_proc_dep | lis_tot_dep | id_orden | TDD | 1 hoja por dependencia |