Printer class question - RESOLVED

Re: Printer class question

Postby karinha » Wed Oct 21, 2020 4:14 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Printer class question

Postby karinha » Wed Oct 21, 2020 4:16 pm

Code: Select all  Expand view

// Using: GDIPLUS.

#include "FiveWin.ch"

#define PAD_LEFT            0
#define PAD_RIGHT           1
#define PAD_CENTER          2

FUNCTION BoxRed() // CAIXA REDONDA - BOXROUND.

   LOCAL oPrn, oFont, oFont2, oFont3, oPen, oPen1, oPen2, oPen3
   LOCAL oBrush, oFondo
   LOCAL ResLinha, ResColuna, nLinha, nColuna
   LOCAL nLinBox, nColBox, nAltBox, nTamBox, lBorEsq, lBorDir

   PRINT oPrn NAME "Ejemplo de caja redondeada" PREVIEW

      DEFINE BRUSH oBrush   COLOR nRGB(250,213,174) // Bello
      DEFINE BRUSH oFondo   COLOR CLR_GRAY  // HGRAY

      // DEFINE PEN oPen WIDTH 2                                    OF oPrn
      DEFINE PEN oPen  WIDTH 2  COLOR CLR_CYAN                    OF oPrn
      Define Pen oPen1 Width 25 COLOR nRgb( 192, 192, 192 )       OF oPrn
      DEFINE PEN oPen2 WIDTH 2  COLOR CLR_BROWN                   OF oPrn
      DEFINE PEN oPen3 WIDTH 50 COLOR nRgb( 192, 192, 192 )       OF oPrn

      DEFINE FONT oFont  NAME "Arial" SIZE 0, - 6  BOLD           OF oPrn
      DEFINE FONT oFont2 NAME "Arial" SIZE 0, - 12 BOLD Underline OF oPrn
      DEFINE FONT oFont3 NAME "Arial" SIZE 0, - 18 BOLD           OF oPrn

      ResLinha  := oPrn:nLogPixely() / 2.54
      ResColuna := oPrn:nLogPixelx() / 2.54

      PAGE

        nLinha  := 2.25
        nColuna := 9.50

        nLinBox := 1.60  // Linha que Inicia o Box
        nColBox := 5.50  // Coluna que inicia o Box
        nAltBox := 3.50  // Altura do Box
        nTamBox := 13.60 // Tamanho(Largura) do Box horizontal
        lBorEsq := 90    // Bordas arredondadas esquerda.
        lBorDir := 90    // Bordas arrendondadas direita.

        Box_Round( nLinBox , nColBox , nAltBox, nTamBox, oPrn, lBorEsq, lBorDir, oPen, oFondo )

        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                    ;
           + "DESCRIZIONE DOCUMENTO", oFont2,, CLR_BLACK,, PAD_CENTER )

        nLinha := nLinha + .80

        oPrn:Say( nLinha * ResLinha, nColuna * ResColuna,                    ;
           + "FiveWin is invincible.", oFont,, CLR_BLACK,, PAD_CENTER )


      ENDPAGE

   ENDPRINT

   oBrush:End()
   oFondo:End()
   oPen:End()
   oPen:release()

RETURN nil

FUNCTION Box_Round( nArriba, nIzq, nAbajo, nDerecha, oPrn, a, b, oPen, oBrush )

   LOCAL hOldPen, xCor := {} , yCor := {}
   LOCAL hOldBrush

   // Pasamos coordenadas de cms a pixel
   xCor := oPrn:Cmtr2Pix(nArriba,nIzq)
   yCor := oPrn:Cmtr2Pix(nAbajo,nDerecha)

   // Guardamos el Lapiz y la brocha que teniamos
   hOldPen   := SelectObject( oPrn:hDcOut, oPen:hPen )
   hOldBrush := SelectObject( oPrn:hDcOut, oBrush:hBrush )

   //Dibujamos el rectangulo redondeado
   roundrect(oPrn:hdcOut,xCor[2],xCor[1],yCor[2],yCor[1],a,b)

   // y  seleccionamos el que habiamos guardado
   selectObject( oPrn:hDcOut, hOldPen )
   selectObject( oPrn:hDcOut, hOldBrush )

RETURN NIL

#IFDEF __HARBOUR__
   DLL FUNCTION RoundRect( hDC AS LONG, ;
              iLeft AS _INT , iTop AS _INT, ;
              iRight AS _INT, iBottom AS _INT, ;
              iWidth AS _INT, iHeight AS _INT ) AS BOOL PASCAL LIB "GDI32.DLL"
#ELSE
   DLL FUNCTION RoundRect( hDC AS WORD, ;
              iLeft AS _INT , iTop AS _INT, ;
              iRight AS _INT, iBottom AS _INT, ;
              iWidth AS _INT, iHeight AS _INT ) AS BOOL PASCAL LIB "GDI.EXE"
#ENDIF
 


Regards.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Printer class question

Postby Silvio.Falconi » Wed Oct 21, 2020 5:05 pm

No. sorry
I would like to create a system where I can store the print form on a file
not just a single box that was just an example
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: Printer class question

Postby TimStone » Wed Oct 21, 2020 5:28 pm

Silvio,

I am sorry to be confused. All of my printouts are stored in .prg files. The content is all variables which are filled from the data. For example, an Invoice has a company name at the top ( either in text or a bitmap ), then two boxes for invoice data, side by side, multi line, and two more boxes for customer and vehicle data. These are grey boxes with borders. Then it lists parts in the next section, all properly formatted, and then labor, and then recommendations. Totals come next in a box that is has a white background, and finally the "fine print" plus any advertising info. These can be black and white, or color.

The whole invoice is a .prg file. It is the "template". Some labels are printed every time, but all data is stored at variables. Those variables are set before the print commences, or drawn fromt the .dbf fields as the printing progresses.

It might be like the report capability in FWH except it is all customized using the printer class, and far more can be done with decision trees to control the actual content and output.

I think this is pretty standard using the class. With that in mind, I'm afraid I don't really understand how this differs from what you want. In my example, the user inputs all the data into a workorder which he interacts with on the screen. To print an invoice ( or other document ) he simply presses a single button and the system selects the data from the current files which match that workorder, applies the proper formatting, and prints the invoice ( all with a single press ), or displays it in preview mode if preferred.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Printer class question

Postby karinha » Wed Oct 21, 2020 5:33 pm

OK. When you manage to do this, please post to all FiveWin users, it will be super interesting. Waiting. Thank you.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7824
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Printer class question

Postby Silvio.Falconi » Wed Oct 21, 2020 7:00 pm

TimStone wrote:Silvio,

I am sorry to be confused. All of my printouts are stored in .prg files. The content is all variables which are filled from the data. For example, an Invoice has a company name at the top ( either in text or a bitmap ), then two boxes for invoice data, side by side, multi line, and two more boxes for customer and vehicle data. These are grey boxes with borders. Then it lists parts in the next section, all properly formatted, and then labor, and then recommendations. Totals come next in a box that is has a white background, and finally the "fine print" plus any advertising info. These can be black and white, or color.

The whole invoice is a .prg file. It is the "template". Some labels are printed every time, but all data is stored at variables. Those variables are set before the print commences, or drawn fromt the .dbf fields as the printing progresses.

It might be like the report capability in FWH except it is all customized using the printer class, and far more can be done with decision trees to control the actual content and output.

I think this is pretty standard using the class. With that in mind, I'm afraid I don't really understand how this differs from what you want. In my example, the user inputs all the data into a workorder which he interacts with on the screen. To print an invoice ( or other document ) he simply presses a single button and the system selects the data from the current files which match that workorder, applies the proper formatting, and prints the invoice ( all with a single press ), or displays it in preview mode if preferred.

Tim

Timm is all right but you see I have to do a pile of documents every time, in Italy for the prints there are many types and every time I have to do many of them sometimes I use the same prints sometimes I can't use them and so if they do a store where to store the format, the fields would be easier
I was hoping for a good report designer program but there is nothing to do, they tell you it uses ER but ER has a lot of problems and honestly wasting time on ER I don't really want to, we always have to do the nistri trained in Italy you have to do about twenty all different in addition to the other prints (lists) that I use the simple treport cche also there are the problems like the famous ncounter then solved in a topic in the forum, we have the invoice but we do not have a single document there there are many types of invoices:
accompanying invoice,
deferred invoice,
proforma invoice,
immediate invoice,
deferred invoice,
advance invoice
down payment invoice
invoice for gifts
Credit and debit note
and these are for invoices only then there are many other documents
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: Printer class question

Postby TimStone » Wed Oct 21, 2020 11:56 pm

Silvio,

I likely have about 60 printouts, and they can be quite different. Each has it's own .prg.

For example, on any workorder, there are 3 options: Estimate, Invoice, and Worksheet. So in one .prg, as it goes through the process I mentioned earlier, it may print different data or formats. How does it know ? You can use IF ... ENDIF statements or the the good DO CASE option. You set an array of flags to .f., and then before printing you select the option you want for the format. That changes the value of the proper flag to .t., and the printout outputs those options.

If you requier multiple reports, you could first show a checklist. Then, you call a single Function that will print each report that is checked. You will need a key for the data to use ( in my case it is the workorder number ), but your reports can all draw the proper data based on that key.

To put it simply, each type of form has it's own .prg.
You start with a selection / options screen that allows you to decide which form(s) to print
The data for that specific job is then applied to each form and it outputs them.
Each form can have a unique design based on the needs and requirements of the client, or even the government.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Printer class question

Postby Silvio.Falconi » Thu Oct 22, 2020 7:11 am

Nages,
Method box ...parametri atext
I can set text font color
How se can add Also the align ?
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: Printer class question

Postby Silvio.Falconi » Thu Oct 22, 2020 2:45 pm

nageswaragunupudi wrote:
Code: Select all  Expand view
function PrnBox()

   local oPrn, oFont, oBrush

   DEFINE BRUSH oBrush FILE "c:\fwh\bitmaps\backgrnd\pebbles.bmp"
   PRINT oPrn PREVIEW
   DEFINE FONT oFont NAME "VERDANA" SIZE 0,-30 OF oPrn BOLD

   PAGE
   oPrn:RoundBox( 1, 1, 5, 5, .5, .5, { CLR_HRED, 3 }, oBrush, ;
                  { "FIRST" + CRLF + "SECOND", oFont, CLR_WHITE, "B" }, ;
                  "INCHES" )
   @ 1,1 PRINT TO oPrn TEXT "HOLLOW TEXT" SIZE 4, 4 INCHES FONT oFont ;
         COLOR CLR_YELLOW OUTLINE CLR_HRED SIZE 3 ALIGN "T"

   ENDPAGE
   ENDPRINT

   RELEASE FONT oFont
   RELEASE BRUSH oBrush

return nil


Image


Nages,
this test run ok BUT I tried

DEFINE FONT oFont NAME "VERDANA" SIZE 0,-6 OF oPrn BOLD

oPrn:Box( 1, 5.5,1.5,0.8, { CLR_BLACK, 1 }, CLR_HGRAY, ;
{ "TIPO DOCUMENTO", oFont, CLR_WHITE, "TL" }, ;
"CM" )

and not run ok


Image






and this small test not run


I wish recreate this

Image






I tried with

Code: Select all  Expand view


 #include"fivewin.ch"


   function PrnBox()

       local oPrn, oFont, oFont2
       local aDat

        PRINT oPrn PREVIEW

       DEFINE FONT oFont NAME "VERDANA" SIZE 0,-6 OF oPrn BOLD
       DEFINE FONT oFont2 NAME "VERDANA" SIZE 0,-12 OF oPrn BOLD
       PAGE


      //   x , y, nWidth,nHeight
aDat:=  {;
         {1,5.5,4.5,0.8,"Tipo Documento" },;
         {5.5,5.5,2.5,0.8,"Numero Documento" },;
         {8,5.5,2.5,0.8,"Data Documento" },;
             }

For n= 1 to 3

        X:=    aDat[n][1]
        Y:=    aDat[n][2]
        nWid:= aDat[n][3]
        nHei:= aDat[n][4]

     oPrn:Box( x, y,nHei,nWid,  { CLR_BLACK, 1 }, CLR_HGRAY, ;
                      { aDat[n][5], oFont, CLR_WHITE, "TL" }, ;
                      "CM" )


     next





       ENDPAGE
       ENDPRINT

       RELEASE FONT oFont
        RELEASE FONT oFont2
    return nil

 



the measures are on cm

but the result is this
Image
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: Printer class question

Postby Silvio.Falconi » Thu Oct 22, 2020 4:41 pm

Now perhaps I understood but the text are not showded

I tried with

Code: Select all  Expand view


function PrnBox()

       local oPrn, oFont, oFont2
              PRINT oPrn PREVIEW

       DEFINE FONT oFont NAME "VERDANA" SIZE 0,-6 OF oPrn BOLD
       DEFINE FONT oFont2 NAME "VERDANA" SIZE 0,-10 OF oPrn BOLD
       PAGE


oPrn:Box(7.50,1,6.6,7.5,  { CLR_BLACK, 1 }, CLR_HGRAY, ;
                    { "TIPO DOCUMENTO", oFont, CLR_WHITE, "TL" }, ;
                      "CM" )

        oPrn:Box(7.50,7.6,6.6,10.5,  { CLR_BLACK, 1 }, CLR_HGRAY, ;
                    { "NUMERO DOCUMENTO", oFont, CLR_WHITE, "TR" }, ;
                      "CM" )

          oPrn:Box(7.50,10.6,6.6,14.5,  { CLR_BLACK, 1 }, CLR_HGRAY, ;
                    { "DATA DOCUMENTO", oFont, CLR_WHITE, "B" }, ;
                      "CM" )


            //FIELD
           @ 3.50,1 PRINT TO oPrn TEXT "DESCRIZIONE DOCUMENTO" SIZE 6, 4 CM FONT oFont2 ;
         COLOR CLR_BLACK  ALIGN "BR"

          @ 3.50,5.8 PRINT TO oPrn TEXT "NUMERO" SIZE 4, 4 CM FONT oFont2 ;
         COLOR CLR_BLACK  ALIGN "BR"

            @ 3.50,9.8 PRINT TO oPrn TEXT "DATA" SIZE 4, 4 CM FONT oFont2 ;
         COLOR CLR_BLACK  ALIGN "BR"


 ENDPAGE
       ENDPRINT

       RELEASE FONT oFont
        RELEASE FONT oFont2
        return nil
 


and this is the result

Image

the coordinates are all bad
and the text smaller of method box are not showed
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: Printer class question

Postby Silvio.Falconi » Thu Oct 22, 2020 5:41 pm

Perhaps we found the solution

now I see all text

Image

Image

Code: Select all  Expand view
 #include"fivewin.ch"


   function PrnBox()

       local oPrn, oFont, oFont2
       local aDat
       local nRow,nCol,nHei,nWid
     
 
        PRINT oPrn PREVIEW

       DEFINE FONT oFont NAME "VERDANA" SIZE 0,-6 OF oPrn BOLD
       DEFINE FONT oFont2 NAME "VERDANA" SIZE 0,-10 OF oPrn BOLD
       PAGE        

           nRow:= 7.50
            nCol:= 1
            nHei:= nRow+0.8
            nWid:= 7.5

         oPrn:Box(nRow,nCol,nHei,nWid,  { CLR_BLACK, 1 }, CLR_HGRAY, ;
                    { "TIPO DOCUMENTO", oFont, CLR_WHITE, "TL" }, ;
                      "CM" )


            nRow:= 7.50
            nCol:= 7.7
            nHei:= nRow+0.8
            nWid:= 11.5

        oPrn:Box(nRow,nCol,nHei,nWid,  { CLR_BLACK, 1 }, CLR_HGRAY, ;
                    { "NUMERO DOCUMENTO", oFont, CLR_WHITE, "TL" }, ;
                      "CM" )

            nRow:= 7.50
            nCol:= 11.7
            nHei:= nRow+0.8
            nWid:= 15.5

            oPrn:Box(nRow,nCol,nHei,nWid,  { CLR_BLACK, 1 }, CLR_HGRAY, ;
                    { "DATA DOCUMENTO", oFont, CLR_WHITE, "TL" }, ;
                      "CM" )
            nRow:= 4.30



            //FIELD
           @ nRow,1 PRINT TO oPrn TEXT "DESCRIZIONE DOCUMENTO" SIZE 6, 4 CM FONT oFont2 ;
         COLOR CLR_BLACK  ALIGN "BR"

          @ nRow,5.8 PRINT TO oPrn TEXT "NUMERO" SIZE 4, 4 CM FONT oFont2 ;
         COLOR CLR_BLACK  ALIGN "BR"

            @ nRow,9.8 PRINT TO oPrn TEXT "DATA" SIZE 4, 4 CM FONT oFont2 ;
         COLOR CLR_BLACK  ALIGN "BR"


ENDPAGE
       ENDPRINT

       RELEASE FONT oFont
        RELEASE FONT oFont2
        return nil




Note ( the values inserted are in cm)

if the boxes start at line 7.50, the writings with the "PRINT TO oPrn" command start at line 4.30
and this is difficult to program, that is, it is not clear why this text must begin 3.20 cm less
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: Printer class question

Postby Otto » Thu Oct 22, 2020 6:34 pm

Hello Silvio,
You can try with EasyReport.
Best regards,
Otto
Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: Printer class question

Postby Silvio.Falconi » Thu Oct 22, 2020 7:24 pm

Otto wrote:Hello Silvio,
You can try with EasyReport.
Best regards,
Otto



As I told ER not run well!!!!!!!!!!!!!!

I can't waste time making prints
Unfortunately you don't live in Italy (even if you are 15 KM from the border)
In Italy there are many special documents to do
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: Printer class question

Postby Silvio.Falconi » Thu Oct 22, 2020 7:30 pm

with the help of Nageswarao I was able to create something equal

this is the original

Image


and this is what I created this afternoon, studying the technique

Image

tomorrow I will think how to create something automatically and print the forms from a print format archive

Nages,
the thickness of the lines is not good, yet I have put 1 as a value, you can have a choice like:
Very fine, fine, Medium, Thick, very thick
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: Printer class question

Postby Silvio.Falconi » Thu Oct 22, 2020 7:37 pm

resolved
{ CLR_BLACK, 0.5 }
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: 7061
Joined: Thu Oct 18, 2012 7:17 pm

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 55 guests