Modifiche varie ed eventuali. Iniziato l'oggetto cliente

git-svn-id: svn://10.65.10.50/trunk@1787 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
matteo 1995-09-06 13:53:23 +00:00
parent 8a1e81ca02
commit 0a2b57b225
2 changed files with 2159 additions and 2119 deletions

View File

@ -29,7 +29,7 @@
#endif #endif
#ifndef __VEUML_H #ifndef __VEUML_H
#include "VEUML.H" #include "veuml.h"
#endif #endif
#ifndef __SHEET_H #ifndef __SHEET_H
@ -45,15 +45,19 @@
#endif #endif
#ifndef __VE0100_H #ifndef __VE0100_H
#include "VE0100.H" #include "ve0100.h"
#endif #endif
#ifndef __VE0100C_H #ifndef __VE0100C_H
#include "VE0100C.H" #include "ve0100C.h"
#endif #endif
#ifndef __VE0100D_H #ifndef __VE0100D_H
#include "VE0100D.H" #include "ve0100D.h"
#endif
#ifndef __TCLIFOR_H
#include "tclifor.h"
#endif #endif
// Numero di colonne presenti sullo sheet totale // Numero di colonne presenti sullo sheet totale
@ -88,12 +92,6 @@ class TMotore_application : public TRelation_application
// Puntatore allo sheet delle righe documento // Puntatore allo sheet delle righe documento
TSheet_field* _sheet; TSheet_field* _sheet;
// Posizione delle colonne nello sheet
int _pos_cols[ MAX_COLUMNS ];
// Numero di colonne realmente presenti sullo sheet
int _realcols;
// Ridefinizione dei metodi virtuali // Ridefinizione dei metodi virtuali
virtual bool user_create( ); virtual bool user_create( );
virtual bool user_destroy( ); virtual bool user_destroy( );
@ -184,13 +182,10 @@ public:
virtual ~TMotore_application( ) { if ( _pro ) delete _pro; } virtual ~TMotore_application( ) { if ( _pro ) delete _pro; }
virtual const char* get_next_key( ); virtual const char* get_next_key( );
int numero_colonne( ){ return _realcols; }
int posizione_colonna( int index ){ return _pos_cols[ index ]; }
}; };
HIDDEN TMotore_application& app( ) { return (TMotore_application&) main_app( ); } HIDDEN TMotore_application& app( ) { return (TMotore_application&) main_app( ); }
int TMotore_application::user_function( int index ) int TMotore_application::user_function( int index )
{ {
switch( index ) switch( index )
@ -271,7 +266,7 @@ void TMotore_application::user_set_handler( int fieldid, int index )
bool TMotore_application::ss_handler( TSheet_field& ss, int r, KEY key ) bool TMotore_application::ss_handler( TSheet_field& ss, int r, KEY key )
{ {
if ( key == K_INS ) if ( key == K_INS ) // Inserimento
{ {
TMask& m = *app( )._msk1; TMask& m = *app( )._msk1;
TTable tabtr( "%TRI" ); TTable tabtr( "%TRI" );
@ -281,43 +276,34 @@ bool TMotore_application::ss_handler( TSheet_field& ss, int r, KEY key )
TToken_string& riga = ss.row( r ); TToken_string& riga = ss.row( r );
riga.add( 1, 0 ); riga.add( 1, 0 );
riga.add( m.get( F_LBTIPORIGA ), 1 ); riga.add( m.get( F_LBTIPORIGA ), 1 );
riga.add( tabtr.get( "S4" ), 2 );
return TRUE;
};
if ( key == K_CTRL + K_INS ) // Dopo inserimento
{
TMask& m = *app( )._msk1;
TTable tabtr( "%TRI" );
tabtr.zero( );
tabtr.put( "CODTAB", m.get( F_LBTIPORIGA ) );
tabtr.read( );
TToken_string& riga = ss.row( r );
TFilename nome_proriga( tabtr.get( "S4" ) ); TFilename nome_proriga( tabtr.get( "S4" ) );
riga.add( nome_proriga, 2 );
nome_proriga.ext( "ini" ); nome_proriga.ext( "ini" );
TConfig pro( nome_proriga ); TConfig pro( nome_proriga );
int ncols = pro.get_int( "NCOLS", "COLUMNS" ); int ncols = pro.get_int( "NCOLS", "COLUMNS" );
// Disabilita tutte le colonne // Disabilita tutte le colonne
for( int i = 1; i < app( ).numero_colonne( ); i ++ ) for( int i = 1; i <= MAX_COLUMNS; i ++ )
ss.disable_cell ( ss.items( ) - 1, i ); ss.disable_cell ( ss.items( ) - 1, i );
for( i = 1; i < ncols; i ++ ) // Abilita le colonne indicate nel profilo della riga
for( i = 1; i <= ncols; i ++ )
{ {
TString16 chiave; TString16 chiave;
chiave.format( "%d", i ); chiave.format( "%d", i );
int coltoenable = pro.get_int( chiave, "COLUMNS" ); int coltoenable = pro.get_int( chiave, "COLUMNS" );
ss.enable_cell ( ss.items( ) - 1, app().posizione_colonna( coltoenable ) ); ss.enable_cell ( ss.items( ) - 1, coltoenable - 1 );
}; };
ss.force_update( ); ss.force_update( );
app( ).curr_mask( ).send_key( K_ROWEDIT, F_SHEET ); app( ).curr_mask( ).send_key( K_ROWEDIT, F_SHEET );
// ss.on_key( K_SPACE );
// ss.edit( ss.items( ) );
/*
nome_proriga.ext( "ini" );
TConfig proriga( nome_proriga );
TMask *sm = new TMask( proriga.get( "MSK", "MAIN" ) );
// int numhandler = proriga.get_int( "NHANDLER", "HANDLERS" );
// for( int i = 1; i <= numhandler; i ++ )
// {
// TString chiave;
// chiave.format( "%d", i );
// TToken_string riga = proriga.get( chiave, "HANDLERS" );
// app().user_set_handler( riga.get_int( 0 ), riga.get_int( 1 ) );
// };
sm->disable( DLG_DELREC );
if ( sm->run( ) == K_ENTER )
{
// Riga inserita, vai col disabilitare le colonne
delete sm;
ss.force_update( ); */
return TRUE; return TRUE;
}; };
return TRUE; return TRUE;
@ -351,7 +337,11 @@ bool TMotore_application::num_handler( TMask_field& f, KEY key )
// Copio la descriozione della numerazione // Copio la descriozione della numerazione
m.set(F_DESNUM, tabnum.get("S0") ); m.set(F_DESNUM, tabnum.get("S0") );
// Copio i tipi di documento validi per la numerazione // Copio i tipi di documento validi per la numerazione
m.set(F_TIPIDOCS, tabnum.get("S2") ); const TString tipidocs( tabnum.get("S2") );
m.set(F_TIPIDOCS, tipidocs );
// Propone il primo tipo di documento come default
m.set(F_TIPODOC, tipidocs.left( 4 ) );
// Se per questa numerazione è abilitata le numerazione provvisoria // Se per questa numerazione è abilitata le numerazione provvisoria
if ( tabnum.get_bool ( "B0" ) ) if ( tabnum.get_bool ( "B0" ) )
{ {
@ -398,16 +388,30 @@ bool TMotore_application::tip_handler(TMask_field& f, KEY key)
return TRUE; return TRUE;
} }
TString tipi_consentiti( m.get( F_TIPIDOCS ) ); TString tipi_consentiti( m.get( F_TIPIDOCS ) );
TString tipo( f.get( ) ); TString16 tipo( f.get( ) );
if( tipi_consentiti.find( tipo ) % 4 ) tipo.trim( );
{ message_box( "Tipo non valido per la numerazione selezionata!" ); bool tipo_valido = FALSE;
for ( int i = 0; i < 10; i ++ )
{
TString16 curtipo( tipi_consentiti.mid( i * 4, 4 ) );
curtipo.trim( );
if( curtipo == tipo )
{
tipo_valido = TRUE;
break;
}
}
if( ! tipo_valido )
{
message_box( "Tipo non valido per la numerazione selezionata!" );
f.set( "" ); f.set( "" );
return FALSE; } return FALSE;
}
TTable tabtip( "%TIP" ); TTable tabtip( "%TIP" );
tabtip.read( ); tabtip.read( );
m.set(F_DESTIPODOC, tabtip.get("S0") ); m.set(F_DESTIPODOC, tabtip.get("S0") );
m.set(F_PROFILO, tabtip.get("S4") ); m.set(F_PROFILO, tabtip.get("S4") );
}; }
if (key == K_ENTER && m.is_running( ) ) if (key == K_ENTER && m.is_running( ) )
{ TString tipo( f.get( ) ); { TString tipo( f.get( ) );
if ( ! tipo.blank( ) ) if ( ! tipo.blank( ) )
@ -464,8 +468,8 @@ bool TMotore_application::changing_mask(int mode)
void TMotore_application::configura_sheet( TSheet_field& sheet, TConfig& config ) void TMotore_application::configura_sheet( TSheet_field& sheet, TConfig& config )
{ {
_realcols = config.get_int( "NCOLS", "SHEET" ); int ncols = config.get_int( "NCOLS", "SHEET" );
for( int i = 1; i <= _realcols; i ++ ) for( int i = 1; i <= ncols; i ++ )
{ {
TString col; TString col;
col.format( "%d", i ); col.format( "%d", i );
@ -478,7 +482,6 @@ void TMotore_application::configura_sheet( TSheet_field& sheet, TConfig& config
sheet.set_column_width( i, sheet_col.get_int( 2 ) ); sheet.set_column_width( i, sheet_col.get_int( 2 ) );
int coltomove = sheet_col.get_int( 0 ) - 1; int coltomove = sheet_col.get_int( 0 ) - 1;
sheet.move_column( coltomove, i ); sheet.move_column( coltomove, i );
_pos_cols[ coltomove ] = i;
}; };
for ( int j = MAX_COLUMNS; j >= i - 1; j -- ) for ( int j = MAX_COLUMNS; j >= i - 1; j -- )
sheet.delete_column( j ); sheet.delete_column( j );
@ -808,6 +811,14 @@ void TMotore_application::calcola_riga( TRectype& r )
bool TMotore_application::user_create( ) bool TMotore_application::user_create( )
{ {
TCliFor C;
C.load( 'C', 1 );
TString s;
TString s1( C.get( LF_CLIFO, "RAGSOC" ) );
TString s2( C.get( LF_CFVEN, "CODINDDOC" ) );
s.format( "%s:%d", ( const char * )s1, atoi( s2 ) );
message_box( ( const char * ) s );
azzera_piedi( ); azzera_piedi( );
_msk = new TMask("VE1000A"); _msk = new TMask("VE1000A");
query_mask( ).set_handler( F_NDOC, ndoc_handler ); query_mask( ).set_handler( F_NDOC, ndoc_handler );
@ -819,14 +830,11 @@ bool TMotore_application::user_create( )
// Metto in relazione testata e righe // Metto in relazione testata e righe
_rel = new TRelation(LF_DOC); _rel = new TRelation(LF_DOC);
rel( ).add( LF_RIGHEDOC,"CODNUM=CODNUM;ANNO=ANNO;PROVV=PROVV;NDOC=NDOC" ); rel( ).add( LF_RIGHEDOC,"CODNUM=CODNUM|ANNO=ANNO|PROVV=PROVV|NDOC=NDOC" );
// Inizializzo il Record_array // Inizializzo il Record_array
_righe_rec = new TRecord_array( LF_RIGHEDOC, "NRIGA", 1 ); _righe_rec = new TRecord_array( LF_RIGHEDOC, "NRIGA", 1 );
// Inizializzo l'array con la posizione delle colonne
for( int i = 0; i <= MAX_COLUMNS; i ++ )
_pos_cols[ i ] = -1;
return TRUE; return TRUE;
} }

View File

@ -80,7 +80,7 @@
// Numero massimo di linee per pagina // Numero massimo di linee per pagina
#define MAX_LINES_PER_PAGE 17 #define MAX_LINES_PER_PAGE 16
#define MASK_FIRST_LINE 6 #define MASK_FIRST_LINE 6
class TMaschera : public TObject class TMaschera : public TObject
@ -211,35 +211,53 @@ void TMaschera::check( const int i )
void TMaschera::control( const int type, const int id, const int size ) void TMaschera::control( const int type, const int id, const int size )
{ {
switch ( type ) switch ( type )
{ case T_DATE : _out << "DA"; break; {
case T_STRING : _out << "ST"; break; case T_DATE:
case T_BOOLEAN : _out << "BO"; break; _out << "DA";
case T_NUMBER : _out << "NU"; break; break;
case T_LISTBOX : _out << "LI"; break; case T_STRING:
case T_MEMO : _out << "ME"; break; _out << "ST";
case T_GROUPBOX : _out << "GR"; break; break;
}; case T_BOOLEAN:
_out << "BO";
break;
case T_NUMBER:
_out << "NU";
break;
case T_LISTBOX:
_out << "LI";
break;
case T_MEMO:
_out << "ME";
break;
case T_GROUPBOX:
_out << "GR";
break;
}
_out << " " << id; _out << " " << id;
if ( size > 0 ) if ( size > 0 )
{ if ( size > 100 ) {
if ( size > 100 )
_out << " " << ( int )( size / 100 ) << " " << ( size % 100 ); _out << " " << ( int )( size / 100 ) << " " << ( size % 100 );
else else
_out << " " << size; _out << " " << size;
}; }
_out << "\n"; _out << "\n";
} }
void TMaschera::item( const TString& str ) void TMaschera::item( const TString& str )
{ int i, j; {
int i, j;
TToken_string u( str, '@' ); TToken_string u( str, '@' );
TToken_string s; TToken_string s;
for( i = 0; i < u.items(); i ++ ) for( i = 0; i < u.items(); i ++ )
{ _out << "IT \"" << s[ 0 ] << "\"\n"; {
_out << "IT \"" << s[ 0 ] << "\"\n";
for( j = 1; j < s.items(); j ++ ) for( j = 1; j < s.items(); j ++ )
_out << "ME " << s[ j ] << "\n"; _out << "ME " << s[ j ] << "\n";
} }
} }
class TGruppo : public TObject class TGruppo : public TObject
{ {
@ -362,6 +380,7 @@ TField::TField( TString& campo, TConfig& pro ) : _nome( campo )
_gruppo = pro.get_int( "GROUP", campo ); _gruppo = pro.get_int( "GROUP", campo );
CHECK( _gruppo != 0, "Gruppo uguale a 0" ); CHECK( _gruppo != 0, "Gruppo uguale a 0" );
_id = pro.get_int( "MSKID", campo ); _id = pro.get_int( "MSKID", campo );
CHECK( _id != 0, "Campo con MSKID uguale a 0" );
_type = pro.get_int( "TYPE", campo ); _type = pro.get_int( "TYPE", campo );
_size = pro.get_int( "SIZE", campo ); _size = pro.get_int( "SIZE", campo );
_prompt = pro.get( "PROMPT", campo ); _prompt = pro.get( "PROMPT", campo );
@ -419,7 +438,7 @@ TField::TField( )
_configs.separator( '~' ); _configs.separator( '~' );
_items = ""; _items = "";
_items.separator( '@' ); _items.separator( '@' );
}; }
void TField::configura( TConfig& pro ) void TField::configura( TConfig& pro )
{ {
@ -445,7 +464,8 @@ void TField::genera( TMaschera& m )
m.control( _type, _id ); m.control( _type, _id );
m.begin(); m.begin();
switch( _stato ) switch( _stato )
{ case FS_HIDDEN: {
case FS_HIDDEN:
m.prompt( 2, 2 ); m.prompt( 2, 2 );
s = "H"; s = "H";
s << _flag; s << _flag;
@ -456,13 +476,11 @@ void TField::genera( TMaschera& m )
s = "D"; s = "D";
s << _flag; s << _flag;
m.flag( s ) ; m.flag( s ) ;
// m.advance_line( );
break; break;
case FS_NORMAL : case FS_NORMAL :
case FS_REQUIRED : case FS_REQUIRED :
m.prompt( _x, _y + m.line( ), _prompt ); m.prompt( _x, _y + m.line( ), _prompt );
m.flag( _flag ); m.flag( _flag );
// m.advance_line( );
break; break;
} }
m.check( _stato ); m.check( _stato );
@ -477,10 +495,11 @@ void TField::genera( TMaschera& m )
if ( !_special.blank( ) ) m.outline( _special ); if ( !_special.blank( ) ) m.outline( _special );
m.end(); m.end();
if ( ( m.line() > MAX_LINES_PER_PAGE ) && ( m._pageopen == TRUE)) if ( ( m.line() > MAX_LINES_PER_PAGE ) && ( m._pageopen == TRUE))
{ m.end(); {
m.end();
m._pageopen = FALSE; m._pageopen = FALSE;
m.line( MASK_FIRST_LINE ); m.line( MASK_FIRST_LINE );
}; }
} }
@ -621,22 +640,27 @@ void TMask_generator::carica_dati_campi( const TFilename& fn, TArray& a )
TField *campo = NULL; TField *campo = NULL;
while ( infile.ok( ) ) while ( infile.ok( ) )
{ line = infile.line( ); {
while ( ( line.empty() || line[ 0 ] == '#' ) && infile.ok( ) ) line = infile.line( );
{ line = infile.line( ); line.trim( );
line.trim(); } while ( ( line.empty() || line[ 0 ] == '#' || line.left( 2 ) == "//" ) && infile.ok( ) )
{
line = infile.line( );
line.trim();
}
if( infile.ok( ) ) if( infile.ok( ) )
{ if ( line[ 0 ] == '[' ) // Carica un un campo {
{ line.strip( "[]" ); if ( line[ 0 ] == '[' ) // Carica un un campo
{
line.strip( "[]" );
if ( campo ) if ( campo )
{ a.add( campo ); a.add( campo );
// delete campo;
};
campo = new TField(); campo = new TField();
campo->nome( line ); campo->nome( line );
} }
else else
{ int pos; {
int pos;
if( ( pos = line.find( '=' ) ) == 0 ) if( ( pos = line.find( '=' ) ) == 0 )
yesnofatal_box( "Linea errata nel file.INI: %s", (const char *) line ); yesnofatal_box( "Linea errata nel file.INI: %s", (const char *) line );
else else
@ -646,53 +670,55 @@ void TMask_generator::carica_dati_campi( const TFilename& fn, TArray& a )
TString value = line.mid( pos + 1 ); TString value = line.mid( pos + 1 );
value.trim(); value.trim();
if( key == "X" ) if( key == "X" )
{ campo->x( atoi( value ) ); } campo->x( atoi( value ) );
else if( key == "Y" ) else if( key == "Y" )
{ campo->y( atoi( value ) ); } campo->y( atoi( value ) );
else if( key == "GROUP" ) else if( key == "GROUP" )
{ campo->gruppo( atoi( value ) ); } campo->gruppo( atoi( value ) );
else if( key == "FIELDNAME" ) else if( key == "FIELDNAME" )
{ campo->fieldname( value ); } campo->fieldname( value );
else if( key == "MSKID" ) else if( key == "MSKID" )
{ campo->id( atoi( value ) ); } campo->id( atoi( value ) );
else if( key == "TYPE" ) else if( key == "TYPE" )
{ campo->type( atoi( value ) ); } campo->type( atoi( value ) );
else if( key == "SIZE" ) else if( key == "SIZE" )
{ campo->size( atoi( value ) ); } campo->size( atoi( value ) );
else if( key == "PROMPT" ) else if( key == "PROMPT" )
{ if( value[ 0 ] == '"' ) {
{ value.rtrim( 1 ); if( value[ 0 ] == '"' )
value.ltrim( 1 ); }; {
campo->prompt( value ); } value.rtrim( 1 );
value.ltrim( 1 );
};
campo->prompt( value );
}
else if( key == "FLAG" ) else if( key == "FLAG" )
{ campo->flag( value ); } campo->flag( value );
else if( key == "USE" ) else if( key == "USE" )
{ campo->use( (TToken_string & ) value ); } campo->use( (TToken_string & ) value );
else if( key == "INPUT" ) else if( key == "INPUT" )
{ campo->input( (TToken_string & )value ); } campo->input( (TToken_string & )value );
else if( key == "DISPLAY" ) else if( key == "DISPLAY" )
{ campo->display( (TToken_string & )value ); } campo->display( (TToken_string & )value );
else if( key == "OUTPUT" ) else if( key == "OUTPUT" )
{ campo->output( (TToken_string & )value ); } campo->output( (TToken_string & )value );
else if( key == "WARNING" ) else if( key == "WARNING" )
{ campo->warning( value ); } campo->warning( value );
else if( key == "HELP" ) else if( key == "HELP" )
{ campo->help( value ); } campo->help( value );
else if( key == "SPECIAL" ) else if( key == "SPECIAL" )
{ campo->special( (TToken_string & )value ); } campo->special( (TToken_string & )value );
else if( key == "ITEMS" ) else if( key == "ITEMS" )
{ campo->items( (TToken_string & )value ); } campo->items( (TToken_string & )value );
else if( key == "CONFIGS" ) else if( key == "CONFIGS" )
{ campo->configs( (TToken_string & )value ); } campo->configs( (TToken_string & )value );
else yesnofatal_box( "Chiave non trovata(%s)", (const char *) key ); else yesnofatal_box( "Chiave non trovata(%s)", (const char *) key );
} }
} }
} }
} }
if ( campo ) if ( campo )
{ a.add( campo ); a.add( campo );
// delete campo;
};
} }
void TMask_generator::carica_tabella( const TFilename& fn, TString_array& tabella ) void TMask_generator::carica_tabella( const TFilename& fn, TString_array& tabella )
@ -922,6 +948,12 @@ void TMask_generator::genera( )
_m->message( "CO,4@" ); _m->message( "CO,4@" );
_m->end(); _m->end();
_m->control( T_STRING, F_TIPOCF, 1 );
_m->begin();
_m->prompt( 2, 2, "Tipo CF " );
_m->flag( "H" );
_m->end();
_m->control( T_STRING, F_DESTIPODOC, 50 ); _m->control( T_STRING, F_DESTIPODOC, 50 );
_m->begin(); _m->begin();
_m->prompt( 24, 2 ); _m->prompt( 24, 2 );