Tcalex printing

Tcalex printing

Postby Silvio.Falconi » Mon Apr 10, 2017 11:51 am

Someone try to print tcalex ( week appoinmets)

I 'm trying to create this :

I add two method on CLASS TWeekView


METHOD PrintWeek()
METHOD PrintHourHorzLines(oPrn,nTop)


I have problems when I try to print Week day names with numbers
and I not found a solution to print the appoinmets ( Ithinked to print colored boxes )


Some can help me ?



Code: Select all  Expand view


METHOD PrintWeek()  CLASS TWeekView
   local oPrn, oFont,oFontDay
   local nRowStep, nColStep
   local nRow := 0, nCol := 0, n, m
   local nGridHeight
   local nGridWidth
   local aDataArea := Array( 4 )
   Local oPen
   Local dFirstDateWeek := oApp():oCalex:GetFirstDateWeek()
   Local dEndDateWeek   :=  dFirstDateWeek + 6
   local aArea := Array( 4 )


   DEFINE PEN oPen WIDTH  2
   DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 0, -90 OF oPrn
   DEFINE FONT oFontDay NAME "Ms Sans Serif" SIZE 0, -12 OF oPrn


   PRINT oPrn NAME "Print week" PREVIEW

   if Empty( oPrn:hDC )
         return nil          // Printer was not installed or ready
      endif



      nGridHeight    := oPrn:nVertRes() / 20
      nGridWidth     := oPrn:nHorzRes() / 15

      nRowStep = oPrn:nVertRes() / 20
      nColStep = oPrn:nHorzRes() / 15

      nGridHeight = nGridHeight*nColStep  / 25.4
      nGridWidth  = nGridWidth*nRowStep   / 25.4

      nHeightHeader := 120

      nModCol = nGridWidth % ::nDays


      PAGE




   aDataArea[ 1 ] := ::nTopMargin - ::nVirtualTop
   aDataArea[ 2 ] := ::nLeftMargin + ::nLeftLabelWidth +800
   aDataArea[ 3 ] := nGridHeight + ::nTopMargin - ::nVirtualTop
   aDataArea[ 4 ] := nGridWidth + ( ::nLeftMargin + ::nLeftLabelWidth )


   // Print Box around
   oPrn:Box(aDataArea[ 1 ], aDataArea[ 2 ], aDataArea[ 3], aDataArea[ 4 ], oPen  )

      nCol2Step = ( Int( nGridWidth / ::nDays ))



   //  lines

      for n = 1 to 6

     oPrn:Line( ::nTopMargin - ::nDNameHeight,;
                ::nLeftMargin + ::nLeftLabelWidth + ( n * nCol2Step ),;
                (nGridHeight) + ::nTopMargin,;
                ::nLeftMargin + ::nLeftLabelWidth + ( n * nCol2Step ) )
  next



    oPrn:Box( ::nTopMargin - ::nDNameHeight,;
               aDataArea[ 2 ], ;
               ::nTopMargin+nHeightHeader, ;
               aDataArea[ 4 ], ;
               oPen)





   for n = 1 to 6
     oPrn:Line(::nTopMargin - ::nDNameHeight,;
              ::nLeftMargin + ::nLeftLabelWidth + ( n * nCol2Step ),;
              ::nTopMargin+nHeightHeader,;
              ::nLeftMargin + ::nLeftLabelWidth + ( n * nCol2Step ) )



  next



     //Print Header

     for n = dFirstDateWeek to dEndDateWeek


         aArea[ 1 ] = ::nTopMargin - ::nDNameHeight
         aArea[ 2 ] = ::nLeftMargin + ::nLeftLabelWidth + ( n * nCol2Step )



        dTemp = dFirstDateWeek + n
        cText = oemtoansi(CDoW( dFirstDateWeek + n ))
        cDay = Str( Day( dFirstDateWeek + n ), 2 )


      //Display character day week


        oPrn:Say( aArea[ 1 ], aArea[ 2 ]+500, cText,  oFontDay )


      //Display numeric day

       oPrn:Say( aArea[ 1 ], aArea[ 2 ]+500, cDay,  oFontDay )


         next n




        // Print the Hour first

           ::PrintHourHorzLines(oPrn,550)


        // Print appointments




       ENDPAGE
     ENDPRINT

   RETURN nil


//--------------------------------------------------------------------------------------//

 METHOD PrintHourHorzLines(oPrn,nTop) CLASS TWeekView
   local nGridWidth,nGridHeight
   local n, nColStep, nRowStep
   local nBottom
   local aLabelArea
   local cTime := ""
   local nTime
   local oFontTime



      nGridWidth     := oPrn:nHorzRes() / 15
      nGridHeight    := oPrn:nVertRes() / 20

      nRowStep = oPrn:nVertRes() / 20
      nColStep = oPrn:nHorzRes() / 15

      nGridHeight = nGridHeight*nColStep  / 25.4
      nGridWidth  = nGridWidth*nRowStep   / 25.4



     DEFINE FONT oFontTime NAME "Ms Sans Serif" SIZE 0, -12 OF oPrn



     nRowStep   = 200

   nTime      = ::nStartHour * 100

   for n = 1 to ::nRowCount

     nTop  = ::nTopMargin + ( n * nRowStep ) - ::nVirtualTop


      //Only paint the visibles rows
      if nTop > 0 .and. nTop < nGridHeight + nRowStep

         if nTime % 100 == 0

            oPrn:Line(nTop - nRowStep,;
                    ::nLeftMargin,;
                    nTop - nRowStep,;
                    nGridWidth + ::nLeftMargin + ::nLeftLabelWidth,;
                    )

         //Show Left label

            aLabelArea = { ::nTopMargin + ( ( n - 1 ) * nRowStep ) - ::nVirtualTop, ;
                           ::nLeftMargin, ::nTopMargin + ( n  * nRowStep ) - ::nVirtualTop, ;
                           ::nLeftLabelWidth - 2 }



            cTime = ::oCalex:ConvertTime(  nTime, ::oCalex:lAmPm )
            oPrn:Say( aLabelArea[ 1 ], aLabelArea[ 2 ]+210, cTime, oFontTime )




              elseif nTime %  100 == 30

               oPrn:Line(nTop - nRowStep,;
                    ::nLeftMargin + ::nLeftLabelWidth + 1,;
                    nTop - nRowStep,;
                    nGridWidth + ::nLeftMargin + ::nLeftLabelWidth,;
                     )

             oPrn:Line( nTop - nRowStep,;
                    ::nLeftMargin + ::nLeftLabelWidth / 2,;
                    nTop - nRowStep,;
                    ::nLeftMargin + ::nLeftLabelWidth - 4,;
                     )

            aLabelArea = { ::nTopMargin + ( ( n - 1 ) * nRowStep ) - ::nVirtualTop, ;
                           ::nLeftMargin, ::nTopMargin + ( n  * nRowStep ) - ::nVirtualTop, ;
                           ::nLeftLabelWidth - 2 }

                cTime = LEFT( ::oCalex:ConvertTime( nTime ), 5 )
                     oPrn:Say( aLabelArea[ 1 ], aLabelArea[ 2 ]+210, cTime, oFontTime )



         else
            oPrn:Line(nTop - nRowStep,;
                    ::nLeftMargin + ::nLeftLabelWidth + 1,;
                    nTop - nRowStep,;
                    nGridWidth + ::nLeftMargin + ::nLeftLabelWidth,;
                     )

            oPrn:Line( nTop - nRowStep,;
                    ::nLeftMargin + ::nLeftLabelWidth / 2,;
                    nTop - nRowStep,;
                    ::nLeftMargin + ::nLeftLabelWidth - 4,;
                     )
         endif

         if n = ::nRowCount
           oPrn:Line( nTop,;
                   ::nLeftMargin,;
                   nTop,;
                   nGridWidth + ::nLeftMargin + ::nLeftLabelWidth,;
                    )
         endif
      endif

      nTime := ::NextInterval( nTime )

   next

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

Re: Tcalex printing

Postby Silvio.Falconi » Wed Apr 12, 2017 4:36 pm

any solution please ?
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: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: Tcalex printing

Postby MGA » Thu Apr 13, 2017 10:46 am

"I have problems when I try to print Week day names with numbers"
Silvio, what's your problem?
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1252
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: Tcalex printing

Postby Silvio.Falconi » Thu Apr 13, 2017 1:20 pm

do you add the methods I create ?

then make on the buildpopup menu

MENUITEM "Print week... " ACTION oApp():oCalex:oWeekView:PrintWeek()

you 'll see the ptint of the week

it print the Hour but it not print the name of the days ( with numbers)
then It must print the appoinments but I not Know How make it


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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 47 guests