Gift Receipt Printing - advise needed

Post

Posted
Rating:
#1 (In Topic #1189)
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
Hi Everyone,

I have a slight problem that I am working on at the moment and i would like some input as to how to handle this

I am trying to print a Receipt for a customer that does not have any prices on it (as a Gift Receipt) below is the example recipit file that is created by my software Ready to print


Code (gambas)

  1. VALUE ORANGE JUICE                            £0.35 A
  2. DVD 12352                                    £19.99 A
  3. ------------------------------------------------------
  4. 2 Items Sold                                  £11.34
  5. ------------------------------------------------------
  6. CASH                                          £15.00
  7. Change                                         £3.66


Ideally I would like it to be like this

Code (gambas)

  1. VALUE ORANGE JUICE                                  A
  2. DVD 12352                                           A
  3. ------------------------------------------------------
  4. 2 Items Sold                                  
  5. ------------------------------------------------------
  6.         ** GIFT RECEIPT ISSUED 19/02/2024 **

Any ideas as how I can do this as the option of a Gift Receipt is At the end when the sale has completed and the Receipt file is already created

Any input is most welcomed. (as you guys have some great ideas and have moved my project along super quickly)

Andy
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Guru
cogier is in the usergroup ‘Guru’
Try saving the receipt as a string, then edit it to remove the unwanted and add the extras.
Online now: No Back to the top

Post

Posted
Rating:
#3
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
 The receipt is saved in a txt file.

I can when I'm at the computer post a example file if that helps
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Guru
cogier is in the usergroup ‘Guru’
 Please do. I'm  sure that will help us help you.
Online now: No Back to the top

Post

Posted
Rating:
#5
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
 |Logo7
|C|2Where Quality Meets Value~
|C|1OPEN MONDAY TO THURSDAY 8AM to 8PM~
|C|1FRIDAY & SATURDAY 8AM to 9PM~
|C|1SUNDAYS 10AM to 4PM~
|L|1컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴~
|L|1CADBURY'S CREAM EGG 40G                          짙0.60 A~
|L|1FARM FRESH LSE BRAEBURN CL1 12                   짙2.89 Z~
|L|1LOOSE PINK LADY APPLES CL1 1KG                   짙3.69 Z~
|L|1컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴~
|L|33 Items Sold                             Total Due 짙7.18~
|L|1컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴~
|L|B1CASH                                              짙10.00~
|L|B1CHANGE DUE                                         짙2.82~
|L|1컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴~
|L|1~
|C|2Thank-you for shopping with~
|C|2us today. we hope to see~
|C|2you again very soon.~
|L|1~|L|3 袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴?
|L|3?1   |4  Last Date for Returns|3     ?
|L|3?1   Your last date that this recipit can be used for   |3?
|L|3?1            refunds or exchanges will be              |3?
|L|3?1|2        27/03/2024         |3?
|L|3훤袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴暠~
~
|C|B1You was served today by ~|C|B2Andrew~
|L|1컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴~
|C|B1Tuesday 13 February 2024~
|C|B122:13  001691  1105  001  0000~

the ~ is used buy the printer module to show the end of the line
Online now: No Back to the top

Post

Posted
Rating:
#6
Guru
BruceSteers is in the usergroup ‘Guru’
could you use echo in shell

Shell "echo 'some text' >> " & sFilePath

Or file open

Code (gambas)

  1.  
  2. f = Open sFilePath For Write
  3. Print #f, "some text~"
  4.  
Online now: No Back to the top

Post

Posted
Rating:
#7
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
y

BruceSteers said

Code (gambas)

  1. f = Open sFilePath For Write
  2. Print #f, "some text~"
  3.  

I do this to print so yes I can open the file no problem i was just stuck on how i would remove the Values and remove everything after the |L|33 Items Sold Total Due 짙7.18~ line (I would need to remove the 짙7.18 value so it would look like |L|33 Items ~)

This is how I would like it to look when the values are removed

|Logo7
|C|2Where Quality Meets Value~
|C|1OPEN MONDAY TO THURSDAY 8AM to 8PM~
|C|1FRIDAY & SATURDAY 8AM to 9PM~
|C|1SUNDAYS 10AM to 4PM~
|L|1컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴~
|L|1CADBURY'S CREAM EGG 40G       A~
|L|1FARM FRESH LSE BRAEBURN CL1 12       Z~
|L|1LOOSE PINK LADY APPLES CL1 1KG       Z~
|L|1컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴~
|L|33 Items Sold
|L|1컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴~
|C|2 ** GIFT RECEIPT **
|L|1~|L|3 袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴?
|L|3?1 |4 Last Date for Returns|3 ?
|L|3?1 Your last date that this recipit can be used for |3?
|L|3?1 refunds or exchanges will be |3?
|L|3?1|2 27/03/2024 |3?
|L|3훤袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴袴暠~

Ignore the strange chrs when it is printed on the Epson Thermal printer they print correctly (I think is is the ASCII version of the control chrs for the printer)
~
|C|B1You was served today by ~|C|B2Andrew~
|L|1컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴~
|C|B1Tuesday 13 February 2024~
|C|B122:13 001691 1105 001 0000~
Online now: No Back to the top

Post

Posted
Rating:
#8
Guru
BruceSteers is in the usergroup ‘Guru’
Why does the example not match the code. can you post a match
So this (or any other example)

Code (gambas)

  1.        
  2. VALUE ORANGE JUICE                            £0.35 A
  3. DVD 12352                                    £19.99 A
  4. ------------------------------------------------------
  5. 2 Items Sold                                  £11.34
  6. ------------------------------------------------------
  7. CASH                                          £15.00
  8. Change                                         £3.66
  9.  

And the printer file text is the same.


I made this

Code (gambas)

  1.   Dim sFilePath As String = User.Home & "/AATest"
  2.  
  3.   Dim aWords As String[]
  4.   Dim sLine As String
  5.   Dim aLines As String[] = Split(File.Load(sFilePath), "\n")
  6.   Dim iPos As Integer
  7.  
  8.   alines.Remove(alines.Count - 2, -1)
  9.  
  10.   For c As Integer = 0 To alines.Max
  11.     sLine = aLines[c]
  12.     If Not sLine Then Continue
  13.     aWords = Split(sLine, " ")
  14.     iPos = aWords.Find("£*", gb.Like)
  15.     If iPos > -1 Then
  16.       aWords.Remove(iPos, 1)
  17.       aLines[c] = aWords.Join(" ")
  18.     Endif
  19.   Next
  20.   aLines.Add("** GIFT RECEIPT ISSUED 19/02/2024 **")
  21.   File.Save(sFilePath, aLines.Join("\n"))
  22.  

then realized the £ was not even in the printer text :-\
I need to correlate/translate

Cheers
Online now: No Back to the top

Post

Posted
Rating:
#9
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
 Sorry the £ is not shown as the file is the actual file that is sent to the printer so it would show up as a chr(156)

I can generate another file tomorrow if that helps.

I have 2 files one file holds everything upto the tender payment and the other file holds the full recipit format would you like me to post both?
Online now: No Back to the top

Post

Posted
Rating:
#10
Guru
BruceSteers is in the usergroup ‘Guru’
 Well does the above code do (with adjustments)
maybe you can just change it to suit your needs
Online now: No Back to the top

Post

Posted
Rating:
#11
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’

BruceSteers said

Well does the above code do (with adjustments)
maybe you can just change it to suit your needs

Thanks I shall have a experiment and see what I get
Online now: No Back to the top
1 guest and 0 members have just viewed this.