121 lines
		
	
	
		
			2.7 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			121 lines
		
	
	
		
			2.7 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 -[1|2|3|4|5]"
 | 
						|
 | 
						|
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;
 | 
						|
}     
 |