107 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			107 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
// Handler di MarcoclaD sui campi delle maschere
 | 
						|
 | 
						|
#ifndef __CHECKS_H
 | 
						|
#include <checks.h>
 | 
						|
#endif
 | 
						|
 | 
						|
#ifndef __MASK_H
 | 
						|
#include <mask.h>
 | 
						|
#endif
 | 
						|
 | 
						|
#ifndef __MASKFLD_H
 | 
						|
#include <maskfld.h>
 | 
						|
#endif
 | 
						|
 | 
						|
#ifndef __KEYS_H
 | 
						|
#include <keys.h>
 | 
						|
#endif
 | 
						|
 | 
						|
#ifndef __STRINGS_H
 | 
						|
#include <strings.h>
 | 
						|
#endif
 | 
						|
 | 
						|
#ifndef __VEUML_H
 | 
						|
#include "VeUML.h"
 | 
						|
#endif
 | 
						|
 | 
						|
#ifndef __VEUML1_H
 | 
						|
#include "VeUML1.h"
 | 
						|
#endif
 | 
						|
 | 
						|
#ifndef __VE0100_H
 | 
						|
#include "ve0100.h"
 | 
						|
#endif
 | 
						|
 | 
						|
#ifndef __VE0100C_H
 | 
						|
#include "ve0100c.h"
 | 
						|
#endif
 | 
						|
 | 
						|
#ifndef __PAGAMENT_H
 | 
						|
#include "..\cg\pagament.h"
 | 
						|
#endif
 | 
						|
 | 
						|
#ifndef __SCONTI_H
 | 
						|
#include "sconti.h"
 | 
						|
#endif
 | 
						|
 | 
						|
bool ora_hndl( TMask_field& field, KEY key )
 | 
						|
 | 
						|
{
 | 
						|
  if (field.to_check(key))
 | 
						|
  {
 | 
						|
    TFixed_string ora( field.get( ), 6 );
 | 
						|
    
 | 
						|
    ora.trim( );
 | 
						|
    if (ora.not_empty() || field.required() )
 | 
						|
    {
 | 
						|
      if ( isdigit( ora[ 0 ] ) )
 | 
						|
      {
 | 
						|
        if ( ora[ 2 ] != ':')
 | 
						|
        {
 | 
						|
          if ( ora.len( ) > 4 )
 | 
						|
            ora.overwrite( ":", 2 );
 | 
						|
          else
 | 
						|
            ora.insert( ":", 2 );            
 | 
						|
        }
 | 
						|
      }
 | 
						|
      const bool ok = ((isdigit(ora[0]))&&(isdigit(ora[1]))&&(isdigit(ora[3]))&&(isdigit(ora[4]))) &&
 | 
						|
                      ((atoi(&(ora[0]))<24)&&(atoi(&(ora[3]))<60));
 | 
						|
      if (ok )
 | 
						|
        field.set((ora));          
 | 
						|
      else  
 | 
						|
        return error_box("Ora errata o formato non valido");
 | 
						|
    }
 | 
						|
  }
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
bool dummy_hndl(TMask_field& field, KEY key)
 | 
						|
{
 | 
						|
  warning_box( "Al campo %d è arrivato un KEY %d", field.dlg( ), key );
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
// Handler per il calcolo delle date di pagamento
 | 
						|
bool condpag_hndl( TMask_field& field, KEY key )
 | 
						|
{                
 | 
						|
  if ( field.to_check(key))
 | 
						|
  {
 | 
						|
    TMask& m = field.mask( );
 | 
						|
    TString16 condpag( m.get( F_CODPAG ) );
 | 
						|
    TString16 data( m.get( F_DATAINSC ) );
 | 
						|
    if ( condpag.not_empty() && data.not_empty())
 | 
						|
    {
 | 
						|
      TPagamento pag( condpag, data );
 | 
						|
      pag.set_total( 100, 10, 10 );
 | 
						|
      pag.set_rate_auto( );      
 | 
						|
      const int numrate = pag.n_rate( );
 | 
						|
      for( int i = 0; i < numrate; i ++ )
 | 
						|
        m.set( F_DATASCAD1 + i, pag.data_rata(i).string());
 | 
						|
      for( ; i < 5; i ++ )
 | 
						|
        m.hide( F_DATASCAD1 + i );
 | 
						|
    }
 | 
						|
  }
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 |