Patch level : 2.0 nopatch
Files correlati : Ricompilazione Demo : [ ] Commento : Tolta vecchia roba commentata git-svn-id: svn://10.65.10.50/trunk@11040 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									cb3183ac5c
								
							
						
					
					
						commit
						cf2a2bb9f8
					
				
							
								
								
									
										11
									
								
								ve/velib.h
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								ve/velib.h
									
									
									
									
									
								
							@ -71,13 +71,7 @@ class TCache_articoli;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool scontoexpr2perc(const char * exp, bool signal , TString & goodexp, real & val_perc );
 | 
					bool scontoexpr2perc(const char * exp, bool signal , TString & goodexp, real & val_perc );
 | 
				
			||||||
// velib01
 | 
					 | 
				
			||||||
/*real lordo2netto(real& lordo, const TString& codiva, int ndec);
 | 
					 | 
				
			||||||
real netto2lordo(const real& netto, const TString& codiva, int ndec);
 | 
					 | 
				
			||||||
real lordo2netto(real& lordo, const real& iva, int ndec);
 | 
					 | 
				
			||||||
real netto2lordo(const real& netto, const real& iva, int ndec); */
 | 
					 | 
				
			||||||
real prezzo_scontato(const real& prezzo, const char * sconto);
 | 
					real prezzo_scontato(const real& prezzo, const char * sconto);
 | 
				
			||||||
/*real iva(real imponibile, const TIVA & codiva,int ndec);   */
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool ora_hndl(TMask_field& field, KEY key);
 | 
					bool ora_hndl(TMask_field& field, KEY key);
 | 
				
			||||||
bool totdoc_hndl(TMask_field& field, KEY key);
 | 
					bool totdoc_hndl(TMask_field& field, KEY key);
 | 
				
			||||||
@ -382,8 +376,7 @@ class TTipo_riga_documento : public TRectype  // velib02
 | 
				
			|||||||
  TString16 _field_provv;
 | 
					  TString16 _field_provv;
 | 
				
			||||||
  TString16 _field_qta, _field_qtaevasa; // Veri campi Quantità e Quantità Evasa
 | 
					  TString16 _field_qta, _field_qtaevasa; // Veri campi Quantità e Quantità Evasa
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  int _decrp;
 | 
					  int _decrp, _incrp;
 | 
				
			||||||
  int _incrp;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
  void read_formule();
 | 
					  void read_formule();
 | 
				
			||||||
@ -422,7 +415,7 @@ public:
 | 
				
			|||||||
  int read(const char* tiporig);
 | 
					  int read(const char* tiporig);
 | 
				
			||||||
  TTipo_riga_documento(const char* tiporig = NULL);
 | 
					  TTipo_riga_documento(const char* tiporig = NULL);
 | 
				
			||||||
  TTipo_riga_documento(const TRectype& rec);
 | 
					  TTipo_riga_documento(const TRectype& rec);
 | 
				
			||||||
  virtual ~TTipo_riga_documento();
 | 
					  virtual ~TTipo_riga_documento() { }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										129
									
								
								ve/velib01.cpp
									
									
									
									
									
								
							
							
						
						
									
										129
									
								
								ve/velib01.cpp
									
									
									
									
									
								
							@ -1,5 +1,3 @@
 | 
				
			|||||||
#include <tabutil.h>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include "velib.h"
 | 
					#include "velib.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/////////////////////////////////////////////////////////////
 | 
					/////////////////////////////////////////////////////////////
 | 
				
			||||||
@ -46,17 +44,20 @@ int TCodice_numerazione::read(const char* codnum)
 | 
				
			|||||||
// TSpesa_prest
 | 
					// TSpesa_prest
 | 
				
			||||||
/////////////////////////////////////////////////////////////
 | 
					/////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
HIDDEN const real CENTO(100.0); // costante per evitare la chiamata dei costruttori real tante volte
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TSpesa_prest::TSpesa_prest(const char* codice, char tipo)
 | 
					TSpesa_prest::TSpesa_prest(const char* codice, char tipo)
 | 
				
			||||||
       : TRectype(LF_TAB)
 | 
					       : TRectype(LF_TAB)
 | 
				
			||||||
{    
 | 
					{    
 | 
				
			||||||
  const bool spesa = tipo == RIGA_SPESEDOC;
 | 
					  const bool spesa = tipo == RIGA_SPESEDOC;
 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  settab(spesa ? "SPP" : "PRS");
 | 
					  settab(spesa ? "SPP" : "PRS");
 | 
				
			||||||
  if (codice && *codice)
 | 
					  if (codice && *codice)
 | 
				
			||||||
    if (read(codice) != NOERR)
 | 
					  {
 | 
				
			||||||
 | 
					    const int err = read(codice);
 | 
				
			||||||
 | 
					#ifdef DBG
 | 
				
			||||||
 | 
					    if (err != NOERR)
 | 
				
			||||||
       error_box(spesa ? "Spesa %s assente" : "Prestazione %s assente", codice);
 | 
					       error_box(spesa ? "Spesa %s assente" : "Prestazione %s assente", codice);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TSpesa_prest::TSpesa_prest(const TRectype& rec)
 | 
					TSpesa_prest::TSpesa_prest(const TRectype& rec)
 | 
				
			||||||
@ -66,107 +67,11 @@ TSpesa_prest::TSpesa_prest(const TRectype& rec)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int TSpesa_prest::read(const char* codice)
 | 
					int TSpesa_prest::read(const char* codice)
 | 
				
			||||||
{                      
 | 
					{                      
 | 
				
			||||||
  zero();             
 | 
					  const TString8 cod = get("COD");
 | 
				
			||||||
  TTable t(get("COD"));
 | 
					  *this = cache().get(cod, codice);
 | 
				
			||||||
  put("CODTAB", codice);
 | 
					  return empty() ? _iskeynotfound : NOERR;
 | 
				
			||||||
  TRectype r(*this);
 | 
					 | 
				
			||||||
  int err = TRectype::read(t);
 | 
					 | 
				
			||||||
  if (err != NOERR)
 | 
					 | 
				
			||||||
    *this = r;
 | 
					 | 
				
			||||||
  return err;  
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*TIVA::TIVA(const char* codice)
 | 
					 | 
				
			||||||
       : TRectype(LF_TABCOM)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  settab("IVA");
 | 
					 | 
				
			||||||
  if (codice && *codice)
 | 
					 | 
				
			||||||
    read(codice);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TIVA::TIVA(const TRectype& rec)
 | 
					 | 
				
			||||||
      : TRectype(rec)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int TIVA::read(const char* codice)
 | 
					 | 
				
			||||||
{                                   
 | 
					 | 
				
			||||||
  TTable t("%IVA");
 | 
					 | 
				
			||||||
  put("CODTAB", codice);
 | 
					 | 
				
			||||||
  int err = TRectype::read(t);
 | 
					 | 
				
			||||||
  if (err != NOERR)
 | 
					 | 
				
			||||||
    yesnofatal_box("Codice IVA assente : %s", codice);
 | 
					 | 
				
			||||||
  return err;  
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
///////////////////////////////////////////////////////////
 | 
					 | 
				
			||||||
// Funzioni per il calcolo dei prezzi netti/lordi
 | 
					 | 
				
			||||||
///////////////////////////////////////////////////////////
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 real lordo2netto(real& lordo, const TString& codiva, int ndec)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  TTable tabiva("%IVA");
 | 
					 | 
				
			||||||
  real aliquota = 0.0;
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  tabiva.put("CODTAB", codiva);
 | 
					 | 
				
			||||||
  if (tabiva.read() == NOERR) aliquota = tabiva.get_real("R0");
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  return lordo2netto(lordo,aliquota, ndec);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
real netto2lordo(const real& netto, const TString& codiva, int ndec)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  TTable tabiva("%IVA");
 | 
					 | 
				
			||||||
  real aliquota = 0.0;
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  tabiva.put("CODTAB", codiva);
 | 
					 | 
				
			||||||
  if (tabiva.read() == NOERR) aliquota = tabiva.get_real("R0");
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  return netto2lordo(netto,aliquota, ndec);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
real lordo2netto(real& lordo, const real& iva, int ndec)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  real netto;
 | 
					 | 
				
			||||||
  real imposta = 0.0;
 | 
					 | 
				
			||||||
  real imposta_rec = 0.0;
 | 
					 | 
				
			||||||
  if (!iva.is_zero())
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    imposta = (lordo * iva) / (iva + 100.0); // Calcola l'imposta...
 | 
					 | 
				
			||||||
    if (imposta < ZERO)
 | 
					 | 
				
			||||||
      imposta.floor(ndec);
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
      imposta.ceil(ndec);
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  netto = lordo - imposta; // Questo e' l'importo netto
 | 
					 | 
				
			||||||
  imposta_rec = (netto * iva) / 100.0; // Ricalcola l'imposta con il nuovo imponibile
 | 
					 | 
				
			||||||
  if (imposta_rec < ZERO)
 | 
					 | 
				
			||||||
    imposta_rec.floor(ndec);
 | 
					 | 
				
			||||||
  else
 | 
					 | 
				
			||||||
    imposta_rec.ceil(ndec);
 | 
					 | 
				
			||||||
  if (imposta != imposta_rec) // In questo caso corregge l'importo lordo 
 | 
					 | 
				
			||||||
    lordo = netto + imposta_rec;
 | 
					 | 
				
			||||||
  return netto;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
real netto2lordo(const real& netto, const real& iva, int ndec)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
  real imposta;
 | 
					 | 
				
			||||||
  if (!iva.is_zero())
 | 
					 | 
				
			||||||
  {
 | 
					 | 
				
			||||||
    imposta = (netto * iva) / 100.0; // Calcola l'imposta
 | 
					 | 
				
			||||||
    if (ndec < 20)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
      if(imposta < ZERO)
 | 
					 | 
				
			||||||
        imposta.floor(ndec);
 | 
					 | 
				
			||||||
      else
 | 
					 | 
				
			||||||
        imposta.ceil(ndec);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
  const real lordo = imposta + netto; // prezzo lordo
 | 
					 | 
				
			||||||
  return lordo;
 | 
					 | 
				
			||||||
}  */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
bool scontoexpr2perc(const char * exp, bool signal , TString & goodexp, real & val_perc )
 | 
					bool scontoexpr2perc(const char * exp, bool signal , TString & goodexp, real & val_perc )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  bool valid = TRUE;
 | 
					  bool valid = TRUE;
 | 
				
			||||||
@ -272,17 +177,3 @@ real prezzo_scontato(const real& prezzo, const char * sconto)
 | 
				
			|||||||
  return scontato;
 | 
					  return scontato;
 | 
				
			||||||
} 
 | 
					} 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* real iva(real imponibile, const TIVA & iva,int ndec)   
 | 
					 | 
				
			||||||
{            
 | 
					 | 
				
			||||||
   real val = imponibile * iva.aliquota() / 100.0;
 | 
					 | 
				
			||||||
                  
 | 
					 | 
				
			||||||
   if (ndec < 20)
 | 
					 | 
				
			||||||
   {               
 | 
					 | 
				
			||||||
     if (val < ZERO)
 | 
					 | 
				
			||||||
       val.floor(ndec);
 | 
					 | 
				
			||||||
     else               
 | 
					 | 
				
			||||||
       val.ceil(ndec);
 | 
					 | 
				
			||||||
   }
 | 
					 | 
				
			||||||
   return val;
 | 
					 | 
				
			||||||
}  */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,3 @@
 | 
				
			|||||||
#include <currency.h>
 | 
					 | 
				
			||||||
#include <prefix.h>
 | 
					 | 
				
			||||||
#include <tabutil.h>
 | 
					#include <tabutil.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "velib.h"
 | 
					#include "velib.h"
 | 
				
			||||||
@ -65,20 +63,14 @@ TTipo_riga_documento::TTipo_riga_documento(const TRectype& rec)
 | 
				
			|||||||
  read_formule();
 | 
					  read_formule();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TTipo_riga_documento::~TTipo_riga_documento()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int TTipo_riga_documento::read(const char* tiporig)
 | 
					int TTipo_riga_documento::read(const char* tiporig)
 | 
				
			||||||
{                                   
 | 
					{                                   
 | 
				
			||||||
  TTable t("%TRI");
 | 
					  *this = cache().get("%TRI", tiporig);
 | 
				
			||||||
  put("CODTAB", tiporig);
 | 
					  if (empty())
 | 
				
			||||||
  int err = TRectype::read(t);
 | 
					 | 
				
			||||||
  if (err == NOERR)
 | 
					 | 
				
			||||||
    read_formule();
 | 
					 | 
				
			||||||
  else
 | 
					 | 
				
			||||||
    yesnofatal_box("Tipo riga documento errato: %s", tiporig);
 | 
					    yesnofatal_box("Tipo riga documento errato: %s", tiporig);
 | 
				
			||||||
  return err;  
 | 
					  else
 | 
				
			||||||
 | 
					    read_formule();
 | 
				
			||||||
 | 
					  return NOERR;  
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TTipo_riga_documento::add_formula_if_needed(TConfig& profile, TString& variable,
 | 
					void TTipo_riga_documento::add_formula_if_needed(TConfig& profile, TString& variable,
 | 
				
			||||||
@ -505,13 +497,13 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
 | 
				
			|||||||
      importo = prezzo(scontato, doc_al_lordo ? TRUE : lordo, ndec);
 | 
					      importo = prezzo(scontato, doc_al_lordo ? TRUE : lordo, ndec);
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case _percentuale: 
 | 
					    case _percentuale: 
 | 
				
			||||||
        importo = r1 * get_real(RDOC_QTA) / 100;
 | 
					        importo = r1 * get_real(RDOC_QTA) / CENTO;
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case _scontoimp:
 | 
					    case _scontoimp:
 | 
				
			||||||
      importo = -prezzo(FALSE, doc_al_lordo ? TRUE : lordo, ndec);
 | 
					      importo = -prezzo(FALSE, doc_al_lordo ? TRUE : lordo, ndec);
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
    case _scontoperc:     
 | 
					    case _scontoperc:     
 | 
				
			||||||
      importo = doc().basesconto() * (r1 - 1.0);
 | 
					      importo = doc().basesconto() * (r1 - UNO);
 | 
				
			||||||
     break;                  
 | 
					     break;                  
 | 
				
			||||||
    default:
 | 
					    default:
 | 
				
			||||||
      break;
 | 
					      break;
 | 
				
			||||||
@ -594,7 +586,7 @@ real TRiga_documento::provvigione(int ndec) const
 | 
				
			|||||||
        val *= netto_testa;
 | 
					        val *= netto_testa;
 | 
				
			||||||
    } 
 | 
					    } 
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    val *= get_real(RDOC_PERCPROV) / 100.0; 
 | 
					    val *= get_real(RDOC_PERCPROV) / CENTO; 
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  val.round(ndec);
 | 
					  val.round(ndec);
 | 
				
			||||||
  return val;
 | 
					  return val;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user