Files correlati : Ricompilazione Demo : [ ] Commento : Aggiunta traduzione a i cespiti git-svn-id: svn://10.65.10.50/trunk@11114 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			150 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			150 lines
		
	
	
		
			3.2 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
| #include <applicat.h>
 | |
| #include <automask.h>
 | |
| #include <printer.h>
 | |
| #include <recarray.h>
 | |
| 
 | |
| #include "celib.h" 
 | |
| #include "ce3400.h" 
 | |
| #include "ce3700a.h" 
 | |
| 
 | |
| #include "../cg/cglib01.h" 
 | |
| 
 | |
| #include "cespi.h" 
 | |
| 
 | |
| ///////////////////////////////////////////////////////////
 | |
| // Main Form
 | |
| ///////////////////////////////////////////////////////////
 | |
| 
 | |
| class TECUP_form : public TCespi_list_form
 | |
| { 
 | |
| protected:
 | |
|   virtual bool validate(TForm_item& fld, TToken_string& val);
 | |
| 
 | |
| public:
 | |
|   void set_testata(const TMask& m);
 | |
| 
 | |
|   TECUP_form();
 | |
| };
 | |
| 
 | |
| void TECUP_form::set_testata(const TMask& m)
 | |
| {     
 | |
|   TCespi_list_form::set_testata(m);
 | |
| }
 | |
| 
 | |
| bool TECUP_form::validate(TForm_item& fld, TToken_string& val)
 | |
| {             
 | |
|   return TCespi_list_form::validate(fld, val);
 | |
| }
 | |
| 
 | |
| TECUP_form::TECUP_form() : TCespi_list_form("ce3700a")
 | |
| { }
 | |
| 
 | |
| ///////////////////////////////////////////////////////////
 | |
| // Main Mask
 | |
| ///////////////////////////////////////////////////////////
 | |
| 
 | |
| class TECUP_mask : public TAutomask
 | |
| {
 | |
| protected:
 | |
|   virtual bool on_field_event(TOperable_field& f, TField_event e, long jolly);
 | |
| 
 | |
| public:
 | |
|   TECUP_mask() : TAutomask("ce3700a") { }
 | |
| };
 | |
| 
 | |
| bool TECUP_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
 | |
| {                                        
 | |
|   switch (f.dlg())
 | |
|   {              
 | |
|   case F_USOPROM1:
 | |
|     if (e == fe_close)
 | |
|     {  
 | |
|       for (int up = 2; up >= 0; up--)
 | |
|         if (get_bool(F_USOPROM1+up))
 | |
|           break;
 | |
|       if (up < 0)    
 | |
|         return error_box(TR("E' necessario specificare almeno una percentuale di deducibilità"));
 | |
|     }
 | |
|     break;
 | |
|   default: break;
 | |
|   }
 | |
|   return TRUE;
 | |
| }
 | |
| 
 | |
| ///////////////////////////////////////////////////////////
 | |
| // Main Application
 | |
| ///////////////////////////////////////////////////////////
 | |
| 
 | |
| class TECUP_app : public TSkeleton_application
 | |
| {
 | |
|   int _gruppo;
 | |
|   TString4 _specie;
 | |
|   bool _usoprom[3];
 | |
|   int _veidip;
 | |
| 
 | |
|   static bool promis_filter(const TRelation* rel);
 | |
| 
 | |
| protected:
 | |
|   virtual void main_loop();
 | |
| };
 | |
| 
 | |
| TECUP_app& app() { return (TECUP_app&)main_app(); }
 | |
| 
 | |
| bool TECUP_app::promis_filter(const TRelation* rel)
 | |
| {     
 | |
|   const TRectype& cespi = rel->curr();
 | |
|   const TECUP_app& a = app();
 | |
|   
 | |
|   if (cespi.get_int(CESPI_CODCGRA) != a._gruppo)
 | |
|     return FALSE;
 | |
|        
 | |
|   if (cespi.get(CESPI_CODSPA) != a._specie)
 | |
|     return FALSE;
 | |
| 
 | |
|   int up = cespi.get_int(CESPI_USOPROM);
 | |
|   if (up > 0) up--;
 | |
|   if (a._usoprom[up] == FALSE)
 | |
|     return FALSE;
 | |
|   
 | |
|   if (a._veidip < 2) 
 | |
|     return cespi.get_bool(CESPI_VEIDIP) == (a._veidip != 0);
 | |
|   
 | |
|   return TRUE;
 | |
| }
 | |
| 
 | |
| void TECUP_app::main_loop()
 | |
| {
 | |
|   TECUP_mask m;
 | |
|   ditta_cespiti().init_mask(m);
 | |
|   
 | |
|   m.set(F_USOPROM2, "X");
 | |
|   m.set(F_USOPROM3, "X");
 | |
|   m.set(F_VEIDIP, 2);
 | |
|   
 | |
|   while (m.run() != K_QUIT)
 | |
|   {
 | |
|     const int ese = m.get_int(F_ESERCIZIO);
 | |
|     _gruppo = m.get_int(F_GRUPPO);
 | |
|     _specie = m.get(F_SPECIE);
 | |
|     ditta_cespiti().set_attivita(ese, _gruppo, _specie);
 | |
|     
 | |
|     for (int u = 0; u < 3; u++)
 | |
|       _usoprom[u] = m.get_bool(F_USOPROM1+u);
 | |
|     _veidip = m.get_int(F_VEIDIP);
 | |
|     
 | |
|     TECUP_form form;
 | |
|     form.cursor()->set_filterfunction(promis_filter);
 | |
|     
 | |
|     form.set_testata(m);
 | |
|     form.print();
 | |
|     xvt_statbar_set("");
 | |
|   }    
 | |
| }
 | |
| 
 | |
| int ce3700(int argc, char* argv[])
 | |
| {
 | |
|   TECUP_app app;
 | |
|   app.run(argc, argv, TR("Cespiti uso promisquo"));
 | |
|   return 0;
 | |
| }
 |