DATE RANGE

Re: DATE RANGE

Postby nageswaragunupudi » Wed Mar 20, 2013 5:25 am

I suggest not to make any changes to the original code.

When a guest enquires about availability of a room from 1st to 4th March, he intends to stay for 4 nights and will check out on 5th morning. Same way when the hotel operator checks for availability, he checks for 4 nights from 1st but does not include the check-out day in the search. Another example, to find availability for a single night say 10th, we enter 10th March to 10th March though he will check out on 11th morning.

So, please do not change the original logic.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: DATE RANGE

Postby Silvio.Falconi » Wed Mar 20, 2013 7:49 am

Right...I believe it 's a good logic
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm

Re: DATE RANGE

Postby Silvio.Falconi » Wed Mar 20, 2013 8:12 am

I'm thinking I can Know with this procedure :

1. the list of chech in a specific day. ( a list of all the arrivals in the day )
2. the list of chech out a specific day (a list of departures scheduled day )

The list of check-out is a very useful tool in the process of overseeing the management
of payments and receipts / invoices at the time when the customers leave the hotel.

Important
I have another Field on original archive called "Option" ( Field date type)
How can I view a list of all bookings entered with date option?
This option is the date notified by the customer as a deadline for the confirmation or cancellation of his reservation.
also with this feature I can see if I can use a room on a range date....

But I'm thinking just I can see it now because if I have an option date and the reservation is not confirmated the Status is changed from
"01" (reserved) to "04" (Canceled)


I have another Field on origianl archive called "ToPayOff" ( logic field)
I have to display a list of all reservations still outstanding for a range of date
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm

Re: DATE RANGE

Postby Silvio.Falconi » Wed Mar 20, 2013 8:55 am

a last prupose

I have on Room dbf also a field called TYPE

this field is the type of Room : it can be Single, Double, Triple, Quadruple

Single 00 or SS
Double 01 or DD
Triple 02 or TT
Quadruple 03 or QQ
Suite 04 or ST


Can I search (on range of date) with the type of room ?
select by combobox selection

and I can search it also inserting another field ( number) FLoor ...
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm

Re: DATE RANGE

Postby nageswaragunupudi » Thu Mar 21, 2013 3:00 am

I suggested this expression for extracting busy rooms:
MAX( dStart, CHECK_IN ) <= MIN( dEnd, CHECK_OUT - 1 )
Though this gives the correct results, the expression is not optimized. Also no RDD/RDBS can optimize such an expression.

I propose re-drafting the expression in the following manner. This revised expression can be fully optimized by the RDD, if we maintain additional indexes on CHECK_IN,CHECK_OUT and STATUS.
Code: Select all  Expand view  RUN

static function GetBusyRooms( dStart, dEnd )

   field ROOMS_ID, CHECK_IN, CHECK_OUT, STATUS

   local cCond, bCond

   ASize( aBusy, 0 )

   cCond    := "CHECK_OUT > STOD('" + DTOS( dStart ) + "' ) .AND. " + ;
               "CHECK_IN <= STOD('" + DTOS( dEnd ) + "' )"
   cCond    += ".AND. STATUS < '04'"
  // here add any more conditions

   bCond    := &( "{ || " + cCond + " }" )

   RES->( DBSETFILTER( bCond, cCond ), DBGOTOP() )
   RES->( DBEVAL( { || AAdd( aBusy, ROOMS_ID ) } ) )
   RES->( DBCLEARFILTER() )

return aBusy
 

If you want to add further tests, you may add those conditions also to the expression, like type of rooms, etc.

I see that STATUS '05' indicates Empty status. I think there is no need to keep a record for this status.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: DATE RANGE

Postby nageswaragunupudi » Thu Mar 21, 2013 3:07 am

This is the revised program
Code: Select all  Expand view  RUN
#include "FiveWin.Ch"
#include "hbcompat.ch"
#include "ord.ch"
#include "xbrowse.ch"
#include "dtpicker.ch"

//----------------------------------------------------------------------------//

REQUEST DBFCDX

//----------------------------------------------------------------------------//

static aBusy   := {}
static aStatus := { "Reserved", "Confirmed", "Occupied", "Canceled", "Empty" }
//----------------------------------------------------------------------------//

function Main()

   SET DATE ITALIAN
   SET CENTURY ON
   SET DELETED ON

   SetGetColorFocus()
   XBrNumFormat( 'E', .t. )

   ReIndexData()
   OpenData()
   ShowRoomStatus()

return (0)

//----------------------------------------------------------------------------//

static function ShowRoomStatus()

   local dStart      := STOD( "20130301" )
   local dEnd        := STOD( "20130304" )
   local d1, d2, nFilter := 1

   //
   local oDlg, oFont, oBrwRooms, oBrwReserva, oGet1, oGet2, oRad

   GetBusyRooms( d1 := dStart, d2 := dEnd )

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 900,500 PIXEL FONT oFont

   @ 10, 10 SAY "From Night Of" SIZE 80,10 PIXEL OF oDlg
   @ 10,100 SAY "Upto Night Of" SIZE 80,20 PIXEL OF oDlg

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

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

   @ 10,230 RADIO oRad VAR nFilter ITEMS "Show All", "Free Only", "Busy Only"  ;
         SIZE 100,10 PIXEL OF oDlg ;
         ON CHANGE ROOMS->( SetRoomsFilter( oBrwRooms, nFilter ), ;
               oBrwRooms:Refresh(),oBrwReserva:Refresh(), oBrwRooms:SetFocus() )

   @ 35, 10 SAY "Room Status between " + DTOC( Min( dStart, dEnd ) ) + " and " + ;
                  DTOC( Max( dStart, dEnd ) ) SIZE 200,10 PIXEL OF oDlg UPDATE

   @ 50, 10 XBROWSE oBrwRooms SIZE 150,-20 PIXEL OF oDlg DATASOURCE "ROOMS" ;
      COLUMNS "ID", "NAME", { || AScan( aBusy, ROOMS->ID ) == 0 } ;
      HEADERS "No", "RoomName", "Status" ;
      COLSIZES nil, 20, 70 ;
      CELL LINES NOBORDER

   @ 50,170 XBROWSE oBrwReserva SIZE -10,-20 PIXEL OF oDlg DATASOURCE "RESERVA" ;
      COLUMNS "ROOMS_ID", "CHECK_IN", "CHECK_OUT", "STATUS", "GUEST" ;
      HEADERS "ID", "CheckIN", "CheckOUT", "Status", "Guest" ;
      CELL LINES NOBORDER

   WITH OBJECT oBrwRooms
      :Status:SetCheck( { 0, 0 }, nil, { "Free", "Busy" } )
      :nStretchCol   := 2
      :bChange       := { || oBrwReserva:Refresh() }
      :bClrStd       := { || If( oBrwRooms:Status:Value, { CLR_BLACK, CLR_WHITE }, { CLR_WHITE, CLR_HRED } ) }
      :bClrSel       := { || { CLR_BLACK, CLR_HGRAY } }
      :SetGroupHeader( "ROOMS" )
      //
      :CreateFromCode()
   END

   WITH OBJECT oBrwReserva
      :Status:bEditValue := { || aStatus[ Val( RESERVA->STATUS ) ] }
      :bClrSel       := { || { CLR_BLACK, CLR_HGRAY } }
      :bClrStd       := { || If( RESERVA->STATUS == '04', { CLR_BLACK, RGB( 160, 210, 255 ) }, ;
                             If( RESERVA->STATUS == '05', { CLR_BLACK, RGB( 160, 255, 200 ) }, ;
                             If( RESERVA->CHECK_OUT > d1 .AND. RESERVA->CHECK_IN <= d2, ;
                                 { CLR_WHITE, CLR_HRED }, { CLR_BLACK, CLR_WHITE } ) ) ) }


      :SetGroupHeader( "RESERVATIONS" )
      //
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT ( oBrwRooms:SetFocus(), .f. )

return nil

//----------------------------------------------------------------------------//

static function OpenData()

   field ID

   USE RESERVA NEW SHARED VIA "DBFCDX"
   SET ORDER TO TAG ROOM_IN
   GO TOP

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

   USE ROOMS NEW SHARED VIA "DBFCDX"
   SET ORDER TO TAG ROOMS_OD
   GO TOP
   SET RELATION TO ID INTO RESERVA SCOPED
   GO TOP

return .t.

//----------------------------------------------------------------------------//

static function GetBusyRooms( dStart, dEnd )

   field ROOMS_ID, CHECK_IN, CHECK_OUT, STATUS

   local cCond, bCond

   ASize( aBusy, 0 )

   cCond    := "CHECK_OUT > STOD('" + DTOS( dStart ) + "' ) .AND. " + ;
               "CHECK_IN <= STOD('" + DTOS( dEnd ) + "' )"
   cCond    += ".AND. STATUS < '04'"

   bCond    := &( "{ || " + cCond + " }" )

   RES->( DBSETFILTER( bCond, cCond ), DBGOTOP() )
   RES->( DBEVAL( { || AAdd( aBusy, ROOMS_ID ) } ) )
   RES->( DBCLEARFILTER() )

return aBusy

//----------------------------------------------------------------------------//

static function SetRoomsFilter( oBrw, nFilter )

   FIELD ID

   static nPrevFilter   := 1

   if nPrevFilter != nFilter
      if nFilter == 2
         SET FILTER TO ASCAN( aBusy, ID ) == 0
      elseif nFilter == 3
         SET FILTER TO ASCAN( aBusy, ID ) > 0
      ELSE
         SET FILTER TO
      ENDIF
      GO TOP
      nPrevFilter := nFilter
      oBrw:Refresh()
   endif

return nil

//----------------------------------------------------------------------------//

static function ReIndexData()

   field ID,ROOMS_ID,CHECK_IN, CHECK_OUT, STATUS

   ferase( "rooms.cdx" )
   ferase( "reserva.cdx" )

   USE ROOMS NEW EXCLUSIVE VIA "DBFCDX"
   INDEX ON ID TAG ROOMS_ID
   CLOSE DATA

   USE RESERVA NEW EXCLUSIVE VIA "DBFCDX"
   INDEX ON ROOMS_ID + DTOS(CHECK_IN) TAG ROOM_IN
   INDEX ON STATUS TAG STATUS
   INDEX ON CHECK_IN TAG CHECK_IN
   INDEX ON CHECK_OUT TAG CHECK_OUT
   CLOSE DATA

return nil

//----------------------------------------------------------------------------//
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: DATE RANGE

Postby Silvio.Falconi » Fri Mar 22, 2013 11:22 am

I revised the program and add new other definitions

I mean for other definitions as :

To Pay Off if the guest must also to pay the Factura or Receipt for the overnight at hotel
Option date is the date notified by the customer as a deadline for the confirmation or cancellation of his reservation.
Check In if the reservation is ongoing
Check Out if the reservation is outgoing
Arrive if the guest is arrived
Departure if the guest is departured
Voucher is the number for the descount of agencies


Image








the filter are "Show All", "Free Only", "Busy Only" with radio selection

the other definition are "No definition", "To Pay Off" , "With Option" , "Check In" , "Check Out" ,"Arrive" ,"Departure" , "Voucher" with combo selection

only when I select on combobox from 3 to 6 it must change the date get on date() and it not refresh the get

I insert a new function
SetOptionFilter(nDefinition,d1,d2,dStart,dEnd,aGet)


To try the test you must add new field on Reserva.dbf with UpDate_Reserva() function


To update the existing Reserva just need to compile and run this simple function.
Code: Select all  Expand view  RUN

Function UpDate_Reserva()

DbCreate(cDir+'PO', { { "DATE"      , "D",   8, 0 },;
                           { "ROOMS_ID"  , "C",   4, 0 },;
                           { "CHECK_IN"  , "D",   8, 0 },;
                           { "CHECK_OUT" , "D",   8, 0 },;
                           { "STATUS"    , "C",   2, 0 },;
                           { "GROUP"     , "C",  10, 0 },;
                           { "GUEST"     , "C",  30, 0 },;
                           { "ARRIVE"    , "C",  10, 0 },;
                           { "DEPARTURE" , "C",  10, 0 },;
                           { "TOPAYOFF"  , "L",   1, 0 },;
                           { "AGENCY"    , "C",  30, 0 },;
                           { "BOOK_FROM" , "C",  30, 0 },;
                           { "OPTION"    , "D",   8, 0 },;
                           { "COLOR"     , "N",  10, 0 },;
                           { "TYPE_BOARD", "C",  10, 0 },;
                           { "LARRIVE"   , "L",   1, 0 },;
                           { "LDEPARTURE", "L",   1, 0 },;
                           { "DEPOSIT"   , "N",  12, 2 },;
                           { "TYPE_DESCO", "C",   1, 0 },;
                           { "DESCOUNT1" , "N",  12, 2 },;
                           { "DESCOUNT2" , "N",   5, 2 },;
                           { "TOTAL"     , "N",  12, 2 },;
                           { "ADULTS"    , "N",   2, 0 },;
                           { "CHILDRENS" , "N",   2, 0 },;
                           { "INFANTS"   , "N",   2, 0 },;
                           { "LISTINO"   , "C",  10, 0 },;
                           { "PAYMENT"   , "C",  10, 0 },;
                           { "NO_CHECKIN", "C", 200, 0 },;
                           { "NO_CHECKOU", "C", 200, 0 },;
                           { "NO_INTERNE", "C", 200, 0 } } , 'DBFCDX')

 close all
      use &(cDir+'PO') new
      select PO
      if FILE(cDir+'RESERVA.DBF')
         delete file &(cdir+'RESERVA.cdx')
         append from &(cdir+'RESERVA')
         dbcommitall()
         close all
         delete file &(cdir+'RESERVA.dbf')
      endif
      close all
      rename &(cdir+'PO.dbf') to &(cdir+'RESERVA.dbf')

Return NIL



Revised Test Range Date
Code: Select all  Expand view  RUN
   

#include "FiveWin.Ch"
    #include "hbcompat.ch"
    #include "ord.ch"
    #include "xbrowse.ch"
    #include "dtpicker.ch"

    //----------------------------------------------------------------------------//

    REQUEST DBFCDX

    //----------------------------------------------------------------------------//

    static aBusy   := {}
    static aStatus := { "Reserved", "Confirmed", "Occupied", "Canceled", "Empty" }
    //----------------------------------------------------------------------------//

    function Main()

       SET DATE ITALIAN
       SET CENTURY ON
       SET DELETED ON

       SetGetColorFocus()
       XBrNumFormat( 'E', .t. )

       ReIndexData()
       OpenData()
       ShowRoomStatus()

    return (0)

    //----------------------------------------------------------------------------//

    static function ShowRoomStatus()

       local dStart      := STOD( "20130301" )
       local dEnd        := STOD( "20130304" )
       local d1, d2, nFilter := 1

       //
       local oDlg, oFont, oBrwRooms, oBrwReserva, oCbx

       local aGet[2]

       //
       local nDefinition := 1
       aDefinitions :={ "No definition",;
                        "To Pay Off"  ,;
                        "With Option" ,;
                        "Check In"    ,;
                        "Check Out"   ,;
                        "Arrive"      ,;
                        "Departure"   ,;
                        "Voucher" }




       GetBusyRooms( d1 := dStart, d2 := dEnd, nDefinition )

       DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
       DEFINE DIALOG oDlg SIZE 900,500 PIXEL FONT oFont;
       TITLE "Check Reserva Situation"

       @ 10, 10 SAY "From Night Of" SIZE 80,10 PIXEL OF oDlg
       @ 10,100 SAY "Upto Night Of" SIZE 80,20 PIXEL OF oDlg

       @ 20, 10 DTPICKER aGet[1] VAR dStart SIZE 80,12 PIXEL OF oDlg UPDATE;
          ON CHANGE ( If( d1 != dStart, ;
                ( GetBusyRooms( d1 := Min( dStart, dEnd ), d2 := Max( dStart, dEnd ),nDefinition ), ;
                  oBrwRooms:Refresh(), oBrwReserva:Refresh(), oDlg:Update() ), nil ), .t. )

       @ 20,100 DTPICKER aGet[2] VAR dEnd SIZE 80,12 PIXEL OF oDlg UPDATE;
          ON CHANGE ( If( d2 != dEnd, ;
                ( GetBusyRooms( d1 := Min( dStart, dEnd ), d2 := Max( dStart, dEnd ), nDefinition ), ;
                  oBrwRooms:Refresh(), oBrwReserva:Refresh(),oDlg:Update() ), nil ), .t. )


       @ 10,230 RADIO oRad VAR nFilter ITEMS "Show All", "Free Only", "Busy Only"  ;
             SIZE 80,10 PIXEL OF oDlg ;
             ON CHANGE ROOMS->( SetRoomsFilter( oBrwRooms, nFilter ), ;
                   oBrwRooms:Refresh(),oBrwReserva:Refresh(), oBrwRooms:SetFocus() )


   @ 10, 330 SAY "Reserva definitions "  SIZE 200,10 PIXEL OF oDlg
 @ 24,330 COMBOBOX oCbx VAR nDefinition ITEMS aDefinitions ;
                SIZE 80,40 PIXEL OF oDlg ;
             ON CHANGE( SetOptionFilter( nDefinition,d1,d2,dstart,dEnd,aGet),;
                        ROOMS->( SetRoomsFilter( oBrwRooms, nDefinition ), ;
                                oBrwRooms:Refresh() ,;
                                oBrwReserva:Refresh(),;
                                oBrwRooms:SetFocus() ) )






       @ 35, 10 SAY "Room Status between " + DTOC( Min( dStart, dEnd ) ) + " and " + ;
                      DTOC( Max( dStart, dEnd ) ) SIZE 200,10 PIXEL OF oDlg UPDATE

       @ 50, 10 XBROWSE oBrwRooms SIZE 150,-20 PIXEL OF oDlg DATASOURCE "ROOMS" ;
          COLUMNS "ID", "NAME", { || AScan( aBusy, ROOMS->ID ) == 0 } ;
          HEADERS "No", "RoomName", "Status" ;
          COLSIZES nil, 20, 70 ;
          CELL LINES NOBORDER

       @ 50,170 XBROWSE oBrwReserva SIZE -10,-20 PIXEL OF oDlg DATASOURCE "RESERVA" ;
          COLUMNS "ROOMS_ID", "CHECK_IN", "CHECK_OUT", "STATUS", "GUEST","TOPAYOFF",;
                  "OPTION", "LARRIVE", "LDEPARTURE", "VOUCHER" ;
          HEADERS "ID", "CheckIN", "CheckOUT", "Status", "Guest","ToPayOff" ,;
                  "Option","Arrive","Departure","Voucher" ;
                  COLSIZES nil,80,80,40,90,20,70,20,20,50 ;
          CELL LINES NOBORDER

       WITH OBJECT oBrwRooms
          :Status:SetCheck( { 0, 0 }, nil, { "Free", "Busy" } )
          :nStretchCol   := 2
          :bChange       := { || oBrwReserva:Refresh() }
          :bClrStd       := { || If( oBrwRooms:Status:Value, { CLR_BLACK, CLR_WHITE }, { CLR_WHITE, CLR_HRED } ) }
          :bClrSel       := { || { CLR_BLACK, CLR_HGRAY } }
          :SetGroupHeader( "ROOMS" )
          //
          :CreateFromCode()
       END

       WITH OBJECT oBrwReserva
          :Status:bEditValue := { || aStatus[ Val( RESERVA->STATUS ) ] }
          :bClrSel       := { || { CLR_BLACK, CLR_HGRAY } }
          :bClrStd       := { || If( RESERVA->STATUS == '04', { CLR_BLACK, RGB( 160, 210, 255 ) }, ;
                                 If( RESERVA->STATUS == '05', { CLR_BLACK, RGB( 160, 255, 200 ) }, ;
                                 If( RESERVA->CHECK_OUT > d1 .AND. RESERVA->CHECK_IN <= d2, ;
                                     { CLR_WHITE, CLR_HRED }, { CLR_BLACK, CLR_WHITE } ) ) ) }


          :SetGroupHeader( "RESERVATIONS" )
          //
          :CreateFromCode()
       END

       ACTIVATE DIALOG oDlg CENTERED ;
          ON INIT ( oBrwRooms:SetFocus(), .f. )

    return nil

    //----------------------------------------------------------------------------//

    static function OpenData()

       field ID

       USE RESERVA NEW SHARED VIA "DBFCDX"
       SET ORDER TO TAG ROOM_IN
       GO TOP

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

       USE ROOMS NEW SHARED VIA "DBFCDX"
       SET ORDER TO TAG ROOMS_OD
       GO TOP
       SET RELATION TO ID INTO RESERVA SCOPED
       GO TOP

    return .t.

    //----------------------------------------------------------------------------//

    static function GetBusyRooms( dStart, dEnd , nDefinition)

       field ROOMS_ID, CHECK_IN, CHECK_OUT, STATUS, TOPAYOFF, OPTION, LARRIVE, LDEPARTURE, VOUCHER

       local cCond, bCond

       ASize( aBusy, 0 )

       cCond    := "CHECK_OUT > STOD('" + DTOS( dStart ) + "' ) .AND. " + ;
                   "CHECK_IN <= STOD('" + DTOS( dEnd ) + "' )"
       cCond    += ".AND. STATUS < '04'"



        //OTHER DEFINITIONS

       DO CASE
          case nDefinition =  2
               cCond    += ".AND. TOPAYOFF = .T."
          case nDefinition = 3
               cCond    += ".AND. ! EMPTY(OPTION)"
          case nDefinition = 4
               cCond    += ".AND. CHECK_IN = STOD('" + DTOS( dStart ) + "' )"
          case nDefinition = 5
               cCond    += ".AND. CHECK_OUT = STOD('" + DTOS( dStart ) + "' )"
          case nDefinition = 6
               cCond    += ".AND. LARRIVE = .T. "
          case nDefinition = 7
               cCond    += ".AND. LDEPARTURE = .T."
          case nDefinition = 8
                cCond    += ".AND. !EMPTY(VOUCHER)"

       Endcase








       bCond    := &( "{ || " + cCond + " }" )

       RES->( DBSETFILTER( bCond, cCond ), DBGOTOP() )
       RES->( DBEVAL( { || AAdd( aBusy, ROOMS_ID ) } ) )
       RES->( DBCLEARFILTER() )

    return aBusy

    //----------------------------------------------------------------------------//


    Static Function  SetOptionFilter(nDefinition,d1,d2,dStart,dEnd,aGet)

              Do Case
              Case nDefinition = 2
              Case nDefinition = 3
              Case nDefinition = 4
                    DStart:=  Date()
                    DEnd  :=  Date()
              Case nDefinition = 5
                    DStart:=  Date()
                    DEnd  :=  Date()
              Case nDefinition = 6
                    DStart:=  Date()
                    DEnd  :=  Date()
              Case nDefinition = 7
                    DStart:=  Date()
                    DEnd  :=  Date()
               Case nDefinition = 8
              EndCase

       aGet[1]:refresh()
       aGet[2]:refresh()

       d1 := dStart
       d2 := dEnd

     return nil

      //----------------------------------------------------------------------------//


    static function SetRoomsFilter( oBrw, nFilter )

       FIELD ID

       static nPrevFilter   := 1

       if nPrevFilter != nFilter
          if nFilter == 2
             SET FILTER TO ASCAN( aBusy, ID ) == 0
          elseif nFilter == 3
             SET FILTER TO ASCAN( aBusy, ID ) > 0

          ELSE
             SET FILTER TO
          ENDIF

          GO TOP
          nPrevFilter := nFilter
          oBrw:Refresh()
       endif

    return nil

    //----------------------------------------------------------------------------//

    static function ReIndexData()

       field ID,ROOMS_ID,CHECK_IN, CHECK_OUT, STATUS

       ferase( "rooms.cdx" )
       ferase( "reserva.cdx" )

       USE ROOMS NEW EXCLUSIVE VIA "DBFCDX"
       INDEX ON ID TAG ROOMS_ID
       CLOSE DATA

       USE RESERVA NEW EXCLUSIVE VIA "DBFCDX"
       INDEX ON ROOMS_ID + DTOS(CHECK_IN) TAG ROOM_IN
       INDEX ON STATUS TAG STATUS
       INDEX ON CHECK_IN TAG CHECK_IN
       INDEX ON CHECK_OUT TAG CHECK_OUT
       CLOSE DATA

    return nil

    //----------------------------------------------------------------------------//
 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm

Re: DATE RANGE

Postby Silvio.Falconi » Tue Mar 26, 2013 6:46 pm

Any solution for new filter ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm

Re: DATE RANGE

Postby Silvio.Falconi » Sun Apr 07, 2013 10:28 am

Nages please,
I add new definitions but they not run ok !!
Can you help me please ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm

Re: DATE RANGE

Postby Silvio.Falconi » Fri Jul 05, 2013 8:54 am

Any solution please
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm

Re: DATE RANGE

Postby Silvio.Falconi » Fri Jul 05, 2013 9:14 am

Nages,

I need to make a change for the status

I need Know if a reservation is (occuppied) only a for a day and add this new status with another color
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm

Re: DATE RANGE

Postby bpd2000 » Sat Aug 01, 2015 11:35 am

What is latest ammendment
Regards, Greetings

Try FWH. You will enjoy it's simplicity and power.!
User avatar
bpd2000
 
Posts: 153
Joined: Tue Aug 05, 2014 9:48 am
Location: India

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 8 guests