2005-03-17 14:20:42 +00:00
|
|
|
#include <xvt.h>
|
|
|
|
|
|
|
|
#include "calib01.h"
|
|
|
|
#include "calib02.h"
|
|
|
|
|
2005-06-27 16:35:27 +00:00
|
|
|
#include "../cg/cglib01.h"
|
2005-07-07 17:05:02 +00:00
|
|
|
|
|
|
|
#include <rdoc.h>
|
|
|
|
#include <pconti.h>
|
2005-06-27 16:35:27 +00:00
|
|
|
|
2005-06-23 12:16:21 +00:00
|
|
|
#include "movana.h"
|
2005-06-29 13:04:49 +00:00
|
|
|
#include "pconana.h"
|
2005-06-23 12:16:21 +00:00
|
|
|
#include "rmovana.h"
|
|
|
|
#include "saldana.h"
|
|
|
|
|
2005-06-29 13:04:49 +00:00
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
// TPconana_recordset
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
2005-07-07 17:05:02 +00:00
|
|
|
const TVariant& TPconana_recordset::get(const char* field) const
|
2005-06-29 13:04:49 +00:00
|
|
|
{
|
2005-07-07 17:05:02 +00:00
|
|
|
const TFixed_string column_name(field);
|
2005-08-08 11:55:59 +00:00
|
|
|
if (column_name[0] == '#')
|
2005-06-29 13:04:49 +00:00
|
|
|
{
|
2005-08-08 11:55:59 +00:00
|
|
|
if (column_name == "#CMSCDC")
|
2005-06-29 13:04:49 +00:00
|
|
|
{
|
2005-07-07 17:05:02 +00:00
|
|
|
const TMultilevel_code_info& info = ca_multilevel_code_info(LF_FASI);
|
|
|
|
switch (info.parent())
|
|
|
|
{
|
|
|
|
case LF_CDC : return get_tmp_var() = _bill.costo();
|
|
|
|
case LF_COMMESSE: return get_tmp_var() = _bill.commessa();
|
|
|
|
default : return NULL_VARIANT;
|
|
|
|
}
|
2005-06-29 13:04:49 +00:00
|
|
|
}
|
2005-08-08 11:55:59 +00:00
|
|
|
if (column_name == "#COSTO")
|
2005-07-07 17:05:02 +00:00
|
|
|
return get_tmp_var() = _bill.costo();
|
2005-08-08 11:55:59 +00:00
|
|
|
if (column_name == "#COMMESSA")
|
2005-07-07 17:05:02 +00:00
|
|
|
return get_tmp_var() = _bill.commessa();
|
2005-08-08 11:55:59 +00:00
|
|
|
if (column_name == "#FASE")
|
2005-07-07 17:05:02 +00:00
|
|
|
return get_tmp_var() = _bill.fase();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-08-08 11:55:59 +00:00
|
|
|
const TRectype& curr = relation()->curr();
|
|
|
|
if (column_name.starts_with(PCONANA_CODCONTO))
|
2005-06-29 13:04:49 +00:00
|
|
|
{
|
2005-07-07 17:05:02 +00:00
|
|
|
TString80 str;
|
|
|
|
if (_tipo == 'C')
|
|
|
|
{
|
2005-08-08 11:55:59 +00:00
|
|
|
const TBill b(curr);
|
2005-07-07 17:05:02 +00:00
|
|
|
str = b.string(0x8);
|
|
|
|
}
|
|
|
|
else
|
2005-08-08 11:55:59 +00:00
|
|
|
str = curr.get(PCONANA_CODCONTO);
|
2005-07-07 17:05:02 +00:00
|
|
|
|
|
|
|
if (column_name[8] == ':')
|
|
|
|
{
|
|
|
|
const TMultilevel_code_info& info = ca_multilevel_code_info(_tipo == 'C' ? LF_PCON : LF_PCONANA);
|
|
|
|
const int level = column_name[9] - '1';
|
|
|
|
str.cut(info.total_len(level));
|
|
|
|
}
|
|
|
|
return get_tmp_var() = str;
|
|
|
|
}
|
2005-08-08 11:55:59 +00:00
|
|
|
if (column_name.starts_with(PCONANA_DESCR))
|
2005-06-29 13:04:49 +00:00
|
|
|
{
|
2005-07-07 17:05:02 +00:00
|
|
|
TString80 str;
|
|
|
|
if (_tipo == 'C')
|
|
|
|
{
|
2005-08-08 11:55:59 +00:00
|
|
|
TBill b(curr);
|
2005-07-07 17:05:02 +00:00
|
|
|
if (column_name[5] == ':')
|
|
|
|
{
|
|
|
|
if (column_name[6] == '1')
|
|
|
|
b.set(b.gruppo(), 0, 0); else
|
|
|
|
if (column_name[6] == '2')
|
|
|
|
b.set(b.gruppo(), b.conto(), 0);
|
|
|
|
}
|
|
|
|
str = b.descrizione();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (column_name[5] == ':')
|
|
|
|
{
|
|
|
|
const TMultilevel_code_info& info = ca_multilevel_code_info(LF_PCONANA);
|
|
|
|
const int level = column_name[6] - '1';
|
2005-08-08 11:55:59 +00:00
|
|
|
str = curr.get(PCONANA_CODCONTO);
|
2005-07-07 17:05:02 +00:00
|
|
|
str.cut(info.total_len(level));
|
|
|
|
str = cache().get(LF_PCONANA, str, PCONANA_DESCR);
|
|
|
|
}
|
|
|
|
else
|
2005-08-08 11:55:59 +00:00
|
|
|
str = curr.get(PCONANA_DESCR);
|
2005-07-07 17:05:02 +00:00
|
|
|
}
|
|
|
|
return get_tmp_var() = str;
|
2005-06-29 13:04:49 +00:00
|
|
|
}
|
2005-08-08 11:55:59 +00:00
|
|
|
if (column_name == PCONANA_INDBIL)
|
|
|
|
{
|
|
|
|
long ib = curr.get_int(PCONANA_INDBIL);
|
|
|
|
if (ib == 0)
|
|
|
|
{
|
|
|
|
if (_tipo == 'C')
|
|
|
|
{
|
|
|
|
TBill b(curr);
|
|
|
|
ib = b.indicatore_bilancio();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const TString80 conto = curr.get(PCONANA_CODCONTO);
|
|
|
|
const TMultilevel_code_info& info = ca_multilevel_code_info(LF_PCONANA);
|
|
|
|
for (int i = info.levels()-2; i >= 0 && ib <= 0; i--)
|
|
|
|
{
|
|
|
|
const TString& k = conto.left(info.total_len(i));
|
|
|
|
const TRectype& pca = cache().get(LF_PCONANA, conto);
|
|
|
|
ib = pca.get_long(PCONANA_INDBIL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return get_tmp_var() = ib;
|
|
|
|
}
|
2005-07-07 17:05:02 +00:00
|
|
|
|
2005-08-08 11:55:59 +00:00
|
|
|
if (column_name.starts_with("SALDO:"))
|
2005-06-29 13:04:49 +00:00
|
|
|
{
|
2005-08-08 11:55:59 +00:00
|
|
|
TString16 sub_field = column_name.mid(6);
|
2005-07-07 17:05:02 +00:00
|
|
|
const char last = sub_field.right(1)[0];
|
|
|
|
int tipimov = 0;
|
|
|
|
switch (last)
|
|
|
|
{
|
|
|
|
case 'C': tipimov = _saldanal_consuntivo; sub_field.rtrim(1); break; // Consuntivo
|
|
|
|
case 'P':
|
|
|
|
case 'V': tipimov = _saldanal_preventivi; sub_field.rtrim(1); break; // Preventivo o variazione preventivo
|
|
|
|
default : tipimov = _tipimov; break;
|
|
|
|
}
|
|
|
|
|
|
|
|
((TAnal_bill&)_bill).set_conto(get(PCONANA_CODCONTO).as_string());
|
|
|
|
const TSaldanal& s = ca_saldo(_bill, _dal, _al, tipimov);
|
|
|
|
|
|
|
|
TVariant& var = get_tmp_var();
|
2005-08-08 11:55:59 +00:00
|
|
|
if (sub_field == "INI_DARE")
|
2005-07-07 17:05:02 +00:00
|
|
|
{
|
|
|
|
var = s._ini.sezione() == 'D' ? s._ini.valore() : ZERO;
|
|
|
|
} else
|
2005-08-08 11:55:59 +00:00
|
|
|
if (sub_field == "INI_AVERE")
|
2005-07-07 17:05:02 +00:00
|
|
|
{
|
|
|
|
var = s._ini.sezione() == 'A' ? s._ini.valore() : ZERO;
|
|
|
|
} else
|
2005-08-08 11:55:59 +00:00
|
|
|
if (sub_field == "MOV_DARE")
|
2005-07-07 17:05:02 +00:00
|
|
|
{
|
|
|
|
var = s._dare.valore();
|
|
|
|
} else
|
2005-08-08 11:55:59 +00:00
|
|
|
if (sub_field == "MOV_AVERE")
|
2005-07-07 17:05:02 +00:00
|
|
|
{
|
|
|
|
var = s._avere.valore();
|
|
|
|
} else
|
2005-08-08 11:55:59 +00:00
|
|
|
if (sub_field == "FIN_DARE")
|
2005-07-07 17:05:02 +00:00
|
|
|
{
|
|
|
|
var = s._fin.sezione() == 'D' ? s._fin.valore() : ZERO;
|
|
|
|
} else
|
2005-08-08 11:55:59 +00:00
|
|
|
if (sub_field == "FIN_AVERE")
|
2005-07-07 17:05:02 +00:00
|
|
|
{
|
|
|
|
var = s._fin.sezione() == 'A' ? s._fin.valore() : ZERO;
|
|
|
|
}
|
|
|
|
return var;
|
2005-06-29 13:04:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return TISAM_recordset::get(column_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TPconana_recordset::valid_record(const TRelation& rel) const
|
|
|
|
{
|
2005-07-07 17:05:02 +00:00
|
|
|
TString80 conto;
|
|
|
|
if (_tipo == 'C')
|
|
|
|
{
|
|
|
|
const TBill b(rel.curr());
|
|
|
|
if (b.sottoconto() <= 0 || !b.is_analitico())
|
|
|
|
return false;
|
|
|
|
conto = b.string(0x8);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
conto = rel.curr().get(PCONANA_CODCONTO);
|
|
|
|
if (conto.len() <= _conto_minlen)
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2005-06-29 13:04:49 +00:00
|
|
|
if (_movimentati || _nonnulli)
|
|
|
|
{
|
|
|
|
((TAnal_bill&)_bill).set_conto(conto);
|
|
|
|
const TSaldanal& s = ca_saldo(_bill, _dal, _al, _tipimov);
|
|
|
|
if (_movimentati && !s._movimentato)
|
|
|
|
return false;
|
2005-07-07 17:05:02 +00:00
|
|
|
if (_nonnulli && s._fin.is_zero())
|
2005-06-29 13:04:49 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const TPconana_recordset* _current_recset = NULL;
|
|
|
|
|
|
|
|
bool TPconana_recordset::pianoconti_filter(const TRelation* rel)
|
|
|
|
{ return _current_recset->valid_record(*rel); }
|
|
|
|
|
|
|
|
void TPconana_recordset::set_custom_filter(TCursor& cursor) const
|
|
|
|
{
|
2005-07-07 17:05:02 +00:00
|
|
|
if (_tipo == 'C')
|
|
|
|
{
|
|
|
|
TRectype darec(LF_PCON), arec(LF_PCON);
|
|
|
|
darec.put(PCN_GRUPPO, _da_conto.mid(0,3));
|
|
|
|
darec.put(PCN_CONTO, _da_conto.mid(3,3));
|
|
|
|
darec.put(PCN_SOTTOCONTO, _da_conto.mid(6,6));
|
|
|
|
arec.put(PCN_GRUPPO, _a_conto.mid(0,3));
|
|
|
|
arec.put(PCN_CONTO, _a_conto.mid(3,3));
|
|
|
|
arec.put(PCN_SOTTOCONTO, _a_conto.mid(6,6));
|
|
|
|
cursor.setregion(darec, arec);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TRectype darec(LF_PCONANA), arec(LF_PCONANA);
|
|
|
|
darec.put(PCONANA_CODCONTO, _da_conto);
|
|
|
|
arec.put(PCONANA_CODCONTO, _a_conto);
|
|
|
|
cursor.setregion(darec, arec);
|
|
|
|
}
|
2005-06-29 13:04:49 +00:00
|
|
|
|
2005-07-07 17:05:02 +00:00
|
|
|
_current_recset = this;
|
|
|
|
cursor.set_filterfunction(pianoconti_filter);
|
|
|
|
}
|
2005-06-29 13:04:49 +00:00
|
|
|
|
2005-07-07 17:05:02 +00:00
|
|
|
void TPconana_recordset::set_tipo(char tipo)
|
|
|
|
{
|
|
|
|
if (tipo != 'A' && tipo != 'C')
|
|
|
|
{
|
|
|
|
TConfig_anal cfg;
|
|
|
|
tipo = cfg.get_bool("UsePdcc") ? 'C' : 'A';
|
|
|
|
}
|
|
|
|
_tipo = tipo;
|
|
|
|
|
|
|
|
if (_tipo == 'A')
|
2005-06-29 13:04:49 +00:00
|
|
|
{
|
2005-07-07 17:05:02 +00:00
|
|
|
set("USE PCONANA");
|
|
|
|
const TMultilevel_code_info& info = ca_multilevel_code_info(LF_PCONANA);
|
|
|
|
_conto_minlen = info.total_len(-1); // Lunghezza fino al penultimo livello
|
2005-06-29 13:04:49 +00:00
|
|
|
}
|
|
|
|
else
|
2005-07-07 17:05:02 +00:00
|
|
|
{
|
|
|
|
set("USE PCON");
|
|
|
|
_conto_minlen = 6; // Gruppo(3)+Conto(3)
|
|
|
|
}
|
2005-06-29 13:04:49 +00:00
|
|
|
}
|
|
|
|
|
2005-07-07 17:05:02 +00:00
|
|
|
void TPconana_recordset::set_filter(char tipo, const char* da_conto, const char* a_conto,
|
2005-06-29 13:04:49 +00:00
|
|
|
const char* costo, const char* commessa, const char* fase,
|
|
|
|
const TDate& dal, const TDate& al,
|
|
|
|
word tipimov, bool movimentati, bool nonnulli)
|
|
|
|
{
|
2005-07-07 17:05:02 +00:00
|
|
|
set_tipo(tipo);
|
2005-06-29 13:04:49 +00:00
|
|
|
|
|
|
|
_da_conto = da_conto;
|
|
|
|
_a_conto = a_conto;
|
|
|
|
|
|
|
|
_dal = dal;
|
|
|
|
_al = al;
|
|
|
|
|
|
|
|
_tipimov= tipimov;
|
|
|
|
_movimentati = movimentati;
|
|
|
|
_nonnulli = nonnulli;
|
|
|
|
|
|
|
|
_bill.reset();
|
|
|
|
_bill.set_costo(costo);
|
|
|
|
_bill.set_commessa(commessa);
|
|
|
|
_bill.set_fase(fase);
|
|
|
|
}
|
|
|
|
|
2005-07-07 17:05:02 +00:00
|
|
|
TPconana_recordset::TPconana_recordset(char tipo) : TISAM_recordset("USE PCONANA")
|
|
|
|
{
|
|
|
|
set_tipo(tipo);
|
|
|
|
}
|
2005-06-29 13:04:49 +00:00
|
|
|
|
2005-06-23 12:16:21 +00:00
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
// TAnal_report
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
2005-03-17 14:20:42 +00:00
|
|
|
size_t TAnal_report::get_usr_words(TString_array& words) const
|
|
|
|
{
|
|
|
|
TReport::get_usr_words(words);
|
|
|
|
|
|
|
|
const char* const name[] =
|
|
|
|
{
|
|
|
|
"CA_FORMAT_COSTO",
|
|
|
|
"CA_FORMAT_COMMESSA",
|
|
|
|
"CA_FORMAT_FASE",
|
|
|
|
"CA_FORMAT_CONTO",
|
2005-03-31 23:41:34 +00:00
|
|
|
"CA_FORMAT_CMSCDC",
|
2005-03-17 14:20:42 +00:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
((TAnal_report*)this)->_first_msg = words.items(); // Calcola il primo numero disponibile
|
|
|
|
size_t i;
|
|
|
|
for (i = 0; name[i] != NULL; i++)
|
|
|
|
words.add(name[i]);
|
|
|
|
|
|
|
|
return words.items();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TAnal_report::msg_format(int logicnum, TVariant_stack& stack)
|
|
|
|
{
|
|
|
|
const TString& str_in = curr_field()->get().as_string();
|
|
|
|
if (str_in.not_empty())
|
|
|
|
{
|
|
|
|
TString80 separator = " ";
|
|
|
|
if (stack.items() > 0)
|
|
|
|
separator = stack.pop().as_string();
|
|
|
|
if (separator.not_empty())
|
|
|
|
{
|
|
|
|
const TMultilevel_code_info& mci = ca_multilevel_code_info(logicnum);
|
2005-07-07 17:05:02 +00:00
|
|
|
TString80 str_out = str_in;
|
|
|
|
for (int i = mci.levels()-2; i >= 0; i--)
|
|
|
|
str_out.insert(separator, mci.total_len(i));
|
2005-03-17 14:20:42 +00:00
|
|
|
curr_field()->set(str_out);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TAnal_report::msg_format_costo (TVariant_stack& stack)
|
|
|
|
{ msg_format(LF_CDC, stack); }
|
|
|
|
|
|
|
|
void TAnal_report::msg_format_commessa(TVariant_stack& stack)
|
|
|
|
{ msg_format(LF_COMMESSE, stack); }
|
|
|
|
|
|
|
|
void TAnal_report::msg_format_fase (TVariant_stack& stack)
|
|
|
|
{ msg_format(LF_FASI, stack); }
|
|
|
|
|
|
|
|
void TAnal_report::msg_format_conto (TVariant_stack& stack)
|
2005-07-07 17:05:02 +00:00
|
|
|
{
|
|
|
|
// Cerca di determinare se si usa il piano contabile o analitico
|
|
|
|
const TFixed_string gruppo(PCN_GRUPPO);
|
|
|
|
TVariant var;
|
|
|
|
get_record_field(gruppo, var);
|
|
|
|
if (var.is_null())
|
|
|
|
msg_format(LF_PCONANA, stack);
|
|
|
|
else
|
|
|
|
msg_format(LF_PCON, stack);
|
|
|
|
}
|
2005-03-17 14:20:42 +00:00
|
|
|
|
2005-03-31 23:41:34 +00:00
|
|
|
void TAnal_report::msg_format_commessa_costo(TVariant_stack& stack)
|
|
|
|
{
|
|
|
|
const TMultilevel_code_info& main_info = ca_multilevel_code_info(LF_FASI);
|
|
|
|
msg_format(main_info.parent(), stack);
|
|
|
|
}
|
2005-06-21 11:46:26 +00:00
|
|
|
|
|
|
|
bool TAnal_report::execute_usr_word(unsigned int opcode, TVariant_stack& stack)
|
|
|
|
{
|
|
|
|
if (opcode < _first_msg)
|
|
|
|
return TReport::execute_usr_word(opcode, stack);
|
|
|
|
opcode -= _first_msg;
|
|
|
|
switch (opcode)
|
|
|
|
{
|
|
|
|
case 0 : msg_format_costo(stack); break;
|
|
|
|
case 1 : msg_format_commessa(stack); break;
|
|
|
|
case 2 : msg_format_fase(stack); break;
|
|
|
|
case 3 : msg_format_conto(stack); break;
|
|
|
|
case 4 : msg_format_commessa_costo(stack); break;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2005-06-27 16:35:27 +00:00
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
// TAnal_bill
|
|
|
|
///////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
int TAnal_bill::compare(const TSortable& s) const
|
|
|
|
{
|
|
|
|
const TAnal_bill& b = (const TAnal_bill&)s;
|
|
|
|
int cmp = _conto.compare(b._conto);
|
|
|
|
if (cmp == 0)
|
|
|
|
{
|
|
|
|
cmp = _costo.compare(b._costo);
|
|
|
|
if (cmp == 0)
|
|
|
|
{
|
|
|
|
cmp = _commessa.compare(b._commessa);
|
|
|
|
if (cmp == 0)
|
|
|
|
cmp = _fase.compare(b._fase);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return cmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TAnal_bill::match(const TAnal_bill& b) const
|
|
|
|
{
|
|
|
|
if (b._conto.not_empty() && _conto != b._conto)
|
|
|
|
return false;
|
|
|
|
if (b._costo.not_empty() && _costo != b._costo)
|
|
|
|
return false;
|
|
|
|
if (b._commessa.not_empty() && _commessa != b._commessa)
|
|
|
|
return false;
|
|
|
|
if (b._fase.not_empty() && _fase != b._fase)
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TAnal_bill::set_conto(const char* c)
|
|
|
|
{ _conto = c; _conto.trim(); }
|
|
|
|
|
|
|
|
void TAnal_bill::set_costo(const char* c)
|
|
|
|
{ _costo = c; _costo.trim(); }
|
|
|
|
|
|
|
|
void TAnal_bill::set_commessa(const char* c)
|
|
|
|
{ _commessa = c; _commessa.trim(); }
|
|
|
|
|
|
|
|
void TAnal_bill::set_fase(const char* c)
|
|
|
|
{ _fase = c; _fase.trim(); }
|
|
|
|
|
|
|
|
const TString& TAnal_bill::conto() const
|
|
|
|
{ return _conto; }
|
|
|
|
|
|
|
|
const TString& TAnal_bill::costo() const
|
|
|
|
{ return _costo; }
|
|
|
|
|
|
|
|
const TString& TAnal_bill::commessa() const
|
|
|
|
{ return _commessa; }
|
|
|
|
|
|
|
|
const TString& TAnal_bill::fase() const
|
|
|
|
{ return _fase; }
|
|
|
|
|
|
|
|
void TAnal_bill::reset()
|
|
|
|
{
|
|
|
|
_conto = _costo = _commessa = _fase = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TAnal_bill::get(const TRectype& rec)
|
|
|
|
{
|
|
|
|
bool ok = true;
|
|
|
|
reset();
|
|
|
|
switch(rec.num())
|
|
|
|
{
|
|
|
|
case LF_RMOVANA:
|
|
|
|
set_conto(rec.get(RMOVANA_CODCONTO));
|
|
|
|
set_costo(rec.get(RMOVANA_CODCCOSTO));
|
|
|
|
set_commessa(rec.get(RMOVANA_CODCMS));
|
|
|
|
set_fase(rec.get(RMOVANA_CODFASE));
|
|
|
|
break;
|
|
|
|
case LF_RIGHEDOC:
|
|
|
|
set_commessa(RDOC_CODCMS);
|
|
|
|
set_fase(RDOC_FASCMS);
|
|
|
|
break;
|
|
|
|
case LF_SALDANA:
|
|
|
|
set_conto(rec.get(SALDANA_CONTO));
|
|
|
|
set_costo(rec.get(SALDANA_COSTO));
|
|
|
|
set_commessa(rec.get(SALDANA_COMMESSA));
|
|
|
|
set_fase(rec.get(SALDANA_FASE));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ok = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return ok;
|
|
|
|
}
|
|
|
|
|
2005-07-07 17:05:02 +00:00
|
|
|
void TAnal_bill::copy(const TAnal_bill& b)
|
2005-06-27 16:35:27 +00:00
|
|
|
{
|
|
|
|
set_conto(b.conto());
|
|
|
|
set_costo(b.costo());
|
|
|
|
set_commessa(b.commessa());
|
|
|
|
set_fase(b.fase());
|
|
|
|
}
|
|
|
|
|
2005-07-07 17:05:02 +00:00
|
|
|
const TAnal_bill& TAnal_bill::operator=(const TAnal_bill& b)
|
|
|
|
{
|
|
|
|
copy(b);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
TAnal_bill::TAnal_bill()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
TAnal_bill::TAnal_bill(const TAnal_bill& b)
|
|
|
|
{ copy(b); }
|
|
|
|
|
2005-06-27 16:35:27 +00:00
|
|
|
TAnal_bill::TAnal_bill(const char* conto, const char* costo, const char* commessa, const char* fase)
|
|
|
|
{
|
|
|
|
set_conto(conto);
|
|
|
|
set_costo(costo);
|
|
|
|
set_commessa(commessa);
|
|
|
|
set_fase(fase);
|
|
|
|
}
|
|
|
|
|
|
|
|
TAnal_bill::TAnal_bill(const TRectype& rec)
|
|
|
|
{
|
|
|
|
get(rec);
|
|
|
|
}
|
|
|
|
|
2005-07-07 17:05:02 +00:00
|
|
|
////////////////////////////////////////////////////////
|
|
|
|
// TRiclassify_cache
|
|
|
|
////////////////////////////////////////////////////////
|
2005-06-23 12:16:21 +00:00
|
|
|
|
2005-07-07 17:05:02 +00:00
|
|
|
class TRiclassify_cache : public TCache
|
2005-06-24 11:24:40 +00:00
|
|
|
{
|
2005-07-07 17:05:02 +00:00
|
|
|
int _conto_min;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual TObject* key2obj(const char* key);
|
2005-08-08 11:55:59 +00:00
|
|
|
void extract(const TString& conto, TString_array& conti) const;
|
2005-07-07 17:05:02 +00:00
|
|
|
|
2005-06-24 11:24:40 +00:00
|
|
|
public:
|
2005-07-07 17:05:02 +00:00
|
|
|
const TString_array& conti(const TString& conto);
|
|
|
|
TRiclassify_cache();
|
2005-06-24 11:24:40 +00:00
|
|
|
};
|
|
|
|
|
2005-08-08 11:55:59 +00:00
|
|
|
void TRiclassify_cache::extract(const TString& conto, TString_array& conti) const
|
2005-06-23 12:16:21 +00:00
|
|
|
{
|
2005-07-07 17:05:02 +00:00
|
|
|
TRecord_array table(conto, LF_PANAPDC);
|
|
|
|
for (int r = table.last_row(); r > 0; r = table.pred_row(r))
|
2005-06-23 12:16:21 +00:00
|
|
|
{
|
2005-07-07 17:05:02 +00:00
|
|
|
const TRectype& row = table.row(r);
|
|
|
|
const TBill b(row);
|
|
|
|
conti.add(b.string(0x8));
|
|
|
|
}
|
|
|
|
}
|
2005-06-23 12:16:21 +00:00
|
|
|
|
2005-07-07 17:05:02 +00:00
|
|
|
TObject* TRiclassify_cache::key2obj(const char* key)
|
|
|
|
{
|
|
|
|
TString_array* k = new TString_array;
|
|
|
|
if (key && int(strlen(key)) > _conto_min)
|
|
|
|
{
|
|
|
|
extract(key, *k);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TString query = "USE PCONANA";
|
|
|
|
if (key && *key)
|
2005-06-23 12:16:21 +00:00
|
|
|
{
|
2005-07-07 17:05:02 +00:00
|
|
|
query << "\nFROM CODCONTO=" << key;
|
|
|
|
query << "\nTO CODCONTO=" << key;
|
2005-06-23 12:16:21 +00:00
|
|
|
}
|
2005-07-07 17:05:02 +00:00
|
|
|
TISAM_recordset pconana(query);
|
|
|
|
for (TRecnotype i = 0; pconana.move_to(i); i++)
|
2005-06-23 12:16:21 +00:00
|
|
|
{
|
2005-07-07 17:05:02 +00:00
|
|
|
const TString& conto = pconana.get(PCONANA_CODCONTO).as_string();
|
|
|
|
extract(conto, *k);
|
2005-06-23 12:16:21 +00:00
|
|
|
}
|
2005-07-07 17:05:02 +00:00
|
|
|
}
|
|
|
|
return k;
|
|
|
|
}
|
|
|
|
|
|
|
|
const TString_array& TRiclassify_cache::conti(const TString& conto)
|
|
|
|
{
|
|
|
|
return *(const TString_array*)objptr(conto);
|
|
|
|
}
|
|
|
|
|
|
|
|
TRiclassify_cache::TRiclassify_cache() : TCache(7)
|
|
|
|
{
|
|
|
|
const TMultilevel_code_info& info = ca_multilevel_code_info(LF_PCONANA);
|
|
|
|
_conto_min = info.total_len(-1); // Lunghezza conti fino al penultimo livello
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////
|
|
|
|
// TSaldi_cache
|
|
|
|
////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class TSaldi_cache : private TCache
|
|
|
|
{
|
|
|
|
TEsercizi_contabili _esc;
|
|
|
|
TRiclassify_cache _riclass;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual TObject* key2obj(const char* key);
|
|
|
|
|
|
|
|
bool int_saldo_annuale(const TAnal_bill& bill, int annoini, int annofin, word tipo, TImporto& dare, TImporto& avere) const;
|
|
|
|
bool int_saldo_movimenti(const TAnal_bill& bill, const TDate& dal, const TDate& al, word tipo, TSaldanal& s) const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool saldo_annuale(const TAnal_bill& bill, int annoini, int annofin, word tipo, TImporto& dare, TImporto& avere);
|
|
|
|
bool saldo_movimenti(const TAnal_bill& bill, const TDate& dal, const TDate& al, word tipo, TSaldanal& s);
|
|
|
|
bool saldi(const TAnal_bill& bill, const TDate& dal, const TDate& al, word tipo, TSaldanal& s);
|
|
|
|
|
|
|
|
public:
|
|
|
|
const TSaldanal& saldo(const TAnal_bill& bill, const TDate& dal, const TDate& al, word tipi = 0x1);
|
|
|
|
TSaldi_cache();
|
|
|
|
};
|
|
|
|
|
|
|
|
// Calcolo saldo annuale di un conto reale NON riclassificato
|
|
|
|
bool TSaldi_cache::int_saldo_annuale(const TAnal_bill& b, int da_anno, int ad_anno, word tipo,
|
|
|
|
TImporto& dare, TImporto& avere) const
|
|
|
|
{
|
|
|
|
CHECKD(ad_anno > 0, "Anno saldo finale errato: ", ad_anno);
|
|
|
|
|
|
|
|
bool movim = false;
|
|
|
|
TString query, select;
|
|
|
|
|
|
|
|
if (b.costo().not_empty())
|
|
|
|
select << "(COSTO=='" << b.costo() << "')";
|
|
|
|
if (b.commessa().not_empty())
|
|
|
|
{
|
|
|
|
if (select.not_empty()) select << "&&";
|
|
|
|
select << "(COMMESSA=='" << b.commessa() << "')";
|
|
|
|
}
|
|
|
|
if (b.fase().not_empty())
|
|
|
|
{
|
|
|
|
if (select.not_empty()) select << "&&";
|
|
|
|
select << "(FASE=='" << b.fase() << "')";
|
|
|
|
}
|
|
|
|
if (b.conto().not_empty() && da_anno != ad_anno)
|
|
|
|
{
|
|
|
|
if (select.not_empty()) select << "&&";
|
|
|
|
select << "(CONTO[1," << b.conto().len() << "]=='" << b.conto() << "')";
|
|
|
|
}
|
|
|
|
|
|
|
|
query << "USE SALDANA";
|
|
|
|
if (select.not_empty())
|
|
|
|
query << " SELECT " << select;
|
|
|
|
if (da_anno > 0)
|
|
|
|
{
|
|
|
|
query << "\nFROM ANNO=" << da_anno;
|
|
|
|
query << '\n';
|
|
|
|
}
|
|
|
|
|
|
|
|
query << "\nTO ANNO=" << ad_anno;
|
|
|
|
query << '\n';
|
|
|
|
|
|
|
|
TISAM_recordset saldini(query);
|
|
|
|
|
|
|
|
for (TRecnotype i = 0; saldini.move_to(i); i++)
|
|
|
|
{
|
|
|
|
char sez = ' ';
|
|
|
|
real imp;
|
|
|
|
if (tipo & _saldanal_consuntivo)
|
2005-06-24 15:07:14 +00:00
|
|
|
{
|
2005-07-07 17:05:02 +00:00
|
|
|
sez = saldini.get(SALDANA_SEZIONE).as_string()[0];
|
|
|
|
imp = saldini.get(SALDANA_SALDO).as_real();
|
2005-06-24 15:07:14 +00:00
|
|
|
}
|
2005-07-07 17:05:02 +00:00
|
|
|
if (tipo & _saldanal_preventivo)
|
|
|
|
{
|
|
|
|
sez = saldini.get(SALDANA_SEZIONEP).as_string()[0];
|
|
|
|
imp = saldini.get(SALDANA_SALDOP).as_real();
|
|
|
|
}
|
|
|
|
if (tipo & _saldanal_variazione)
|
|
|
|
{
|
|
|
|
sez = saldini.get(SALDANA_SEZIONEV).as_string()[0];
|
|
|
|
imp = saldini.get(SALDANA_SALDOV).as_real();
|
|
|
|
}
|
|
|
|
if (sez > ' ')
|
|
|
|
{
|
|
|
|
if (sez == 'D')
|
|
|
|
dare += TImporto('D', imp);
|
|
|
|
else
|
|
|
|
avere += TImporto('A', imp);
|
|
|
|
movim = true;
|
|
|
|
}
|
|
|
|
}
|
2005-06-23 12:16:21 +00:00
|
|
|
|
2005-07-07 17:05:02 +00:00
|
|
|
return movim;
|
|
|
|
}
|
2005-06-23 12:16:21 +00:00
|
|
|
|
2005-07-07 17:05:02 +00:00
|
|
|
bool TSaldi_cache::saldo_annuale(const TAnal_bill& b, int da_anno, int ad_anno, word tipo,
|
|
|
|
TImporto& dare, TImporto& avere)
|
|
|
|
{
|
|
|
|
bool movim = false;
|
|
|
|
if (ad_anno > 0)
|
|
|
|
{
|
|
|
|
if (tipo & _saldanal_riclassify)
|
2005-06-23 12:16:21 +00:00
|
|
|
{
|
2005-07-07 17:05:02 +00:00
|
|
|
// Legge tabella di riclassificazione
|
|
|
|
const TString_array& table = _riclass.conti(b.conto());
|
|
|
|
if (!table.empty())
|
2005-06-23 15:32:55 +00:00
|
|
|
{
|
2005-07-07 17:05:02 +00:00
|
|
|
TAnal_bill c(b); // Conto riclassificato
|
|
|
|
FOR_EACH_ARRAY_ROW(table, i, row)
|
|
|
|
{
|
|
|
|
c.set_conto(*row);
|
|
|
|
movim |= int_saldo_annuale(c, da_anno, ad_anno, tipo, dare, avere);
|
|
|
|
}
|
2005-06-23 15:32:55 +00:00
|
|
|
}
|
2005-06-23 12:16:21 +00:00
|
|
|
}
|
2005-07-07 17:05:02 +00:00
|
|
|
else
|
|
|
|
movim = int_saldo_annuale(b, da_anno, ad_anno, tipo, dare, avere);
|
2005-06-23 12:16:21 +00:00
|
|
|
}
|
2005-07-07 17:05:02 +00:00
|
|
|
return movim;
|
2005-06-23 12:16:21 +00:00
|
|
|
}
|
|
|
|
|
2005-07-07 17:05:02 +00:00
|
|
|
bool TSaldi_cache::int_saldo_movimenti(const TAnal_bill& b,
|
|
|
|
const TDate& dal, const TDate& al,
|
|
|
|
word tipo, TSaldanal& s) const
|
2005-06-23 12:16:21 +00:00
|
|
|
{
|
|
|
|
TDate dataini;
|
|
|
|
if (dal.ok())
|
|
|
|
{
|
2005-07-07 17:05:02 +00:00
|
|
|
const int annoprec = _esc.date2prevesc(dal);
|
2005-06-23 12:16:21 +00:00
|
|
|
if (annoprec > 0)
|
2005-07-07 17:05:02 +00:00
|
|
|
dataini = _esc[annoprec].fine()+1L;
|
2005-06-23 12:16:21 +00:00
|
|
|
}
|
|
|
|
|
2005-06-24 15:07:14 +00:00
|
|
|
TString query, select;
|
|
|
|
|
2005-06-27 16:35:27 +00:00
|
|
|
if (b.costo().not_empty())
|
2005-06-24 15:07:14 +00:00
|
|
|
{
|
|
|
|
if (select.not_empty())
|
|
|
|
select << "&&";
|
2005-06-27 16:35:27 +00:00
|
|
|
select << "(CODCOSTO==\"" << b.costo() << "\")";
|
2005-06-24 15:07:14 +00:00
|
|
|
}
|
2005-06-27 16:35:27 +00:00
|
|
|
if (b.commessa().not_empty())
|
2005-06-24 15:07:14 +00:00
|
|
|
{
|
|
|
|
if (select.not_empty())
|
|
|
|
select << "&&";
|
2005-06-27 16:35:27 +00:00
|
|
|
select << "(CODCMS==\"" << b.commessa() << "\")";
|
2005-06-24 15:07:14 +00:00
|
|
|
}
|
2005-06-27 16:35:27 +00:00
|
|
|
if (b.fase().not_empty())
|
2005-06-24 15:07:14 +00:00
|
|
|
{
|
|
|
|
if (select.not_empty())
|
|
|
|
select << "&&";
|
2005-06-27 16:35:27 +00:00
|
|
|
select << "(CODFASE==\"" << b.fase() << "\")";
|
2005-06-24 15:07:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
query << "USE RMOVANA KEY 2\n";
|
|
|
|
if (select.not_empty())
|
|
|
|
query << "SELECT " << select << "\n";
|
2005-06-23 12:16:21 +00:00
|
|
|
|
2005-06-27 16:35:27 +00:00
|
|
|
// Faccio la join solo se mi serve il tipo movimento in testata
|
2005-07-07 17:05:02 +00:00
|
|
|
const bool filtra_tipo = (tipo & _saldanal_qualsiasi) != 0 &&
|
|
|
|
(tipo & _saldanal_qualsiasi) != _saldanal_qualsiasi;
|
|
|
|
if (filtra_tipo)
|
2005-06-27 16:35:27 +00:00
|
|
|
query << "JOIN MOVANA INTO NUMREG==NUMREG\n";
|
|
|
|
|
|
|
|
query << "FROM CODCONTO=" << b.conto();
|
2005-06-23 12:16:21 +00:00
|
|
|
if (dataini.ok())
|
2005-06-27 16:35:27 +00:00
|
|
|
query << " DATACOMP=" << dataini;
|
2005-06-23 12:16:21 +00:00
|
|
|
query << "\n";
|
|
|
|
|
2005-06-27 16:35:27 +00:00
|
|
|
query << "TO CODCONTO=" << b.conto();
|
2005-06-23 12:16:21 +00:00
|
|
|
if (al.ok())
|
2005-06-27 16:35:27 +00:00
|
|
|
query << " DATACOMP=" << al;
|
2005-06-23 12:16:21 +00:00
|
|
|
query << "\n";
|
|
|
|
|
|
|
|
TISAM_recordset rmovana(query);
|
|
|
|
|
2005-07-07 17:05:02 +00:00
|
|
|
for (TRecnotype i = 0; rmovana.move_to(i); i++)
|
2005-06-23 12:16:21 +00:00
|
|
|
{
|
2005-06-27 16:35:27 +00:00
|
|
|
// Controllo il tipo movimento solo se necessario
|
2005-07-07 17:05:02 +00:00
|
|
|
if (filtra_tipo)
|
2005-06-27 16:35:27 +00:00
|
|
|
{
|
|
|
|
const char tipomov = rmovana.get("107.TIPOMOV").as_string()[0];
|
|
|
|
int ntipomov = 0;
|
|
|
|
if (tipomov == 'P')
|
2005-07-07 17:05:02 +00:00
|
|
|
ntipomov = _saldanal_preventivo; else
|
2005-06-27 16:35:27 +00:00
|
|
|
if (tipomov == 'V')
|
2005-07-07 17:05:02 +00:00
|
|
|
ntipomov = _saldanal_variazione;
|
2005-06-27 16:35:27 +00:00
|
|
|
else
|
2005-07-07 17:05:02 +00:00
|
|
|
ntipomov = _saldanal_consuntivo;
|
2005-06-27 16:35:27 +00:00
|
|
|
if ((ntipomov & tipo) == 0)
|
|
|
|
continue;
|
|
|
|
}
|
2005-06-23 15:32:55 +00:00
|
|
|
|
2005-06-24 16:40:56 +00:00
|
|
|
const TDate data = rmovana.get(RMOVANA_DATACOMP).as_date();
|
2005-06-23 12:16:21 +00:00
|
|
|
const TImporto imp(rmovana.get(RMOVANA_SEZIONE).as_string()[0],
|
|
|
|
rmovana.get(RMOVANA_IMPORTO).as_real());
|
|
|
|
if (data >= dal)
|
|
|
|
{
|
|
|
|
if (imp.sezione() == 'D')
|
2005-06-27 16:35:27 +00:00
|
|
|
s._dare += imp;
|
2005-06-23 12:16:21 +00:00
|
|
|
else
|
2005-06-27 16:35:27 +00:00
|
|
|
s._avere += imp;
|
|
|
|
s._movimentato = true;
|
2005-06-23 12:16:21 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-06-27 16:35:27 +00:00
|
|
|
s._ini += imp;
|
2005-06-23 12:16:21 +00:00
|
|
|
}
|
|
|
|
}
|
2005-06-27 16:35:27 +00:00
|
|
|
return s._movimentato;
|
2005-06-23 12:16:21 +00:00
|
|
|
}
|
|
|
|
|
2005-07-07 17:05:02 +00:00
|
|
|
bool TSaldi_cache::saldo_movimenti(const TAnal_bill& b,
|
|
|
|
const TDate& dal, const TDate& al,
|
|
|
|
word tipo, TSaldanal& s)
|
2005-06-23 12:16:21 +00:00
|
|
|
{
|
2005-07-07 17:05:02 +00:00
|
|
|
bool movim = false;
|
|
|
|
if (tipo & _saldanal_riclassify)
|
|
|
|
{
|
|
|
|
// Legge tabella di riclassificazione
|
|
|
|
const TString_array& table = _riclass.conti(b.conto());
|
|
|
|
if (!table.empty())
|
|
|
|
{
|
|
|
|
TAnal_bill c(b); // Conto riclassificato
|
|
|
|
FOR_EACH_ARRAY_ROW(table, i, row)
|
|
|
|
{
|
|
|
|
c.set_conto(*row);
|
|
|
|
movim |= int_saldo_movimenti(c, dal, al, tipo, s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
movim = int_saldo_movimenti(b, dal, al, tipo, s);
|
|
|
|
return movim;
|
2005-06-23 12:16:21 +00:00
|
|
|
}
|
2005-06-24 11:24:40 +00:00
|
|
|
|
2005-07-07 17:05:02 +00:00
|
|
|
bool TSaldi_cache::saldi(const TAnal_bill& bill,
|
|
|
|
const TDate& dal, const TDate& al, word tipo,
|
|
|
|
TSaldanal& s)
|
2005-06-24 11:24:40 +00:00
|
|
|
{
|
2005-07-07 17:05:02 +00:00
|
|
|
// Calcolo i saldi fino all'anno scorso.
|
|
|
|
// In assemza di data iniziale mi torna 0
|
|
|
|
const int anno_prec = _esc.date2prevesc(dal);
|
|
|
|
if (anno_prec > 0)
|
|
|
|
{
|
|
|
|
TImporto dare, avere;
|
|
|
|
saldo_annuale(bill, 0, anno_prec, tipo, dare, avere);
|
|
|
|
s._ini = dare;
|
|
|
|
s._ini += avere;
|
|
|
|
}
|
2005-06-27 16:35:27 +00:00
|
|
|
|
2005-07-07 17:05:02 +00:00
|
|
|
if (tipo & _saldanal_ultima_imm)
|
|
|
|
{
|
|
|
|
// Calcolo i saldi di quest'anno
|
|
|
|
// In assemza di data iniziale somma tutti gli anni (fino al 9999)
|
|
|
|
const int anno_ini = _esc.date2esc(dal);
|
|
|
|
const int anno_fin = anno_ini > 0 ? anno_ini : 9999;
|
|
|
|
s._movimentato = saldo_annuale(bill, anno_ini, anno_fin, tipo, s._dare, s._avere);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
saldo_movimenti(bill, dal, al, tipo, s);
|
|
|
|
}
|
|
|
|
s._ini.normalize();
|
|
|
|
s._fin = s._ini;
|
|
|
|
s._fin += s._dare;
|
|
|
|
s._fin += s._avere;
|
|
|
|
s._fin.normalize();
|
2005-06-24 11:24:40 +00:00
|
|
|
|
2005-07-07 17:05:02 +00:00
|
|
|
return s._movimentato;
|
|
|
|
}
|
2005-06-24 11:24:40 +00:00
|
|
|
|
|
|
|
TObject* TSaldi_cache::key2obj(const char* key)
|
|
|
|
{
|
|
|
|
TSaldanal* s = new TSaldanal;
|
|
|
|
|
|
|
|
TToken_string tok(key);
|
2005-06-27 16:35:27 +00:00
|
|
|
const TAnal_bill bill(tok.get(0), tok.get(1), tok.get(2), tok.get(3));
|
|
|
|
const TDate dal = tok.get(4); // Le get precedenti avvengono in ordine inverso!
|
2005-06-24 11:24:40 +00:00
|
|
|
const TDate al = tok.get();
|
2005-06-27 16:35:27 +00:00
|
|
|
const int tipo = tok.get_int();
|
2005-08-08 11:55:59 +00:00
|
|
|
saldi(bill, dal, al, tipo, *s);
|
2005-06-24 11:24:40 +00:00
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2005-06-27 16:35:27 +00:00
|
|
|
const TSaldanal& TSaldi_cache::saldo(const TAnal_bill& bill, const TDate& dal, const TDate& al, word tipi)
|
2005-06-24 11:24:40 +00:00
|
|
|
{
|
|
|
|
TToken_string key;
|
2005-06-27 16:35:27 +00:00
|
|
|
key.add(bill.conto(), 0);
|
|
|
|
key.add(bill.costo(), 1);
|
|
|
|
key.add(bill.commessa(), 2);
|
|
|
|
key.add(bill.fase(), 3);
|
2005-06-24 11:24:40 +00:00
|
|
|
key.add(dal, 4);
|
|
|
|
key.add(al, 5);
|
|
|
|
key.add(tipi, 6);
|
|
|
|
return *(const TSaldanal*)objptr(key);
|
|
|
|
}
|
|
|
|
|
2005-07-07 17:05:02 +00:00
|
|
|
|
|
|
|
TSaldi_cache::TSaldi_cache() : TCache(3881) // Numero primo
|
|
|
|
{ }
|
|
|
|
|
2005-06-27 16:35:27 +00:00
|
|
|
const TSaldanal& ca_saldo(const TAnal_bill& bill, const TDate& dal, const TDate& al, word tipi)
|
2005-06-24 11:24:40 +00:00
|
|
|
{
|
|
|
|
static TSaldi_cache* cache = NULL;
|
2005-06-24 11:28:19 +00:00
|
|
|
if (cache == NULL)
|
2005-06-24 11:24:40 +00:00
|
|
|
cache = new TSaldi_cache;
|
2005-06-27 16:35:27 +00:00
|
|
|
return cache->saldo(bill, dal, al, tipi);
|
2005-06-24 11:24:40 +00:00
|
|
|
}
|