Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

QlabCashboxBase Class Reference
[Cashbox Related ClassesCashbox Related Classes]

#include <qlabcashboxbase.h>

List of all members.


Detailed Description

This class describes a generic Cashbox Logic Manager.
Your Physical implementations should inherit this and overload methods or add new ones.

This Class provides a skeleton integrating the various Cashbox Construction Kit. You may use it as you want, simply inheriting it and making the signaled changes.

Todo:
More documentation....
See also:
QlabCashboxInterfaceDefinition Hardware interface abstraction class

QlabTicketLine Ticket Line Management class

QlabDatabaseCashboxClient Database connectivity class stripped for cashboxes.

Public Types

Public Slots

Public Member Functions

Private Member Functions

Private Attributes


Member Enumeration Documentation

enum QlabCashboxBase::PosStates
 

Descriptive view of the various states of the cashbox machine.

This emulates a state machine. Think of this not the classic state machine, but the Prolog way as a state is only a descriptor of a context.

Enumeration values:
STATUS_WaitForLogin  Cashbox is closed, waits for login
STATUS_WaitForPassword  Login enterd, wait for password
STATUS_InPause  Cashbox paused, wait for password
STATUS_ReadyForTransaction  Transaction Ready. Can start a sales transaction or a Supervision action
STATUS_InTransaction  Standard sales process. Scan products...
STATUS_DrawerOpenQuery  When an open drawer action is needed, outside a transaction
STATUS_DrawerOpen  When cash drawer is open. Used to limit other actions
STATUS_CancelLine  A ticket line cancellation is required
STATUS_CancelTicket  A cancel full ticket is required
STATUS_PushTicket  A Push Ticket on stack is required
STATUS_PopTicket  A Recall ticket from stack is required
STATUS_Tender  Entering the pay strategy. Ticket line add transaction is up to close
STATUS_TENDER_KEYBOARD  A pay action needs keyboard interaction
STATUS_TENDER_MSR  A pay action requires Magnetic Strip Card reading
STATUS_TENDER_CASH  A Cash Pay action occured
STATUS_DRAWER_CLOSED  A Close Drawer action occured, after payment
STATUS_PRINTER_ERROR  The Printer posted an error. This blocks transaction till error is cleared
STATUS_TENDER_CHEQUER  A Pay by check action occured. Arises when check Reader activates
STATUS_REMOVE_CHEQUE  A chack Read or print action finishes
STATUS_TENDER_MAN_CHEQUER  A try to manually print check action starts
STATUS_CANCEL_MODE  Some job cancellation occured
STATUS_PRINT_FEATURES  A feature list print required. Service Only (Hypervisor)
STATUS_REQUIRE_SUPERVISOR  An action requiring supervisor mode occured
STATUS_WITHDRAW  A cash withdrawal action has been required
STATUS_WITHDRAW_FAST  Fast withdraw mode has been selected

enum QlabCashboxBase::PosStates
 

Descriptive view of the various states of the cashbox machine.

This emulates a state machine. Think of this not the classic state machine, but the Prolog way as a state is only a descriptor of a context.

Enumeration values:
STATUS_WaitForLogin  Cashbox is closed, waits for login
STATUS_WaitForPassword  Login enterd, wait for password
STATUS_InPause  Cashbox paused, wait for password
STATUS_ReadyForTransaction  Transaction Ready. Can start a sales transaction or a Supervision action
STATUS_InTransaction  Standard sales process. Scan products...
STATUS_DrawerOpenQuery  When an open drawer action is needed, outside a transaction
STATUS_DrawerOpen  When cash drawer is open. Used to limit other actions
STATUS_CancelLine  A ticket line cancellation is required
STATUS_CancelTicket  A cancel full ticket is required
STATUS_PushTicket  A Push Ticket on stack is required
STATUS_PopTicket  A Recall ticket from stack is required
STATUS_Tender  Entering the pay strategy. Ticket line add transaction is up to close
STATUS_TENDER_KEYBOARD  A pay action needs keyboard interaction
STATUS_TENDER_MSR  A pay action requires Magnetic Strip Card reading
STATUS_TENDER_CASH  A Cash Pay action occured
STATUS_DRAWER_CLOSED  A Close Drawer action occured, after payment
STATUS_PRINTER_ERROR  The Printer posted an error. This blocks transaction till error is cleared
STATUS_TENDER_CHEQUER  A Pay by check action occured. Arises when check Reader activates
STATUS_REMOVE_CHEQUE  A chack Read or print action finishes
STATUS_TENDER_MAN_CHEQUER  A try to manually print check action starts
STATUS_CANCEL_MODE  Some job cancellation occured
STATUS_PRINT_FEATURES  A feature list print required. Service Only (Hypervisor)
STATUS_REQUIRE_SUPERVISOR  An action requiring supervisor mode occured
STATUS_WITHDRAW  A cash withdrawal action has been required
STATUS_WITHDRAW_FAST  Fast withdraw mode has been selected

enum QlabCashboxBase::SuperviseActions
 

Descriptors for Supervise Actions.

Note:
This might be extended in the future, as new Supervise actions may be determined.
Enumeration values:
SuperviseNone  Nothing to Supervise. Normal state
SuperTicketPush  A ticket Push action is required. See STATUS_PushTicket
SuperTicketRecall  A Ticket Recall action is required. See STATUS_PopTicket
SuperTicketCancel  A ticket cancellation is required. See STATUS_TicketCancel
SuperPayModeForce  A Pay Mode Force is required

enum QlabCashboxBase::SuperviseActions
 

Descriptors for Supervise Actions.

Note:
This might be extended in the future, as new Supervise actions may be determined.
Enumeration values:
SuperviseNone  Nothing to Supervise. Normal state
SuperTicketPush  A ticket Push action is required. See STATUS_PushTicket
SuperTicketRecall  A Ticket Recall action is required. See STATUS_PopTicket
SuperTicketCancel  A ticket cancellation is required. See STATUS_TicketCancel
SuperPayModeForce  A Pay Mode Force is required


Constructor & Destructor Documentation

QlabCashboxBase::QlabCashboxBase QObject *  parent = 0,
char *  name = 0
 

Create a new instance of QlabCashboxBase owned by parent and named name.

Note:
Your inherited tree MUST reimplement a call to interface, as this one only calls the generic interface bound to no hardware at all.

QlabCashboxBase::~QlabCashboxBase  ) 
 

Destroys a QlabCashboxBase instance. Usually empty as Qt does clean up very well.


Member Function Documentation

void QlabCashboxBase::addInlineRebate  )  [private, virtual]
 

Adds an inline rebete value.

This is an automatic method called by part management.

void QlabCashboxBase::addProductToBasket bool  negate = FALSE  )  [private, virtual]
 

Adds a product to the ticket and stores values and all parts stuff.

long QlabCashboxBase::calcTaxes  )  [private, virtual]
 

Iterates through ticket to calculate taxes.

This has to be included in a specific method, as tax calculation may differ from country to country.

Note:
Internal mplementation may change in the future, when we have to deal with USA Federal Tax/ State Tax/Local Tax. Need some more legal information to implement this.

void QlabCashboxBase::cancelLine  )  [private, virtual]
 

Immediate Cancel Mode. Cancels the last line.

void QlabCashboxBase::cancelTicket  )  [private, virtual]
 

Cancels a full ticket.

void QlabCashboxBase::checkCancel  )  [private, virtual]
 

Checks if a Cancel Action is allowed in current context.

void QlabCashboxBase::checkClear  )  [private, virtual]
 

Checks if a Clear action is allowed in context.

void QlabCashboxBase::checkDrawerStatus  )  [private, virtual]
 

Checks if Drawer opening is allowed in current context.

void QlabCashboxBase::checkInterfaceStatus int  newStatus  )  [virtual, slot]
 

Received whenever interface processing status changes.

Warning:
We make reference to hardware status.
You migth have to fully reimplement this if you have some specific things to deal with.

void QlabCashboxBase::checkPause  )  [private, virtual]
 

Checks if a PAUSE action is allowed in context.

void QlabCashboxBase::checkSessionStatus  )  [private, virtual]
 

Checks Session status before allowing some actions.
Can move session status from one step to next depending on active context.

void QlabCashboxBase::checkSupervise bool  ss  )  [virtual, slot]
 

Received whenever Supervise status changes.

You may need some processing there, depending on what you want to implement.

void QlabCashboxBase::checkTicketPushPop  )  [private, virtual]
 

Checks if Ticket Push or Pop is allowed.

void QlabCashboxBase::checkTotal  )  [private, virtual]
 

Checks if Registering GrandTotal is allowed in context.

void QlabCashboxBase::checkUser const QString &  data  )  [private, virtual]
 

Processes the second stage login. Received password.

Check user and act upon this.

void QlabCashboxBase::confirmPass const QString &  data  )  [private, virtual]
 

Used as Password confirmation before accepting forced drawer open.

void QlabCashboxBase::displayAmount int  devdes,
double  amt
[private, virtual]
 

Used to format display for floating numbers.

Warning:
This might be moved to hardware interface in future versions, as formating rules may differ.

void QlabCashboxBase::drawerClosed  )  [virtual, slot]
 

What should we do on drawer close event ?

Usually, as drawer is only open after a transaction, we can welcome next customer and say operator that next customer is ready. This is QlabCashboxBase::showWelcome() method usage.

void QlabCashboxBase::drawerOpen  )  [virtual, slot]
 

What should we do if drawer is open ?

In most cases, we just have to say something to operator and wait for the drawer closes, except if we allow transactions with an open drawer, which sounds risky!

void QlabCashboxBase::duplicateLast  )  [private, virtual]
 

Duplicates the last Ticjket Line This is a helper for Quick repeat.

You'll have to implement your real code for this, according to your context if default one does not fit what you need.

void QlabCashboxBase::endTransaction  )  [virtual, slot]
 

End of sales transaction processing.

Mainly QlabCashboxBase::showWelcome() and put status to STATUS_ReadyForTransaction

void QlabCashboxBase::enterKeyPressed const QString &  data  )  [virtual, slot]
 

Process Enter key signal.

This is one of the most complex methods as Enter is used to confirm many things. We meet an old friend: a Supervise switch and a standard switch

void QlabCashboxBase::errorMsg const QString &  msg  )  [private, virtual]
 

Displays an interesting msg to the operator, while sounding a nice melody.

void QlabCashboxBase::execSuperviseAction  )  [private, virtual]
 

Executes the SuperviseAction waiting for processing.

This is executed when Supervisor login arises on a Supervise only action. You'll have to reimplement this method to give the wanted code for keyboardSupervisorStatus.

void QlabCashboxBase::findItem const QString &  serial  )  [private, virtual]
 

Try to find an item serial.

This is hooked to both keyboard and scanner systems.

Note:
An enhanced version is underway. But as this will change noting to this interface, don't bother with internal processing.

You don't have to think of those special EAN values in classes 02, 378-9, 487-8, 978... as the Parts management logic in QlabDatabaseCashboxClient::QlabDatabaseCashboxClient() does all the job for you.

void QlabCashboxBase::getScannerData const QString &  data  )  [virtual, slot]
 

Scanner data processor.

Mainly used for EAN/Codabar reference processing. Can also be used for user signon, liability...

Warning:
Depending on hardware, you might have to release the scanner or unlock it!

void QlabCashboxBase::keyPressed unsigned char  keyCode  )  [virtual, slot]
 

Process action keys from keyboard.

Here we need a switch to connect actions to processing. The thing sounds obvious, while KeyCodes are auto documented.

You MUST reimplement it as we cannot have a clue of your keycodes in the skeleton.

void QlabCashboxBase::newTicket  )  [private, virtual]
 

Spawns a new ticket Map and does housekeeping for it.

void QlabCashboxBase::postError const QString &  msg  )  [virtual, slot]
 

Posts an error message to operator and advises server.

void QlabCashboxBase::postLogin const QString &  data  )  [private, virtual]
 

Processes when in Login 1st stage.

This should not need overloading by inheritors as the processing is pretty standard.

void QlabCashboxBase::printerChanged int  pd  )  [virtual, slot]
 

Reveived whenever active print device changes.

Informational only, as your logic should already know you wanted a printer change.

void QlabCashboxBase::printLine uint  lineno = 0  )  [private, virtual]
 

Formats a ticket line lineno for printing.

Note:
Internals may change in future versions and may be replaced by a template based system.

void QlabCashboxBase::printSeparator  )  [private, virtual]
 

Prints a separator line to active printer.

This is just an helper method. You may forget it.

Deprecated:
May disapear from next version. This should be moved to hardware interface.

void QlabCashboxBase::printTicketHead  )  [private, virtual]
 

Prints the ticket header.

void QlabCashboxBase::processCheckNumber const QString &  data  )  [virtual, slot]
 

Check Number read from Micr.

Can be ignored or stored in transaction

void QlabCashboxBase::processDeviceOnlineStatus const QString &  msg  )  [virtual, slot]
 

Reveived on hardware device status Online/Offline changes.

Do whatever you want with this. Depends on hardware.

void QlabCashboxBase::processDeviceStatus const QString &  msg  )  [virtual, slot]
 

Reveived on hardware device status changes.

Do whatever you want with this, even trashing it.

void QlabCashboxBase::processHardwareErrors int  errNo,
int  severity,
const QString &  msg
[virtual, slot]
 

Reveived on hardware device exceptions deviceError() signal.

Mainly used to interact whith operator and send Error messages to administrative backend.
You'll have to implement your own hardware error manager.

void QlabCashboxBase::processMagneticStrip const QString &  data  )  [virtual, slot]
 

Process Magnetic Strip Data event.

Here, we can hook whatever we want:

  • Credit Card processing for non CP8 Credit Cards
  • Liability Cards processing
  • user SignOn
  • supervisor SignOn...

void QlabCashboxBase::registerBalance double  value  )  [private, virtual]
 

Registers Balance Due with value.

Posts a line in ticket for balance due. This is only used when we start in multiple tender modes (ie Cash + Voucher).
Show Operator and Customer the Balance Due.

void QlabCashboxBase::registerNoSale  )  [private, virtual]
 

Registers a NO SALE transaction.

One may need some quirks with this, as each and every company has a different politics on how to deal with NO SALE events.

void QlabCashboxBase::registerPayMode const QString &  value  )  [private, virtual]
 

Registers a Pay mode corresponding to value paid.

Note:
This is very useful when dealing with multiple tender modes.

void QlabCashboxBase::registerRefund double  value  )  [private, virtual]
 

Registers Money Back value.

Posts a line in ticket for Money Back.
Show Operator and Customer Money Back Value.

bool QlabCashboxBase::removeLine int  lineno  )  [virtual, slot]
 

Removes Ticket Line number lineno.

This method is used by both single line delete and full ticket cancellation.

void QlabCashboxBase::saveAutomaticWithDraw  )  [private, virtual]
 

Registers an automatic Withdrawal.

void QlabCashboxBase::saveCashWithDraw int  count  )  [private, virtual]
 

Registers a Cash withdrawal.

Note:
Internal implementation might change when we have to deal with all and every monetary unit. Interface will remain standard.

void QlabCashboxBase::saveFastWithDraw double  value = 0  )  [private, virtual]
 

Registers a Fast Withdrawal action.

void QlabCashboxBase::saveGrandTotal  )  [private, virtual]
 

Registers the Grand Total.

Grand Total is the Ledger term dealing with general Total for a transaction, including taxes and everything dealing with it.
In other words, Grand Total is what the customer has to pay.

void QlabCashboxBase::setPayText unsigned char  keyCode  )  [private, virtual]
 

Maps a PayMode Code sent by keyCode to a human readable expression.

You must implement (maybe simply copying the sampled code here) the real values for keyCodes. This might be extended in the future whenever new pay modes arise, ie MentalPayMode, EmbeddedChipUnderSkin...

void QlabCashboxBase::setup  )  [virtual, slot]
 

Standard Setup Method
Cannot be included in constructor as some hardware is pretty slow to init.

  • Sets the hardware abstraction up,
  • Creates signal/slot connections,
  • Declares the DataManager stuff and
  • Starts the message passing manager.
Feel free to extend or change the signal/slot declarations as you need.

void QlabCashboxBase::showKeyboardData const QString &  data  )  [virtual, slot]
 

Process keyboard buffer changes.

What should we do when we receive a signal from hardware saying the keyboard buffer has been changed?

Note:
We MUST take care of Password status. Thus the treatment is somewhat larger than most others.

void QlabCashboxBase::showWelcome  )  [private, virtual]
 

Shows Welcome Message to Customer and Next Customer to Operator.

This is only a handy method quicket to type than the two display ones.

void QlabCashboxBase::showWithdrawDetail bool  tnew  )  [private, virtual]
 

Used to crawl inside the Withdraw detail form.

This only deals with withdraw details when using an emulated spreadsheet on those 2 line displays.
Only here as experimental stuff. You may safely ignore it.

void QlabCashboxBase::ticketCancel  )  [private, virtual]
 

Nicely cancels a ticket.

Note:
Even if some steps sound unuseful, we made this to be compliant with Fiscal Rules in many countries.

void QlabCashboxBase::ticketPush  )  [private, virtual]
 

Pushes a ticket on stack for later processing.

void QlabCashboxBase::ticketRecall bool  std  )  [private, virtual]
 

Recalls a ticket from standard PushStack or ticket history according to std.

void QlabCashboxBase::tooManyItems  )  [private, virtual]
 

Posts an alert to operator when ticket is too big.

void QlabCashboxBase::updateQty  )  [private, virtual]
 

Processes a Quantity change query.

void QlabCashboxBase::writePrinterDate bool  full = TRUE  )  [private, virtual]
 

Cleanup for the transaction with full make when full is TRUE.

This method name comes from those nifty Fiscal Printers which must have a printer datestamp for each and every transaction. As we use a transaction stamp too for our informMaster() method, this sounds nice.

This method _MUST_ be called whenever a transaction ends as it has many tasks to accomplish.

  • write the optional Message of the day on the Cust Receipt
  • write the ticket footer to Cust Receipt
  • write the timestamp to the Cust Receipt and (optional history roll)
  • inform master server of the transaction.


Member Data Documentation

QString QlabCashboxBase::activePayMode [private]
 

Used by the Tender Modes.

QString QlabCashboxBase::activePayText [private]
 

Used to humanly talk about current Tender mode.

QMap<uint, QlabTicketLine> QlabCashboxBase::activeTicket [private]
 

Mapping to current ticket objects.

QMap<uint, QlabTicketLine * > QlabCashboxBase::activeTicket [private]
 

Mapping to current ticket objects.

int QlabCashboxBase::cashboxID [private]
 

Cashbox ID.

Filled during init.

QlabDatabseCashboxClient* QlabCashboxBase::cbevents [private]
 

Cash Events Manager hook.

QlabDatabaseCashboxClient* QlabCashboxBase::cbevents [private]
 

Cash Events Manager hook.

QString QlabCashboxBase::custwelcome [private]
 

Holds the Customer Welcome String.

bool QlabCashboxBase::inlineSavings [private]
 

Used to determine is savings are printed inline or deported to ticket foot.

bool QlabCashboxBase::inSupervise [private]
 

Supervise mode switch.

virtual QlabCashboxInterfaceDefinition* QlabCashboxBase::interf [private]
 

MUST Reimplement for your hardware interface.

For internal use only.

QlabCashboxInterfaceDefinition* QlabCashboxBase::interf [private]
 

MUST Reimplement for your hardware interface.

For internal use only.

int QlabCashboxBase::itemQty [private]
 

Next item qty.

QString QlabCashboxBase::login [private]
 

Used during Login State.

QString QlabCashboxBase::loginSave [private]
 

Used while Supervise mode is On.

uint QlabCashboxBase::maxItems [private]
 

Max lines in a ticket..

QlabDatabseCashboxClient* QlabCashboxBase::motd [private]
 

Grabs the Cashbox Messages options.

QlabDatabaseCashboxClient* QlabCashboxBase::motd [private]
 

Grabs the Cashbox Messages options.

QlabDatabseCashboxClient* QlabCashboxBase::opts [private]
 

Optional Discount Rules, if used with the discount subsystem.

QlabDatabaseCashboxClient* QlabCashboxBase::opts [private]
 

Optional Discount Rules, if used with the discount subsystem.

QlabDatabseCashboxClient* QlabCashboxBase::parts [private]
 

Hook to Part Manager.

QlabDatabaseCashboxClient* QlabCashboxBase::parts [private]
 

Hook to Part Manager.

QString QlabCashboxBase::passwd [private]
 

Used as a password storage key.

QString QlabCashboxBase::passwdSave [private]
 

Used while in Supervise Mode.

PosStates QlabCashboxBase::posActiveStatus [private]
 

Current Status Place Holder.

PosStates QlabCashboxBase::posSavedStatus [private]
 

Previous Status place holder.

QString QlabCashboxBase::priceControl [private]
 

Place holder for price control.

bool QlabCashboxBase::printByLine [private]
 

TRUE = print by line, FALSE = Print full Ticket.

bool QlabCashboxBase::printToPage [private]
 

Used by Document Insertion Printing.

QlabDatabseCashboxClient* QlabCashboxBase::prods [private]
 

Hook to Product list.

May disappear in the future

QlabDatabaseCashboxClient* QlabCashboxBase::prods [private]
 

Hook to Product list.

May disappear in the future

QString QlabCashboxBase::recallCode [private]
 

Used by Ticket Recall Logic.

QString QlabCashboxBase::recallKey [private]
 

Used by ticket recall logic.

bool QlabCashboxBase::returnOnlyCashbox [private]
 

Only TRUE for Return Only cashboxes.

bool QlabCashboxBase::showOnly [private]
 

Used when activating the PriceCall() Method.

bool QlabCashboxBase::showTaxes [private]
 

Used internally by printing optimizer.

QValueStack<PosStates> QlabCashboxBase::statusStack [private]
 

May be used when we need to Push Status.

QValueStack<PosStates> QlabCashboxBase::statusStack [private]
 

May be used when we need to Push Status.

SuperviseActions QlabCashboxBase::superviseAction [private]
 

Required supervise action code.

bool QlabCashboxBase::supervisorLoggedIn [private]
 

Supervise Login completion flag.

int QlabCashboxBase::ticketNO [private]
 

Current ticket number.

int QlabCashboxBase::ticketNo [private]
 

Current ticket number.

QString QlabCashboxBase::ticketStamp [private]
 

Mixed style ticket Stamp.

double QlabCashboxBase::ticketTotal [private]
 

Ticket Total storage.

QlabDatabseCashboxClient* QlabCashboxBase::user [private]
 

User Manager hook.

QlabDatabaseCashboxClient* QlabCashboxBase::user [private]
 

User Manager hook.

int QlabCashboxBase::userID [private]
 

Operator User ID.

Needed to recall from Supervise actions

int QlabCashboxBase::userIDsave [private]
 

Operator User ID save state for supervisor mode.

bool QlabCashboxBase::welcomeDisplayed [private]
 

Cust welcome already displayed.

QMap<QString, double> QlabCashboxBase::withdrawHist [private]
 

Only used by Detailled Withdraw Mode.

QMap<QString, double> QlabCashboxBase::withdrawHist [private]
 

Only used by Detailled Withdraw Mode.

bool QlabCashboxBase::withdrawstop [private]
 

Used by Detailled Withdraw Mode.

 

L.A.B. Project © 2001-2004 LAB Project & DJ Anubis