FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Booking xbrowse example
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Booking xbrowse example
Posted: Mon Jul 10, 2023 06:13 AM
Original idea by Silvio, implemented by Mr. Rao

You can drag & drop the reservations using the mouse

booking.prg
Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local oDlg, oBrw, oFont, oCur
   local aData := Array( 6, 11 )
   local n
   local aColors := { METRO_AMBER, METRO_OLIVE, CLR_HMAGENTA, CLR_HBLUE, CLR_HRED, CLR_HGREEN, CLR_RED, CLR_MAGENTA, CLR_GREEN }
   AEval( aData, { |a,i| AFill( a, 0 ), a[ 1 ] := "Camera n." + Str(i,1,0) } )

   SET DATE ITALIAN

   DEFINE CURSOR oCur DRAG
   DEFINE FONT oFont NAME "VERDANA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 760,430 PIXEL TRUEPIXEL ;
      RESIZABLE FONT oFont

   @ 5,5 XBROWSE oBrw SIZE 0,400 PIXEL OF oDlg DATASOURCE aData ;
      COLUMNS 1,2,3,4,5,6,7,8,9,10,11 ;
      HEADERS "", "AM","PM","AM","PM","AM","PM","AM","PM","AM","PM" ;
      NOBORDER STYLE FLAT

   WITH OBJECT oBrw
      :nWidths             := 60
      :nRowHeight          := 60
      :nHeaderHeight       := 60
      :nColDividerStyle    := ;
      :nRowDividerStyle    := LINESTYLE_LIGHTGRAY
      :nMarqueeStyle       := MARQSTYLE_SOLIDCELL
      :lDrawBorder         := .t.
      :nDataStrAligns      := AL_CENTER
      :lDisplayZeros       := .f.
      :nFreeze             := 1
      :lLockFreeze         := .t.
      :lAllowColSwapping   := .f.
      :lAllowColHiding     := .f.
      :lAllowRowSizing     := .f.
      :lAllowSizings       := .f.
      :lColChangeNotify    := .t.

      :bClrStd := <|b,oCol|
         local nClr  := CLR_WHITE
         if oCol != nil .and. !Empty( oCol:Value )
            nClr  := aColors[ oCol:Value ]
         endif
         return { ContrastClr( nClr ), nClr }
         >

      for n := 2 to 10 step 2
         :SetGroupHeader( DTOC( Date() + n/2 - 1 ), n, n + 1, nil, nil, 30 )
      next
      WITH OBJECT :aCols[ 1 ]
         :nWidth     := aData[ 1, 1 ] + "9999"
         :bClrStd    := ;
         :bClrHeader := { || { CLR_BLACK, RGB(125,135,249) } }
         :nDataStrAlign := AL_CENTER
      END

      :bPopUp     := { |oCol| CellMenu( oCol ) }
      :lRecordSelector  := .f.
      :lFitGridHeight   := .t.

      // drag and drop

      :bChange       := < ||
                           local oCol := oBrw:SelectedCol()
                           if oCol:nArrayCol > 1 .and. !Empty( oCol:Value )
                              oBrw:oDragCursor := oCur
                           else
                              oBrw:oDragCursor := nil
                           endif
                           return nil
                           >

      :bDragBegin    := < |r,c,f|
                           SetDropInfo( { oBrw:nArrayAt, oBrw:SelectedCol():nArrayCol } )
                           return nil
                           >
      :bDropOver     := < |u,r,c,f|
                           oBrw:SetPos( r, c, .t. )
                           oBrw:SelectedCol():Value := aData[ u[ 1 ], u[ 2 ] ]
                           aData[ u[ 1 ], u[ 2 ] ] := 0
                           XEval( oBrw:bChange, oBrw )
                           oBrw:Refresh()
                           return nil
                        >

      //

      :nColSel    := 2
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont
   RELEASE CURSOR oCur

return nil
   
   //----------------------------------------------------------------------------//
   
   static function CellMenu( oCol )
   
      local oPop, oItem, oBrw, nVal, n
   
      if oCol:nCreationOrder > 1
         nVal  := oCol:Value
         oBrw  := oCol:oBrw
         MENU oPop POPUP 2010
            MENUITEM "Reserve To:"
            MENU
            for n := 1 to 9
               MENUITEM "Customer-" + Str(n,1,0) BLOCK Reserve( oCol, n )
            next
            ENDMENU
            MENUITEM "Cancel" WHEN nVal > 0 ACTION ;
               ( oCol:Value := 0, oBrw:RefreshCurrent() )
         ENDMENU
   
      endif
   
   return oPop
   
   static function Reserve( oCol, n )
   return { || oCol:Value := n, oCol:oBrw:RefreshCurrent() }
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 218
Joined: Mon Feb 07, 2022 09:54 PM
Re: Booking xbrowse example
Posted: Wed Jul 12, 2023 09:18 AM
This works great, Antonio.
It demonstrates the power of xbrowse and fwh.
Thanks for this great example. :D

Only a little glitch...
When the program starts and you reserve a first cell to a customer you can not immediately drag and drop this cell.
First you must click at an other cell. Then after drag and drop works well.

Regards,
Detlef
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Booking xbrowse example
Posted: Wed Jul 12, 2023 09:26 AM
Thank you dear Detlef,

Mr. Rao is working on an enhanced version. Lets wait a little for him to deliver it

Its another great work from Mr. Rao :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 218
Joined: Mon Feb 07, 2022 09:54 PM
Re: Booking xbrowse example
Posted: Wed Jul 12, 2023 09:46 AM
Its another great work from Mr. Rao :-)
That's true! :D
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Booking xbrowse example
Posted: Fri Jul 21, 2023 09:25 AM

As I told you, I use on reserva.dbf a field "type" to show the type of Rome, so I need this visualizzation, there are rooms with the same number buy with type different.

sample:

Camera n.1 SS

Camera n.1 DD

For evening or morning (AM -PM) I use two logic field.

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: Booking xbrowse example
Posted: Tue Sep 19, 2023 07:19 AM
Antonio Linares wrote:Thank you dear Detlef,

Mr. Rao is working on an enhanced version. Lets wait a little for him to deliver it

Its another great work from Mr. Rao :-)
Antonio,

when a an enhanced version ?
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: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Booking xbrowse example
Posted: Tue Sep 19, 2023 09:21 AM

Dear Silvio,

I just asked Mr. Rao

waiting for his answer

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 218
Joined: Mon Feb 07, 2022 09:54 PM
Re: Booking xbrowse example
Posted: Fri Dec 29, 2023 03:32 PM

Is there some progress? I'm very interested too about this topic.

I wish you all a very happy, healthy and successful new year.

Regards, Detlef

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Booking xbrowse example
Posted: Fri Dec 29, 2023 03:40 PM
Dear Detlef,

I just asked Mr. Rao about it

wish you too a very happy, healthy and successful new year :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Booking xbrowse example
Posted: Sat Dec 30, 2023 07:46 AM

Hello friends,

Why not try recreating this example as a proof of concept to demonstrate the power of WebView as a WebView example?

Best regards,

Otto

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Booking xbrowse example
Posted: Sat Dec 30, 2023 08:25 AM
Dear Otto,

thats a nice idea :-)

Surely you may be able to help us with some existing web code to start with
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Booking xbrowse example
Posted: Sat Dec 30, 2023 12:32 PM
Antonio Linares wrote:Dear Otto,

thats a nice idea :-)

Surely you may be able to help us with some existing web code to start with
Yes but before It Need to have a usefull prg in Windows with the features i list above and the possibilty to insert a reservation clickinking with the mouse One or more cells , or moving the reservation to another room or period.


in this way the example of nages is nice but in Italy it is unusable at least for what I need and what they require both for hotels and for other businesses in the sector
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: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Booking xbrowse example
Posted: Sat Dec 30, 2023 06:28 PM

Silvio,

Webview allows the use of prg programs, just as you create them, while still utilizing web technologies.

You should really look at the examples in the FIVEWIN samples.

Best regards,

Otto

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Booking xbrowse example
Posted: Sat Dec 30, 2023 06:54 PM
Dear Antonio,
I am glad you like the idea. I have indeed already developed a planner with html/javascript for mod harbour.

I have not integrated anything except bootstrap and jquery.

Therefore, I believe one would only need to embed the html into a Fivewin webview.

I have already posted several webview examples.

Best regards,
Otto


https://forums.fivetechsupport.com/viewtopic.php?f=3&t=11204&p=265558&hilit=planner&sid=c439ca4174db5684c6b3d89dd21ba93f&sid=c439ca4174db5684c6b3d89dd21ba93f#p265558














Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Booking xbrowse example
Posted: Sat Dec 30, 2023 11:00 PM
Otto wrote:Silvio,

Webview allows the use of prg programs, just as you create them, while still utilizing web technologies.
You should really look at the examples in the FIVEWIN samples.

Best regards,
Otto
As I told you many times I not want make web application
HTML/JavaScript and others languages
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