Patch level : 12.0 394

Files correlati     : cg4.exe

Corretto in funzionamento per fatture per cassa
Corretta stampa registri per l'ultima registrazione stampata 2 volte in certe condizioni

git-svn-id: svn://10.65.10.50/branches/R_10_00@23832 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
bonazzi 2017-05-20 20:14:09 +00:00
parent 8cb639765b
commit 25dbb8e2d4
2 changed files with 117 additions and 117 deletions

View File

@ -1639,8 +1639,12 @@ void TStampa_registri_app::set_page_tot_reg()
}
} // for
}
if (printed)
{
flush();
fine_mese();
}
if (_stampa_plafonds)
stampa_plafonds(rr);
}
@ -2651,134 +2655,129 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
return true;
}
void TStampa_registri_app::fine_mese()
{
const TRecnotype pos = _cur->pos();
const TRecnotype items = _cur->items();
const bool last_mov = pos == items-1;
if (_stampa_plafonds && !last_mov)
{
// Nel caso sia richiesta la stampa prospetto mensile plafond e vi siano mesi
// senza movimenti, è necessario forzarne la stampa
const TDate save_date(_datareg);
// Caso speciale, in cui non vi siano movimenti sull'ultimo mese indicato in stampa
//const bool print_over = last_mov && _dataregp == _dataregs && _dataregp.month() < _data_a.month();
const int m1 = _dataregp.month()+1;
const int m2 = _dataregs.month();
for (int kk = m1; kk < m2; kk++)
{
_datareg = TDate(1, kk, _annoes);
if (stampa_plafonds(-1, true))
{
printer().formfeed();
stampa_plafonds(-1);
}
}
_datareg = save_date;
}
const int a_mese = _datareg.month();
int da_mese = 0;
if (_frequiva == 'T')
{
if (a_mese % 3 == 0)
da_mese = a_mese-2;
}
else
da_mese = a_mese;
if (da_mese > 0)
{
if (some_IVAxCassa(da_mese, a_mese))
{
printer().formfeed();
print_IVAxCassa(da_mese, a_mese);
da_mese = 0; // vieta ristampa!
}
_riga_prospettoXcassa.destroy(); // Elimina comunque tracking movimenti
}
if (_liquidazione)
{
if (!_st_liq[a_mese] && stampo_liquidazione(a_mese))
{
_st_liq[a_mese] = true;
if (_scelta == B0_settato)
liq_b0_settato();
if (_scelta == prosegui_stampa || _scelta == prosegui_cal_stampa)
{
if (_t.exist())
{
printer().formfeed();
_intesta_liq = true;
merge_export_file(_t,false,true);
_intesta_liq = false;
remove(_t);
}
}
}
}
if (last_mov)
{
if (_stampa_plafonds || (_tipo_stampa != libro_unico && _liquidazione))
stampa_liq_mesi_succ();
if (_tipo_stampa != prova)
{
int da = _datareg.month() + 1;
int a = _data_a.month();
for (int m=da; m<=a; m++)
{
TDate data(1, m, _annoes);
data.set_end_month();
scrivi_reg(data);
}
}
}
}
print_action TStampa_registri_app::postprocess_page (int file, int counter)
{
if (file == LF_MOV)
{
if (counter) //dopo aver fatto un REPEAT_PAGE (cioe' dopo aver stampato
//le righe settate in set_page_tot_reg()), in pratica a rottura di mese o alla fine
const TRectype& mov = _cur->curr(LF_MOV);
const TRecnotype pos = _cur->pos();
const long items = _cur->items();
const bool FINITO = (pos == items-1);
if ( FINITO )
{
reset_print();
const TRecnotype pos = _cur->pos();
const TRecnotype items = _cur->items();
const bool last_mov = pos == items-1;
if (_stampa_plafonds && !last_mov)
{
// Nel caso sia richiesta la stampa prospetto mensile plafond e vi siano mesi
// senza movimenti, è necessario forzarne la stampa
const TDate save_date(_datareg);
// Caso speciale, in cui non vi siano movimenti sull'ultimo mese indicato in stampa
//const bool print_over = last_mov && _dataregp == _dataregs && _dataregp.month() < _data_a.month();
const int m1 = _dataregp.month()+1;
const int m2 = _dataregs.month();
for (int kk = m1; kk < m2; kk++)
{
_datareg = TDate(1, kk, _annoes);
if (stampa_plafonds(-1, true))
{
printer().formfeed();
stampa_plafonds(-1);
}
}
_datareg = save_date;
}
const int a_mese = _datareg.month();
int da_mese = 0;
if (_frequiva == 'T')
{
if (a_mese % 3 == 0)
da_mese = a_mese-2;
}
else
da_mese = a_mese;
if (da_mese > 0)
{
if (some_IVAxCassa(da_mese, a_mese))
{
printer().formfeed();
print_IVAxCassa(da_mese, a_mese);
da_mese = 0; // vieta ristampa!
}
_riga_prospettoXcassa.destroy(); // Elimina comunque tracking movimenti
}
if (_liquidazione)
{
if (!_st_liq[a_mese] && stampo_liquidazione(a_mese))
{
_st_liq[a_mese] = true;
if (_scelta == B0_settato)
liq_b0_settato();
if (_scelta == prosegui_stampa || _scelta == prosegui_cal_stampa)
{
if (_t.exist())
{
printer().formfeed();
_intesta_liq = true;
merge_export_file(_t,false,true);
_intesta_liq = false;
remove(_t);
}
}
}
}
if (last_mov)
{
if (_stampa_plafonds || (_tipo_stampa != libro_unico && _liquidazione))
stampa_liq_mesi_succ();
if (_tipo_stampa != prova)
{
int da = _datareg.month() + 1;
int a = _data_a.month();
for (int m=da; m<=a; m++)
{
TDate data(1, m, _annoes);
data.set_end_month();
scrivi_reg(data);
}
}
}
}
else
liq_other_case();
if (_tipo_stampa != prova)
calcola_progressivi();
set_page_tot_reg();
return NEXT_PAGE;
}
else
{
const TRectype& mov = _cur->curr(LF_MOV);
const TRecnotype pos = _cur->pos();
const long items = _cur->items();
const bool FINITO = (pos == items-1);
if ( FINITO )
_cur->save_status();
++(*_cur);
_dataregs = mov.get_date(MOV_DATAREG);
--(*_cur);
_cur->restore_status();
if (_dataregs.month() != _dataregp.month())
{
liq_other_case();
if (_tipo_stampa != prova)
calcola_progressivi();
set_page_tot_reg();
return NEXT_PAGE;
return NEXT_PAGE;
}
else
{
_cur->save_status();
++(*_cur);
_dataregs = mov.get_date(MOV_DATAREG);
--(*_cur);
_cur->restore_status();
if (_dataregs.month() != _dataregp.month())
{
liq_other_case();
if (_tipo_stampa != prova)
calcola_progressivi();
set_page_tot_reg();
return NEXT_PAGE;
}
}
}
}
}
return NEXT_PAGE;
}

View File

@ -124,7 +124,8 @@ public:
void set_choice_limits(TMask&);
void build_ditte_sheet(int flags);
tiporeg cerca_reg(const TString&);
void set_page_tot_reg();
void fine_mese();
void set_page_tot_reg();
void send_message(char,const TFilename&,int);
void aggiorna_reg(const bool aggiorna_vidi);
void aggiorna_lib();