#ifndef __VE0100_H #define __VE0100_H // Operazioni che pur fare il motore su un documento #define OP_NUOVO 1 #define OP_MODIFICA 2 #define OP_CANCELLA 3 #define OP_STAMPA 4 #define OP_RAGGRUPPA 5 #define OP_USER 6 // Costante per il non-cambiamento di stato #define NO_CHANGE_STATUS -1 #define NO_DOC_STATUS -2 #define F_SHEET 500 #define F_MEMORIGA 501 #define BASE_PIEDE 600 #define CHANGE_MESSAGE "Sono state effettuate modifiche alla configurazione.\nPrima di eseguire la gestione documenti occorrer` rigenerare le maschere.\nDesideri farlo ora ?" // Modifiche pianificate per il dopo/cattolica: // Rorganizzazione del codice come: // Oggetto documento // che contiene: // Array di oggetti riga // Oggetto Cliente // Oggetto Cambio // Oggetto Sconto testa #define F_LBTIPORIGA 175 #define NPIEDI 40 #include #ifndef __CHECKS_H #include #endif #ifndef __EXPR_H #include #endif #ifndef __TABUTIL_H #include #endif #ifndef __BRWAPP_H #include #endif #ifndef __RELAPP_H #include #endif #ifndef __CONFIG_H #include #endif #ifndef __LFFILES_H #include #endif #ifndef __DEFMASK_H #include "defmask.h" #endif #ifndef __VEUML_H #include "veuml.h" #endif #ifndef __VEUML1_H #include "veuml1.h" #endif #ifndef __VERIG_H #include "verig.h" #endif #ifndef __SHEET_H #include #endif #ifndef __REAL_H #include #endif #ifndef __MSKSHEET_H #include #endif #ifndef __VE0100C_H #include "ve0100c.h" #endif #ifndef __VE0100D_H #include "ve0100d.h" #endif #ifndef __TCLIFOR_H #include "tclifor.h" #endif #ifndef __RIGHEDOC_H #include "righedoc.h" #endif #ifndef __VE1000O_H #include "ve1000o.h" #endif #ifndef __VARMASK_H #include #endif #ifndef __EXECP_H #include #endif #ifndef __SCONTI_H #include "sconti.h" #endif class TTipo_documento : public TObject { TString16 _tipodoc; TString16 _profile; TFilename _profile_file; TMask * _mask; protected: const char * profile_name() {return _profile; } const char * profile_file() {return _profile_file; } public: const char * tipodoc() { return _tipodoc;} TConfig * create_profile() { return new TConfig(_profile_file);} TMask & mask() { return *_mask;} TTipo_documento(const char * tipodoc); virtual ~TTipo_documento(); }; // Definizione della classe dell'applicazione motore class TMotore_application : public TRelation_application { // Array di totalizzatori TPiede_documento _piede; // Record array per la gestione delle righe TRecord_array* _righe_rec; // Puntatore al profilo del documento caricato TConfig* _pro; // Puntatore al nome, per evitare di ricrearlo se h uguale TFilename* _proname; // Puntatore alla maschera di ricerca TMask* _msk; // Puntatore alla maschera di modifica/inserimento ( dipende dal profilo ) // TVariable_mask* _msk1; // puntatore alla relazione TRelation* _rel; TLocalisamfile * _rdoc; // Puntatore allo sheet delle righe documento TSheet_field * _sheet; // Oggetto cliente per il motore TCliForVendite* _clifor; // Indica se il documento ha come soggetto un liente o un ornitore char _tipocf; TString16 _profilo; TString16 _codnum; TString16 _tipodoc; int _anno; TString16 _tiponum; long _numdoc; // Array di maschere documento TAssoc_array _doc_masks; // Array di maschere righe TAssoc_array _row_masks; // Ridefinizione dei metodi virtuali virtual bool user_create( ); virtual bool user_destroy( ); virtual TMask* get_mask( int mode ); virtual bool changing_mask( int mode ); virtual TRelation* get_relation( ) const { return _rel;} virtual void init_query_mode(TMask& m); virtual void init_insert_mode( TMask& m ); virtual int read( TMask& m ); virtual bool remove( void ); virtual int write( const TMask& m ); virtual int rewrite( const TMask& m ); // Punti di ingresso per le funzioni utente // Funzioni da associare ad ogni procedura int user_function( int index ); // Funzioni per il calcolo delle righe real user_row_calculate( TRectype& row, int index ); void user_set_handler( int fieldid, int index, TMask* m = NULL ); long prossimo_numero( bool provv ); int avanza_numero( bool provv ); void get_edit_mask( const char * profilo ); void azzera_piedi( ); void carica_piedi( ); void somma_piedi( ); void sottrai_piedi( ); // Esegue, se c'h, la procedura utente relativa ad una certa operazione int esegui_procedura( int operazione ); protected: // Procedure e funzioni per la gestione della maschera e dei files void read_rdoc( TMask& m ); // formato dipendente dallo sheet ( sono le varie colonne ) void load_riga( TSheet_field& f, int numrig, TRectype& r ); void store_riga( TSheet_field& f, int numrig, TRectype& r ); void save( TRelation* r ) const; void set_descr ( int numrig, const char* descr ); void carica_righe_libere( int from = -1 ); bool check_key( TLocalisamfile& rdoc, TString16 codnum, bool provv, TString16 _anno, TString16 _ndoc ); // Procedure e funzioni per la gestione degli stati // void setta_stato_corrente( int nuovostato ); const char* nome_sezione( int op ); int stato_corrente( ); int stato_finale( int operazione ); bool stato_valido( int stato, int operazione ); void segnala_stato_non_valido( int operazione ); TString& stati_validi( int operazione ){ return ( pro( ).get( "STATIVALIDI", nome_sezione( operazione ) ) );} // Handle che ritorna la maschera per le righe static TMask * ss_getmask( int numriga, TMask& fullmask, bool destroy ); // Handler che gestisce la richiesta del tipo riga in inserimento static bool ss_handler( TSheet_field& ss, int r, KEY key ); // Handler per la maschera di ricerca static bool ndoc_handler( TMask_field& f, KEY key ); static bool num_handler( TMask_field& f, KEY key ); static bool tip_handler( TMask_field& f, KEY key ); // Handler per la maschera di modifica static bool clifo_handler( TMask_field& f, KEY key ); static bool occas_handler( TMask_field& f, KEY key ); static bool val_handler( TMask_field& f, KEY key ); static bool elabora_handler( TMask_field& f, KEY key ); // Configurazione dello sheet dato il profilo void configura_sheet( TSheet_field& sheet, TConfig& config ); // Funzione per la sostituzione delle variabili nella decodifica // delle espressioni di una riga void carica_variabile( TExpression& e, const char * varname, TRectype r ); public: // Funzioni di accesso alle variabili private TRecord_array& righe_rec( ) { CHECK( _righe_rec, "Record array delle righe nullo!" ); return * _righe_rec; } TConfig& pro( ) { CHECK( _pro, "Profilo del documento nullo!" ); return *_pro; } TFilename& proname( ) { CHECK( _proname, "Nome del profilo nullo!" ); return *_proname; } TMask& query_mask( ) { CHECK( _msk, "Maschera di ricerca nulla!" ); return *_msk; } TMask& edit_mask( ) { return (TMask &) _doc_masks[_tipodoc]; } TRelation& rel( ) { CHECK( _rel, "Relazione nulla!" ); return *_rel; } TSheet_field& sheet( ) { CHECK( _sheet, "Sheet nullo!" ); return *_sheet; } TCliForVendite& clifo( ) { CHECK( _clifor, "Oggetto cliente nullo!" ); return *_clifor; } TPiede_documento& piede( ){ return _piede; } // Operazione const char tipocf( ) { return _tipocf; } void tipocf( const char tcf ) { _tipocf = tcf; } bool valida_operazione( int operazione ); TSheet_field & ss( ) const { return *_sheet; } TMotore_application( ) { _pro = NULL; } virtual ~TMotore_application( ) { if ( _pro ) delete _pro; } virtual const char* get_next_key( ); }; TMotore_application& app( ); #endif