Share My Creation B-POS - Simple point of sale

B-POS is a fairly simple point of sale app that's designed to run on a tablet and enable the sale of merchandise at events. We're a member supported club, and this is an important source of revenue for us. It's intended to be used with a standalone card reader, like a Square or MyPOS device, and can link to a Bluetooth ESC/POS printer to produce receipts.

This is a work in progress (particularly, I've only tested it on the Galaxy Tab A9 that I'll be using for an event later this month; I hope to improve that later). Also, I'll be working on more integrations, including using the postback options to fully integrate it into our PrestaShop online store.

Key features​

  • Grid display of products with images and prices
  • Automatic totalling of current sale
  • Support for applying a discount percentage
  • Support for sales refunds
  • Products can be configured to require a custom data field
  • Logging of sales to internal database
  • Printing of receipts via a Bluetooth printer
  • Printing of sales summaries
  • Support for VAT, including different rates on different products
  • Basic stock control, showing quantities and out of stock items
  • Emailing of sales summaries as CSV files
  • POSTing of transactions as JSON to a remote server
  • Product details can be downloaded from a remote server
  • Business details can be entered manually, or downloaded from a remote server
More information, plus downloadable code and an example of a postback script, on my GitHub: https://github.com/nigelwhitfield/bpos
 

Attachments

  • 01Default.jpg
    01Default.jpg
    192.4 KB · Views: 2,119
  • 02BLUF-Home.jpg
    02BLUF-Home.jpg
    243.4 KB · Views: 492
  • 03BLUF-Sale.jpg
    03BLUF-Sale.jpg
    247 KB · Views: 482
  • 04PrintReceipt.jpg
    04PrintReceipt.jpg
    211.8 KB · Views: 467
  • 05Import.jpg
    05Import.jpg
    141.6 KB · Views: 498

aeric

Expert
Licensed User
Longtime User
Thanks for sharing.
I bought the magazine written by you.
 

aeric

Expert
Licensed User
Longtime User
Great project.
Are you looking for pull requests in github?

I suggest to update the code with B4X new features :
  1. Update to EscPosPrinter class to use of InputListAsync
  2. Comparison of object. Move value to Left side of comparison.
  3. Use Resultset instead of Cursor so it will be supported for B4i if it is going to be a B4
EscPosPrinter:
' Ask the user to connect to a printer and return whether she tried or not
' If True then a subsequent Connected event will indicate success or failure
Public Sub Connect As ResumableSub
    Dim PairedDevices As Map
    PairedDevices = Serial1.GetPairedDevices
    Dim l As List
    l.Initialize
    For i = 0 To PairedDevices.Size - 1
        l.Add(PairedDevices.GetKeyAt(i))
    Next
    Dim Res As Int
    'Res = InputList(l, "Choose a printer", -1) 'show list with paired devices
    InputListAsync(l, "Choose a printer", -1, True)
    Wait For InputList_Result (Res As Int)
    If Res <> DialogResponse.CANCEL Then
        Serial1.Connect(PairedDevices.Get(l.Get(Res))) 'convert the name to mac address
        RemoteMAC = PairedDevices.Get(l.Get(Res))
        Log("Device MAC is " & RemoteMAC)
        Return True
    End If
    Return False
End Sub

B4XMainPage:
If 1 = p.Get("qty") Then ' Line #844
    CLV_Sale.RemoveAt(i)
    Exit
Else
 

nwhitfield

Active Member
Licensed User
Longtime User
Great project.
Are you looking for pull requests in github?

I'm certainly open to that, though for the moment, I just put the project there as a zip, since I'm not sure how many people are actually using GitHub for B4X projects.

I suggest to update the code with B4X new features :
  1. Update to EscPosPrinter class to use of InputListAsync
Noted; that's actually a class from agraham: https://www.b4x.com/android/forum/threads/bluetooth-esc-pos-printer-class.106553 (I think trying to figure out those little printers would have made my head explode).

  1. Comparison of object. Move value to Left side of comparison.
  2. Use Resultset instead of Cursor so it will be supported for B4i if it is going to be a B4
Good points; I am planning to get an iPad later this year, so I'll look at doing that - though I suspect that iPad users will have to do without receipt printing, sadly. (Though, I suppose the JSON postback means you could write a little Android app that listens for it, and does the receipts that way).
 

aeric

Expert
Licensed User
Longtime User
though I suspect that iPad users will have to do without receipt printing, sadly.
No need to be sad. agraham's EscPosPrinter class works in B4i too.

A bit modification is required on the ESC/POS command. i.e adding an empty string in front of the commands.

It works with cheap BLE supported bluetooth thermal printers.

I understand the headache working with the printers especially sending wrong command causing printing garbage.

The difficult part is dealing with image, fonts and barcode/QRCode that the printer is not supported.

Check this thread:
 

asales

Expert
Licensed User
Longtime User
Thanks for sharing.
I bought the magazine written by you.
Me too... and translated to portuguese:
 

nwhitfield

Active Member
Licensed User
Longtime User
Me too... and translated to portuguese:
Wow; I didn't even know it was translated. I'd probably shudder at some of the mistakes and coding practices in there now, but really glad if it helped some people on their way.
 

asales

Expert
Licensed User
Longtime User
Wow; I didn't even know it was translated. I'd probably shudder at some of the mistakes and coding practices in there now, but really glad if it helped some people on their way.
It is great, not only because the explanations, but because insights like this:
" In the world of books, everyone knows that big-names authors like JK Rowling... they're the exception, not the rule. Most of the people who write books actually have to pay their bills by doing other jobs... It's pretty much the same in the world of apps. "
 

nwhitfield

Active Member
Licensed User
Longtime User
I have updated the Github page, fixed some typos to the readme, and also added two simple example postback scripts, one to update stock levels on a PrestaShop store (tested) and one to update them on an Ecwid store (not tested).

So, with these, each time you sell something in person using the B-POS app, the stock level in your online store will be updated as well (or in a batch, if you chose to post transactions that way).
 
Last edited:

nwhitfield

Active Member
Licensed User
Longtime User
I have updated the code on github to v1.01:
  • Added the ability to set stock levels on products. Long press a product image to enter new stock level. If a settings passcode is set, it will be required
  • Ttweaks to sales log report format to improve clarity
  • Changed code to use Resultset instead of Cursor, in case I attempt a B4i version later
  • Discount and stock dialogs are set to numeric input mode
  • Better reporting of postback results, including how many success/failures there were
  • Changed printer module to use async dialog when selecting printer
  • Added status display on settings screen to show number of sales, number unposted, and gross sales total
 

nwhitfield

Active Member
Licensed User
Longtime User
More updates on GitHub
• Version 1.02 fixed issues with the status display and an empty database
• Version 1.03 allows you to configure discount in the settings file, so you don't need to type a percentage every time
• More explanatory notes in the simple postback example
 

nwhitfield

Active Member
Licensed User
Longtime User
I doubt you can any more; it was written back in 2014, and I've certainly not been asked to update it, so even if you could find a copy somewhere, it will be rather out of date - lots of things have changed in both Android and B4A since then.

If there have been updates, I do hope whoever did them got paid for it.
@aeric and @nwhitfield where can i buy this magazine
 

nwhitfield

Active Member
Licensed User
Longtime User
Following a fairly successful weekend flogging things to people at an event in Antwerp, I've made some changes.

So, there's another update on GitHub to version 1.1
  • The reference for the current sale is displayed just above the total price. So, if you use a payment device like MyPOS Go which supports adding a reference, you can see what to type into the device as well as the price.
  • The sales log now saves the order prefix, and the number of SKUs as well as the number of line items, and the discount rate, This makes interpreting the data later easier, and also allows you to change the prefix - you might use a different one for each day of an event, for example - without affecting past orders
  • The postback data now includes the discount rate applied to an order
  • The sales log printout now displays both number of SKUs and number of items and correctly counts items (before, it included discounts as an item)
 
Top