Files correlati : Ricompilazione Demo : [ ] Commento : Riportata la versione 1.5 fino alla patch 811 git-svn-id: svn://10.65.10.50/trunk@8985 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			81 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			81 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
| // Programma generico di gestione tabelle modulo provvigioni agenti
 | |
| 
 | |
| #include <tabapp.h>
 | |
| 
 | |
| #include "prtbapr.h"
 | |
| 
 | |
| class TTablePR_app : public TTable_application
 | |
| {
 | |
| protected:
 | |
|   virtual bool user_create() ;
 | |
|   virtual TString& get_mask_name(TString& t) const;
 | |
|   static  bool gmc_handler(TMask_field& f, KEY k);
 | |
| };
 | |
| 
 | |
| static inline TTablePR_app& app() { return (TTablePR_app&)main_app(); }
 | |
| 
 | |
| bool TTablePR_app::gmc_handler(TMask_field& f, KEY k)
 | |
| {
 | |
|   if (f.to_check(k))
 | |
|   {
 | |
|     TString v1 = f.get(),v2;
 | |
|     TMask& m = f.mask();
 | |
|     if (v1 == "E" || v1 == "R")
 | |
|     {
 | |
|       for (short id = F_SEQRIC1; id <= F_SEQRIC4; id++)
 | |
|       {
 | |
|         if (f.dlg() == id)
 | |
|           continue;
 | |
|         v2 = m.get(id);
 | |
|         if (v1 == "E" && v2 == "R" || v1 == "R" && v2 == "E")
 | |
|           return f.error_box("Non e' possibile usare contemporaneamente la "
 | |
|                              "tabella gruppo merceologico e la tabella sottogruppo "
 | |
|                              "merceologico");
 | |
|       }
 | |
|     }
 | |
|   }
 | |
|   return TRUE;
 | |
| }
 | |
| 
 | |
| TString& TTablePR_app::get_mask_name(TString& t) const
 | |
| {
 | |
|   if (t[0] == '%' )
 | |
|   {
 | |
|     t.ltrim(1);
 | |
|   }
 | |
| 
 | |
|   t = "prtb"; t << get_tabname();
 | |
| 
 | |
|   TFilename n = t;
 | |
|   n.ext ("msk");
 | |
|   if (n.exist())
 | |
|   { 
 | |
|     return t;
 | |
|   }          
 | |
|   return Tab_application::get_mask_name(t);
 | |
| }
 | |
| 
 | |
| bool TTablePR_app::user_create()
 | |
| {
 | |
|   Tab_application::user_create();
 | |
|   const TString& name = get_tabname();
 | |
|   TMask& mask = *get_mask();
 | |
|   if (name == "APR") 
 | |
|   {
 | |
|     mask.set_handler(F_SEQRIC1,gmc_handler);
 | |
|     mask.set_handler(F_SEQRIC2,gmc_handler);
 | |
|     mask.set_handler(F_SEQRIC3,gmc_handler);
 | |
|     mask.set_handler(F_SEQRIC4,gmc_handler);
 | |
|   }
 | |
| 
 | |
|   return TRUE;
 | |
| }
 | |
| 
 | |
| 
 | |
| int pr0100(int argc, char** argv)
 | |
| {
 | |
|   TTablePR_app a;
 | |
|   a.run(argc, argv, "Tabella");
 | |
|   return 0;
 | |
| }
 |