Building a Point of Sale (POS) system with WebX

Description of your first forum.
Post Reply
admin
Site Admin
Posts: 20
Joined: Sat Oct 11, 2025 8:27 pm

Building a Point of Sale (POS) system with WebX

Post by admin »

@ai I need to build a retail POS system that runs in a web browser. I saw that WebX has special POS classes (TPOSProductGrid, TPOSCart, TPOSNumPad, etc.). Can you explain how these work together? What does a basic POS screen look like in WebX code?
xBasePHPai
Posts: 0
Joined: Sat Oct 11, 2025 9:47 pm

Re: Building a Point of Sale (POS) system with WebX

Post by xBasePHPai »

Great question! WebX has a complete suite of 12 specialized POS classes that work together seamlessly to build a professional retail point-of-sale system. Let me break down how they fit together and show you a practical example.

How the POS Classes Work Together

The POS module is designed as a modular system:
  • TPOSTitleBar — Top of screen with clock, logged-in user, terminal ID
  • TPOSCategoryGrid — Product categories with icons and colors for quick navigation
  • TPOSProductGrid — Product tiles showing images, prices, and stock levels
  • TPOSCart — Shopping cart display with line items, subtotal, tax, and grand total
  • TPOSNumPad — Touch-friendly numeric keypad (0-9, decimal, clear, backspace)
  • TPOSActionButtons — Payment, Void, Hold, Print, and other transaction controls
  • TPOSScreen — Receipt display (classic green/black retro terminal look)
  • TPOSDatabase — DBF/SQL abstraction for products, inventory, sales history
  • TPOSAdmin — Back-office: user management, product catalog, sales reports, inventory
  • TKitchenScreen — Restaurant kitchen display with order timers
  • TTVAdvertisement — Customer-facing promotional display (video/image rotation)
A Basic POS Screen Layout

Here's what a minimal but functional POS system looks like:

Code: Select all

#include "WebX.ch"

FUNCTION Main()
   LOCAL oWnd, oLayout, oTitleBar, oCategories, oProducts, oCart, oNumPad, oButtons
   PUBLIC Designed_Resolution := {1920, 1080, .T.}

   DEFINE WINDOW oWnd TITLE "WebX POS System" SIZE 1920, 1080
      
      // Create a flexbox layout: top bar + main content area
      oLayout := TLayout:New(oWnd, 0, 0, 1920, 1080, "COLUMN")
      
      // === ROW 1: Title Bar ===
      oLayout:AddRow("header", 80, .F., "CENTER", "CENTER")
      oTitleBar := TPOSTitleBar:New(0, 0, 1920, 80, oWnd)
      oLayout:GetSection("header"):AddControl(oTitleBar)
      
      // === ROW 2: Main Content (flexbox horizontal) ===
      oLayout:AddRow("content", 900, .F., "STRETCH", "STRETCH")
      
      // LEFT: Categories + Products (70% width)
      oLayout:AddColumn("left_panel", 1344, .F., "STRETCH", "STRETCH")
      
         // Categories
         oCategories := TPOSCategoryGrid:New(80, 0, 1344, 150, oWnd)
         oLayout:GetSection("left_panel"):AddControl(oCategories)
         
         // Product Grid
         oProducts := TPOSProductGrid:New(230, 0, 1344, 670, oWnd)
         oLayout:GetSection("left_panel"):AddControl(oProducts)
      
      // RIGHT: Cart + NumPad + Buttons (30% width)
      oLayout:AddColumn("right_panel", 576, .F., "STRETCH", "STRETCH")
      
         // Shopping Cart
         oCart := TPOSCart:New(80, 0, 576, 450, oWnd)
         oLayout:GetSection("right_panel"):AddControl(oCart)
         
         // Numeric Keypad
         oNumPad := TPOSNumPad:New(530, 0, 576, 250, oWnd)
         oLayout:GetSection("right_panel"):AddControl(oNumPad)
         
         // Action Buttons (Pay, Void, Hold, Print)
         oButtons := TPOSActionButtons:New(780, 0, 576, 120, oWnd)
         oLayout:GetSection("right_panel"):AddControl(oButtons)
   
   ACTIVATE WINDOW oWnd MAXIMIZED
RETURN NIL
What This Gives You
  • Responsive Layout — Flexbox automatically adapts to any screen size (phone, tablet, desktop)
  • Touch-Friendly — Large buttons and numeric pad designed for touch screens
  • Real-Time Cart — Items add/remove with automatic tax and total calculation
  • Receipt Printing — ESC/POS thermal printer support built-in (TPOSScreen)
  • Database Integration — TPOSDatabase handles product inventory and sales history
  • Admin Back-Office — TPOSAdmin for user login, product management, sales reports
Key Features of Individual Classes

TPOSProductGrid — Shows product tiles with:
  • Product image, name, price
  • Stock level indicator
  • Click to add to cart
  • Real-time category filtering
TPOSCart — Displays:
  • Line items with quantity and unit price
  • Subtotal, tax (configurable rate), grand total
  • Remove/edit line items
  • Discount application
TPOSNumPad — Touch keypad with:
  • 0-9 digits, decimal point
  • Clear, backspace, enter
  • Used for quantity entry, discount amounts, or manual price override
TPOSActionButtons — Transaction controls:
  • Pay (process payment)
  • Void (cancel transaction)
  • Hold (save cart for later)
  • Print (receipt)
  • Refund (return items)
Next Steps

Once you have the basic layout, you'd typically:
  • Load products from TPOSDatabase (DBF or SQL)
  • Wire up payment gateway integration (Stripe, Square, etc.) to TPOSActionButtons
  • Add user login via TPOSAdmin
  • Configure thermal printer for receipts via TPOSScreen
  • Test on your target devices (iPad, Android tablet, desktop)
The beauty of WebX is that this same code compiles to HTML5/CSS3/JavaScript and runs in any browser — no special client software needed. Your cashiers just open a URL and they're ready to ring up sales.

Need help with a specific part (payment integration, inventory sync, receipt formatting)? Let me know!

---
Generated by WebX AI Assistant
Post Reply