Advise on Cleaning up data

Post

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

I was wondering if someone could help with a puzzle I have

I am thinking about adding a "Clean Receipt" option on my software for when Items are voided during the sale

This is what I have at the moment

Code (gambas)

  1. <PIPE>L<PIPE>1CADBURY'S CREAM EGG 40G                          Â£0.60 A~
  2. <PIPE>L<PIPE>1FARM FRESH LSE BRAEBURN CL1 12                   £2.89 Z~
  3. <PIPE>L<PIPE>1** NEXT ITEM HAS BEEN VOIDED **~
  4. <PIPE>L<PIPE>1FARM FRESH LSE BRAEBURN CL1 12                  -£2.89 Z~

What I would need to do is remove the Item(s) that was originally placed on the receipt as well as the Voided one

in the above example I would need to remove

Code (gambas)

  1. <PIPE>L<PIPE>1FARM FRESH LSE BRAEBURN CL1 12                   £2.89 Z~
  2. <PIPE>L<PIPE>1** NEXT ITEM HAS BEEN VOIDED **~
  3. <PIPE>L<PIPE>1FARM FRESH LSE BRAEBURN CL1 12                  -£2.89 Z~

so when the receipt is printed it would show like

Code (gambas)

  1. <PIPE>L<PIPE>1CADBURY'S CREAM EGG 40G                          Â£0.60 A~

How would I do this? I know i would need to loop though the receipt file but I am not sure how I would remove the lines i need

And yes the voided format will always show the |L|1** NEXT ITEM HAS BEEN VOIDED **~ before the item that is voided.

the following is what could be shown

Code (gambas)

  1. ** Price Override **
  2. ** Next Item has been voided **
  3. Qty @ Price (qty sale)
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Guru
cogier is in the usergroup ‘Guru’
Is the list of products in an array? If so, you can just delete the correct item with Array.Remove()
Online now: No Back to the top

Post

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

cogier said

Is the list of products in an array? If so, you can just delete the correct item with Array.Remove()

At the moment the receipt data file is created each time an item is scanned.

The file is called recipit.tmp

The system is using the ~ when it reads the file in for printing as a end of line marker

I'm not sure if this is the best way to make the receipt file as the item is still showing on the main screen as being scanned and the. Voided.

I'm always open to way to improve the system.
Online now: No Back to the top

Post

Posted
Rating:
#4
Avatar
Guru
cogier is in the usergroup ‘Guru’
Can you post the program so we can see how you are doing things.
Online now: No Back to the top

Post

Posted
Rating:
#5
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
 I can not post the whole program as it's closed source but I can post the code that adds data to the receipt file if that helps.
Online now: No Back to the top

Post

Posted
Rating:
#6
Avatar
Guru
cogier is in the usergroup ‘Guru’
..I can post the code that adds data to the receipt file if that helps.

Yes that would help.
Online now: No Back to the top

Post

Posted
Rating:
#7
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
Basically what happens the System would call FormatRecipitEntery_Single with the product name and value etc in it

FormatRecipitEntery_Single("VALUE ORANGE JUICE","£0.35","A")

Code (gambas)

  1. Public Sub FormatRecipitEntery_Single(TextToShow As String, PriceToShow As String, VATCode As String)
  2.     Global.SpaceNeeded = (56 - (String.Len(TextToShow) + String.Len(PriceToShow)))
  3.  
  4.     If Global.VATActive = "Yes" Then
  5.         Global.SpaceNeeded -= 2
  6.         CreateRecipitFile("L", "1", TextToShow & Space(Global.SpaceNeeded) & PriceToShow & " " & VATCode)
  7.     Else
  8.         CreateRecipitFile("L", "1", TextToShow & Space(Global.SpaceNeeded) & PriceToShow)
  9.     End If

then once the spacing etc has been calculated the system then called CreateRecipitFile


Code (gambas)

  1. Public Sub CreateRecipitFile(AligmentType As String, FontType As String, TextToUse As String)
  2.     Dim DataToWrite As String = Null
  3.    
  4.     Select Case AligmentType
  5.         Case "L"
  6.             DataToWrite &= Global.LeftAlignText
  7.        
  8.         Case "C"        
  9.             DataToWrite &= Global.CentreAlignText
  10.        
  11.         Case "R"
  12.             DataToWrite &= Global.RightAlignText
  13.     End Select
  14.    
  15.     Select Case FontType
  16.         Case "1"
  17.             DataToWrite &= Global.NormalFont
  18.        
  19.         Case "2"
  20.             DataToWrite &= Global.DoubleWidthFont
  21.        
  22.         Case "3"
  23.             DataToWrite &= Global.DoubleHeightFont
  24.        
  25.         Case "4"
  26.             DataToWrite &= Global.DoubleWidthHeightFont
  27.  
  28.         Case "B1"
  29.             DataToWrite &= Global.BoldNormalFont
  30.        
  31.         Case "B2"
  32.             DataToWrite &= Global.BoldDoubleWidthFont
  33.        
  34.         Case "B3"
  35.             DataToWrite &= Global.BoldDoubleHeightFont
  36.        
  37.         Case "B4"
  38.             DataToWrite &= Global.BoldDoubleWidthHeightFont
  39.                
  40.         Case "B5"
  41.             DataToWrite &= Global.LargeDoubleWidthHeightFont
  42.  
  43.     End Select
  44.  
  45.     DataToWrite &= TextToUse & "~"
  46.    
  47.     If Exist(Global.RecipitFileName) = True Then
  48.         Global.RecipitFile = Open Global.RecipitFileName For Write Append
  49.             Print #Global.RecipitFile, gb.NewLine;
  50.             Print #Global.RecipitFile, DataToWrite;
  51.         Global.RecipitFile.Close
  52.     Else
  53.         Global.RecipitFile = Open Global.RecipitFileName For Write Create
  54.             Print #Global.RecipitFile, DataToWrite;
  55.         Global.RecipitFile.Close
  56.      End If

The Void is the same sort of process but it would call FormatRecipitEntery_TwoLines

FormatRecipitEntery_Single("**NEXT ITEM IS VOIDED**|VALUE ORANGE JUICE","-£0.35","A")

Code (gambas)

  1. Public Sub FormatRecipitEntery_TwoLines(TextToShow As String, PriceToShow As String, VATCode As String)
  2.     Global.LineMessages = Split(TextToShow, "|")
  3.     Global.SpaceNeeded = (56 - (String.Len(Global.LineMessages[1]) + String.Len(PriceToShow)))
  4.  
  5.     If Global.VATActive = "Yes" Then
  6.         Global.SpaceNeeded -= 2
  7.         CreateRecipitFile("L", "1", Global.LineMessages[0])
  8.         CreateRecipitFile("L", "1", Global.LineMessages[1] & Space(Global.SpaceNeeded) & PriceToShow & " " & VATCode)
  9.     Else
  10.         CreateRecipitFile("L", "1", Global.LineMessages[0])
  11.         CreateRecipitFile("L", "1", Global.LineMessages[1] & Space(Global.SpaceNeeded) & PriceToShow)
  12.     End If


If you have a smarter way of doing this then I am more then happy to update the receipt function to work with the new format
Online now: No Back to the top

Post

Posted
Rating:
#8
Avatar
Guru
cogier is in the usergroup ‘Guru’
Well, that looks quite complicated.

I have looked at till receipts and if there is a credit it is clearly shown and, I think, a record should be kept. Below is a simplified piece of code showing the way I would go about this. Sorry but I have run out of time today to improve it.

Code (gambas)

  1. ' Gambas class file
  2.  
  3. sTempReceiept As New String[]
  4. fTempValue As Float
  5.  
  6. Public Sub Form_Open()
  7.  
  8.   StartNewCustomer
  9.  
  10.  
  11. Public Sub StartNewCustomer()
  12.  
  13.   sTempReceiept.Clear
  14.   fTempValue = 0
  15.  
  16.   NewReceipt("CADBURY'S CREAM EGG 40G", 0.60)
  17.   NewReceipt("FARM FRESH LSE BRAEBURN CL1 12", 2.89)
  18.   NewReceipt("* * NEXT ITEM HAS BEEN VOIDED * *")
  19.   NewReceipt("FARM FRESH LSE BRAEBURN CL1 12", -2.89)
  20.   NewReceipt("EndTransaction")
  21.  
  22.  
  23. Public Sub NewReceipt(sItem As String, Optional iValue As Float)
  24.  
  25.   Dim iLoop As Integer
  26.  
  27.   If sItem = "EndTransaction" Then
  28.     sTempReceiept.Add("Grand Total = " & Format(fTempValue, "$0.00"))
  29.     For iLoop = 0 To sTempReceiept.Max  '' Here you could add the data to your Global.RecipitFileName
  30.       Print sTempReceiept[iLoop]
  31.     Next
  32.   Else
  33.     sTempReceiept.Add(sItem & " " & Format(iValue, "$0.00"))
  34.     fTempValue += iValue
  35.   End If
  36.  
  37.  
  38.  
Online now: No Back to the top

Post

Posted
Rating:
#9
Avatar
Enthusiast
sadams54 is in the usergroup ‘Enthusiast’
 I have written a Point of Sale in gambas that is used all the time. They get very complex especially when doing receipts and figuring out pricing. I am lost as to how you are doing things on this but always happy to talk private about how we can do things.
The way I handled this was since the sale is on the screen in a columnview when it is time to print the receipt I just iterate through the columnview and print. All items in the columnview are stored in a mysql database for easy retrieval including remotely. I am assuming that your sale is on the screen when you want to print. My receipt print is relatively simple this way. I may not be giving code but the concept of how to do it may be more simple allowing you to code it easier. My thought is put the original item on the sale, then the voided item would simply have a negative quantity. You can even include a "notation" item with it. Then printing a receipt would be as simple as just step through the list on screen.

cogier has helped me on a few options with my POS so this is the guy you want to listen to. He solves problems I can't.
Online now: No Back to the top
1 guest and 0 members have just viewed this.