126 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			126 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
// Handler di marco 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 __VE0100C_H
 | 
						||
#include "ve0100c.h"
 | 
						||
#endif
 | 
						||
 | 
						||
#ifndef __PAGAMENT_H
 | 
						||
#include "..\cg\pagament.h"
 | 
						||
#endif
 | 
						||
 | 
						||
bool    ora_hndl(TMask_field& field, KEY key)
 | 
						||
{
 | 
						||
  if (key == K_TAB)
 | 
						||
  {
 | 
						||
    if (field.to_check(key))
 | 
						||
    {
 | 
						||
      TFixed_string ora(field.get(),6);
 | 
						||
      ora.trim();
 | 
						||
      if (ora.not_empty() || field.required())
 | 
						||
      {
 | 
						||
        //                              bool changed = FALSE;
 | 
						||
        if (isdigit(ora[0]))
 | 
						||
        {
 | 
						||
          if (ora[2] != ':')
 | 
						||
          {
 | 
						||
            if (ora.len()>4) ora.overwrite(":",2);
 | 
						||
            else ora.insert(":", 2);
 | 
						||
            //                                          changed = TRUE;
 | 
						||
          }
 | 
						||
        }
 | 
						||
        bool ok;
 | 
						||
        ok = ((isdigit(ora[0]))&&(isdigit(ora[1]))&&(isdigit(ora[3]))&&(isdigit(ora[4])));
 | 
						||
        ok &= ((atoi(&(ora[0]))<24)&&(atoi(&(ora[3]))<60));
 | 
						||
        if (!ok)
 | 
						||
        {
 | 
						||
          error_box("Ora errata o formato non valido");
 | 
						||
          return FALSE;
 | 
						||
        }
 | 
						||
        else    /* if (changed) */
 | 
						||
        {
 | 
						||
          field.set((ora));
 | 
						||
          //                                                    field.picture_data((ora),TRUE);
 | 
						||
          //                                                    field.picture_data((ora.strip(":")),FALSE);
 | 
						||
        }
 | 
						||
      }
 | 
						||
    }
 | 
						||
  }
 | 
						||
  return TRUE;
 | 
						||
}
 | 
						||
 | 
						||
bool    codcli_hndl(TMask_field& field, KEY key)
 | 
						||
{
 | 
						||
  if (key == K_TAB)
 | 
						||
  {
 | 
						||
    if (field.to_check(key))
 | 
						||
    {
 | 
						||
      field.send_key(K_TAB,F_CODVAL);
 | 
						||
      field.send_key(K_TAB,F_CODLIN);
 | 
						||
      field.send_key(K_TAB,F_CODPAG);
 | 
						||
      field.send_key(K_TAB,F_CODABIA);
 | 
						||
      field.send_key(K_TAB,F_CODCABA);
 | 
						||
      field.send_key(K_TAB,F_INDSP);
 | 
						||
    }
 | 
						||
  }
 | 
						||
  return TRUE;
 | 
						||
}
 | 
						||
 | 
						||
bool    dummy_hndl(TMask_field& field, KEY key)
 | 
						||
{
 | 
						||
  warning_box("Al campo %d <20> arrivato un KEY %d",field.dlg(),key);
 | 
						||
  return TRUE;
 | 
						||
}
 | 
						||
 | 
						||
bool condpag_hndl(TMask_field& field, KEY key)
 | 
						||
{
 | 
						||
  
 | 
						||
  if (key == K_TAB)
 | 
						||
  {
 | 
						||
    if (field.to_check(key))
 | 
						||
    {
 | 
						||
      TMask& m = field.mask( );
 | 
						||
      TString16 condpag( m.get( F_CODPAG ) );
 | 
						||
      TString16 data( m.get( F_DATAINSC ) );
 | 
						||
      if ( condpag.blank( ) || data.blank( ) )
 | 
						||
        return TRUE;
 | 
						||
      TPagamento pag( condpag, data );
 | 
						||
      pag.set_total( 100, 10, 10 );
 | 
						||
      pag.set_rate_auto( );      
 | 
						||
      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;
 | 
						||
}
 | 
						||
 |