Page 1 of 1

print on dot matrix printer

Posted: Wed Nov 30, 2016 8:33 pm
by kajot
is any class to print on dot matrix printer (oki 3320), as in xHarbour

@prow(),pcol() say 'test'


best regards
kajot

Re: print on dot matrix printer

Posted: Thu Dec 01, 2016 2:45 am
by Armando
Kajot:

Please look at the TPRinter class

Regards

Re: print on dot matrix printer

Posted: Sun Dec 04, 2016 1:51 pm
by kajot
dot matrix printer

Re: print on dot matrix printer

Posted: Sun Dec 04, 2016 5:43 pm
by Armando
Kajot:

Yes, dot matrix printer.

Pls look al the SAY, CmSay or InchSay methods

Here is the syntaxis

Code: Select all

oPrn:SAY(nRow,nCol,cText,oFont,nWidth,nClrText,nBakMode,nPen)

oPrn:CmSay(ídem)

oPrn:InchSay(ídem)
 
In the first one, nRow and nCol are coodinates in grapjical

In the second one, nRow and nCol are coodinates in centimeters

and the third one, nRow and nCol are coordinates in inches

Unfortunately I have not a sample.

Regards

Re: print on dot matrix printer

Posted: Mon Dec 05, 2016 3:05 pm
by dbmanfwh
Kajot,

Please See tdosprn.prg within \fwh\source\classes folder.

Regards

Re: print on dot matrix printer

Posted: Tue Dec 06, 2016 11:27 am
by Marc Venken
This is also a Sample :

This will print the selected invoice from a database.

Code: Select all

function druk_Ketting()

   Local nDruk:=0, nDrukafstand:= 0.5, nDrukstart:= 12.7
   cPagtitel = "GROOT"
   cDagboek = "VER"

   Rec_lock("factinfo")
      factinfo->factuur = oTellers:factnummer
      factinfo->toestand = "Factuur GR="+str(oTellers:factnummer,7)
      factinfo->Docstatus = "A"
   rec_unlock("factinfo")

   Public oPrn
   Public oF12,oF12B,oF12I,oF12U,oFlarge

   PRINTER oPrn NAME "Afdruk" // FROM USER //PREVIEW MODAL
   oPrn:setup()
   oPrn:setsize(2400,3050)

   DEFINE FONT oF12    NAME "ARIAL" SIZE 0, -9 OF oPrn
   DEFINE FONT oF12B   NAME "ARIAL" BOLD SIZE 0, -12 OF oPrn
   DEFINE FONT oF12I   NAME "ARIAL" ITALIC SIZE 0, -12 OF oPrn
   DEFINE FONT oF12U   NAME "ARIAL" UNDERLINE BOLD SIZE 0, -10 OF oPrn
   DEFINE FONT oFLarge NAME "ARIAL" BOLD SIZE 0, -18 OF oPrn

   oPrn:startpage()

   hoofding(oPrn,"KETTING",cPagTitel)  // afdruk hoofding
   nDruk = nDrukstart

   dbselectarea("DETAIL")

   detail->(dbgotop())
   nTotaal := 0
   cDrukbon = ""
   do while !detail->(eof())
      if nDruk >= 23.5
         oPrn:endpage()
         oPrn:startpage()
         hoofding(oPrn,"KETTING",cPagTitel)  // afdruk hoofding
         nDruk = nDrukstart
      endif
      If cDrukbon <> alltrim(detail->drukdoc)
         cDrukbon = alltrim(detail->drukdoc)
         nDruk += +.3
         oPrn:cmsay (nDruk,6.1,"Leveringsbon  " + cDrukbon,oF12)
         if factinfo->(dbseek(cDrukbon))
            If !empty(factinfo->bestelbon)
               oPrn:cmsay (nDruk,11,"Uw order " + alltrim(factinfo->bestelbon),oF12)
            EndIF
            Rec_lock("factinfo")
               factinfo->factuur = oTellers:factnummer
               factinfo->toestand = "Factuur GR="+str(oTellers:factnummer,7)
               factinfo->Docstatus = "A"
            rec_unlock("factinfo")
         endif
         factinfo->(dbseek(cDocnummer))
         nDruk += nDrukafstand+.3
      EndIF
      oPrn:cmsay (nDruk, 3.9 ,detail->refnummer,oF12)
      oPrn:cmsay (nDruk, 6.1 ,detail->benaming,oF12)
      oPrn:cmsay (nDruk,16.8 ,str(detail->aantal,9),oF12,,,,1)
      oPrn:cmsay (nDruk,18.5 ,str(detail->eenh_prijs,9,2),oF12,,,,1)
      oPrn:cmsay (nDruk,19.5 ,if(detail->korting <> 0, "-"+stzero(detail->korting,3,0),""),oF12,,,,1)
      oPrn:cmsay (nDruk,21.6 ,str(detail->totaal,9,2),oF12,,,,1)
      oPrn:cmsay (nDruk,22.6 ,"21",oF12,,,,1)
      nTotaal = nTotaal + detail->totaal

      nDruk += nDrukafstand
      detail->(dbskip())
   enddo
   if !empty(factinfo->voldaan)
      oPrn:cmsay (24 , 3 ,"Betaalwijze : "+factinfo->voldaan,oF12)
   endif

   //oPrn:cmsay (25   , 3 ,"-2 % korting op de goederenprijs bij betaling",oF12)
   //oPrn:cmsay (25.5 , 3 ,"     voor "+dtoc(date()+10)+"  - €"+str( (nTotaal*2/100),6,2),oF12)

   oPrn:cmsay (27.6 , 17.8 ,str(nTotaal,11,2),oF12b,,,,1)
   oPrn:cmsay (27.6 , 18.4 ,"21",oF12b)
   If upper(klant->btwjn) == "N"
      nNoBtw:= 0
      oPrn:cmsay (27.6 , 20.6 ,str(nNoBtw,11,2),oF12b,,,,1)
      oPrn:cmsay (27.6 , 22.6 ,str(nTotaal,11,2),oF12b,,,,1)
   else
      oPrn:cmsay (27.6 , 20.6 ,str(Btw(21,nTotaal),11,2),oF12b,,,,1)
      oPrn:cmsay (27.6 , 22.6 ,str(BtwIncl(21,nTotaal),11,2),oF12b,,,,1)
      cSom = alltrim(str(BtwIncl(21,nTotaal)))
      nPos = at(".",cSom)
      nSomEuro = val(substr(cSom,1,nPos-1))
      nSomCent = val(substr(cSom,nPos+1))
      cEuro = Numconv(nSomEuro)+ " EURO EN " + Numconv(nSomCent)+" CENT"
      oPrn:cmsay (28.8 , 3,"Waar en echt verklaard voor de som van",oF12)
      oPrn:cmsay (29.3 , 3,cEuro,oF12)
   EndIF

   oPrn:cmsay (28.7 , 19.3 ,dtoc(vervaldat()),oFLarge)

   oPrn:endpage()

   //oPrn:Preview()

   oF12:end();oF12B:end();oF12I:end();oF12U:end();oFlarge:end();oPrn:end()

return

 
Part of function hoofding (To print new page headers.

Code: Select all

    case cDoctype == "KETTING"

         oPrn:cmsay (6.2 ,13,klant->naam_1,oF12B)
         oPrn:cmsay (6.7 ,13,klant->naam_2,oF12B)
         oPrn:cmsay (7.2 ,13,klant->straat,oF12B)
         oPrn:cmsay (7.7 ,13,str(klant->postcode,4)+"  "+klant->gemeente,oF12B)

         oPrn:cmsay (6.2 , 3,cLev_naam,oF12B)
         oPrn:cmsay (6.7 , 3,cLev_straat,oF12B)
         oPrn:cmsay (7.2 , 3,cLev_Plaats,oF12B)

         DO case
            CASE cPagTitel = "GROOT"
               oPrn:cmsay (9.3  ,4 ,"FACTUUR",oFlarge)
            CASE cPagTitel = "KNOTA"
               oPrn:cmsay (9.3  ,4 ,"KREDIETNOTA",oFlarge)
         Endcase

         oPrn:cmsay (11  , 3.5  ,klant->klant_nr,oF12b)
         oPrn:cmsay (11  , 7.5  ,klant->btw_nr,oF12b)
         oPrn:cmsay (11  ,13    ,str(oTellers:factnummer,6),oF12b)
         oPrn:cmsay (11  ,18.5  ,dtoc(factinfo->datum),oF12b)

 
Marc