Help or advise on this issues

Post

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

I am getting on very well with my EPoS application but I am not sure how to do the following thing….

 at the moment I am saving every item individually to a temp file so the file would look like this

Code

1,I,50201600,2,0.35,0.70

if I void one I would have to do the following

Code

1,IV,50201600,1,0.35,0.35

Is there a better way to store the information as the receipt would currently look like this

CREAME EGG
 2 @ £0.35                    £0.70
**Item Voided **
CREAM EGG                 -£0.35

Ideally I would like it just to show

CREAME EGG                £0.35

In the Windows Version I am using a listarray and below is the code I am using (.net)

Code

Imports algPoSMultisavers (this is my custom write mutlisaver module that I need to some how convert to Gambas)

Public Class ReceiptData

    Inherits List(Of LineItem)

    Private _transactionId As Integer = 0

    Public Sub New()
    End Sub

    Public Shadows ReadOnly Property Count() As Integer
        Get
            Return (MyBase.Count)
        End Get
    End Property

    Default Public Shadows Property Item(ByVal anIndex As Integer) As LineItem
        Get
            Return (MyBase.Item(anIndex))
        End Get

        Set(ByVal value As LineItem)
            MyBase.Item(anIndex) = value
        End Set
    End Property

    Public Shadows Function Add(ByVal anItem As LineItem) As Integer
        _transactionId += 1

        anItem.TransactionIDNumber = _transactionId

        MyBase.Add(anItem)

        MultisaversComponent.OnProductAdded(anItem.TransactionIDNumber, New MultisaverProduct(anItem.ItemBarcodeNumber, anItem.Line1, SaleLocation_Main, anItem.LinePrice), anItem.QtySold, Now(), CBool(PriceOverrideValue > 0))

        Return (_transactionId)
    End Function

    Public Shadows Sub Remove(ByVal anItem As LineItem)
        Debug.Print("Item removed from receipt by reference.")
        MyBase.Remove(anItem)
    End Sub

    Public Shadows Sub RemoveAt(ByVal anIndex As Integer)
        Debug.Print("Item removed from receipt by index.")
        MyBase.RemoveAt(anIndex)
    End Sub

    Public Shadows Sub Clear()
        MyBase.Clear()
        MultisaversComponent.Reset()
        UpdateMSData()
        _transactionId = 0
    End Sub
End Class


and when I sell a item I add it like this

Code

RecData.Add(New LineItem(ItemType, RecData.Count, ItembarcodeNumber, Line1, Line2, Line3, Line4, LineTotal, LinePrice, VATCode, LocalLineNumber, LocalQtySold, "", 0, "", 0, 0, SaleLocationNumber))

and to remove it from the list I do this RecData.RemoveAt(LocationNumber)

I also use this to create the recipit that the system prints.

any advise is most welcome as I am not sure what aproach to take with this.
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’
I would make a class to manage an array of transactions and then process/send the finished list when ready

I've added a basic example.

It has a Transaction.class that used statically can add/void items with I or IV , i made it to use your string but you could use natural datatypes or anything else you want.

It has a simple test form.

Used like this…

Code (gambas)

  1.  
  2. ' Add 2 identical items
  3.   Transaction("I,50201600,1,0.35")
  4.   Transaction("I,50201600,1,0.35")
  5.  
  6. ' void 1 of them
  7.   Transaction("IV,50201600,1,0.35")
  8.  
  9.  


the List items button iterates through the pending transactions like this..

Code (gambas)

  1.   For Each trans As Transaction In Transaction.All
  2.     Print trans.ID, trans.Quantity, trans.Cost, trans.Total
  3.   Next
  4.  

You could modify that to send your strings to the device without any voids when ready.
All items will be your "I" type not "IV"
there is a GetText function for a Transaction will produce your string without the "I," something like this…

Code (gambas)

  1.   For Each trans As Transaction In Transaction.All
  2.     Print "I," & trans.GetText()
  3.   Next
  4.  

will print "I,50201600,1,0.35"

any multiple items will be listed as one ID with the relevant quantity

I really have no clue as to exactly how you need to do this but maybe this code will help?

Bruce

Attachment
Online now: No Back to the top
1 guest and 0 members have just viewed this.