Patch level : 120.00 1412

Files correlati     : sc2.exe
Commento                :
Corretta stampa prospetto pagamenti
This commit is contained in:
alex 2026-05-06 14:09:56 +02:00
parent 2bfdd76218
commit c441ab7af8

View File

@ -96,6 +96,8 @@ class TProspettoScadenze : public TPrintapp
_nsinfasce;
TString _anno,_numdoc,_protiva,_datadoc,_codval, _codvalsel,
_cod, _cod_pre, _des, _des_pre;
long _first;
long _last;
TDate _limop, _limscad, _datas, _limbf; // Data limite operazione, data limite scaduto e data di stampa
int _gcr, // Giorni per Calcolo Rischio (valido solo per stampa clienti)
_sfasce,
@ -124,9 +126,9 @@ public:
virtual bool user_destroy();
virtual bool set_print(int);
virtual void set_page (int file, int counter);
void print_totali_rows(int nriga, bool what);
void print_totali_rows(int nriga, bool what, TAssoc_array * l = nullptr);
void export_totali_rows();
void print_totali(int nriga);
void print_totali(int nriga, TAssoc_array * l = nullptr);
void print_header();
int calc_last_column();
@ -135,7 +137,7 @@ public:
void compute_all(TPartita& p);
void print_real(TString& dest, const real& num);
void riempi_conti_mastro(const char * cf);
void calcola_saldo();
void calcola_saldo(TAssoc_array * l = nullptr);
TProspettoScadenze();
};
@ -383,9 +385,9 @@ void TProspettoScadenze::compute_all(TPartita& p)
update_totals(1, esposto, s, ns); // ...Generale
}
void TProspettoScadenze::calcola_saldo()
void TProspettoScadenze::calcola_saldo(TAssoc_array * l)
{
TAssoc_array& a = (TAssoc_array&) _t[0];
TAssoc_array& a = l == nullptr ? (TAssoc_array&) _t[0] : *l;
TLineTotal *ll = (TLineTotal *) a.objptr(_codval);
TEsercizi_contabili e;
TSaldo saldo;
@ -413,7 +415,7 @@ void TProspettoScadenze::calcola_saldo()
// aggiorno il totale generale
TAssoc_array& at = (TAssoc_array&) _t[1];
TLineTotal *lt = (TLineTotal *) at.objptr(_codval);
if (lt == NULL)
if (lt == nullptr)
{
lt = new TLineTotal;
at.add(_codval, lt);
@ -432,29 +434,45 @@ bool TProspettoScadenze::preprocess_page(int file, int counter)
if (!checked && !_end_printed) // Se non e' stato selezionato salta al prossimo record
return false;
// int nriga = 1;
if (_tipost == clienti || _tipost == fornitori)
if (_tipost == clienti || _tipost == fornitori)
{
const TRectype& clifo = current_cursor()->curr(LF_CLIFO);
_des = clifo.get(CLI_RAGSOC);
_cod = clifo.get(CLI_CODCF);
}
else
{
const TRectype& pcon = current_cursor()->curr(LF_PCON);
_des = pcon.get(PCN_DESCR);
_cod = pcon.get(PCN_GRUPPO);
_cod << " " << pcon.get(PCN_CONTO);
_cod << " " << pcon.get(PCN_SOTTOCONTO);
}
}
if (_cod != _cod_pre || _end_printed) // Controlla se e' cambiato il codice cli/fo/conto
{
reset_print();
if (((TAssoc_array&) _t[0]).items() > 0)
print_totali(1);
if (((TAssoc_array&)_t[0]).items() > 0)
{
print_totali(1);
print_one(0);
reset_print();
}
_des.trim();
long cod = atol(_cod_pre) + 1;
if (cod > _first)
for (; cod < atol(_cod); cod++)
{
if (_tipost == clienti || _tipost == fornitori)
{
TToken_string key = _tipost == clienti ? "C" : "F";
key.add(cod);
const TRectype& clifo = cache().get(LF_CLIFO, key);
_des_pre = clifo.get(CLI_RAGSOC);
_cod_pre = clifo.get(CLI_CODCF);
}
TAssoc_array xassoc;
xassoc.add(_codval, new TLineTotal);
print_totali(1, &xassoc);
print_one(0);
}
_cod_pre = _cod;
_des_pre = _des;
}
@ -564,10 +582,12 @@ bool TProspettoScadenze::open_print()
long cli_first = 0, cli_last = 0;
_m->get_clifo_range(cli_first, cli_last);
if (cli_first > 0)
_first = cli_first;
if (cli_first > 0)
filter_from.put(PART_SOTTOCONTO, cli_first);
if (cli_last >= cli_first)
_last = cli_last;
if (cli_last >= cli_first)
filter_to.put(PART_SOTTOCONTO, cli_last);
}
@ -638,11 +658,35 @@ print_action TProspettoScadenze::postprocess_print(int file, int counter)
{
print_totali(1);
print_one(0);
reset_print();
}
long cod = atol(_cod_pre) + 1;
if (cod > _first)
for (; cod <= _last; cod++)
{
if (_tipost == clienti || _tipost == fornitori)
{
TToken_string key = _tipost == clienti ? "C" : "F";
key.add(cod);
const TRectype& clifo = cache().get(LF_CLIFO, key);
_des_pre = clifo.get(CLI_RAGSOC);
_cod_pre = clifo.get(CLI_CODCF);
}
TAssoc_array xassoc;
xassoc.add(_codval, new TLineTotal);
print_totali(1, &xassoc);
print_one(0);
}
if (((TAssoc_array&) _t[1]).items() > 0)
{
print_totali_rows(1,1);
print_one(0);
reset_print();
}
}
return rt;
@ -736,7 +780,7 @@ bool TProspettoScadenze::set_print(int)
if (!repeat)
{
TDate data = today;
data.set_end_month();
if (!_m->get_date(F_DATASCADUTO).ok())
_m->set(F_DATASCADUTO, data);
@ -759,11 +803,11 @@ bool TProspettoScadenze::set_print(int)
return print;
}
void TProspettoScadenze::print_totali_rows(int nriga, bool what)
void TProspettoScadenze::print_totali_rows(int nriga, bool what, TAssoc_array * l)
// If what is 0 prints single total... else prints also general total
{
reset_print();
TAssoc_array& xassoc = (TAssoc_array&) _t[what];
TAssoc_array& xassoc = l == nullptr ? (TAssoc_array&) _t[what] : *l;
if (_cod_pre.blank())
{
xassoc.destroy();
@ -774,18 +818,17 @@ void TProspettoScadenze::print_totali_rows(int nriga, bool what)
xassoc.get_keys(as);
as.sort();
for (int i=0; i < items; i++)
for (int i=0; i < items; i++)
{
if (!what && !_excel)
calcola_saldo();
TString k(as.row(i)); // Chiave di ordinamento(valuta)
TString value;
TLineTotal& v = (TLineTotal&)xassoc[k];
real tot = ZERO;
int pos = 49;
TString rw(255);
if (!what && !_excel)
calcola_saldo(l);
rw = "";
if (_sinfasce)
{
@ -961,12 +1004,12 @@ void TProspettoScadenze::export_totali_rows()
}
}
void TProspettoScadenze::print_totali(int nriga)
void TProspettoScadenze::print_totali(int nriga, TAssoc_array * l)
{
reset_row(nriga);
if (_excel)
export_totali_rows();
print_totali_rows(nriga, 0);
print_totali_rows(nriga, 0, l);
}
void TProspettoScadenze::print_header()