3d6e47e8ae
TDocumento. (Separato da ve1100). In ve0100.h e ve0100.cpp ho spostato la definizione di app(). (Dal .cpp al .h). git-svn-id: svn://10.65.10.50/trunk@3404 c028cbd2-c16b-5b4b-a496-9718f37d4682
286 lines
7.3 KiB
C++
Executable File
286 lines
7.3 KiB
C++
Executable File
#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 occorre 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 <xvt_defs.h>
|
|
|
|
#ifndef __CHECKS_H
|
|
#include <checks.h>
|
|
#endif
|
|
|
|
#ifndef __EXPR_H
|
|
#include <expr.h>
|
|
#endif
|
|
|
|
#ifndef __TABUTIL_H
|
|
#include <tabutil.h>
|
|
#endif
|
|
|
|
#ifndef __BRWAPP_H
|
|
#include <brwapp.h>
|
|
#endif
|
|
|
|
#ifndef __RELAPP_H
|
|
#include <relapp.h>
|
|
#endif
|
|
|
|
#ifndef __CONFIG_H
|
|
#include <config.h>
|
|
#endif
|
|
|
|
#ifndef __LFFILES_H
|
|
#include <lffiles.h>
|
|
#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 <sheet.h>
|
|
#endif
|
|
|
|
#ifndef __REAL_H
|
|
#include <real.h>
|
|
#endif
|
|
|
|
#ifndef __MSKSHEET_H
|
|
#include <msksheet.h>
|
|
#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 __VARMASK_H
|
|
#include <varmask.h>
|
|
#endif
|
|
|
|
#ifndef __EXECP_H
|
|
#include <execp.h>
|
|
#endif
|
|
|
|
#ifndef __SCONTI_H
|
|
#include "sconti.h"
|
|
#endif
|
|
|
|
#ifndef __VELIB01_H
|
|
#include "velib01.h"
|
|
#endif
|
|
|
|
// Definizione della classe dell'applicazione motore
|
|
class TMotore_application : public TRelation_application
|
|
{
|
|
|
|
TArray _file; // Tutti i fiels da usare
|
|
// Array di totalizzatori
|
|
TPiede_documento _piede;
|
|
|
|
TDocumento * _doc;
|
|
|
|
// Puntatore al profilo del documento caricato
|
|
TConfig * _pro;
|
|
TConfig * _config_ditta;
|
|
|
|
// Puntatore alla maschera di ricerca
|
|
TMask * _msk;
|
|
|
|
// puntatore alla relazione
|
|
TRelation * _rel;
|
|
|
|
// Puntatore allo sheet delle righe documento
|
|
TSheet_field * _sheet;
|
|
|
|
// Oggetto cliente per il motore
|
|
TCliForVendite * _clifor;
|
|
|
|
TCond_vendita * _condv;
|
|
|
|
// Indica se il documento ha come soggetto un <C>liente o un <F>ornitore
|
|
char _tipocf;
|
|
|
|
// TString16 _profilo;
|
|
// TString16 _codnum;
|
|
// TString16 _tipodoc;
|
|
// int _anno;
|
|
// TString16 _tiponum;
|
|
// long _numdoc;
|
|
// int _statodoc;
|
|
|
|
// 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 );
|
|
|
|
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:
|
|
|
|
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();
|
|
|
|
|
|
// 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 );
|
|
|
|
// 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 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
|
|
|
|
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; }
|
|
TCliForVendite & clifo() { CHECK( _clifor, "Oggetto cliente nullo!" ); return *_clifor; }
|
|
TPiede_documento & piede() { return _piede; }
|
|
TCond_vendita & condv() { return *_condv; }
|
|
TConfig & config_ditta() {return *_config_ditta; }
|
|
|
|
// 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( ) { return ( TMotore_application& ) main_app( ); }
|
|
#endif
|