git-svn-id: svn://10.65.10.50/branches/R_10_00@22928 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									526ec34d8a
								
							
						
					
					
						commit
						7fcde8da9b
					
				@ -372,7 +372,14 @@ const char* TMotore_application::get_next_key( )
 | 
				
			|||||||
  return "";
 | 
					  return "";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int TMotore_application::read( TMask& m )
 | 
					const char* TMotore_application::record_description(const TRelation& rel) const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  const TString4 tipodoc = rel.curr().get(DOC_TIPODOC);
 | 
				
			||||||
 | 
					  const TString& desc = cache().get("%TIP", tipodoc, "S0");
 | 
				
			||||||
 | 
					  return desc.empty() ? TR("Documento") : desc;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int TMotore_application::read(TMask& m)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	TDocumento_mask& mask = (TDocumento_mask&) m;
 | 
						TDocumento_mask& mask = (TDocumento_mask&) m;
 | 
				
			||||||
  TRelation_application::read(m);
 | 
					  TRelation_application::read(m);
 | 
				
			||||||
 | 
				
			|||||||
@ -79,6 +79,8 @@ protected:
 | 
				
			|||||||
  virtual bool last_doc(char provv, int anno, const char* codnum, long& ndoc, TDate& datadoc) const;
 | 
					  virtual bool last_doc(char provv, int anno, const char* codnum, long& ndoc, TDate& datadoc) const;
 | 
				
			||||||
  bool save_and_print(bool savedoc, TPrtype mode);
 | 
					  bool save_and_print(bool savedoc, TPrtype mode);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  virtual const char* record_description(const TRelation& rel) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	virtual void do_elab(TDocumento& doc, int w = 0);  // w 0=Save; 1=Print; 2=Definitive
 | 
						virtual void do_elab(TDocumento& doc, int w = 0);  // w 0=Save; 1=Print; 2=Definitive
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1084,7 +1084,7 @@ TMask* TVendite_tabapp::set_mask(TMask* m)
 | 
				
			|||||||
    TFilename mn; get_mask_name(mn);
 | 
					    TFilename mn; get_mask_name(mn);
 | 
				
			||||||
    TVendite_mask* vm = new TVendite_mask(mn);
 | 
					    TVendite_mask* vm = new TVendite_mask(mn);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (has_module(CAAUT, CHK_DONGLE) || has_module(CMAUT, CHK_DONGLE))
 | 
					    if (ca_config().get_int("Authorizations") != 0)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
       // Crea i campi per i conti analitici (vendite e acquisti)
 | 
					       // Crea i campi per i conti analitici (vendite e acquisti)
 | 
				
			||||||
      if (vm->table_code() == "SPP")
 | 
					      if (vm->table_code() == "SPP")
 | 
				
			||||||
 | 
				
			|||||||
@ -56,7 +56,7 @@ class TRighe_condizioni_vendita: public TRelation_application
 | 
				
			|||||||
  static bool handle_price(TMask_field &, KEY); // handler del prezzo netto e lordo
 | 
					  static bool handle_price(TMask_field &, KEY); // handler del prezzo netto e lordo
 | 
				
			||||||
  static bool handle_qta(TMask_field &, KEY); // handler della quantita' limite per scaglione
 | 
					  static bool handle_qta(TMask_field &, KEY); // handler della quantita' limite per scaglione
 | 
				
			||||||
  static bool handle_sca(TMask_field &, KEY); // handler dello scaglione
 | 
					  static bool handle_sca(TMask_field &, KEY); // handler dello scaglione
 | 
				
			||||||
  static void fill_rec(TRectype& r, TMask& m);
 | 
					  static void fill_rec(TRectype& r, const TMask& m);
 | 
				
			||||||
  static real find_prev_qta(const TRectype& r);
 | 
					  static real find_prev_qta(const TRectype& r);
 | 
				
			||||||
  static real find_next_qta(const TRectype& r);
 | 
					  static real find_next_qta(const TRectype& r);
 | 
				
			||||||
  static const char* look_codiva(char tipo, TString& cod);
 | 
					  static const char* look_codiva(char tipo, TString& cod);
 | 
				
			||||||
@ -384,7 +384,7 @@ bool TRighe_condizioni_vendita::handle_price(TMask_field &f, KEY k)
 | 
				
			|||||||
  return TRUE;
 | 
					  return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TRighe_condizioni_vendita::fill_rec(TRectype &r, TMask& m)
 | 
					void TRighe_condizioni_vendita::fill_rec(TRectype &r, const TMask& m)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  const char c = app()._rcondven[0];
 | 
					  const char c = app()._rcondven[0];
 | 
				
			||||||
  short id = (c == 'C' ? F_R_C_COD : (c == 'L' ? F_R_L_COD : F_R_O_COD));
 | 
					  short id = (c == 'C' ? F_R_C_COD : (c == 'L' ? F_R_L_COD : F_R_O_COD));
 | 
				
			||||||
@ -406,64 +406,56 @@ bool TRighe_condizioni_vendita::handle_qta(TMask_field &f, KEY k)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  if (f.to_check(k))
 | 
					  if (f.to_check(k))
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    TMask& m = f.mask();
 | 
					    const TMask& m = f.mask();
 | 
				
			||||||
    real qta_prev,qta_next;
 | 
					    const real current_qta = f.get();
 | 
				
			||||||
    real current_qta(f.get());
 | 
					    const int sca = m.get_int(F_R_NSCAGL);
 | 
				
			||||||
    TRectype r1(LF_RCONDV);
 | 
					    if (sca > 1)
 | 
				
			||||||
    fill_rec(r1,m);
 | 
					 | 
				
			||||||
    TRectype r2(r1);
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    qta_prev = find_prev_qta(r1);
 | 
					 | 
				
			||||||
    qta_next = find_next_qta(r2);
 | 
					 | 
				
			||||||
    int sca = m.get_int(F_R_NSCAGL);
 | 
					 | 
				
			||||||
    if (sca == 1 && current_qta == 0.0)
 | 
					 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      f.error_box("La quantita' limite deve essere maggiore di 0");
 | 
					      TRectype r1(LF_RCONDV); fill_rec(r1,m);
 | 
				
			||||||
      return FALSE;
 | 
					      const real qta_prev = find_prev_qta(r1);
 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    if (sca == 9 && current_qta == 0.0) return TRUE;
 | 
					 | 
				
			||||||
    if (qta_next <= current_qta)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      f.error_box("La quantita' limite deve essere minore di %s.", 
 | 
					 | 
				
			||||||
                  (const char*)qta_next.string());
 | 
					 | 
				
			||||||
      return FALSE;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
      if (qta_prev >= current_qta)
 | 
					      if (qta_prev >= current_qta)
 | 
				
			||||||
 | 
					        return f.error_box(FR("La quantità limite deve maggiore di %s (scaglione %d)"), 
 | 
				
			||||||
 | 
					                           qta_prev.stringa(), sca-1);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      f.error_box("La quantita' limite deve maggiore di %s.", 
 | 
					      if (current_qta.is_zero())
 | 
				
			||||||
                  (const char*)qta_prev.string());
 | 
					        return f.error_box(TR("La quantità limite deve essere maggiore di 0"));
 | 
				
			||||||
      return FALSE;
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (sca < 9)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      TRectype r2(LF_RCONDV); fill_rec(r2,m);
 | 
				
			||||||
 | 
					      const real qta_next = find_next_qta(r2);
 | 
				
			||||||
 | 
					      if (qta_next > ZERO && qta_next <= current_qta)
 | 
				
			||||||
 | 
					        return f.error_box(FR("La quantità limite deve essere minore di %s (scaglione %d)"), 
 | 
				
			||||||
 | 
					                           qta_next.stringa(), sca+1);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return TRUE;
 | 
					  return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
bool TRighe_condizioni_vendita::handle_sca(TMask_field &f, KEY k)
 | 
					bool TRighe_condizioni_vendita::handle_sca(TMask_field &f, KEY k)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (f.to_check(k))
 | 
					  if (f.to_check(k))
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    const int sca = atoi(f.get());
 | 
				
			||||||
 | 
					    if (sca > 1)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      TMask& m = f.mask();
 | 
					      TMask& m = f.mask();
 | 
				
			||||||
    int sca = atoi(f.get());
 | 
					 | 
				
			||||||
    if (sca == 1) return TRUE;
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
      TRectype r(LF_RCONDV);
 | 
					      TRectype r(LF_RCONDV);
 | 
				
			||||||
      fill_rec(r, m);
 | 
					      fill_rec(r, m);
 | 
				
			||||||
    TLocalisamfile cond(LF_RCONDV);
 | 
					 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
    cond.curr() = r;
 | 
					      TLocalisamfile cond(LF_RCONDV);
 | 
				
			||||||
    cond.read();
 | 
					      if (cond.read() != NOERR) // se non l'ha trovato significa che e' in inserimento
 | 
				
			||||||
    if (cond.bad()) // se non l'ha trovato significa che e' in inserimento
 | 
					 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
      sca--;
 | 
					        r.put("NSCAGL", sca-1);    //cerca quello precedente...
 | 
				
			||||||
      r.put("NSCAGL",sca); //cerca quello precedente...
 | 
					 | 
				
			||||||
        if (cond.read(r) != NOERR) // se non lo trova segnala l'errore di errata sequenza
 | 
					        if (cond.read(r) != NOERR) // se non lo trova segnala l'errore di errata sequenza
 | 
				
			||||||
      {
 | 
					          return f.error_box(TR("Numero di scaglione fuori sequenza"));
 | 
				
			||||||
        f.error_box("Il numero di scaglione immesso non e' in sequenza.");
 | 
					 | 
				
			||||||
        return FALSE;
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return TRUE;
 | 
					  return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char* TRighe_condizioni_vendita::look_codiva(char tipo, TString& cod)
 | 
					const char* TRighe_condizioni_vendita::look_codiva(char tipo, TString& cod)
 | 
				
			||||||
@ -504,7 +496,7 @@ real TRighe_condizioni_vendita::find_prev_qta(const TRectype& r)
 | 
				
			|||||||
  TLocalisamfile f(LF_RCONDV);
 | 
					  TLocalisamfile f(LF_RCONDV);
 | 
				
			||||||
  real qta = ZERO;
 | 
					  real qta = ZERO;
 | 
				
			||||||
  f.curr() = r;
 | 
					  f.curr() = r;
 | 
				
			||||||
  int nscagl = r.get_int("NSCAGL");
 | 
					  const int nscagl = r.get_int("NSCAGL");
 | 
				
			||||||
  f.put("NSCAGL", nscagl-1);
 | 
					  f.put("NSCAGL", nscagl-1);
 | 
				
			||||||
  if (f.read() == NOERR)
 | 
					  if (f.read() == NOERR)
 | 
				
			||||||
    qta = f.get_real("QLIM");
 | 
					    qta = f.get_real("QLIM");
 | 
				
			||||||
@ -516,7 +508,7 @@ real TRighe_condizioni_vendita::find_next_qta(const TRectype& r)
 | 
				
			|||||||
  TLocalisamfile f(LF_RCONDV);
 | 
					  TLocalisamfile f(LF_RCONDV);
 | 
				
			||||||
  real qta(1e10);
 | 
					  real qta(1e10);
 | 
				
			||||||
  f.curr() = r;
 | 
					  f.curr() = r;
 | 
				
			||||||
  int nscagl = r.get_int("NSCAGL");
 | 
					  const int nscagl = r.get_int("NSCAGL");
 | 
				
			||||||
  f.put("NSCAGL", nscagl+1);
 | 
					  f.put("NSCAGL", nscagl+1);
 | 
				
			||||||
  if (f.read() == NOERR)
 | 
					  if (f.read() == NOERR)
 | 
				
			||||||
    qta = f.get_real("QLIM");
 | 
					    qta = f.get_real("QLIM");
 | 
				
			||||||
 | 
				
			|||||||
@ -38,8 +38,8 @@ class TStampa_condizioni_vendita: public TPrint_application
 | 
				
			|||||||
  bool _testastamp; // booleano di testata completa già stampata
 | 
					  bool _testastamp; // booleano di testata completa già stampata
 | 
				
			||||||
  bool _gest_val, _gest_um, _gest_sca, _gest_so; // booleani per l'abilitazione di valute, unità di misura, scaglioni e sconti/omaggi
 | 
					  bool _gest_val, _gest_um, _gest_sca, _gest_so; // booleani per l'abilitazione di valute, unità di misura, scaglioni e sconti/omaggi
 | 
				
			||||||
  bool _filter_by_grm; //Filtro per gruppo merceologico nel caso di stampa righe articoli
 | 
					  bool _filter_by_grm; //Filtro per gruppo merceologico nel caso di stampa righe articoli
 | 
				
			||||||
  TString4 _codiva, _um, _descragg;
 | 
					  TString4 _codiva, _um;
 | 
				
			||||||
  TString _strprezzo, _stromaggio, _strstorico; //stringhe per la stampa del prezzo dell'articolo (normale, omaggiato e storico!)
 | 
					  TString _strprezzo, _stromaggio, _strstorico, _descragg; //stringhe per la stampa del prezzo dell'articolo (normale, omaggiato e storico!)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
  static bool tipo_handler(TMask_field& f, KEY k);
 | 
					  static bool tipo_handler(TMask_field& f, KEY k);
 | 
				
			||||||
@ -314,8 +314,8 @@ bool TStampa_condizioni_vendita::preprocess_page(int i, int c)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  if (i == LF_RCONDV)
 | 
					  if (i == LF_RCONDV)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    TLocalisamfile &rcondv= current_cursor()->file();
 | 
					    const TRectype& rcondv= current_cursor()->curr();
 | 
				
			||||||
    TLocalisamfile &anamag= current_cursor()->file(-ART1);
 | 
					    const TRectype& anamag= current_cursor()->curr(-ART1);
 | 
				
			||||||
    _codiva = rcondv.get("CODIVA");
 | 
					    _codiva = rcondv.get("CODIVA");
 | 
				
			||||||
    _um     = rcondv.get("UM");
 | 
					    _um     = rcondv.get("UM");
 | 
				
			||||||
    if (_printdesagg)
 | 
					    if (_printdesagg)
 | 
				
			||||||
@ -327,7 +327,7 @@ bool TStampa_condizioni_vendita::preprocess_page(int i, int c)
 | 
				
			|||||||
    if (_codiva.empty())
 | 
					    if (_codiva.empty())
 | 
				
			||||||
      _codiva = anamag.get("CODIVA");
 | 
					      _codiva = anamag.get("CODIVA");
 | 
				
			||||||
    if (_um.empty())
 | 
					    if (_um.empty())
 | 
				
			||||||
      _um   = current_cursor()->file(LF_UMART).get("UM"); // Prima unità di misura per sto articolo
 | 
					      _um   = current_cursor()->curr(LF_UMART).get("UM"); // Prima unità di misura per sto articolo
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return TRUE;
 | 
					  return TRUE;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -597,9 +597,9 @@ void TStampa_condizioni_vendita::set_page(int file, int) {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ve3200(int argc, char **argv) {
 | 
					int ve3200(int argc, char **argv) 
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
  TStampa_condizioni_vendita a;
 | 
					  TStampa_condizioni_vendita a;
 | 
				
			||||||
  
 | 
					  a.run(argc, argv, TR("Stampa condizioni vendita"));
 | 
				
			||||||
  a.run(argc, argv, "Stampa condizioni vendita");
 | 
					 | 
				
			||||||
  return 0;
 | 
					  return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -249,6 +249,7 @@ public:
 | 
				
			|||||||
	// Funzioni che effettuano la cache di importanti valori contenuti nel profilo
 | 
						// Funzioni che effettuano la cache di importanti valori contenuti nel profilo
 | 
				
			||||||
	const char	tipocf() const;
 | 
						const char	tipocf() const;
 | 
				
			||||||
	void	set_defaults(TMask& m) const;
 | 
						void	set_defaults(TMask& m) const;
 | 
				
			||||||
 | 
					  const TString_array& get_defaults() const;
 | 
				
			||||||
	const TString_array& keys_descrs() const;
 | 
						const TString_array& keys_descrs() const;
 | 
				
			||||||
	const TString_array& sheet_columns() const;
 | 
						const TString_array& sheet_columns() const;
 | 
				
			||||||
	const TPointer_array& handlers() const;
 | 
						const TPointer_array& handlers() const;
 | 
				
			||||||
@ -891,13 +892,18 @@ public:
 | 
				
			|||||||
	virtual ~TDocumento();
 | 
						virtual ~TDocumento();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
#define FOR_EACH_PHYSICAL_RDOC(__doc, __r, __rdoc) TRiga_documento* __rdoc=NULL; \
 | 
					#define FOR_EACH_PHYSICAL_RDOC(__doc, __r, __rdoc) TRiga_documento* __rdoc=NULL; \
 | 
				
			||||||
  TRecord_array& bodyof##__rdoc = (__doc).body(); \
 | 
					  TRecord_array& bodyof##__rdoc = (__doc).body(); \
 | 
				
			||||||
  for (int __r = bodyof##__rdoc.first_row(); bodyof##__rdoc.exist(__r) && (__rdoc=&(__doc)[__r])!=NULL; __r=bodyof##__rdoc.succ_row(__r))
 | 
					  for (int __r = bodyof##__rdoc.first_row(); bodyof##__rdoc.exist(__r) && (__rdoc=&(__doc)[__r])!=NULL; __r=bodyof##__rdoc.succ_row(__r))
 | 
				
			||||||
 | 
					*/
 | 
				
			||||||
 | 
					#define FOR_EACH_PHYSICAL_RDOC(__doc, __r, __rdoc) TRiga_documento* __rdoc=NULL; \
 | 
				
			||||||
 | 
					  TRecord_array& bodyof##__rdoc = (__doc).body(); \
 | 
				
			||||||
 | 
					  for (int __r = bodyof##__rdoc.first_row(); bodyof##__rdoc.exist(__r) && (__rdoc=&(TRiga_documento&)bodyof##__rdoc.row(__r))!=NULL; __r=bodyof##__rdoc.succ_row(__r))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define FOR_EACH_PHYSICAL_RDOC_BACK(__doc, __r, __rdoc) TRiga_documento* __rdoc=NULL; \
 | 
					#define FOR_EACH_PHYSICAL_RDOC_BACK(__doc, __r, __rdoc) TRiga_documento* __rdoc=NULL; \
 | 
				
			||||||
  TRecord_array& bodyof##__rdoc = (__doc).body(); \
 | 
					  TRecord_array& bodyof##__rdoc = (__doc).body(); \
 | 
				
			||||||
  for (int __r = bodyof##__rdoc.last_row(); __r>0 && (__rdoc=&(__doc)[__r])!= NULL; __r = bodyof##__rdoc.pred_row(__r))
 | 
					  for (int __r = bodyof##__rdoc.last_row(); __r>0 && (__rdoc=&(TRiga_documento&)bodyof##__rdoc.row(__r))!= NULL; __r = bodyof##__rdoc.pred_row(__r))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TCurrency_documento : public TCurrency
 | 
					class TCurrency_documento : public TCurrency
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -984,6 +990,7 @@ protected:
 | 
				
			|||||||
  
 | 
					  
 | 
				
			||||||
	int insert_anal_fields(TMask& m, int page, int lf, int& y, short& dlg, short& dlgd, bool required);
 | 
						int insert_anal_fields(TMask& m, int page, int lf, int& y, short& dlg, short& dlgd, bool required);
 | 
				
			||||||
	void insert_anal_page();
 | 
						void insert_anal_page();
 | 
				
			||||||
 | 
					  void set_or_def(short id, const TString& val);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	virtual bool is_omaggio_enabled() { return true;}
 | 
						virtual bool is_omaggio_enabled() { return true;}
 | 
				
			||||||
 | 
				
			|||||||
@ -17,10 +17,6 @@
 | 
				
			|||||||
#include "vepriv.h"
 | 
					#include "vepriv.h"
 | 
				
			||||||
#include "veuml.h"
 | 
					#include "veuml.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//#include <doc.h>
 | 
					 | 
				
			||||||
//#include <clifo.h>
 | 
					 | 
				
			||||||
//#include <cfven.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
///////////////////////////////////////////////////////////
 | 
					///////////////////////////////////////////////////////////
 | 
				
			||||||
// TTipo_documento_cache
 | 
					// TTipo_documento_cache
 | 
				
			||||||
///////////////////////////////////////////////////////////
 | 
					///////////////////////////////////////////////////////////
 | 
				
			||||||
@ -48,15 +44,13 @@ TObject* TTipo_documento_cache::rec2obj(const TRectype& curr) const
 | 
				
			|||||||
  return new TTipo_documento(curr);
 | 
					  return new TTipo_documento(curr);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TTipo_documento & TTipo_documento_cache::tipo(const char* key)
 | 
					TTipo_documento& TTipo_documento_cache::tipo(const char* key)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	TString8 k;
 | 
						TString8 k;	k << "TIP|" << key;
 | 
				
			||||||
	k << "TIP|" << key;
 | 
					  return (TTipo_documento&)query(k);
 | 
				
			||||||
  TTipo_documento & tipo = (TTipo_documento &) query(k);
 | 
					 | 
				
			||||||
  return tipo;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const TTipo_documento & cached_tipodoc(const char * tipodoc)
 | 
					const TTipo_documento& cached_tipodoc(const char* tipodoc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	HIDDEN TTipo_documento_cache __cache_tipi_documento;
 | 
						HIDDEN TTipo_documento_cache __cache_tipi_documento;
 | 
				
			||||||
	return __cache_tipi_documento.tipo(tipodoc);
 | 
						return __cache_tipi_documento.tipo(tipodoc);
 | 
				
			||||||
@ -73,7 +67,6 @@ protected:
 | 
				
			|||||||
public:
 | 
					public:
 | 
				
			||||||
	TCodice_numerazione & num(const char* key);
 | 
						TCodice_numerazione & num(const char* key);
 | 
				
			||||||
	TNumerazione_cache();
 | 
						TNumerazione_cache();
 | 
				
			||||||
	virtual ~TNumerazione_cache() { }
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TNumerazione_cache::TNumerazione_cache()
 | 
					TNumerazione_cache::TNumerazione_cache()
 | 
				
			||||||
@ -90,11 +83,8 @@ TObject* TNumerazione_cache::rec2obj(const TRectype& curr) const
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
TCodice_numerazione & TNumerazione_cache::num(const char* key)
 | 
					TCodice_numerazione & TNumerazione_cache::num(const char* key)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	TString8 k;
 | 
						TString8 k; k << "NUM|" << key;
 | 
				
			||||||
	
 | 
					  return (TCodice_numerazione&)query(k);
 | 
				
			||||||
	k << "NUM|" << key;
 | 
					 | 
				
			||||||
  TCodice_numerazione & num = (TCodice_numerazione &) query(k);
 | 
					 | 
				
			||||||
  return num;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const TCodice_numerazione& cached_numerazione(const char * codnum)
 | 
					const TCodice_numerazione& cached_numerazione(const char * codnum)
 | 
				
			||||||
@ -2190,8 +2180,8 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
 | 
				
			|||||||
	TArray imponibili;
 | 
						TArray imponibili;
 | 
				
			||||||
  const bool fatt_comm = tipo().fattura_commerciale();
 | 
					  const bool fatt_comm = tipo().fattura_commerciale();
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
  TString4 codiva_es;               
 | 
					  TString4 codiva_es; iva_esente(codiva_es);
 | 
				
			||||||
  iva_esente(codiva_es);                       
 | 
					  
 | 
				
			||||||
  for (int i = items; i > 0; i--)
 | 
					  for (int i = items; i > 0; i--)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    const TRiga_documento& r = row(i);
 | 
					    const TRiga_documento& r = row(i);
 | 
				
			||||||
@ -2207,8 +2197,8 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
 | 
				
			|||||||
    else
 | 
					    else
 | 
				
			||||||
      if (!r.is_descrizione())
 | 
					      if (!r.is_descrizione())
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        const real imposta = doc_al_lordo ? ZERO :r.imposta(FALSE);
 | 
					        const real imposta = doc_al_lordo ? ZERO : r.imposta(false);
 | 
				
			||||||
// Aggiorna o aggiunge l'elemento se non esiste    
 | 
					        // Aggiorna o aggiunge l'elemento se non esiste    
 | 
				
			||||||
        const TCodiceIVA & iva = r.iva(); 
 | 
					        const TCodiceIVA & iva = r.iva(); 
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        if (iva.ok())
 | 
					        if (iva.ok())
 | 
				
			||||||
@ -2231,7 +2221,7 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
  }  
 | 
					  }  
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  if (table.items() == 0)
 | 
					  if (table.empty())
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
  if (tot_sconti != ZERO)
 | 
					  if (tot_sconti != ZERO)
 | 
				
			||||||
@ -2244,17 +2234,18 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
 | 
				
			|||||||
			FOR_EACH_ASSOC_OBJECT(table, obj, key, o)
 | 
								FOR_EACH_ASSOC_OBJECT(table, obj, key, o)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				TRiepilogo_iva* aliquota = (TRiepilogo_iva*)o;
 | 
									TRiepilogo_iva* aliquota = (TRiepilogo_iva*)o;
 | 
				
			||||||
				d.add(aliquota->imp() - aliquota->imp_spese_row());
 | 
					        const real i = aliquota->imp() - aliquota->imp_spese_row();
 | 
				
			||||||
 | 
									d.add(i);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
		FOR_EACH_ASSOC_OBJECT(table, obj, key, o)
 | 
							FOR_EACH_ASSOC_OBJECT(table, obj, key, o)
 | 
				
			||||||
    {     
 | 
					    {     
 | 
				
			||||||
			TRiepilogo_iva * aliquota = (TRiepilogo_iva *) o;
 | 
								TRiepilogo_iva& aliquota = *(TRiepilogo_iva*)o;
 | 
				
			||||||
      const TCodiceIVA & ci = aliquota->cod_iva();    
 | 
					      const TCodiceIVA& ci = aliquota.cod_iva();    
 | 
				
			||||||
      const real i(d.get());
 | 
					      const real i = d.get();
 | 
				
			||||||
      real & imponibile = aliquota->imp();
 | 
					 | 
				
			||||||
      
 | 
					      
 | 
				
			||||||
 | 
					      real& imponibile = aliquota.imp();
 | 
				
			||||||
      imponibile += i;
 | 
					      imponibile += i;
 | 
				
			||||||
      
 | 
					      
 | 
				
			||||||
      TGeneric_distrib s(i, ndec);
 | 
					      TGeneric_distrib s(i, ndec);
 | 
				
			||||||
@ -2262,10 +2253,10 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
 | 
				
			|||||||
      s.add(tot_sconti_imp);
 | 
					      s.add(tot_sconti_imp);
 | 
				
			||||||
      s.add(tot_sconti_perc);
 | 
					      s.add(tot_sconti_perc);
 | 
				
			||||||
      
 | 
					      
 | 
				
			||||||
      aliquota->sconto_imp() = s.get();
 | 
					      aliquota.sconto_imp() = s.get();
 | 
				
			||||||
      aliquota->sconto_perc() = s.get(); 
 | 
					      aliquota.sconto_perc() = s.get(); 
 | 
				
			||||||
      
 | 
					      
 | 
				
			||||||
      real & iva = aliquota->iva();   
 | 
					      real& iva = aliquota.iva();   
 | 
				
			||||||
      
 | 
					      
 | 
				
			||||||
/*      if (doc_al_lordo)
 | 
					/*      if (doc_al_lordo)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
@ -2287,7 +2278,7 @@ void TDocumento::update_tabella_iva(bool solo_imponibili)
 | 
				
			|||||||
        const real imposta(ci.imposta(i, ndec));
 | 
					        const real imposta(ci.imposta(i, ndec));
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
        iva += imposta;
 | 
					        iva += imposta;
 | 
				
			||||||
        aliquota->iva_sconto() = imposta;
 | 
					        aliquota.iva_sconto() = imposta;
 | 
				
			||||||
        tot_doc += imposta;
 | 
					        tot_doc += imposta;
 | 
				
			||||||
      } 
 | 
					      } 
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -2759,7 +2750,7 @@ void TDocumento::update_raee()
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old, TSheet_field * sh)
 | 
					void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old, TSheet_field* sh)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  const bool updated = get_bool(DOC_SPESEUPD);
 | 
					  const bool updated = get_bool(DOC_SPESEUPD);
 | 
				
			||||||
  if (updated)
 | 
					  if (updated)
 | 
				
			||||||
@ -2800,7 +2791,7 @@ void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old,
 | 
				
			|||||||
        const TString& s = spese_aut.row(i);
 | 
					        const TString& s = spese_aut.row(i);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        if (sp.read(s) != NOERR)
 | 
					        if (sp.read(s) != NOERR)
 | 
				
			||||||
          message_box("Codice spesa  %s  assente", (const char *) s);
 | 
					          warning_box("Codice spesa '%s' assente", (const char*)s);
 | 
				
			||||||
        else 
 | 
					        else 
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          const TString4 tipo(sp.tipo_riga());
 | 
					          const TString4 tipo(sp.tipo_riga());
 | 
				
			||||||
 | 
				
			|||||||
@ -1,11 +1,10 @@
 | 
				
			|||||||
#include <recset.h>
 | 
					 | 
				
			||||||
#include <tabutil.h>
 | 
					 | 
				
			||||||
#include <utility.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "velib.h"
 | 
					#include "velib.h"
 | 
				
			||||||
#include "vepriv.h"
 | 
					#include "vepriv.h"
 | 
				
			||||||
#include "verig.h"
 | 
					#include "verig.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <tabutil.h>
 | 
				
			||||||
 | 
					#include <utility.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "../db/dblib.h"
 | 
					#include "../db/dblib.h"
 | 
				
			||||||
#include "../mg/mglib.h"
 | 
					#include "../mg/mglib.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -307,7 +306,7 @@ const TPointer_array&  TTipo_documento::handlers() const
 | 
				
			|||||||
  return _handlers;
 | 
					  return _handlers;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TTipo_documento::set_defaults(TMask& m) const
 | 
					const TString_array& TTipo_documento::get_defaults() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (_defaults.empty()) // Carica lo string_array con i defaults
 | 
					  if (_defaults.empty()) // Carica lo string_array con i defaults
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@ -323,11 +322,15 @@ void TTipo_documento::set_defaults(TMask& m) const
 | 
				
			|||||||
     ((TTipo_documento*)this)->_defaults.add(s.get(), field);
 | 
					     ((TTipo_documento*)this)->_defaults.add(s.get(), field);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  return _defaults;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void TTipo_documento::set_defaults(TMask& m) const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  const TString_array& def = get_defaults();
 | 
				
			||||||
  // Setta i campi della maschera
 | 
					  // Setta i campi della maschera
 | 
				
			||||||
  FOR_EACH_ARRAY_ROW(_defaults, i, tt)
 | 
					  FOR_EACH_ARRAY_ROW(def, i, tt)
 | 
				
			||||||
	{
 | 
					    m.set(i, *tt, true);
 | 
				
			||||||
    m.set(i, *tt, TRUE);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TTipo_documento::add_formula_if_needed(TConfig& profile, TString& variable,
 | 
					void TTipo_documento::add_formula_if_needed(TConfig& profile, TString& variable,
 | 
				
			||||||
 | 
				
			|||||||
@ -168,7 +168,7 @@ int TLista_documenti::write(bool re) const
 | 
				
			|||||||
  else
 | 
					  else
 | 
				
			||||||
    msg.format(FR("Creazione di %d documenti"), docs);
 | 
					    msg.format(FR("Creazione di %d documenti"), docs);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TProgind pi(docs, msg, true, true);
 | 
					  TProgress_monitor pi(docs, msg, true);
 | 
				
			||||||
  int err = NOERR;                                      
 | 
					  int err = NOERR;                                      
 | 
				
			||||||
  for (int i = 0; i < docs && err == NOERR; i++)
 | 
					  for (int i = 0; i < docs && err == NOERR; i++)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 | 
				
			|||||||
@ -37,7 +37,7 @@ void TFatturazione_bolle::campi_raggruppamento_righe(TToken_string& campi_riga)
 | 
				
			|||||||
  {
 | 
					  {
 | 
				
			||||||
    campi_riga = RDOC_CODART"|"RDOC_UMQTA;  // Uguali sempre
 | 
					    campi_riga = RDOC_CODART"|"RDOC_UMQTA;  // Uguali sempre
 | 
				
			||||||
    // Uguali se commesse attive
 | 
					    // Uguali se commesse attive
 | 
				
			||||||
    if (dongle().active(CAAUT) || dongle().active(CMAUT))
 | 
					    if (ca_config().get_int("Authorizations") != 0)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      campi_riga.add(RDOC_CODCMS);
 | 
					      campi_riga.add(RDOC_CODCMS);
 | 
				
			||||||
      campi_riga.add(RDOC_FASCMS);
 | 
					      campi_riga.add(RDOC_FASCMS);
 | 
				
			||||||
@ -123,7 +123,6 @@ void TFatturazione_bolle::elabora_riga(TRiga_documento& r, TDocumento& doc_out,
 | 
				
			|||||||
		if (rin.is_generata() && rin.get("GENTIPO").empty() && rin.is_spese())
 | 
							if (rin.is_generata() && rin.get("GENTIPO").empty() && rin.is_spese())
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			const TSpesa_prest& sp = rin.spesa();
 | 
								const TSpesa_prest& sp = rin.spesa();
 | 
				
			||||||
 | 
					 | 
				
			||||||
			if (sp.tipo() == 'P')
 | 
								if (sp.tipo() == 'P')
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -138,7 +137,6 @@ void TFatturazione_bolle::elabora_riga(TRiga_documento& r, TDocumento& doc_out,
 | 
				
			|||||||
			return;
 | 
								return;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		const real q = rin.get(RDOC_QTA);
 | 
							const real q = rin.get(RDOC_QTA);
 | 
				
			||||||
 | 
					 | 
				
			||||||
		r.put(RDOC_QTAEVASA, q);
 | 
							r.put(RDOC_QTAEVASA, q);
 | 
				
			||||||
		r.put(RDOC_RIGAEVASA, true);
 | 
							r.put(RDOC_RIGAEVASA, true);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -452,7 +450,6 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
 | 
				
			|||||||
        return error_box("Documenti incompatibili: cliente/fornitore diverso");
 | 
					        return error_box("Documenti incompatibili: cliente/fornitore diverso");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			const TString4 codnum(out.get(DOC_CODNUM));
 | 
								const TString4 codnum(out.get(DOC_CODNUM));
 | 
				
			||||||
 | 
					 | 
				
			||||||
			if (cached_numerazione(codnum).num_provv())
 | 
								if (cached_numerazione(codnum).num_provv())
 | 
				
			||||||
				out.put(DOC_PROVV, 'P');
 | 
									out.put(DOC_PROVV, 'P');
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@ -499,6 +496,8 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
 | 
				
			|||||||
      TDocumento::copy_data(new_doc->head(), campione.head());    // Copio la testata 
 | 
					      TDocumento::copy_data(new_doc->head(), campione.head());    // Copio la testata 
 | 
				
			||||||
//      td = old_tipo_in;                                         // Ripristino il vecchio
 | 
					//      td = old_tipo_in;                                         // Ripristino il vecchio
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      new_doc->zero(DOC_SPESEUPD);  // Senno' non aggiorna le spese automatiche
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
      new_doc->put(DOC_DATADOC, data_elab);
 | 
					      new_doc->put(DOC_DATADOC, data_elab);
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
      // Aggiungilo alla lista dei documenti in uscita
 | 
					      // Aggiungilo alla lista dei documenti in uscita
 | 
				
			||||||
@ -590,10 +589,9 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
 | 
				
			|||||||
		else
 | 
							else
 | 
				
			||||||
		d.put("FATID", 0);
 | 
							d.put("FATID", 0);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
  for (int i = doc_out.items() - 1; i >=0; i--)   // Aggiorna esenzione
 | 
					  for (int i = doc_out.items() - 1; i >= 0; i--)   // Aggiorna esenzione
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    TDocumento& d = doc_out[i];
 | 
					    TDocumento& d = doc_out[i];
 | 
				
			||||||
 | 
					 | 
				
			||||||
    d.update_esenzione();
 | 
					    d.update_esenzione();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return doc_out.items() > 0;
 | 
					  return doc_out.items() > 0;
 | 
				
			||||||
 | 
				
			|||||||
@ -1138,7 +1138,6 @@ error_type TContabilizzazione::compile_head_mov(TDocumento& doc)
 | 
				
			|||||||
			descr << ' ';
 | 
								descr << ' ';
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
	const TString16 rif = doc.get(DOC_NUMDOCRIF);
 | 
						const TString16 rif = doc.get(DOC_NUMDOCRIF);
 | 
				
			||||||
	const bool use_rif = _caus->iva() == iva_acquisti && rif.not_empty();
 | 
						const bool use_rif = _caus->iva() == iva_acquisti && rif.not_empty();
 | 
				
			||||||
	if (use_rif)
 | 
						if (use_rif)
 | 
				
			||||||
@ -3146,7 +3145,7 @@ error_type TContabilizzazione::write_all(TDocumento& doc, TMovimentoPN_VE & movi
 | 
				
			|||||||
  if (good() && in_enabled())
 | 
					  if (good() && in_enabled())
 | 
				
			||||||
    write_intra(doc);
 | 
					    write_intra(doc);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  if (good() && (dongle().active(CMAUT) || dongle().active(CAAUT)))
 | 
					  if (good() && (ca_config().get_int("Authorizations") & 0x5)) // No CI qui
 | 
				
			||||||
    write_anal(doc, movimento);
 | 
					    write_anal(doc, movimento);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	const int tipocoll = _caus->link_m770();
 | 
						const int tipocoll = _caus->link_m770();
 | 
				
			||||||
@ -3225,7 +3224,7 @@ error_type TContabilizzazione::write_all_re(TDocumento& doc, TMovimentoPN_VE & m
 | 
				
			|||||||
  aggiorna_saldi(saldo, movimento, true);
 | 
					  aggiorna_saldi(saldo, movimento, true);
 | 
				
			||||||
  dispatch_transaction(movimento, old_numreg > 0 ? "MODIFY": "INSERT");
 | 
					  dispatch_transaction(movimento, old_numreg > 0 ? "MODIFY": "INSERT");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (good() && (dongle().active(CMAUT) || dongle().active(CAAUT)))
 | 
					  if (good() && (ca_config().get_int("Authorizations") & 0x5)) // No CIAUT
 | 
				
			||||||
    write_anal(doc, movimento);
 | 
					    write_anal(doc, movimento);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (good())
 | 
					  if (good())
 | 
				
			||||||
 | 
				
			|||||||
@ -112,35 +112,32 @@ int rows_sort_func(TSheet_field& s, int i, int j)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  const TToken_string& s1 = s.row(i);
 | 
					  const TToken_string& s1 = s.row(i);
 | 
				
			||||||
  const TToken_string& s2 = s.row(j);
 | 
					  const TToken_string& s2 = s.row(j);
 | 
				
			||||||
  TString80 ss1, ss2;
 | 
					  
 | 
				
			||||||
  TDate dd1, dd2;
 | 
					  const short fields[] = { S_CODART, S_LIVGIAC1, S_LIVGIAC2, S_LIVGIAC3, S_LIVGIAC4, 
 | 
				
			||||||
  real rr1, rr2;
 | 
					 | 
				
			||||||
  const int fields[] = { S_CODART, S_LIVGIAC1, S_LIVGIAC2, S_LIVGIAC3, S_LIVGIAC4, 
 | 
					 | 
				
			||||||
                           S_CODMAG, S_CODDEP, S_RIGAEVASA, S_DATACONS, S_QTARESIDUA, -1 };
 | 
					                           S_CODMAG, S_CODDEP, S_RIGAEVASA, S_DATACONS, S_QTARESIDUA, -1 };
 | 
				
			||||||
  int ret = 0;
 | 
					  int ret = 0;
 | 
				
			||||||
  for (short field = 0; fields[field] > 0; field++)
 | 
					  for (int field = 0; ret == 0 && fields[field] > 0; field++)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    if (fields[field] == S_QTARESIDUA)
 | 
					    if (fields[field] == S_QTARESIDUA)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					      real rr1, rr2;
 | 
				
			||||||
      s1.get(fields[field]-FIRST_FIELD, rr1);
 | 
					      s1.get(fields[field]-FIRST_FIELD, rr1);
 | 
				
			||||||
      s2.get(fields[field]-FIRST_FIELD, rr2);
 | 
					      s2.get(fields[field]-FIRST_FIELD, rr2);
 | 
				
			||||||
      ret = rr2 < rr1 ? -1 : (rr2 > rr1 ? 1 : 0);
 | 
					      ret = rr2 < rr1 ? -1 : (rr2 > rr1 ? 1 : 0);
 | 
				
			||||||
    } 
 | 
					    } 
 | 
				
			||||||
    else 
 | 
					    else 
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					      TString80 ss1, ss2;
 | 
				
			||||||
      s1.get(fields[field]-FIRST_FIELD ,ss1);
 | 
					      s1.get(fields[field]-FIRST_FIELD ,ss1);
 | 
				
			||||||
      s2.get(fields[field]-FIRST_FIELD ,ss2);
 | 
					      s2.get(fields[field]-FIRST_FIELD ,ss2);
 | 
				
			||||||
      if (fields[field] == S_DATACONS)
 | 
					      if (fields[field] == S_DATACONS)
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        dd1 = ss1;
 | 
					        const TDate dd1 = ss1, dd2 = ss2;
 | 
				
			||||||
        dd2 = ss2;
 | 
					 | 
				
			||||||
        ret = int (dd1.date2ansi() - dd2.date2ansi());
 | 
					        ret = int (dd1.date2ansi() - dd2.date2ansi());
 | 
				
			||||||
      } 
 | 
					      } 
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
        ret = ss1.compare(ss2);
 | 
					        ret = ss1.compare(ss2);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (ret != 0)
 | 
					 | 
				
			||||||
      break;
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  return ret;
 | 
					  return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -199,10 +196,14 @@ void TConsegna_mask::doc2mask(const TDocumento& doc, const TString& articolo)
 | 
				
			|||||||
      const TString& livello = rec.get(RDOC_LIVELLO);
 | 
					      const TString& livello = rec.get(RDOC_LIVELLO);
 | 
				
			||||||
      for (int l = 1; l <= 4; l++)
 | 
					      for (int l = 1; l <= 4; l++)
 | 
				
			||||||
        r.add(livelli_giacenza().unpack_grpcode(livello, l));
 | 
					        r.add(livelli_giacenza().unpack_grpcode(livello, l));
 | 
				
			||||||
      if (rec.get_date(RDOC_DATACONS).ok())
 | 
					      
 | 
				
			||||||
        r.add(rec.get_date(RDOC_DATACONS));
 | 
					      // Reperisce data di consegna da riga o testata
 | 
				
			||||||
 | 
					      const TDate row_data_cons = rec.get(RDOC_DATACONS);
 | 
				
			||||||
 | 
					      if (row_data_cons.ok())
 | 
				
			||||||
 | 
					        r.add(row_data_cons);
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
        r.add(doc.get_date(DOC_DATACONS));
 | 
					        r.add(doc.get_date(DOC_DATACONS));
 | 
				
			||||||
 | 
					      
 | 
				
			||||||
      r.add(rec.get(RDOC_PREZZO), s.cid2index(S_PREZZO));
 | 
					      r.add(rec.get(RDOC_PREZZO), s.cid2index(S_PREZZO));
 | 
				
			||||||
      r.add(rec.get(RDOC_DESCR), s.cid2index(S_DESCR));
 | 
					      r.add(rec.get(RDOC_DESCR), s.cid2index(S_DESCR));
 | 
				
			||||||
      r.add(rec.get(RDOC_TIPORIGA), s.cid2index(S_TIPORIGA));
 | 
					      r.add(rec.get(RDOC_TIPORIGA), s.cid2index(S_TIPORIGA));
 | 
				
			||||||
@ -226,10 +227,10 @@ TConsegna_mask::TConsegna_mask(int header_code, bool per_codice, bool ignora_des
 | 
				
			|||||||
  if (header_code == 1)
 | 
					  if (header_code == 1)
 | 
				
			||||||
  {                                   
 | 
					  {                                   
 | 
				
			||||||
    s.set_column_header(S_QTARESIDUA, HR("Quantità\nconsegnata"));
 | 
					    s.set_column_header(S_QTARESIDUA, HR("Quantità\nconsegnata"));
 | 
				
			||||||
    s.sheet_mask().field(S_QTARESIDUA).set_prompt(PR("Q.ta' consegnata"));
 | 
					    s.sheet_mask().field(S_QTARESIDUA).set_prompt(PR("Q.tà consegnata"));
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    s.set_column_header(S_QTADAEVADERE, HR("Quantità\nda fatturare"));
 | 
					    s.set_column_header(S_QTADAEVADERE, HR("Quantità\nda fatturare"));
 | 
				
			||||||
    s.sheet_mask().field(S_QTADAEVADERE).set_prompt(PR("Q.ta' da fatturare"));
 | 
					    s.sheet_mask().field(S_QTADAEVADERE).set_prompt(PR("Q.tà da fatturare"));
 | 
				
			||||||
  } else
 | 
					  } else
 | 
				
			||||||
  if (header_code == 2)
 | 
					  if (header_code == 2)
 | 
				
			||||||
  {                                   
 | 
					  {                                   
 | 
				
			||||||
@ -692,12 +693,12 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
 | 
				
			|||||||
					if (prezzo_da_ordine())
 | 
										if (prezzo_da_ordine())
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
						//const bool doc_al_lordo = outdoc.tipo().calcolo_lordo();
 | 
											//const bool doc_al_lordo = outdoc.tipo().calcolo_lordo();
 | 
				
			||||||
						const TString & codart = outrec.get(RDOC_CODARTMAG);
 | 
											const TString& codart = outrec.get(RDOC_CODARTMAG);
 | 
				
			||||||
						const TRectype & anamag = cache().get(LF_ANAMAG, codart);
 | 
											const TRectype& anamag = cache().get(LF_ANAMAG, codart);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
						if (!anamag.empty())
 | 
											if (!anamag.empty())
 | 
				
			||||||
						{
 | 
											{
 | 
				
			||||||
							const TString16 field_prezzo = outdoc.tipo().field_prezzo();
 | 
												const TFixed_string field_prezzo = outdoc.tipo().field_prezzo();
 | 
				
			||||||
							if (field_prezzo.full())
 | 
												if (field_prezzo.full())
 | 
				
			||||||
								outrec.put(RDOC_PREZZO, anamag.get_real(field_prezzo));
 | 
													outrec.put(RDOC_PREZZO, anamag.get_real(field_prezzo));
 | 
				
			||||||
							else
 | 
												else
 | 
				
			||||||
@ -716,6 +717,14 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
 | 
				
			|||||||
						}
 | 
											}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
						
 | 
											
 | 
				
			||||||
 | 
					          
 | 
				
			||||||
 | 
					          TDate dc = outrec.get(RDOC_DATACONS); // Controllo che sia sempre piena la data di consegna, 
 | 
				
			||||||
 | 
					          if (!dc.ok())                         // che potrebbe venire da righe che non ce l'hanno perchè uguale alla testata! 
 | 
				
			||||||
 | 
					          {
 | 
				
			||||||
 | 
					            dc = row->get(S_DATACONS - FIRST_FIELD);
 | 
				
			||||||
 | 
					            outrec.put(RDOC_DATACONS, dc);
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          const int last_row = outdoc.physical_rows();
 | 
					          const int last_row = outdoc.physical_rows();
 | 
				
			||||||
					if (j > 0 && last_row > 0 && gestione_riferimenti())
 | 
										if (j > 0 && last_row > 0 && gestione_riferimenti())
 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
@ -723,6 +732,7 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
 | 
				
			|||||||
            if (last_rdoc.is_descrizione() && last_rdoc.get("RIFR").full())
 | 
					            if (last_rdoc.is_descrizione() && last_rdoc.get("RIFR").full())
 | 
				
			||||||
							outdoc.destroy_row(last_row, true); 
 | 
												outdoc.destroy_row(last_row, true); 
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }  
 | 
					    }  
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										111
									
								
								ve/velib06.cpp
									
									
									
									
									
								
							
							
						
						
									
										111
									
								
								ve/velib06.cpp
									
									
									
									
									
								
							@ -120,14 +120,9 @@ TDocumento_mask::TDocumento_mask(const char* td)
 | 
				
			|||||||
	listbox.replace_items(keys, desc);
 | 
						listbox.replace_items(keys, desc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Controlla se deve generare la pagina di analitica
 | 
						// Controlla se deve generare la pagina di analitica
 | 
				
			||||||
  _ges_ca = dongle().active(CAAUT) || dongle().active(CMAUT);
 | 
					  _ges_ca = ca_config().get_int("Authorizations") != 0;
 | 
				
			||||||
  if (_ges_ca)
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    TConfig& caini = ca_config();
 | 
					 | 
				
			||||||
    _ges_ca = caini.get("Level", NULL, 1).full();
 | 
					 | 
				
			||||||
  if (_ges_ca)
 | 
					  if (_ges_ca)
 | 
				
			||||||
    insert_anal_page();
 | 
					    insert_anal_page();
 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	configura_sheet(*_sheet);
 | 
						configura_sheet(*_sheet);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
@ -140,7 +135,6 @@ TDocumento_mask::TDocumento_mask(const char* td)
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
	for (i = fields() - 1; i >= 0; i--)
 | 
						for (i = fields() - 1; i >= 0; i--)
 | 
				
			||||||
 | 
					 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		TMask_field& f = fld(i);
 | 
							TMask_field& f = fld(i);
 | 
				
			||||||
    if (f.is_operable())
 | 
					    if (f.is_operable())
 | 
				
			||||||
@ -989,6 +983,25 @@ void TDocumento_mask::contr2mask()
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void TDocumento_mask::set_or_def(short id, const TString& val)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  TMask_field* fld = find_by_id(id);
 | 
				
			||||||
 | 
					  if (fld != NULL)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    if (val.blank())
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      const TString_array& def = doc().tipo().get_defaults();
 | 
				
			||||||
 | 
					      const TString* str = (const TString*)def.objptr(id);
 | 
				
			||||||
 | 
					      if (str != NULL && str->full())
 | 
				
			||||||
 | 
					        fld->set(*str);
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
					        fld->reset();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      fld->set(val);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TDocumento_mask::cli2mask(bool force_load)
 | 
					void TDocumento_mask::cli2mask(bool force_load)
 | 
				
			||||||
{	
 | 
					{	
 | 
				
			||||||
	const TCli_for& c = doc().clifor(); 
 | 
						const TCli_for& c = doc().clifor(); 
 | 
				
			||||||
@ -1119,25 +1132,26 @@ void TDocumento_mask::cli2mask(bool force_load)
 | 
				
			|||||||
			set(F_CODCABP1, cfbanpr.get(CFBAN_CAB), 0x2);
 | 
								set(F_CODCABP1, cfbanpr.get(CFBAN_CAB), 0x2);
 | 
				
			||||||
			set(F_PROGBNP1, cfbanpr.get(CFBAN_PROGPR));
 | 
								set(F_PROGBNP1, cfbanpr.get(CFBAN_PROGPR));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		set(F_RAGGR, ven_rec.get(CFV_RAGGDOC));
 | 
					
 | 
				
			||||||
		set(F_RAGGREFF, ven_rec.get(CFV_RAGGEFF));
 | 
							set_or_def(F_RAGGR, ven_rec.get(CFV_RAGGDOC));
 | 
				
			||||||
		set(F_CODINDSP, ven_rec.get(CFV_CODINDSP));
 | 
							set_or_def(F_RAGGREFF, ven_rec.get(CFV_RAGGEFF));
 | 
				
			||||||
		set(F_CODAG, ven_rec.get(CFV_CODAG));
 | 
							set_or_def(F_CODINDSP, ven_rec.get(CFV_CODINDSP));
 | 
				
			||||||
		set(F_CODAGVIS, ven_rec.get(CFV_CODAG1));
 | 
							set_or_def(F_CODAG, ven_rec.get(CFV_CODAG));
 | 
				
			||||||
		set(F_CODSPMEZZO, ven_rec.get(CFV_CODSPMEZZO));
 | 
							set_or_def(F_CODAGVIS, ven_rec.get(CFV_CODAG1));
 | 
				
			||||||
		set(F_CODPORTO, ven_rec.get(CFV_CODPORTO));
 | 
							set_or_def(F_CODSPMEZZO, ven_rec.get(CFV_CODSPMEZZO));
 | 
				
			||||||
		set(F_CODNOTESP1, ven_rec.get(CFV_CODNOTESP1));
 | 
							set_or_def(F_CODPORTO, ven_rec.get(CFV_CODPORTO));
 | 
				
			||||||
		set(F_CODNOTESP2, ven_rec.get(CFV_CODNOTESP2));
 | 
							set_or_def(F_CODNOTESP1, ven_rec.get(CFV_CODNOTESP1));
 | 
				
			||||||
		set(F_CODNOTE, ven_rec.get(CFV_CODNOTE));
 | 
							set_or_def(F_CODNOTESP2, ven_rec.get(CFV_CODNOTESP2));
 | 
				
			||||||
		set(F_CODVETT1, ven_rec.get(CFV_CODVETT1));
 | 
							set_or_def(F_CODNOTE, ven_rec.get(CFV_CODNOTE));
 | 
				
			||||||
		set(F_CODVETT2, ven_rec.get(CFV_CODVETT2));
 | 
							set_or_def(F_CODVETT1, ven_rec.get(CFV_CODVETT1));
 | 
				
			||||||
		set(F_CODVETT3, ven_rec.get(CFV_CODVETT3));
 | 
							set_or_def(F_CODVETT2, ven_rec.get(CFV_CODVETT2));
 | 
				
			||||||
		set(F_SPESEINC, ven_rec.get(CFV_PERCSPINC));	
 | 
							set_or_def(F_CODVETT3, ven_rec.get(CFV_CODVETT3));
 | 
				
			||||||
		set(F_ADDBOLLI, ven_rec.get(CFV_ADDBOLLI));
 | 
							set_or_def(F_SPESEINC, ven_rec.get(CFV_PERCSPINC));	
 | 
				
			||||||
		set(F_CATVEN, ven_rec.get(CFV_CATVEN));
 | 
							set_or_def(F_ADDBOLLI, ven_rec.get(CFV_ADDBOLLI));
 | 
				
			||||||
 | 
							set_or_def(F_CATVEN, ven_rec.get(CFV_CATVEN));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const int alleg = c.get_int(CLI_ALLEG);
 | 
					    const int alleg = c.get_int(CLI_ALLEG);
 | 
				
			||||||
    const bool ivadiff = alleg == 7 && ven_rec.get_bool(CFV_FATTSOSP);
 | 
					    const bool ivadiff = (alleg == 7) && ven_rec.get_bool(CFV_FATTSOSP);
 | 
				
			||||||
		set(F_LIQDIFF, ivadiff ? "X" : "");
 | 
							set(F_LIQDIFF, ivadiff ? "X" : "");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const TDate datadoc = doc().get(DOC_DATADOC);
 | 
					    const TDate datadoc = doc().get(DOC_DATADOC);
 | 
				
			||||||
@ -1357,7 +1371,7 @@ void TDocumento_mask::spese2mask()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void TDocumento_mask::reset_masks(const TString& tipo_doc)
 | 
					void TDocumento_mask::reset_masks(const TString& tipo_doc)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	static TString16 last_tipo_doc;
 | 
						static TString4 last_tipo_doc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (tipo_doc != last_tipo_doc)
 | 
						if (tipo_doc != last_tipo_doc)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@ -1835,10 +1849,10 @@ bool TDocumento_mask::ss_handler(TMask_field& f, KEY key)
 | 
				
			|||||||
		const TSheet_field& ss = (TSheet_field&)f;
 | 
							const TSheet_field& ss = (TSheet_field&)f;
 | 
				
			||||||
    TDocumento_mask& mask = (TDocumento_mask&)ss.mask();
 | 
					    TDocumento_mask& mask = (TDocumento_mask&)ss.mask();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const short cme = mask.cms_end();
 | 
					 | 
				
			||||||
    if (mask.id2pos(cme) > 0 && app().has_module(CAAUT) && mask.get(cme).empty())
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
    TConfig& ini = ca_config();
 | 
					    TConfig& ini = ca_config();
 | 
				
			||||||
 | 
					    const short cme = mask.cms_end();
 | 
				
			||||||
 | 
					    if (mask.id2pos(cme) > 0 && mask.get(cme).empty() && (ini.get_int("Authorizations") & 0x6))
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
      if (ini.get_bool("CmsRequired") || ini.get("FathFasi").full())
 | 
					      if (ini.get_bool("CmsRequired") || ini.get("FathFasi").full())
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        const int col = ss.cid2index(mask.cms_end_sh());
 | 
					        const int col = ss.cid2index(mask.cms_end_sh());
 | 
				
			||||||
@ -2331,20 +2345,19 @@ int TLista_elaborazioni::select(TString_array & result, const char * tipo_inizia
 | 
				
			|||||||
	for (TElaborazione* el = (TElaborazione*)_elab->get(); el != NULL; el = (TElaborazione*)_elab->get())
 | 
						for (TElaborazione* el = (TElaborazione*)_elab->get(); el != NULL; el = (TElaborazione*)_elab->get())
 | 
				
			||||||
	{						 
 | 
						{						 
 | 
				
			||||||
		bool ok = false;
 | 
							bool ok = false;
 | 
				
			||||||
		TString ti;
 | 
					 | 
				
			||||||
		if ((tipo_iniziale && *tipo_iniziale) && (stato_iniziale && *stato_iniziale))
 | 
							if ((tipo_iniziale && *tipo_iniziale) && (stato_iniziale && *stato_iniziale))
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
			for (int i = 0; !ok && i < TElaborazione::_max_tipi_doc_elab; i++)					
 | 
								for (int i = 0; !ok && i < TElaborazione::_max_tipi_doc_elab; i++)					
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				ti = el->tipo_iniziale(i);
 | 
					 | 
				
			||||||
				const char si = el->stato_iniziale(i);
 | 
									const char si = el->stato_iniziale(i);
 | 
				
			||||||
				ok |= ti == tipo_iniziale &&
 | 
									const TString& ti = el->tipo_iniziale(i);
 | 
				
			||||||
							si == *stato_iniziale;
 | 
									ok |= ti == tipo_iniziale && si == *stato_iniziale;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
		else 
 | 
							else 
 | 
				
			||||||
			ok = true;			
 | 
								ok = true;			
 | 
				
			||||||
		if ((tipo_finale && *tipo_finale) && (stato_finale && *stato_finale))																								 
 | 
							if ((tipo_finale && *tipo_finale) && (stato_finale && *stato_finale))																								 
 | 
				
			||||||
			ok &= el->tipo_finale() == tipo_finale &&
 | 
								ok &= el->tipo_finale() == tipo_finale &&	el->stato_finale() == stato_finale;
 | 
				
			||||||
						el->stato_finale() == stato_finale;
 | 
					 | 
				
			||||||
		if (ok)
 | 
							if (ok)
 | 
				
			||||||
			result.add(el->codice());
 | 
								result.add(el->codice());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -2352,10 +2365,10 @@ int TLista_elaborazioni::select(TString_array & result, const char * tipo_inizia
 | 
				
			|||||||
	return result.items();
 | 
						return result.items();
 | 
				
			||||||
} 
 | 
					} 
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
TElaborazione & TLista_elaborazioni::operator [](const char * key) const
 | 
					TElaborazione& TLista_elaborazioni::operator[](const char * key) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	((TLista_elaborazioni *)this)->read();
 | 
						((TLista_elaborazioni *)this)->read();
 | 
				
			||||||
	return (TElaborazione &) (*_elab)[key];
 | 
						return (TElaborazione&)(*_elab)[key];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TLista_elaborazioni::update()
 | 
					void TLista_elaborazioni::update()
 | 
				
			||||||
@ -2990,7 +3003,7 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
 | 
				
			|||||||
					set(F_TYPE, "");
 | 
										set(F_TYPE, "");
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			update_ndoc_filter(true);
 | 
								update_ndoc_filter(true);
 | 
				
			||||||
			const bool add_to_doc = o.get().not_empty();
 | 
								const bool add_to_doc = o.get().full();
 | 
				
			||||||
  		TElaborazione * e = curr_elab();
 | 
					  		TElaborazione * e = curr_elab();
 | 
				
			||||||
			const bool external = e != NULL && e->tipo() == _esterna;
 | 
								const bool external = e != NULL && e->tipo() == _esterna;
 | 
				
			||||||
      const bool is_search = o.get().empty() || field(F_CODCF_ELAB).empty() || external || add_to_doc;
 | 
					      const bool is_search = o.get().empty() || field(F_CODCF_ELAB).empty() || external || add_to_doc;
 | 
				
			||||||
@ -3175,22 +3188,24 @@ bool TElabora_mask::on_field_event(TOperable_field& o, TField_event e, long joll
 | 
				
			|||||||
int TElabora_mask::update_list()
 | 
					int TElabora_mask::update_list()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	TString_array elabs;
 | 
						TString_array elabs;
 | 
				
			||||||
	const TString4 tipo(_main->get(F_TIPODOC));
 | 
						const TString& tipo = _main->get(F_TIPODOC);
 | 
				
			||||||
	const TString4 stato(_main->get(F_STATO));
 | 
						const TString& stato = _main->get(F_STATO);
 | 
				
			||||||
	const TString4 tipo_elab(get(F_TIPODOC_ELAB));
 | 
						const TString& tipo_elab = get(F_TIPODOC_ELAB);
 | 
				
			||||||
	const TString4 stato_elab(get(F_STATODOC_ELAB));
 | 
						const TString& stato_elab = get(F_STATODOC_ELAB);
 | 
				
			||||||
	const bool from_elab = !get_bool(F_TYPE);	 
 | 
						const bool from_elab = !get_bool(F_TYPE);	 
 | 
				
			||||||
	int items = 0;
 | 
						int items = 0;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if (from_elab)
 | 
						if (from_elab)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		items = _elab.select(elabs, tipo, stato,"","") ;
 | 
							items = _elab.select(elabs, tipo, stato, "", "") ;
 | 
				
			||||||
		field(F_ANNO_ELAB).check_type(CHECK_REQUIRED);
 | 
							field(F_ANNO_ELAB).check_type(CHECK_REQUIRED);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		field(F_ANNO_ELAB).check_type(CHECK_NONE);
 | 
							field(F_ANNO_ELAB).check_type(CHECK_NONE);
 | 
				
			||||||
		items = _elab.select(elabs, tipo_elab, stato_elab, tipo, stato);
 | 
							items = _elab.select(elabs, tipo_elab, stato_elab, tipo, stato);
 | 
				
			||||||
 | 
					    if (items == 0)
 | 
				
			||||||
 | 
					      items = _elab.select(elabs, "", "", tipo, stato);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	TList_field & f = lfield(F_ELAB);
 | 
						TList_field & f = lfield(F_ELAB);
 | 
				
			||||||
@ -3218,7 +3233,7 @@ int TElabora_mask::update_list()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (codes != f.get_codes())
 | 
						if (codes != f.get_codes())
 | 
				
			||||||
		f.replace_items(codes, descrs);
 | 
							f.replace_items(codes, descrs);
 | 
				
			||||||
	const TElaborazione * e = curr_elab();
 | 
						const TElaborazione* e = curr_elab();
 | 
				
			||||||
	if (e != NULL && e->tipo() == _consegna_ordini)
 | 
						if (e != NULL && e->tipo() == _consegna_ordini)
 | 
				
			||||||
		show(-GRP_ART);
 | 
							show(-GRP_ART);
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
@ -3360,7 +3375,7 @@ bool TElabora_mask::elabora()
 | 
				
			|||||||
      // Toglie spunta ai documenti selezionati
 | 
					      // Toglie spunta ai documenti selezionati
 | 
				
			||||||
      _tree.toggle_all_nodes();
 | 
					      _tree.toggle_all_nodes();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		const TString8 num_in = e->codice_numerazione_iniziale();
 | 
							const TString4 num_in = e->codice_numerazione_iniziale();
 | 
				
			||||||
		set(F_CODNUM_ELAB, num_in);
 | 
							set(F_CODNUM_ELAB, num_in);
 | 
				
			||||||
		set(F_NDOC_ELAB, "");
 | 
							set(F_NDOC_ELAB, "");
 | 
				
			||||||
		set(F_NUMDOCRIF_ELAB, "");
 | 
							set(F_NUMDOCRIF_ELAB, "");
 | 
				
			||||||
@ -3382,8 +3397,8 @@ bool TElabora_mask::elabora()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
TElaborazione* TElabora_mask::curr_elab()
 | 
					TElaborazione* TElabora_mask::curr_elab()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	const TString8 cod_elab(get(F_ELAB));
 | 
						const TString& cod_elab = get(F_ELAB);
 | 
				
			||||||
	return cod_elab.not_empty() ? &_elab[cod_elab] : NULL;
 | 
						return cod_elab.full() ? &_elab[cod_elab] : NULL;
 | 
				
			||||||
}		 
 | 
					}		 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TElabora_mask::add_valuta_filter(TString& filter) const
 | 
					void TElabora_mask::add_valuta_filter(TString& filter) const
 | 
				
			||||||
@ -3437,7 +3452,7 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			set(F_UPDATE_HEADER, agg_test ? "X" : "");
 | 
								set(F_UPDATE_HEADER, agg_test ? "X" : "");
 | 
				
			||||||
			const TString8 num_in = e->codice_numerazione_iniziale(); 
 | 
								const TString4 num_in = e->codice_numerazione_iniziale(); 
 | 
				
			||||||
			if (elab_changed)
 | 
								if (elab_changed)
 | 
				
			||||||
			{ 
 | 
								{ 
 | 
				
			||||||
				const TString4 tipo_in(e->tipo_iniziale(0));
 | 
									const TString4 tipo_in(e->tipo_iniziale(0));
 | 
				
			||||||
@ -3445,7 +3460,7 @@ void TElabora_mask::update_ndoc_filter(bool is_tipo_elaborazione)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				set(F_CODNUM_ELAB, num_in, 0x2);
 | 
									set(F_CODNUM_ELAB, num_in, 0x2);
 | 
				
			||||||
				set(F_TIPODOC_ELAB , tipo_in, 0x2);
 | 
									set(F_TIPODOC_ELAB , tipo_in, 0x2);
 | 
				
			||||||
				TString8 si; si << stato_in;
 | 
									TString4 si; si << stato_in;
 | 
				
			||||||
				set(F_STATODOC_ELAB, si, 0x2);
 | 
									set(F_STATODOC_ELAB, si, 0x2);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
				// Azzero anno di elaborazione quando ho a che fare con degli ordini				
 | 
									// Azzero anno di elaborazione quando ho a che fare con degli ordini				
 | 
				
			||||||
 | 
				
			|||||||
@ -184,18 +184,17 @@ bool ora_hndl( TMask_field& field, KEY key )
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	if (field.to_check(key,true))
 | 
						if (field.to_check(key,true))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		TString8 ora;
 | 
					 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if (field.automagic() && field.empty())
 | 
							if (field.automagic() && field.empty())
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			struct tm* t = xvt_time_now();
 | 
								const struct tm* t = xvt_time_now();
 | 
				
			||||||
			ora.format("%02d%02d", t->tm_hour, t->tm_min);
 | 
					   		TString4 ora;	ora.format("%02d%02d", t->tm_hour, t->tm_min);
 | 
				
			||||||
      field.set(ora);
 | 
					      field.set(ora);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      TMask& m = field.mask();
 | 
					      TMask& m = field.mask();
 | 
				
			||||||
      const int pos_data = m.id2pos(field.dlg()) - 1;
 | 
					      const int pos_data = m.id2pos(field.dlg()) - 1;
 | 
				
			||||||
      TMask_field& dt = m.fld(pos_data);
 | 
					      TMask_field& dt = m.fld(pos_data);
 | 
				
			||||||
      if (dt.is_kind_of(CLASS_DATE_FIELD) && dt.automagic())
 | 
					      if (dt.automagic() && dt.is_kind_of(CLASS_DATE_FIELD))
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        const TDate oggi(TODAY);
 | 
					        const TDate oggi(TODAY);
 | 
				
			||||||
        dt.set(oggi.string());
 | 
					        dt.set(oggi.string());
 | 
				
			||||||
@ -203,8 +202,8 @@ bool ora_hndl( TMask_field& field, KEY key )
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			ora = field.get();
 | 
								const TString& ora = field.get();
 | 
				
			||||||
			if (ora.not_empty())
 | 
								if (ora.full())
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				if (!isdigit(ora[0]) ||	!isdigit(ora[1]) ||	!isdigit(ora[2]) ||
 | 
									if (!isdigit(ora[0]) ||	!isdigit(ora[1]) ||	!isdigit(ora[2]) ||
 | 
				
			||||||
						!isdigit(ora[3]) ||	atoi(ora.left(2)) > 23 || atoi(ora.mid(2)) > 59)
 | 
											!isdigit(ora[3]) ||	atoi(ora.left(2)) > 23 || atoi(ora.mid(2)) > 59)
 | 
				
			||||||
@ -944,7 +943,7 @@ static void search_price(TEdit_field& f, KEY key )
 | 
				
			|||||||
		nums =  mask.get(F_CODNUM);
 | 
							nums =  mask.get(F_CODNUM);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	TString4 first_num(nums.get(0));
 | 
						TString4 first_num(nums.get(0));
 | 
				
			||||||
	TString4 last_num(first_num);;
 | 
						TString4 last_num(first_num);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
  TString filter;
 | 
					  TString filter;
 | 
				
			||||||
	filter << "((CODNUM==\"" << first_num << "\")";
 | 
						filter << "((CODNUM==\"" << first_num << "\")";
 | 
				
			||||||
@ -1131,12 +1130,12 @@ static void search_price_article(TEdit_field& f, KEY key )
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	from.put(RDOC_CODART, codart);
 | 
						from.put(RDOC_CODART, codart);
 | 
				
			||||||
	from.put(RDOC_LIVELLO, livello);
 | 
						from.put(RDOC_LIVELLO, livello); // Non fa parte della chive 5
 | 
				
			||||||
	from.put(RDOC_CODNUM, first_num);
 | 
						from.put(RDOC_CODNUM, first_num);
 | 
				
			||||||
	from.put(RDOC_ANNO, first_anno);
 | 
						from.put(RDOC_ANNO, first_anno);
 | 
				
			||||||
	from.put(RDOC_PROVV, 'D');
 | 
						from.put(RDOC_PROVV, 'D');
 | 
				
			||||||
	to.put(RDOC_CODART, codart);
 | 
						to.put(RDOC_CODART, codart);
 | 
				
			||||||
	to.put(RDOC_LIVELLO, livello);
 | 
						to.put(RDOC_LIVELLO, livello);  // Non fa parte della chive 5
 | 
				
			||||||
	to.put(RDOC_CODNUM, last_num);
 | 
						to.put(RDOC_CODNUM, last_num);
 | 
				
			||||||
	to.put(RDOC_ANNO, last_anno);
 | 
						to.put(RDOC_ANNO, last_anno);
 | 
				
			||||||
	to.put(RDOC_PROVV, 'D');
 | 
						to.put(RDOC_PROVV, 'D');
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user