Martellata per benino la stampa scaduto: sistemata la stampa totali e

la stampa intestazione cli/fo. La maggior parte delle modifiche
riguarda la preprocess_page().


git-svn-id: svn://10.65.10.50/trunk@2973 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
angelo 1996-06-06 16:07:42 +00:00
parent e14fef8edd
commit f820668b01

View File

@ -69,7 +69,6 @@ class TStampaScaduto : public TPrintapp
TRelation *_rel1, *_rel2; // Relazioni di lavoro...
int _cur1, _cur2, // Identificatori dei cursori di lavoro...
_cur3, _cur4;
int _pending_total;
TSelection_ext_mask *_m;
TLocalisamfile *_scad,*_pagsca;
@ -345,8 +344,7 @@ void TStampaScaduto::compute_all(TPartita& p)
bool TStampaScaduto::preprocess_page(int file, int counter)
{
TRectype& rc = current_cursor()->curr(file);
int lastgood = 0;
TRectype rc(current_cursor()->curr(file));
if (file == LF_PARTITE)
{
@ -358,12 +356,11 @@ bool TStampaScaduto::preprocess_page(int file, int counter)
else
if (_tipost == altri)
rec = current_cursor()->curr(LF_PCON);
int nriga = 1;
int nriga = 1;
bool checked = cs.checked(c->read(_isequal));
if (!checked && !_end_printed) // Se non e' stato selezionato salta alla prossima part
if (!checked && !_end_printed) // Se non e' stato selezionato salta al prossimo record
return FALSE;
if (_tipost == clienti || _tipost == fornitori)
@ -382,45 +379,34 @@ bool TStampaScaduto::preprocess_page(int file, int counter)
if (_cod != _cod_pre || _end_printed) // Controlla se e' cambiato il codice cli/fo/conto
{
reset_print();
if (_pending_total > 0 || _end_printed) // stampa i totali del precedente solo se non e' la prima
if (_cod_pre != "") // stampa i totali del precedente solo se non e' la prima
{
TAssoc_array& a = (TAssoc_array&) _t[0];
if (a.items() > 0)
{
TAssoc_array& sin_tot = (TAssoc_array&) _t[0];
if (sin_tot.items() > 0)
print_totali(nriga);
lastgood = nriga;
_pending_total = 0;
if (_end_printed)
return TRUE; // Go back, print and exit!
if (_end_printed)
{
TAssoc_array& gen_tot = (TAssoc_array&) _t[1];
if (gen_tot.items() > 0)
{
set_row(nriga,"TOTALE GENERALE");
print_totali_rows(nriga,1);
}
return TRUE; // Go back, print and exit!
}
}
if (checked)
{
_pending_clifo = TRUE;
_cod_pre = _cod;
}
_cod_pre = _cod;
_pending_clifo = TRUE;
}
TPartita p(rc);
int r = p.prima_fattura();
if (rc.get_int(PART_NRIGA) == 1)
{
_pending_total++;
if (_pending_clifo)
{
set_page_clifoco(nriga); // Setta le righe per stampare le informazioni del cli/fo/conto
_pending_clifo = FALSE;
set_row(++nriga,"");
nriga++;
}
if (r > 0)
set_page_part(nriga);
}
//Pesca gli estremi dalla prima riga di fattura, che non e' necessariamente la riga #1
int r = p.prima_fattura();
if (r < 1) return TRUE; // se non ci sono fatture ... salta al prossimo
_residuo = "";
_nonscad = "";
_buonfin = "";
@ -446,37 +432,23 @@ bool TStampaScaduto::preprocess_page(int file, int counter)
}
current_cursor()->repos(); // Very, very necessary...
if (r < 1)
// Se c'e' qualcosa da stampare (ovvero almeno un importo non nullo)
const bool to_print = !_residuo.empty() || !_nonscad.empty() || !_sc_1.empty() || !_sc_2.empty() ||
!_sc_3.empty() || !_sc_4.empty() || !_sc_5.empty() || !_sc_6.empty() || (_tipost == clienti && !_buonfin.empty());
if (to_print)
{
_pending_total--;
if (_pending_clifo)
_pending_clifo = (_pending_total > 0);
return TRUE;
}
if (_residuo.empty() && _nonscad.empty() && _sc_1.empty() && _sc_2.empty() &&
_sc_3.empty() && _sc_4.empty() && _sc_5.empty() && _sc_6.empty())
{
if (_tipost == clienti)
if (rc.get_int(PART_NRIGA) == 1)
{
if (_buonfin.empty())
{
// se ha stampato i totali precedenti deve mantenerli
for (int i = lastgood; i <= nriga; i++) reset_row(i);
_pending_total--;
if (_pending_clifo)
_pending_clifo = (_pending_total > 0);
return lastgood;
if (_pending_clifo)
{
set_page_clifoco(nriga); // Setta le righe per stampare le informazioni del cli/fo/conto
set_row(++nriga,"");
nriga++;
_pending_clifo = FALSE;
}
set_page_part(nriga);
}
else
{
for (int i = lastgood; i <= nriga; i++) reset_row(i);
_pending_total--;
if (_pending_clifo) _pending_clifo = (_pending_total > 0);
return lastgood;
}
}
}
return TRUE;
@ -568,8 +540,7 @@ bool TStampaScaduto::set_print(int)
else _tipost = fornitori;
if (_m->get_key() == 1) _ordcod = TRUE;
else _ordcod = FALSE;
_end_printed = _pending_clifo =FALSE;
_pending_total = 0;
_end_printed = _pending_clifo = FALSE;
_gcr = _m->get_int(F_GIORNI);
_stvaluta = _m->get_bool(F_VALUTA);
_datas = (const char *)(_m->get(F_DATASTAMPA));
@ -707,22 +678,18 @@ void TStampaScaduto::print_totali_rows(int& nriga, bool what)
}
void TStampaScaduto::print_totali(int& nriga)
// Riconosce all'interno se stampare o meno anche il totale generale
{
TString s("CLIENTE");
if (_tipost == fornitori) s = "FORNITORE";
else if (_tipost == altri) s = "CONTO";
reset_row(nriga);
set_row(nriga++,"");
reset_row(nriga);
set_row(nriga,"TOTALE %s",(const char*) s);
print_totali_rows(nriga,0);
set_row(nriga++,"");
if (_end_printed)
{
set_row(nriga,"TOTALE GENERALE");
print_totali_rows(nriga,1);
set_row(nriga++,"");
}
set_row(++nriga,"");
nriga++;
}
void TStampaScaduto::print_header()