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

qlabibmcashbox.h

00001 #ifndef QLABIBMCASHBOX_H
00002 #define QLABIBMCASHBOX_H
00003 
00004 #include <qobject.h>
00005 #include <qmap.h>
00006 #include <qdatetime.h>
00007 #include <qvaluestack.h>
00008 
00009 #include "qlabibm4694.h"
00010 
00011 class QSqlCursor ;
00012 
00013 typedef struct ticketLine
00014 {
00015         int recid ;
00016         int prodid ;
00017         QString serial ;
00018         QString prodname ;
00019         double retail ;
00020         int     qty ;
00021         double rebate ;
00022         double total ;
00023         int valid ;
00024         QString line_type ;
00025         QDateTime twhen ;
00026 } ;
00027 
00028 
00029 class Q_EXPORT QlabIbmCashbox : public QObject
00030 {
00031         Q_OBJECT
00032 
00033         Q_ENUMS( PosStates )
00034         Q_ENUMS( LineTypes )
00035         Q_ENUMS( MasterConversation )
00036         Q_ENUMS( SuperviseActions )
00037 
00038 public :
00039         QlabIbmCashbox( QObject * parent = 0, char * name = 0 ) ;
00040         ~QlabIbmCashbox() ;
00041 
00042         // overloaded member. Original in QlabDatabase class
00043         static QString SequenceGetNextValue( const QString table ) ;
00044 
00045         // Describes the various Sales operations.
00046         enum PosStates { STATUS_WaitForLogin,
00047                                          STATUS_WaitForPassword,
00048                                          STATUS_InPause,
00049                                          STATUS_ReadyForTransaction,
00050                                          STATUS_InTransaction,
00051                                          STATUS_DrawerOpenQuery,
00052                                          STATUS_DrawerOpen,
00053                                          STATUS_CancelLine,
00054                                          STATUS_CancelTicket,
00055                                          STATUS_PushTicket,
00056                                          STATUS_PopTicket,
00057 
00058                                          STATUS_Tender,
00059                                          STATUS_TENDER_KEYBOARD,
00060                                          STATUS_TENDER_MSR,
00061                                          STATUS_TENDER_CASH,
00062                                          STATUS_DRAWER_CLOSED,
00063                                          STATUS_PRINTER_ERROR,
00064                                          STATUS_TENDER_CHEQUER,
00065                                          STATUS_REMOVE_CHEQUE,
00066                                          STATUS_TENDER_MAN_CHEQUER,
00067                                          STATUS_CANCEL_MODE,
00068                                          STATUS_PRINT_FEATURES,
00069                                          STATUS_REQUIRE_SUPERVISOR,
00070                                          STATUS_WITHDRAW,
00071                                          STATUS_WITHDRAW_FAST,
00072                                          STATUS_WITHDRAW_DETAIL } ;
00073 
00074         enum LineTypes { Header, Footer, Line, Subtotal, Total, GrandTotal, Rebate, Tax,
00075                                          Refund, Cashin, Cheque, CreditCard, Moneo,
00076                                          PrivateCard, Delayed, Coupons, InternalCoupons,
00077                                          LineCancel, PayCancel, Separator, ChequeExternal,
00078                                          CashWidthdraw, ChequeWidthdraw, CashCount, CashCurrency, CashClose } ;
00079 
00080         enum MasterConversation { MasterTicketEnd,
00081                                                           MasterCountOpening,
00082                                                           MasterCountClose,
00083                                                           MasterCountRedrawal,
00084                                                           MasterCountInsertion,
00085                                                           MasterCancelation,
00086                                                           MasterAnomality,
00087                                                           MasterSessionStart,
00088                                                           MasterSessionPause,
00089                                                           MasterSessionReprise,
00090                                                           MasterSessionClose,
00091                                                           MasterSessionLoginError,
00092                                                           MasterSessionSuperLoginError } ;
00093 
00094         enum SuperviseActions { SuperviseNone, SuperTicketPush, SuperTicketRecall, SuperTicketCancel } ;
00095 
00096 
00097 public slots :
00098         void setup() ;
00099 
00100         void drawerOpen() ;
00101         void drawerClosed() ;
00102         void endTransaction() ;
00103         void showKeyboardData( const QString & data ) ;
00104         void enterKeyPressed( const QString & data ) ;
00105         void keyPressed( unsigned char keyCode ) ;
00106         void processMagneticStrip( const QString & data ) ;
00107         void getScannerData( const QString & data ) ;
00108         void processCheckNumber( const QString & data ) ;
00109         void checkSupervise( bool ss ) ;
00110         void checkInterfaceStatus( int st ) ;
00111         void processHardwareErrors( int errNo, int severity,
00112                                                                 const QString & descr ) ;
00113         void processDeviceStatus( const QString & status ) ;
00114         void processDeviceOnlineStatus( const QString & descr ) ;
00115         void printerChanged( int newPrinter ) ;
00116 
00117 
00118         // void store() ;
00119 
00120         // This is to get a grab on database
00121 
00122         bool removeLine( int lineno ) ;
00123         void postError( const QString & msg ) ;
00124 
00125 private :
00126         bool createConnections() ;
00127         QString GetIniVar( const QString & section, const QString & varname ) ;
00128         void informMaster( MasterConversation mc, const QString & msg = "" ) ;
00129         bool pingMaster() ;
00130 
00131         void newTicket() ;
00132 
00133         // ===============================================
00134         void postLogin( const QString & data ) ;
00135         void checkUser( const QString & data ) ;
00136         void confirmPass( const QString & data ) ;
00137         void findItem( const QString & serial ) ;
00138         void duplicateLast() ;
00139         void addProductToBasket( bool negate = FALSE ) ;
00140         void addInlineRebate() ;
00141         void updateQty() ;
00142         void checkSessionStatus() ;
00143         void checkDrawerStatus() ;
00144         void checkClear() ;
00145         void checkCancel() ;
00146         void printTicketHead() ;
00147         void checkTotal() ;
00148         void checkPause() ;
00149         void checkSupervisorAccess( const QString & data ) ;
00150         void checkTicketPushPop() ;
00151         void execSuperviseAction() ;
00152         void ticketPush() ;
00153         void ticketRecall( bool std ) ;
00154         void printLine( uint lineno = 0 ) ;
00155         void ticketCancel() ;
00156         void displayAmount( int devdes, double amt ) ;
00157         void cancelLine() ;
00158         void cancelTicket() ;
00159 
00160         // =====================================OLD STUFF
00161         void errorMsg( const QString & msg ) ;
00162         void showWelcome() ;
00163 
00164         void showWithdrawDetail( bool tnew ) ;
00165         void saveFastWithDraw( double value = 0 ) ;
00166         void saveCashWithDraw( int count ) ;
00167         void saveAutomaticWithDraw() ;
00168         void saveGrandTotal() ;
00169         void registerNoSale() ;
00170         void registerPayMode( const QString & value ) ;
00171         void registerRefund( double value ) ;
00172         void registerBalance( double value ) ;
00173 
00174         long calcTaxes() ;
00175         void tooManyItems() ;
00176         void printSeparator() ;
00177         void writePrinterDate( bool full = TRUE ) ;
00178         void setPayText( unsigned char keyCode ) ;
00179 
00180         //bool superviseRequired( SuperviseActions action ) ;
00181         //bool superviseLogin( SuperviseActions action ) ;
00182         //void releaseSupervise() ;
00183 
00184         // Instance Vars
00185         QlabIbm4694 * interf ;                                          // hardware interface widget
00186         PosStates posActiveStatus ;                                     // current status
00187         PosStates posSavedStatus ;                                      // previous status
00188 
00189         QMap<uint, ticketLine> activeTicket ;           // Mapping to current ticket
00190 
00191         // Standard QlabCashbox vars
00192         int userID ;                                                            // operator User ID
00193         int userIDsave ;                                                        // operator User ID save state for supervisor mode
00194         int cashboxID ;                                                         // cashbox ID. Filled during init.
00195         int ticketNO ;                                                          // current ticket number
00196         bool returnOnlyCashbox ;                                        // Only TRUE for Return Only cashboxes.
00197         QString ticketStamp ;                                           // mixed style ticket Stamp
00198 
00199         // Transitory vars
00200         QString login ;
00201         QString loginSave ;
00202         QString passwd ;
00203         QString passwdSave ;
00204         bool inSupervise ;
00205         bool supervisorLoggedIn ;
00206         SuperviseActions superviseAction ;
00207         // Ticket Management vars
00208         bool welcomeDisplayed ;                                         // Cust welcome already displayed
00209         bool printByLine ;                                                      // TRUE = print by line, FALSE = Print full Ticket
00210         bool showOnly ;                                                         // Used when using the PriceCall() Method
00211         bool showTaxes ;                                                        // Used internally by printing optimizer.
00212         uint maxItems ;                                                         // Max lines in a ticket...
00213         double ticketTotal ;                                            // Ticket Total
00214         int itemQty ;                                                           // next item qty.
00215 
00216         QString priceControl ;                                          // holder for price control
00217         bool inlineSavings ;
00218         QString recallCode ;
00219         QString recallKey ;
00220         QString activePayMode ;
00221         QString activePayText ;
00222 
00223         // used by integrated data Manager
00224         // Will move to a datalib soon
00225         QSqlCursor * parts ;
00226         QSqlCursor * prods ;
00227         // QSqlCursor * ticket ;        // Moved to a Map
00228         QSqlCursor * opts ;
00229         QSqlCursor * cbevents ;
00230         QSqlCursor * motd ;
00231 
00232         // this is the old stuff =============
00233         QMap<QString, double> withdrawHist ;
00234         bool withdrawstop ;
00235 
00236         bool printToPage ;
00237         QString custwelcome ;
00238 
00239         QValueStack<PosStates> statusStack ;
00240 
00241 } ;
00242 
00243 
00244 
00245 #endif // QLABIBMCASHBOX_H
00246 
00247 

 

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