Patch level :2.2 394
Files correlati :ca3.exe,ca3700.msk Ricompilazione Demo : [ ] Commento :sistemato problema dei campi sovrapposti nella maschera dei conti nel caso si usi il piano dei conti analitico;perfezionata la definizione di piano dei conti riclassificato (da migliorare ulteriormente in seguito); aggiunto un warning non bloccante nel caso si presentino righe documento prive di relativa testata (archivi incasinati di ruffo) git-svn-id: svn://10.65.10.50/trunk@13875 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
7acca48b02
commit
cafac20e45
162
ca/ca3700.cpp
162
ca/ca3700.cpp
@ -145,20 +145,21 @@ TPrint_rendiconto_ca_mask::TPrint_rendiconto_ca_mask()
|
||||
const TMultilevel_code_info& pconana_info = ca_multilevel_code_info(LF_PCONANA);
|
||||
const int pconana_levels = pconana_info.levels();
|
||||
|
||||
int pconana_prefix = cfg.get_int("PdcPrefix");
|
||||
if (pconana_prefix >= pconana_levels)
|
||||
pconana_prefix = pconana_levels-1;
|
||||
int prefix = cfg.get_int("PdcPrefix");
|
||||
if (prefix >= pconana_levels)
|
||||
prefix = pconana_levels-1;
|
||||
|
||||
//setta nel campo F_PIANO il tipo di piano dei conti usato in base alla configurazione..
|
||||
//..e disabilita il campo (non si puo' cambiare la configurazione in una stampa!!)
|
||||
disable(F_PIANO);
|
||||
set(F_PIANO, use_pdcc ? "C" : "A");
|
||||
|
||||
// Controllo se voglio (e posso) usare il conto analitico come prefisso di quello contabile
|
||||
const int pref = cfg.get_int("PdcPrefix");
|
||||
if (use_pdcc && pref > 0)
|
||||
if (use_pdcc && prefix > 0)
|
||||
{
|
||||
const TMultilevel_code_info& info = ca_multilevel_code_info(LF_PCONANA);
|
||||
const int levels = info.levels();
|
||||
if (levels >= 2 && pref < levels && esistono_riclassificazioni())
|
||||
if (levels >= 2 && prefix < levels && esistono_riclassificazioni())
|
||||
{
|
||||
enable(F_PIANO);
|
||||
ca_create_fields(*this, 1, LF_PCONANA, 2, 4, F_PRE1, F_PREDES1, 0x0, PCONANA_CODCONTO);
|
||||
@ -166,7 +167,7 @@ TPrint_rendiconto_ca_mask::TPrint_rendiconto_ca_mask()
|
||||
// Nascondi i campi che non fanno parte del prefisso
|
||||
for (int i = 0; i < levels; i++)
|
||||
{
|
||||
if (i < pref)
|
||||
if (i < prefix)
|
||||
{
|
||||
field(F_PRE1 + i).check_type(CHECK_REQUIRED);
|
||||
field(F_PRE1 + i).set_group(6);
|
||||
@ -233,7 +234,7 @@ class TPrint_rendiconto_ca_recordset : public TISAM_recordset
|
||||
{
|
||||
TExternisamfile* _tmp;
|
||||
bool _riclassificato;
|
||||
TString _prefix, _da_conto_riclas, _a_conto_riclas;
|
||||
TString _prefix;
|
||||
|
||||
protected:
|
||||
int _anno;
|
||||
@ -279,18 +280,11 @@ void TPrint_rendiconto_ca_recordset::set_custom_filter(TCursor& cur) const
|
||||
TRectype darec(cur.curr()), arec(cur.curr()); //curr perchè è il file externisamfile
|
||||
darec.zero();
|
||||
arec.zero();
|
||||
if (!_riclassificato)
|
||||
{
|
||||
if (_daconto.not_empty())
|
||||
darec.put("CONTO", _daconto);
|
||||
if (_aconto.not_empty())
|
||||
arec.put("CONTO", _aconto);
|
||||
}
|
||||
else
|
||||
{
|
||||
darec.put("CONTO", _da_conto_riclas);
|
||||
arec.put("CONTO", _a_conto_riclas);
|
||||
}
|
||||
|
||||
if (_daconto.not_empty())
|
||||
darec.put("CONTO", _daconto);
|
||||
if (_aconto.not_empty())
|
||||
arec.put("CONTO", _aconto);
|
||||
|
||||
//filtro sulla data(non avendo anche codnum non ho la chiave completa per mettere la data nella setregion)
|
||||
TString filtro;
|
||||
@ -374,19 +368,13 @@ const TVariant& TPrint_rendiconto_ca_recordset::get(const char* column_name) con
|
||||
if (strcmp(column_name, "#DACONTO") == 0)
|
||||
{
|
||||
TVariant& var = get_tmp_var();
|
||||
if (!_riclassificato)
|
||||
var = _daconto;
|
||||
else
|
||||
var = _da_conto_riclas;
|
||||
var = _daconto;
|
||||
return var;
|
||||
}
|
||||
if (strcmp(column_name, "#ACONTO") == 0)
|
||||
{
|
||||
TVariant& var = get_tmp_var();
|
||||
if (!_riclassificato)
|
||||
var = _aconto;
|
||||
else
|
||||
var = _a_conto_riclas;
|
||||
var = _aconto;
|
||||
return var;
|
||||
}
|
||||
//cerca l'indicatore di bilancio del conto;utilizzato per stabilire il campo ove sommare..
|
||||
@ -482,8 +470,8 @@ void TPrint_rendiconto_ca_recordset::scrive_riga(const TRectype& rmovana, const
|
||||
//ATTENZIONE! Se era stata operata una selezione sui conti riclassificati nella maschera
|
||||
//ed il conto riclassificato attuale non ricade nell'intervallo selezionato il programma
|
||||
//non deve aggiungere il record al file!!
|
||||
if ((_da_conto_riclas.not_empty() && conto_riclassificato < _da_conto_riclas) ||
|
||||
(_a_conto_riclas.not_empty() && conto_riclassificato.compare(_a_conto_riclas, _a_conto_riclas.len()) > 0))
|
||||
if ((_daconto.not_empty() && conto_riclassificato < _daconto) ||
|
||||
(_aconto.not_empty() && conto_riclassificato.compare(_aconto, _aconto.len()) > 0))
|
||||
return;
|
||||
|
||||
} //if(_riclassificato)
|
||||
@ -865,47 +853,64 @@ void TPrint_rendiconto_ca_recordset::crea_righe_da_rdoc(const TPrint_rendiconto_
|
||||
pi.addstatus(1);
|
||||
if (pi.iscancelled())
|
||||
break;
|
||||
|
||||
|
||||
//La riga esaminata deve avere una testata valida!!!!Se la testata non esiste va saltata..
|
||||
//..la riga
|
||||
const TRectype& curr_doc = cur_rdoc.curr(LF_DOC);
|
||||
//controlla se il documento cui appartiene la rigadoc e' stato contabilizzato;
|
||||
//se e' stato contabilizzato lo salta in quanto la riga documento apparira' attraverso le righe
|
||||
//dei movimenti di analitica
|
||||
const long numregca = curr_doc.get_long(DOC_NUMREGCA);
|
||||
if (numregca == 0)
|
||||
if (!curr_doc.empty())
|
||||
{
|
||||
const TString curr_key = curr_doc.build_key();
|
||||
if (curr_key == old_key)
|
||||
continue;
|
||||
else
|
||||
old_key = curr_key;
|
||||
|
||||
TDocumento doc(curr_doc);
|
||||
TAnal_mov mov;
|
||||
cont_anal.elabora(doc, 0, NULL, false, mov);
|
||||
|
||||
//estrae il tipo ed il codice clifo dal documento per metterlo nel movana che ha generato
|
||||
//con la elabora (richiesta puramente adolfica!)
|
||||
TString16 key;
|
||||
key << doc.get(DOC_TIPOCF) << '|' << doc.get(DOC_CODCF);
|
||||
const TString clifo = cache().get(LF_CLIFO, key, CLI_RAGSOC);
|
||||
mov.put(MOVANA_DESCR, clifo);
|
||||
|
||||
for (int j = 1; j <= mov.rows(); j++)
|
||||
//controlla se il documento cui appartiene la rigadoc e' stato contabilizzato;
|
||||
//se e' stato contabilizzato lo salta in quanto la riga documento apparira' attraverso le righe
|
||||
//dei movimenti di analitica
|
||||
const long numregca = curr_doc.get_long(DOC_NUMREGCA);
|
||||
if (numregca == 0)
|
||||
{
|
||||
//controlla che la riga in esame abbia realmente la cms/cdc/fas indicata nel filtro;
|
||||
//procedimento necessario per evitare la stampa di righe appartenenti a docs elaborati
|
||||
//perchè contenenti 1 riga con cms corretta ed altre righe con cms sbagliate
|
||||
const TRectype& rmov = mov.body()[j];
|
||||
const TString curr_key = curr_doc.build_key();
|
||||
if (curr_key == old_key)
|
||||
continue;
|
||||
else
|
||||
old_key = curr_key;
|
||||
|
||||
if (_codcms.not_empty() && rmov.get(RMOVANA_CODCMS) != _codcms)
|
||||
continue;
|
||||
if (_codcosto.not_empty() && rmov.get(RMOVANA_CODCCOSTO) != _codcosto)
|
||||
continue;
|
||||
if (_codfas.not_empty() && rmov.get(RMOVANA_CODFASE) != _codfas)
|
||||
continue;
|
||||
scrive_riga(rmov, mov, &doc);
|
||||
} //for int j...
|
||||
} //if numregca
|
||||
TDocumento doc(curr_doc);
|
||||
TAnal_mov mov;
|
||||
cont_anal.elabora(doc, 0, NULL, false, mov);
|
||||
|
||||
//estrae il tipo ed il codice clifo dal documento per metterlo nel movana che ha generato
|
||||
//con la elabora (richiesta puramente adolfica!)
|
||||
TString16 key;
|
||||
key << doc.get(DOC_TIPOCF) << '|' << doc.get(DOC_CODCF);
|
||||
const TString clifo = cache().get(LF_CLIFO, key, CLI_RAGSOC);
|
||||
mov.put(MOVANA_DESCR, clifo);
|
||||
|
||||
for (int j = 1; j <= mov.rows(); j++)
|
||||
{
|
||||
//controlla che la riga in esame abbia realmente la cms/cdc/fas indicata nel filtro;
|
||||
//procedimento necessario per evitare la stampa di righe appartenenti a docs elaborati
|
||||
//perchè contenenti 1 riga con cms corretta ed altre righe con cms sbagliate
|
||||
const TRectype& rmov = mov.body()[j];
|
||||
|
||||
if (_codcms.not_empty() && rmov.get(RMOVANA_CODCMS) != _codcms)
|
||||
continue;
|
||||
if (_codcosto.not_empty() && rmov.get(RMOVANA_CODCCOSTO) != _codcosto)
|
||||
continue;
|
||||
if (_codfas.not_empty() && rmov.get(RMOVANA_CODFASE) != _codfas)
|
||||
continue;
|
||||
scrive_riga(rmov, mov, &doc);
|
||||
} //for int j...
|
||||
} //if numregca
|
||||
} //if !curr_doc.empty()
|
||||
//Ha trovato una riga senza testata! non puo' considerarla ma avverte l'utente del problema
|
||||
else
|
||||
{
|
||||
const TRectype& bad_row = cur_rdoc.curr();
|
||||
const TString4 bad_codnum = bad_row.get(RDOC_CODNUM);
|
||||
const int bad_anno = bad_row.get_int(RDOC_ANNO);
|
||||
const long bad_ndoc = bad_row.get_long(RDOC_NDOC);
|
||||
const int bad_nriga = bad_row.get_int(RDOC_NRIGA);
|
||||
TString error_string;
|
||||
error_string << bad_codnum << "|" << bad_anno << "|D|" << bad_ndoc << "|" << bad_nriga;
|
||||
warning_box("Riga documento %s priva di testata!", (const char*)error_string);
|
||||
}
|
||||
} //for cur_rdoc..
|
||||
} //if rdoc_items
|
||||
|
||||
@ -980,26 +985,17 @@ void TPrint_rendiconto_ca_recordset::set_filter(const TPrint_rendiconto_ca_mask&
|
||||
|
||||
//si utilizza la riclassificazione dei conti?
|
||||
if (msk.get(F_PIANO) == "A")
|
||||
_riclassificato = true;
|
||||
{
|
||||
TLocalisamfile panapdc(LF_PANAPDC);
|
||||
_riclassificato = panapdc.first() == NOERR;
|
||||
}
|
||||
else
|
||||
_riclassificato = false;
|
||||
|
||||
//conti non riclassificati
|
||||
if (!_riclassificato)
|
||||
for (int i = 0; i < 4 && msk.id2pos(dlg_da+i) > 0; i++)
|
||||
{
|
||||
for (int i = 0; i < 4 && msk.id2pos(dlg_da+i) > 0; i++)
|
||||
{
|
||||
_daconto << msk.get(dlg_da+i);
|
||||
_aconto << msk.get(dlg_al+i);
|
||||
}
|
||||
}
|
||||
else //conti riclassificati
|
||||
{
|
||||
for (int i = 0; i < 4 && msk.id2pos(dlg_da+i) > 0; i++)
|
||||
{
|
||||
_da_conto_riclas << msk.get(dlg_da+i);
|
||||
_a_conto_riclas << msk.get(dlg_al+i);
|
||||
}
|
||||
_daconto << msk.get(dlg_da+i);
|
||||
_aconto << msk.get(dlg_al+i);
|
||||
}
|
||||
|
||||
_dadata = msk.get_date(F_DATAINI);
|
||||
|
@ -109,6 +109,7 @@ BEGIN
|
||||
MESSAGE HIDE,5@|SHOW,6@
|
||||
ITEM "C|Contabile"
|
||||
MESSAGE HIDE,6@|SHOW,5@
|
||||
FLAGS "G"
|
||||
END
|
||||
|
||||
GROUPBOX F_PRE0 76 6
|
||||
|
Loading…
x
Reference in New Issue
Block a user