Planta de Liq. Generales de la UNC
De Wiki
Revisión del 13:56 31 ene 2012 de Mwilson (Discusión | contribuciones) (→Programa "prg_fec_permanencia.prg")
Contenido
FORMULARIO
INFORME
CÓDIGO
Programa "planta.prg"
SET DELETED ON SET DATE TO DMY SET TALK OFF SET EXCLUSIVE ON SET CENTURY ON SET SAFE OFF *-- ** *wait windows "Espere un momento por favor. Procesando datos......."+chr(13)+"Puede tardar unos minutos " *------ tabla= vm_bases_informes + "plantale" create table &tabla free (categ C (4),agrup c(4),horas n(6),caracter c(4),; depend c(3),horas_l n(6),legajo c(6),cargo c(9)) *----- tabla= vm_bases_informes + "planta" create table &tabla free (categ C (4),agrup c(4),horas n(6),caracter c(4),; ocupados n(6), depend c(3), conlic n(6),; renova n(6),horas_l n(6),conlic_s n(6),; L9969 n(6),L9991 n(6),descrip c(60),H9969 n(6),H9991 n (6)) *----------------------------------------------------------------------------- SELE DISTINC(NRO_CARGO)as nro_cargo,nro_legaj FROM dh21 INTO table vm_bases_informes + "dh21uni" sele dh03 index on nro_cargo tag cargo *------------------------------------------------ *---abro la vista del dh11 actual cadenasql= "select *"; + " from dh11" nom5=sys(3) create sql view &nom5; connection con_pampasql; as &cadenasql *connection con_pampasql; if !used('v_11') sele sele(1) use &nom5 alias v_11 endif tabla= vm_bases_informes + "dh11" select *; from v_11; into table &tabla *----- if used ('dh11') sele dh11 use endif sele sele(1) use &tabla excl index on val(codc_categ) tag categ *------------------------------------------------ tabla= vm_bases_informes + "planta" if used ("planta") sele planta use endif sele sele(1) use &tabla excl index on alltrim(categ)+alltrim(depend)+alltrim(caracter)+alltrim(agrup) tag planta additive index on padl(alltrim(depend),3,"0")+padl(alltrim(categ),4,"0") tag listado *--------------------------------------------------------------------------------- public vm_depend store " " to vm_depend ********* **lee del dh21uni los cargos liquidados y saca del dh03 la categoria del agente y lo cuenta **como ocupado en planta segun categoria , caracter y agrupamiento **carga tambien en plantale el detalle de la persona SELE DH21UNI &&nro de cargos distintos scan SCATTER MEMVAR sele dh03 set order to CARGO if seek(m.NRO_CARGO) sele planta set order to planta @ 2,45 say "Procesando...." if !seek(alltrim(dh03.codc_categ)+alltrim(dh03.codc_uacad)+alltrim(dh03.codc_carac)+alltrim(dh03.codc_agrup)) *primera vez append blank repla categ with dh03.codc_categ repla depend with alltrim(dh03.codc_uacad) repla caracter with alltrim(dh03.codc_carac) repla agrup with alltrim(dh03.codc_agrup) repla horas with (dh03.hs_dedic) repla ocupados with 1 else repla ocupados with ocupados+1 repla horas with horas+dh03.hs_dedic endif sele plantale append blank repla legajo with padl(alltrim(str(dh03.nro_legaj)),6,"0") repla cargo with padl(alltrim(str(dh03.nro_cargo)),9,"0") repla categ with dh03.codc_categ repla depend with alltrim(dh03.codc_uacad) repla caracter with alltrim(dh03.codc_carac) repla agrup with alltrim(dh03.codc_agrup) repla horas with (dh03.hs_dedic) endif sele dh21UNI endscan *------------------------------------------ llamada=vm_programas + "planta_s.prg" *llamada1=vm_programas + "planta_r.prg" do &llamada *do &llamada1 sele planta scan sele dh11 set order to categ if seek(val(planta.categ)) repla planta.descrip with dh11.desc_categ endif sele planta endscan return *------------------------------------------
Botón "Ejecutar" (Command1)
set excl on public planta, depend,busca,buscadh03,base,basedh03,buscadh05,basedh05 public fechaL ,fecha store " " to planta store 0 to depend base = "pla"+padl(alltrim(thisform.text1.value),2,"0")+right(alltrim(str(thisform.text2.value)),2) busca =vm_bases+ "pla"+padl(alltrim(thisform.text1.value),2,"0")+right(alltrim(str(thisform.text2.value)),2)+".dbf" buscadh05 =vm_bases+ "dh05"+padl(alltrim(thisform.text1.value),2,"0")+right(alltrim(str(thisform.text2.value)),2)+".dbf" basedh05 = "dh05"+padl(alltrim(thisform.text1.value),2,"0")+right(alltrim(str(thisform.text2.value)),2) buscadh03 =vm_bases+ "dh03"+padl(alltrim(thisform.text1.value),2,"0")+right(alltrim(str(thisform.text2.value)),2)+".dbf" basedh03 = "dh03"+padl(alltrim(thisform.text1.value),2,"0")+right(alltrim(str(thisform.text2.value)),2) if empty(thisform.text1.value ) = .f. if empty(thisform.text2.value ) = .f. *---------dh05------------------- if FILE('&buscadh05') = .t. if not used ('dh05') sele sele(1) *use &basedh05 alias dh05 use &buscadh05 alias dh05 else sele dh05 endif planta = "S" else wait windows "No existe inf de cargos del mes ingresado" planta = "N" endif *---------dh03------------------- if FILE('&buscadh03') = .t. if !used ('dh03') sele sele(1) *use &basedh03 alias dh03 use &buscadh03 alias dh03 else sele dh03 endif planta = "S" else wait windows "No existe inf de cargos del mes ingresado" planta = "N" endif *-------planta-------------------------------------------------------------- if FILE('&busca') = .t. if !used ('dh21') sele sele(1) *use &base alias dh21 use &busca alias dh21 else sele dh21 endif planta = "S" else wait windows "No existe inf de planta del mes ingresado" planta = "N" endif else wait windows "debe ingresar año" nowait endif else wait windows "debe ingresar mes" nowait endif planta = "S" if planta = "S" fecha = ('{^' + alltrim(str(thisform.text2.value))+ '/' + padl(alltrim(thisform.text1.value),2,"0") +'/01}') if inlist(val(alltrim(thisform.text1.value)) ,1,3,5,7,8,10,12) *fechaL = alltrim(str(thisform.text2.value))+ '-' + padl(alltrim(thisform.text1.value),2,"0") +'-31' fechaL = ('{^' + alltrim(str(thisform.text2.value))+ '/' + padl(alltrim(thisform.text1.value),2,"0") +'/31}') endif if inlist(val(alltrim(thisform.text1.value)),4,6,9,11) *fechaL = alltrim(str(thisform.text2.value))+ '-' + padl(alltrim(thisform.text1.value),2,"0") +'-30' fechaL = ('{^' + alltrim(str(thisform.text2.value))+ '/' + padl(alltrim(thisform.text1.value),2,"0") +'/30}') endif if val(alltrim(thisform.text1.value)) = 2 AND thisform.text2.value % 4=0 *año 2004 bisiesto febrero trae 29 fechaL = ('{^' + alltrim(str(thisform.text2.value))+ '/' + padl(alltrim(thisform.text1.value),2,"0") +'/29}') endif if val(alltrim(thisform.text1.value)) = 2 AND thisform.text2.value %4 <>0 fechaL = ('{^' + alltrim(str(thisform.text2.value))+ '/' + padl(alltrim(thisform.text1.value),2,"0") +'/28}') endif do vm_programas+"planta.prg" endif thisform.command3.enabled = .t. thisform.pageframe1.page1.optiongroup4.option1.enabled = .t. thisform.pageframe1.page1.optiongroup4.option2.enabled = .t. thisform.pageframe1.page1.optiongroup4.option3.enabled = .t. thisform.pageframe1.page1.optiongroup1.option1.enabled = .t. thisform.pageframe1.page1.optiongroup1.option2.enabled = .t. thisform.pageframe1.page2.optiongroup2.option1.enabled = .t. thisform.pageframe1.page2.optiongroup2.option2.enabled = .t. thisform.pageframe1.page2.optgroupreno.optrenova.enabled = .t. thisform.pageframe1.page2.optgroupreno.opincapa.enabled = .t. thisform.command1.enabled = .f. *store "2003-06-30" to fechaL &&fecha para licencias s/g *store {^2003/06/01} to fecha &&fecha para cargos vigentes
Botón "Cancelar" (btnCancelar)
THISFORM.Release