Versione beta
git-svn-id: svn://10.65.10.50/trunk@3680 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									293c6e8c75
								
							
						
					
					
						commit
						ac6e4946de
					
				
							
								
								
									
										461
									
								
								ve/righedoc.cpp
									
									
									
									
									
								
							
							
						
						
									
										461
									
								
								ve/righedoc.cpp
									
									
									
									
									
								
							@ -18,437 +18,76 @@
 | 
			
		||||
#include "sconti.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static void row_set_handler( TMask& m, const int field, const int index )
 | 
			
		||||
 | 
			
		||||
void TRiga_documento_motore::load(TSheet_field & f,  TToken_string& row)
 | 
			
		||||
{
 | 
			
		||||
  switch ( index )
 | 
			
		||||
  {
 | 
			
		||||
    case 1:
 | 
			
		||||
      m.set_handler( field, dummy_hndl );
 | 
			
		||||
      break;
 | 
			
		||||
    default:
 | 
			
		||||
      yesnofatal_box( FALSE, "Funzione di handler sulla riga non definita( %d ).", index );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
                                     
 | 
			
		||||
HIDDEN TString16 curr_um; 
 | 
			
		||||
HIDDEN real curr_fc(1.0);
 | 
			
		||||
                                     
 | 
			
		||||
HIDDEN bool codart_handler( TMask_field& f, KEY key )
 | 
			
		||||
{
 | 
			
		||||
  // Se qualcuno cerca di modificare la maschera
 | 
			
		||||
  if ( key == K_TAB && f.focusdirty())
 | 
			
		||||
  {            
 | 
			
		||||
    TMask& row_mask = f.mask();               
 | 
			
		||||
    TMask & mask = app().edit_mask();
 | 
			
		||||
    TCond_vendita & condv = app().condv();
 | 
			
		||||
    
 | 
			
		||||
    condv.set_testa(&mask);
 | 
			
		||||
    condv.set_riga(&row_mask);
 | 
			
		||||
 | 
			
		||||
    TLocalisamfile & anamag = ((TEdit_field &) f).browse()->cursor()->file();
 | 
			
		||||
    TLocalisamfile & umart  = ((TEdit_field &) row_mask.field(FR_UMQTA)).browse()->cursor()->file();
 | 
			
		||||
    
 | 
			
		||||
    condv.set_anamag(anamag);
 | 
			
		||||
    condv.set_umart(umart);
 | 
			
		||||
    TString80 codart(f.get());   
 | 
			
		||||
    anamag.setkey(1);
 | 
			
		||||
    anamag.put("CODART", codart);
 | 
			
		||||
    if (anamag.read() != NOERR)
 | 
			
		||||
    {
 | 
			
		||||
      TLocalisamfile codalt(LF_CODCORR);
 | 
			
		||||
      
 | 
			
		||||
      codalt.setkey(2);
 | 
			
		||||
      codalt.put("CODARTALT", codart);
 | 
			
		||||
      if (codalt.read() == NOERR)
 | 
			
		||||
      {                              
 | 
			
		||||
        codart = codalt.get("CODART");
 | 
			
		||||
        anamag.zero();
 | 
			
		||||
        anamag.put("CODART", codart);
 | 
			
		||||
        if (anamag.read() == NOERR)
 | 
			
		||||
          f.set(codart);
 | 
			
		||||
      }
 | 
			
		||||
    }   
 | 
			
		||||
 | 
			
		||||
    if (anamag.good())
 | 
			
		||||
    {
 | 
			
		||||
      const TString16 lingua = mask.get(F_CODLIN);                              
 | 
			
		||||
      const TString codart(row_mask.get(FR_CODART));
 | 
			
		||||
      TString desc(anamag.get("DESCR"));
 | 
			
		||||
      
 | 
			
		||||
      if (lingua.not_empty())
 | 
			
		||||
      {
 | 
			
		||||
        TLocalisamfile deslin(LF_DESLIN);
 | 
			
		||||
        
 | 
			
		||||
        deslin.setkey(2);
 | 
			
		||||
        deslin.put("CODART", codart);
 | 
			
		||||
        deslin.put("CODLIN", lingua);
 | 
			
		||||
        if (deslin.read() == NOERR)
 | 
			
		||||
          desc = deslin.get("DESCR");
 | 
			
		||||
      }
 | 
			
		||||
      row_mask.set(FR_DESCR, desc);
 | 
			
		||||
                                     
 | 
			
		||||
      umart.setkey(1);              
 | 
			
		||||
      umart.zero(); 
 | 
			
		||||
      umart.put("CODART", codart);
 | 
			
		||||
      if (umart.read(_isgteq) == NOERR && codart == umart.get("CODART"))
 | 
			
		||||
      {
 | 
			
		||||
        curr_um = umart.get("UM");       
 | 
			
		||||
        curr_fc = umart.get_real("FC");
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
      {
 | 
			
		||||
        curr_um.cut(0);                  
 | 
			
		||||
        curr_fc = 1.0;
 | 
			
		||||
      }
 | 
			
		||||
      row_mask.set(FR_UMQTA, curr_um);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    condv.ricerca();
 | 
			
		||||
  }
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
HIDDEN bool umart_handler( TMask_field& f, KEY key )
 | 
			
		||||
{
 | 
			
		||||
  // Se qualcuno cerca di modificare la maschera
 | 
			
		||||
  if ( key == K_TAB && f.focusdirty())
 | 
			
		||||
  { 
 | 
			
		||||
    TMask& row_mask = f.mask( );               
 | 
			
		||||
    TMask & mask = app().edit_mask();
 | 
			
		||||
    TLocalisamfile & anamag = ((TEdit_field &) row_mask.field(FR_CODART)).browse()->cursor()->file();
 | 
			
		||||
    TLocalisamfile & umart  = ((TEdit_field &) f).browse()->cursor()->file();
 | 
			
		||||
    TCond_vendita & condv = app().condv();
 | 
			
		||||
    
 | 
			
		||||
    condv.set_testa(&mask);
 | 
			
		||||
    condv.set_riga(&row_mask);
 | 
			
		||||
    condv.set_anamag(anamag);
 | 
			
		||||
    condv.set_umart(umart);
 | 
			
		||||
    condv.ricerca(FALSE);
 | 
			
		||||
  
 | 
			
		||||
    const TString16 um(f.get());
 | 
			
		||||
    real fc(1.0);
 | 
			
		||||
    
 | 
			
		||||
    if (um.not_empty() && curr_um.not_empty() && um != curr_um)
 | 
			
		||||
    {           
 | 
			
		||||
      umart.setkey(2);                               
 | 
			
		||||
      umart.put("CODART", row_mask.get(FR_CODART));
 | 
			
		||||
      umart.put("UM", um);
 | 
			
		||||
      if (umart.read() == NOERR)
 | 
			
		||||
      {
 | 
			
		||||
        real qta(row_mask.get_real(FR_QTA));
 | 
			
		||||
        qta *= curr_fc;          
 | 
			
		||||
        fc = umart.get_real("FC");
 | 
			
		||||
        qta /= fc;
 | 
			
		||||
        row_mask.set(FR_QTA, qta);
 | 
			
		||||
      }
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
    curr_um = um;
 | 
			
		||||
    curr_fc = fc;
 | 
			
		||||
  }   
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
HIDDEN bool descr_handler( TMask_field& f, KEY key )
 | 
			
		||||
{
 | 
			
		||||
  if (key == K_TAB && f.focusdirty())
 | 
			
		||||
  {            
 | 
			
		||||
    const TString s(f.get());
 | 
			
		||||
    if (s.find('\n') < 0)
 | 
			
		||||
    {
 | 
			
		||||
      TLocalisamfile & anamag = ((TEdit_field &) f).browse()->cursor()->file();
 | 
			
		||||
      
 | 
			
		||||
      anamag.zero();
 | 
			
		||||
      anamag.setkey(2);
 | 
			
		||||
      anamag.put("DESCR", ((TZoom_field &) f).get_first_line());
 | 
			
		||||
      if (anamag.read() == NOERR)
 | 
			
		||||
      {                         
 | 
			
		||||
        f.mask().set(FR_CODART, anamag.get("CODART"));
 | 
			
		||||
        f.mask().field(FR_CODART).set_dirty();
 | 
			
		||||
        f.mask().check_field(FR_CODART);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }       
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
HIDDEN bool qta_handler( TMask_field& f, KEY key )
 | 
			
		||||
{
 | 
			
		||||
  // Se qualcuno cerca di modificare la maschera
 | 
			
		||||
  if ( key == K_TAB && f.focusdirty())
 | 
			
		||||
  { 
 | 
			
		||||
    TMask& row_mask = f.mask( );               
 | 
			
		||||
    TMask & mask = app().edit_mask();
 | 
			
		||||
    TLocalisamfile & anamag = ((TEdit_field &) row_mask.field(FR_CODART)).browse()->cursor()->file();
 | 
			
		||||
    TLocalisamfile & umart  = ((TEdit_field &) row_mask.field(FR_UMQTA)).browse()->cursor()->file();
 | 
			
		||||
    TCond_vendita & condv = app().condv();
 | 
			
		||||
    
 | 
			
		||||
    condv.set_testa(&mask);
 | 
			
		||||
    condv.set_riga(&row_mask);
 | 
			
		||||
    condv.set_anamag(anamag);
 | 
			
		||||
    condv.set_umart(umart);
 | 
			
		||||
    condv.ricerca(FALSE);
 | 
			
		||||
  } 
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
void TRiga::load(TSheet_field & f,  TToken_string& row, TRectype * r)
 | 
			
		||||
{
 | 
			
		||||
  if (r)
 | 
			
		||||
    _data = *r;  
 | 
			
		||||
  _data.put( "STATORIGA", row.get( f.cid2index(FR_STATORIGA) ) );
 | 
			
		||||
  _data.put( "TIPORIGA", row.get( f.cid2index(FR_TIPORIGA )) );
 | 
			
		||||
  put( "STATORIGA", row.get( f.cid2index(FR_STATORIGA) ) );
 | 
			
		||||
  put( "TIPORIGA", row.get( f.cid2index(FR_TIPORIGA )) );
 | 
			
		||||
  TString16 codmag(row.get(f.cid2index(FR_CODMAG)));
 | 
			
		||||
    
 | 
			
		||||
  codmag.left_just(3);
 | 
			
		||||
  codmag << row.get( f.cid2index(FR_CODDEP ));
 | 
			
		||||
  _data.put( "CODMAG",  codmag);
 | 
			
		||||
  _data.put( "CODART", row.get( f.cid2index(FR_CODART )) );
 | 
			
		||||
  put( "CODMAG",  codmag);
 | 
			
		||||
  put( "CODART", row.get( f.cid2index(FR_CODART )) );
 | 
			
		||||
  TString s(row.get(f.cid2index(FR_DESCR))); 
 | 
			
		||||
  int split_pos = s.find('\n');
 | 
			
		||||
  if (split_pos > 0)
 | 
			
		||||
  {
 | 
			
		||||
    _data.put( "DESCR", s.left(split_pos));
 | 
			
		||||
    _data.put("DESCLUNGA", "X");  
 | 
			
		||||
    put( "DESCR", s.left(split_pos));
 | 
			
		||||
    put("DESCLUNGA", "X");  
 | 
			
		||||
    s.ltrim(split_pos);
 | 
			
		||||
    _data.put("DESCEST", s);
 | 
			
		||||
    put("DESCEST", s);
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    _data.put("DESCR", s);
 | 
			
		||||
    _data.put("DESCLUNGA", "");
 | 
			
		||||
    _data.zero("DESCEST");
 | 
			
		||||
    put("DESCR", s);
 | 
			
		||||
    put("DESCLUNGA", "");
 | 
			
		||||
    zero("DESCEST");
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  _data.put( "PREZZO", row.get( f.cid2index(FR_PREZZO )) );
 | 
			
		||||
  _data.put( "UMQTA", row.get( f.cid2index(FR_UMQTA )) );
 | 
			
		||||
  _data.put( "QTA", row.get( f.cid2index(FR_QTA )) );
 | 
			
		||||
  _data.put( "QTAEVASA", row.get( f.cid2index(FR_QTAEVASA )) );
 | 
			
		||||
  _data.put( "RIGAEVASA", row.get( f.cid2index(FR_RIGAEVASA )) );
 | 
			
		||||
  _data.put( "TARA", row.get( f.cid2index(FR_TARA )) );
 | 
			
		||||
  _data.put( "PNETTO", row.get( f.cid2index(FR_PNETTO )) );
 | 
			
		||||
  _data.put( "NCOLLI", row.get( f.cid2index(FR_NCOLLI )) );
 | 
			
		||||
  _data.put( "DAEVADERE", row.get( f.cid2index(FR_DAEVADERE )) );  
 | 
			
		||||
  _data.put( "SCONTO", row.get( f.cid2index(FR_SCONTO )) );
 | 
			
		||||
  _data.put( "PERCPROV", row.get( f.cid2index(FR_PERCPROV )) );
 | 
			
		||||
  _data.put( "IMPFISSO", row.get( f.cid2index(FR_IMPFISSO )) );
 | 
			
		||||
  _data.put( "CODIVA", row.get( f.cid2index(FR_CODIVA )) );
 | 
			
		||||
  _data.put( "ADDIVA", row.get( f.cid2index(FR_ADDIVA )) );
 | 
			
		||||
  _data.put( "ASPBENI", row.get( f.cid2index(FR_ASPBENI )) );  
 | 
			
		||||
  carica_profilo( );
 | 
			
		||||
  _piede.destroy( );
 | 
			
		||||
//  somma( _piede );  
 | 
			
		||||
  _data.put( "G1", _piede.string( ) );
 | 
			
		||||
  if (r)
 | 
			
		||||
    *r = _data;
 | 
			
		||||
  
 | 
			
		||||
  put( "PREZZO", row.get( f.cid2index(FR_PREZZO )) );
 | 
			
		||||
  put( "UMQTA", row.get( f.cid2index(FR_UMQTA )) );
 | 
			
		||||
  put( "QTA", row.get( f.cid2index(FR_QTA )) );
 | 
			
		||||
  put( "QTAEVASA", row.get( f.cid2index(FR_QTAEVASA )) );
 | 
			
		||||
  put( "RIGAEVASA", row.get( f.cid2index(FR_RIGAEVASA )) );
 | 
			
		||||
  put( "TARA", row.get( f.cid2index(FR_TARA )) );
 | 
			
		||||
  put( "PNETTO", row.get( f.cid2index(FR_PNETTO )) );
 | 
			
		||||
  put( "NCOLLI", row.get( f.cid2index(FR_NCOLLI )) );
 | 
			
		||||
  put( "DAEVADERE", row.get( f.cid2index(FR_DAEVADERE )) );  
 | 
			
		||||
  put( "SCONTO", row.get( f.cid2index(FR_SCONTO )) );
 | 
			
		||||
  put( "PERCPROV", row.get( f.cid2index(FR_PERCPROV )) );
 | 
			
		||||
  put( "IMPFISSO", row.get( f.cid2index(FR_IMPFISSO )) );
 | 
			
		||||
  put( "CODIVA", row.get( f.cid2index(FR_CODIVA )) );
 | 
			
		||||
  put( "ADDIVA", row.get( f.cid2index(FR_ADDIVA )) );
 | 
			
		||||
  put( "ASPBENI", row.get( f.cid2index(FR_ASPBENI )) );  
 | 
			
		||||
}
 | 
			
		||||
    
 | 
			
		||||
void TRiga::save(TSheet_field & f, TToken_string& row )
 | 
			
		||||
void TRiga_documento_motore::save(TSheet_field & f, TToken_string& row )
 | 
			
		||||
{
 | 
			
		||||
  row.add( _data.get( "STATORIGA" ), f.cid2index(FR_STATORIGA ));
 | 
			
		||||
  row.add( _data.get( "TIPORIGA" ), f.cid2index(FR_TIPORIGA ));
 | 
			
		||||
  const TString codmag(_data.get("CODMAG"));
 | 
			
		||||
  row.add( get( "STATORIGA" ), f.cid2index(FR_STATORIGA ));
 | 
			
		||||
  row.add( get( "TIPORIGA" ), f.cid2index(FR_TIPORIGA ));
 | 
			
		||||
  const TString codmag(get("CODMAG"));
 | 
			
		||||
  row.add( codmag.left(3), f.cid2index(FR_CODMAG ));
 | 
			
		||||
  row.add( codmag.mid(3), f.cid2index(FR_CODDEP ));
 | 
			
		||||
  row.add( _data.get( "CODART" ), f.cid2index(FR_CODART ));
 | 
			
		||||
  TString s(_data.get("DESCR"));
 | 
			
		||||
  if (_data.get_bool("DESCLUNGA"))
 | 
			
		||||
    s << _data.get("DESCEST");
 | 
			
		||||
  row.add( get( "CODART" ), f.cid2index(FR_CODART ));
 | 
			
		||||
  TString s(get("DESCR"));
 | 
			
		||||
  if (get_bool("DESCLUNGA"))
 | 
			
		||||
    s << get("DESCEST");
 | 
			
		||||
  row.add(s, f.cid2index(FR_DESCR ));
 | 
			
		||||
  row.add( _data.get( "UMQTA" ), f.cid2index(FR_UMQTA ));
 | 
			
		||||
  row.add( _data.get( "PREZZO" ), f.cid2index(FR_PREZZO ));
 | 
			
		||||
  row.add( _data.get( "QTA" ), f.cid2index(FR_QTA ));
 | 
			
		||||
  row.add( _data.get( "QTAEVASA" ), f.cid2index(FR_QTAEVASA ));
 | 
			
		||||
  row.add( _data.get( "RIGAEVASA" ), f.cid2index(FR_RIGAEVASA ));
 | 
			
		||||
  row.add( _data.get( "TARA" ), f.cid2index(FR_TARA ));
 | 
			
		||||
  row.add( _data.get( "PNETTO" ), f.cid2index(FR_PNETTO ));
 | 
			
		||||
  row.add( _data.get( "NCOLLI" ), f.cid2index(FR_NCOLLI ));
 | 
			
		||||
  row.add( _data.get( "DAEVADERE" ), f.cid2index(FR_DAEVADERE ));
 | 
			
		||||
  row.add( _data.get( "SCONTO" ), f.cid2index(FR_SCONTO ));
 | 
			
		||||
  row.add( _data.get( "PERCPROV" ), f.cid2index(FR_PERCPROV ));
 | 
			
		||||
  row.add( _data.get( "IMPFISSO" ), f.cid2index(FR_IMPFISSO ));
 | 
			
		||||
  row.add( _data.get( "CODIVA" ), f.cid2index(FR_CODIVA ));
 | 
			
		||||
  row.add( _data.get( "ADDIVA" ), f.cid2index(FR_ADDIVA ));
 | 
			
		||||
  row.add( _data.get( "ASPBENI" ), f.cid2index(FR_ASPBENI ));
 | 
			
		||||
 // row.add( _piede.string( ), f.cid2index(FR_G1 )); 
 | 
			
		||||
  row.add( get( "UMQTA" ), f.cid2index(FR_UMQTA ));
 | 
			
		||||
  row.add( get( "PREZZO" ), f.cid2index(FR_PREZZO ));
 | 
			
		||||
  row.add( get( "QTA" ), f.cid2index(FR_QTA ));
 | 
			
		||||
  row.add( get( "QTAEVASA" ), f.cid2index(FR_QTAEVASA ));
 | 
			
		||||
  row.add( get( "RIGAEVASA" ), f.cid2index(FR_RIGAEVASA ));
 | 
			
		||||
  row.add( get( "TARA" ), f.cid2index(FR_TARA ));
 | 
			
		||||
  row.add( get( "PNETTO" ), f.cid2index(FR_PNETTO ));
 | 
			
		||||
  row.add( get( "NCOLLI" ), f.cid2index(FR_NCOLLI ));
 | 
			
		||||
  row.add( get( "DAEVADERE" ), f.cid2index(FR_DAEVADERE ));
 | 
			
		||||
  row.add( get( "SCONTO" ), f.cid2index(FR_SCONTO ));
 | 
			
		||||
  row.add( get( "PERCPROV" ), f.cid2index(FR_PERCPROV ));
 | 
			
		||||
  row.add( get( "IMPFISSO" ), f.cid2index(FR_IMPFISSO ));
 | 
			
		||||
  row.add( get( "CODIVA" ), f.cid2index(FR_CODIVA ));
 | 
			
		||||
  row.add( get( "ADDIVA" ), f.cid2index(FR_ADDIVA ));
 | 
			
		||||
  row.add( get( "ASPBENI" ), f.cid2index(FR_ASPBENI ));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TRiga::load( const TRectype& rec )
 | 
			
		||||
{
 | 
			
		||||
  _data = rec;
 | 
			
		||||
  carica_profilo( );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TRiga::save( TRectype& rec )
 | 
			
		||||
{
 | 
			
		||||
  rec = _data;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TRiga::carica_profilo( )
 | 
			
		||||
{
 | 
			
		||||
  if( _pro )
 | 
			
		||||
     delete _pro;              
 | 
			
		||||
  TFilename proname("verig");
 | 
			
		||||
  proname << _data.get("TIPORIGA");
 | 
			
		||||
  proname.ext( "ini" );  
 | 
			
		||||
  _pro = new TConfig( proname );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TRiga::configura_sheet( TSheet_field& f, int numriga )
 | 
			
		||||
{
 | 
			
		||||
  int ncols = _pro->get_int( "NCOLS", "COLUMNS" );
 | 
			
		||||
  // Disabilita tutte le colonne
 | 
			
		||||
  f.disable_cell ( numriga, -1 );
 | 
			
		||||
  // Abilita le colonne indicate nel profilo della riga  
 | 
			
		||||
  for( int i = 1; i <= ncols; i ++ )
 | 
			
		||||
  {
 | 
			
		||||
    TString16 chiave;
 | 
			
		||||
    chiave.format( "%d", i );
 | 
			
		||||
    int coltoenable = _pro->get_int( chiave, "COLUMNS" );
 | 
			
		||||
    f.enable_cell ( numriga, coltoenable);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TVariable_mask * TRiga::getmask( )
 | 
			
		||||
{           
 | 
			
		||||
                             
 | 
			
		||||
  TString16 msk("verig");
 | 
			
		||||
  msk << _data.get("TIPORIGA");
 | 
			
		||||
  TVariable_mask * mask = new TVariable_mask( msk );
 | 
			
		||||
  int numhandler = _pro->get_int( "NHANDLER", "HANDLERS" );
 | 
			
		||||
  for( int i = 1; i <= numhandler; i ++ )
 | 
			
		||||
  {
 | 
			
		||||
    TString chiave;
 | 
			
		||||
    chiave.format( "%d", i );
 | 
			
		||||
    TToken_string riga = _pro->get( chiave, "HANDLERS" );
 | 
			
		||||
    row_set_handler( *mask, riga.get_int( 0 ), riga.get_int( 1 ) );
 | 
			
		||||
  }  
 | 
			
		||||
  const TMask_field & f = mask->field(FR_CODART);
 | 
			
		||||
  if (f.is_edit())
 | 
			
		||||
  {
 | 
			
		||||
    TBrowse * browse = ((TEdit_field &) f).browse();
 | 
			
		||||
    
 | 
			
		||||
    if (browse )
 | 
			
		||||
    {                 
 | 
			
		||||
      TCursor * cur = browse->cursor();
 | 
			
		||||
      CHECK(cur, "Null cursor in CODART check");
 | 
			
		||||
      if (cur)
 | 
			
		||||
      {
 | 
			
		||||
        const int num = cur->file().num();
 | 
			
		||||
        if (num == LF_ANAMAG)
 | 
			
		||||
        {
 | 
			
		||||
          mask->set_handler( FR_CODART, codart_handler );
 | 
			
		||||
          mask->set_handler( FR_UMQTA, umart_handler );
 | 
			
		||||
          mask->set_handler( FR_DESCR, descr_handler ); 
 | 
			
		||||
          mask->set_handler( FR_QTA, qta_handler ); 
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  return mask;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void TRiga::edit_keys( const KEY key, TPiede_documento& nuovo )
 | 
			
		||||
{
 | 
			
		||||
  static TPiede_documento vecchio;
 | 
			
		||||
  
 | 
			
		||||
  switch( key )
 | 
			
		||||
  {
 | 
			
		||||
    // Inizio modifica
 | 
			
		||||
    case K_SPACE:
 | 
			
		||||
      vecchio.destroy( );
 | 
			
		||||
//      somma( vecchio );
 | 
			
		||||
      break;
 | 
			
		||||
      
 | 
			
		||||
    // Cancellazione  
 | 
			
		||||
    case K_DEL:
 | 
			
		||||
      // Toglie i vecchi valori
 | 
			
		||||
      nuovo.sottrai( vecchio );
 | 
			
		||||
      break;
 | 
			
		||||
      
 | 
			
		||||
    // Modifica
 | 
			
		||||
    case K_ENTER:
 | 
			
		||||
      // Toglie i vecchi valori
 | 
			
		||||
      nuovo.sottrai( vecchio );
 | 
			
		||||
      // Aggiunge i nuovi all
 | 
			
		||||
//      somma( nuovo );
 | 
			
		||||
      break;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TRiga::~TRiga( )
 | 
			
		||||
{ 
 | 
			
		||||
  if( _pro )
 | 
			
		||||
    delete _pro;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void TPiede_documento::somma( TPiede_documento& tosum, bool add  )
 | 
			
		||||
{                        
 | 
			
		||||
  tosum.restart( );
 | 
			
		||||
  THash_object* curr = tosum.get_hashobj( );
 | 
			
		||||
  while( curr )
 | 
			
		||||
  {
 | 
			
		||||
    TString16 key( curr->key( ) );
 | 
			
		||||
    if( add )
 | 
			
		||||
      somma( key, ( real& )curr->obj( ) );
 | 
			
		||||
    else
 | 
			
		||||
      sottrai( key, ( real& )curr->obj( ) );
 | 
			
		||||
    curr = tosum.get_hashobj( );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
    
 | 
			
		||||
void TPiede_documento::somma( TString16& piede, const real& importo )
 | 
			
		||||
{
 | 
			
		||||
  if( is_key( piede ) )
 | 
			
		||||
  {
 | 
			
		||||
    real& attuale = ( real& ) operator []( piede );
 | 
			
		||||
    attuale += importo;
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
    add( piede, importo );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TToken_string& TPiede_documento::string( )
 | 
			
		||||
{
 | 
			
		||||
  TToken_string ret;
 | 
			
		||||
  
 | 
			
		||||
  ret.separator( '~' );
 | 
			
		||||
  restart( );
 | 
			
		||||
  THash_object* curr = get_hashobj( );
 | 
			
		||||
  while( curr )
 | 
			
		||||
  {
 | 
			
		||||
    ret.add( curr->key( ) );
 | 
			
		||||
    ret.add( (( real& ) curr->obj( )).string( ) );
 | 
			
		||||
    curr = get_hashobj( );
 | 
			
		||||
  }
 | 
			
		||||
  return ret;  
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TPiede_documento::load( TToken_string& s )
 | 
			
		||||
{
 | 
			
		||||
  s.separator( '~' );
 | 
			
		||||
  for( int i = 0; i < s.items( ); i+=2 )
 | 
			
		||||
  {
 | 
			
		||||
    TString16 piede = s.get( i );
 | 
			
		||||
    TString num = s.get( i + 1 );
 | 
			
		||||
    real valore( num );
 | 
			
		||||
    add( piede, valore );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
    
 | 
			
		||||
real& TPiede_documento::get( TString16& piede )
 | 
			
		||||
{
 | 
			
		||||
  static real zero( "0.0" );
 | 
			
		||||
  
 | 
			
		||||
  if( is_key( piede ) )
 | 
			
		||||
  {
 | 
			
		||||
    return ( real& ) find( piede );
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
    return zero;
 | 
			
		||||
}
 | 
			
		||||
@ -25,72 +25,26 @@
 | 
			
		||||
#include "config.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __MSKSHEET_H
 | 
			
		||||
#include "msksheet.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __VARMASK_H
 | 
			
		||||
#include "varmask.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
class TPiede_documento : public TAssoc_array
 | 
			
		||||
#ifndef __VELIB01_H
 | 
			
		||||
#include "velib01.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
class TRiga_documento_motore : public TRiga_documento
 | 
			
		||||
{
 | 
			
		||||
  public:
 | 
			
		||||
    
 | 
			
		||||
    TToken_string& string( );
 | 
			
		||||
    void load( TToken_string& s );
 | 
			
		||||
    void somma( TPiede_documento& tosum, bool add = TRUE );
 | 
			
		||||
    void sottrai( TPiede_documento& tosum ){ somma( tosum, FALSE ); };
 | 
			
		||||
    void somma( TString16& piede, const real& importo );
 | 
			
		||||
    void sottrai( TString16& piede, const real& importo ){ somma( piede, -importo ); };
 | 
			
		||||
    real& get( TString16& piede );
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class TRiga : public TObject
 | 
			
		||||
{
 | 
			
		||||
  private:
 | 
			
		||||
  
 | 
			
		||||
     // Record che contiene i dati sulla riga
 | 
			
		||||
     TRectype _data;
 | 
			
		||||
     
 | 
			
		||||
     // Profilo di riga
 | 
			
		||||
     TConfig* _pro;
 | 
			
		||||
     
 | 
			
		||||
     // Maschera per la riga
 | 
			
		||||
     
 | 
			
		||||
     TPiede_documento _piede;
 | 
			
		||||
    
 | 
			
		||||
  protected:
 | 
			
		||||
     
 | 
			
		||||
     // Carca il profilo di riga: da migliorare mettendo una cache o precaricando 
 | 
			
		||||
     // tutti i profili per un documento
 | 
			
		||||
     void carica_profilo( );
 | 
			
		||||
          
 | 
			
		||||
  public:
 | 
			
		||||
    
 | 
			
		||||
    // Setta il numero della riga
 | 
			
		||||
    void set_numero( int r ) { _data.put( "NRIGA", r ); }
 | 
			
		||||
    int numero( ) { return _data.get_int( "NRIGA" ); }
 | 
			
		||||
    const TString & tipo( ) const { return _data.get( "TIPORIGA" ); }
 | 
			
		||||
    // Carica la riga dalla riga dello sheet
 | 
			
		||||
    void load( TSheet_field& f, TToken_string& row , TRectype * r = NULL);
 | 
			
		||||
    void load( TSheet_field& f, TToken_string& row);
 | 
			
		||||
    // Registra la riga sullo sheet
 | 
			
		||||
    void save( TSheet_field& f, TToken_string& row);
 | 
			
		||||
    // Legge la riga dal record
 | 
			
		||||
    void load( const TRectype& rec );
 | 
			
		||||
    // Scrive la riga sul record
 | 
			
		||||
    void save( TRectype& rec );
 | 
			
		||||
    // Disabilita le colonne dello sheet come da profilo riga
 | 
			
		||||
    void configura_sheet( TSheet_field& f, int numriga );
 | 
			
		||||
    // Somma la riga su di un piede documento
 | 
			
		||||
    void edit_keys( const KEY key, TPiede_documento& nuovo );
 | 
			
		||||
    // Costruisce e Ritorna la maschera della riga per la editazione
 | 
			
		||||
    TVariable_mask * getmask(); 
 | 
			
		||||
    
 | 
			
		||||
    // Costruttorino standard
 | 
			
		||||
    TRiga( ) : _data( LF_RIGHEDOC ), _pro( NULL ) { }
 | 
			
		||||
    TRiga_documento_motore(TDocumento* doc) : TRiga_documento(doc) { }
 | 
			
		||||
    TRiga_documento_motore(const TRiga_documento& rec, TDocumento* doc) : TRiga_documento(rec, doc) { }
 | 
			
		||||
    
 | 
			
		||||
    virtual ~TRiga( );
 | 
			
		||||
    virtual ~TRiga_documento_motore() {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										107
									
								
								ve/sconti.cpp
									
									
									
									
									
								
							
							
						
						
									
										107
									
								
								ve/sconti.cpp
									
									
									
									
									
								
							@ -26,8 +26,6 @@
 | 
			
		||||
#include <tabutil.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// #define A_ANAMAG         0
 | 
			
		||||
 | 
			
		||||
HIDDEN const real CENTO(100.0);
 | 
			
		||||
 | 
			
		||||
bool TCond_vendita::set_sconto( const char * exp, bool signal  )
 | 
			
		||||
@ -58,7 +56,7 @@ bool TCond_vendita::set_sconto( const char * exp, bool signal  )
 | 
			
		||||
        {
 | 
			
		||||
          // Aggiunge il numero alla sequenza
 | 
			
		||||
          real newval( num );
 | 
			
		||||
          _molt_sconto *= ( CENTO + newval ) / CENTO;
 | 
			
		||||
          _molt_sconto *= ( CENTO - newval ) / CENTO;
 | 
			
		||||
          goodexp << num;
 | 
			
		||||
        }
 | 
			
		||||
        // Inizia il nuovo numero
 | 
			
		||||
@ -106,7 +104,7 @@ bool TCond_vendita::set_sconto( const char * exp, bool signal  )
 | 
			
		||||
    {
 | 
			
		||||
      // Aggiunge l'ultimo numero preso
 | 
			
		||||
      real lastval( num ); 
 | 
			
		||||
      _molt_sconto *= ( CENTO + lastval ) / CENTO;
 | 
			
		||||
      _molt_sconto *= ( CENTO - lastval ) / CENTO;
 | 
			
		||||
      goodexp << num; // Assegna la nuova espressione formattata bene     
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
@ -118,7 +116,7 @@ bool TCond_vendita::set_sconto( const char * exp, bool signal  )
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  _sconto = goodexp;
 | 
			
		||||
  if (_riga && _riga->id2pos(FR_SCONTO) >= 0 && _riga->field(FR_SCONTO).active())
 | 
			
		||||
  if (_load_mask && _riga && _riga->id2pos(FR_SCONTO) >= 0 && _riga->field(FR_SCONTO).active())
 | 
			
		||||
    _riga->set(FR_SCONTO, _sconto);
 | 
			
		||||
  return valid;
 | 
			
		||||
}
 | 
			
		||||
@ -148,7 +146,7 @@ void TCond_vendita::set_prezzo(const real & prezzo, const char * val_rif)
 | 
			
		||||
      _prezzo.round(cambio == 1.0 ? 0 : 3);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  if (_riga && _riga->id2pos(FR_PREZZO) >= 0 && _riga->field(FR_PREZZO).active())
 | 
			
		||||
  if (_load_mask && _riga && _riga->id2pos(FR_PREZZO) >= 0 && _riga->field(FR_PREZZO).active())
 | 
			
		||||
    _riga->set(FR_PREZZO, _prezzo);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -156,7 +154,7 @@ void TCond_vendita::set_provv(const real & provv)
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  _provv = provv;
 | 
			
		||||
  if (_riga && _riga->id2pos(FR_PERCPROV) >= 0 && _riga->field(FR_PERCPROV).active())
 | 
			
		||||
  if (_load_mask && _riga && _riga->id2pos(FR_PERCPROV) >= 0 && _riga->field(FR_PERCPROV).active())
 | 
			
		||||
    _riga->set(FR_PERCPROV, _provv);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -164,7 +162,7 @@ void TCond_vendita::set_iva(const TString & codiva)
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
  _codiva = codiva;
 | 
			
		||||
  if (_riga && _riga->id2pos(FR_CODIVA) >= 0 && _riga->field(FR_CODIVA).active())
 | 
			
		||||
  if (_load_mask && _riga && _riga->id2pos(FR_CODIVA) >= 0 && _riga->field(FR_CODIVA).active())
 | 
			
		||||
    _riga->set(FR_CODIVA, _codiva);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -219,25 +217,25 @@ bool TCond_vendita::cerca( int tiporicerca )
 | 
			
		||||
    }
 | 
			
		||||
    if( _condv.read( ) == NOERR )
 | 
			
		||||
    { 
 | 
			
		||||
      _rcondv.setkey( 2 );
 | 
			
		||||
      _rcondv.zero( );
 | 
			
		||||
      _rcondv.put( "TIPO", _condv.get( "TIPO"));
 | 
			
		||||
      _rcondv.put( "CATVEN", _condv.get( "CATVEN"));
 | 
			
		||||
      _rcondv.put( "TIPOCF", _condv.get( "TIPOCF"));
 | 
			
		||||
      _rcondv.put( "CODCF", _condv.get( "CODCF"));
 | 
			
		||||
      _rcondv.put("COD", _condv.get("COD"));  
 | 
			
		||||
      if( _condv.get_bool( "GESTUM" ) )
 | 
			
		||||
        _rcondv.put( "UM", riga().get(FR_UMQTA));
 | 
			
		||||
//      _rcondv.setkey( 2 );
 | 
			
		||||
        
 | 
			
		||||
      const bool gest_scagl = _condv.get_bool("GESTSCAGL");
 | 
			
		||||
      const TString16 seqricrighe( _condv.get( "SEQRIC" ) );
 | 
			
		||||
      bool found = FALSE;
 | 
			
		||||
      
 | 
			
		||||
      if (gest_scagl)
 | 
			
		||||
        _rcondv.put("NSCAGL", 1);
 | 
			
		||||
 | 
			
		||||
      for( int i = 0; !found && i < seqricrighe.len( ); i ++ )
 | 
			
		||||
      {
 | 
			
		||||
        _rcondv.zero( );
 | 
			
		||||
        _rcondv.put( "TIPO", _condv.get( "TIPO"));
 | 
			
		||||
        _rcondv.put( "CATVEN", _condv.get( "CATVEN"));
 | 
			
		||||
        _rcondv.put( "TIPOCF", _condv.get( "TIPOCF"));
 | 
			
		||||
        _rcondv.put( "CODCF", _condv.get( "CODCF"));
 | 
			
		||||
        _rcondv.put("COD", _condv.get("COD"));  
 | 
			
		||||
        if( _condv.get_bool( "GESTUM" ) )
 | 
			
		||||
          _rcondv.put( "UM", riga().get(FR_UMQTA));
 | 
			
		||||
        if (gest_scagl)
 | 
			
		||||
          _rcondv.put("NSCAGL", 1);
 | 
			
		||||
        
 | 
			
		||||
        char ricerca = seqricrighe[ i ];
 | 
			
		||||
        _rcondv.put( "TIPORIGA", ricerca );
 | 
			
		||||
@ -262,13 +260,13 @@ bool TCond_vendita::cerca( int tiporicerca )
 | 
			
		||||
            _rcondv.put("CODRIGA", anamag().get( "RAGGFIS"));
 | 
			
		||||
            _rcondv.read();
 | 
			
		||||
            break;
 | 
			
		||||
          case 'C':                       
 | 
			
		||||
          case 'S':                       
 | 
			
		||||
            {
 | 
			
		||||
              _rcondv.put( "CODRIGA", anamag().get("GRMERC"));
 | 
			
		||||
              _rcondv.read( );              
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
          case 'L':                       
 | 
			
		||||
          case 'G':                       
 | 
			
		||||
            {
 | 
			
		||||
              _rcondv.put( "CODRIGA", anamag().get("GRMERC").left(3));
 | 
			
		||||
              _rcondv.read( );              
 | 
			
		||||
@ -308,10 +306,11 @@ bool TCond_vendita::cerca( int tiporicerca )
 | 
			
		||||
}
 | 
			
		||||
    
 | 
			
		||||
// Probabilmente dovrebbe lavorare sulla maschera, ma per ora la lasciamo cosl
 | 
			
		||||
void TCond_vendita::ricerca(bool full_load)
 | 
			
		||||
void TCond_vendita::ricerca(bool load_um_only, bool load_scagl_only)
 | 
			
		||||
{
 | 
			
		||||
  TString codart = anamag().get( "CODART" );
 | 
			
		||||
  const TString codriga = riga().get( FR_CODART );
 | 
			
		||||
  _load_mask = !load_um_only && !load_scagl_only;  
 | 
			
		||||
  
 | 
			
		||||
  if(anamag().bad() || codriga != codart )
 | 
			
		||||
  {
 | 
			
		||||
@ -319,13 +318,13 @@ void TCond_vendita::ricerca(bool full_load)
 | 
			
		||||
    anamag().put("CODART", codriga);
 | 
			
		||||
    if (anamag().read() != NOERR)
 | 
			
		||||
    {                                     
 | 
			
		||||
      if (full_load)
 | 
			
		||||
      {
 | 
			
		||||
//      if (full_load)
 | 
			
		||||
//      {
 | 
			
		||||
        set_prezzo(ZERO);
 | 
			
		||||
        set_sconto("");  
 | 
			
		||||
        set_iva("");
 | 
			
		||||
        set_provv(ZERO);
 | 
			
		||||
      }
 | 
			
		||||
//      }
 | 
			
		||||
      return;
 | 
			
		||||
    }  
 | 
			
		||||
  }                  
 | 
			
		||||
@ -342,31 +341,39 @@ void TCond_vendita::ricerca(bool full_load)
 | 
			
		||||
  }                                  
 | 
			
		||||
 | 
			
		||||
  const bool found_condv = cerca(A_CONTRATTI) || cerca(A_OFFERTE) || cerca(A_LISTINI);
 | 
			
		||||
  const bool cv_scagl = _condv.get_bool("GESTSCAGL");
 | 
			
		||||
  const bool cv_um = _condv.get_bool("GESTUM");
 | 
			
		||||
 | 
			
		||||
  if (found_condv)
 | 
			
		||||
  {
 | 
			
		||||
    _load_mask |= load_scagl_only && cv_scagl;
 | 
			
		||||
    _load_mask |= load_um_only && cv_um;
 | 
			
		||||
    set_prezzo(_rcondv.get_real("PREZZO"), _condv.get("CODVAL"));
 | 
			
		||||
    _load_mask = !load_um_only && !load_scagl_only;  
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
    if (full_load)
 | 
			
		||||
//    if (full_load)
 | 
			
		||||
      set_prezzo(umart().get_real("PREZZO")); 
 | 
			
		||||
      
 | 
			
		||||
      
 | 
			
		||||
  if (full_load)     
 | 
			
		||||
  {
 | 
			
		||||
//  if (full_load)     
 | 
			
		||||
//  {
 | 
			
		||||
    if (_ivarid)
 | 
			
		||||
      set_iva(anamag().get("CODIVAR"));
 | 
			
		||||
    else
 | 
			
		||||
      set_iva(anamag().get("CODIVA"));
 | 
			
		||||
  }
 | 
			
		||||
//  }
 | 
			
		||||
 | 
			
		||||
  const char gestione = config_ditta().get_char( "GESSCORIGA", "ve" );                        
 | 
			
		||||
  const bool sco_scagl =  config_ditta().get_bool("GESCOSCA", "ve");
 | 
			
		||||
  const bool sco_um_gest =  config_ditta().get_bool("GESSCORIGAUM", "ve");
 | 
			
		||||
      
 | 
			
		||||
  if (!full_load && gestione != 'A' && !sco_scagl)
 | 
			
		||||
  {
 | 
			
		||||
    if (gestione == 'L' && found_condv)
 | 
			
		||||
      set_sconto(_rcondv.get("SCONTO"));
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
//  if (!full_load && gestione != 'A' && !sco_scagl)
 | 
			
		||||
//  {
 | 
			
		||||
//    if (gestione == 'L' && found_condv)
 | 
			
		||||
//      set_sconto(_rcondv.get("SCONTO"));
 | 
			
		||||
//}
 | 
			
		||||
//  else
 | 
			
		||||
  {
 | 
			
		||||
    switch (gestione)
 | 
			
		||||
    {
 | 
			
		||||
@ -377,7 +384,12 @@ void TCond_vendita::ricerca(bool full_load)
 | 
			
		||||
      case 'L':
 | 
			
		||||
        // Percentuale su contratti/offerte/listini/anagrafica   
 | 
			
		||||
        if (found_condv)
 | 
			
		||||
        {
 | 
			
		||||
          _load_mask |= load_scagl_only && cv_scagl;
 | 
			
		||||
          _load_mask |= load_um_only && cv_um;
 | 
			
		||||
          set_sconto(_rcondv.get("SCONTO"));
 | 
			
		||||
          _load_mask = !load_um_only && !load_scagl_only;  
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
          set_sconto(anamag().get("SCONTO"));
 | 
			
		||||
        break;
 | 
			
		||||
@ -390,7 +402,7 @@ void TCond_vendita::ricerca(bool full_load)
 | 
			
		||||
          _sconti.put("TIPO", "R");
 | 
			
		||||
          if( config_ditta().get_bool("GESSCORIGACV", "ve"))
 | 
			
		||||
            _sconti.put("CODCAT", clifo().get(LF_CFVEN, "CATVEN"));
 | 
			
		||||
          if( config_ditta().get_bool("GESSCORIGAUM", "ve"))
 | 
			
		||||
          if (sco_um_gest)
 | 
			
		||||
            _sconti.put("UM", riga().get( FR_UMQTA));
 | 
			
		||||
          _sconti.put("TIPORIGA", rigakey);
 | 
			
		||||
 | 
			
		||||
@ -448,7 +460,10 @@ void TCond_vendita::ricerca(bool full_load)
 | 
			
		||||
          }                                                                  
 | 
			
		||||
          if (!found)
 | 
			
		||||
            _sconti.zero();
 | 
			
		||||
          _load_mask |= load_scagl_only && sco_scagl;
 | 
			
		||||
          _load_mask |= load_scagl_only && sco_um_gest;
 | 
			
		||||
          set_sconto(_sconti.get("SCONTO"));
 | 
			
		||||
          _load_mask = !load_um_only && !load_scagl_only;  
 | 
			
		||||
        }
 | 
			
		||||
        break; 
 | 
			
		||||
      case 'C':
 | 
			
		||||
@ -476,12 +491,12 @@ void TCond_vendita::ricerca(bool full_load)
 | 
			
		||||
        if (tipoprovv <= ' ')
 | 
			
		||||
          tipoprovv = config_ditta().get_char( "AGETIPOPERC", "ve" );
 | 
			
		||||
          
 | 
			
		||||
        if (!full_load)
 | 
			
		||||
        {
 | 
			
		||||
          if (tipoprovv == 'L' && found_condv)
 | 
			
		||||
            set_provv(_rcondv.get_real("PERCPROVV"));
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
//        if (!full_load)
 | 
			
		||||
//        {
 | 
			
		||||
//          if (tipoprovv == 'L' && found_condv)
 | 
			
		||||
//            set_provv(_rcondv.get_real("PERCPROVV"));
 | 
			
		||||
//        }
 | 
			
		||||
//        else
 | 
			
		||||
        {
 | 
			
		||||
          switch (tipoprovv)
 | 
			
		||||
          {
 | 
			
		||||
@ -493,7 +508,11 @@ void TCond_vendita::ricerca(bool full_load)
 | 
			
		||||
              break;                                              
 | 
			
		||||
            case 'L':
 | 
			
		||||
              if (found_condv)
 | 
			
		||||
              {
 | 
			
		||||
                _load_mask |= load_scagl_only && sco_scagl;
 | 
			
		||||
                _load_mask |= load_scagl_only && sco_um_gest;
 | 
			
		||||
                set_provv(_rcondv.get_real("PERCPROVV"));
 | 
			
		||||
              }
 | 
			
		||||
              else
 | 
			
		||||
                set_provv(anamag().get_real("PERCPROVV"));
 | 
			
		||||
              break;
 | 
			
		||||
@ -524,9 +543,9 @@ void TCond_vendita::ricerca(bool full_load)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TCond_vendita::TCond_vendita(TCliFor& clifo, TConfig * ditta, TMask * testa, TMask * riga,
 | 
			
		||||
TCond_vendita::TCond_vendita(TCliFor * clifo, TConfig * ditta, TMask * testa, TMask * riga,
 | 
			
		||||
                             TLocalisamfile * anamag, TLocalisamfile * umart)
 | 
			
		||||
             : _clifo(&clifo), _testa(testa), _riga(riga),
 | 
			
		||||
             : _clifo(clifo), _testa(testa), _riga(riga),
 | 
			
		||||
               _condv( LF_CONDV ), _rcondv( LF_RCONDV ), _sconti( LF_SCONTI ),
 | 
			
		||||
               _anamag(anamag), _umart(umart), _config_ditta(ditta), _ivarid(FALSE)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
@ -34,6 +34,7 @@ class TCond_vendita : public TObject
 | 
			
		||||
  TConfig * _config_ditta;
 | 
			
		||||
  TMask * _testa;
 | 
			
		||||
  TMask * _riga; 
 | 
			
		||||
  bool _load_mask;
 | 
			
		||||
 | 
			
		||||
  bool cerca(int tiporicerca);    
 | 
			
		||||
  
 | 
			
		||||
@ -43,7 +44,7 @@ protected:
 | 
			
		||||
  void set_iva(const TString & codiva);
 | 
			
		||||
 | 
			
		||||
  TCliFor & clifo() const { CHECK(_clifo, "Cliente/fornitore non inizializzato"); return * _clifo; }
 | 
			
		||||
  TConfig & config_ditta() const { CHECK(_clifo, "Configurazione ditta non inizializzata"); return * _config_ditta; }
 | 
			
		||||
  TConfig & config_ditta() const { CHECK(_config_ditta, "Configurazione ditta non inizializzata"); return * _config_ditta; }
 | 
			
		||||
  TMask & testa() const { CHECK(_testa, "Maschera testata non inizializzata"); return * _testa; }
 | 
			
		||||
  TMask & riga() const { CHECK(_testa, "Maschera testata non inizializzata"); return * _riga; }
 | 
			
		||||
  TLocalisamfile & anamag() const { CHECK(_anamag, "Anagrafica di magazzino non inizializzata") ; return *_anamag; }
 | 
			
		||||
@ -62,10 +63,10 @@ public:
 | 
			
		||||
  void set_riga( TMask * riga ){ _riga = riga; }
 | 
			
		||||
  void set_anamag(TLocalisamfile & anamag) { _anamag = &anamag; }
 | 
			
		||||
  void set_umart(TLocalisamfile & umart) { _umart = &umart; }
 | 
			
		||||
  void ricerca(bool full_load = TRUE);
 | 
			
		||||
  void ricerca(bool load_um_only = FALSE, bool load_scagl_only = FALSE);
 | 
			
		||||
  bool gestum() const { return _condv.get_bool("GESTUM"); }
 | 
			
		||||
  
 | 
			
		||||
  TCond_vendita(TCliFor & clifo, TConfig * _ditta = NULL, TMask * testa = NULL, TMask * riga = NULL,
 | 
			
		||||
  TCond_vendita(TCliFor * clifo = NULL, TConfig * _ditta = NULL, TMask * testa = NULL, TMask * riga = NULL,
 | 
			
		||||
                TLocalisamfile * anamag = NULL, TLocalisamfile * umart = NULL);    
 | 
			
		||||
  ~TCond_vendita() {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -143,9 +143,8 @@ void TCliForVendite::update_mask( TMask& m, bool onload )
 | 
			
		||||
    set( m, F_CODVETT1, LF_CFVEN, "CODVETT1" );
 | 
			
		||||
    set( m, F_CODVETT2, LF_CFVEN, "CODVETT2" );
 | 
			
		||||
    set( m, F_CODVETT3, LF_CFVEN, "CODVETT3" );
 | 
			
		||||
    set( m, F_SPESEINC, LF_CFVEN, "ADDSPINC" );  
 | 
			
		||||
    set( m, F_ADDBRB, LF_CFVEN, "ADDBOLLIRB" );
 | 
			
		||||
    set( m, F_ADDBTR, LF_CFVEN, "ADDBOLLITR" );
 | 
			
		||||
    set( m, F_SPESEINC, LF_CFVEN, "PERCSPINC" );  
 | 
			
		||||
    set( m, F_ADDBOLLI, LF_CFVEN, "ADDBOLLI" );
 | 
			
		||||
    set(m, F_CATVEN, LF_CFVEN, "CATVEN");
 | 
			
		||||
    if (m.id2pos(F_CODLIST) >= 0 && m.field(F_CODLIST).active())
 | 
			
		||||
      set(m, F_CODLIST, LF_CFVEN, "CODLIST");
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										282
									
								
								ve/ve0100.cpp
									
									
									
									
									
								
							
							
						
						
									
										282
									
								
								ve/ve0100.cpp
									
									
									
									
									
								
							@ -6,13 +6,22 @@
 | 
			
		||||
#include "ve0100o.h"
 | 
			
		||||
#endif                    
 | 
			
		||||
 | 
			
		||||
#ifndef __VEINI_H
 | 
			
		||||
#include "veini.h"
 | 
			
		||||
#endif                    
 | 
			
		||||
 | 
			
		||||
#ifndef __UTILITY_H
 | 
			
		||||
#include "utility.h"
 | 
			
		||||
#endif                    
 | 
			
		||||
 | 
			
		||||
void TMotore_application::init_query_mode( TMask& m )
 | 
			
		||||
{
 | 
			
		||||
     _msk->set( F_CODNUM, _doc->numerazione()); 
 | 
			
		||||
     _msk->field(F_CODNUM).set_focusdirty(TRUE);
 | 
			
		||||
     _msk->field(F_CODNUM).on_key(K_TAB);
 | 
			
		||||
     _msk->field(F_CODNUM).set_dirty(FALSE);
 | 
			
		||||
     _msk->set( F_TIPODOC, _doc->tipo().codice(), TRUE); 
 | 
			
		||||
     
 | 
			
		||||
     _msk->set( F_TIPODOC, _doc->get("TIPODOC"), TRUE); 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TMotore_application::init_insert_mode( TMask& m )
 | 
			
		||||
@ -26,7 +35,7 @@ void TMotore_application::init_insert_mode( TMask& m )
 | 
			
		||||
  const long numdoc = m.get_long(F_NDOC);
 | 
			
		||||
  
 | 
			
		||||
  _doc->read(provv, anno, codnum, numdoc);
 | 
			
		||||
  _doc->head().put("TIPODOC", m.get(F_TIPODOC));
 | 
			
		||||
  _doc->set_tipo(m.get(F_TIPODOC));
 | 
			
		||||
 | 
			
		||||
  m.field(F_CODNUM).set_focusdirty(TRUE);
 | 
			
		||||
  m.field(F_CODNUM).on_key(K_TAB);
 | 
			
		||||
@ -82,44 +91,11 @@ int TMotore_application::user_function( int index )
 | 
			
		||||
 | 
			
		||||
// Funzione che dato il profilo di riga ottiene la maschera
 | 
			
		||||
// Serve per ottenere una maschera diversa per ogni riga
 | 
			
		||||
TMask *TMotore_application::ss_getmask( int numriga, TMask& fullmask, bool destroy )
 | 
			
		||||
TMask * TMotore_application::ss_getmask( int numriga, TMask& fullmask)
 | 
			
		||||
{
 | 
			
		||||
  static TRiga* r = NULL;
 | 
			
		||||
  TRiga_documento & riga = (*(app()._doc))[numriga + 1];
 | 
			
		||||
    
 | 
			
		||||
  if ( destroy )
 | 
			
		||||
  {
 | 
			
		||||
    delete r;
 | 
			
		||||
    r = NULL;
 | 
			
		||||
    return( NULL ); 
 | 
			
		||||
  }
 | 
			
		||||
  else  
 | 
			
		||||
  { 
 | 
			
		||||
    TSheet_field & ss = *fullmask.get_sheet( );  
 | 
			
		||||
    TToken_string& riga = ss.row( numriga );
 | 
			
		||||
    const TString tipo(riga.get( ss.cid2index(FR_TIPORIGA)));
 | 
			
		||||
 | 
			
		||||
    if ( tipo.blank() ) return &fullmask;
 | 
			
		||||
    if ( !r )
 | 
			
		||||
      r = new TRiga;
 | 
			
		||||
    if(r->tipo() != tipo)
 | 
			
		||||
    {    
 | 
			
		||||
      r->load(ss, riga);
 | 
			
		||||
    }                       
 | 
			
		||||
    TAssoc_array & row_masks = app()._row_masks;
 | 
			
		||||
    TVariable_mask * row_mask = (TVariable_mask *) row_masks.objptr(tipo);
 | 
			
		||||
    if (row_mask == NULL)
 | 
			
		||||
    {
 | 
			
		||||
      row_mask = r->getmask();
 | 
			
		||||
      row_mask->set_sheet( &ss );
 | 
			
		||||
      row_masks.add(tipo, row_mask);
 | 
			
		||||
    }
 | 
			
		||||
    return( row_mask );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TMotore_application::azzera_piedi( )
 | 
			
		||||
{
 | 
			
		||||
  _piede.destroy( );
 | 
			
		||||
  return ((TTipo_riga_documento &)riga.tipo()).mask();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TMotore_application::user_set_handler( int fieldid, int index, TMask* m )
 | 
			
		||||
@ -143,50 +119,26 @@ void TMotore_application::user_set_handler( int fieldid, int index, TMask* m )
 | 
			
		||||
bool TMotore_application::ss_handler( TSheet_field& ss, int r, KEY key )
 | 
			
		||||
 | 
			
		||||
{ 
 | 
			
		||||
  static TRiga * riga = NULL;
 | 
			
		||||
  if ( key == K_ENTER ) // Cancellazione
 | 
			
		||||
  {
 | 
			
		||||
    TRiga_documento & riga = (*(app()._doc))[r + 1];
 | 
			
		||||
    
 | 
			
		||||
  if ( key == K_SPACE ) // Inizio modifica
 | 
			
		||||
  {
 | 
			
		||||
    TPiede_documento& piede = app( ).piede( );
 | 
			
		||||
    riga->edit_keys( key, piede );
 | 
			
		||||
    riga.autosave(ss);
 | 
			
		||||
  }
 | 
			
		||||
  if ( key == K_TAB ) // Mi posiziono su di una riga nello sheet
 | 
			
		||||
  {
 | 
			
		||||
    if ( riga )     
 | 
			
		||||
      delete riga;
 | 
			
		||||
    riga = new TRiga;
 | 
			
		||||
  else
 | 
			
		||||
    if ( key == K_DEL ) // Cancellazione
 | 
			
		||||
      app()._doc->destroy_row(r + 1, TRUE);
 | 
			
		||||
    else
 | 
			
		||||
      if ( key == K_INS ) // Inserimento              
 | 
			
		||||
      {
 | 
			
		||||
        TMask & emask = app().edit_mask();             
 | 
			
		||||
        TRiga_documento & riga = app()._doc->insert_row(r + 1, emask.get( F_LBTIPORIGA ));
 | 
			
		||||
        
 | 
			
		||||
    riga->load(ss,  ss.row( r ));
 | 
			
		||||
  }
 | 
			
		||||
  if ( key == K_INS ) // Inserimento              
 | 
			
		||||
  {
 | 
			
		||||
    TMask & emask = app().edit_mask();
 | 
			
		||||
    TToken_string& tsr = ss.row( r );
 | 
			
		||||
    tsr.add(emask.get( F_LBTIPORIGA ), FR_TIPORIGA - 101 );
 | 
			
		||||
    tsr.add("", FR_STATORIGA - 101 );
 | 
			
		||||
    if ( riga )     
 | 
			
		||||
      delete riga;
 | 
			
		||||
    riga = new TRiga;
 | 
			
		||||
    riga->load(ss, tsr);    
 | 
			
		||||
    return TRUE;    
 | 
			
		||||
  }     
 | 
			
		||||
  if (key == K_CTRL + K_INS)
 | 
			
		||||
  {
 | 
			
		||||
    ss.select(r);
 | 
			
		||||
    return TRUE;
 | 
			
		||||
  }
 | 
			
		||||
  if ( key == K_DEL ) // Cancellazione
 | 
			
		||||
  { 
 | 
			
		||||
    TPiede_documento& piede = app( ).piede( );
 | 
			
		||||
    riga->edit_keys( key, piede );
 | 
			
		||||
    return TRUE;
 | 
			
		||||
  }
 | 
			
		||||
  if ( key == K_ENTER ) // Modifica
 | 
			
		||||
  {
 | 
			
		||||
    TPiede_documento& piede = app( ).piede( );
 | 
			
		||||
    riga->edit_keys( key, piede );
 | 
			
		||||
    return TRUE;
 | 
			
		||||
  }
 | 
			
		||||
        riga.autoload(ss);    
 | 
			
		||||
      }
 | 
			
		||||
      else     
 | 
			
		||||
        if (key == K_CTRL + K_INS)
 | 
			
		||||
          ss.select(r);
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -209,7 +161,6 @@ bool TMotore_application::num_handler( TMask_field& f, KEY key )
 | 
			
		||||
          
 | 
			
		||||
        // Propone il primo tipo di documento come default
 | 
			
		||||
      m.set( F_TIPODOC, tipidocs.left( 4 ) );
 | 
			
		||||
        // m.field( F_TIPODOC ).check( );      
 | 
			
		||||
      m.send_key( K_TAB, F_TIPODOC );
 | 
			
		||||
      // Se per questa numerazione h abilitata le numerazione provvisoria
 | 
			
		||||
      if ( tabnum.get_bool ( "B0" ) )
 | 
			
		||||
@ -343,42 +294,6 @@ bool TMotore_application::clifo_handler( TMask_field& f, KEY key )
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 void TMotore_application::carica_piedi( )
 | 
			
		||||
{               
 | 
			
		||||
/*
 | 
			
		||||
  TToken_string s( pro( ).get( "PROGPIEDE", "MAIN" ) ); // prof
 | 
			
		||||
  TString s1 = s.get( );
 | 
			
		||||
  TTable ppd( "PPD" );
 | 
			
		||||
  while( !s1.blank( ) )
 | 
			
		||||
  {
 | 
			
		||||
    ppd.zero( );
 | 
			
		||||
    ppd.put( "CODTAB", s1 );
 | 
			
		||||
    if( ppd.read( ) == NOERR )
 | 
			
		||||
    {
 | 
			
		||||
      real valpiede( "0.0" );
 | 
			
		||||
      if ( _piede.is_key( s1 ) )
 | 
			
		||||
        valpiede = ( real & )( _piede[ s1 ] );
 | 
			
		||||
      edit_mask( ).set( BASE_PIEDE + ppd.get_int( "I0" ), valpiede.stringa( 15 ) );
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
      message_box( "Piede non trovato( %s )", ( const char * )s1 );
 | 
			
		||||
    s1 = s.get( );
 | 
			
		||||
  }
 | 
			
		||||
*/
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TMotore_application::somma_piedi( )
 | 
			
		||||
{ 
 | 
			
		||||
  /*for ( int i = 0; i < NPIEDI; i++ )
 | 
			
		||||
    _piedi[ i ] += _piedi_temp[ i ];*/
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TMotore_application::sottrai_piedi( )
 | 
			
		||||
{ 
 | 
			
		||||
  /*for ( int i = 0; i < NPIEDI; i++ )
 | 
			
		||||
    _piedi[ i ] -= _piedi_temp[ i ];*/
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TMotore_application::changing_mask( int mode )
 | 
			
		||||
{ 
 | 
			
		||||
  static int lastmode = NO_MODE;
 | 
			
		||||
@ -440,40 +355,34 @@ TMask* TMotore_application::get_mask( int mode )
 | 
			
		||||
      {                
 | 
			
		||||
        const TString16 tipodoc(_msk->get(F_TIPODOC)); 
 | 
			
		||||
        
 | 
			
		||||
        _doc->head().put("TIPODOC", tipodoc);
 | 
			
		||||
        
 | 
			
		||||
        TVariable_mask * msk1 = (TVariable_mask *) _doc_masks.objptr(tipodoc);
 | 
			
		||||
        TDocumento_mask * msk1 = (TDocumento_mask *) _doc_masks.objptr(tipodoc);
 | 
			
		||||
        
 | 
			
		||||
        _doc->set_tipo(tipodoc);
 | 
			
		||||
        update_profile();
 | 
			
		||||
        
 | 
			
		||||
        TString tipocf( app( ).pro( ).get( "TIPOCF", "MAIN" ) );     //prof
 | 
			
		||||
        app( ).tipocf( tipocf[ 0 ] );
 | 
			
		||||
        if (msk1 == NULL)
 | 
			
		||||
        {
 | 
			
		||||
          msk1 = new TVariable_mask(_doc->tipo().mask_name()); // prof
 | 
			
		||||
          msk1 = new TDocumento_mask(_doc->tipo().mask_name(), _doc); // prof
 | 
			
		||||
          _doc_masks.add(tipodoc, msk1);
 | 
			
		||||
          _sheet = &( TSheet_field& )msk1->field( F_SHEET );
 | 
			
		||||
           sheet( ).set_notify( ss_handler );
 | 
			
		||||
           sheet().set_append(FALSE);
 | 
			
		||||
          TList_field& listbox = ( TList_field& ) msk1->field( F_LBTIPORIGA );
 | 
			
		||||
          const int numtr = app( ).pro( ).get_int( "NTIPIRIGA", "RIGHE" ); //prof
 | 
			
		||||
          TTable tabtr( "%TRI" );
 | 
			
		||||
          TToken_string keys( "" ), descrs( "" );
 | 
			
		||||
          TToken_string keys, descrs; 
 | 
			
		||||
          TRiga_documento r(_doc);
 | 
			
		||||
          
 | 
			
		||||
          for ( int i = 1; i <= numtr; i ++ )
 | 
			
		||||
          {                                  
 | 
			
		||||
            TString chiave;
 | 
			
		||||
            TToken_string item;
 | 
			
		||||
            chiave.format( "%d", i );
 | 
			
		||||
            tabtr.zero( );
 | 
			
		||||
            TString tiporiga( app( ).pro( ).get( chiave, "RIGHE" ) );  // pro
 | 
			
		||||
            tabtr.put( "CODTAB", tiporiga );
 | 
			
		||||
            if ( tabtr.read( ) == NOERR )
 | 
			
		||||
            { 
 | 
			
		||||
              keys.add( tabtr.get( "CODTAB" ) );
 | 
			
		||||
              descrs.add( tabtr.get( "S0" ) );
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
              error_box( "Inserito un tipo di riga non valido ( %s )", ( const char * )tiporiga );
 | 
			
		||||
            TString16 var;      
 | 
			
		||||
            
 | 
			
		||||
            var.format("%d", i);
 | 
			
		||||
            TString tiporiga(app().pro().get(var, "RIGHE"));  // pro
 | 
			
		||||
            r.set_tipo(tiporiga);
 | 
			
		||||
            keys.add(r.tipo().codice());
 | 
			
		||||
            descrs.add(r.tipo().descrizione());
 | 
			
		||||
          }
 | 
			
		||||
          listbox.replace_items( keys, descrs );    
 | 
			
		||||
          configura_sheet( *_sheet, *_pro );
 | 
			
		||||
@ -628,14 +537,10 @@ const char* TMotore_application::get_next_key( )
 | 
			
		||||
 | 
			
		||||
int TMotore_application::read( TMask& m )
 | 
			
		||||
{  
 | 
			
		||||
  azzera_piedi( );         
 | 
			
		||||
  
 | 
			
		||||
  TRectype & curr = _rel->lfile().curr();
 | 
			
		||||
  const int err = _doc->read(curr);
 | 
			
		||||
  const int err = _doc->read(_doc->head());
 | 
			
		||||
  
 | 
			
		||||
  if ( err == NOERR )
 | 
			
		||||
  {                        
 | 
			
		||||
    curr = _doc->head();
 | 
			
		||||
    m.autoload(*_rel);
 | 
			
		||||
    const char tipocf = _doc->head().get("TIPOCF")[0];
 | 
			
		||||
    const long codcf = _doc->head().get_long("CODCF");
 | 
			
		||||
@ -650,16 +555,12 @@ int TMotore_application::read( TMask& m )
 | 
			
		||||
    const int rows = _doc->rows();
 | 
			
		||||
    for (int i = 1; i <= rows; i++)
 | 
			
		||||
    {                                    
 | 
			
		||||
      TToken_string& srow = f.row( i - 1 );
 | 
			
		||||
      TRectype& rec = (*_doc)[i];
 | 
			
		||||
      TToken_string & r = f.row(i -1);
 | 
			
		||||
      TRiga_documento & rec = (*_doc)[i];
 | 
			
		||||
      
 | 
			
		||||
      TRiga currentrow;
 | 
			
		||||
      
 | 
			
		||||
      currentrow.load( rec );
 | 
			
		||||
      currentrow.save(f, srow);
 | 
			
		||||
      rec.autoload(f);
 | 
			
		||||
      f.post_insert(i - 1);
 | 
			
		||||
    } 
 | 
			
		||||
    carica_piedi( );
 | 
			
		||||
  }
 | 
			
		||||
  return err;
 | 
			
		||||
}
 | 
			
		||||
@ -676,22 +577,10 @@ int TMotore_application::write( const TMask& m )  // C 90
 | 
			
		||||
    if ( err == NOERR )
 | 
			
		||||
    {  
 | 
			
		||||
      m.autosave(*_rel);   
 | 
			
		||||
      _doc->head() =  _rel->lfile().curr();
 | 
			
		||||
      TSheet_field& f = ss( );
 | 
			
		||||
      _doc->destroy_rows();
 | 
			
		||||
      for ( int i = 0; i < f.items( ); i ++ )
 | 
			
		||||
      {
 | 
			
		||||
        TToken_string& t = f.row( i );
 | 
			
		||||
        TRectype& rec = _doc->new_row(); 
 | 
			
		||||
        store_riga( f, i, rec );
 | 
			
		||||
      } 
 | 
			
		||||
      err = _doc->write( );      
 | 
			
		||||
    }
 | 
			
		||||
    if (err == NOERR)
 | 
			
		||||
    {
 | 
			
		||||
      _rel->curr() = _doc->head();
 | 
			
		||||
      _rel->read();                  // per posizionare correttamente la relazione
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  return err;
 | 
			
		||||
@ -710,16 +599,6 @@ int TMotore_application::rewrite( const TMask& m ) // C 90
 | 
			
		||||
    if ( err == NOERR )
 | 
			
		||||
    {  
 | 
			
		||||
      m.autosave(*_rel);   
 | 
			
		||||
      _doc->head() =  _rel->lfile().curr();
 | 
			
		||||
      
 | 
			
		||||
      TSheet_field& f = ss( );
 | 
			
		||||
      _doc->destroy_rows( );
 | 
			
		||||
      for ( int i = 0; i < f.items( ); i ++ )
 | 
			
		||||
      {
 | 
			
		||||
        TToken_string& t = f.row( i );
 | 
			
		||||
        TRectype& rec = _doc->new_row(); 
 | 
			
		||||
        store_riga( f, i, rec );
 | 
			
		||||
      } 
 | 
			
		||||
      err = _doc->rewrite( );      
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
@ -735,57 +614,6 @@ bool TMotore_application::remove( void )  // C 80
 | 
			
		||||
  return _doc->remove() == NOERR;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TMotore_application::load_riga( TSheet_field& f, int numrig, TRectype& r )
 | 
			
		||||
{
 | 
			
		||||
  TToken_string& riga = f.row( numrig );
 | 
			
		||||
  riga = r.get( "STATORIGA" );
 | 
			
		||||
  riga.add( r.get( "TIPORIGA" ) );
 | 
			
		||||
  TFilename proname( r.get( "PROFRIGA" ) );
 | 
			
		||||
  riga.add( proname );
 | 
			
		||||
  riga.add( r.get( "CODMAG" ) );
 | 
			
		||||
  riga.add( r.get( "CODART" ) );
 | 
			
		||||
  riga.add( r.get( "DESCR" ) ); 
 | 
			
		||||
  riga.add( r.get( "DESCLUNGA" ) );
 | 
			
		||||
  riga.add( r.get( "PREZZO" ) );
 | 
			
		||||
  riga.add( r.get( "UMQTA" ) ); 
 | 
			
		||||
  riga.add( r.get_real( "QTA" ).string( 11 ) );
 | 
			
		||||
  riga.add( r.get( "QTAEVASA" ) );
 | 
			
		||||
  riga.add( r.get( "RIGAEVASA" ) );
 | 
			
		||||
  riga.add( r.get( "TARA" ) );
 | 
			
		||||
  riga.add( r.get( "PNETTO" ) );
 | 
			
		||||
  riga.add( r.get( "NCOLLI" ) );
 | 
			
		||||
  riga.add( r.get( "DAEVADERE" ) );
 | 
			
		||||
  riga.add( r.get( "SCONTO" ) );
 | 
			
		||||
  riga.add( r.get( "PERCPROV" ) );
 | 
			
		||||
  riga.add( r.get( "IMPFISSO" ) );
 | 
			
		||||
  riga.add( r.get( "IMPFISUN" ) );
 | 
			
		||||
  riga.add( r.get( "CODIVA" ) );
 | 
			
		||||
  riga.add( r.get( "ADDIVA" ) );
 | 
			
		||||
  riga.add( r.get( "ASPBENI" ) );
 | 
			
		||||
  proname.ext( "ini" );
 | 
			
		||||
  TConfig pro( proname ); 
 | 
			
		||||
  int ncols = pro.get_int( "NCOLS", "COLUMNS" );
 | 
			
		||||
  // Disabilita tutte le colonne
 | 
			
		||||
  for ( int i = 1; i <= MAX_COLUMNS; i ++ )
 | 
			
		||||
    f.disable_cell ( f.items( ) - 1, i );
 | 
			
		||||
  // Abilita le colonne indicate nel profilo della riga  
 | 
			
		||||
  for ( i = 1; i <= ncols; i ++ )
 | 
			
		||||
  {
 | 
			
		||||
    TString16 chiave;
 | 
			
		||||
    chiave.format( "%d", i );
 | 
			
		||||
    int coltoenable = pro.get_int( chiave, "COLUMNS" );
 | 
			
		||||
    f.enable_cell ( numrig - 1, coltoenable - 1 );
 | 
			
		||||
  }
 | 
			
		||||
}                                           
 | 
			
		||||
 | 
			
		||||
void TMotore_application::store_riga( TSheet_field& f, int numrig, TRectype& r )
 | 
			
		||||
{
 | 
			
		||||
  TToken_string& rigastr = f.row( numrig );
 | 
			
		||||
  TRiga riga; 
 | 
			
		||||
  riga.load(f, rigastr, &r);
 | 
			
		||||
  riga.save( r );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TMotore_application::open_files(int logicnum, ...)  
 | 
			
		||||
{  
 | 
			
		||||
  va_list marker;
 | 
			
		||||
@ -805,7 +633,6 @@ void TMotore_application::on_firm_change()
 | 
			
		||||
  _config_ditta = new TConfig(CONFIG_DITTA);
 | 
			
		||||
  condv().set_config(_config_ditta);
 | 
			
		||||
  _doc_masks.destroy();
 | 
			
		||||
  _row_masks.destroy();
 | 
			
		||||
  TApplication::on_firm_change();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -830,17 +657,19 @@ bool TMotore_application::user_create( )
 | 
			
		||||
  _rel = new TRelation( LF_DOC );
 | 
			
		||||
  open_files(LF_RIGHEDOC, LF_CONDV, LF_RCONDV, LF_ANAMAG, LF_SCONTI, LF_UMART, 0);
 | 
			
		||||
  _doc = new TDocumento;
 | 
			
		||||
  _rel->lfile().set_curr(_doc);
 | 
			
		||||
  _doc->set_relation(_rel);
 | 
			
		||||
  
 | 
			
		||||
  _clifor = new TCliForVendite( );
 | 
			
		||||
  _condv = new TCond_vendita(*_clifor, _config_ditta);
 | 
			
		||||
  _condv = new TCond_vendita(_clifor, _config_ditta);
 | 
			
		||||
  _doc->set_condv(_condv);
 | 
			
		||||
                                  
 | 
			
		||||
  azzera_piedi( );
 | 
			
		||||
  _msk = new TMask( "ve0100a" ); 
 | 
			
		||||
  query_mask( ).set_handler( F_CODNUM, num_handler );
 | 
			
		||||
  query_mask( ).set_handler( F_TIPODOC, tip_handler );
 | 
			
		||||
  TConfig utente( CONFIG_USER );
 | 
			
		||||
  _doc->head().put("CODNUM", utente.get("CODNUM"));
 | 
			
		||||
  _doc->head().put("TIPODOC", utente.get("TIPODOC"));
 | 
			
		||||
  _msk->set(F_CODNUM, utente.get("CODNUM"));
 | 
			
		||||
  _msk->set(F_TIPODOC, utente.get("TIPODOC"));
 | 
			
		||||
  // La maschera di inserimento/modifica per ora non la so!
 | 
			
		||||
  // Viene letta dal profilo non appena trovato il record
 | 
			
		||||
 | 
			
		||||
@ -852,7 +681,7 @@ bool TMotore_application::user_destroy( )
 | 
			
		||||
  // Registro l'ultimo tipo documento e l'ultima numerazione
 | 
			
		||||
  TConfig utente( CONFIG_USER );
 | 
			
		||||
  utente.set( "CODNUM", _doc->numerazione(), "ve" );
 | 
			
		||||
  utente.set( "TIPODOC", _doc->tipo().codice(), "ve" );
 | 
			
		||||
  utente.set( "TIPODOC", _doc->get("TIPODOC"), "ve" );
 | 
			
		||||
 | 
			
		||||
  if (_config_ditta != NULL)
 | 
			
		||||
    delete _config_ditta;
 | 
			
		||||
@ -861,7 +690,6 @@ bool TMotore_application::user_destroy( )
 | 
			
		||||
    delete _msk;
 | 
			
		||||
  
 | 
			
		||||
  // Distruggo la relazione
 | 
			
		||||
  delete _doc;
 | 
			
		||||
  delete _rel;
 | 
			
		||||
  delete _condv;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										47
									
								
								ve/ve0100.h
									
									
									
									
									
								
							
							
						
						
									
										47
									
								
								ve/ve0100.h
									
									
									
									
									
								
							@ -14,27 +14,8 @@
 | 
			
		||||
#define NO_CHANGE_STATUS              -1
 | 
			
		||||
// #define NO_DOC_STATUS                 -2
 | 
			
		||||
 | 
			
		||||
#define F_SHEET                                        500
 | 
			
		||||
#define F_MEMORIGA                                     501
 | 
			
		||||
#define BASE_PIEDE                                     600
 | 
			
		||||
 | 
			
		||||
#define CHANGE_MESSAGE "Sono state effettuate modifiche alla configurazione.\nPrima di eseguire la gestione documenti occorre rigenerare le maschere.\nDesideri farlo ora ?"
 | 
			
		||||
 | 
			
		||||
// Modifiche pianificate per il dopo/cattolica:
 | 
			
		||||
// Rorganizzazione del codice come:
 | 
			
		||||
//   Oggetto documento
 | 
			
		||||
//     che contiene:
 | 
			
		||||
//        Array di oggetti riga
 | 
			
		||||
//        Oggetto Cliente
 | 
			
		||||
//        Oggetto Cambio
 | 
			
		||||
//        Oggetto Sconto testa
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define F_LBTIPORIGA 175
 | 
			
		||||
#define NPIEDI        40 
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// #include <xvt_defs.h>                                     
 | 
			
		||||
 | 
			
		||||
#ifndef __CHECKS_H
 | 
			
		||||
#include <checks.h>
 | 
			
		||||
@ -48,10 +29,6 @@
 | 
			
		||||
#include <tabutil.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __BRWAPP_H
 | 
			
		||||
#include <brwapp.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __RELAPP_H
 | 
			
		||||
#include <relapp.h>
 | 
			
		||||
#endif
 | 
			
		||||
@ -129,8 +106,6 @@ class TMotore_application : public TRelation_application
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  TArray _file;               // Tutti i fiels da usare
 | 
			
		||||
  // Array di totalizzatori
 | 
			
		||||
  TPiede_documento _piede;
 | 
			
		||||
 | 
			
		||||
  TDocumento * _doc;
 | 
			
		||||
 | 
			
		||||
@ -167,16 +142,11 @@ class TMotore_application : public TRelation_application
 | 
			
		||||
 | 
			
		||||
  TAssoc_array _doc_masks;
 | 
			
		||||
 | 
			
		||||
  // Array di maschere righe
 | 
			
		||||
 | 
			
		||||
  TAssoc_array _row_masks;
 | 
			
		||||
  
 | 
			
		||||
  // Ridefinizione dei metodi virtuali
 | 
			
		||||
  virtual bool user_create( );
 | 
			
		||||
  virtual bool user_destroy( );
 | 
			
		||||
  virtual TMask* get_mask( int mode );
 | 
			
		||||
  virtual bool changing_mask( int mode );
 | 
			
		||||
  virtual TRelation* get_relation( ) const { return _rel;}
 | 
			
		||||
  virtual void init_query_mode(TMask& m);
 | 
			
		||||
  virtual void init_insert_mode( TMask& m );
 | 
			
		||||
  virtual int read( TMask& m );
 | 
			
		||||
@ -194,11 +164,6 @@ class TMotore_application : public TRelation_application
 | 
			
		||||
 | 
			
		||||
  void user_set_handler( int fieldid, int index, TMask* m = NULL );
 | 
			
		||||
 | 
			
		||||
  void azzera_piedi( );   
 | 
			
		||||
  void carica_piedi( );
 | 
			
		||||
  void somma_piedi( );
 | 
			
		||||
  void sottrai_piedi( );
 | 
			
		||||
  
 | 
			
		||||
  // Esegue, se c'h, la procedura utente relativa ad una certa operazione
 | 
			
		||||
  int esegui_procedura( int operazione );
 | 
			
		||||
 | 
			
		||||
@ -214,8 +179,7 @@ protected:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  // formato dipendente dallo sheet ( sono le varie colonne )
 | 
			
		||||
  void load_riga( TSheet_field& f, int numrig, TRectype& r );
 | 
			
		||||
  void store_riga( TSheet_field& f, int numrig, TRectype& r );
 | 
			
		||||
// void load_riga( TSheet_field& f, int numrig, TRectype& r );
 | 
			
		||||
 | 
			
		||||
  void save( TRelation* r ) const;
 | 
			
		||||
  void set_descr ( int numrig, const char* descr );
 | 
			
		||||
@ -231,7 +195,7 @@ protected:
 | 
			
		||||
  TString& stati_validi( int operazione ){ return ( pro( ).get( "STATIVALIDI", nome_sezione( operazione ) ) );}
 | 
			
		||||
 | 
			
		||||
  // Handle che ritorna la maschera per le righe
 | 
			
		||||
  static TMask * ss_getmask( int numriga, TMask& fullmask, bool destroy );
 | 
			
		||||
  static TMask * ss_getmask( int numriga, TMask& fullmask);
 | 
			
		||||
 | 
			
		||||
  // Handler che gestisce la richiesta del tipo riga in inserimento
 | 
			
		||||
  static bool ss_handler( TSheet_field& ss, int r, KEY key );
 | 
			
		||||
@ -255,6 +219,8 @@ protected:
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
  virtual TRelation* get_relation( ) const { return _rel;}
 | 
			
		||||
 | 
			
		||||
  // Funzioni di accesso alle variabili private
 | 
			
		||||
 | 
			
		||||
  TConfig & pro() { CHECK( _pro, "Profilo del documento nullo!" ); return *_pro; }
 | 
			
		||||
@ -264,9 +230,9 @@ public:
 | 
			
		||||
  TRelation & rel() { CHECK( _rel, "Relazione nulla!" ); return *_rel; }
 | 
			
		||||
  TSheet_field & sheet() { CHECK( _sheet, "Sheet nullo!" ); return *_sheet; }
 | 
			
		||||
  TCliForVendite & clifo() { CHECK( _clifor, "Oggetto cliente nullo!" ); return *_clifor; }
 | 
			
		||||
  TPiede_documento & piede() { return _piede; }
 | 
			
		||||
  TCond_vendita & condv() { return *_condv; }
 | 
			
		||||
  TConfig & config_ditta() {return *_config_ditta; }
 | 
			
		||||
  TDocumento & doc() {return *_doc; }
 | 
			
		||||
 | 
			
		||||
  // Operazione
 | 
			
		||||
 | 
			
		||||
@ -281,5 +247,6 @@ public:
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
TMotore_application& app( ) { return ( TMotore_application&  ) main_app( ); }
 | 
			
		||||
inline TMotore_application & app() { return (TMotore_application &) main_app(); }
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										201
									
								
								ve/ve0100c.cpp
									
									
									
									
									
								
							
							
						
						
									
										201
									
								
								ve/ve0100c.cpp
									
									
									
									
									
								
							@ -21,11 +21,11 @@
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __VEUML_H
 | 
			
		||||
#include "VeUML.h"
 | 
			
		||||
#include "veuml.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __VEUML1_H
 | 
			
		||||
#include "VeUML1.h"
 | 
			
		||||
#include "veuml1.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __VE0100_H
 | 
			
		||||
@ -104,3 +104,200 @@ bool condpag_hndl( TMask_field& field, KEY key )
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// handler delle righe
 | 
			
		||||
 | 
			
		||||
void row_set_handler( TMask& m, const int field, const int index )
 | 
			
		||||
{
 | 
			
		||||
  switch ( index )
 | 
			
		||||
  {
 | 
			
		||||
    case 1:
 | 
			
		||||
      m.set_handler( field, dummy_hndl );
 | 
			
		||||
      break;
 | 
			
		||||
    default:
 | 
			
		||||
      yesnofatal_box( FALSE, "Funzione di handler sulla riga non definita( %d ).", index );
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
                                     
 | 
			
		||||
HIDDEN TString16 curr_um; 
 | 
			
		||||
HIDDEN real curr_fc(1.0);
 | 
			
		||||
                                     
 | 
			
		||||
bool codart_handler( TMask_field& f, KEY key )
 | 
			
		||||
{
 | 
			
		||||
  // Se qualcuno cerca di modificare la maschera
 | 
			
		||||
  if ( key == K_TAB && f.focusdirty())
 | 
			
		||||
  {            
 | 
			
		||||
    TMask& row_mask = f.mask();               
 | 
			
		||||
//    TMask & mask = app().edit_mask();
 | 
			
		||||
    TMask & mask = row_mask.get_sheet()->mask();
 | 
			
		||||
    TCond_vendita & condv = app().condv();
 | 
			
		||||
    
 | 
			
		||||
    condv.set_testa(&mask);
 | 
			
		||||
    condv.set_riga(&row_mask);
 | 
			
		||||
 | 
			
		||||
    TLocalisamfile & anamag = ((TEdit_field &) f).browse()->cursor()->file();
 | 
			
		||||
    TLocalisamfile & umart  = ((TEdit_field &) row_mask.field(FR_UMQTA)).browse()->cursor()->file();
 | 
			
		||||
    
 | 
			
		||||
    condv.set_anamag(anamag);
 | 
			
		||||
    condv.set_umart(umart);
 | 
			
		||||
    TString80 codart(f.get());   
 | 
			
		||||
    anamag.setkey(1);
 | 
			
		||||
    anamag.put("CODART", codart);
 | 
			
		||||
    if (anamag.read() != NOERR)
 | 
			
		||||
    {
 | 
			
		||||
      TLocalisamfile codalt(LF_CODCORR);
 | 
			
		||||
      
 | 
			
		||||
      codalt.setkey(2);
 | 
			
		||||
      codalt.put("CODARTALT", codart);
 | 
			
		||||
      if (codalt.read() == NOERR)
 | 
			
		||||
      {                              
 | 
			
		||||
        codart = codalt.get("CODART");
 | 
			
		||||
        anamag.zero();
 | 
			
		||||
        anamag.put("CODART", codart);
 | 
			
		||||
        if (anamag.read() == NOERR)
 | 
			
		||||
          f.set(codart);
 | 
			
		||||
      }
 | 
			
		||||
    }   
 | 
			
		||||
 | 
			
		||||
    if (anamag.good())
 | 
			
		||||
    {
 | 
			
		||||
      const TString16 lingua = mask.get(F_CODLIN);                              
 | 
			
		||||
      const TString codart(row_mask.get(FR_CODART));
 | 
			
		||||
      TString desc(anamag.get("DESCR"));
 | 
			
		||||
      
 | 
			
		||||
      if (lingua.not_empty())
 | 
			
		||||
      {
 | 
			
		||||
        TLocalisamfile deslin(LF_DESLIN);
 | 
			
		||||
        
 | 
			
		||||
        deslin.setkey(2);
 | 
			
		||||
        deslin.put("CODART", codart);
 | 
			
		||||
        deslin.put("CODLIN", lingua);
 | 
			
		||||
        if (deslin.read() == NOERR)
 | 
			
		||||
          desc = deslin.get("DESCR");
 | 
			
		||||
      }
 | 
			
		||||
      row_mask.set(FR_DESCR, desc);
 | 
			
		||||
                                     
 | 
			
		||||
      umart.setkey(1);              
 | 
			
		||||
      umart.zero(); 
 | 
			
		||||
      umart.put("CODART", codart);
 | 
			
		||||
      if (umart.read(_isgteq) == NOERR && codart == umart.get("CODART"))
 | 
			
		||||
      {
 | 
			
		||||
        curr_um = umart.get("UM");       
 | 
			
		||||
        curr_fc = umart.get_real("FC");
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
      {
 | 
			
		||||
        curr_um.cut(0);                  
 | 
			
		||||
        curr_fc = 1.0;
 | 
			
		||||
      }
 | 
			
		||||
      row_mask.set(FR_UMQTA, curr_um);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    condv.ricerca();
 | 
			
		||||
  }
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool umart_handler( TMask_field& f, KEY key )
 | 
			
		||||
{
 | 
			
		||||
  // Se qualcuno cerca di modificare la maschera
 | 
			
		||||
  if ( key == K_TAB && f.focusdirty())
 | 
			
		||||
  { 
 | 
			
		||||
    TMask& row_mask = f.mask( );               
 | 
			
		||||
//    TMask & mask = app().edit_mask();
 | 
			
		||||
    TMask & mask = row_mask.get_sheet()->mask();
 | 
			
		||||
    TLocalisamfile & anamag = ((TEdit_field &) row_mask.field(FR_CODART)).browse()->cursor()->file();
 | 
			
		||||
    TLocalisamfile & umart  = ((TEdit_field &) f).browse()->cursor()->file();
 | 
			
		||||
    TCond_vendita & condv = app().condv();
 | 
			
		||||
    
 | 
			
		||||
    condv.set_testa(&mask);
 | 
			
		||||
    condv.set_riga(&row_mask);
 | 
			
		||||
    condv.set_anamag(anamag);
 | 
			
		||||
    condv.set_umart(umart);
 | 
			
		||||
    condv.ricerca(FALSE);
 | 
			
		||||
  
 | 
			
		||||
    const TString16 um(f.get());
 | 
			
		||||
    real fc(1.0);
 | 
			
		||||
    
 | 
			
		||||
    if (um.not_empty() && curr_um.not_empty() && um != curr_um)
 | 
			
		||||
    {           
 | 
			
		||||
      umart.setkey(2);                               
 | 
			
		||||
      umart.put("CODART", row_mask.get(FR_CODART));
 | 
			
		||||
      umart.put("UM", um);
 | 
			
		||||
      if (umart.read() == NOERR)
 | 
			
		||||
      {
 | 
			
		||||
        real qta(row_mask.get_real(FR_QTA));
 | 
			
		||||
        qta *= curr_fc;          
 | 
			
		||||
        fc = umart.get_real("FC");
 | 
			
		||||
        qta /= fc;
 | 
			
		||||
        row_mask.set(FR_QTA, qta);
 | 
			
		||||
      }
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
    curr_um = um;
 | 
			
		||||
    curr_fc = fc;
 | 
			
		||||
  }   
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool descr_handler( TMask_field& f, KEY key )
 | 
			
		||||
{
 | 
			
		||||
  if (key == K_TAB && f.focusdirty())
 | 
			
		||||
  {            
 | 
			
		||||
    const TString s(f.get());
 | 
			
		||||
    if (s.find('\n') < 0)
 | 
			
		||||
    {
 | 
			
		||||
      TLocalisamfile & anamag = ((TEdit_field &) f).browse()->cursor()->file();
 | 
			
		||||
      
 | 
			
		||||
      anamag.zero();
 | 
			
		||||
      anamag.setkey(2);
 | 
			
		||||
      anamag.put("DESCR", ((TZoom_field &) f).get_first_line());
 | 
			
		||||
      if (anamag.read() == NOERR)
 | 
			
		||||
      {                         
 | 
			
		||||
        f.mask().set(FR_CODART, anamag.get("CODART"));
 | 
			
		||||
        f.mask().field(FR_CODART).set_dirty();
 | 
			
		||||
        f.mask().check_field(FR_CODART);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }       
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool qta_handler( TMask_field& f, KEY key )
 | 
			
		||||
{
 | 
			
		||||
  // Se qualcuno cerca di modificare la maschera
 | 
			
		||||
  if ( key == K_TAB && f.focusdirty())
 | 
			
		||||
  { 
 | 
			
		||||
    TMask& row_mask = f.mask( );               
 | 
			
		||||
//    TMask & mask = app().edit_mask();
 | 
			
		||||
    TMask & mask = row_mask.get_sheet()->mask();
 | 
			
		||||
    TLocalisamfile & anamag = ((TEdit_field &) row_mask.field(FR_CODART)).browse()->cursor()->file();
 | 
			
		||||
    TLocalisamfile & umart  = ((TEdit_field &) row_mask.field(FR_UMQTA)).browse()->cursor()->file();
 | 
			
		||||
    TCond_vendita & condv = app().condv();
 | 
			
		||||
    
 | 
			
		||||
    condv.set_testa(&mask);
 | 
			
		||||
    condv.set_riga(&row_mask);
 | 
			
		||||
    condv.set_anamag(anamag);
 | 
			
		||||
    condv.set_umart(umart);
 | 
			
		||||
    condv.ricerca(FALSE);
 | 
			
		||||
  } 
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool cod_handler( TMask_field& f, KEY key )
 | 
			
		||||
{
 | 
			
		||||
  if ( key == K_TAB && f.focusdirty())
 | 
			
		||||
  {                  
 | 
			
		||||
    TMask& row_mask = f.mask( );               
 | 
			
		||||
    TMask & mask = row_mask.get_sheet()->mask();
 | 
			
		||||
    real cambio = mask.get(F_CAMBIO);
 | 
			
		||||
                               
 | 
			
		||||
    if (cambio != 0.0)
 | 
			
		||||
    {                           
 | 
			
		||||
      real prezzo = row_mask.get(FR_PREZZO);
 | 
			
		||||
      
 | 
			
		||||
      prezzo /= mask.get_real(F_CAMBIO);
 | 
			
		||||
      row_mask.set(FR_PREZZO, prezzo);
 | 
			
		||||
    }
 | 
			
		||||
  } 
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										16
									
								
								ve/ve0100c.h
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								ve/ve0100c.h
									
									
									
									
									
								
							@ -1,8 +1,14 @@
 | 
			
		||||
#define __VE0100C_H
 | 
			
		||||
 | 
			
		||||
// Handlers per i campi delle bolle
 | 
			
		||||
// Handlers per testata e righe
 | 
			
		||||
 | 
			
		||||
extern  bool    ora_hndl(TMask_field& field, KEY key);
 | 
			
		||||
extern  bool    codcli_hndl(TMask_field& field, KEY key);
 | 
			
		||||
extern  bool    dummy_hndl(TMask_field& field, KEY key);
 | 
			
		||||
extern  bool    condpag_hndl(TMask_field& field, KEY key);
 | 
			
		||||
bool ora_hndl(TMask_field& field, KEY key);
 | 
			
		||||
bool codcli_hndl(TMask_field& field, KEY key);
 | 
			
		||||
bool dummy_hndl(TMask_field& field, KEY key);
 | 
			
		||||
bool condpag_hndl(TMask_field& field, KEY key);
 | 
			
		||||
void row_set_handler(TMask& m, const int field, const int index);
 | 
			
		||||
bool codart_handler(TMask_field& f, KEY key);
 | 
			
		||||
bool umart_handler(TMask_field& f, KEY key);
 | 
			
		||||
bool descr_handler(TMask_field& f, KEY key);
 | 
			
		||||
bool qta_handler(TMask_field& f, KEY key);
 | 
			
		||||
bool cod_handler(TMask_field& f, KEY key);
 | 
			
		||||
 | 
			
		||||
@ -87,7 +87,7 @@ PAGE "Gestione spese bolli" 1 1 60 14
 | 
			
		||||
NUMBER F_SPBOSCA1 11
 | 
			
		||||
BEGIN
 | 
			
		||||
PROMPT  2 2 "Scaglione "
 | 
			
		||||
FIELD SPBOBSCA[1]
 | 
			
		||||
FIELD SPBOSCA[1]
 | 
			
		||||
PICTURE "."
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -91,7 +91,7 @@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// Numero massimo di linee per pagina
 | 
			
		||||
#define MAX_LINES_PER_PAGE                                18
 | 
			
		||||
#define MAX_LINES_PER_PAGE                                19
 | 
			
		||||
#define MASK_FIRST_LINE                                    6
 | 
			
		||||
 | 
			
		||||
#define GROUPKEY(x)   format( "%5d", x )
 | 
			
		||||
@ -120,7 +120,7 @@ public:
 | 
			
		||||
  void check( const int i );
 | 
			
		||||
 | 
			
		||||
  // PAGE
 | 
			
		||||
  void pagina( const int i, const TString& title = "Pagina " ){ _out << "PA \"" << title << " " << i << "\" 11 60 14\n"; };
 | 
			
		||||
  void pagina( const int i, const TString& title = "Pag." ){ _out << "PA \"" << title << " " << i << "\" 11 60 14\n"; };
 | 
			
		||||
 | 
			
		||||
  // PROMPT
 | 
			
		||||
  void prompt( const int x, const int y, const TString& s = "" ){ _out << "PR " << x << " " << y << " \"" << s << "\"\n"; };
 | 
			
		||||
@ -148,7 +148,7 @@ public:
 | 
			
		||||
 | 
			
		||||
  // PICTURE
 | 
			
		||||
  void picture( const int p) { _out << "PI " << p << "\n"; };
 | 
			
		||||
  void picture( const TString & s) { _out << "PI " << s << "\n"; };
 | 
			
		||||
  void picture( const TString & s) { _out << "PI " << '\"' << s << "\"\n"; };
 | 
			
		||||
 | 
			
		||||
  // FIELD
 | 
			
		||||
  void field( const TString& s ) { outline( s, "FI "); };
 | 
			
		||||
@ -503,9 +503,8 @@ void TGruppo::add( TField * field )
 | 
			
		||||
 | 
			
		||||
TGruppo::TGruppo( int i )
 | 
			
		||||
{
 | 
			
		||||
  TConfig pro( "ve0300c.ini" );
 | 
			
		||||
  _id = i;
 | 
			
		||||
  _height = pro.get_int( "HEIGHT", format( "%d", i ) );
 | 
			
		||||
  _height = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TGruppo::TGruppo( int i, int height )
 | 
			
		||||
@ -530,8 +529,16 @@ static void verifica_campo( const TObject& campo )
 | 
			
		||||
  TGruppo & gruppo = cmp.grp();
 | 
			
		||||
    
 | 
			
		||||
  cmp.stato(cmp.stato_reale());
 | 
			
		||||
  if (!gruppo.present() && cmp.stato() != S_NASCOSTO)
 | 
			
		||||
    gruppo.present(TRUE);
 | 
			
		||||
  if (cmp.stato() != S_NASCOSTO)
 | 
			
		||||
  {
 | 
			
		||||
    int h = cmp.y() + 1;          
 | 
			
		||||
    if (cmp.type() == T_CORNICE)
 | 
			
		||||
      h += cmp.size()%100 - 1;
 | 
			
		||||
    if (gruppo.height() < h)
 | 
			
		||||
      gruppo.height(h);
 | 
			
		||||
    if (!gruppo.present())
 | 
			
		||||
      gruppo.present(TRUE);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
HIDDEN TProgind * _bar;
 | 
			
		||||
@ -896,8 +903,7 @@ void TMask_generator::carica_dati_campi( const TFilename& fn, TAssoc_array& a )
 | 
			
		||||
            }
 | 
			
		||||
            TString16 taggruppo;
 | 
			
		||||
            taggruppo.format( "%d", campo->gruppo( ) );
 | 
			
		||||
            int hgruppo = _groupsini.get_int( "HEIGHT", taggruppo );
 | 
			
		||||
            gruppo = new TGruppo( campo->gruppo( ), hgruppo );
 | 
			
		||||
            gruppo = new TGruppo( campo->gruppo( ));
 | 
			
		||||
            gruppo->generatore( *this );
 | 
			
		||||
          }
 | 
			
		||||
          gruppo->add( campo );
 | 
			
		||||
@ -974,9 +980,8 @@ void TMask_generator::carica_dati_campi( const TFilename& fn, TAssoc_array& a )
 | 
			
		||||
        a.add( curgruppo, gruppo );
 | 
			
		||||
      }
 | 
			
		||||
      TString16 taggruppo;
 | 
			
		||||
      taggruppo.format( "%d", campo->gruppo( ) );
 | 
			
		||||
      int hgruppo = _groupsini.get_int( "HEIGHT", taggruppo );
 | 
			
		||||
      gruppo = new TGruppo( campo->gruppo( ), hgruppo );
 | 
			
		||||
      taggruppo.format("%d", campo->gruppo());
 | 
			
		||||
      gruppo = new TGruppo(campo->gruppo());
 | 
			
		||||
      gruppo->generatore( *this );
 | 
			
		||||
    }
 | 
			
		||||
    gruppo->add( campo );
 | 
			
		||||
@ -1184,7 +1189,7 @@ void TMask_generator::genera( const TString& profilo )
 | 
			
		||||
  _m->begin( );
 | 
			
		||||
  _m->prompt( 2, 1, "Cod. num.  " );
 | 
			
		||||
  _m->field("CODNUM"); 
 | 
			
		||||
  _m->use("NUM", 1);
 | 
			
		||||
  _m->use("%NUM", 1);
 | 
			
		||||
  temp_s.format("CODTAB %d", F_CODNUM);
 | 
			
		||||
  _m->input(temp_s);
 | 
			
		||||
  _m->display("\"Codice\" CODTAB~\"Descrizione@50\" S0");
 | 
			
		||||
@ -1332,7 +1337,6 @@ void TMask_generator::genera( const TString& profilo )
 | 
			
		||||
 | 
			
		||||
  // Generazione
 | 
			
		||||
 | 
			
		||||
  // carica_ordine_gruppi( );
 | 
			
		||||
  // Scorro l'array dei gruppi, e ne creo una copia ordinata
 | 
			
		||||
  // con solo i gruppi visibili
 | 
			
		||||
 | 
			
		||||
@ -1381,29 +1385,38 @@ void TMask_generator::genera( const TString& profilo )
 | 
			
		||||
 | 
			
		||||
  // Generazione pagina dei piedi         
 | 
			
		||||
  {
 | 
			
		||||
    TToken_string s(_pro->get("PROGPIEDE", "MAIN"));
 | 
			
		||||
    TToken_string s(_pro->get("CAMPICALC", "MAIN"));
 | 
			
		||||
    
 | 
			
		||||
    if (s.not_empty())
 | 
			
		||||
    {
 | 
			
		||||
      intestazione_pagina( );
 | 
			
		||||
      TTable ppd( "%PPD" );
 | 
			
		||||
      TTable frd( "%FRD" );
 | 
			
		||||
      int nr = 1;
 | 
			
		||||
      int id = 0;
 | 
			
		||||
      for (const char * cp = s.get(0); cp && *cp; cp = s.get())
 | 
			
		||||
      {             
 | 
			
		||||
        const TString16 codpiede(cp);
 | 
			
		||||
        do_events();
 | 
			
		||||
        ppd.zero( );
 | 
			
		||||
        ppd.put( "CODTAB", codpiede );         
 | 
			
		||||
        if ( ppd.read( ) == NOERR )
 | 
			
		||||
        frd.zero( );
 | 
			
		||||
        frd.put( "CODTAB", codpiede );         
 | 
			
		||||
        if ( frd.read( ) == NOERR )
 | 
			
		||||
        {
 | 
			
		||||
          const TString80 picture(ppd.get( "S3"));
 | 
			
		||||
          const TString80 picture(frd.get( "S3"));    
 | 
			
		||||
          const int len = picture.len() > 0 ? picture.len() : 18;
 | 
			
		||||
          int dec = picture.find(',');
 | 
			
		||||
          if (dec >= 0)
 | 
			
		||||
            dec = len - dec - 1;
 | 
			
		||||
          else
 | 
			
		||||
            dec = 0; 
 | 
			
		||||
                                                        
 | 
			
		||||
          id++;                                              
 | 
			
		||||
          _m->control( T_NUMERO, BASE_PIEDE + id, 1805);
 | 
			
		||||
          if (frd.get_bool("B0"))
 | 
			
		||||
             _m->control( T_NUMERO, BASE_PIEDE + id, len * 100 + dec);
 | 
			
		||||
           else
 | 
			
		||||
             _m->control( T_STRINGA, BASE_PIEDE + id, len * 100);
 | 
			
		||||
          _m->begin( );
 | 
			
		||||
          
 | 
			
		||||
          TString80 header(ppd.get("S0")); header.left_just(40 - picture.len());
 | 
			
		||||
          TString80 header(frd.get("S0")); header.left_just(58 - len);
 | 
			
		||||
                                                                                
 | 
			
		||||
          _m->prompt( 2, 7 + nr, header );
 | 
			
		||||
          _m->field(codpiede);            
 | 
			
		||||
@ -1447,7 +1460,6 @@ protected:
 | 
			
		||||
 | 
			
		||||
  virtual bool create ( );
 | 
			
		||||
  virtual bool destroy( );
 | 
			
		||||
  // virtual bool menu( MENU_TAG );  // Controlla il menu
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										28
									
								
								ve/veconf.h
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								ve/veconf.h
									
									
									
									
									
								
							@ -57,16 +57,24 @@
 | 
			
		||||
// Campi per ve0200d.uml
 | 
			
		||||
#define F_SPINCODIVA      101
 | 
			
		||||
#define F_SPINDESIVA      102
 | 
			
		||||
#define F_SPINCODCON1     103
 | 
			
		||||
#define F_SPINCODCON2     104
 | 
			
		||||
#define F_SPINCODCON3     105
 | 
			
		||||
#define F_SPINDESCON      106
 | 
			
		||||
#define F_SPBRBCODIVA     107
 | 
			
		||||
#define F_SPBRBDESIVA     108
 | 
			
		||||
#define F_SPBRBCODCON1    109
 | 
			
		||||
#define F_SPBRBCODCON2    110
 | 
			
		||||
#define F_SPBRBCODCON3    111
 | 
			
		||||
#define F_SPBRBDESCON     112
 | 
			
		||||
#define F_SPINCODCON1V    103
 | 
			
		||||
#define F_SPINCODCON2V    104
 | 
			
		||||
#define F_SPINCODCON3V    105
 | 
			
		||||
#define F_SPINDESCONV     106
 | 
			
		||||
#define F_SPBOCODIVA      107
 | 
			
		||||
#define F_SPBODESIVA      108
 | 
			
		||||
#define F_SPBOCODCON1V    109
 | 
			
		||||
#define F_SPBOCODCON2V    110
 | 
			
		||||
#define F_SPBOCODCON3V    111
 | 
			
		||||
#define F_SPBODESCONV     112
 | 
			
		||||
#define F_SPBOCODCON1A    113
 | 
			
		||||
#define F_SPBOCODCON2A    114
 | 
			
		||||
#define F_SPBOCODCON3A    115
 | 
			
		||||
#define F_SPBODESCONA     116
 | 
			
		||||
#define F_SPINCODCON1A    117
 | 
			
		||||
#define F_SPINCODCON2A    118
 | 
			
		||||
#define F_SPINCODCON3A    119
 | 
			
		||||
#define F_SPINDESCONA     120
 | 
			
		||||
 | 
			
		||||
// Campi per ve0200e.uml
 | 
			
		||||
#define F_RICERCACR1      101
 | 
			
		||||
 | 
			
		||||
@ -11,3 +11,11 @@
 | 
			
		||||
#define S_DISABILITATO   1
 | 
			
		||||
#define S_NORMALE        2
 | 
			
		||||
#define S_OBBLIGATORIO   3
 | 
			
		||||
 | 
			
		||||
// #define F_LBTIPORIGA 175
 | 
			
		||||
// #define NPIEDI        40 
 | 
			
		||||
 | 
			
		||||
#define F_SHEET                                        500
 | 
			
		||||
// #define F_MEMORIGA                                     501
 | 
			
		||||
#define BASE_PIEDE                                     600
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1697
									
								
								ve/velib01.cpp
									
									
									
									
									
								
							
							
						
						
									
										1697
									
								
								ve/velib01.cpp
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										328
									
								
								ve/velib01.h
									
									
									
									
									
								
							
							
						
						
									
										328
									
								
								ve/velib01.h
									
									
									
									
									
								
							@ -5,14 +5,176 @@
 | 
			
		||||
#include <relation.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
real lordo2netto(real& lordo, const TString& codiva, bool is_valuta = FALSE);
 | 
			
		||||
real netto2lordo(const real& netto, const TString& codiva, bool is_valuta = FALSE);
 | 
			
		||||
real lordo2netto(real& lordo, const real& iva, bool is_valuta = FALSE);
 | 
			
		||||
real netto2lordo(const real& netto, const real& iva, bool is_valuta = FALSE);
 | 
			
		||||
#ifndef __VARREC_H
 | 
			
		||||
#include <varrec.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __VARMASK_H
 | 
			
		||||
#include <varmask.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __PAGAMENT_H
 | 
			
		||||
#include "../cg/pagament.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
class TDocumento;
 | 
			
		||||
class TRiga_documento;
 | 
			
		||||
class TCond_vendita;
 | 
			
		||||
class TIVA;
 | 
			
		||||
 | 
			
		||||
real lordo2netto(real& lordo, const TString& codiva, int ndec);
 | 
			
		||||
inline real lordo2netto(real& lordo, const TString& codiva, bool is_valuta = FALSE) { return lordo2netto(lordo, codiva, is_valuta ? 3 : 0);}
 | 
			
		||||
real netto2lordo(const real& netto, const TString& codiva, int ndec);
 | 
			
		||||
inline real netto2lordo(const real& netto, const TString& codiva, bool is_valuta = FALSE) { return netto2lordo(netto, codiva, is_valuta ? 3 : 0);}
 | 
			
		||||
real lordo2netto(real& lordo, const real& iva, int ndec);
 | 
			
		||||
inline real lordo2netto(real& lordo, const real& iva, bool is_valuta = FALSE) {return lordo2netto(lordo, iva, is_valuta ? 3 : 0); }
 | 
			
		||||
real netto2lordo(const real& netto, const real& iva, int ndec);
 | 
			
		||||
inline real netto2lordo(const real& netto, const real& iva, bool is_valuta = FALSE) { return netto2lordo(netto, iva, is_valuta ? 3 : 0); }
 | 
			
		||||
real prezzo_scontato(const real& prezzo, const char * sconto);
 | 
			
		||||
real iva(real imponibile, const TIVA & codiva,int ndec);   
 | 
			
		||||
 | 
			
		||||
bool ora_hndl(TMask_field& field, KEY key);
 | 
			
		||||
bool codcli_hndl(TMask_field& field, KEY key);
 | 
			
		||||
bool dummy_hndl(TMask_field& field, KEY key);
 | 
			
		||||
bool condpag_hndl(TMask_field& field, KEY key);
 | 
			
		||||
 | 
			
		||||
class TDocumento_variable_field : public TVariable_field
 | 
			
		||||
{                                           
 | 
			
		||||
  bool _dirty;
 | 
			
		||||
  
 | 
			
		||||
  public:
 | 
			
		||||
// @cmember segnala che il campo deve essere ricalcolato
 | 
			
		||||
  virtual bool dirty() const { return _dirty;}
 | 
			
		||||
// @cmember assegna lo stato di campo da ricalcolare
 | 
			
		||||
  virtual void set_dirty(bool on = TRUE) { _dirty = on;}
 | 
			
		||||
 | 
			
		||||
// @ cmember Costruttore con una espressione di calcolo  
 | 
			
		||||
  TDocumento_variable_field(const char * name, const char * expr = "", TTypeexp type = _strexpr)
 | 
			
		||||
                          : TVariable_field(name, expr, type), _dirty(TRUE) {}
 | 
			
		||||
// @ cmember Costruttore con una funzione
 | 
			
		||||
  TDocumento_variable_field(const char * name, VIRTUAL_GET_FUNCTION getfunc)
 | 
			
		||||
                          : TVariable_field(name, getfunc), _dirty(TRUE) {}
 | 
			
		||||
// @ cmember Costruttore con una espressione di calcolo  
 | 
			
		||||
  TDocumento_variable_field(const char * name, TExpression * expr, TTypeexp type = _strexpr)
 | 
			
		||||
                          : TVariable_field(name, expr, type), _dirty(TRUE) {}
 | 
			
		||||
// @ cmember Costruttore con un variable_field 
 | 
			
		||||
  TDocumento_variable_field(const TVariable_field & f) : TVariable_field(f), _dirty(TRUE) {}
 | 
			
		||||
// @ cmember Distruttore  
 | 
			
		||||
  ~TDocumento_variable_field() {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class TSpesa_prest : public TRectype
 | 
			
		||||
{                    
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
  int read(const char* codice);
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  TObject* dup() const { return new TSpesa_prest(codice()); }
 | 
			
		||||
 | 
			
		||||
public:       
 | 
			
		||||
  const TString& codice() const { return get("CODTAB");}  
 | 
			
		||||
  const TString& descrizione() const { return get("S0"); } 
 | 
			
		||||
  const TString& field_perc() const { return get("S5"); } 
 | 
			
		||||
  char tipo() const { return get_char("S6"); }
 | 
			
		||||
  char genere() const { return get("COD") == "SPP" ? 'S' : 'P'; }
 | 
			
		||||
 | 
			
		||||
  TSpesa_prest(const char* codice = NULL, char tipo = 'S');
 | 
			
		||||
  TSpesa_prest(const TRectype& rec);
 | 
			
		||||
  virtual ~TSpesa_prest() {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class TIVA : public TRectype
 | 
			
		||||
{                    
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
  int read(const char* codice);
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  TObject* dup() const { return new TIVA(codice()); }
 | 
			
		||||
 | 
			
		||||
public:       
 | 
			
		||||
  const TString& codice() const { return get("CODTAB");}  
 | 
			
		||||
  const TString& descrizione() const { return get("S0"); } 
 | 
			
		||||
  const real aliquota() const { return get_real("R0"); } 
 | 
			
		||||
  const TString& tipo() const { return get("S1"); } 
 | 
			
		||||
 | 
			
		||||
  TIVA(const char* codice = NULL);
 | 
			
		||||
  TIVA(const TRectype& rec);
 | 
			
		||||
  virtual ~TIVA() {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class TExpr_documento : public TExpression
 | 
			
		||||
{     
 | 
			
		||||
  TDocumento * _doc; 
 | 
			
		||||
  TRiga_documento * _row;
 | 
			
		||||
  
 | 
			
		||||
protected:                       
 | 
			
		||||
  virtual void evaluate_user_func(int index, int nparms, TEval_stack & stack, TTypeexp type) const;
 | 
			
		||||
  virtual int parse_user_func(const char * name, int nparms) const;
 | 
			
		||||
 | 
			
		||||
public:            
 | 
			
		||||
  // @cmember Duplica l'espressione
 | 
			
		||||
  virtual TObject* dup() const;
 | 
			
		||||
  // @cmember Assegna il documento corrente
 | 
			
		||||
  void set_doc(TDocumento * doc) { _doc = doc; }
 | 
			
		||||
  // @cmember Assegna il documento corrente
 | 
			
		||||
  void set_row(TRiga_documento * row) { _row = row; }
 | 
			
		||||
  // @cmember Costruttore (assegna l'estressione e il suo tipo)
 | 
			
		||||
  TExpr_documento(const char* expression, TTypeexp type = _numexpr,
 | 
			
		||||
                  TDocumento * doc = NULL, TRiga_documento * row = NULL);
 | 
			
		||||
  // @cmember Costruttore (assegna il tipo dell'istruzione) 
 | 
			
		||||
  TExpr_documento(TTypeexp type = _numexpr,
 | 
			
		||||
                  TDocumento * doc = NULL, TRiga_documento * row = NULL)
 | 
			
		||||
                 : TExpression(type), _doc(doc), _row(row) {}
 | 
			
		||||
  // @cmember Costruttore di copia
 | 
			
		||||
  TExpr_documento(const TExpr_documento & expr)
 | 
			
		||||
                 : TExpression(expr), _doc(expr._doc), _row(expr._row) {}
 | 
			
		||||
  // @cmember Distruttore
 | 
			
		||||
  virtual ~TExpr_documento() {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum TTipo_formula { _documento, _riga };
 | 
			
		||||
 | 
			
		||||
class TFormula_documento : public TRectype
 | 
			
		||||
{               
 | 
			
		||||
  TString16       _tab;
 | 
			
		||||
  TExpr_documento * _expr;
 | 
			
		||||
  
 | 
			
		||||
protected:
 | 
			
		||||
  int read(const char* codice);
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  TObject* dup() const { return new TFormula_documento(_tab == "%FRD" ? _documento : _riga, codice()); }
 | 
			
		||||
 | 
			
		||||
public:       
 | 
			
		||||
  const TString& codice() const { return get("CODTAB");}  
 | 
			
		||||
  const TString& name() const { return codice();}
 | 
			
		||||
  TExpr_documento * expr() const { return _expr ? new TExpr_documento(*_expr) : NULL;}
 | 
			
		||||
  
 | 
			
		||||
  const TString& descrizione() const { return get("S0"); } 
 | 
			
		||||
  const TString& expr_string() const { return get("S1"); }
 | 
			
		||||
  TTypeexp expr_type() const { return get_bool("B0") ? _numexpr : _strexpr;}
 | 
			
		||||
  
 | 
			
		||||
  TFormula_documento(TTipo_formula tipo = _documento, const char* codice = NULL);
 | 
			
		||||
  TFormula_documento(const TRectype& rec);
 | 
			
		||||
  virtual ~TFormula_documento();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TTipo_documento : public TRectype
 | 
			
		||||
{              
 | 
			
		||||
 | 
			
		||||
  static TAssoc_array _formule_documento;
 | 
			
		||||
  TToken_string _formule;
 | 
			
		||||
  TString16 _imponibile;
 | 
			
		||||
  TString16 _imposta;
 | 
			
		||||
  TString16 _totale;
 | 
			
		||||
  TString16 _basesconto; 
 | 
			
		||||
  TString16 _spese;
 | 
			
		||||
        
 | 
			
		||||
protected:     
 | 
			
		||||
  void read_formule();
 | 
			
		||||
  int read(const char* tipodoc);
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
@ -26,6 +188,15 @@ public:
 | 
			
		||||
  
 | 
			
		||||
  const TString& descrizione() const { return get("S0"); } 
 | 
			
		||||
  const TString& riferimento() const { return get("S1"); }
 | 
			
		||||
  const TString& imponibile() const { return _imponibile;}  
 | 
			
		||||
  const TString& imposta() const { return _imposta;}  
 | 
			
		||||
  const TString& totale_doc() const { return _totale;}  
 | 
			
		||||
  const TString& basesconto() const { return _basesconto;}  
 | 
			
		||||
  const TString& spese() const { return _spese;}  
 | 
			
		||||
 | 
			
		||||
  TFormula_documento * first_formula() { return succ_formula(TRUE); }
 | 
			
		||||
  TFormula_documento * succ_formula(bool restart = FALSE);
 | 
			
		||||
 | 
			
		||||
  const int ncopie() const { return get_int("I0"); }
 | 
			
		||||
  
 | 
			
		||||
  TTipo_documento(const char* tipodoc = NULL);
 | 
			
		||||
@ -35,17 +206,35 @@ public:
 | 
			
		||||
 | 
			
		||||
class TTipo_riga_documento : public TRectype
 | 
			
		||||
{                    
 | 
			
		||||
 | 
			
		||||
  static TAssoc_array _formule_riga;
 | 
			
		||||
  TToken_string _formule;
 | 
			
		||||
  TString16 _name;
 | 
			
		||||
  TString16 _imponibile;
 | 
			
		||||
  TString16 _imposta;
 | 
			
		||||
  TVariable_mask * _mask;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
  void read_formule();
 | 
			
		||||
  int read(const char* tiporig);
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  TObject* dup() const { return new TTipo_riga_documento(codice()); }
 | 
			
		||||
 | 
			
		||||
public:       
 | 
			
		||||
  const TString& profile_name() const { return _name;}
 | 
			
		||||
  const TString& mask_name() const { return profile_name();}
 | 
			
		||||
  const TString& codice() const { return get("CODTAB");}  
 | 
			
		||||
  bool mask_loaded() const { return _mask != NULL; }
 | 
			
		||||
  TVariable_mask * mask(); 
 | 
			
		||||
    
 | 
			
		||||
  const TString& descrizione() const { return get("S0"); } 
 | 
			
		||||
  char tipo() const { return get_char("S7"); }
 | 
			
		||||
  const TString& imponibile() const { return _imponibile;}  
 | 
			
		||||
  const TString& imposta() const { return _imposta;}  
 | 
			
		||||
 | 
			
		||||
  TFormula_documento * first_formula() { return succ_formula(TRUE); }
 | 
			
		||||
  TFormula_documento * succ_formula(bool restart = FALSE);
 | 
			
		||||
  
 | 
			
		||||
  TTipo_riga_documento(const char* tiporig = NULL);
 | 
			
		||||
  TTipo_riga_documento(const TRectype& rec);
 | 
			
		||||
@ -53,60 +242,107 @@ public:
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TRiga_documento : public TRectype
 | 
			
		||||
class TRiga_documento : public TAuto_variable_rectype
 | 
			
		||||
{
 | 
			
		||||
  friend class TDocumento;
 | 
			
		||||
  const TDocumento* _doc;
 | 
			
		||||
 | 
			
		||||
  TDocumento * _doc; 
 | 
			
		||||
  static TAssoc_array _tipi;
 | 
			
		||||
  static TAssoc_array _spese;
 | 
			
		||||
  static TAssoc_array _ive;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
protected:  
 | 
			
		||||
  void set_doc(const TDocumento* doc) { _doc = doc; }
 | 
			
		||||
   // @cmember Setta il contenuto del campo <p fieldname> (non tipizzata)
 | 
			
		||||
  virtual void put_str(const char* fieldname, const char* val);
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
  TObject* dup() const { return new TRiga_documento(*this); }
 | 
			
		||||
  
 | 
			
		||||
public:  
 | 
			
		||||
  const TDocumento& documento() const 
 | 
			
		||||
  { CHECK(_doc, "Riga documento orfana"); return *_doc; }
 | 
			
		||||
  void dirty_fields(bool   dirty_document = TRUE); 
 | 
			
		||||
  bool doc_dependent() const;
 | 
			
		||||
  int numero() const { return get_int("NRIGA");}
 | 
			
		||||
  void set_numero(int numero) { put("NRIGA", numero);}
 | 
			
		||||
  // @cmember Assegna il documento corrente
 | 
			
		||||
  void set_doc(TDocumento * doc) { _doc = doc; }
 | 
			
		||||
  const TDocumento & doc() const { CHECK(_doc, "Documento nullo"); return *_doc;}
 | 
			
		||||
 | 
			
		||||
  const TTipo_riga_documento& tipo() const;
 | 
			
		||||
  virtual void zero(const char * fieldname);
 | 
			
		||||
  virtual void zero(char c = '\0');
 | 
			
		||||
  // row -> sheet
 | 
			
		||||
  void autoload( TSheet_field& f);
 | 
			
		||||
  // sheet -> row
 | 
			
		||||
  void autosave( TSheet_field& f);
 | 
			
		||||
 | 
			
		||||
  const TTipo_riga_documento & tipo() const;
 | 
			
		||||
  const TSpesa_prest & spesa() const;
 | 
			
		||||
  static const TIVA & iva(const char * codice);
 | 
			
		||||
  const TIVA & iva() const {const TString16 cod(get("CODIVA")); return iva(cod);}
 | 
			
		||||
  
 | 
			
		||||
  void set_tipo(const char * tipo) { put("TIPORIGA", tipo);}
 | 
			
		||||
  bool sola_descrizione() const;
 | 
			
		||||
  void forza_sola_descrizione();
 | 
			
		||||
  
 | 
			
		||||
  TRiga_documento& operator =(const TRiga_documento& r) 
 | 
			
		||||
  { TRectype::operator=(r); _doc = r._doc; return *this; }
 | 
			
		||||
  virtual TRectype & operator =(const TRectype & r); 
 | 
			
		||||
  virtual TRectype & operator =(const char * r); 
 | 
			
		||||
  
 | 
			
		||||
  bool raggruppabile(const TRiga_documento& r, TToken_string& campi) const;
 | 
			
		||||
  TRiga_documento& operator +=(const TRiga_documento& r);
 | 
			
		||||
  
 | 
			
		||||
  TRiga_documento(const TDocumento* doc) : TRectype(LF_RIGHEDOC), _doc(doc) { }
 | 
			
		||||
  TRiga_documento(const TRiga_documento& rec) : TRectype(rec), _doc(rec._doc) { }
 | 
			
		||||
  virtual ~TRiga_documento() { }
 | 
			
		||||
  void reset_fields(TAuto_variable_rectype & rec) { rec.remove_field(); }
 | 
			
		||||
  void set_fields(TAuto_variable_rectype & rec);
 | 
			
		||||
 | 
			
		||||
  real prezzo(bool scontato, bool lordo, int ndec) const ;
 | 
			
		||||
  real importo(bool scontato, bool lordo, int ndec, bool iva_calc = FALSE) const ;   
 | 
			
		||||
//  real iva(int ndec) const {return ::iva(importo(TRUE, FALSE, ndec, TRUE), iva(), ndec);}
 | 
			
		||||
  real iva(int ndec) const {return ::iva(imponibile(), iva(), ndec);}
 | 
			
		||||
  real imponibile() const; 
 | 
			
		||||
  real imposta() const;
 | 
			
		||||
  
 | 
			
		||||
  TRiga_documento(TDocumento* doc, const char * tipo = NULL);
 | 
			
		||||
  TRiga_documento(const TRiga_documento& rec, TDocumento* doc,
 | 
			
		||||
                  const char * tipo = NULL);
 | 
			
		||||
  virtual ~TRiga_documento() {}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class TDocumento : public TRectype
 | 
			
		||||
class TDocumento : public TAuto_variable_rectype
 | 
			
		||||
{ 
 | 
			
		||||
  static TAssoc_array _tipi;
 | 
			
		||||
 | 
			
		||||
  TRecord_array _rows;  // Array di TRectype per le righe documenti di vendita.
 | 
			
		||||
  bool _nuovo;
 | 
			
		||||
 | 
			
		||||
  TRelation * _rel;
 | 
			
		||||
  TCond_vendita * _condv;
 | 
			
		||||
  TPagamento _pag;
 | 
			
		||||
 | 
			
		||||
protected:  
 | 
			
		||||
  TRectype & row(int index) { return _rows.row(index, FALSE); } 
 | 
			
		||||
  TAuto_variable_rectype & row(int index) { return (TAuto_variable_rectype &) _rows.row(index, FALSE); } 
 | 
			
		||||
  long get_next_key(char provv, int anno, const char* codnum) const;
 | 
			
		||||
  virtual void put_str(const char* fieldname, const char* val);
 | 
			
		||||
  long renum(long numdoc = 0);
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  const TRectype& head() const { return *this; } // Ritorna la testata del documento
 | 
			
		||||
  TRectype& head() { return *this; } // Ritorna la testata del documento
 | 
			
		||||
  void dirty_fields();
 | 
			
		||||
  const TAuto_variable_rectype& head() const { return *this; } // Ritorna la testata del documento
 | 
			
		||||
  TAuto_variable_rectype& head() { return *this; } // Ritorna la testata del documento
 | 
			
		||||
 | 
			
		||||
  TCond_vendita & condv() const {CHECK(_condv, "Condizioni di vendita nulle"); return *_condv;}
 | 
			
		||||
  TRelation & get_relation() const {CHECK(_rel, "Relazione nulla"); return *_rel;}
 | 
			
		||||
  void set_condv(TCond_vendita * condv) { _condv = condv; }
 | 
			
		||||
  void set_relation(TRelation * rel) { _rel = rel; }
 | 
			
		||||
    
 | 
			
		||||
  virtual TRectype & operator =(const TRectype & r); 
 | 
			
		||||
  virtual TRectype & operator =(const char * r); 
 | 
			
		||||
  virtual void zero(const char * fieldname);
 | 
			
		||||
  virtual void zero(char c = '\0');
 | 
			
		||||
    
 | 
			
		||||
  int rows() const { return _rows.rows(); } 
 | 
			
		||||
  const TRiga_documento& operator[](int index) const { return (const TRiga_documento&)_rows.row(index); }
 | 
			
		||||
  TRiga_documento& operator[](int index) { return (TRiga_documento&)_rows.row(index, FALSE); } 
 | 
			
		||||
  
 | 
			
		||||
  TRiga_documento& new_row() { return (TRiga_documento&)_rows.row(-1, TRUE); }
 | 
			
		||||
  bool destroy_row(int n) { return _rows.destroy_row(n); }
 | 
			
		||||
  TRiga_documento& insert_row(int row, const char *tipo = NULL);
 | 
			
		||||
  TRiga_documento& new_row(const char *tipo = NULL);
 | 
			
		||||
  bool destroy_row(int n, bool pack = FALSE) { return _rows.destroy_row(n, pack); }
 | 
			
		||||
  void destroy_rows() { _rows.destroy_rows(); }
 | 
			
		||||
  
 | 
			
		||||
  int read(char provv, int anno, const char* codnum, long numdoc);
 | 
			
		||||
@ -121,10 +357,11 @@ public:
 | 
			
		||||
  const TString& numerazione() { return get("CODNUM"); }
 | 
			
		||||
  long numero() const { return get_long("NDOC"); }
 | 
			
		||||
  TDate data() const { return get_date("DATADOC"); }
 | 
			
		||||
  const bool in_valuta();
 | 
			
		||||
  const TString& valuta() { return get("CODVAL"); }
 | 
			
		||||
  const bool in_valuta() const;
 | 
			
		||||
  const TString& valuta() const { return get("CODVAL"); }
 | 
			
		||||
  const real cambio() { return get_real("CAMBIO"); }
 | 
			
		||||
  const TTipo_documento& tipo() const;                  
 | 
			
		||||
  void set_tipo(const char * tipo) { head().put("TIPODOC", tipo);}
 | 
			
		||||
  
 | 
			
		||||
  char stato() const { return get_char("STATO"); }
 | 
			
		||||
  void stato(char s) { put("STATO", s); }
 | 
			
		||||
@ -135,12 +372,49 @@ public:
 | 
			
		||||
  static void set_key(TRectype& rec, char provv, int anno, const char* codnum, long numdoc);
 | 
			
		||||
  static void copy_data(TRectype& dst, const TRectype& src);
 | 
			
		||||
  
 | 
			
		||||
  void reset_fields(TAuto_variable_rectype & rec) { rec.remove_field(); }
 | 
			
		||||
  void set_fields(TAuto_variable_rectype & rec);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  real spese_incasso(real & imp, int ndec, bool netto = FALSE) const ;
 | 
			
		||||
  real bolli(real & imp, int ndec, bool netto = FALSE) const ;
 | 
			
		||||
  real descrizione() const;
 | 
			
		||||
  real riferimento() const;
 | 
			
		||||
  real imponibile() const;
 | 
			
		||||
  real imposta() const;
 | 
			
		||||
  real totale_doc() const;
 | 
			
		||||
  real basesconto() const;
 | 
			
		||||
  real spese() const;
 | 
			
		||||
  
 | 
			
		||||
  TPagamento & pagamento();
 | 
			
		||||
 | 
			
		||||
  TDocumento ();
 | 
			
		||||
  TDocumento(char provv, int anno, const char* codnum, long numdoc);
 | 
			
		||||
  TDocumento(const TRectype& doc);
 | 
			
		||||
  TDocumento(char provv, int anno, const char* codnum, long numdoc, 
 | 
			
		||||
             TCond_vendita * condv = NULL, TRelation * rel = NULL);
 | 
			
		||||
  TDocumento(const TRectype& doc, TCond_vendita * condv = NULL,
 | 
			
		||||
             TRelation * rel = NULL);
 | 
			
		||||
  virtual ~TDocumento() { }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class TDocumento_mask : public TVariable_mask
 | 
			
		||||
{
 | 
			
		||||
  int _progs_page;  // pagina in cui cominciano i progressivi
 | 
			
		||||
  int _last_prog;   // numero dell'ultimo progressivo
 | 
			
		||||
  TDocumento * _doc; // documento                    
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
  virtual void next_page(int p);
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  virtual bool on_key(KEY key);
 | 
			
		||||
  TDocumento & doc() const {CHECK(_doc, "Documento nullo"); return *_doc;}
 | 
			
		||||
  TCond_vendita & condv() const {CHECK(_doc, "Documento nullo"); return _doc->condv();}
 | 
			
		||||
  TRelation & get_relation() const {CHECK(_doc, "Documento nullo"); return _doc->get_relation();}
 | 
			
		||||
  
 | 
			
		||||
  TDocumento_mask(const char* name, TDocumento * _doc, int num = 0, int max = MAX_PAGES);
 | 
			
		||||
  virtual ~TDocumento_mask() { }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class TLista_documenti : public TObject
 | 
			
		||||
{ 
 | 
			
		||||
  TArray _documenti;
 | 
			
		||||
 | 
			
		||||
@ -77,12 +77,7 @@ void TDocumentoEsteso::compile_summary()
 | 
			
		||||
    if (_iva->read() != NOERR) continue; // Se non trova il codice salta questa riga
 | 
			
		||||
    
 | 
			
		||||
    aliquota = _iva->get_real("R0");
 | 
			
		||||
    if (_condv != NULL && sconto.not_empty()) // Se c'e' la condizione di vendita, calcola lo sconto...
 | 
			
		||||
    {
 | 
			
		||||
      _condv->set_sconto(sconto);
 | 
			
		||||
      sc = 100.0 - _condv->sconto_val();
 | 
			
		||||
      price = (price * sc);
 | 
			
		||||
    }
 | 
			
		||||
    price = scontato(price, sconto);
 | 
			
		||||
    price.round(val ? _parm.pri_val : _parm.pri_lit); // prezzo scontato
 | 
			
		||||
    qta.round(val ? _parm.qta_val : _parm.qta_lit);
 | 
			
		||||
    imponibile = price * qta;
 | 
			
		||||
@ -299,30 +294,10 @@ const char* TDocumentoEsteso::get_head_info(const TString & what)
 | 
			
		||||
  return (const char*) rt;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TDocumentoEsteso::set_condv(TCliFor* cli)
 | 
			
		||||
{
 | 
			
		||||
  if (_condv != NULL)
 | 
			
		||||
   delete _condv;
 | 
			
		||||
  if (cli != NULL)
 | 
			
		||||
    _condv = new TCond_vendita(*cli);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TDocumentoEsteso::TDocumentoEsteso(const TRectype& rec, TCliFor *cli)
 | 
			
		||||
 : TDocumento(rec), _condv(NULL), _sum_filter(-1), _sum_selected(FALSE), _scadenze_current(-1)
 | 
			
		||||
 : TDocumento(rec), _sum_filter(-1), _sum_selected(FALSE), _scadenze_current(-1)
 | 
			
		||||
{
 | 
			
		||||
  _iva = new TTable("%IVA");
 | 
			
		||||
  if (cli != NULL) _condv = new TCond_vendita(*cli);
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    TCliFor cf;
 | 
			
		||||
    TString16 tipocf,ocfpi;
 | 
			
		||||
    long codcf;
 | 
			
		||||
    tipocf = get("TIPOCF");
 | 
			
		||||
    codcf = get_long("CODCF");
 | 
			
		||||
    ocfpi = get("OCFPI");
 | 
			
		||||
    cf.load(tipocf[0],codcf,ocfpi);
 | 
			
		||||
    _condv = new TCond_vendita(cf);
 | 
			
		||||
  }
 | 
			
		||||
  // Inizializza i parametri di default
 | 
			
		||||
  _parm.pri_lit = 0; _parm.pri_val = 3;
 | 
			
		||||
  _parm.qta_lit = 3; _parm.qta_val = 3;
 | 
			
		||||
@ -330,26 +305,14 @@ TDocumentoEsteso::TDocumentoEsteso(const TRectype& rec, TCliFor *cli)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TDocumentoEsteso::TDocumentoEsteso(const TRectype& rec, dec_parm & parm, TCliFor *cli)
 | 
			
		||||
 : TDocumento(rec), _condv(NULL), _sum_filter(-1), _sum_selected(FALSE),  _scadenze_current(-1)
 | 
			
		||||
 : TDocumento(rec), _sum_filter(-1), _sum_selected(FALSE),  _scadenze_current(-1)
 | 
			
		||||
{ 
 | 
			
		||||
  _parm = parm;
 | 
			
		||||
  _iva = new TTable("%IVA");
 | 
			
		||||
  if (cli != NULL) _condv = new TCond_vendita(*cli);
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    TCliFor cf;
 | 
			
		||||
    TString16 tipocf,ocfpi;
 | 
			
		||||
    long codcf;
 | 
			
		||||
    tipocf = get("TIPOCF");
 | 
			
		||||
    codcf = get_long("CODCF");
 | 
			
		||||
    ocfpi = get("OCFPI");
 | 
			
		||||
    cf.load(tipocf[0],codcf,ocfpi);
 | 
			
		||||
    _condv = new TCond_vendita(cf);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TDocumentoEsteso::TDocumentoEsteso()
 | 
			
		||||
 : TDocumento(), _condv(NULL), _sum_filter(-1), _sum_selected(FALSE), _scadenze_current(-1)
 | 
			
		||||
 : TDocumento(), _sum_filter(-1), _sum_selected(FALSE), _scadenze_current(-1)
 | 
			
		||||
{
 | 
			
		||||
  _iva = new TTable("%IVA");
 | 
			
		||||
}
 | 
			
		||||
@ -357,7 +320,6 @@ TDocumentoEsteso::TDocumentoEsteso()
 | 
			
		||||
TDocumentoEsteso::~TDocumentoEsteso()
 | 
			
		||||
{
 | 
			
		||||
  if (_iva != NULL) delete _iva;
 | 
			
		||||
  if (_condv != NULL) delete _condv;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -78,7 +78,6 @@ class TDocumentoEsteso : public TDocumento
 | 
			
		||||
  // Parametri del documento
 | 
			
		||||
  dec_parm        _parm;          // Parametri per gli arrotondamenti
 | 
			
		||||
  TTable        * _iva;           // Tabella codici IVA
 | 
			
		||||
  TCond_vendita * _condv;         // Condizioni di vendita per lo sconto
 | 
			
		||||
  
 | 
			
		||||
  // Totali del documento ricalcolati non appena la tabellina di riepilogo IVA e' completa
 | 
			
		||||
  real _importi_netti, _imposte;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user