From 02a750c7b1b69db242b2573a4c1dd839ff37f11e Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 26 Oct 2012 08:31:41 +0000 Subject: [PATCH] Migliorat gestione descrizioni su due righe git-svn-id: svn://10.65.10.50/branches/R_10_00@22740 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ef/ef0500.cpp | 56 +++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/ef/ef0500.cpp b/ef/ef0500.cpp index 5f070535d..6d2257d28 100755 --- a/ef/ef0500.cpp +++ b/ef/ef0500.cpp @@ -726,7 +726,7 @@ bool TRiba_form::validate(TForm_item &cf, TToken_string &s) { if (condition) { - real importo(dati.get(2)); + const real importo(dati.get(2)); cf.set(importo.string()); } } @@ -1213,17 +1213,19 @@ void TRiba_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TStr else { TToken_string dati; effetto.altridati_fatt(num, dati); - int elem = dati.items(); - TString16 str; - for (int i = 0; i < elem; i+=3) + + const int elem = dati.items(); + for (int i = 0; i < elem; i += 3) { if (i!=0) descfatt << "/"; - str = dati.get(i); str.trim(); // codnum - if (str.not_empty()) descfatt << str << ' '; + TString16 str = dati.get(i); str.trim(); // codnum + if (str.full()) + descfatt << str << ' '; str = dati.get(); str.trim(); // numdoc - if (str.not_empty()) descfatt << str; + if (str.full()) + descfatt << str; str = dati.get(); // anno (2 cifre) 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)) { const TString &cup = effetto.get(EFF_CUP); - if (cup.full()) - descfatt << " CUP: " << cup; - else - { - const TString &cig = effetto.get(EFF_CIG); + descfatt << " CUP:" << cup; - if (cig.full()) - descfatt << " CIG: " << cig; - } + const TString &cig = effetto.get(EFF_CIG); + if (cig.full()) + descfatt << " CIG:" << cig; } - const int l = descfatt.len(); - TString in(s.get()); + const TFixed_string in = s.get(); if (in[0]=='!') { - in.ltrim(1); - if (in == "1") + TParagraph_string p(descfatt, 40); + // Provo a fare una spezzatura "leggibile" in due righe + if (p.items() <= 2) { - valore = descfatt.left(40); - valore.trim(); + valore = p.get(in[1]-'1'); } - if (in == "2") + else { - valore = descfatt.mid(40, l); - valore.trim(); + // Spezzatura brutale a 40 caratteri + if (in[1] == '1') + valore = descfatt.left(40); + else + valore = descfatt.mid(40); } + valore.trim(); } } else if (code == "_IMPORTO") @@ -1269,7 +1270,7 @@ void TRiba_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TStr // dove: è uno delle macro seguenti: // "!ADD" aggiunge l'importo dell'effetto corrente al totale // "!TOT" emette il totale - const TString in(s.get()); + const TFixed_string in = s.get(); CHECK(in[0]=='!',"Macro _IMPORTO senza carattere '!'"); if (in=="!ADD") { @@ -1283,7 +1284,7 @@ void TRiba_file::validate(TCursor& cur,TRecord_text &rec, TToken_string &s, TStr } else if (in=="!TOT") { - const real& importo = tot_importi(); + const real importo = tot_importi(); valore = importo.string("##############@"); 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") { - TConfig cnf(CONFIG_DITTA, "ef"); - valore = cnf.get("CODSIA"); + valore = ini_get_string(CONFIG_DITTA, "ef", "CODSIA"); } else if (code == "_CODMON") {