Print a coupon

Print a coupon

Postby Silvio.Falconi » Fri Jun 17, 2022 10:05 am

I have to print black boxes in the boxes corresponding to the prices of the bets

Image



I save the totals of the bets in an array


Image


when I go to print I have to break down each total and I have to have the corresponding columns and rows

through a function that I also use in the program I proceed with the decomposition and save positions on array


Image

however I realized that in print I have everything in reverse and therefore the second column of the array is actually the row in the print


so i thought about converting the print command


Code: Select all  Expand view  RUN
for nI := 1 to len( aImports )
             nColonna     :=  aImports[ nI ][2]
               nRiga        :=   aImports[ nI ][1]


instead of

Code: Select all  Expand view  RUN
for nI := 1 to len( aImports )
             nColonna     :=  aImports[ nI ][1]
               nRiga        :=   aImports[ nI ][2]



But work bad because it print this

Image


How I can resolve it ?

this is the function to print that area
Code: Select all  Expand view  RUN


 // Imports
    #define _MARGIN_TOP_IMPORTS        10.83
    #define _MARGIN_LEFT_IMPORTS       2.25
    #define _SQUARE_RAD_IMPORTS        0.9
    #define _SQUARE_LEFT_IMPORTS       10.2
    #define _SQUARE_SIZE_IMPORTS       0.44
    #define _SQUARE_DIST_IMPORTS       0.13
    #define _XSPACE_IMPORTS            0.57
    #define _YSPACE_IMPORTS            0.7

Function Print_Imports( oPrn, oPen, aImports, oBrush )
    LOCAL n, o
    LOCAL nI
    LOCAL nTop, nLeft, nBottom, nRight, aRect
    LOCAL nVar := 1
    LOCAL nRow, nCol
    LOCAL nRadH := _SQUARE_RAD_IMPORTS * ( 10 * oPrn:nHorzRes() / oPRn:nHorzSize() ) / 10 // radius for round boxes in printer resolution horizontal
    LOCAL nRadV := _SQUARE_RAD_IMPORTS * ( 10 * oPrn:nVertRes()  / oPrn:nVertSize() )  / 10 // radius for round boxes in printer resolution vertical
    local ncolonna, nRiga

 //print Imports  Errors
         for nI := 1 to len( aImports )
             nColonna     :=  aImports[ nI ][2]
             nRiga        :=   aImports[ nI ][1]

             nRow := int( nRiga / 8 )
             nCol := ( nColonna % 13 )
             if nCol == 0
                nCol := 13
             else
                ++nRow
             endif

             nTop    := _MARGIN_TOP_IMPORTS  + .1 + ( --nRow  * _YSPACE )    // + .1 to make square smaller than circle
             nLeft   := _MARGIN_LEFT_IMPORTS + .1 + ( --nCol  * _XSPACE )     // + .1 to make square smaller than circle
             nBottom := nTop    - .2 + _SQUARE_SIZE_IMPORTS                 // - .2 to make square smaller than circle
             nRight  := nLeft   - .2 + _SQUARE_SIZE_IMPORTS               // - .2 to make square smaller than circle

             oPrn:Cmtr2Pix( @nTop,    @nLeft  )
             oPrn:Cmtr2Pix( @nBottom, @nRight )

             aRect := { nTop,  nLeft , nBottom , nRight }
             oPrn:FillRect( aRect, oBrush )
          next


     return nil



in the demo calibration of the receipt the correct printing coordinates as you can see in this example

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: 7075
Joined: Thu Oct 18, 2012 7:17 pm

Re: Print a coupon

Postby Antonio Linares » Sun Jun 19, 2022 7:41 am

Dear Silvio,

As you are checking for yourself, the best way to understand a problem is to explain it (to yourself) :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 44 guests