1995-12-04 17:41:06 +00:00
# ifndef __VE0100_H
# define __VE0100_H
1996-06-18 15:55:39 +00:00
// Operazioni che pur fare il motore su un documento
1995-08-07 07:59:09 +00:00
# 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
1995-09-14 13:59:52 +00:00
# define F_MEMORIGA 501
1995-08-07 07:59:09 +00:00
# define BASE_PIEDE 600
1995-12-04 17:41:06 +00:00
1996-06-18 15:55:39 +00:00
# define CHANGE_MESSAGE "Sono state effettuate modifiche alla configurazione.\nPrima di eseguire la gestione documenti occorrer` rigenerare le maschere.\nDesideri farlo ora ?"
1995-12-04 17:41:06 +00:00
// 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
1996-05-03 17:11:39 +00:00
# ifndef __VERIG_H
# include "verig.h"
1995-12-04 17:41:06 +00:00
# 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 __VE1000O_H
# include "ve1000o.h"
# endif
1996-03-20 16:15:18 +00:00
# ifndef __VARMASK_H
# include <varmask.h>
1995-12-04 17:41:06 +00:00
# endif
# ifndef __EXECP_H
1996-03-20 16:15:18 +00:00
# include <execp.h>
1995-12-04 17:41:06 +00:00
# endif
# ifndef __SCONTI_H
# include "sconti.h"
# endif
1996-05-03 17:11:39 +00:00
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 ( ) ;
} ;
1995-12-04 17:41:06 +00:00
// 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 ;
1996-06-18 15:55:39 +00:00
// Puntatore al nome, per evitare di ricrearlo se h uguale
1995-12-04 17:41:06 +00:00
TFilename * _proname ;
// Puntatore alla maschera di ricerca
TMask * _msk ;
// Puntatore alla maschera di modifica/inserimento ( dipende dal profilo )
1996-05-03 17:11:39 +00:00
// TVariable_mask* _msk1;
1995-12-04 17:41:06 +00:00
// puntatore alla relazione
TRelation * _rel ;
1996-06-18 15:55:39 +00:00
TLocalisamfile * _rdoc ;
1995-12-04 17:41:06 +00:00
// Puntatore allo sheet delle righe documento
1996-03-20 16:15:18 +00:00
TSheet_field * _sheet ;
1995-12-04 17:41:06 +00:00
// Oggetto cliente per il motore
TCliForVendite * _clifor ;
// Indica se il documento ha come soggetto un <C>liente o un <F>ornitore
char _tipocf ;
1996-05-03 17:11:39 +00:00
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 ;
1995-12-04 17:41:06 +00:00
// 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 ; }
1996-05-03 17:11:39 +00:00
virtual void init_query_mode ( TMask & m ) ;
1995-12-04 17:41:06 +00:00
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 ( ) ;
1996-06-18 15:55:39 +00:00
// Esegue, se c'h, la procedura utente relativa ad una certa operazione
1995-12-04 17:41:06 +00:00
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 ) ;
1996-03-05 16:48:04 +00:00
static bool elabora_handler ( TMask_field & f , KEY key ) ;
1995-12-04 17:41:06 +00:00
// 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 ; }
1996-05-03 17:11:39 +00:00
TMask & edit_mask ( ) { return ( TMask & ) _doc_masks [ _tipodoc ] ; }
1995-12-04 17:41:06 +00:00
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
1996-03-20 16:15:18 +00:00
const char tipocf ( ) { return _tipocf ; }
void tipocf ( const char tcf ) { _tipocf = tcf ; }
1995-12-04 17:41:06 +00:00
bool valida_operazione ( int operazione ) ;
1996-03-20 16:15:18 +00:00
TSheet_field & ss ( ) const { return * _sheet ; }
1995-12-04 17:41:06 +00:00
TMotore_application ( ) { _pro = NULL ; }
virtual ~ TMotore_application ( ) { if ( _pro ) delete _pro ; }
virtual const char * get_next_key ( ) ;
} ;
TMotore_application & app ( ) ;
# endif