Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Receipt printing
Message
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00171761
Message ID:
00171775
Views:
31
>Hi,
>I am trying to run a receipt printer with the report designer. And since many of you out there may already know the answer, I was hoping someone could tell me how to proceed?
>I want run the report to a file first so I have the ability to reprint. Do I need to use the ascii setting with receipt printers. Or will it work with the formatting the report designer creates. Even though I am using the correct Win 95 driver for my printer (a Star SP300), it doesn't seem to like the report bands.
>I also looked into OLE OPOS. It's an active x to control many devices in the POS realm, including receipt printers. I don't see in the docs how to run a text file with the printing methods of the control. If someone has experience with this control and could offer some advice, I'd be most grateful.
>
>TIA
>Allen

You are right, receipt printers do not like report bands and probably never will. You will greatly reduce you frustration level by using the OPOS control.

I downloaded my free control from the printer manufacturer's web site including documentation. I subclassed the control for use in VFP and it works great. It did take about 8 hours of work for the on-the-job-training and development. My subclass is for an EPSON receipt printer so I do not know of what benefit it may be to you.

Basically what you have to do is feed your printer, via VFP, line-by-line to the control. These lines can be the receipt header, date and invoice number, lineitems with prices, sub-totals, totals and a footer line.

I also do not think I can legally upload the control because I had to fill out an on-line agreement before I could download the control. At the end of this reply is my code is from my subclass.

Another key is installing the OPOS software on your and the end-user computers and setting up what the device is through their software.

If this does not look good on the screen, right-click on it and view the html source code, then cut and paste the code into a text file.
#INCLUDE OPOS.H
#INCLUDE OPOSPTR.H
#INCLUDE EPSON.H
#INCLUDE EPSNPTR.H
#DEFINE RECEIPT_LINE_FEED   CHR(10) + CHR(13)
lParameter tnInvoice
local lnInvoice
if !inlist(vartype(tnInvoice), "N", "I")
   lnInvoice = 0
else
   lnInvoice = tnInvoice
endif
if lnInvoice = 0
   return .f.
endif
if !used("Sales")
   use Sales in 0
endif
select Sales
set order to Invoice
if !used("Items")
   use Items in 0
endif
select Items
set order to Invoice
seek lnInvoice
if eof()
   return .f.
endif
local lnRetVal
with This.oleOPOS
   lnRetVal = .Open("T88II")
   lnRetVal = .Claim(10)
   if .ResultCode = OPOS_SUCCESS
      .DeviceEnabled = .T.
      .AsyncMode = .F.
      local lcPrintLine
      lcPrintLine = "STORE_NAME"
      .PrintNormal(PTR_S_RECEIPT, lcPrintLine + RECEIPT_LINE_FEED)
      This.BlankLines(1)
      lcPrintLine = TTOC(DateTime()) + "   Invoice " ;
                  + alltrim(str(lnInvoice,7,0))
      .PrintNormal(PTR_S_RECEIPT, lcPrintLine + RECEIPT_LINE_FEED)
      This.BlankLines(1)
      do while Items.Invoice = lnInvoice
         if items.quant = 1
            lcPrintLine = substr(Items.descript,1,30) ;
                        + space(4) + str(items.extprice,8,2)
            .PrintNormal(PTR_S_RECEIPT, lcPrintLine ;
                        + RECEIPT_LINE_FEED)
         else
            lcPrintLine = substr(Items.descript,1,30)
            .PrintNormal(PTR_S_RECEIPT, lcPrintLine ;
                        + RECEIPT_LINE_FEED)
            lcPrintLine = str(quant,4,0) + " each @ $" ;
                        + str(price,8,2) + space(13) ;
                        + str(items.extprice,8,2)
            .PrintNormal(PTR_S_RECEIPT, lcPrintLine ;
                        + RECEIPT_LINE_FEED)
         endif
         skip
      enddo
      select Sales
      seek lnInvoice
      if !eof()
         lcPrintLine = replicate(chr(196),42)
         .PrintNormal(PTR_S_RECEIPT, lcPrintLine + RECEIPT_LINE_FEED)
         lcPrintLine = space(20) + "Taxable       " + str(Sales.Taxable,8,2)
         .PrintNormal(PTR_S_RECEIPT, lcPrintLine + RECEIPT_LINE_FEED)
         lcPrintLine = space(20) + "Exempt        " + str(Sales.Exempt,8,2)
         .PrintNormal(PTR_S_RECEIPT, lcPrintLine + RECEIPT_LINE_FEED)
         lcPrintLine = space(20) + "Sales Tax     " + str(Sales.SaleTax,8,2)
         .PrintNormal(PTR_S_RECEIPT, lcPrintLine + RECEIPT_LINE_FEED)
         lcPrintLine = space(20) + replicate(chr(196),22)
         .PrintNormal(PTR_S_RECEIPT, lcPrintLine + RECEIPT_LINE_FEED)
         lcPrintLine = space(20) + "Sales Total   " ;
                     + str(Sales.Taxable+Sales.Exempt+Sales.SaleTax,8,2)
         .PrintNormal(PTR_S_RECEIPT, lcPrintLine + RECEIPT_LINE_FEED)
      endif
      This.BlankLines(6)
      if .CapRecPaperCut
         .CutPaper(90)
      endif
      .Release()
   endif
endwith
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform