Migliorata descrizione conti in stampa mastrini (ora usa TBill)

git-svn-id: svn://10.65.10.50/branches/R_10_00@22801 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2013-02-07 14:28:26 +00:00
parent 2f0306ab1d
commit d6c37f2f14
4 changed files with 47 additions and 33 deletions

View File

@ -2212,6 +2212,8 @@ void TStampa_bilanci::riempi_record(char t,int g,int c,long s,
void TStampa_bilanci::leggi_clifo(const TArray& gccf) void TStampa_bilanci::leggi_clifo(const TArray& gccf)
{ {
TEsercizi_contabili ese;
TSaldo sld; TSaldo sld;
TLocalisamfile saldi(LF_SALDI); TLocalisamfile saldi(LF_SALDI);
// int g = 0, c=0; // int g = 0, c=0;
@ -2261,7 +2263,6 @@ void TStampa_bilanci::leggi_clifo(const TArray& gccf)
ragsoc << ' ' << nome; ragsoc << ' ' << nome;
} }
TEsercizi_contabili ese;
int aprec = ese.pred(anno); int aprec = ese.pred(anno);
saldi.zero(); saldi.zero();
saldi.put(SLD_ANNOES, anno); // W96SALDI del 05-06-96 saldi.put(SLD_ANNOES, anno); // W96SALDI del 05-06-96
@ -3578,15 +3579,18 @@ TDate TStampa_bilanci::UltimaData(int g, int c, long s, int anno)
// Non ho potuto usare quella di TConto!!! Chiedere a me! // Non ho potuto usare quella di TConto!!! Chiedere a me!
// Guy: E tu chi sei? // Guy: E tu chi sei?
const char* TStampa_bilanci::DescrizioneConto(int g, int c, long s, char tipocf) const char* TStampa_bilanci::DescrizioneConto(int g, int c, long s, char tipocf)
{ {
static TString80 ragsoc; /*
static TString80 ragsoc;
const char* desc = NULL; const char* desc = NULL;
TString80 key; key << g; TString80 key; key << g;
if (c != 0) if (c != 0)
{
key << "|" << c ; key << "|" << c ;
if (s != 0) if (s != 0)
key << "|" << s; key << "|" << s;
}
const TRectype & pconti = cache().get(LF_PCON, key); const TRectype & pconti = cache().get(LF_PCON, key);
if (!pconti.empty()) if (!pconti.empty())
_tmp = pconti.get(PCN_DESCR); _tmp = pconti.get(PCN_DESCR);
@ -3597,11 +3601,11 @@ const char* TStampa_bilanci::DescrizioneConto(int g, int c, long s, char tipocf)
if (!clifo.empty()) if (!clifo.empty())
{ {
char tipoa = clifo.get_char("TIPOAPER"); char tipoa = clifo.get_char(CLI_TIPOAPER);
if (tipoa == 'F') //persona fisica if (tipoa == 'F') //persona fisica
{ {
TString80 cognome, nome; TString80 cognome, nome;
ragsoc = clifo.get("RAGSOC"); ragsoc = clifo.get(CLI_RAGSOC);
cognome = ragsoc.mid(0,30); cognome = ragsoc.mid(0,30);
nome = ragsoc.mid(30,20); nome = ragsoc.mid(30,20);
cognome.trim(); nome.trim(); cognome.trim(); nome.trim();
@ -3610,7 +3614,7 @@ const char* TStampa_bilanci::DescrizioneConto(int g, int c, long s, char tipocf)
desc = ragsoc; desc = ragsoc;
} }
else else
desc = clifo.get("RAGSOC"); desc = clifo.get(CLI_RAGSOC);
_tmp = desc; _tmp = desc;
} }
else else
@ -3618,7 +3622,10 @@ const char* TStampa_bilanci::DescrizioneConto(int g, int c, long s, char tipocf)
} }
return _tmp; return _tmp;
*/
const TBill bill(g, c, s, tipocf);
_tmp = bill.descrizione();
return _tmp;
} }
bool TStampa_bilanci::user_create() bool TStampa_bilanci::user_create()

View File

@ -84,11 +84,7 @@ const char* TCausale::desc_agg(int num) const
if (rec != NULL) if (rec != NULL)
{ {
const TString& cod = rec->get(RCA_CODDESC); const TString& cod = rec->get(RCA_CODDESC);
if (cod.not_empty()) deag = cache().get("%DPN", cod, "S0");
{
const TRectype& da = cache().get("%DPN", cod);
deag = da.get("S0");
}
} }
return deag; return deag;

View File

@ -1,10 +1,8 @@
#include "cg3.h" #include "cg3.h"
#include "cg3200.h" #include "cg3200.h"
#include "cglib01.h"
#include "cglib02.h" #include "cglib02.h"
#include "cglib03.h" #include "cglib03.h"
#include <modaut.h>
#include <msksheet.h> #include <msksheet.h>
#include <printapp.h> #include <printapp.h>
#include <utility.h> #include <utility.h>
@ -19,7 +17,6 @@
#include <nditte.h> #include <nditte.h>
#include <unloc.h> #include <unloc.h>
class TMastrini_record : public TRectype class TMastrini_record : public TRectype
{ {
TBill _bill; TBill _bill;
@ -2501,10 +2498,8 @@ void TMastrini_application::ricerca_dati_ditta()
_ragsoc = nditte.get(NDT_RAGSOC); _ragsoc = nditte.get(NDT_RAGSOC);
TString16 key; TString16 key;
key.format("%ld|1", app); key.format("%ld|1", app);
const TRectype& unloc = cache().get(LF_UNLOC, key);
const TRectype & unloc = cache().get(LF_UNLOC, key);
_indulc= unloc.get(ULC_INDULC); _indulc= unloc.get(ULC_INDULC);
_civulc= unloc.get(ULC_CIVULC); _civulc= unloc.get(ULC_CIVULC);

View File

@ -330,21 +330,20 @@ const char* iva2name(TipoIVA iva)
const TString& cap2comune(const TString& cap, const TString& denom) const TString& cap2comune(const TString& cap, const TString& denom)
{ {
if (cap.len() == 5 && denom.full()) TString80 up_denom = denom;
up_denom.upper();
TString4 codone;
if (cap.len() == 5 && up_denom.full())
{ {
TString8 cappone = cap; TString8 cappone = cap;
if (cappone[2] == '1') //e' un capoluogo di provincia if (cappone[2] == '1') //e' un capoluogo di provincia
cappone.overwrite("00", 3, 2); cappone.overwrite("00", 3, 2);
TString80 up_denom = denom;
up_denom.upper();
TRelation relcom(LF_COMUNI); TRelation relcom(LF_COMUNI);
TRectype& comrec = relcom.curr(); TRectype& comrec = relcom.curr();
comrec.put(COM_CAPCOM, cappone); comrec.put(COM_CAPCOM, cappone);
TString4 codone;
TCursor comuni (&relcom, "", 3, &comrec, &comrec); TCursor comuni (&relcom, "", 3, &comrec, &comrec);
const TRecnotype items = comuni.items(); const TRecnotype items = comuni.items();
comuni.freeze(); comuni.freeze();
@ -360,20 +359,37 @@ const TString& cap2comune(const TString& cap, const TString& denom)
cmp = fc; cmp = fc;
} }
} }
}
if (codone.full()) if (codone.blank() && denom.full())
return get_tmp_string() = codone;
} else
if (cap.blank() && denom.full())
{ {
TLocalisamfile comuni(LF_COMUNI); TLocalisamfile comuni(LF_COMUNI);
comuni.setkey(2); comuni.setkey(2);
comuni.put(COM_DENCOM, denom); comuni.put(COM_DENCOM, denom);
if (comuni.read() == NOERR) if (comuni.read() == NOERR)
return comuni.get(COM_COM); codone = comuni.get(COM_COM);
else
{
double cmp = 0.9;
comuni.zero();
const TString4 pref = up_denom.left(4);
comuni.put(COM_DENCOM, pref);
for (int err = comuni.read(_isgteq); err == NOERR; err = comuni.next())
{
TString80 denominazione = comuni.get(COM_DENCOM);
denominazione.upper();
if (!denominazione.starts_with(pref))
break;
const double fc = xvt_str_fuzzy_compare (up_denom, denominazione);
if (fc > cmp)
{
cmp = fc;
codone = comuni.get(COM_COM);
}
}
}
} }
return EMPTY_STRING; return codone.full() ? (get_tmp_string() = codone) : EMPTY_STRING;
} }
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////