#include 'fivewin.ch'
Static oBrw2
Static oQry2
//----------------------------------------------------------------------------//
Function TablaLegajos( nCodigo, cCliente )
Local i
Local oFont1
Local oFont2
Local oFont3
Memvar oVar
nCodigo := oVar : oQry : id_empleado
cCliente := oVar : oQry : nombre
oQry2 := oVar : oServer : Query( 'select a.id_legajo, b.descrip as sub_emp, a.caracter, concat( cast( a.anti_anios as char ), "/", cast( anti_meses as char ) ) as antiguedad, ' +;
'a.cargo, a.estado, a.horas, a.dp, a.dod, a.motivo, a.f_lic, a.f_f_lic, a.goce_sueldo, a.alta, a.suplea, a.desde, a.hasta ' +;
'from legajo a, sub_emp b where id_empleado = ' + Alltrim( Str( nCodigo ) ) +;
' and a.id_empresa1 = b.empresa1 and b.empresa = ' + Alltrim( Str( oVar : nEmpresa ) ) )
Define Font oFont1 Name "Segoe UI Light" Size 0, -12 Bold
Define Font oFont2 Name "Segoe UI Light" Size 0, -12
Define Font oFont3 Name "Segoe UI" Size 0, -16
Define Window oVar : oWndChild2 MDICHILD Of oVar : oWndmain From -10, -10 To -100, -100 Pixel NoSysMenu NoCaption Title 'legajo/s de: ' + Alltrim( cCliente )//Color 0, CLR_BLACK
@ 100, 20 xBrowse oBrw2 DataSource oQry2 Columns 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 Size 1300, 400 Pixel Of oVar : oWndChild2 NoBorder
With Object oBrw2
For i := 1 To Len( :aCols )
Switch i
Case 1
:aCols[ i ] : nWidth := 60
:aCols[ i ] : cHeader := 'Nº LEG.'
:aCols[ i ] : bStrData := { || StrZero( oQry2 : id_legajo, 6 ) }
:aCols[ i ] : nDataStrAlign := 2
Exit
Case 2
:aCols[ i ] : nWidth := 260
:aCols[ i ] : cHeader := 'SECCIÓN'
:aCols[ i ] : nGrpHeight := 2
Exit
Case 3
:aCols[ i ] : bStrData := { || oQry2 : caracter }
:aCols[ i ] : nDataStrAlign := 2
:aCols[ i ] : nEditType := EDIT_GET
:aCols[ i ] : bEditValue := { || Padr( oQry2 : caracter, 1, ' ' ) }
//:aCols[ i ] : aEditListTxt := { "Titular", "Suplente", "Contratado", "Prov." }
//:aCols[ i ] : aEditListBound := { "T", "S", "C", "P" }
:aCols[ i ] : bOnPostEdit := { | o, x, n | UpdateCaracter( x ) }
:aCols[ i ] : cEditPicture := '@!'
Exit
Case 4
:aCols[ i ] : nWidth := 60
:aCols[ i ] : cHeader := 'ANTIG.'
Exit
Case 7
:aCols[ i ] : nWidth := 50
Exit
Case 8
:aCols[ i ] : nWidth := 100
:aCols[ i ] : cHeader := 'DESCUENTO' + CRLF + 'PRESENTISMO'
:aCols[ i ] : bStrData := { || If( oQry2 : dp, 'SI', 'NO' ) }
:aCols[ i ] : nDataStrAlign := 2
Exit
Case 9
:aCols[ i ] : nWidth := 100
:aCols[ i ] : cHeader := 'DESC. OBLIG.' + CRLF + 'DÍAS'
:aCols[ i ] : nDataStrAlign := 2
Exit
Case 10
:aCols[ i ] : nWidth := 100
:aCols[ i ] : cHeader := 'ARTICULO DE' + CRLF + 'LICENCIA'
:aCols[ i ] : nDataStrAlign := 2
Exit
Case 11
:aCols[ i ] : nWidth := 100
:aCols[ i ] : cHeader := 'FECHA INICIO' + CRLF + 'DE LICENCIA'
:aCols[ i ] : nDataStrAlign := 2
Exit
Case 12
:aCols[ i ] : nWidth := 100
:aCols[ i ] : cHeader := 'FECHA FIN' + CRLF + 'DE LICENCIA'
:aCols[ i ] : nDataStrAlign := 2
Exit
Case 13
:aCols[ i ] : nWidth := 100
:aCols[ i ] : cHeader := 'CON O SIN ' + CRLF + 'GOCE SUELDO'
:aCols[ i ] : bStrData := { || If( Valtype( oQry2 : f_lic ) == 'D' .and. !Empty( oQry2 : f_lic ) , If( oQry2 : goce_sueldo, 'CON', 'SIN'), '' ) }
:aCols[ i ] : nDataStrAlign := 2
Exit
Case 14
:aCols[ i ] : nWidth := 100
:aCols[ i ] : cHeader := 'F. DE INGRESO'
:aCols[ i ] : nDataStrAlign := 2
Exit
Case 15
:aCols[ i ] : nWidth := 100
:aCols[ i ] : cHeader := 'REEMPLAZA A'
//:aCols[ i ] : nDataStrAlign := 2
Exit
Case 16
:aCols[ i ] : nWidth := 100
:aCols[ i ] : cHeader := 'F. INICIO DE' + CRLF + 'LICENCIA'
:aCols[ i ] : nDataStrAlign := 2
Exit
Case 17
:aCols[ i ] : nWidth := 100
:aCols[ i ] : cHeader := 'F. FIN DE' + CRLF + 'LICENCIA'
:aCols[ i ] : nDataStrAlign := 2
Exit
EndSwitch
:aCols[ i ] : cHeader := Upper( :aCols[ i ] : cHeader )
:aCols[ i ] : oHeaderFont := oFont1
:aCols[ i ] : oDataFont := oFont2
:aCols[ i ] : nHeadStrAlign := 0
Next i
:bClrHeader := { || { 0, CLR_WHITE } }
:nRowHeight := 28
:nHeaderHeight := 40
:nColDividerStyle := 1
:nRowDividerStyle := 5
:nColAdvance := 50
:nColorPen := nRgb( 225, 225, 225 )
:nMarqueeStyle := 3
:nFreeze := 2
:nRecSelColor := CLR_WHITE
:bClrSelFocus := { || { CLR_WHITE, RGB( 43, 87, 154 ) } }
:nHeaderLines := 2
:lVScroll := .f.
:lFlatStyle := .t.
:l2007 := .f.
:lKinetic := .f.
:lAllowRowSizing := .f.
:lExcelCellWise := .t.
:lFreezeLikeExcel := .t.
:lFastEdit := .t.
:lColDividerComplete := .t.
:bKeyDown := { | nKey | KeyLegajos( nKey ) }
:SetGroupHeader( 'DATOS', 3, 14, oFont1 )
:SetGroupHeader( 'SOLO PARA SUPLENTES', 15, 17, oFont1 )
:CreateFromCode()
End
oVar : oWndChild2 : SetControl( oBrw2 )
Activate Window oVar : oWndChild2 Maximized Valid ( oFont1 : End(), oFont2 : End(), oFont3 : End(), .t. )
Return 0
//----------------------------------------------------------------------------//
Function UpdateCaracter( x )
Local cUpdate := 'update legajo set caracter = ' + ClipValue2Sql( x ) + ' where id_legajo = ' + Alltrim( Str( oQry2 : id_legajo ) )
? 'update legajo set caracter = ' + ClipValue2Sql( x ) + ' where id_legajo = ' + Alltrim( Str( oQry2 : id_legajo ) )
Memvar -> oVar : oServer : Execute( cUpdate )
oQry2 : Refresh()
oBrw2 : Refresh()
Return 0
//----------------------------------------------------------------------------//
Function KeyLegajos( nKey )
Memvar oVar
Switch nKey
Case VK_F7
oVar : nOpcion := 1
ElijeOpcion()
Exit
EndSwitch
Return 0