#include "fivewin.ch"
REQUEST DBFCDX
function Main()
local oDlg, oBrw, oFont, x
local dBaseDate := STOD( "20230102" )
local dDate := dBaseDate
local nRotate := 0
CreateRotateTable()
USE ROTATE NEW SHARED VIA "DBFCDX"
dBaseDate := FIELD->FECHA
dDate := dBaseDate
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
DEFINE DIALOG oDlg SIZE 400,670 PIXEL TRUEPIXEL ;
FONT oFont
@ 70,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
DATASOURCE "ROTATE" AUTOCOLS ;
CELL LINES NOBORDER
WITH OBJECT oBrw
:nStretchCol := 1
:aCols[ 2 ]:bEditValue := { || FIELD->FECHA + nRotate }
:aFilter := Array( 23 )
AEval( :aFilter, { |u,i| :aFilter[ i ] := i } )
:CreateFromCode()
END
@ 10,020 BTNBMP BITMAP 0xE112 SIZE 80,40 PIXEL OF oDlg FLAT ;
ACTION ( nRotate--, ;
x := oBrw:aFilter[ 1 ], ADel( oBrw:aFilter, 1 ), ;
oBrw:aFilter[ 23 ] := x, ;
oBrw:Refresh(), oBrw:SetFocus() )
@ 10,280 BTNBMP BITMAP 0xE111 SIZE 80,40 PIXEL OF oDlg FLAT ;
ACTION ( nRotate++, ;
AIns( oBrw:aFilter, 1, ATail( oBrw:aFilter ) ), ;
oBrw:Refresh(), oBrw:SetFocus() )
ACTIVATE DIALOG oDlg CENTERED
RELEASE FONT oFont
return nil
static function CreateRotateTable()
local aData := Array( 23 )
AEval( aData, { |u,i| aData[ i ] := { "RF07", STOD( "20230102" ), "SMT", i, 700+i } } )
AEval( aData, { |a,i| a[ 5 ] += 1 }, 8 )
AEval( aData, { |a,i| a[ 5 ] += 1 }, 14 )
AEval( aData, { |a,i| a[ 5 ] += 1 }, 21 )
DBCREATE( "ROTATE.DBF", { { "ROL", "C", 4, 0 }, ;
{ "FECHA", "D", 8, 0 }, { "RUTA", "C", 3, 0 }, ;
{ "SEC", "N", 2, 0 }, { "ECO", "N", 3, 0 } }, ;
"DBFCDX", .T., "ROT" )
FW_ArrayToDBF( aData )
CLOSE DATA
return nil