#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 CHANGE_MESSAGE "Sono state effettuate modifiche alla configurazione.\nPrima di eseguire la gestione documenti occorre rigenerare le maschere.\nDesideri farlo ora ?" #ifndef __CHECKS_H #include #endif #ifndef __EXPR_H #include #endif #ifndef __TABUTIL_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 __VARMASK_H #include #endif #ifndef __EXECP_H #include #endif #ifndef __SCONTI_H #include "sconti.h" #endif #ifndef __VELIB_H #include "velib.h" #endif // Definizione della classe dell'applicazione motore class TMotore_application : public TRelation_application { TArray _file; // Tutti i fiels da usare TDocumento * _doc; // Puntatore al profilo del documento caricato TConfig * _pro; TConfig * _config_ditta; // Puntatore alla maschera di ricerca TMask * _msk; TMask * _occas_mask; // puntatore alla relazione TRelation * _rel; // Puntatore allo sheet delle righe documento TSheet_field * _sheet; // Oggetto cliente per il motore // TCli_for_vendite * _clifor; TCond_vendita * _condv; // Indica se il documento ha come soggetto un liente o un ornitore char _tipocf; TString16 _codnum; TString16 _tipodoc; // Array di maschere documento TAssoc_array _doc_masks; TLista_elaborazioni _elab; // 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 void init_query_mode(TMask& m); virtual void init_insert_mode( TMask& m ); virtual void init_modify_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 ); // Esegue, se c'h, la procedura utente relativa ad una certa operazione int esegui_procedura( int operazione ); protected: void open_files(int logicnum, ...); void close_files() { _file.destroy(); } virtual void on_firm_change(); // Procedure e funzioni per la gestione della maschera e dei files void read_rdoc( TMask& m ); void update_profile(); void set_descr ( int numrig, const char* descr ); // Procedure e funzioni per la gestione degli stati 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); // 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 ); static bool occas_code_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 elabora_handler( TMask_field& f, KEY key ); static bool print_handler( TMask_field& f, KEY key ); // Configurazione dello sheet dato il profilo void configura_sheet( TSheet_field& sheet, TConfig& config ); public: virtual TRelation* get_relation( ) const { return _rel;} // Funzioni di accesso alle variabili private TConfig & pro() { CHECK( _pro, "Profilo del documento nullo!" ); return *_pro; } const TFilename & proname() { return _pro->name(); } TMask & query_mask() { CHECK( _msk, "Maschera di ricerca nulla!" ); return *_msk; } TMask & edit_mask() { return (TMask &) _doc_masks[_doc->tipo().codice()]; } TRelation & rel() { CHECK( _rel, "Relazione nulla!" ); return *_rel; } TSheet_field & sheet() { CHECK( _sheet, "Sheet nullo!" ); return *_sheet; } TCond_vendita & condv() { return *_condv; } TConfig & config_ditta() {return *_config_ditta; } TLista_elaborazioni & elab() { return _elab; } TDocumento & doc() {return *_doc; } // 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( ); }; inline TMotore_application & app() { return (TMotore_application &) main_app(); } #endif