FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Print a coupon
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Print a coupon
Posted: Fri Jun 17, 2022 10:05 AM
I have to print black boxes in the boxes corresponding to the prices of the bets





I save the totals of the bets in an array





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




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 (fw): Select all Collapse
 for nI := 1 to len( aImports )
             nColonna     :=  aImports[ nI ][2]
               nRiga        :=   aImports[ nI ][1]


instead of

Code (fw): Select all Collapse
 for nI := 1 to len( aImports )
             nColonna     :=  aImports[ nI ][1]
               nRiga        :=   aImports[ nI ][2]



But work bad because it print this




How I can resolve it ?

this is the function to print that area
Code (fw): Select all Collapse
 // 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

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: Print a coupon
Posted: Sun Jun 19, 2022 07: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

Continue the discussion