Thankx xPro,
When the user hovers over the button of the table with the mouse
on the listbox which is right at the ribbon should display the quantity for that table according to the archive of reservations.
Must be shown for all the months from January to December and each day if the table is free or not
This is to facilitate the user when the customer requests a reservation of a table.
Archive of the reservations I have three fields need for this calculation : a numeric field where you enter your table such as 12,two fields type date for the start date and end date.
Then there are other leaders like the name of the Clent and deposit paid but the latter are not necessary in my opinion in this context
I've already done the listbox inside the ribbon and I assigned the array aDatiDisp value of 1 or 2 if the table is free or busy : to make a quick example I asegnato only 7 months and 31 regions for each month but this is not real because we know that not all months have 31 days.
for the calculation of days for a particular month I use an old function to calculate how many days are there in that month
Code: Select all
FUNCTION nDaysMonth( dDate )
Local nMes, cYear
Local dDay
Local aDays := {31,28,31,30,31,30,31,31,30,31,30,31}
Local nReturn
Local dateformat
if empty( dDate )
return 0
endif
nMes := Month( dDate )
cYear := str( year( dDate ),4 )
if nMes == 2
dateformat := set( _SET_DATEFORMAT, "dd-mm-yyyy" )
if day( ctod( "29-02-" + cYear ) ) != 0
nReturn := 29
else
nReturn := 28
endif
set( _SET_DATEFORMAT, dateformat )
else
nReturn := aDays[ nMes ]
endif
Return nReturn
to create the xbrowse in rbbon I used an array aData this created :
Code: Select all
aData := { {'Marzo', aDatiDisp[1][1],aDatiDisp[1][2],aDatiDisp[1][3],aDatiDisp[1][4],aDatiDisp[1][5],aDatiDisp[1][6],aDatiDisp[1][7],aDatiDisp[1][8],aDatiDisp[1][9],aDatiDisp[1][10],;
aDatiDisp[1][11],aDatiDisp[1][12],aDatiDisp[1][13],aDatiDisp[1][14],aDatiDisp[1][15],aDatiDisp[1][16],aDatiDisp[1][17],aDatiDisp[1][18],aDatiDisp[1][19],aDatiDisp[1][20],;
aDatiDisp[1][21],aDatiDisp[1][22],aDatiDisp[1][23],aDatiDisp[1][24],aDatiDisp[1][25],aDatiDisp[1][26],aDatiDisp[1][27],aDatiDisp[1][28],aDatiDisp[1][29],aDatiDisp[1][30],aDatiDisp[1][31]},;
{'Aprile', aDatiDisp[2][1],aDatiDisp[2][2],aDatiDisp[2][3],aDatiDisp[2][4],aDatiDisp[2][5],aDatiDisp[2][6],aDatiDisp[2][7],aDatiDisp[2][8],aDatiDisp[2][9],aDatiDisp[2][10],;
aDatiDisp[2][11],aDatiDisp[2][12],aDatiDisp[2][13],aDatiDisp[2][14],aDatiDisp[2][15],aDatiDisp[2][16],aDatiDisp[2][17],aDatiDisp[2][18],aDatiDisp[2][19],aDatiDisp[2][20],;
aDatiDisp[2][21],aDatiDisp[2][22],aDatiDisp[2][23],aDatiDisp[2][24],aDatiDisp[2][25],aDatiDisp[2][26],aDatiDisp[2][27],aDatiDisp[2][28],aDatiDisp[2][29],aDatiDisp[2][30],aDatiDisp[2][31]},;
{'Maggio', aDatiDisp[3][1],aDatiDisp[3][2],aDatiDisp[3][3],aDatiDisp[3][4],aDatiDisp[3][5],aDatiDisp[3][6],aDatiDisp[3][7],aDatiDisp[3][8],aDatiDisp[3][9],aDatiDisp[3][10],;
aDatiDisp[3][11],aDatiDisp[3][12],aDatiDisp[3][13],aDatiDisp[3][14],aDatiDisp[3][15],aDatiDisp[3][16],aDatiDisp[3][17],aDatiDisp[3][18],aDatiDisp[3][19],aDatiDisp[3][20],;
aDatiDisp[3][21],aDatiDisp[3][22],aDatiDisp[3][23],aDatiDisp[3][24],aDatiDisp[3][25],aDatiDisp[3][26],aDatiDisp[3][27],aDatiDisp[3][28],aDatiDisp[3][29],aDatiDisp[3][30],aDatiDisp[3][31]},;
{'Giugno', aDatiDisp[4][1],aDatiDisp[4][2],aDatiDisp[4][3],aDatiDisp[4][4],aDatiDisp[4][5],aDatiDisp[4][6],aDatiDisp[4][7],aDatiDisp[4][8],aDatiDisp[4][9],aDatiDisp[4][10],;
aDatiDisp[4][11],aDatiDisp[4][12],aDatiDisp[4][13],aDatiDisp[4][14],aDatiDisp[4][15],aDatiDisp[4][16],aDatiDisp[4][17],aDatiDisp[4][18],aDatiDisp[4][19],aDatiDisp[4][20],;
aDatiDisp[4][21],aDatiDisp[4][22],aDatiDisp[4][23],aDatiDisp[4][24],aDatiDisp[4][25],aDatiDisp[4][26],aDatiDisp[4][27],aDatiDisp[4][28],aDatiDisp[4][29],aDatiDisp[4][30],aDatiDisp[4][31]},;
{'Luglio', aDatiDisp[5][1],aDatiDisp[5][2],aDatiDisp[5][3],aDatiDisp[5][4],aDatiDisp[5][5],aDatiDisp[5][6],aDatiDisp[5][7],aDatiDisp[5][8],aDatiDisp[5][9],aDatiDisp[5][10],;
aDatiDisp[5][11],aDatiDisp[5][12],aDatiDisp[5][13],aDatiDisp[5][14],aDatiDisp[5][15],aDatiDisp[5][16],aDatiDisp[5][17],aDatiDisp[5][18],aDatiDisp[5][19],aDatiDisp[5][20],;
aDatiDisp[5][21],aDatiDisp[5][22],aDatiDisp[5][23],aDatiDisp[5][24],aDatiDisp[5][25],aDatiDisp[5][26],aDatiDisp[5][27],aDatiDisp[5][28],aDatiDisp[5][29],aDatiDisp[5][30],aDatiDisp[5][31]},;
{'Agosto', aDatiDisp[6][1],aDatiDisp[6][2],aDatiDisp[6][3],aDatiDisp[6][4],aDatiDisp[6][5],aDatiDisp[6][6],aDatiDisp[6][7],aDatiDisp[6][8],aDatiDisp[6][9],aDatiDisp[6][10],;
aDatiDisp[6][11],aDatiDisp[6][12],aDatiDisp[6][13],aDatiDisp[6][14],aDatiDisp[6][15],aDatiDisp[6][16],aDatiDisp[6][17],aDatiDisp[6][18],aDatiDisp[6][19],aDatiDisp[6][20],;
aDatiDisp[6][21],aDatiDisp[6][22],aDatiDisp[6][23],aDatiDisp[6][24],aDatiDisp[6][25],aDatiDisp[6][26],aDatiDisp[6][27],aDatiDisp[6][28],aDatiDisp[6][29],aDatiDisp[6][30],aDatiDisp[6][31]},;
{'Settembre', aDatiDisp[7][1],aDatiDisp[7][2],aDatiDisp[7][3],aDatiDisp[7][4],aDatiDisp[7][5],aDatiDisp[7][6],aDatiDisp[7][7],aDatiDisp[7][8],aDatiDisp[7][9],aDatiDisp[7][10],;
aDatiDisp[7][11],aDatiDisp[7][12],aDatiDisp[7][13],aDatiDisp[7][14],aDatiDisp[7][15],aDatiDisp[7][16],aDatiDisp[7][17],aDatiDisp[7][18],aDatiDisp[7][19],aDatiDisp[7][20],;
aDatiDisp[7][21],aDatiDisp[7][22],aDatiDisp[7][23],aDatiDisp[7][24],aDatiDisp[7][25],aDatiDisp[7][26],aDatiDisp[7][27],aDatiDisp[7][28],aDatiDisp[7][29],aDatiDisp[7][30],aDatiDisp[7][31]}}
and the I created the listbox on the ribbon
Code: Select all
DEFINE RIBBONBAR oRBar WINDOW oWnd PROMPT "Disponibiltà", "test", "test"
ADD GROUP oGr RIBBON oRBar TO OPTION 1 PROMPT "Disponibiltà" width 950
@ 2,2 xbrowse oBrw ;
COLUMNS 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32 ;
HEADERS "Mese","1","2","3","4","5","6","7","8","9","10","11","12","13","14",;
"15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31" ;
ARRAY aData of oGr size oGr:nWidth -5, oGr:nHeight - oGr:nHeight/7 - 2 pixel ;
SIZES 50, 25, 25, 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25
for n = 2 to Len( oBrw:aCols )
// COLORS
oBrw:aCols[ n ]:bClrStd := ;
{|| { RGB( 216, 230, 246 ), ;
IF ( EVAL (oBrw:bKeyno, NIL, oBrw ) %2 == 0, ;
CLR_WHITE,RGB( 255, 255, 189 ) ) } }
// BMPDATA
oBrw:aCols[ n ]:AddBmpFile("SELECT.BMP")
oBrw:aCols[ n ]:AddBmpFile("UNSELECT.BMP")
oBrw:aCols[ n ]:bBmpData := {|| oBrw:nArrayAt }
Next
Now the problem is to put the right information for each array 1 if the table is free 2 if the table is occupied
How do I do this?