Migliorat gestione descrizioni su due righe

git-svn-id: svn://10.65.10.50/branches/R_10_00@22740 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2012-10-26 08:31:41 +00:00
parent aaeeb54314
commit 02a750c7b1

View File

@ -726,7 +726,7 @@ bool TRiba_form::validate(TForm_item &cf, TToken_string &s)
{ {
if (condition) if (condition)
{ {
real importo(dati.get(2)); const real importo(dati.get(2));
cf.set(importo.string()); cf.set(importo.string());
} }
} }
@ -1213,17 +1213,19 @@ void TRiba_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TStr
else else
{ {
TToken_string dati; effetto.altridati_fatt(num, dati); TToken_string dati; effetto.altridati_fatt(num, dati);
int elem = dati.items();
TString16 str; const int elem = dati.items();
for (int i = 0; i < elem; i+=3) for (int i = 0; i < elem; i += 3)
{ {
if (i!=0) if (i!=0)
descfatt << "/"; descfatt << "/";
str = dati.get(i); str.trim(); // codnum TString16 str = dati.get(i); str.trim(); // codnum
if (str.not_empty()) descfatt << str << ' '; if (str.full())
descfatt << str << ' ';
str = dati.get(); str.trim(); // numdoc str = dati.get(); str.trim(); // numdoc
if (str.not_empty()) descfatt << str; if (str.full())
descfatt << str;
str = dati.get(); // anno (2 cifre) str = dati.get(); // anno (2 cifre)
str.trim(); str.trim();
@ -1234,32 +1236,31 @@ void TRiba_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TStr
if (main_app().has_module(CUAUT)) if (main_app().has_module(CUAUT))
{ {
const TString &cup = effetto.get(EFF_CUP); const TString &cup = effetto.get(EFF_CUP);
if (cup.full()) if (cup.full())
descfatt << " CUP: " << cup; descfatt << " CUP:" << cup;
else
{
const TString &cig = effetto.get(EFF_CIG);
if (cig.full()) const TString &cig = effetto.get(EFF_CIG);
descfatt << " CIG: " << cig; if (cig.full())
} descfatt << " CIG:" << cig;
} }
const int l = descfatt.len(); const TFixed_string in = s.get();
TString in(s.get());
if (in[0]=='!') if (in[0]=='!')
{ {
in.ltrim(1); TParagraph_string p(descfatt, 40);
if (in == "1") // Provo a fare una spezzatura "leggibile" in due righe
if (p.items() <= 2)
{ {
valore = descfatt.left(40); valore = p.get(in[1]-'1');
valore.trim();
} }
if (in == "2") else
{ {
valore = descfatt.mid(40, l); // Spezzatura brutale a 40 caratteri
valore.trim(); if (in[1] == '1')
valore = descfatt.left(40);
else
valore = descfatt.mid(40);
} }
valore.trim();
} }
} }
else if (code == "_IMPORTO") else if (code == "_IMPORTO")
@ -1269,7 +1270,7 @@ void TRiba_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TStr
// dove: <macro> è uno delle macro seguenti: // dove: <macro> è uno delle macro seguenti:
// "!ADD" aggiunge l'importo dell'effetto corrente al totale // "!ADD" aggiunge l'importo dell'effetto corrente al totale
// "!TOT" emette il totale // "!TOT" emette il totale
const TString in(s.get()); const TFixed_string in = s.get();
CHECK(in[0]=='!',"Macro _IMPORTO senza carattere '!'"); CHECK(in[0]=='!',"Macro _IMPORTO senza carattere '!'");
if (in=="!ADD") if (in=="!ADD")
{ {
@ -1283,7 +1284,7 @@ void TRiba_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TStr
} }
else if (in=="!TOT") else if (in=="!TOT")
{ {
const real& importo = tot_importi(); const real importo = tot_importi();
valore = importo.string("##############@"); valore = importo.string("##############@");
set_tot_importi(ZERO); set_tot_importi(ZERO);
} }
@ -1292,8 +1293,7 @@ void TRiba_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TStr
} }
else if (code == "_CODSIA") else if (code == "_CODSIA")
{ {
TConfig cnf(CONFIG_DITTA, "ef"); valore = ini_get_string(CONFIG_DITTA, "ef", "CODSIA");
valore = cnf.get("CODSIA");
} }
else if (code == "_CODMON") else if (code == "_CODMON")
{ {