Jump to content
Fivewin Brasil

Emissão de Cardapio (Bares / Restaurantes) em HTML / pdf / etc


marcioe

Recommended Posts

Olá a Todos os Amigos, 

Temos em nosso sistema de Restaurantes/Bares a Opção de Gerar o Cardápio, Se for impresso (Fisicamente na impressora) fica BLZ

Porem o que queremos é hospedar ele no "tipo google drive", ou no disco virtual do cliente e Apontar com um QRCODE, isso blz;

Se exportamos em PDF como tem imagens, fica lento para abrir,   
Dai pensei em HTMl, mas quando exporto fica totalmente diferente do PREVIEW do fast, exemplo fica sem o fundo (um exemplo para entenderem)

Queria algo tipo assim 

cardapio-digital-pdf-e-png-1paginas.jpg


 

Link to comment
Share on other sites

Ola, obrigado a todos...

Quando a Hospedagem eu já tenho.  (no nosso caso iremos hosperdar na nossa) e o cliente quando mudar irar subir o Arquivo


O problema está na hora de gerar (exportar)   tanto PDF quanto html.  

Um fica pesado demais (Pdf), e carregar, demora demais..   Já HTML fica "truncando" imagem, texto.

 

Link to comment
Share on other sites

Como você faz? Usando URLDownloadToFile é super rápido. Pelo menos na minha máquina. Veja:

// c:\fwh...\samples\IMAGMARC.PRG  - 24/04/2023
	#Include "FiveWin.ch"
	#define CLR_MSPURPLE RGB( 0,  120, 215 )
#define CLR_MSRED    RGB( 232,  17,  35 )
#define CLR_MSGRAY   RGB( 229, 229, 229 )
	#define TME_LEAVE    2
	STATIC oWnd, hLib
	FUNCTION Main()
	   LOCAL oBar, cTitle, cUrl, cSaveAs
   LOCAL oWnd, nRowPos, nColPos, oBtnClose, oBtnMax, oBtnMin, lDrag := .F., ;
         lRResize := .F., lBResize := .F.
	   SetBalloon( .T. )
	   SkinButtons()
	   /*
   //https://imgur.com/QMNfhGK
	   //<blockquote class="imgur-embed-pub" lang="en" data-id="QMNfhGK"><a href="https://imgur.com/QMNfhGK">View post on imgur.com</a></blockquote><script async src="//s.imgur.com/min/embed.js" charset="utf-8"></script>
	   //[img=https://i.imgur.com/QMNfhGK.jpg]
	   //[Imgur](https://imgur.com/QMNfhGK)
	   //https://i.ibb.co/FXGNX6n/xxxxxxxxxxxxxxxxxxxxxxxx.jpg
   */
	   cUrl    := "https://i.ibb.co/FXGNX6n/xxxxxxxxxxxxxxxxxxxxxxxx.jpg"  // IMAGEM
	   cSaveAs := "MarcioMg.png"
	   cTitle  := "FiveWin Brasil: Grabar Imagen Desde URL"
	   // DEFINE WINDOW oWnd TITLE cTitle
   DEFINE WINDOW oWnd STYLE WS_POPUP COLOR CLR_BLACK, CLR_MSPURPLE // MDI
	   oWnd:Center()
   oWnd:Shadow()
   oWnd:bPainted = { || oWnd:Say( 8, 30, "Caption Color", CLR_RED, CLR_MSPURPLE, oWnd:oFont, .T., .T. ) }
	   oWnd:bLClicked = { | nRow, nCol | If( nRow < 25, ( oWnd:Capture(), nRowPos := nRow, nColPos := nCol, lDrag := .T. ),),;
                                     If( nRow > 25 .and. nCol > oWnd:nWidth - 25, ( oWnd:Capture(), nRowPos := nRow, nColPos := nCol, lRResize := .T. ),),;
                                     If( nRow > 25 .and. nRow > oWnd:nHeight - 25, ( oWnd:Capture(), nRowPos := nRow, nColPos := nCol, lBResize := .T. ),) }
     
   oWnd:bMMoved = { | nRow, nCol | TrackMouseEvent( oWnd:hWnd, TME_LEAVE ),;
                                   If( lDrag .and. ! IsZoomed( oWnd:hWnd ) .and. IsOverWnd( oWnd:hWnd, nRow, nCol ),;
                                       oWnd:Move( oWnd:nTop + nRow - nRowPos, oWnd:nLeft + nCol - nColPos,,, .T. ),),;
                                   If( lRResize .and. ! IsZoomed( oWnd:hWnd ) .and. IsOverWnd( oWnd:hWnd, nRow, nCol ),;    
                                       ( oWnd:SetSize( oWnd:nWidth + nCol - nColPos, oWnd:nHeight, .T. ), nColPos := nCol ),),;
                                   If( lBResize .and. ! IsZoomed( oWnd:hWnd ) .and. IsOverWnd( oWnd:hWnd, nRow, nCol ),;    
                                       ( oWnd:SetSize( oWnd:nWidth, oWnd:nHeight + nRow - nRowPos, .T. ), nRowPos := nRow ),) }  
	   oWnd:bLButtonUp = { || ReleaseCapture(), lDrag := .F., lRResize := .F., lBResize := .F. }
   oWnd:bMLeave    = { || lDrag := .F. }
	   @ 1, oWnd:nWidth - 46 BTNBMP oBtnClose BITMAP "../bitmaps/16x16/closew.bmp" ;
      FLAT NOBORDER NOROUND ACTION oWnd:End() SIZE 45, 29 ;
      COLOR CLR_BLACK, CLR_MSPURPLE
	   @ 1, oWnd:nWidth - 92 BTNBMP oBtnMax BITMAP "../bitmaps/16x16/max.bmp" ;
      FLAT NOBORDER NOROUND ACTION If( ! IsZoomed( oWnd:hWnd ), oWnd:Maximize(), oWnd:Restore() ) SIZE 45, 29 ;
      COLOR CLR_BLACK, CLR_MSPURPLE
	   @ 1, oWnd:nWidth - 138 BTNBMP oBtnMin BITMAP "../bitmaps/16x16/min.bmp" ;
      FLAT NOBORDER NOROUND ACTION If( ! IsIconic( oWnd:hWnd ), oWnd:Iconize(), oWnd:Restore() ) SIZE 45, 29 ;
      COLOR CLR_BLACK, CLR_MSPURPLE
	   oBtnClose:bMMoved = { || oBtnClose:SetColor( CLR_BLACK, If( oBtnClose:lMOver, CLR_MSRED, oWnd:nClrPane ) ) }
   oBtnMax:bMMoved   = { || oBtnMax:SetColor( CLR_BLACK, If( oBtnMax:lMOver, CLR_MSGRAY, oWnd:nClrPane ) ) }
   oBtnMin:bMMoved   = { || oBtnMin:SetColor( CLR_BLACK, If( oBtnMin:lMOver, CLR_MSGRAY, oWnd:nClrPane ) ) }
	   oWnd:bResized = { || oBtnClose:Move( 1, oWnd:nWidth - 46 ), oBtnMax:Move( 1, oWnd:nWidth - 92 ),;
                        oBtnMin:Move( 1, oWnd:nWidth - 138 ) }
	   DEFINE BUTTONBAR oBar BUTTONSIZE 60, 50 _3DLOOK TOP OF oWnd 2007
	   DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\floppy.bmp" FLAT         ;
      ACTION( URLDownLoad( cUrl, cSaveAs ) ) TOOLTIP "Saves this Image"
	   DEFINE BUTTON OF oBar FILENAME "..\bitmaps\16x16\Exit.bmp" FLAT           ;
      ACTION oWnd:End() TOOLTIP "Exit this app" GROUP
	   SET MESSAGE OF oWnd TO cTitle  NOINSET CLOCK DATE KEYBOARD 2007
	   // ON INIT( CLRTEST( CLR_WHITE, CLR_HRED ) )                              ;
   ACTIVATE WINDOW oWnd MAXIMIZED /*                                         ;
      ON PAINT(  DiagonalGradientFill( hDC,                                  ;
                 0, 0, oWnd:nHeight, oWnd:nWidth,                            ;
                 { { 0.16, CLR_WHITE, CLR_CYAN },                            ;
                 { 0.16, CLR_CYAN, nRGB( 181, 61, 29 ) },                    ;
                 { 0.16, nRGB( 181, 61, 29 ), nRGB( 250,157,52 ) },          ;
                 { 0.16, nRGB( 250,157,52 ), nRGB( 181, 61, 29 ) },          ;
                 { 0.16, nRGB( 181, 61, 29 ), CLR_CYAN },                    ;
                 { 0.20, CLR_CYAN, CLR_WHITE } },.T. ), PINTA( hDC ) )
                 */
	RETURN NIL
	FUNCTION URLDownLoad( cUrl, cSaveAs )
	   hLib := LOADLIBRARY( "urlmon.dll" )
	   CURSORWAIT()
	   IF FILE( cSaveAs )
	      ERASE cSaveAs
	   ENDIF
	   IF .NOT. URLDownloadToFile( 0, cUrl, cSaveAs, 0, 0 ) == 0
	      MsgInfo( "Image Not Found", "Attention!" )
	      RETURN( .F. )
	   ENDIF
	   FreeLibrary( hLib )
	   CURSORARROW()
	   ShellExecute(GetActiveWindow(),"open",'"'+cSaveAs+'"')
	RETURN( .T. )
	FUNCTION DiagonalGradientFill( hDC, nTop, nLeft, nBottom, nRight, aGradInfo, ;
                               lDirection )
	   LOCAL nClr := 1, nClrs := Len( aGradInfo )
   LOCAL nSize, nStart, nEnd
	   DEFAULT lDirection := .T.
	   IF Empty( aGradInfo )
	      RETURN NIL
	   ENDIF
	   nSize    = ( nBottom - nTop ) + ( nRight - nLeft )
   nStart   = 0
   nEnd     = 0
	   FOR nClr := 1 to nClrs
	      nStart = nEnd
      nEnd   += ( nSize * ( aGradInfo[ nClr ][ 1 ] ) )
	      DiagonalGradient( hDC, ;
                        { nTop, nLeft, nBottom, nRight },;
                          aGradInfo[ nClr ][ 2 ], ;
                          aGradInfo[ nClr ][ 3 ], ;
                          lDirection, ;
                          nStart, ;
                          nEnd )
	   NEXT
	RETURN NIL
	FUNCTION Pinta( hDC )
	   LOCAL nColor
   LOCAL nLeft   := 80
   LOCAL nRight  := 220
   LOCAL cTexto  := "FIVEWIN BRASIL THE BEST"
   LOCAL cTexto2 := "No funciona...    "
   LOCAL oFont
   LOCAL hFont
   LOCAL nLen    := LEN( cTexto )
   LOCAL cLetra, n
   LOCAL nResHoriz, nResVert
	   nResHoriz := oWnd:nHorzRes() // retorna a resolucao horizontal
   nResVert  := oWnd:nVertRes() // retorna a resolucao vertical
	   // atencao: nResolution identifica em que resolucao foram inicialmente
   // desenhadas as telas, e DEVE ter um dos seguintes valores:
   //
   // 1 =  640 X 480
   // 2 =  800 X 600
   // 3 = 1024 X 768
   // 4 = 1152 X 864
   // 5 = 1280 X 800
   // 6 = 1280 X 1024
   // 7 = 1600 X 1200
   // 8 =  768 X 1024
   // 9 = 1440 X 900
   // 10 = 1280 X 768
   // 11 = 1280 X 720
	   IF nResHoriz = 1366 .AND. nResVert = 768
	      nLeft  := 260
      nRight := 230
	   ELSEIF nResHoriz = 1360 .AND. nResVert = 768
	      nLeft  := 210
      nRight := 250
	   ELSEIF nResHoriz = 1280 .AND. nResVert = 1024
	      nLeft  := 210
      nRight := 350
	   ELSEIF nResHoriz = 1280 .AND. nResVert = 768
	      nLeft  := 170 // 210  // my computer.
      nRight := 280
	   ELSEIF nResHoriz = 1280 .AND. nResVert = 720
	      nLeft  := 200
      nRight := 200
	   ELSEIF nResHoriz = 1024 .AND. nResVert = 768
	      nLeft  :=  80
      nRight := 220
	   ELSE
	      nLeft  :=  80
      nRight := 220
	   ENDIF
	   DEFINE FONT oFont NAME "Segoe UI Symbol" SIZE 0, -80 BOLD
	   hFont := SelectObject( hDC, oFont:hFont )
	   FOR n := 1 TO nLen
	      cLetra := substr( cTexto, n, 1 )
	      nColor := SetTextColor( hDC,  CLR_GREEN )
	      // TextOut( hDC, 10, nLeft, cLetra )
      TextOut( hDC, nRight, nLeft, cLetra )
	      SetTextColor( hDC, nColor )
	      nLeft += GetTextWidth( hDC, cLetra, oFont )
	   NEXT
	   SelectObject( hDC, hFont )
	RETURN NIL
	#pragma BEGINDUMP
	#include <hbapi.h>
#include <windows.h>
	HB_FUNC( CLRTEST )
{
   int aElements[2] = { COLOR_CAPTIONTEXT, COLOR_ACTIVECAPTION };
   DWORD aColors[2];
	   aColors[ 0 ] = hb_parnl( 1 );
   aColors[ 1 ] = hb_parnl( 2 );
   SetSysColors( 2, aElements, aColors );
	}
	#pragma ENDDUMP
	DLL32 FUNCTION URLDownloadToFile( pCaller AS LONG, szURL AS STRING, szFileName ;
   AS STRING, dwReserved AS LONG, lpfnCB AS LONG ) AS LONG PASCAL              ;
   FROM "URLDownloadToFileA" LIB hlib
	// fin /end

Regards, saludos

Link to comment
Share on other sites

Eu posso não tem entendido corretamente, mas deixa eu tentar tentar explicar.

Nosso sistema de controla as mesas/comandas(bares e Restaurantes)

E nas mesas tem um Qr-Code, onde a pessoa(Cliente) scaneia e pega os preços dos produtos(cardápio) no celular.   

Esse cardápio nada mais é que um "report" um relatório  hospedado em algum servidor-on-line.

Quando o restaurante / bar mudar os preços ele sobre pelo nosso sistema para a hospedagem. 
Isso para que nao seja mais impresso "cardápio"

Funciona, mas em alguns casos fica lento, então estamos querendo "melhorar"

Tenha em mente que sempre será "lido em um Celular"
 

Link to comment
Share on other sites

Obrigado amigo, mas no caso, voce faz isso no seu EXE, no meu caso,  

Como é um BAR/RESTAURANTE, voce chega com seu celular (android, iPhone),    não tem Nosso sistema no celular deles

Sacou, ele vai ler o QR-code na mesa e acessar o CARDÁPIO,   nada mais,   Só pra ver os preços e o que a casa oferece, simples


 

29 minutos atrás, edutraini disse:

Boa tarde, eu uso uma solucao que talvez seja uma ideia

assim que emito a nota fiscal eletronica eu salvo o pdf da nota dentro de um campo text no sql 

codificado  para base64 

quando preciso do pdf simplesmente leio o campo e mostro na tela

 

 

Tipo assim amigo (está impresso no porta treco da mesa) por exemplo

 

ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...