00001 /* 00002 * Linux Advanced Business Enterprise Management System 00003 * 00004 * 00005 * File name....... : qlabcashboxbase.h 00006 * File version.... : 1.2 00007 * Revision Date... : mardi 27 mai 2003 00008 * 00009 * File Description : Generic Cashbox Logic Manager 00010 * 00011 * Author.......... : DJ Anubis 00012 * Copyright....... : (C) 2001-2003 by DJ Anubis 00013 * Email .......... : labproject@free.fr 00014 * 00015 * License : 00016 * Please read the license file in doc directory. 00017 * 1. Lab Public License. 00018 * You should have received a copy of the Lab Public License with this package. 00019 * If this is not the case, you can read it or download it at: 00020 * http://labproject.free.fr 00021 * 2. Q Public License. 00022 * Conformant to Trolltech QPL license. 00023 * 3. GNU General Public License. 00024 * Reserved for free projects. 00025 * 4. Commercial license. 00026 * Recommanded if your code is not distributed under one of the 3 models above. 00027 * 00028 * Read the license FAQ in doc directory. 00029 * 00030 */ 00031 00032 00033 #ifndef QLABCASHBOXBASE_H 00034 #define QLABCASHBOXBASE_H 00035 00036 #include <qobject.h> 00037 #include <qmap.h> 00038 #include <qdatetime.h> 00039 #include <qvaluestack.h> 00040 00041 #include <qlabcashboxinterfacedefinition.h> 00042 00043 class QlabDatabaseCashboxClient ; 00044 class QlabTicketLine ; 00045 00046 class Q_EXPORT QlabCashboxBase : public QObject 00047 { 00048 Q_OBJECT 00049 00050 Q_ENUMS( PosStates ) 00051 Q_ENUMS( LineTypes ) 00052 Q_ENUMS( SuperviseActions ) 00053 00054 public : 00055 QlabCashboxBase( QObject * parent = 0, char * name = 0 ) ; 00056 ~QlabCashboxBase() ; 00057 00064 enum PosStates { STATUS_WaitForLogin, 00065 STATUS_WaitForPassword, 00066 STATUS_InPause, 00067 STATUS_ReadyForTransaction, 00068 STATUS_InTransaction, 00069 STATUS_DrawerOpenQuery, 00070 STATUS_DrawerOpen, 00071 STATUS_CancelLine, 00072 STATUS_CancelTicket, 00073 STATUS_PushTicket, 00074 STATUS_PopTicket, 00076 STATUS_Tender, 00077 STATUS_TENDER_KEYBOARD, 00078 STATUS_TENDER_MSR, 00079 STATUS_TENDER_CASH, 00080 STATUS_DRAWER_CLOSED, 00081 STATUS_PRINTER_ERROR, 00082 STATUS_TENDER_CHEQUER, 00083 STATUS_REMOVE_CHEQUE, 00084 STATUS_TENDER_MAN_CHEQUER, 00085 STATUS_CANCEL_MODE, 00086 STATUS_PRINT_FEATURES, 00087 STATUS_REQUIRE_SUPERVISOR, 00088 STATUS_WITHDRAW, 00089 STATUS_WITHDRAW_FAST, 00090 STATUS_WITHDRAW_DETAIL } ; 00097 enum SuperviseActions { SuperviseNone, 00098 SuperTicketPush, 00099 SuperTicketRecall, 00100 SuperTicketCancel, 00101 SuperPayModeForce 00102 } ; 00103 00104 00105 public slots : 00106 virtual void setup() ; 00107 00108 virtual void drawerOpen() ; 00109 virtual void drawerClosed() ; 00110 virtual void endTransaction() ; 00111 virtual void showKeyboardData( const QString & data ) ; 00112 virtual void enterKeyPressed( const QString & data ) ; 00113 virtual void keyPressed( unsigned char keyCode ) ; 00114 virtual void processMagneticStrip( const QString & data ) ; 00115 virtual void getScannerData( const QString & data ) ; 00116 virtual void processCheckNumber( const QString & data ) ; 00117 virtual void checkSupervise( bool ss ) ; 00118 virtual void checkInterfaceStatus( int st ) ; 00119 virtual void processHardwareErrors( int errNo, int severity, const QString & descr ) ; 00120 virtual void processDeviceStatus( const QString & status ) ; 00121 virtual void processDeviceOnlineStatus( const QString & descr ) ; 00122 virtual void printerChanged( int newPrinter ) ; 00123 00124 virtual bool removeLine( int lineno ) ; 00125 virtual void postError( const QString & msg ) ; 00126 00127 private : 00128 virtual void newTicket() ; 00129 00130 virtual void postLogin( const QString & data ) ; 00131 virtual void checkUser( const QString & data ) ; 00132 virtual void confirmPass( const QString & data ) ; 00133 virtual void findItem( const QString & serial ) ; 00134 virtual void duplicateLast() ; 00135 virtual void addProductToBasket( bool negate = FALSE ) ; 00136 virtual void addInlineRebate() ; 00137 virtual void updateQty() ; 00138 virtual void checkSessionStatus() ; 00139 virtual void checkDrawerStatus() ; 00140 virtual void checkClear() ; 00141 virtual void checkCancel() ; 00142 virtual void printTicketHead() ; 00143 virtual void checkTotal() ; 00144 virtual void checkPause() ; 00145 virtual void checkSupervisorAccess( const QString & data ) ; 00146 virtual void checkTicketPushPop() ; 00147 virtual void execSuperviseAction() ; 00148 virtual void ticketPush() ; 00149 virtual void ticketRecall( bool std ) ; 00150 virtual void printLine( uint lineno = 0 ) ; 00151 virtual void ticketCancel() ; 00152 virtual void displayAmount( int devdes, double amt ) ; 00153 virtual void cancelLine() ; 00154 virtual void cancelTicket() ; 00155 00156 virtual void errorMsg( const QString & msg ) ; 00157 virtual void showWelcome() ; 00158 00159 virtual void showWithdrawDetail( bool tnew ) ; 00160 virtual void saveFastWithDraw( double value = 0 ) ; 00161 virtual void saveCashWithDraw( int count ) ; 00162 virtual void saveAutomaticWithDraw() ; 00163 virtual void saveGrandTotal() ; 00164 virtual void registerNoSale() ; 00165 virtual void registerPayMode( const QString & value ) ; 00166 virtual void registerRefund( double value ) ; 00167 virtual void registerBalance( double value ) ; 00168 00169 virtual long calcTaxes() ; 00170 virtual void tooManyItems() ; 00171 virtual void printSeparator() ; 00172 virtual void writePrinterDate( bool full = TRUE ) ; 00173 virtual void setPayText( unsigned char keyCode ) ; 00174 00175 virtual QlabCashboxInterfaceDefinition * interf ; 00176 PosStates posActiveStatus ; 00177 PosStates posSavedStatus ; 00178 QMap<uint, QlabTicketLine> activeTicket ; 00180 int userID ; 00181 int userIDsave ; 00182 int cashboxID ; 00183 int ticketNO ; 00184 bool returnOnlyCashbox ; 00185 QString ticketStamp ; 00187 QString login ; 00188 QString loginSave ; 00189 QString passwd ; 00190 QString passwdSave ; 00191 bool inSupervise ; 00192 bool supervisorLoggedIn ; 00193 SuperviseActions superviseAction ; 00195 bool welcomeDisplayed ; 00196 bool printByLine ; 00197 bool showOnly ; 00198 bool showTaxes ; 00199 uint maxItems ; 00200 double ticketTotal ; 00201 int itemQty ; 00203 QString priceControl ; 00204 bool inlineSavings ; 00205 QString recallCode ; 00206 QString recallKey ; 00207 QString activePayMode ; 00208 QString activePayText ; 00210 QlabDatabseCashboxClient * parts ; 00211 QlabDatabseCashboxClient * prods ; 00212 QlabDatabseCashboxClient * opts ; 00213 QlabDatabseCashboxClient * cbevents ; 00214 QlabDatabseCashboxClient * motd ; 00215 QlabDatabseCashboxClient * user ; 00217 QMap<QString, double> withdrawHist ; 00218 bool withdrawstop ; 00220 bool printToPage ; 00221 QString custwelcome ; 00223 QValueStack<PosStates> statusStack ; 00225 } ; 00226 00227 00228 00229 #endif // QLABCASHBOXBASE_H 00230 00231