diff --git a/cg/cg1600.cpp b/cg/cg1600.cpp index 386c80039..ebd2a1241 100755 --- a/cg/cg1600.cpp +++ b/cg/cg1600.cpp @@ -2170,8 +2170,12 @@ void TStampa_IVdirettiva::stampa_risultato_prima_delle_imposte() _i++; } - set_row (_i,"@4g%s@81g%r", TR("Risultato prima delle imposte"), &_totale_economico); - _totale_economico += _sale; // Guy was here 18/02./2004: Altrimenti ignora la prima imposta + // set_row (_i,"@4g%s@81g%r", TR("Risultato prima delle imposte"), &_totale_economico); + // _totale_economico += _sale; // Guy was here 18/02/2004: Altrimenti ignora la prima imposta + + // Guy was here 05/03/2004: Altrimenti ignora la prima imposta + const real te = _totale_economico-_sale; + set_row (_i,"@4g%s@81g%r", TR("Risultato prima delle imposte"), &te); if (raff) set_row (_i,"@111g%r", &_totale_economico_raf); diff --git a/cg/cg6902.cpp b/cg/cg6902.cpp index 74ae47a4f..dd5eaa3a2 100755 --- a/cg/cg6902.cpp +++ b/cg/cg6902.cpp @@ -2046,8 +2046,7 @@ void TInv_cont::negPC2negAS(TString& numero) numero.trim(); numero.ltrim(1); // Considero il numero senza il segno - - int len = numero.len(); - int cifra = atoi(numero.mid(len -1 ,1)); // Considero l'ultima cifra + const int cifra = atoi(numero.right(1)); // Considero l'ultima cifra char carattere = _tabella[cifra]; @@ -2063,10 +2062,13 @@ void TInv_cont::dec2integer(real& val, long dec) void TInv_cont::write_AS_imp(const real& importo, TString& record, int pos, int len) { - const int dec = TCurrency::get_firm_dec(); TString16 numero; - numero = importo.string(0, dec); - numero.strip("."); + + // const int dec = TCurrency::get_firm_dec(); + // numero = importo.string(0, dec); + const TCurrency imp(importo); // Proviamo se e' meglio + numero = imp.string(true); + numero.strip(".,"); if (numero[0] == '-') negPC2negAS(numero); diff --git a/include/real.cpp b/include/real.cpp index 97baf573a..946399fce 100755 --- a/include/real.cpp +++ b/include/real.cpp @@ -558,20 +558,20 @@ const char *real::string ( else __tmp_real.trail(); - char * s = get_tmp_string().get_buffer(80); - dtoa (s, __tmp_real.ptr ()); - int lun = strlen (s); + TString& tmp = get_tmp_string(32); + char* s = tmp.get_buffer(); + dtoa(s, __tmp_real.ptr()); - - if (lun < len) + const int rd = __tmp_real._dec.ls.lid; // real decimals + if (dec != UNDEFINED && dec > 0 && rd < dec) { - const int delta = len - lun; - for (int i = lun; i >= 0; i--) - s[i + delta] = s[i]; - for (i = 0; i < delta; i++) - s[i] = pad; + if (rd == 0) + tmp << '.'; + for (int d = rd; d < dec; d++) + tmp << '0'; } - + if (len > tmp.len()) + tmp.right_just(len, pad); return s; } diff --git a/include/real.h b/include/real.h index 3268d799a..6bf7512e5 100755 --- a/include/real.h +++ b/include/real.h @@ -55,7 +55,7 @@ public: static const char* ita2eng(const char* s); // @cmember Controlla se si tratta di un numero reale (TRUE se vero) static bool is_real(const char* n); - // @cmember Controlla se si tratta di un numero naturale intero (TRUE se vero) + // @cmember Controlla se si tratta di un numero naturale (TRUE se vero) static bool is_natural(const char* n); // @cmember Controlla se si tratta di uno zero (TRUE se vero) static bool is_null(const char* n);