ExecuteReport( )

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
Amarante
Posts: 182
Joined: Fri Apr 27, 2012 9:44 pm
DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL
Location: Araruama-RJ, Brazil

Re: ExecuteReport( )

Post by Amarante »

Creo que el problema es sólo en la vista previa del informe, ya que el PDF tiene acentos, pero los acentos no aparezco en metarchivos (CEM) generados por Vista previa.
Yo lo uso porque además de ser gratuito, pequeño y eficiente, no sé si el cliente tendrá un lector de PDF instalado, pero puede ser cualquiera de varios existente.
Mi ejemplo con SumatraPDF era demostrar que fuera en lugar de utilizar la vista previa se puede utilizar el lector de PDF.
______________________
I think the problem is only in the Preview of the report, because the PDF has accents, but the accents do not appear in metafiles (EMF) generated by Preview.
I use it because besides being free, small and efficient do not know if the client will have a PDF reader installed, but can be any of several existing.
My example with SumatraPDF was to demonstrate that out instead of using the preview you could use the PDF reader.
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

ExecuteReport( )

Post by Pablo César »

How it could be make a preview of PDF file.

In FW there is already a solution (with not source codes yet) at: http://forums.fivetechsupport.com/viewt ... 38#p173438

So, it seems posible to create our own visualizer for PDFs files.

Lets wait more details about specially promissed source codes...
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Amarante
Posts: 182
Joined: Fri Apr 27, 2012 9:44 pm
DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL
Location: Araruama-RJ, Brazil

Re: ExecuteReport( )

Post by Amarante »

Pablo,
I'm not much of politics to reinvent the wheel. My goal is to just meet my clients. So I do not see the need to create a report viewer when abound and free.
In my programs I generate the PDF ... temporarily run the PDF viewer ... there being you if you want to print, save ... do what you want .... but only back to my program after closing the reader pdf ... then it will hardly give problem ... of course there will always be a tapir who can not use any software ... but it's rare.
---------------
Pablo,
Eu não sou muito da politica de reinventar a roda. Meu objetivo é atender logo meus clientes. Então não vejo a necessidade de criar um visualizador de relatório quando existem aos montes e gratuitos.
Nos meus programas eu gero o PDF temporariamente... executo o visualizador de PDF... estando lá o usuário se quiser imprime, salva... faz o que quiser.... mas só volta pro meu programa após fechar o leitor de pdf... então dificilmente vai dar problema... é claro que sempre existirão umas antas que não conseguem usar nenhum software... mas é mais raro.
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

ExecuteReport( )

Post by Pablo César »

Amarante wrote:é claro que sempre existirão umas antas que não conseguem usar nenhum software... mas é mais raro
:lol: :lol:

Tenho curiosidade e a título de aprendizado, gostaria de poder dar uma olhadinha nesse visualizador. Quem sabe podemos implementar no nosso PREVIEW ?
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: ExecuteReport( )

Post by andyglezl »

Hola

Voy de acuerdo con lo que dice Amarante:
I'm not much of politics to reinvent the wheel. My goal is to just meet my clients. So I do not see the need to create a report viewer when abound and free.
In my programs I generate the PDF ... temporarily run the PDF viewer ... there being you if you want to print, save ... do what you want .... but only back to my program after closing the reader pdf ... then it will hardly give problem ... of course there will always be a tapir who can not use any software ... but it's rare.
Pablo César wrote:
Lo que se poderia hacer, es visualizar en EMF y generar el archivo PDF. Eso poderia ser un sugerencia que puedes hacerlo en la seccion WishList.
Quizá sea una buena opcion, en donde por ejemplo:

ExecuteReport( 'Ctes2', .f., .f., cRaiz + 'Clientes.pdf' ) // No hacer PREVIEW y que no aparezca el diálogo de la impresora pero que genere el PDF
SHELLEXECUTE( 0, "open" , "AcroRd32.exe", cRaiz + 'Clientes.pdf' ) // o con el SumatraPDF

Como Aclaración, el PDF generado con el PREVIEW (HMG_PrintFile.PDF) si se ve bien con el Acrobat Reader y el que genera el ExecuteReport( ) es el que da problemas.
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
Amarante
Posts: 182
Joined: Fri Apr 27, 2012 9:44 pm
DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL
Location: Araruama-RJ, Brazil

Re: ExecuteReport( )

Post by Amarante »

Honestly, I think the standard emf is very archaic. It worked well when the window graphics mode prevailed and processors were lentissimos. Today with both open source I see no sense in transform a text (the report) in Graphic and clog the disk with files, which depending on the amount of report leaves, will be huge.
A pdf file of the graph text format will be mounted during the lowering display much file size.
For me creating the pdf file ... you can read it in your PDF viewer of your choice ... I do not see any sense in creating more a viewer. It's good for learning? No doubt. But only if it were making money from it. Otherwise we will invent what does not exist, or improve what already works.
Maybe I'm speaking on behalf of themselves, because since they do not use DBF files, then do not use the HMG report generators.
Forgive me, sometimes we forget the needs of others.
But here I try to leave my experience with PDF viewers. It's easy and it works!
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: ExecuteReport( )

Post by andyglezl »

Hola Amarante

Me surgen 2 detalles:

1.- No hace nada (no despliega) al ejecutar el SumatraPDF.exe con: SHELLEXECUTE( 0, "open" , "SumatraPDF.exe", cRaiz + 'Clientes.pdf' )
2.- Incluí tu función en mi programa: Run_MyProcess( cRaiz+"SumatraPDF.exe "+cRaiz+"Clientes.pdf", .t. ) pero me
despliega el PDF a pantalla completa y no me da opción al menú para imprimir.

Alguna idea ?
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Hello Amarante

I come two details:

1. Do nothing (not displayed) to run the SumatraPDF.exe with: ShellExecute (0, "open", "SumatraPDF.exe" cRaiz + 'Clientes.pdf')
2. I have included your function in my program: Run_MyProcess ( CRaiz + "SumatraPDF.exe" + cRaiz + "Clientes.pdf", .t. ) but I
displays the PDF in full screen and not an option for the menu to print.

Any thoughts?
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
Amarante
Posts: 182
Joined: Fri Apr 27, 2012 9:44 pm
DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL
Location: Araruama-RJ, Brazil

Re: ExecuteReport( )

Post by Amarante »

Andy,
Escribiste:

Code: Select all

RunMyProcess (Crazy + "SumatraPDF.exe" cRaiz + .t "Clientes.pdf" +.)
Resulta que el parámetro con el nombre del archivo que se pasa a la SumatraPDF necesita ser citado debido a que el nombre del directorio puede contener espacios, por lo que evitar la confusión con otros parámetros
Reescribiendo la línea, la forma correcta de llamar SumatraPDF sería:

Code: Select all

Run_MyProcess (CRaiz + [SumatraPDF.exe "] + cRaiz + [Clientes.pdf"] .t.)
He cambiado la rutina para evitar errores

Code: Select all

/**
*
* Run_MyProcess
*
* Description: Executes an external process
* Syntax.....: Run_MyProcess( <expC1>, [expL1], [expB1], [expN1], [expN2] )
* Parameters.: <expC1> - Expression of process running
*              [expL1] - Wait on process (default .T.)
*              [expB1] - Block-function to be performed during the process
*              [expN1] - Time (default 1)
*              [expN2] - Number of times to perform the block-function (default 0)
* Return.....: expN - Result of the process
* Example....:
*   Run_MyProcess( "SumatraPDF.exe " + "Certidao.PDF", .T. )
*   ------ other sample -----
*   hb_memowrit( "test.txt", "Test File..." )
*   ? "Retorno:", Run_MyProcess( "notepad test.txt", .T., { || QOUT( "Waiting Notepad close..." ) }, 1 )
*   WAIT "When you get here notepad already ended. press ENTER..."
*   ? "Retorno:", Run_MyProcess( "notepad test.txt", .F. )
*   WAIT "When you get here notepad is still running. press ENTER..."
*   ? "Retorno:", Run_MyProcess( "notepad test.txt",, { | nCtd | QOUT( "Waiting Notepad close (" + hb_ntos( 5 - nCtd ) + ")..." ) },, 5 )
*   WAIT "The Loop was closed after in 5 seconds..."
*   ? "Retorno:", Run_MyProcess( "notepad test.txt",, { | nCtd | QOUT( "Forcing the closure of Notepad by returning the codeblock..." ), IIF( nCtd = 2, .F., .T. ) } )
*   WAIT "The Loop was closed..."
*
*/
FUNCTION Run_MyProcess( cExecute, lWait, bBlock, nTime, nOccurs )

  #include "fileio.ch"							// <----- le falta
  #define LWA_ALPHA    0x02					// <------le falta

  LOCAL cWin_ := _HMG_SYSDATA[ 316 ]                      // Name of the current window
  LOCAL hProcess
  LOCAL nCtd := 0
  LOCAL nResult
  LOCAL lRet

  __DefaultNIL( @lWait, .T. )
  __DefaultNIL( @nTime, 1 )
  __DefaultNIL( @nOccurs, 0 )
  
  hProcess := HB_ProcessOpen( cExecute )
  IF hProcess <> F_ERROR
    SetLayeredWindowAttributes( GetFormHandle( cWin_ ), 0, 180, LWA_ALPHA )
    DO WHILE ( nResult := HB_ProcessValue( hProcess, .F. ) ) == - 1
      DO EVENTS
      IF .NOT. lWait
        EXIT
      ENDIF
      nCtd += 1
      IF HB_IsBlock( bBlock )
        lRet := EVAL( bBlock, nCtd )
        IF HB_IsLogical( lRet ) .AND. .NOT. lRet
          HB_ProcessClose( hProcess, .T. )
          EXIT
        ENDIF
      ENDIF
      IF nTime > 0
        HB_IdleSleep( nTime )
      ENDIF
      IF nCtd == nOccurs
        HB_ProcessClose( hProcess, .T. )
        EXIT
      ENDIF
    ENDDO
    SetLayeredWindowAttributes( GetFormHandle( cWin_ ), 0, 255, LWA_ALPHA )
  ELSE
    MsgInfo( "Error Open Process" )
  ENDIF
  RETURN nResult
User avatar
Amarante
Posts: 182
Joined: Fri Apr 27, 2012 9:44 pm
DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL
Location: Araruama-RJ, Brazil

Re: ExecuteReport( )

Post by Amarante »

Clearing Up ....
This routine is not of my own ... it was originally made by Rossine, who posted it on another forum and that Pablo thought was a woman. I just changed for my needs.
Run_MyProcess does not prevent the user closes their program .... you need to make use of other artifices to prevent the ever-existing, user wretched, miserable and other insults that I should not speak here to find a flaw in your program.
Another time I will show in a sample program.
------------------
Aclarar ....
Esta rutina no es de mi propia ... que fue hecho originalmente por Rossine, quien lo publicó en otro foro y que Pablo creía que era una mujer. Acabo de cambiar para mis necesidades.
Run_MyProcess no impide que el usuario cierra su programa .... lo necesario para hacer uso de otros artificios para evitar la siempre existente, el usuario desventurado, miserable y otros insultos que no debo hablar aquí para encontrar un defecto en su programa.
Otra vez voy a mostrar en un programa de ejemplo.
------------------
Esclarecendo....
Essa rotina não é de minha autoria... foi feita originalmente por Rossine, que postou ela em outro fórum e que o Pablo achava que era mulher. Eu apenas alterei para minhas necessidades.
A Run_MyProcess não impede que o usuário feche o seu programa.... você precisa fazer usar de outros artificios para impedir o sempre existente, usuário desgraçado, miseravel e outros impropérios que não devo falar aqui de achar uma falha no seu programa.
Outra hora demonstrarei em um programa exemplo.
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: ExecuteReport( )

Post by andyglezl »

Hola
Probé el ejemplo: "\HMG\3.4\SAMPLES\Controls\ReportAdvanced\REPORT_ADVANCED_6"
y tiene el mismo detalle antes mencionado, la image no se muestra en el PDF generado.
-------------------------------------------------------------------------------------------------------------
Hello
I tried the example: "\HMG\3.4\EXAMPLES\Controls\Report Advanced\REPORT_ADVANCED_6"
and has the same detail above, the image is not displayed in the PDF generated.
createRepSample5.jpg
createRepSample5.jpg (280.02 KiB) Viewed 4864 times
Andrés González López
Desde Guadalajara, Jalisco. México.
Post Reply