Planta de Liq. Generales de la UNC

De Wiki
Revisión del 13:36 14 feb 2012 de Mwilson (Discusión | contribuciones)

(dif) ← Revisión anterior | Revisión actual (dif) | Revisión siguiente → (dif)
Saltar a: navegación, buscar

FORMULARIO

planta.scx

Planta.PNG


Planta2.PNG

INFORME

planta.frx

Frx Planta.PNG

d_planta.frx

D planta.PNG

d_lic.frx

D lic.PNG

renova.frx

Renova.PNG

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
  *------------------------------------------

Programa "planta_s.prg"

  *public fechaL ,fecha
  public vm_legajo,vm_categ,vm_baja,fecha,fechal,descuenta,vm_cargo,vm_caracter
  descuenta ="N"
  SET DATE TO FRENCH
  SET CENTURY ON
  *set excl on
  
  *------base donde se carga los cargos con licencia
  tabla= vm_bases_informes + "horaslic"
  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),tipo c(4),;
                        fec_desde d(8),fec_hasta d(8))
                       
  *-------
  tabla= vm_bases_informes + "plantale"
  if used ("plantale")
    sele plantale
    use
  endif
  sele sele(1)  
  use &tabla excl
  index on legajo tag d_legajo additive
  index on cargo tag d_cargo
  *----------------------------------------------------------------------------------
  tabla= vm_bases_informes + "dh21uni"
  if used ("dh21uni")
    sele dh21uni
    use
  endif
  sele sele(1)  
  use &tabla excl
  index on nro_cargo tag dh21car
  *---------base con renovaciones de cargo**** 
  tabla= vm_bases_informes + "renova"
  create table &tabla free (categ C (4),agrup c(4),horas n(6),caracter c(4),;
                             depend c(3),legajo n(6), alta d(8), baja d(8) null ,cargo n(9),carant c(4))
  if used ('renova')
    sele renova
    use
  endif
  sele sele(1)  
  use &tabla excl
  index on depend+alltrim(str(legajo)) tag lis_renova
  *-----------------------------------------------------------------------------------------
  *---filtro
  *store "2003-06-30" to fechaL &&fecha para licencias s/g
  *store {^2003/06/01} to fecha   &&fecha para cargos vigentes
  
  *----------------------------------------------------------------------------------------
  
  
  sele dh03
  set filter to (fec_baja >= &fecha)  or (empty(fec_baja)=.t.) or isnull(fec_baja)
  index on padl(alltrim(str(nro_legaj)),6,"0")+ padl(alltrim(codc_categ),3,"0")+padl(alltrim(str(nro_cargo)),9,"0") tag dh03L
  
  
  
  *-----------------------------------------------
  
  
  *----------------------------------
  cadenasql=   "select *";
             + " from dl02"
  nom5=sys(3)
  create sql view &nom5;
  connection con_pampasql;
  as &cadenasql
  
  if !used('v_dl02')
   sele sele(1)  
   use &nom5 alias v_dl02
  endif
  
  tabla= vm_bases_informes + "dl02"
  select *;
  from v_dl02;
  into table &tabla
  *-----
  if used ('dl02')
    sele dl02
    use
  endif
  sele sele(1)  
  use &tabla excl
  
  
  *---------------------------------------------------
  *-----------base donde se carga la planta
  tabla= vm_bases_informes + "planta"
  if used ('planta')
    sele planta
    use
  endif
  sele sele(1)  
  use &tabla excl
  *---------------------------------------------------
 
 
  
  *--licencias de legajos en periodo informado por el usuario
       select distinct dh05.nro_legaj,dh05.fec_desde,;
                       dh05.fec_hasta, dh05.nrovarlice, dl02.codn_tipo_;
              from dh05,dL02,dh03 where dh05.nro_cargo = 0 and ;
                   dh05.nro_legaj = dh03.nro_legaj and;
                   dl02.nrovarlice =dh05.nrovarlice and;
                   dl02.porcremune  = 0 and dh05.fec_hasta >=&fechaL;
                   into table vm_bases_informes+"V_L"
    
        
  *--licencia de cargos
            select distinct dh05.nro_cargo , dh05.fec_desde,;
                            dh05.fec_hasta, dh05.nrovarlice, dl02.codn_tipo_;
                   from dh05,dL02,dh03 where dh05.nro_legaj = 0 and ;
                        dh05.nro_cargo = dh03.nro_cargo and ;
                        dl02.nrovarlice = dh05.nrovarlice and;
                        dl02.porcremune  = 0 and dh05.fec_hasta >=&fechaL;
                        into table vm_bases_informes+"V_C"
  
  *----------------------------
  
  *--tabla para la vista de licencias por cargos      
  tabla= vm_bases_informes+"lic_c"   
  select *;
  from V_C;
  into table &tabla
  index on nro_cargo tag cargo
  *---tabla para la vista de licencias por legajos
  tabla= vm_bases_informes+"lic_l"   
  select *;
  from V_L;
  into table &tabla
  index on nro_legaj tag legajo 
  
  *-------------------------------------------------
  
  *-------lee el dh03 con cargos vigentes al mes y si tienen subrogancia(no docente) lo agrega 
  *en la plantay plantale
  sele dh03
  
  scan
    SCATTER MEMVAR
    if m.nro_legaj =39100
    * set step on
    endif
    if dh03.codc_carac = "SUBR"
       sele planta
       set order to planta
       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  
     do buscolic  &&llama al procedimiento que busca lic sin goce
     sele dh03
  endscan
  *----------------
  
  *----lee del dh21 los cargos pagados y controla si tienen cargos renovados y si notiene licencia
  *---lo resta de la planta 
  sele dh21uni  &&son los cargos pagados 
  go top
    scan
      scatter memvar
      vm_regis=recno()
      sele dh03 &&esta filtrada por cargos vigentes
      set order to cargo
      if seek (m.nro_cargo)
         if m.nro_cargo=76304
  *       set step on
         endif   
          vm_legajo = dh03.nro_legaj
          vm_categ    = ALLTRIM(dh03.codc_categ)
          vm_baja     = dh03.fec_baja
          vm_depend   = ALLTRIM(dh03.codc_uacad)
          vm_caracter = ALLTRIM(dh03.codc_carac)
          vm_cargo    = padl(alltrim(str(dh03.nro_cargo)),9,"0")
          SET ORDER TO DH03L
          GO TOP
          if SEEK(PADL(ALLTRIM(STR(vm_legajo)),6,"0")+padl(alltrim(vm_categ),3,"0"))
           SCAN WHILE vm_legajo = dh03.nro_legaj and vm_categ = alltrim(dh03.codc_categ) and vm_depend = alltrim(dh03.codc_uacad)
            if !empty (vm_baja )
               if (vm_baja + 1) = dh03.fec_ALTA
                 sele dh21uni
                 set order to dh21car
                 go top
                 if seek(dh03.nro_cargo)
                   sele renova
                   append blank
                   repla categ     with dh03.codc_categ
                   repla depend    with alltrim(dh03.codc_uacad)
                   if vm_caracter # dh03.codc_carac
                     repla carant  with alltrim(vm_caracter) 
                   endif  
                   repla caracter  with alltrim(dh03.codc_carac) 
                   repla agrup     with alltrim(dh03.codc_agrup)
                   repla horas     with (dh03.hs_dedic)
                   repla legajo    with dh03.nro_legaj
                   repla alta      with dh03.fec_alta
                   repla baja      with dh03.fec_baja
                   repla cargo     with dh03.nro_cargo
                   sele plantale
                   set order to d_cargo
                   if seek (vm_cargo) && si lo encuentra significa que tiene dias y dias y lo debe restar de planta detallada
                     dele 
                     pack
                   endif  
                   @ 2,0  clear to 2,60
                   @ 2,45 say "Fin del Proceso"
                   *wait windows "Fin del proceso" nowait
                 endif  
               endif
             endif
           sele dh03
           endscan
          endif
           
      endif  
      sele dh21uni
      goto vm_regis
  endscan
   
  *----esta parte lee del renova hacia el dh21uni para detectar si existen--------
  *----cargos renovados que se hayan pagado en el mismo mes en la misma dep.
  sele renova
  go top
  scan
    banlic=0
    scatter memvar
    sele dh21uni
    set order to dh21car
    if seek (m.cargo)
      sele planta
      set order to planta
      if !seek(alltrim(m.categ)+alltrim(m.depend)+alltrim(m.caracter)+alltrim(m.agrup))
  *!*	      append blank
  *!*	      repla categ    with m.categ
  *!*	      repla depend   with m.depend
  *!*	      repla caracter with m.caracter
  *!*	      repla agrup    with m.agrup
  *!*	      if (m.horas) <> 0
  *!*	        repla renova with m.horas &&acumulo las hs renovadas
  *!*	      else
  *!*        repla renova with 1
  *!* 	      endif 
      else  &&si ya existe la categoria en el pampa 
        ***se fija si tiene licencias del cargo
        sele lic_c
        set order to cargo
        if seek (m.cargo) &&si un cargo renovado tiene licencia de cargo lo cargo como renovado y no lo resto de los cargos ocupados
          banlic=1   
          sele planta
          if (m.horas) <> 0
            repla renova   with renova + m.horas
         else
            repla renova   with renova+1  
          endif
        else
          ***se fija si tiene licencias del legajo
          sele lic_l
          set order to legajo
          if seek (m.legajo) &&si un cargo renovado tiene licencia de legajo lo cargo como renovado y no lo resto de los cargos ocupados
            banlic=1   
            sele planta
            if (m.horas) <> 0
              repla renova   with renova + m.horas
            else
              repla renova   with renova+1  
            endif   
          else
            **si un cargo renovado no tiene licencia lo cargo como renovado y lo resto de la planta
            sele planta
            if empty(alltrim(m.carant))=.t.
              if (m.horas) <> 0
                repla horas    with horas - (m.horas)  &&le resto las horas de los cargos renovados
                repla renova   with renova + m.horas
              else
                repla ocupados with ocupados - 1 &&le resto las personas de los cargos renovados
                repla renova   with renova+1  
              endif
            else
              if (m.horas) <> 0
                repla renova   with renova + m.horas
              else
                repla renova   with renova+1  
              endif
            endif 
          endif
        endif
        **busco por caracter cambiado
        sele planta
        set order to planta
        go top
        if seek(alltrim(m.categ)+alltrim(m.depend)+ m.carant + alltrim(m.agrup) )
          if (m.horas) <> 0
            repla planta.horas with horas - (m.horas) 
          else 
            repla planta.ocupados with ocupados -1  
          endif   
        endif
      endif
    endif
    sele renova
  endscan 
  
  *------------
  
  
  
  
  *-------procedimientos
  **no corre mas
  ***-----busca si tiene licencias sin goce y las carga en otro campo en la planta sin restar nada
  ****no corre mas
  **si tiene licencias sin goce o sea dias y dias lo resta de cargos ocupados
  procedure buscolic
  
  **viene del dh03
  sele lic_l  &&licencia por legajo
  set order to legajo
  if seek (m.nro_legaj) && si tiene lic por legajo
    **si tiene licencias s/g cargo las horas y ocupados con licencias
    sele plantale
    set order to d_legajo
    if seek (padl(alltrim(str(m.nro_legaj)),6,"0")) && si lo encuentra significa que tiene dias y dias y lo debe restar de planta
      descuenta = "S"
      **borro de plantale
      delete
    else
      descuenta = "N"  
    endif     
    sele planta
    set order to planta
       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)
          if dh03.hs_dedic <> 0
            repla horas_l    with horas_l+dh03.hs_dedic
          else
           repla conlic with conlic+1  
          endif
       else
          if dh03.hs_dedic <> 0
           repla horas_l    with horas_l+dh03.hs_dedic
          else
           repla conlic with conlic+1  
          endif
          if descuenta = "S"
            if dh03.hs_dedic <> 0 
               repla horas    with horas-dh03.hs_dedic
            else
               repla ocupados with ocupados-1   
            endif
              descuenta = "N"
          endif
       endif
       if (alltrim(lic_l.codn_tipo_) = "999" or alltrim(lic_l.codn_tipo_) = "996")
         repla planta.L9969 with planta.L9969 + 1
         repla planta.H9969 with planta.H9969 + dh03.hs_dedic
         
       endif
       if (alltrim(lic_l.codn_tipo_) = "9991" )
         repla planta.L9991 with planta.L9991 + 1
         repla planta.H9991 with planta.H9991 + dh03.hs_dedic
         
       endif
       sele horaslic
       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_l     with (dh03.hs_dedic)
       repla legajo    with padl(alltrim(str(dh03.nro_legaj)),6,"0")
       repla cargo     with padl(alltrim(str(dh03.nro_cargo)),9,"0")
       repla tipo      with lic_l.codn_tipo_
       repla fec_desde with lic_l.fec_desde
       repla fec_hasta with lic_l.fec_hasta
       
  endif
  sele lic_c
  set order to cargo
  if nro_cargo = 109343
  * set step on
  endif 
  
  if seek (m.nro_cargo)
    **si tiene licencias s/g cargo las horas y ocupados con licencias
    sele plantale
    set order to d_cargo
    if seek (padl(alltrim(str(m.nro_cargo)),9,"0")) && si lo encuentra significa que tiene dias y dias y lo debe restar de planta
      descuenta = "S"
      **borro de plantale
      delete
    else
      descuenta = "N"  
    endif     
    sele planta
    set order to planta
       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)
          if dh03.hs_dedic <> 0
           repla horas_l    with horas_l+dh03.hs_dedic
          else
           repla conlic with conlic+1  
          endif
          
       else
          if dh03.hs_dedic <> 0
           repla horas_l    with horas_l+dh03.hs_dedic
          else
           
           repla conlic with conlic+1  
          endif
       endif
       if descuenta = "S"
            if dh03.hs_dedic <> 0 
               repla horas    with horas-dh03.hs_dedic
            else
               repla ocupados with ocupados-1   
            endif
              descuenta = "N"
       endif
       **si es licencia 999 o 996 no resta nada del total ocupado
       if (alltrim(lic_c.codn_tipo_) = "999" or alltrim(lic_c.codn_tipo_) = "996")
         repla planta.L9969 with planta.L9969 + 1
         repla planta.H9969 with planta.H9969 + dh03.hs_dedic
       endif
       if (alltrim(lic_c.codn_tipo_) = "9991" )
         repla planta.L9991 with planta.L9991 + 1
         repla planta.H9991 with planta.H9991 + dh03.hs_dedic
         
       endif
  
       sele horaslic
       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_l     with (dh03.hs_dedic)
       repla legajo    with padl(alltrim(str(dh03.nro_legaj)),6,"0")
       repla cargo     with padl(alltrim(str(dh03.nro_cargo)),9,"0")
       repla tipo      with lic_c.codn_tipo_
       repla fec_desde with lic_c.fec_desde
       repla fec_hasta with lic_c.fec_hasta
  endif
  return
  
  *----------------------
  *-----destruyo las vista 
  sele 1
  use
  drop view &nom1
  *-------
  sele 1
  use
  drop view &nom3
  sele 1
  use
  drop view &nom2


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 "Listado"(Command3)

  *--seteo
   set safe off
   set century on
   set date to french
   vm_mes =(thisform.text1.value)
   vm_anio = (thisform.text2.value)
  
  *-------------------------------------------------------
    tabla= vm_bases_informes + "planta"
    if used ("planta")
       sele planta
       use
    endif
    sele sele(1)  
    use &tabla excl
    set order to listado
   
      tabla= vm_bases_informes + "plantale"
      if used ("plantale")
         sele plantale
         use
      endif
      sele sele(1)  
      use &tabla excl
      index on padl(alltrim(depend),3,"0")+padl(alltrim(categ),4,"0")+alltrim(caracter)+padl(alltrim(legajo),6,"0") tag d_lista
    
      tabla= vm_bases_informes + "horaslic"
      if used ("horaslic")
         sele horaslic
         use
      endif
      sele sele(1)  
      use &tabla excl
      index on padl(alltrim(depend),3,"0")+padl(alltrim(categ),4,"0")+alltrim(caracter) tag d_liclis
  
  
  
  *----------------------------------------------------------------------------
  *******pagina 1
  if thisform.pageframe1.activepage = 1
  &&planta 
   if thisform.pageframe1.page1.optiongroup1.option1.value = 1 &&planta por depend
     if !empty(alltrim(thisform.pageframe1.page1.text3.value))
      sele planta
      set filter to alltrim(depend)= padl(alltrim(thisform.pageframe1.page1.text3.value ),2,"0")
      report format vm_informes+"planta.frx" preview 
     else
       messagebox ("Ingrese N° de dependencia.")
       thisform.pageframe1.page1.text3.setfocus
     endif  
   endif
   
   if thisform.pageframe1.page1.optiongroup1.option2.value = 1 &&planta todas dep
       sele planta
       set filter to
       report format vm_informes+"planta.frx" preview 
   endif 
    
  &&detalle planta por depend
  do case
   *--depend
case thisform.pageframe1.page1.check1.value = 1  and thisform.pageframe1.page1.check2.value = 0  and thisform.pageframe1.page1.check3.value=0
     if !empty(alltrim(thisform.pageframe1.page1.text4.value))
       sele plantale
       set filter to alltrim(depend)= padl(alltrim(thisform.pageframe1.page1.text4.value ),2,"0") 
        report format vm_informes+"d_planta.frx" preview 
      else
       messagebox ("Ingrese N° de dependencia.")
       thisform.pageframe1.page1.text4.setfocus
      endif
  
  *-----categoria
  case thisform.pageframe1.page1.check1.value = 0  and thisform.pageframe1.page1.check2.value = 1 and thisform.pageframe1.page1.check3.value=0
       if !empty(alltrim(thisform.pageframe1.page1.text5.value))
          sele plantale
          set filter to  padl(alltrim(categ),4,"0") = padl(alltrim(thisform.pageframe1.page1.text5.value  ),4,"0")
          report format vm_informes+"d_planta.frx" preview 
       else
          messagebox ("Ingrese Categoria")
          thisform.pageframe1.page1.text5.setfocus 
       endif
       
   *------caracter
  case thisform.pageframe1.page1.check1.value = 0  and thisform.pageframe1.page1.check2.value = 0 and thisform.pageframe1.page1.check3.value=1 
          if !empty(alltrim(thisform.pageframe1.page1.text6.value)) 
               sele plantale
               set filter to  alltrim(caracter) = alltrim(thisform.pageframe1.page1.text6.value) 
               report format vm_informes+"d_planta.frx" preview 
          else
               messagebox ("Ingrese Caracter")
              thisform.pageframe1.page1.text6.setfocus 
          endif
        
   *--depend+categ
 case thisform.pageframe1.page1.check1.value = 1  and thisform.pageframe1.page1.check2.value = 1 and thisform.pageframe1.page1.check3.value=0
      if !empty(alltrim(thisform.pageframe1.page1.text4.value))
        if !empty(alltrim(thisform.pageframe1.page1.text5.value))
          sele plantale
          set filter to alltrim(depend)= padl(alltrim(thisform.pageframe1.page1.text4.value ),2,"0") and padl(alltrim(categ),4,"0") =    
  padl(alltrim(thisform.pageframe1.page1.text5.value  ),4,"0")
           report format vm_informes+"d_planta.frx" preview 
        else
          messagebox ("Ingrese Categoria")
          thisform.pageframe1.page1.text5.setfocus 
        endif
       else
          messagebox ("Ingrese N° de dependencia.")
          thisform.pageframe1.page1.text4.setfocus
       endif 
  *----dep+caracter
    *-depend+caracter
 case thisform.pageframe1.page1.check1.value = 1  and thisform.pageframe1.page1.check2.value = 0 and thisform.pageframe1.page1.check3.value=1 
        if !empty(alltrim(thisform.pageframe1.page1.text4.value))
            if !empty(alltrim(thisform.pageframe1.page1.text6.value)) 
               sele plantale
               set filter to alltrim(depend)= padl(alltrim(thisform.pageframe1.page1.text4.value ),2,"0");
                       and alltrim(caracter) = alltrim(thisform.pageframe1.page1.text6.value) 
               report format vm_informes+"d_planta.frx" preview 
            else
               messagebox ("Ingrese Caracter")
               thisform.pageframe1.page1.text6.setfocus 
            endif
        else
          messagebox ("Ingrese N° de dependencia.")
          thisform.pageframe1.page1.text4.setfocus
        endif     
  
  
    *-depend+categ+caracter
  case thisform.pageframe1.page1.check1.value = 1  and thisform.pageframe1.page1.check2.value = 1 and thisform.pageframe1.page1.check3.value=1 
        if !empty(alltrim(thisform.pageframe1.page1.text4.value))
          if !empty(alltrim(thisform.pageframe1.page1.text5.value))
             if !empty(alltrim(thisform.pageframe1.page1.text6.value)) 
               sele plantale
               set filter to alltrim(depend)= padl(alltrim(thisform.pageframe1.page1.text4.value ),2,"0");
               and padl(alltrim(categ),4,"0") = padl(alltrim(thisform.pageframe1.page1.text5.value  ),4,"0") ;
               and alltrim(caracter) = alltrim(thisform.pageframe1.page1.text6.value) 
                report format vm_informes+"d_planta.frx" preview 
             else
               messagebox ("Ingrese Caracter")
          thisform.pageframe1.page1.text6.setfocus 
             endif
          else
            messagebox ("Ingrese Categoria")
          thisform.pageframe1.page1.text5.setfocus 
          endif
        else
          messagebox ("Ingrese N° de dependencia.")
          thisform.pageframe1.page1.text4.setfocus
        endif     
    *-categ+caractr
  case thisform.pageframe1.page1.check1.value = 0  and thisform.pageframe1.page1.check2.value = 1 and thisform.pageframe1.page1.check3.value=1 
          if !empty(alltrim(thisform.text5.value))
             if !empty(alltrim(thisform.text6.value)) 
               sele plantale
               set filter to  padl(alltrim(categ),4,"0") = padl(alltrim(thisform.text5.value  ),4,"0") ;
               and alltrim(caracter) = alltrim(thisform.pageframe1.page1.text6.value) 
               report format vm_informes+"d_planta.frx" preview 
             else
               messagebox ("Ingrese Caracter")
               thisform.pageframe1.page1.text6.setfocus 
             endif
          else
            messagebox ("Ingrese Categoria")
            thisform.pageframe1.page1.text5.setfocus 
          endif
       
  
  endcase
  
  
  &&detalle licencias
  do case
    **solo dependencia
 case thisform.pageframe1.page1.check4.value = 1  and thisform.pageframe1.page1.check5.value = 0  and thisform.pageframe1.page1.check6.value=0
     if !empty(alltrim(thisform.pageframe1.page1.text7.value)) 
      sele horaslic
      set filter to alltrim(depend)= padl(alltrim(thisform.pageframe1.page1.text7.value ),2,"0") 
      report format vm_informes+"d_lic.frx" preview 
     else
      messagebox ("Ingrese N° de dependencia.")
      thisform.pageframe1.page1.text7.setfocus
     endif
  *---
  **solo categoria
  case thisform.pageframe1.page1.check4.value = 0  and thisform.pageframe1.page1.check5.value = 1 and thisform.pageframe1.page1.check6.value=0
     if !empty(alltrim(thisform.pageframe1.page1.text8.value)) 
         sele horaslic
         set filter to padl(alltrim(categ),4,"0") = padl(alltrim(thisform.pageframe1.page1.text8.value  ),4,"0")
         report format vm_informes+"d_lic.frx" preview 
     else
         messagebox ("Ingrese Categoria")
         thisform.pageframe1.page1.text8.setfocus
     endif
   
   *--solo caracter  
  case thisform.pageframe1.page1.check4.value = 0  and thisform.pageframe1.page1.check5.value = 0 and thisform.pageframe1.page1.check6.value=1 
         if !empty(alltrim(thisform.pageframe1.page1.text9.value)) 
           sele horaslic
           set filter to alltrim(caracter) = alltrim(thisform.pageframe1.page1.text9.value) 
           report format vm_informes+"d_lic.frx" preview 
         else
            messagebox ("Ingrese Caracter")
            thisform.pageframe1.page1.text9.setfocus
         endif
        
    ***depe+categoria
  case thisform.pageframe1.page1.check4.value = 1  and thisform.pageframe1.page1.check5.value = 1 and thisform.pageframe1.page1.check6.value=0
     if !empty(alltrim(thisform.pageframe1.page1.text7.value)) 
       if !empty(alltrim(thisform.pageframe1.page1.text8.value)) 
         sele horaslic
         set filter to alltrim(depend)= padl(alltrim(thisform.pageframe1.page1.text7.value ),2,"0") and padl(alltrim(categ),4,"0") =     
  padl(alltrim(thisform.pageframe1.page1.text8.value  ),4,"0")
         report format vm_informes+"d_lic.frx" preview 
        else
         messagebox ("Ingrese Categoria")
        thisform.pageframe1.page1.text8.setfocus
        endif
     else
        messagebox ("Ingrese N° de dependencia.")
        thisform.pageframe1.page1.text7.setfocus
     endif   
    **dep+categ+caracter
    case thisform.pageframe1.page1.check4.value = 1  and thisform.pageframe1.page1.check5.value = 1 and isform.pageframe1.page1.check6.value=1 
     if !empty(alltrim(thisform.pageframe1.page1.text7.value)) 
       if !empty(alltrim(thisform.pageframe1.page1.text8.value)) 
         if !empty(alltrim(thisform.pageframe1.page1.text9.value)) 
           sele horaslic
           set filter to alltrim(depend)= padl(alltrim(thisform.pageframe1.page1.text7.value ),2,"0");
           and padl(alltrim(categ),4,"0") = padl(alltrim(thisform.pageframe1.page1.text8.value  ),4,"0") ;
           and alltrim(caracter) = alltrim(thisform.pageframe1.page1.text9.value) 
           report format vm_informes+"d_lic.frx" preview 
          else
            messagebox ("Ingrese Caracter")
            thisform.pageframe1.page1.text9.setfocus
          endif
        else
           messagebox ("Ingrese Categoria")
           thisform.pageframe1.page1.text8.setfocus
        endif    
       else
        messagebox ("Ingrese N° de dependencia.")
        thisform.pageframe1.page1.text7.setfocus
    endif
  *----dep+caracter
  case thisform.pageframe1.page1.check4.value = 1  and thisform.pageframe1.page1.check5.value = 0 and thisform.pageframe1.page1.check6.value=1 
     if !empty(alltrim(thisform.pageframe1.page1.text7.value)) 
         if !empty(alltrim(thisform.pageframe1.page1.text9.value)) 
           sele horaslic
           set filter to alltrim(depend)= padl(alltrim(thisform.pageframe1.page1.text7.value ),2,"0");
           and alltrim(caracter) = alltrim(thisform.pageframe1.page1.text9.value) 
           report format vm_informes+"d_lic.frx" preview 
          else
            messagebox ("Ingrese Caracter")
            thisform.pageframe1.page1.text9.setfocus
          endif
      else
            messagebox ("Ingrese N° de dependencia.")
            thisform.pageframe1.page1.text7.setfocus
      endif      
     
  *---categ + caracter
  case thisform.pageframe1.page1.check4.value = 0  and thisform.pageframe1.page1.check5.value = 1 and thisform.pageframe1.page1.check6.value=1 
       if !empty(alltrim(thisform.pageframe1.page1.text8.value)) 
         if !empty(alltrim(thisform.pageframe1.page1.text9.value)) 
           sele horaslic
           set filter to padl(alltrim(categ),4,"0") = padl(alltrim(thisform.pageframe1.page1.text8.value  ),4,"0") ;
           and alltrim(caracter) = alltrim(thisform.pageframe1.page1.text9.value) 
           report format vm_informes+"d_lic.frx" preview 
          else
            messagebox ("Ingrese Caracter")
            thisform.pageframe1.page1.text9.setfocus
          endif
        else
           messagebox ("Ingrese Categoria")
           thisform.pageframe1.page1.text8.setfocus
        endif    
  endcase
  endif
  set filter to
  
  if thisform.pageframe1.activepage = 2
  ***pagina 2
   if thisform.pageframe1.page2.optiongroup2.option1.value = 1 
     if !empty(alltrim(thisform.pageframe1.page2.text3.value))
      sele RENOVA
     set order to lis_renova
     set filter to alltrim(depend)= padl(alltrim(thisform.pageframe1.page2.text3.value ),2,"0")
     report format vm_informes+"renova.frx" preview 
    else
       messagebox ("Ingrese N° de dependencia.")
       thisform.pageframe1.page2.text3.setfocus
     endif  
   endif
   
   if thisform.pageframe1.page2.optiongroup2.option2.value = 1 
       sele renova
       set order to lis_renova
       set filter to
       report format vm_informes+"renova.frx" preview 
   endif 
  endif
  set filter to

Botón "Cancelar" (Command2)

  close table all
  thisform.release

MANUAL DEL USUARIO

Procedimiento de Uso