which included commits to RCS files with non-trunk default branches. git-svn-id: svn://10.65.10.50/trunk@1835 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			103 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			103 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
 | 
						|
#include <applicat.h>
 | 
						|
#include <tabapp.h>  
 | 
						|
#include <strings.h>
 | 
						|
#include <stdtypes.h>
 | 
						|
#include <tabutil.h>
 | 
						|
#include <utility.h> 
 | 
						|
#include <prefix.h>
 | 
						|
 | 
						|
#include "batbpdb.h"
 | 
						|
 | 
						|
class Tabanabil_application : public Tab_application
 | 
						|
{
 | 
						|
private:
 | 
						|
  TMask*  _msk;   
 | 
						|
  TString _tabname;
 | 
						|
  
 | 
						|
public:
 | 
						|
  bool user_create();
 | 
						|
  
 | 
						|
  static bool giorno_handler(TMask_field& f, KEY k);
 | 
						|
  static bool mese_handler  (TMask_field& f, KEY k);
 | 
						|
 | 
						|
  Tabanabil_application() {}
 | 
						|
  virtual ~Tabanabil_application() {}
 | 
						|
};
 | 
						|
 | 
						|
HIDDEN inline Tabanabil_application& app() {return (Tabanabil_application&) main_app();}
 | 
						|
 | 
						|
bool Tabanabil_application::giorno_handler(TMask_field& f, KEY k)
 | 
						|
{
 | 
						|
  if (k == K_TAB && f.mask().is_running())
 | 
						|
  {
 | 
						|
    int giorno = atoi(f.get());   
 | 
						|
    
 | 
						|
    if (giorno > 31)
 | 
						|
      return f.warning_box("Valore non valido per il giorno");
 | 
						|
 | 
						|
    int mese   = (f.dlg() == F_GIORNO_INI ? f.mask().get_int(F_MESE_INI) : f.mask().get_int(F_MESE_FINE));
 | 
						|
    
 | 
						|
    if (mese == 2)
 | 
						|
      if (giorno > 29)
 | 
						|
        return f.warning_box("Valore non valido per il giorno");
 | 
						|
    
 | 
						|
    if (mese == 11 || mese == 4 || mese == 6 || mese == 9)
 | 
						|
      if (giorno > 30)
 | 
						|
        return f.warning_box("Valore non valido per il giorno");
 | 
						|
  }
 | 
						|
  
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
bool Tabanabil_application::mese_handler(TMask_field& f, KEY k)
 | 
						|
{
 | 
						|
  if (k == K_TAB && f.mask().is_running())
 | 
						|
  {
 | 
						|
    int mese = atoi(f.get());
 | 
						|
    
 | 
						|
    if (mese < 1 || mese > 12)
 | 
						|
      return f.warning_box("Valore non valido per il mese");
 | 
						|
    
 | 
						|
    int giorno = (f.dlg() == F_MESE_INI ? f.mask().get_int(F_GIORNO_INI) : f.mask().get_int(F_GIORNO_FINE));
 | 
						|
    
 | 
						|
    if (mese == 2)
 | 
						|
      if (giorno > 29)
 | 
						|
        return f.warning_box("Valore non valido per il giorno");
 | 
						|
    
 | 
						|
    if (mese == 11 || mese == 4 || mese == 6 || mese == 9)
 | 
						|
      if (giorno > 30)
 | 
						|
        return f.warning_box("Valore non valido per il giorno");
 | 
						|
  }
 | 
						|
  
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
bool Tabanabil_application::user_create()
 | 
						|
{ 
 | 
						|
  Tab_application::user_create();
 | 
						|
 | 
						|
  _msk     = get_mask();
 | 
						|
  _tabname = get_tabname();
 | 
						|
 | 
						|
  if (_tabname == "%PDB")         
 | 
						|
  {
 | 
						|
    _msk->set_handler(F_GIORNO_INI,  giorno_handler);
 | 
						|
    _msk->set_handler(F_MESE_INI,    mese_handler);
 | 
						|
    _msk->set_handler(F_GIORNO_FINE, giorno_handler);
 | 
						|
    _msk->set_handler(F_MESE_FINE,   mese_handler);
 | 
						|
  }
 | 
						|
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
ab0100(int argc, char* argv[])
 | 
						|
{
 | 
						|
  Tabanabil_application a;
 | 
						|
  
 | 
						|
  a.run(argc,argv, "Tabelle");
 | 
						|
  return 0;
 | 
						|
}
 | 
						|
 | 
						|
 |