campo-sirio/ve/ve0200.cpp
matteo 2749cef346 Prima implementazione dell'oggetto sconto. Il motore adesso si accorge se sono
state modificate le impostazioni e chiede di rigenerare le maschere


git-svn-id: svn://10.65.10.50/trunk@1832 c028cbd2-c16b-5b4b-a496-9718f37d4682
1995-09-15 13:49:07 +00:00

121 lines
2.9 KiB
C++
Executable File

#include <xvt.h>
#ifndef __CHECKS_H
#include <checks.h>
#endif
#ifndef __CONFAPP_H
#include <confapp.h>
#endif
#ifndef __EXECP_H
#include <execp.h>
#endif
#ifndef __TABUTIL_H
#include <tabutil.h>
#endif
#define SINTASSI "Sintassi: VE0 -2 [a|b|c|d|e]"
class TConf_vendite : public TConfig_application
{
private:
bool _changed;
public:
virtual bool preprocess_config (TMask& mask, TConfig& config);
virtual bool postprocess_config_changed (const char* par, const char* var,
const char* oldv, const char* newv);
virtual bool postprocess_config (TMask& mask, TConfig& config);
virtual bool user_create( );
virtual bool user_destroy( );
TConf_vendite() : TConfig_application( CONFIG_DITTA ){ }
virtual ~TConf_vendite( ){ }
};
bool TConf_vendite::preprocess_config (TMask& mask, TConfig& config)
{
disable_menu_item(M_FILE_NEW);
disable_menu_item(M_FILE_REVERT);
return TRUE;
}
bool TConf_vendite::postprocess_config (TMask& mask, TConfig& config)
{
enable_menu_item(M_FILE_NEW);
enable_menu_item(M_FILE_REVERT);
return TRUE;
}
bool TConf_vendite::postprocess_config_changed (const char* par, const char* var,
const char* oldv, const char* newv)
{
// Notifica al motore che la configurazione è cambiata: occorre rigenerare le maschere
_changed = TRUE;
return TRUE;
}
bool TConf_vendite::user_create( )
{
TString16 arg( argv(2) );
_changed = FALSE;
// Il fottuto meno serve per evitare fottutamente che la fottuta confapp
// si fotta il fottuto parametro
if( arg[ 0 ] != '-' )
fatal_box( SINTASSI );
char msk = arg[1];
// Devo usare un puntatore così deletandolo si registra
TConfig confditta( CONFIG_DITTA );
// Prima usavo le lettere ma la fottuta confapp si fotte il fottuto -c per i suoi fottuti
// motivi, così uso i fottuti numeri
switch( msk )
{
case '1':
confditta.set( "EdMask", "ve0200a", "ve" );
break;
case '2':
confditta.set( "EdMask", "ve0200b", "ve" );
break;
case '3':
confditta.set( "EdMask", "ve0200c", "ve" );
break;
case '4':
confditta.set( "EdMask", "ve0200d", "ve" );
break;
case '5':
confditta.set( "EdMask", "ve0200e", "ve" );
break;
default:
fatal_box( SINTASSI );
return FALSE;
break;
}
return TRUE;
}
bool TConf_vendite::user_destroy( )
{
if( _changed )
{
TConfig confditta( CONFIG_DITTA );
confditta.set( "EdMask", "", "ve" );
confditta.set( "CHANGED", "X", "ve" );
}
return TRUE;
}
int ve0200(int argc, char** argv)
{
TConf_vendite appc;
if( argc < 3 )
fatal_box( SINTASSI );
appc.run(argc, argv, "Parametri gestione vendite");
return 0;
}