FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour DATE RANGE
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: DATE RANGE
Posted: Mon Mar 18, 2013 08:09 PM

SILVIO,

I used the original files from your first post.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: DATE RANGE
Posted: Tue Mar 19, 2013 08:18 AM
James Bott wrote:Nages,

The code in your next post, Mon Mar 18, 2013 12:04 am, isn't working for me either. When first run all the records show as FREE in the left browse, and the right browse is empty. Clicking on the "Free Only" radio button show both browses as empty and the same when clicking the "Busy Only" radio.

Again I have no idea why it is not working. Any ideas?

Regards,
James



James

static function OpenData()

field ID

USE RESERVA NEW SHARED VIA "DBFCDX"
INDEX ON RESERVA->ROOMS_ID + DToS( RESERVA->CHECK_IN ) TAG ROOM_IN TO RESERVA
SET ORDER TO TAG ROOM_IN
GO TOP

USE RESERVA NEW SHARED ALIAS "RES" VIA "DBFCDX"
GO TOP

USE ROOMS NEW SHARED VIA "DBFCDX"
INDEX ON ROOMS->ID TAG rooms_id TO rooms
SET ORDER TO TAG ROOMS_ID
GO TOP
SET RELATION TO ID INTO RESERVA SCOPED
GO TOP

return .t.


try it please !!
I insert the insed and the thereis an error on SET ORDER TO TAG ROOMS_ID instead of SET ORDER TO TAG ROOMS_OD

@ 10,230 RADIO oRad VAR nFilter ITEMS "Mostra tutte le camere", ;
"Mostra solo le camere libere",;
"Mostra solo le camere occupate" ;
SIZE 130,10 PIXEL OF oDlg ;
ON CHANGE (ROOMS->( SetRoomsFilter( oBrwRooms, nFilter) ),;
oBrwReserva:Refresh() )


BUT i NOT UNDERSTOOD ...

Why i must open two tries Reserva.dbf ? one with alias Reserva and then with alias Res
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: DATE RANGE
Posted: Tue Mar 19, 2013 01:26 PM

Silvio,

I tried your version of the function opendata() and the only difference is the when "Free Only" is clicked the left browse remains showing all rooms as "Free" instead of going blank as it did before. There is still nothing in the right side browse.

I will try to find some time later today to look into this some more.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: DATE RANGE
Posted: Tue Mar 19, 2013 01:45 PM

Nages,

The EXE you mailed to me works exactly the same as described in my post just previous to this one.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: DATE RANGE
Posted: Tue Mar 19, 2013 10:30 PM
James,
Nages send me an exe and here it seems run ok
I had made test with big dbf

I use the range date old ( 01.03.2013 to 04.03.2013) to test

First option
I can see all rooms


and it seems run ok

Second Option

I can see only the free rooms


and it seems run ok



third otion
if I not have a free room and I wish see if there is a probable room free in next days I can see this with the last option

on the second obrw I can see wich is the reservation that could change his state






I need a room from 1 march .2013 to 04. march 2013 and the first room is that I see on red but it change his state on 5 march 2013 .... why ?

and it for me not run ok

I select each occupied room and then I found the room number 7 can be usefull because
I need from 01. march 2013 to 04. march 2013 and the room number 7 can be free on 03 March 2013
also the room number 28

as you can see here :

Room Seven



Room 28



then If I need to found two room for two customer
I can say to customers I can have a room only for the 4 march 2013
because the rooms number 7 and 28 have the check out on 3 March 2013 and they could be free at 04 march 2013

what do you think about ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: DATE RANGE
Posted: Tue Mar 19, 2013 10:52 PM
I need from 01. march 2013 to 04. march 2013 and the room number 7 can be free on 03 March 2013

We need a room from 1st to 4th. But Room 7 is not available on 1st and 2nd.
I can not comment on room 28 because my dbf is different from your dbf.

This program shows a room available only if it is available continuously from 1st March to 4th March.
Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: DATE RANGE
Posted: Tue Mar 19, 2013 10:59 PM

Nages,
I sent you the new dbf ( many records)

If I found the rooms free on this dialog ( number 7 and 28) How I could select them to remeber to system "I can give to customer that two rooms." on 4 march 2013 ? ..

>This program shows a room available only if it is available continuously from 1st March to 4th March.

I saw I can modify the get data range and the app run

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: DATE RANGE
Posted: Tue Mar 19, 2013 11:01 PM

If you enter the dates as 4th march to 4th march you will see these rooms as available

Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: DATE RANGE
Posted: Tue Mar 19, 2013 11:05 PM
yes I saw!!

to select fast the range dates I changed only to try

@ 10, 10 DTPICKER oGet1 VAR dStart OF oDlg SIZE 50, 10 PIXEL UPDATE ;
VALID ( If( d1 != dStart, ;
( GetBusyRooms( d1 := Min( dStart, dEnd ), d2 := Max( dStart, dEnd ) ), ;
oBrwRooms:Refresh(), oBrwReserva:Refresh(), oDlg:Update() ), nil ), .t. ) ;
ON CHANGE ( oBrwRooms:Refresh(), oBrwReserva:Refresh() )

@ 10, 100 DTPICKER oGet2 VAR dEnd OF oDlg SIZE 50, 10 PIXEL UPDATE ;
VALID ( If( d2 != dEnd, ;
( GetBusyRooms( d1 := Min( dStart, dEnd ), d2 := Max( dStart, dEnd ) ), ;
oBrwRooms:Refresh(), oBrwReserva:Refresh(),oDlg:Update() ), nil ), .t. ) ;
ON CHANGE ( oBrwRooms:Refresh(), oBrwReserva:Refresh() )


BUT NOT REFRESH THE oxbrwser then when I move the mouse over the xbrowse are refreshed
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: DATE RANGE
Posted: Tue Mar 19, 2013 11:27 PM

Nages,
on get need to control if dEnd must not be < of dStart

VALID dstart<=dEnd where I insert this ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: DATE RANGE
Posted: Tue Mar 19, 2013 11:28 PM

I see.
We can improve on this.

One important note.
When we enter dStart and dEnd, the assumption in the program is that the guest will stay for the night on dEnd also.
If you mean that the guest will check out on dEnd, then we need to change the filter condition slightly. We shoud use dEnd - 1 where we used dEnd

Regards



G. N. Rao.

Hyderabad, India
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: DATE RANGE
Posted: Tue Mar 19, 2013 11:40 PM

yes,
on bed and breakfast hotel for a sample when I have a room from 01 march to 4 march I have 3 nights and the room must be free (check out) on 10:00 o' clock by customer of 4 march

>We shoud use dEnd - 1 where we used dEnd

where I must modify it to try ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: DATE RANGE
Posted: Wed Mar 20, 2013 12:19 AM

Silvio,

>We should use dEnd - 1 where we used dEnd

I suggest changing it in the function GetBusyRooms().

As I said before, I think you will also have to do it for dStart by adding 1. Example:

For the same room:
existing reservation 01/03/2013 to 03/03/2013
existing reservation 04/03/2013 to 08/03/2013
Desired reservation 03/03/2013 to 04/03/2013

The room is available from 03/03 to 04/03. They check in on the afternoon of the 3rd, and out in the morning of the 4th.

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: DATE RANGE
Posted: Wed Mar 20, 2013 12:23 AM
I suggest changing it in the function GetBusyRooms().


Yes


As I said before, I think you will also have to do it for dStart by adding 1. Example:


No. Because we are already using CHECK_OUT - 1
Regards



G. N. Rao.

Hyderabad, India
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: DATE RANGE
Posted: Wed Mar 20, 2013 12:36 AM

Nages,

>No. Because we are already using CHECK_OUT - 1

Sorry, I forgot and I don't have the code with me right now (using a tablet).

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10