Files correlati : Ricompilazione Demo : [ ] Commento :iniziata implementazione superstampa di Adolfo! git-svn-id: svn://10.65.10.50/trunk@14463 c028cbd2-c16b-5b4b-a496-9718f37d4682
152 lines
4.1 KiB
C++
Executable File
152 lines
4.1 KiB
C++
Executable File
#include "calib01.h"
|
|
#include "calib02.h"
|
|
#include "ca3883.h"
|
|
#include "panapdc.h"
|
|
#include "pconana.h"
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////
|
|
// Classe per ricavare l'indicatore di bilancio dei conti analitici riclassificati e non
|
|
////////////////////////////////////////////////////////////////////////////////////////
|
|
TObject* TIndbil_cache::key2obj(const char* key)
|
|
{
|
|
TString80 conto = key;
|
|
if (_usepdcc && conto.len() == 12 && real::is_natural(conto))
|
|
{
|
|
TLocalisamfile panapdc(LF_PANAPDC);
|
|
panapdc.setkey(2);
|
|
const int gr = atoi(conto.left(3));
|
|
const int co = atoi(conto.mid(3,3));
|
|
const long so = atol(conto.mid(6,6));
|
|
|
|
TRectype& panapdrec = panapdc.curr();
|
|
for (int i = 2; i >= 0; i--)
|
|
{
|
|
panapdrec.zero();
|
|
panapdrec.put(PANAPDC_GRUPPO, gr);
|
|
if (i > 0)
|
|
panapdrec.put(PANAPDC_CONTO, co);
|
|
if (i == 2)
|
|
panapdrec.put(PANAPDC_SOTTOCONTO, so);
|
|
|
|
//occhio al prefisso!
|
|
panapdrec.put(PANAPDC_CODCONTO, _prefix);
|
|
|
|
if (panapdc.read(_isgteq) == NOERR)
|
|
{
|
|
bool found = panapdrec.get_int(PANAPDC_GRUPPO) == gr;
|
|
if (found)
|
|
found = panapdrec.get_int(PANAPDC_CONTO) == (i > 0 ? co : 0);
|
|
if (found)
|
|
found = panapdrec.get_long(PANAPDC_SOTTOCONTO) == (i > 1 ? so : 0L);
|
|
if (found && _prefix.full())
|
|
found = panapdrec.get(PANAPDC_CODCONTO).starts_with(_prefix);
|
|
|
|
if (found)
|
|
{
|
|
conto = panapdrec.get(PANAPDC_CODCONTO);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
//se non trova il corrispondente conto analitico azzera il conto per il prossimo giro
|
|
if (i < 0)
|
|
conto.cut(0);
|
|
}
|
|
//conto analitico
|
|
TAnal_bill bill(conto);
|
|
int indbil = bill.indicatore_bilancio();
|
|
TToken_string* ib = new TToken_string;
|
|
*ib << indbil;
|
|
ib->add(conto);
|
|
return ib;
|
|
}
|
|
|
|
int TIndbil_cache::get_indbil(const TString& conto, TString& conto_anale)
|
|
{
|
|
TToken_string* ib = (TToken_string*)objptr(conto);
|
|
if (ib != NULL)
|
|
ib->get(1, conto_anale);
|
|
return ib ? ib->get_int(0) : 0;
|
|
}
|
|
|
|
void TIndbil_cache::set_prefix(const char* prefix)
|
|
{
|
|
if (_prefix != prefix)
|
|
{
|
|
_prefix = prefix;
|
|
destroy();
|
|
}
|
|
}
|
|
|
|
TIndbil_cache::TIndbil_cache()
|
|
{
|
|
TConfig& cfg = ca_config();
|
|
_usepdcc = cfg.get_bool("UsePdcc");
|
|
}
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
//Classe di report speciale con numero colonne adattabile in base ad un parametro
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
void TCRPA_report::merge_array(TString_array& c, TString_array& t,
|
|
TString_array& codici, TString_array& testate) const
|
|
{
|
|
while (c.items() > 0)
|
|
{
|
|
TObject* cod = c.remove(0,true);
|
|
TObject* tes = t.remove(0,true);
|
|
codici.TArray::add(cod);
|
|
testate.TArray::add(tes);
|
|
}
|
|
}
|
|
|
|
void TCRPA_report::analize_pconana_structure (const TString& prefix, const int depth,
|
|
TString_array& codici, TString_array& testate) const
|
|
{
|
|
TConfig& cfg = ca_config();
|
|
const TMultilevel_code_info& pconana_info = ca_multilevel_code_info(LF_PCONANA);
|
|
const long total_length = pconana_info.total_len(depth);
|
|
|
|
|
|
TISAM_recordset recset("USE PCONANA\nSELECT LEN(CODCONTO)=#LUN\nFROM CODCONTO=#PREFIX\nTO CODCONTO=#PREFIX");
|
|
recset.set_var("#LUN", TVariant(total_length));
|
|
recset.set_var("#PREFIX", TVariant(prefix));
|
|
const int prefix_length = prefix.len();
|
|
|
|
TString_array codici_c, testate_c, codici_r, testate_r;
|
|
|
|
for (bool ok = recset.move_first(); ok; ok = recset.move_next())
|
|
{
|
|
const TString& codconto = recset.get(PCONANA_CODCONTO).as_string();
|
|
|
|
const TAnal_bill zio(codconto);
|
|
const int indbil = zio.indicatore_bilancio();
|
|
if (indbil == 3 || indbil == 4)
|
|
{
|
|
const TString& codice = codconto.mid(prefix_length);
|
|
const TString& testata = zio.testata();
|
|
if (indbil == 3)
|
|
{
|
|
codici_c.add(codice);
|
|
testate_c.add(testata);
|
|
}
|
|
else
|
|
{
|
|
codici_r.add(codice);
|
|
testate_r.add(testata);
|
|
}
|
|
}
|
|
}
|
|
|
|
merge_array(codici_r, testate_r, codici, testate);
|
|
merge_array(codici_c, testate_c, codici, testate);
|
|
}
|
|
|
|
|
|
TCRPA_report::TCRPA_report (const char* rep_name, const TString& prefix, const int depth)
|
|
{
|
|
load(rep_name);
|
|
TString_array codici, testate;
|
|
analize_pconana_structure (prefix, depth, codici, testate);
|
|
}
|