Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

POS issue resolved BUT

Status
Not open for further replies.

tondi

Technical User
Nov 29, 2001
115
US
I have been going round and round with this POS issue and appreciate the input I've received here on Tek-Tips. I wanted to share the code that finally works without need for MSCOMM32 or other 3rd party program. I do have a question however... Can anyone explain why the line remarked 'did not work' did not work and the two lines after the remark did work?
Tony


*************************************************************
*** NOTE: (sysinfo.cashstring) is CHR(7) found in sysinfo setup table

nFoundPrinter = 0
nRows = APRINTERS(aPrintArray)
FOR i = 1 TO nRows
aa = AT("DRAWER",UPPER(aPrintArray(i,1)))
IF aa <> 0
nFoundPrinter = i
ENDIF
NEXT
IF nFoundPrinter = 0
* No Drawer - See if it's a pass thru from the RECEIPT printer
nFoundPrinter = 0
nRows = APRINTERS(aPrintArray)
FOR i = 1 TO nRows
aa = AT("RECEIPT",UPPER(aPrintArray(i,1)))
IF aa <> 0
nFoundPrinter = i
ENDIF
NEXT
IF nFoundPrinter = 0
* No DRAWER or RECEIPT
* Nothing
ELSE
SET PRINTER TO NAME (aPrintArray(nFoundPrinter,1))
SET DEVICE TO PRINTER
*** ??? ALLTRIM(sysinfo.cashstring) && DID NOT WORK
cTemp = ALLTRIM(sysinfo.cashstring)
??? &cTemp
SET DEVICE TO SCREEN
SET PRINTER TO DEFAULT
SET PRINTER TO
SET PRINTER TO
SET DEVICE TO SCREEN
ENDIF

ELSE
SET PRINTER TO NAME (aPrintArray(nFoundPrinter,1))
SET DEVICE TO PRINTER
*** ??? ALLTRIM(sysinfo.cashstring) && DID NOT WORK
cTemp = ALLTRIM(sysinfo.cashstring)
??? &cTemp
SET DEVICE TO SCREEN
SET PRINTER TO DEFAULT
SET PRINTER TO
SET PRINTER TO
SET DEVICE TO SCREEN
ENDIF


************************************************************
 
I assume

??? sysinfo.cashstring

does not work, because it's a differnece if you send "CHR(7)", which is the text chr(7) consisting of 6 characters c h r ( 7 ) or if you send chr(7), which is one character ascii code 7.

if sysinfo.cashstring would really be chr(7) instead of "chr(7)" it would also work with the line:

??? sysinfo.cashstring

Bye, Olaf.
 
Olaf,
We originally tried ??? SYSINFO.CASHSTRING
as you suggest but the printer was sent
40 characters which is the length of the
field We then added the ALLTRIM which
sent only the 6 characters as you said.
Neither command sent the single BEL character.
Thanks for your response,
Tony
 
Hi Tony,

I said that you have to modify the value of the field cashstring, before you can do without a variable, on which you work with makrosubstitution (&):

* this would be needed only once:
replace next 1 cashstring with CHR(7) in "sysinfo"
* THEN you could do this:
??? alltrim(sysinfo.cashstring)

If you omti the alltrim, you always send the whole filed, if that is c(40) of course you send 40 charcters. alltrim cuts off all leading and trailing spaces.

Bye, Olaf.
 
I think this could make it clear:

I use chr(65), which is "A", as that is a printable character, so it's easier to see the difference. But in principle it's the same with chr(7):

In the command window do:
Code:
? "? chr(65):", chr(65)
? "? 'chr(65)':", 'chr(65)'
local lcText
lcText = "chr(65)"
? "? lcText:", lcText
? "? "+"&"+"lcText:", &lcText

create cursor curTest (cashstring c(40))
insert into curTest values (chr(65))

? "field c(40):", curTest.cashstring, len(curTest.cashstring)
? "trimmed field c(40):",alltrim(curTest.cashstring), len(alltrim(curTest.cashstring))

create cursor curTest (cashstring c(1))
insert into curTest values (chr(65))

? "field c(1):", curTest.cashstring, len(curTest.cashstring)
? "trimmed field c(1):", alltrim(curTest.cashstring),len(alltrim(curTest.cashstring))

So the line
Code:
??? system.cashstring
could of course only work and just print one character chr(7), if it was a c(1) field AND it's value was chr(7).

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top