Beta2
git-svn-id: svn://10.65.10.50/trunk@3812 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									e0b4e5bfff
								
							
						
					
					
						commit
						1ad524cc85
					
				@ -187,7 +187,8 @@ DESCRMAG1       = S_NASCOSTO                    //2900
 | 
			
		||||
CAUSMAG2        = S_NASCOSTO                    //2900
 | 
			
		||||
DESCRMAG2       = S_NASCOSTO                    //2900
 | 
			
		||||
BLANK           = S_DISABILITATO                //4000
 | 
			
		||||
//NOTECLI         = S_NORMALE                     //2500
 | 
			
		||||
CODNOTE         = S_NORMALE                     //2500
 | 
			
		||||
NOTECLI         = S_NORMALE                     //2500
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
[DEFAULT]
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
33
 | 
			
		||||
67
 | 
			
		||||
68
 | 
			
		||||
CODNUM|1|4|0|Codice della numerazione
 | 
			
		||||
ANNO|2|4|0|Anno/Esercizio
 | 
			
		||||
PROVV|1|1|0|Tipo numerazione <P>rovvisorio <D>efinitivo
 | 
			
		||||
@ -63,6 +63,7 @@ PNETTO|4|15|2|Peso netto
 | 
			
		||||
NCOLLI|3|7|0|Numero di colli
 | 
			
		||||
CAUSMAG1|1|3|0|Causale di magazzino 1
 | 
			
		||||
CAUSMAG2|1|3|0|Causale di magazzino 2
 | 
			
		||||
CODNOTE|1|2|0|Codice note cliente
 | 
			
		||||
NOTE|11|10|0|Note
 | 
			
		||||
G1|11|10|0|Campo generale 1
 | 
			
		||||
DATAAGG|5|8|0|Data ultimo aggiornamento
 | 
			
		||||
 | 
			
		||||
@ -305,11 +305,12 @@ bool TCond_vendita::cerca( int tiporicerca )
 | 
			
		||||
  return FALSE;
 | 
			
		||||
}
 | 
			
		||||
    
 | 
			
		||||
// Probabilmente dovrebbe lavorare sulla maschera, ma per ora la lasciamo cosl
 | 
			
		||||
void TCond_vendita::ricerca(bool load_um_only, bool load_scagl_only)
 | 
			
		||||
{
 | 
			
		||||
  TString codart = anamag().get( "CODART" );
 | 
			
		||||
  const TString codriga = riga().get( FR_CODART );
 | 
			
		||||
  
 | 
			
		||||
  _ivarid = _clifo->get_bool(LF_CFVEN, "IVARID");
 | 
			
		||||
  _load_mask = !load_um_only && !load_scagl_only;  
 | 
			
		||||
  
 | 
			
		||||
  if(anamag().bad() || codriga != codart )
 | 
			
		||||
 | 
			
		||||
@ -43,7 +43,6 @@ protected:
 | 
			
		||||
  void set_provv(const real & provv);   
 | 
			
		||||
  void set_iva(const TString & codiva);
 | 
			
		||||
 | 
			
		||||
  TCliFor & clifo() const { CHECK(_clifo, "Cliente/fornitore non inizializzato"); return * _clifo; }
 | 
			
		||||
  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; }
 | 
			
		||||
@ -51,6 +50,7 @@ protected:
 | 
			
		||||
  TLocalisamfile & umart() const { CHECK(_umart, "Anagrafica di unita' di misura magazzino non inizializzata") ; return *_umart; }
 | 
			
		||||
  
 | 
			
		||||
public:
 | 
			
		||||
  TCliFor & clifo() const { CHECK(_clifo, "Cliente/fornitore non inizializzato"); return * _clifo; }
 | 
			
		||||
  bool set_sconto( const char * exp, bool signal = FALSE );
 | 
			
		||||
  const TString& get_sconto() const { return _sconto; }
 | 
			
		||||
  real sconto_val() const { return _molt_sconto;}
 | 
			
		||||
 | 
			
		||||
@ -140,6 +140,7 @@ void TCliForVendite::update_mask( TMask& m, bool onload )
 | 
			
		||||
    set( m, F_CODPORTO, LF_CFVEN, "CODPORTO" );
 | 
			
		||||
    set( m, F_CODNOTESP1, LF_CFVEN, "CODNOTESP1" );
 | 
			
		||||
    set( m, F_CODNOTESP2, LF_CFVEN, "CODNOTESP2" );
 | 
			
		||||
    set( m, F_CODNOTE, LF_CFVEN, "CODNOTE" );
 | 
			
		||||
    set( m, F_CODVETT1, LF_CFVEN, "CODVETT1" );
 | 
			
		||||
    set( m, F_CODVETT2, LF_CFVEN, "CODVETT2" );
 | 
			
		||||
    set( m, F_CODVETT3, LF_CFVEN, "CODVETT3" );
 | 
			
		||||
@ -214,11 +215,18 @@ void TCliForVendite::update_mask( TMask& m, bool onload )
 | 
			
		||||
  m.check_field( F_CODPORTO );
 | 
			
		||||
  m.check_field( F_CODNOTESP1 );
 | 
			
		||||
  m.check_field( F_CODNOTESP2 );
 | 
			
		||||
  m.check_field( F_CODNOTE );
 | 
			
		||||
  m.check_field( F_CODVETT1 );
 | 
			
		||||
  m.check_field( F_CODVETT2 );
 | 
			
		||||
  m.check_field( F_CODVETT3 );    
 | 
			
		||||
  m.check_field( F_CATVEN );    
 | 
			
		||||
  m.check_field( F_CODZON );
 | 
			
		||||
  const bool gescontr       =  app().config_ditta().get_bool("GES", "ve", 2);          
 | 
			
		||||
  const bool contr_enabled = get_bool(LF_CFVEN, "GESTCONTR");
 | 
			
		||||
  
 | 
			
		||||
  m.enable(F_CODCONT1, contr_enabled && gescontr);
 | 
			
		||||
  m.enable(F_CODCONT, contr_enabled && gescontr);
 | 
			
		||||
   
 | 
			
		||||
//  imposta_dati_comune( m );
 | 
			
		||||
  imposta_indirizzo_spedizione( m );
 | 
			
		||||
  imposta_sconto_testa( m );
 | 
			
		||||
@ -355,7 +363,7 @@ void TCliForVendite::imposta_sconto_testa( TMask& m )
 | 
			
		||||
void TCliForVendite::imposta_valuta( TMask& m )
 | 
			
		||||
{
 | 
			
		||||
   
 | 
			
		||||
  TConfig ditta( CONFIG_DITTA );
 | 
			
		||||
  TConfig & ditta = app().config_ditta();
 | 
			
		||||
   
 | 
			
		||||
  if( ditta.get_bool( "GESVALAC", "ve" ) )
 | 
			
		||||
  {
 | 
			
		||||
 | 
			
		||||
@ -134,6 +134,10 @@ bool TMotore_application::ss_handler( TSheet_field& ss, int r, KEY key )
 | 
			
		||||
        TMask & emask = app().edit_mask();             
 | 
			
		||||
        TRiga_documento & riga = app()._doc->insert_row(r + 1, emask.get( F_LBTIPORIGA ));
 | 
			
		||||
                      
 | 
			
		||||
        TString16 s(app()._clifor->get(LF_CFVEN, "CODMAG"));
 | 
			
		||||
        
 | 
			
		||||
        s << app()._clifor->get(LF_CFVEN, "CODDEP");
 | 
			
		||||
        riga.put("CODMAG", s);
 | 
			
		||||
        riga.autoload(ss);  
 | 
			
		||||
      }
 | 
			
		||||
      else     
 | 
			
		||||
@ -392,6 +396,7 @@ TMask* TMotore_application::get_mask( int mode )
 | 
			
		||||
          msk1->set_handler( F_CODCF, clifo_handler );
 | 
			
		||||
          msk1->set_handler( F_CODPAG, condpag_hndl );
 | 
			
		||||
          msk1->set_handler( F_DATAINSC, condpag_hndl );
 | 
			
		||||
          msk1->set_handler( F_CODNOTE, note_hndl );
 | 
			
		||||
      //    _msk1->set_handler( 99, elabora_handler );
 | 
			
		||||
          int numhandler = pro( ).get_int( "NHANDLER", "HANDLERS" ); // prof
 | 
			
		||||
          for ( i = 1; i <= numhandler; i ++ )
 | 
			
		||||
@ -452,8 +457,9 @@ TMask* TMotore_application::get_mask( int mode )
 | 
			
		||||
 | 
			
		||||
          if (gescontr)
 | 
			
		||||
          {                          
 | 
			
		||||
            msk1->show(F_CODCONT, !gescontrcli);
 | 
			
		||||
           
 | 
			
		||||
            msk1->show(F_CODCONT1, gescontrcli);    
 | 
			
		||||
            msk1->show(F_CODCONT, !gescontrcli);
 | 
			
		||||
          }
 | 
			
		||||
          else        
 | 
			
		||||
          {
 | 
			
		||||
@ -640,19 +646,6 @@ bool TMotore_application::user_create( )
 | 
			
		||||
{  
 | 
			
		||||
  _config_ditta = new TConfig(CONFIG_DITTA);
 | 
			
		||||
 | 
			
		||||
  // Controllo se sono cambiate le impostazioni delle vendite.
 | 
			
		||||
  if (_config_ditta->get_bool( "CHANGED", "ve" ))
 | 
			
		||||
  { // Se sono cambiate, rigenero tutte le maschere
 | 
			
		||||
    if (yesno_box( CHANGE_MESSAGE ) )
 | 
			
		||||
    {
 | 
			
		||||
      TExternal_app generazione( "ve0 -3 -all" );
 | 
			
		||||
      
 | 
			
		||||
      generazione.run();
 | 
			
		||||
    }   
 | 
			
		||||
    else
 | 
			
		||||
      message_box("Attenzione i profili dei documenti potrebbero\n non essere aggiornati");
 | 
			
		||||
  }  
 | 
			
		||||
  
 | 
			
		||||
  // Metto in relazione testata e righe
 | 
			
		||||
  _rel = new TRelation( LF_DOC );
 | 
			
		||||
  open_files(LF_RIGHEDOC, LF_CONDV, LF_RCONDV, LF_ANAMAG, LF_SCONTI, LF_UMART, LF_TAB, LF_TABCOM, 0);
 | 
			
		||||
 | 
			
		||||
@ -221,6 +221,19 @@ PROMPT 2 13 "Gestione archivio sconti unita' di misura "
 | 
			
		||||
FIELD GESSCOUM
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
STRING F_SCOTRIGA 4
 | 
			
		||||
BEGIN
 | 
			
		||||
PROMPT 2 14 "Tipo riga per gli sconti di testa "
 | 
			
		||||
FLAGS "U"
 | 
			
		||||
USE %TRI SELECT S7=="C"
 | 
			
		||||
FIELD SCOTRIGA
 | 
			
		||||
INPUT CODTAB F_SCOTRIGA
 | 
			
		||||
DISPLAY "Codice" CODTAB
 | 
			
		||||
DISPLAY "Descrizione@50" S0
 | 
			
		||||
OUTPUT F_SCOTRIGA CODTAB
 | 
			
		||||
CHECKTYPE REQUIRED
 | 
			
		||||
END
 | 
			
		||||
 | 
			
		||||
ENDPAGE
 | 
			
		||||
 | 
			
		||||
ENDMASK
 | 
			
		||||
 | 
			
		||||
@ -1213,21 +1213,30 @@ OUTPUT=F_CODVETT3 CODTAB~F_NOMEVETT3 S0
 | 
			
		||||
WARNING=Codice primo vettore non trovato
 | 
			
		||||
HELP=Inserisci il codice del primo (o unico) vettore
 | 
			
		||||
 | 
			
		||||
[NOTECLI]
 | 
			
		||||
[CODNOTE]
 | 
			
		||||
GROUP=2500
 | 
			
		||||
X=2
 | 
			
		||||
Y=1
 | 
			
		||||
FIELDNAME=CODNOTE
 | 
			
		||||
MSKID=F_CODNOTE
 | 
			
		||||
TYPE=T_STRINGA
 | 
			
		||||
PROMPT="Cod.Note "
 | 
			
		||||
SIZE=2
 | 
			
		||||
USE=%NOT
 | 
			
		||||
INPUT=CODTAB F_CODNOTE
 | 
			
		||||
DISPLAY="Codice" CODTAB~"Descrizione@50" S0
 | 
			
		||||
OUTPUT=F_CODNOTE CODTAB~F_NOTECLI S0
 | 
			
		||||
WARNING=Note clienti assenti
 | 
			
		||||
 | 
			
		||||
[NOTECLI]
 | 
			
		||||
GROUP=2500
 | 
			
		||||
X=2
 | 
			
		||||
Y=2
 | 
			
		||||
FIELDNAME=NOTE
 | 
			
		||||
MSKID=F_NOTECLI
 | 
			
		||||
TYPE=T_MEMO
 | 
			
		||||
PROMPT=""
 | 
			
		||||
PROMPT="         "
 | 
			
		||||
SIZE=50
 | 
			
		||||
USE=%NOT KEY 2
 | 
			
		||||
INPUT=S0 F_NOTECLI
 | 
			
		||||
DISPLAY="Descrizione@50" S0~"Codice" CODTAB
 | 
			
		||||
OUTPUT=F_NOTECLI S0
 | 
			
		||||
WARNING=
 | 
			
		||||
HELP=
 | 
			
		||||
 | 
			
		||||
[NCOPIE]
 | 
			
		||||
GROUP=1600
 | 
			
		||||
 | 
			
		||||
@ -33,6 +33,7 @@
 | 
			
		||||
 | 
			
		||||
#define F_GESSCOSCA       128
 | 
			
		||||
#define F_GESSCOUM        129
 | 
			
		||||
#define F_SCOTRIGA        130
 | 
			
		||||
 | 
			
		||||
// Campi per ve0200b.uml
 | 
			
		||||
#define F_GESAGE          101
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										122
									
								
								ve/velib01.cpp
									
									
									
									
									
								
							
							
						
						
									
										122
									
								
								ve/velib01.cpp
									
									
									
									
									
								
							@ -41,6 +41,11 @@
 | 
			
		||||
#include "veini.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifndef __DEFMASK_H
 | 
			
		||||
#include <defmask.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#ifndef __PAGAMENT_H
 | 
			
		||||
#include "..\cg\pagament.h"
 | 
			
		||||
#endif
 | 
			
		||||
@ -158,6 +163,31 @@ bool condpag_hndl( TMask_field& field, KEY key )
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool note_hndl( TMask_field& f, KEY key )
 | 
			
		||||
{             
 | 
			
		||||
  TDocumento_mask & m = (TDocumento_mask &) f.mask();
 | 
			
		||||
 | 
			
		||||
  if (key == K_TAB && (f.focusdirty() || !m.is_running()))
 | 
			
		||||
  {
 | 
			
		||||
    TTable & note = (TTable &) ((TEdit_field &) f).browse()->cursor()->file();
 | 
			
		||||
    const TString16 cod(f.get());
 | 
			
		||||
    
 | 
			
		||||
    if (cod != note.get("CODTAB"))
 | 
			
		||||
    {
 | 
			
		||||
      note.zero();
 | 
			
		||||
      note.put("CODTAB", cod);
 | 
			
		||||
      if (note.read() != NOERR)
 | 
			
		||||
        note.zero();
 | 
			
		||||
    }
 | 
			
		||||
    const bool reg_disabled = note.get_bool("B0");
 | 
			
		||||
    
 | 
			
		||||
    if (reg_disabled)
 | 
			
		||||
      message_box("Registrazione disbilitata : %s", (const char *) note.get("S0"));
 | 
			
		||||
    m.enable(DLG_SAVEREC, !reg_disabled);
 | 
			
		||||
  }
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// handler delle righe
 | 
			
		||||
 | 
			
		||||
HIDDEN void row_set_handler( TMask& m, const int field, const int index )
 | 
			
		||||
@ -175,6 +205,19 @@ HIDDEN void row_set_handler( TMask& m, const int field, const int index )
 | 
			
		||||
HIDDEN TString16 curr_um;                                                     
 | 
			
		||||
HIDDEN real curr_fc(1.0);
 | 
			
		||||
 | 
			
		||||
HIDDEN bool iva_handler( TMask_field& f, KEY key )
 | 
			
		||||
{   
 | 
			
		||||
  if (key == 0 || key == K_ENTER)
 | 
			
		||||
  {
 | 
			
		||||
    TDocumento_mask & mask = (TDocumento_mask &) f.mask().get_sheet()->mask();
 | 
			
		||||
    const TString16 codiva = mask.condv().clifo().get(LF_CFVEN, "ASSFIS");
 | 
			
		||||
 | 
			
		||||
    if (codiva.not_empty())
 | 
			
		||||
      f.set(codiva);
 | 
			
		||||
  }
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
                                       
 | 
			
		||||
HIDDEN bool codart_handler( TMask_field& f, KEY key )
 | 
			
		||||
{
 | 
			
		||||
  // Se qualcuno cerca di modificare la maschera
 | 
			
		||||
@ -246,6 +289,10 @@ HIDDEN bool codart_handler( TMask_field& f, KEY key )
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    condv.ricerca();
 | 
			
		||||
    const int pos = row_mask.id2pos(FR_CODIVA);
 | 
			
		||||
 | 
			
		||||
    if (pos >= 0)
 | 
			
		||||
      iva_handler(row_mask.fld(pos), 0);
 | 
			
		||||
  }
 | 
			
		||||
  return TRUE;
 | 
			
		||||
}
 | 
			
		||||
@ -367,6 +414,9 @@ HIDDEN bool sppr_handler( TMask_field& f, KEY key )
 | 
			
		||||
          prezzo /= mask.get_real(F_CAMBIO);
 | 
			
		||||
        }
 | 
			
		||||
        row_mask.set(FR_PREZZO, prezzo);          
 | 
			
		||||
        const int pos =row_mask.id2pos(FR_CODIVA);
 | 
			
		||||
        if (pos >= 0)
 | 
			
		||||
          iva_handler(row_mask.fld(pos), 0);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  } 
 | 
			
		||||
@ -1186,6 +1236,11 @@ TVariable_mask * TTipo_riga_documento::mask()
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  const int posiva = _mask->id2pos(FR_CODIVA);
 | 
			
		||||
  
 | 
			
		||||
  if (posiva >= 0)
 | 
			
		||||
    _mask->set_handler( FR_CODIVA, iva_handler );
 | 
			
		||||
    
 | 
			
		||||
  return _mask;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1682,7 +1737,7 @@ TAssoc_array TDocumento::_tipi;
 | 
			
		||||
 | 
			
		||||
TDocumento::TDocumento()
 | 
			
		||||
          : TAuto_variable_rectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA"), _nuovo(TRUE),
 | 
			
		||||
            _condv(NULL), _rel(NULL)
 | 
			
		||||
            _condv(NULL), _rel(NULL), _sconto(NULL)
 | 
			
		||||
{                      
 | 
			
		||||
  set_memo_fld("G1");
 | 
			
		||||
}
 | 
			
		||||
@ -1690,7 +1745,7 @@ TDocumento::TDocumento()
 | 
			
		||||
TDocumento::TDocumento(char provv, int anno, const char* codnum, long numdoc,
 | 
			
		||||
                       TCond_vendita * condv, TRelation * rel)
 | 
			
		||||
          : TAuto_variable_rectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA"), _nuovo(TRUE),
 | 
			
		||||
            _condv(condv), _rel(rel)
 | 
			
		||||
            _condv(condv), _rel(rel), _sconto(NULL)
 | 
			
		||||
{
 | 
			
		||||
  set_memo_fld("G1");
 | 
			
		||||
  if (numdoc <= 0)
 | 
			
		||||
@ -1700,7 +1755,7 @@ TDocumento::TDocumento(char provv, int anno, const char* codnum, long numdoc,
 | 
			
		||||
    
 | 
			
		||||
    TRiga_documento* key = new TRiga_documento(this);
 | 
			
		||||
    set_key(*key, provv, anno, codnum, numdoc);
 | 
			
		||||
    _rows.set_key(key);
 | 
			
		||||
    _rows.set_key(key);  // ok
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
    read(provv, anno, codnum, numdoc);
 | 
			
		||||
@ -1747,17 +1802,17 @@ TDocumento::TDocumento(const TRectype& rec, TCond_vendita * condv, TRelation * r
 | 
			
		||||
 | 
			
		||||
TRiga_documento& TDocumento::insert_row(int row, const char *tipo)
 | 
			
		||||
{       
 | 
			
		||||
  TRiga_documento * r = new TRiga_documento((const TRiga_documento &) _rows.key(), this);
 | 
			
		||||
  TRiga_documento * r = new TRiga_documento((const TRiga_documento &) _rows.key(), this); // ok
 | 
			
		||||
  r->set_numero(row);     
 | 
			
		||||
  if (tipo)
 | 
			
		||||
   r->set_tipo(tipo);
 | 
			
		||||
  _rows.insert_row(r);
 | 
			
		||||
  _rows.insert_row(r); // ok
 | 
			
		||||
  return *r;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TRiga_documento& TDocumento::new_row(const char *tipo)
 | 
			
		||||
{
 | 
			
		||||
  TRiga_documento & r = (TRiga_documento&)_rows.row(-1, TRUE);
 | 
			
		||||
  TRiga_documento & r = (TRiga_documento&)_rows.row(-1, TRUE); // ok
 | 
			
		||||
  if (tipo)
 | 
			
		||||
   r.set_tipo(tipo);
 | 
			
		||||
  return r;
 | 
			
		||||
@ -1779,15 +1834,16 @@ int TDocumento::read(const TRectype& rec)
 | 
			
		||||
  if (err == NOERR)
 | 
			
		||||
  {
 | 
			
		||||
    _nuovo = FALSE;
 | 
			
		||||
    _rows.read(key);
 | 
			
		||||
    _rows.read(key); //ok
 | 
			
		||||
  }  
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    _nuovo = TRUE;
 | 
			
		||||
    head() = rec;
 | 
			
		||||
    destroy_rows();
 | 
			
		||||
    _rows.set_key(key);
 | 
			
		||||
    _rows.set_key(key);  // ok
 | 
			
		||||
  }
 | 
			
		||||
  set_riga_sconto();
 | 
			
		||||
  return err;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1810,10 +1866,42 @@ long TDocumento::renum(long numdoc)
 | 
			
		||||
  }   
 | 
			
		||||
  char num[16]; sprintf(num, "%ld", numdoc);
 | 
			
		||||
  renum_key("NDOC", num);       // Aggiorna testata
 | 
			
		||||
  _rows.renum_key("NDOC", num); // Aggiorna righe
 | 
			
		||||
  _rows.renum_key("NDOC", num); // Aggiorna righe  ok
 | 
			
		||||
  return numdoc;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TDocumento::set_riga_sconto()
 | 
			
		||||
{                                 
 | 
			
		||||
  const TString80 sconto(get("SCONTOPERC"));  
 | 
			
		||||
  
 | 
			
		||||
  if (sconto.empty())
 | 
			
		||||
  {        
 | 
			
		||||
    if(_sconto != NULL)
 | 
			
		||||
      delete _sconto;
 | 
			
		||||
    _sconto = NULL;
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {                
 | 
			
		||||
    if (_sconto == NULL)
 | 
			
		||||
    {                   
 | 
			
		||||
      static TString _tipo_riga;
 | 
			
		||||
      static long firm = -1;
 | 
			
		||||
      long new_firm = main_app().get_firm();
 | 
			
		||||
          
 | 
			
		||||
      if (firm != new_firm)
 | 
			
		||||
      {
 | 
			
		||||
        TConfig conf(CONFIG_DITTA);
 | 
			
		||||
          
 | 
			
		||||
        _tipo_riga = conf.get("SCOTRIGA", "ve");
 | 
			
		||||
        firm = new_firm;
 | 
			
		||||
      }
 | 
			
		||||
      _sconto = new TRiga_documento(this, _tipo_riga); 
 | 
			
		||||
      _sconto->put("DESCR","Sconto");
 | 
			
		||||
    }
 | 
			
		||||
    _sconto->put("SCONTO", sconto);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TDocumento::dirty_fields()
 | 
			
		||||
{
 | 
			
		||||
  for (TDocumento_variable_field * f = (TDocumento_variable_field *) first_variable_field(); 
 | 
			
		||||
@ -1821,7 +1909,7 @@ void TDocumento::dirty_fields()
 | 
			
		||||
    f->set_dirty();
 | 
			
		||||
  for (int i = rows(); i > 0; i--)
 | 
			
		||||
  {
 | 
			
		||||
    TRiga_documento & r = (TRiga_documento &) _rows.row(i, FALSE);
 | 
			
		||||
    TRiga_documento & r = (TRiga_documento &) row(i);
 | 
			
		||||
        
 | 
			
		||||
    if (r.doc_dependent())
 | 
			
		||||
      r.dirty_fields(FALSE);
 | 
			
		||||
@ -1889,6 +1977,18 @@ const bool TDocumento::in_valuta() const
 | 
			
		||||
  return (val.not_empty() && val != "LIT");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TRiga_documento & TDocumento::row(int index)
 | 
			
		||||
{     
 | 
			
		||||
  const int nrows = _rows.rows();
 | 
			
		||||
  if (index <= nrows)
 | 
			
		||||
    return (TRiga_documento &) _rows.row(index, FALSE);
 | 
			
		||||
  else
 | 
			
		||||
  {                                           
 | 
			
		||||
    CHECKD(index == nrows + 1 &&_sconto != NULL, "Riga documento non esistente ", index);
 | 
			
		||||
    return  *_sconto;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
long TDocumento::get_next_key(char provv, int anno, const char* codnum) const
 | 
			
		||||
{               
 | 
			
		||||
  static long n = 0;
 | 
			
		||||
@ -2077,6 +2177,8 @@ void TDocumento::put_str(const char* fieldname, const char* val)
 | 
			
		||||
  {
 | 
			
		||||
    TAuto_variable_rectype::put_str(fieldname, val);
 | 
			
		||||
    dirty_fields();                                
 | 
			
		||||
    if (strcmp(fieldname, "SCONTOPERC") == 0) 
 | 
			
		||||
      set_riga_sconto();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										13
									
								
								ve/velib01.h
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								ve/velib01.h
									
									
									
									
									
								
							@ -37,6 +37,7 @@ 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);
 | 
			
		||||
bool note_hndl(TMask_field& field, KEY key);
 | 
			
		||||
 | 
			
		||||
class TDocumento_variable_field : public TVariable_field
 | 
			
		||||
{                                           
 | 
			
		||||
@ -314,12 +315,14 @@ class TDocumento : public TAuto_variable_rectype
 | 
			
		||||
  TRelation * _rel;
 | 
			
		||||
  TCond_vendita * _condv;
 | 
			
		||||
  TPagamento _pag;
 | 
			
		||||
  TRiga_documento * _sconto; // Riga per lo sconto di testata
 | 
			
		||||
 | 
			
		||||
protected:  
 | 
			
		||||
  TAuto_variable_rectype & row(int index) { return (TAuto_variable_rectype &) _rows.row(index, FALSE); } 
 | 
			
		||||
  TRiga_documento & row(int index);
 | 
			
		||||
  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);  
 | 
			
		||||
  void set_riga_sconto();
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  void dirty_fields();
 | 
			
		||||
@ -336,9 +339,9 @@ public:
 | 
			
		||||
  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); } 
 | 
			
		||||
  int rows() const { return _rows.rows() + ((_sconto != NULL) ? 1 : 0); } 
 | 
			
		||||
  const TRiga_documento& operator[](int index) const { return (const TRiga_documento&)((TDocumento *)this)->row(index); }
 | 
			
		||||
  TRiga_documento& operator[](int index) { return (TRiga_documento&)row(index); } 
 | 
			
		||||
  
 | 
			
		||||
  TRiga_documento& insert_row(int row, const char *tipo = NULL);
 | 
			
		||||
  TRiga_documento& new_row(const char *tipo = NULL);
 | 
			
		||||
@ -394,7 +397,7 @@ public:
 | 
			
		||||
             TCond_vendita * condv = NULL, TRelation * rel = NULL);
 | 
			
		||||
  TDocumento(const TRectype& doc, TCond_vendita * condv = NULL,
 | 
			
		||||
             TRelation * rel = NULL);
 | 
			
		||||
  virtual ~TDocumento() { }
 | 
			
		||||
  virtual ~TDocumento() { if (_sconto != NULL) delete _sconto;}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class TDocumento_mask : public TVariable_mask
 | 
			
		||||
 | 
			
		||||
@ -76,6 +76,7 @@
 | 
			
		||||
#define F_ATTIVAANNO                179     // GESTITO DAL MOTORE
 | 
			
		||||
#define F_OCCASEDIT                 180     // GESTITO DAL MOTORE
 | 
			
		||||
#define F_CATVEN                    181
 | 
			
		||||
#define F_CODNOTE                   182
 | 
			
		||||
 | 
			
		||||
#define F_CODVAL1                   200
 | 
			
		||||
#define F_NOMEVAL1                  201
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user