Price
Posted: Sat Oct 11, 2025 10:07 pm
What is the price???
Code: Select all
//----------------------------------------------------------------------------//
// complete_pos_system.prg - Complete POS System Demo
// Shows main POS terminal with categories, products, cart, numpad
// Uses TLayout for screen organization - NO HTML required!
//----------------------------------------------------------------------------//
#include "WebX.ch"
FUNCTION Main()
LOCAL oWnd, oLayout
LOCAL oCategory, oProducts, oCart, oNumPad
LOCAL aCategories, aProducts, oStyle, aData
PUBLIC Designed_Resolution := {1366, 768, .T.}
// Load data from database
aData := LoadSampleData()
aCategories := aData[1]
aProducts := aData[2]
DEFINE WINDOW oWnd TITLE "Maya POS System"
//==========================================================================
// Create main layout: 2 columns (Products | Cart/NumPad)
//==========================================================================
oLayout := TLayout():New( oWnd, 0, 0, 1366, 700, "COLUMN" )
oLayout:nGap := 4
// Left column - Products area (flex = takes remaining space)
oLayout:AddColumn( "products", 0 )
// Right column - Cart & NumPad (fixed 400px)
oLayout:AddColumn( "sidebar", 400 )
//==========================================================================
// LEFT SIDE: Categories + Products
//==========================================================================
// Categories at top (120px height)
oCategory := TPOSCategoryGrid():New( 0, 0, 900, 120, aCategories, oLayout:GetSection("products"), 4 )
oStyle := TPOSButtonStyle():New()
oStyle:SetSize( 4, 0, 0 )
oStyle:SetText( "lg", 3, .T. )
oStyle:SetStyle( "lg", .T., "shadow" )
oCategory:SetButtonStyle( oStyle )
// Products grid below (fills remaining space)
oProducts := TPOSProductGrid():New( 0, 130, 900, 520, aProducts, oLayout:GetSection("products"), 3 )
oProducts:lShowStock := .T.
oProducts:nLowStock := 10
//==========================================================================
// RIGHT SIDE: Cart + NumPad
//==========================================================================
// Shopping cart (top portion)
oCart := TPOSCart():New( 0, 0, 384, 380, oLayout:GetSection("sidebar") )
oCart:nTaxRate := 0.08
// NumPad below cart
oNumPad := TPOSNumPad():New( 0, 390, oLayout:GetSection("sidebar"), "paymentAmount" )
oNumPad:nGap := 2
ACTIVATE WINDOW oWnd
RETURN NIL
//----------------------------------------------------------------------------//
// LoadSampleData - Returns array with {aCategories, aProducts}
//----------------------------------------------------------------------------//
FUNCTION LoadSampleData()
LOCAL aCategories
LOCAL aProducts
// Categories: {name, icon, color, id}
aCategories := { ;
{"Drinks", "🥤", "blue", 1}, ;
{"Food", "🍔", "green", 2}, ;
{"Snacks", "🍿", "yellow", 3}, ;
{"Desserts", "🍰", "pink", 4} ;
}
// Products: {id, name, price, category, stock}
aProducts := { ;
{1, "Coca Cola", 2.50, "Drinks", 100}, ;
{2, "Pepsi", 2.50, "Drinks", 100}, ;
{3, "Water", 1.50, "Drinks", 200}, ;
{4, "Coffee", 3.00, "Drinks", 150}, ;
{5, "Burger", 8.99, "Food", 50}, ;
{6, "Fries", 3.50, "Food", 75}, ;
{7, "Pizza Slice", 5.99, "Food", 40}, ;
{8, "Salad", 6.50, "Food", 30}, ;
{9, "Chips", 2.00, "Snacks", 150}, ;
{10, "Candy Bar", 1.50, "Snacks", 8}, ;
{11, "Ice Cream", 4.50, "Desserts", 60}, ;
{12, "Cake Slice", 5.50, "Desserts", 25} ;
}
RETURN {aCategories, aProducts}
