Patch level : 12.00 1412
Files correlati : cg4.exe Commento : Corretta stampa registri
This commit is contained in:
parent
e09b886b9c
commit
f5b1b74396
@ -137,7 +137,7 @@ const TRectype& TStampa_registri_app::look_comuni (const char* cod)
|
|||||||
void TStampa_registri_app::get_dati_ditta()
|
void TStampa_registri_app::get_dati_ditta()
|
||||||
{
|
{
|
||||||
const TRectype& nditte = cache().get(LF_NDITTE, get_firm());
|
const TRectype& nditte = cache().get(LF_NDITTE, get_firm());
|
||||||
|
|
||||||
_ragsoc = nditte.get(NDT_RAGSOC);
|
_ragsoc = nditte.get(NDT_RAGSOC);
|
||||||
|
|
||||||
TToken_string key; key.format("%ld|%s", get_firm(), (const char*) _codatt);
|
TToken_string key; key.format("%ld|%s", get_firm(), (const char*) _codatt);
|
||||||
@ -737,7 +737,7 @@ void TStampa_registri_app::build_ditte_sheet(int flags)
|
|||||||
|
|
||||||
TBit_array sel;
|
TBit_array sel;
|
||||||
FOR_EACH_CHECKED_ROW(*_ditte, r, riga)
|
FOR_EACH_CHECKED_ROW(*_ditte, r, riga)
|
||||||
{
|
{
|
||||||
const long ditta = riga->get_long(1);
|
const long ditta = riga->get_long(1);
|
||||||
sel.set(ditta);
|
sel.set(ditta);
|
||||||
}
|
}
|
||||||
@ -754,11 +754,13 @@ void TStampa_registri_app::build_ditte_sheet(int flags)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
d.insert(" |", 0);
|
d.insert(" |", 0);
|
||||||
const long pos = _ditte->add(d);
|
|
||||||
if (vers == '?')
|
const long pos = _ditte->add(d);
|
||||||
|
|
||||||
|
if (vers == '?')
|
||||||
_ditte->disable_row(pos);
|
_ditte->disable_row(pos);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const long ditta = d.get_long(1);
|
const long ditta = d.get_long(1);
|
||||||
if (sel[ditta])
|
if (sel[ditta])
|
||||||
_ditte->check(pos); // Ripristino eventuale selezione precedente
|
_ditte->check(pos); // Ripristino eventuale selezione precedente
|
||||||
@ -766,8 +768,8 @@ void TStampa_registri_app::build_ditte_sheet(int flags)
|
|||||||
good_one = pos; else
|
good_one = pos; else
|
||||||
if (good_one >= 0)
|
if (good_one >= 0)
|
||||||
good_one = -2;
|
good_one = -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (good_one >= 0 && !_ditte->one_checked())
|
if (good_one >= 0 && !_ditte->one_checked())
|
||||||
_ditte->check(good_one);
|
_ditte->check(good_one);
|
||||||
}
|
}
|
||||||
@ -942,10 +944,10 @@ bool TStampa_registri_app::user_create()
|
|||||||
|
|
||||||
bool TStampa_registri_app::user_destroy()
|
bool TStampa_registri_app::user_destroy()
|
||||||
{
|
{
|
||||||
delete _ditte;
|
safe_delete(_ditte);
|
||||||
delete _nditte;
|
safe_delete(_nditte);
|
||||||
delete _tabreg;
|
safe_delete(_tabreg);
|
||||||
delete _rel;
|
safe_delete(_rel);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1115,6 +1117,7 @@ int TStampa_registri_app::riga_rmoviva(const bool fattrit)
|
|||||||
|
|
||||||
const TRectype& mov = _cur->curr(LF_MOV);
|
const TRectype& mov = _cur->curr(LF_MOV);
|
||||||
const int mese_liq = mov.get_int(MOV_MESELIQ);
|
const int mese_liq = mov.get_int(MOV_MESELIQ);
|
||||||
|
const int mese_corr = mov.get_date(MOV_DATAREG).month();
|
||||||
|
|
||||||
TLocalisamfile& rmoviva = _cur->file(LF_RMOVIVA);
|
TLocalisamfile& rmoviva = _cur->file(LF_RMOVIVA);
|
||||||
const TRecnotype nr = rmoviva.recno();
|
const TRecnotype nr = rmoviva.recno();
|
||||||
@ -1149,20 +1152,20 @@ int TStampa_registri_app::riga_rmoviva(const bool fattrit)
|
|||||||
{
|
{
|
||||||
const real somma = -(impo + impos);
|
const real somma = -(impo + impos);
|
||||||
_tot_iva_array.add_riga(ZERO,ZERO,somma,ZERO,ZERO,ZERO,codiva);
|
_tot_iva_array.add_riga(ZERO,ZERO,somma,ZERO,ZERO,ZERO,codiva);
|
||||||
if (mese_liq != 0)
|
if (mese_liq > 0 && mese_liq < mese_corr)
|
||||||
_tot_prec_iva_array.add_riga(ZERO,ZERO,somma,ZERO,ZERO,ZERO,codiva);
|
_tot_prec_iva_array.add_riga(ZERO,ZERO,somma,ZERO,ZERO,ZERO,codiva);
|
||||||
}
|
}
|
||||||
else if (_tipodoc == "CR" || _tipodoc == "RF" || _tipodoc == "SC")
|
else if (_tipodoc == "CR" || _tipodoc == "RF" || _tipodoc == "SC")
|
||||||
{
|
{
|
||||||
_tot_iva_array.add_riga(ZERO,ZERO,impo+impos,ZERO,ZERO,ZERO,codiva);
|
_tot_iva_array.add_riga(ZERO,ZERO,impo+impos,ZERO,ZERO,ZERO,codiva);
|
||||||
if (mese_liq != 0)
|
if (mese_liq > 0 && mese_liq < mese_corr)
|
||||||
_tot_prec_iva_array.add_riga(ZERO,ZERO,impo+impos,ZERO,ZERO,ZERO,codiva);
|
_tot_prec_iva_array.add_riga(ZERO,ZERO,impo+impos,ZERO,ZERO,ZERO,codiva);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_tipodoc != "CR" && _tipodoc != "SC" && _tipodoc != "RF")
|
if (_tipodoc != "CR" && _tipodoc != "SC" && _tipodoc != "RF")
|
||||||
{
|
{
|
||||||
_tot_iva_array.add_riga(impo,impos,codiva);
|
_tot_iva_array.add_riga(impo,impos,codiva);
|
||||||
if (mese_liq != 0)
|
if (mese_liq > 0 && mese_liq < mese_corr)
|
||||||
_tot_prec_iva_array.add_riga(impo,impos,codiva);
|
_tot_prec_iva_array.add_riga(impo,impos,codiva);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1185,7 +1188,8 @@ int TStampa_registri_app::setta_riga(int r, const TRigaiva& riga, real& tot1,
|
|||||||
TString descrizione = descr_iva(riga._codiva);
|
TString descrizione = descr_iva(riga._codiva);
|
||||||
if (riga._tipocr > 0)
|
if (riga._tipocr > 0)
|
||||||
{
|
{
|
||||||
const char* cr = NULL;
|
const char* cr = nullptr;
|
||||||
|
|
||||||
switch (riga._tipocr)
|
switch (riga._tipocr)
|
||||||
{
|
{
|
||||||
case 1: cr = TR("Beni per rivendita"); break;
|
case 1: cr = TR("Beni per rivendita"); break;
|
||||||
@ -1335,7 +1339,7 @@ bool TStampa_registri_app::controlla_mov(long & numreg, TDate & data)
|
|||||||
{
|
{
|
||||||
TLocalisamfile mov (LF_MOV);
|
TLocalisamfile mov (LF_MOV);
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
TRecnotype rec = _tabreg->recno();
|
TRecnotype rec = _tabreg->recno();
|
||||||
|
|
||||||
numreg = 0L;
|
numreg = 0L;
|
||||||
data = botime;
|
data = botime;
|
||||||
@ -1355,13 +1359,12 @@ bool TStampa_registri_app::controlla_mov(long & numreg, TDate & data)
|
|||||||
|
|
||||||
if (datareg.year() < _annoIVA)
|
if (datareg.year() < _annoIVA)
|
||||||
{
|
{
|
||||||
// const long numreg = mov.get_long(MOV_NUMREG);
|
if (!stampato)
|
||||||
if (!stampato)
|
{
|
||||||
{
|
numreg = mov.get_long(MOV_NUMREG);
|
||||||
numreg = mov.get_long(MOV_NUMREG);
|
data = mov.get_date(MOV_DATAREG);
|
||||||
data = mov.get_date(MOV_DATAREG);
|
ok = false;
|
||||||
ok = false;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1404,7 +1407,7 @@ int TStampa_registri_app::stampa_prospetto_IVA(int rr, int tipo_prosp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_esiste_riga_iva && _stampa)
|
if (_st_tot_fin && _esiste_riga_iva && _stampa)
|
||||||
{
|
{
|
||||||
if (tipo_prosp == 2)
|
if (tipo_prosp == 2)
|
||||||
{
|
{
|
||||||
@ -2055,8 +2058,7 @@ bool TStampa_registri_app::print_IVAxCassa(int da_month, int a_month)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TPrinter& pr = printer();
|
||||||
TPrinter& pr = printer();
|
|
||||||
TPrintrow riga;
|
TPrintrow riga;
|
||||||
const TString linea(_stampa_width, '-');
|
const TString linea(_stampa_width, '-');
|
||||||
|
|
||||||
@ -2365,9 +2367,13 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
|
|||||||
TLocalisamfile& mov = _cur->file(LF_MOV);
|
TLocalisamfile& mov = _cur->file(LF_MOV);
|
||||||
TLocalisamfile& caus = _cur->file(LF_CAUSALI);
|
TLocalisamfile& caus = _cur->file(LF_CAUSALI);
|
||||||
|
|
||||||
_datareg = mov.get_date(MOV_DATAREG);
|
#ifdef DBG
|
||||||
|
if (mov.get_long(MOV_NUMREG) == 67834)
|
||||||
|
int q = 1;
|
||||||
|
#endif
|
||||||
|
_datareg = mov.get_date(MOV_DATAREG);
|
||||||
|
|
||||||
if (_tipo_stampa != libro_unico && _liquidazione)
|
if (_tipo_stampa != libro_unico && _liquidazione)
|
||||||
{
|
{
|
||||||
const int da = (_tipo_stampa == prova) ? _data_da.month() : 1;
|
const int da = (_tipo_stampa == prova) ? _data_da.month() : 1;
|
||||||
const int a = _datareg.month();
|
const int a = _datareg.month();
|
||||||
@ -2462,8 +2468,12 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
|
|||||||
if (totdoc < ZERO) // Controlla il segno corretto da assegnare alle ritenute
|
if (totdoc < ZERO) // Controlla il segno corretto da assegnare alle ritenute
|
||||||
{
|
{
|
||||||
ritsoc = -ritsoc;
|
ritsoc = -ritsoc;
|
||||||
ritfis = -ritfis;
|
|
||||||
revcha = -revcha;
|
// const TCausale & caus = cached_causale(mov.get(MOV_CODCAUS));
|
||||||
|
|
||||||
|
// if (!caus.intra())
|
||||||
|
// ritfis = -ritfis;
|
||||||
|
// revcha = -revcha;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_cur->pos() == 0)
|
if (_cur->pos() == 0)
|
||||||
@ -2571,8 +2581,8 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
|
|||||||
|
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
if (meseliq > 0)
|
if (meseliq > 0 && meseliq != mov.get_date(MOV_DATAREG).month())
|
||||||
set_row(_r, "@62g%02d", meseliq);
|
set_row(_r, "@62g%02d", meseliq);
|
||||||
set_row(_r, "@67g%2s", (const char*) _tipodoc);
|
set_row(_r, "@67g%2s", (const char*) _tipodoc);
|
||||||
if (fattrit)
|
if (fattrit)
|
||||||
set_row(_r, "@69gD");
|
set_row(_r, "@69gD");
|
||||||
@ -2607,7 +2617,7 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
|
|||||||
TString s_dataregcoll(dataregcoll.string(brief, '/'));
|
TString s_dataregcoll(dataregcoll.string(brief, '/'));
|
||||||
TString s_datadoccoll(datadoccoll.string(brief, '/'));
|
TString s_datadoccoll(datadoccoll.string(brief, '/'));
|
||||||
|
|
||||||
while ((r = desc.get()) != NULL)
|
while ((r = desc.get()) != nullptr)
|
||||||
{
|
{
|
||||||
set_row(i, "@38g%s", r);
|
set_row(i, "@38g%s", r);
|
||||||
i++;
|
i++;
|
||||||
@ -2635,7 +2645,7 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
|
|||||||
set_row(i, "@31g%6ld", codcf);
|
set_row(i, "@31g%6ld", codcf);
|
||||||
TParagraph_string desc(ragsoc, 23);
|
TParagraph_string desc(ragsoc, 23);
|
||||||
|
|
||||||
while ((r = desc.get()) != NULL)
|
while ((r = desc.get()) != nullptr)
|
||||||
{
|
{
|
||||||
set_row (i, "@38g%s", r);
|
set_row (i, "@38g%s", r);
|
||||||
i++;
|
i++;
|
||||||
@ -2715,7 +2725,15 @@ bool TStampa_registri_app::preprocess_page(int file, int counter)
|
|||||||
|
|
||||||
}
|
}
|
||||||
//*****aggiornamento del totale documento,imponibile e imposta progressivi
|
//*****aggiornamento del totale documento,imponibile e imposta progressivi
|
||||||
const real totdoc = mov.get_real(MOV_TOTDOC);
|
|
||||||
|
real totdoc = mov.get(MOV_TOTDOC);
|
||||||
|
real ritsoc = mov.get(MOV_RITSOC);
|
||||||
|
real ritfis = mov.get(MOV_RITFIS);
|
||||||
|
real revcha = is_reverse_charge(mov.curr()) ? mov.get_real(MOV_REVCHARGE) : ZERO;
|
||||||
|
|
||||||
|
if (totdoc < ZERO) // Controlla il segno corretto da assegnare alle ritenute
|
||||||
|
ritsoc = -ritsoc;
|
||||||
|
totdoc += ritsoc + ritfis + revcha;
|
||||||
_progr_doc = totdoc;
|
_progr_doc = totdoc;
|
||||||
|
|
||||||
if (_rows_left > 0)
|
if (_rows_left > 0)
|
||||||
@ -4029,12 +4047,12 @@ bool TStampa_registri_app::stampa_registri_IVA(const TMask& m)
|
|||||||
long numreg;
|
long numreg;
|
||||||
TDate data;
|
TDate data;
|
||||||
|
|
||||||
if (!controlla_mov(numreg, data))
|
if (!controlla_mov(numreg, data))
|
||||||
{
|
{
|
||||||
TApplication::set_firm(__firm);
|
TApplication::set_firm(__firm);
|
||||||
|
|
||||||
return error_box(TR("Finire di stampare registri anno precedente\n"
|
return error_box(TR("Finire di stampare registri anno precedente\n"
|
||||||
"Il primo è il numero %ld del %s."), numreg, data.stringa());
|
"Il primo è il numero %ld del %s."), numreg, data.stringa());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!_stampa_tutti_i_registri)
|
if (!_stampa_tutti_i_registri)
|
||||||
@ -4167,7 +4185,7 @@ bool TStampa_registri_app::stampa_registri_IVA(const TMask& m)
|
|||||||
mov_from.put(MOV_DATAREG, _data_da);
|
mov_from.put(MOV_DATAREG, _data_da);
|
||||||
mov_to.put(MOV_DATAREG, _data_a);
|
mov_to.put(MOV_DATAREG, _data_a);
|
||||||
_cur->setregion(mov_from, mov_to);
|
_cur->setregion(mov_from, mov_to);
|
||||||
_cur->set_filterfunction(NULL);
|
_cur->set_filterfunction(nullptr);
|
||||||
_cur->set_filterfunction(filter_func, true);
|
_cur->set_filterfunction(filter_func, true);
|
||||||
(*_cur) = 0L;
|
(*_cur) = 0L;
|
||||||
ok = setta_mask(i);
|
ok = setta_mask(i);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user