SELECT 1
SET ORDER to TAG VNUMBER
GO TOP
xALIAS := ALIAS()
cMOTORPOOL := xPOOL
xMOTOR := "Agency "+alltrim(xAGENCY)+" for Motorpool "+alltrim( xPOOL )
DEFINE WINDOW oWNDCHILD MDICHILD ;
FROM 1,1 to 33,100 ;
of oWNDMDI ;
NOSYSMENU ;
NOZOOM ;
NOMINIMIZE ;
TITLE "Reservation Information"
DEFINE DIALOG oEMP RESOURCE "RESBROW" of oWNDCHILD
REDEFINE XBROWSE oBrow ID 111 OF oEMP ALIAS xAlias ;
AUTOSORT AUTOCOLS LINES CELL
oBrow:nRowHeight := 15
oBrow:bLDblClick := { |nRow,nCol | oBtn1:Hide(),;
oBtn2:Hide(), ;
oBtn3:Hide(), ;
oBtn4:Hide(), ;
oBtn5:Hide(), ;
_PtrpBrow( CTOD("00/00/00"), A->VNUMBER, oRsPtrips, oRstrips ),;
_ReFrsh( A->VNUMBER, dDATE1 ), ;
oBtn1:Show(), ;
oBtn2:Show(), ;
oBtn3:Show(), ;
oBtn4:Show(), ;
oBtn5:Show(), ;
oBROW:REFRESH(), SysReFresh(),;
oBROW:SetFocus() }
oBROW:nFREEZE := 5
AEval( oBrow:aCols, { |o| o:nDataStrAlign := SetClrBlock( o ) } )
REDEFINE SAY oMOTORPOOL var cMOTORPOOL ID 114 of oEMP
REDEFINE SAY oMOTOR var xMOTOR ID 113 of oEMP
REDEFINE SAY oDATE1 var dDATE1 ID 119 of oEMP
REDEFINE SAY oDATE2 var dDATE2 ID 120 of oEMP
REDEFINE BUTTON oBTN3 ID 115 of oEMP ; // quit
ACTION ( oWndChild:End() )
ACTIVATE DIALOG oEMP NOWAIT ;
ON PAINT GradientFill( hDC, 0, 0, oEMP:nHeight, oEMP:nWidth, xGrad1, .T. ) ;
ON INIT ( oEMP:Move( 0, 0 ), XbrGoToCol( oBrow, nCol),oBrow:SetFocus(),;
IF( (xSUPER = 'Y'.or. xMGR = 'Y' .or. xADMIN = 'Y'), ,oBTN4:HIDE() ))
ACTIVATE WINDOW oWNDCHILD ;
ON INIT ( oWndChild:SetSize( oEMP:nWIDTH,oEMP:nHEIGHT, .T. )) ;
VALID ( IIF( !lOK, CloseRes(.T., oBar1),.F. ))
RETURN( NIL )
//------------------------
static function SetClrBlock( oCol )
* oCol:bClrStd := { || If( SameAsNext( oCol ), { CLR_WHITE, CLR_HRED }, { CLR_BLACK, CLR_WHITE } ) }
oCol:bClrStd := { || If( SameAsNext( oCol ), ColorOf( oCol:Value ), { CLR_BLACK, CLR_WHITE } ) }
return nil
//---------------------------------------
Static function ColorOf( cName )
static hColors := {=>}
// any logic that assigns a different color to different values
if ! HHasKey( hColors, cName )
hColors[ cName ] := nRGB( HB_RandomInt( 0, 220 ), ;
HB_RandomInt( 0, 220 ), ;
HB_RandomInt( 0, 220 ) )
endif
return { CLR_WHITE, hColors[ cName ] }
//----------------------------------
static function SameAsNext( oCol )
local lSame := .f.
local nCol := oCol:nCreationOrder
local oBrw := oCol:oBrw
LOCAL xVALUE,yVALUE,zVALUE
xVALUE := oBrw:aCols[ nCol ]:Value
yVALUE := oBrw:aCols[ nCol+1 ]:Value
TRY
zVALUE := oBrw:aCols[ nCol-1 ]:Value
CATCH
zVALUE := "BOGUS"
END TRY
IF VALTYPE(xVALUE) <> "C"
xVALUE := STR(xVALUE)
ENDIF
IF VALTYPE(yVALUE) <> "C"
yVALUE := STR(yVALUE)
ENDIF
IF VALTYPE(zVALUE) <> "C"
zVALUE := STR(zVALUE )
ENDIF
IF VALTYPE( xVALUE) <> "C" .or. xVALUE = " "
lSAME := .F.
RETURN(lSAME)
ENDIF
IF xVALUE <> yVALUE
IF xVALUE = zVALUE
lSAME := .T.
RETURN(lSAME )
ENDIF
ENDIF
IF xVALUE <> yVALUE .and. nCOL > 5
IF xVALUE <> yVALUE
lSAME := .T.
RETURN(lSAME)
ENDIF
ENDIF
IF xVALUE = yVALUE
lSAME := .T.
ENDIF
/*
if nCol < Len( oBrw:aCols ) .and. oCol:Value == oBrw:aCols[ nCol + 1 ]:Value
lSame := .t.
endif
if ! lSame .and. nCol > 1 .and. oCol:Value == oBrw:aCols[ nCol - 1 ]:Value
lSame := .t.
endif
*/
RETURN( lSAME )
//-------------------------------------
function XbrGoToCol( oBrw, nCol1 )
oBrw:nColOffSet := nCol1 - oBrw:nFreeze
oBrw:nColSel := oBrw:nFreeze + 1
oBrw:ReFresh()
SysReFresh()
return nil