Correzioni alla gestione degli occasionali e degli stati

git-svn-id: svn://10.65.10.50/trunk@4118 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1997-02-06 17:44:07 +00:00
parent 29e5500df9
commit 6b199d4340
4 changed files with 32 additions and 23 deletions

View File

@ -102,7 +102,7 @@ bool TCliFor::load( const char tipocf, const long codcf, const TString& ocfpi )
TRelation occrel( LF_OCCAS ); TRelation occrel( LF_OCCAS );
occrel.curr().zero(); occrel.curr().zero();
occrel.curr().put( "CFPI", ocfpi ); occrel.curr().put( "CFPI", ocfpi );
if (occrel.read() != NOERR) if (occrel.read(_isequal) != NOERR)
occrel.curr().zero(); occrel.curr().zero();
occas_mask().autoload( occrel ); occas_mask().autoload( occrel );
} }
@ -118,7 +118,8 @@ void TCliForVendite::update_mask( TMask& m, bool onload )
const TString16 datacambio(m.get(F_DATACAMBIO1)); const TString16 datacambio(m.get(F_DATACAMBIO1));
// Setta i campi che appartengono al file LF_CLIFO // Setta i campi che appartengono al file LF_CLIFO
const bool occas = app().config_ditta().get_bool("GESOCCAS") && occasionale(); // const bool occas = app().config_ditta().get_bool("GESOCCAS") && occasionale();
const bool occas = occasionale();
m.show(F_OCCASEDIT, occas); m.show(F_OCCASEDIT, occas);
// In forse per l'Occasionale, sicuri per il Normale // In forse per l'Occasionale, sicuri per il Normale
@ -164,21 +165,24 @@ void TCliForVendite::update_mask( TMask& m, bool onload )
set(m, F_CODZON, LF_CFVEN, "CODZONA"); set(m, F_CODZON, LF_CFVEN, "CODZONA");
set(m, F_RAGGR, LF_CFVEN, "RAGGDOC"); set(m, F_RAGGR, LF_CFVEN, "RAGGDOC");
} }
if ( occasionale ( ) ) // if ( occasionale ( ) )
TMask & occ_mask = occas_mask();
if (occas)
{ {
m.set( F_COFI, "" ); m.set( F_COFI, "" );
m.set( F_PAIVA, "" ); m.set( F_PAIVA, "" );
m.set( F_LOCALITACF, ""); m.set( F_LOCALITACF, "");
m.set( F_OCFPI, occas_mask( ).get( O_CODICE ) ); m.set( F_OCFPI, occ_mask.get( O_CODICE ) );
m.set( F_RAGSOC, occas_mask( ).get( O_RAGSOC ) ); m.set( F_RAGSOC, occ_mask.get( O_RAGSOC ) );
m.set( F_INDCF, occas_mask( ).get( O_INDIRIZZO ) ); m.set( F_INDCF, occ_mask.get( O_INDIRIZZO ) );
m.set( F_CIVCF, occas_mask( ).get( O_NUMERO ) ); m.set( F_CIVCF, occ_mask.get( O_NUMERO ) );
m.set( F_CAPCF, occas_mask( ).get( O_CAP ) ); m.set( F_CAPCF, occ_mask.get( O_CAP ) );
m.set( F_COMCF, occas_mask( ).get( O_COMUNE ) ); m.set( F_COMCF, occ_mask.get( O_COMUNE ) );
m.set( F_STATOCF, stato = occas_mask( ).get( O_STATO ) ); m.set( F_STATOCF, stato = occ_mask.get( O_STATO ) );
} }
else else
{ {
occ_mask.reset();
set( m, F_COFI, LF_CLIFO, "COFI" ); set( m, F_COFI, LF_CLIFO, "COFI" );
set( m, F_INDCF, LF_CLIFO, "INDCF" ); set( m, F_INDCF, LF_CLIFO, "INDCF" );
set( m, F_CIVCF, LF_CLIFO, "CIVCF" ); set( m, F_CIVCF, LF_CLIFO, "CIVCF" );

View File

@ -335,7 +335,8 @@ bool TMotore_application::clifo_handler( TMask_field& f, KEY key )
if ( clifo.get_bool("SOSPESO") ) if ( clifo.get_bool("SOSPESO") )
return f.error_box( "Il codice '%ld' e' sospeso e non puo' essere utilizzato", codcf ); return f.error_box( "Il codice '%ld' e' sospeso e non puo' essere utilizzato", codcf );
if (app().clifo().load( cf, codcf, "")) const TString80 occas_cod(app().clifo().occas_mask().get(O_CODICE));
if (app().clifo().load( cf, codcf, occas_cod))
{ {
app().clifo().update_mask(m, !m.is_running()); app().clifo().update_mask(m, !m.is_running());
if( f.mask().id2pos(F_OCCASEDIT) > 0 && f.to_check(key)) if( f.mask().id2pos(F_OCCASEDIT) > 0 && f.to_check(key))
@ -633,6 +634,7 @@ int TMotore_application::write( const TMask& m ) // C 90
if ( err == NOERR ) if ( err == NOERR )
{ {
m.autosave(*_rel); m.autosave(*_rel);
_doc->put("OCFPI", app().clifo().occas_mask().get(O_CODICE));
err = _doc->write( ); err = _doc->write( );
} }
if (err == NOERR) if (err == NOERR)
@ -655,6 +657,7 @@ int TMotore_application::rewrite( const TMask& m ) // C 90
if ( err == NOERR ) if ( err == NOERR )
{ {
m.autosave(*_rel); m.autosave(*_rel);
_doc->put("OCFPI", app().clifo().occas_mask().get(O_CODICE));
err = _doc->rewrite( ); err = _doc->rewrite( );
} }
} }
@ -665,7 +668,7 @@ int TMotore_application::rewrite( const TMask& m ) // C 90
bool TMotore_application::remove( void ) // C 80 bool TMotore_application::remove( void ) // C 80
{ {
if ( ! valida_operazione( OP_CANCELLA ) ) if ( ! valida_operazione( OP_CANCELLA ) )
return FALSE; return TRUE;
int err = esegui_procedura(OP_CANCELLA); int err = esegui_procedura(OP_CANCELLA);
return _doc->remove() == NOERR; return _doc->remove() == NOERR;
} }
@ -802,7 +805,9 @@ bool TMotore_application::stato_valido( int stato, int operazione )
{ {
#ifdef _DEBUG #ifdef _DEBUG
warning_box( "Controllo stati validi!\nStato corrente %d.\nStati validi %s.", stato_corrente( ), ( const char * )stati_validi( operazione ) ); warning_box( "Controllo stati validi!\nStato corrente %d.\nStati validi %s.", stato_corrente( ), ( const char * )stati_validi( operazione ) );
#endif #endif
if (stato == 0)
return TRUE;
char p[2] = "0"; char p[2] = "0";
TToken_string ret ( stati_validi( operazione ), ',' ); TToken_string ret ( stati_validi( operazione ), ',' );
p[0] += ( char )stato; p[0] += ( char )stato;
@ -811,7 +816,7 @@ bool TMotore_application::stato_valido( int stato, int operazione )
int TMotore_application::stato_corrente( ) int TMotore_application::stato_corrente( )
{ {
return _doc->head().get_int("STATO"); return edit_mask().get_int(F_STATO);
} }
void TMotore_application::segnala_stato_non_valido( int operazione ) void TMotore_application::segnala_stato_non_valido( int operazione )

View File

@ -2,5 +2,5 @@
#define F_GESVAL 102 #define F_GESVAL 102
#define F_GESLIN 103 #define F_GESLIN 103
#define F_GESSOSPIMP 104 #define F_GESSOSPIMP 104
#define F_GESOCCAS 105 //#define F_GESOCCAS 105

View File

@ -37,7 +37,7 @@ ITEM "C|Clienti "
ITEM "L|Condizioni di vendita" ITEM "L|Condizioni di vendita"
END END
GROUPBOX DLG_NULL 78 7 GROUPBOX DLG_NULL 78 6
BEGIN BEGIN
PROMPT 1 6 "Gestione dati generali" PROMPT 1 6 "Gestione dati generali"
END END
@ -66,11 +66,11 @@ PROMPT 2 10 "Gestione documenti in sospensione di imposta"
FIELD GESSOSPIMP FIELD GESSOSPIMP
END END
BOOLEAN F_GESOCCAS //BOOLEAN F_GESOCCAS
BEGIN //BEGIN
PROMPT 2 11 "Gestione archivio clienti occasionali" //PROMPT 2 11 "Gestione archivio clienti occasionali"
FIELD GESOCCAS //FIELD GESOCCAS
END //END
ENDPAGE ENDPAGE