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 #include <qlabticketline.h> 00043 class QlabDatabaseCashboxClient ; 00044 00045 class Q_EXPORT QlabCashboxBase : public QObject 00046 { 00047 Q_OBJECT 00048 00049 Q_ENUMS( PosStates ) 00050 Q_ENUMS( LineTypes ) 00051 Q_ENUMS( SuperviseActions ) 00052 00053 public : 00054 QlabCashboxBase( QObject * parent = 0, char * name = 0 ) ; 00055 ~QlabCashboxBase() ; 00056 00063 enum PosStates { STATUS_WaitForLogin, 00064 STATUS_WaitForPassword, 00065 STATUS_InPause, 00066 STATUS_ReadyForTransaction, 00067 STATUS_InTransaction, 00068 STATUS_DrawerOpenQuery, 00069 STATUS_DrawerOpen, 00070 STATUS_CancelLine, 00071 STATUS_CancelTicket, 00072 STATUS_PushTicket, 00073 STATUS_PopTicket, 00075 STATUS_Tender, 00076 STATUS_TENDER_KEYBOARD, 00077 STATUS_TENDER_MSR, 00078 STATUS_TENDER_CASH, 00079 STATUS_DRAWER_CLOSED, 00080 STATUS_PRINTER_ERROR, 00081 STATUS_TENDER_CHEQUER, 00082 STATUS_REMOVE_CHEQUE, 00083 STATUS_TENDER_MAN_CHEQUER, 00084 STATUS_CANCEL_MODE, 00085 STATUS_PRINT_FEATURES, 00086 STATUS_REQUIRE_SUPERVISOR, 00087 STATUS_WITHDRAW, 00088 STATUS_WITHDRAW_FAST, 00089 STATUS_WITHDRAW_DETAIL } ; 00096 enum SuperviseActions { SuperviseNone, 00097 SuperTicketPush, 00098 SuperTicketRecall, 00099 SuperTicketCancel, 00100 SuperPayModeForce 00101 } ; 00102 00103 00104 public slots : 00105 virtual void setup() ; 00106 00107 virtual void drawerOpen() ; 00108 virtual void drawerClosed() ; 00109 virtual void endTransaction() ; 00110 virtual void showKeyboardData( const QString & data ) ; 00111 virtual void enterKeyPressed( const QString & data ) ; 00112 virtual void keyPressed( unsigned char keyCode ) ; 00113 virtual void processMagneticStrip( const QString & data ) ; 00114 virtual void getScannerData( const QString & data ) ; 00115 virtual void processCheckNumber( const QString & data ) ; 00116 virtual void checkSupervise( bool ss ) ; 00117 virtual void checkInterfaceStatus( int st ) ; 00118 virtual void processHardwareErrors( int errNo, int severity, const QString & descr ) ; 00119 virtual void processDeviceStatus( const QString & status ) ; 00120 virtual void processDeviceOnlineStatus( const QString & descr ) ; 00121 virtual void printerChanged( int newPrinter ) ; 00122 00123 virtual bool removeLine( int lineno ) ; 00124 virtual void postError( const QString & msg ) ; 00125 00126 private : 00127 virtual void newTicket() ; 00128 00129 virtual void postLogin( const QString & data ) ; 00130 virtual void checkUser( const QString & data ) ; 00131 virtual void confirmPass( const QString & data ) ; 00132 virtual void findItem( const QString & serial ) ; 00133 virtual void duplicateLast() ; 00134 virtual void addProductToBasket( bool negate = FALSE ) ; 00135 virtual void addInlineRebate() ; 00136 virtual void updateQty() ; 00137 virtual void checkSessionStatus() ; 00138 virtual void checkDrawerStatus() ; 00139 virtual void checkClear() ; 00140 virtual void checkCancel() ; 00141 virtual void printTicketHead() ; 00142 virtual void checkTotal() ; 00143 virtual void checkPause() ; 00144 virtual void checkSupervisorAccess( const QString & data ) ; 00145 virtual void checkTicketPushPop() ; 00146 virtual void execSuperviseAction() ; 00147 virtual void ticketPush() ; 00148 virtual void ticketRecall( bool std ) ; 00149 virtual void printLine( uint lineno = 0 ) ; 00150 virtual void ticketCancel() ; 00151 virtual void displayAmount( int devdes, double amt ) ; 00152 virtual void cancelLine() ; 00153 virtual void cancelTicket() ; 00154 00155 virtual void errorMsg( const QString & msg ) ; 00156 virtual void showWelcome() ; 00157 00158 virtual void showWithdrawDetail( bool tnew ) ; 00159 virtual void saveFastWithDraw( double value = 0 ) ; 00160 virtual void saveCashWithDraw( int count ) ; 00161 virtual void saveAutomaticWithDraw() ; 00162 virtual void saveGrandTotal() ; 00163 virtual void registerNoSale() ; 00164 virtual void registerPayMode( const QString & value ) ; 00165 virtual void registerRefund( double value ) ; 00166 virtual void registerBalance( double value ) ; 00167 00168 virtual long calcTaxes() ; 00169 virtual void tooManyItems() ; 00170 virtual void printSeparator() ; 00171 virtual void writePrinterDate( bool full = TRUE ) ; 00172 virtual void setPayText( unsigned char keyCode ) ; 00173 00174 QlabCashboxInterfaceDefinition * interf ; 00175 PosStates posActiveStatus ; 00176 PosStates posSavedStatus ; 00177 QMap<uint, QlabTicketLine * > activeTicket ; 00179 int userID ; 00180 int userIDsave ; 00181 int cashboxID ; 00182 int ticketNo ; 00183 bool returnOnlyCashbox ; 00184 QString ticketStamp ; 00186 QString login ; 00187 QString loginSave ; 00188 QString passwd ; 00189 QString passwdSave ; 00190 bool inSupervise ; 00191 bool supervisorLoggedIn ; 00192 SuperviseActions superviseAction ; 00194 bool welcomeDisplayed ; 00195 bool printByLine ; 00196 bool showOnly ; 00197 bool showTaxes ; 00198 uint maxItems ; 00199 double ticketTotal ; 00200 int itemQty ; 00202 QString priceControl ; 00203 bool inlineSavings ; 00204 QString recallCode ; 00205 QString recallKey ; 00206 QString activePayMode ; 00207 QString activePayText ; 00209 QlabDatabaseCashboxClient * parts ; 00210 QlabDatabaseCashboxClient * prods ; 00211 QlabDatabaseCashboxClient * opts ; 00212 QlabDatabaseCashboxClient * cbevents ; 00213 QlabDatabaseCashboxClient * motd ; 00214 QlabDatabaseCashboxClient * user ; 00216 QMap<QString, double> withdrawHist ; 00217 bool withdrawstop ; 00219 bool printToPage ; 00220 QString custwelcome ; 00222 QValueStack<PosStates> statusStack ; 00224 } ; 00225 00226 00227 00228 #endif // QLABCASHBOXBASE_H 00229 00230