Gift Receipt Printing - advise needed

Post your Gambas programming questions here.
Online
AndyGable
Posts: 363
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Gift Receipt Printing - advise needed

Post by AndyGable »

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


VALUE ORANGE JUICE                            £0.35 A
DVD 12352                                    £19.99 A
------------------------------------------------------
2 Items Sold                                  £11.34
------------------------------------------------------
CASH                                          £15.00
Change                                         £3.66



Ideally I would like it to be like this

VALUE ORANGE JUICE                                  A
DVD 12352                                           A
------------------------------------------------------
2 Items Sold                                  
------------------------------------------------------
        ** 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
User avatar
cogier
Site Admin
Posts: 1127
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Gift Receipt Printing - advise needed

Post by cogier »

Try saving the receipt as a string, then edit it to remove the unwanted and add the extras.
Online
AndyGable
Posts: 363
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: Gift Receipt Printing - advise needed

Post by AndyGable »

The receipt is saved in a txt file.

I can when I'm at the computer post a example file if that helps
User avatar
cogier
Site Admin
Posts: 1127
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Gift Receipt Printing - advise needed

Post by cogier »

Please do. I'm sure that will help us help you.
Online
AndyGable
Posts: 363
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: Gift Receipt Printing - advise needed

Post by AndyGable »

|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
User avatar
BruceSteers
Posts: 1579
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Gift Receipt Printing - advise needed

Post by BruceSteers »

could you use echo in shell

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

Or file open

Dim f As File
f = Open sFilePath For Write
Print #f, "some text~"
f.close
If at first you don't succeed , try doing something differently.
BruceS
Online
AndyGable
Posts: 363
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: Gift Receipt Printing - advise needed

Post by AndyGable »

y
BruceSteers wrote: Monday 19th February 2024 10:36pm
Dim f As File
f = Open sFilePath For Write
Print #f, "some text~"
f.close
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~
User avatar
BruceSteers
Posts: 1579
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Gift Receipt Printing - advise needed

Post by BruceSteers »

Why does the example not match the code. can you post a match
So this (or any other example)
	
VALUE ORANGE JUICE                            £0.35 A
DVD 12352                                    £19.99 A
------------------------------------------------------
2 Items Sold                                  £11.34
------------------------------------------------------
CASH                                          £15.00
Change                                         £3.66


And the printer file text is the same.


I made this
  Dim sFilePath As String = User.Home & "/AATest"

  Dim aWords As String[]
  Dim sLine As String
  Dim aLines As String[] = Split(File.Load(sFilePath), "\n")
  Dim iPos As Integer

  alines.Remove(alines.Count - 2, -1) 

  For c As Integer = 0 To alines.Max
    sLine = aLines[c]
    If Not sLine Then Continue
    aWords = Split(sLine, " ")
    iPos = aWords.Find("£*", gb.Like)
    If iPos > -1 Then
      aWords.Remove(iPos, 1)
      aLines[c] = aWords.Join(" ")
    Endif
  Next
  aLines.Add("** GIFT RECEIPT ISSUED 19/02/2024 **")
  File.Save(sFilePath, aLines.Join("\n"))


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

Cheers
If at first you don't succeed , try doing something differently.
BruceS
Online
AndyGable
Posts: 363
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: Gift Receipt Printing - advise needed

Post by AndyGable »

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?
User avatar
BruceSteers
Posts: 1579
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Gift Receipt Printing - advise needed

Post by BruceSteers »

Well does the above code do (with adjustments)
maybe you can just change it to suit your needs
If at first you don't succeed , try doing something differently.
BruceS
Post Reply