Corretti errori ripristino stampa registri
git-svn-id: svn://10.65.10.50/trunk@985 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
500260ae16
commit
6215837eea
148
cg/cg4400.cpp
148
cg/cg4400.cpp
@ -5,11 +5,9 @@
|
||||
#include "cg4400a.h"
|
||||
#include "cg4400b.h"
|
||||
|
||||
static TString256 TMP;
|
||||
inline TReg_print& app() { return (TReg_print&)main_app(); }
|
||||
|
||||
inline CG4400_application& app() { return (CG4400_application&)main_app(); }
|
||||
|
||||
bool CG4400_application::filter_func (const TRelation * r)
|
||||
bool TReg_print::filter_func (const TRelation * r)
|
||||
{
|
||||
TLocalisamfile& mov = r->lfile(LF_MOV);
|
||||
TString16 codreg = mov.get(MOV_REG);
|
||||
@ -53,19 +51,19 @@ HIDDEN int compare_fields(const TObject** o1, const TObject** o2)
|
||||
return strcmp(campo1, campo2);
|
||||
}
|
||||
|
||||
bool CG4400_application::stampa_totali_finali()
|
||||
bool TReg_print::stampa_totali_finali()
|
||||
{
|
||||
TConfig conf(CONFIG_DITTA);
|
||||
return conf.get_bool("StTfFr");
|
||||
}
|
||||
|
||||
bool CG4400_application::stampa_datareg()
|
||||
bool TReg_print::stampa_datareg()
|
||||
{
|
||||
TConfig conf(CONFIG_STUDIO);
|
||||
return conf.get_bool("NoDtRg");
|
||||
}
|
||||
|
||||
bool CG4400_application::mask_select (TMask_field& f, KEY k)
|
||||
bool TReg_print::mask_select (TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
@ -81,7 +79,7 @@ bool CG4400_application::mask_select (TMask_field& f, KEY k)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG4400_application::mask_azzera (TMask_field& f, KEY k)
|
||||
bool TReg_print::mask_azzera (TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
@ -95,7 +93,7 @@ bool CG4400_application::mask_azzera (TMask_field& f, KEY k)
|
||||
}
|
||||
|
||||
/*
|
||||
bool CG4400_application::mask_firm_to (TMask_field& f, KEY k)
|
||||
bool TReg_print::mask_firm_to (TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_TAB && f.focusdirty())
|
||||
{
|
||||
@ -123,7 +121,7 @@ bool CG4400_application::mask_azzera (TMask_field& f, KEY k)
|
||||
}
|
||||
*/
|
||||
|
||||
bool CG4400_application::mask_tipo_stampa(TMask_field& f, KEY k)
|
||||
bool TReg_print::mask_tipo_stampa(TMask_field& f, KEY k)
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
|
||||
@ -138,7 +136,7 @@ bool CG4400_application::mask_tipo_stampa(TMask_field& f, KEY k)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG4400_application::mask_mese (TMask_field& f, KEY k)
|
||||
bool TReg_print::mask_mese (TMask_field& f, KEY k)
|
||||
{
|
||||
const short id = f.dlg();
|
||||
int mese;
|
||||
@ -182,7 +180,7 @@ bool CG4400_application::mask_mese (TMask_field& f, KEY k)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG4400_application::look_reg(int i, int anno, TString& codlib, int m, const char* cod, int* umese, long ditta)
|
||||
bool TReg_print::look_reg(int i, int anno, TString& codlib, int m, const char* cod, int* umese, long ditta)
|
||||
{
|
||||
TString16 y;
|
||||
|
||||
@ -224,7 +222,7 @@ bool CG4400_application::look_reg(int i, int anno, TString& codlib, int m, const
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool CG4400_application::look_regs(int anno, TString& codlib, int m, int* umese, long ditta)
|
||||
bool TReg_print::look_regs(int anno, TString& codlib, int m, int* umese, long ditta)
|
||||
{
|
||||
int a, tipo;
|
||||
TString16 codtab;
|
||||
@ -264,7 +262,7 @@ bool CG4400_application::look_regs(int anno, TString& codlib, int m, int* umese,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG4400_application::mask_libun (TMask_field& f, KEY k)
|
||||
bool TReg_print::mask_libun (TMask_field& f, KEY k)
|
||||
{
|
||||
if ( k == K_ENTER )
|
||||
{
|
||||
@ -325,7 +323,7 @@ bool CG4400_application::mask_libun (TMask_field& f, KEY k)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG4400_application::mask_cod (TMask_field& f, KEY k)
|
||||
bool TReg_print::mask_cod (TMask_field& f, KEY k)
|
||||
{
|
||||
TTable TabLbu ("%LBU");
|
||||
TString codtab;
|
||||
@ -358,7 +356,7 @@ bool CG4400_application::mask_cod (TMask_field& f, KEY k)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG4400_application::mask_data (TMask_field& f, KEY k)
|
||||
bool TReg_print::mask_data (TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_TAB && f.mask().is_running())
|
||||
{
|
||||
@ -381,7 +379,7 @@ bool CG4400_application::mask_data (TMask_field& f, KEY k)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
const char * CG4400_application::descr_doc()
|
||||
const char * TReg_print::descr_doc()
|
||||
{
|
||||
TTable tab_tpd("%TPD");
|
||||
TString codtab(format("%-2s",(const char*) _tipodoc));
|
||||
@ -396,7 +394,7 @@ const char * CG4400_application::descr_doc()
|
||||
return TMP;
|
||||
}
|
||||
|
||||
const char * CG4400_application::descr_iva(const char * cod)
|
||||
const char * TReg_print::descr_iva(const char * cod)
|
||||
{
|
||||
TTable tab_iva("%IVA");
|
||||
TString codtab(format ("%-4s", cod));
|
||||
@ -411,7 +409,7 @@ const char * CG4400_application::descr_iva(const char * cod)
|
||||
return TMP;
|
||||
}
|
||||
|
||||
const char * CG4400_application::tipo_attivita()
|
||||
const char * TReg_print::tipo_attivita()
|
||||
{
|
||||
TLocalisamfile attiv (LF_ATTIV);
|
||||
|
||||
@ -424,7 +422,7 @@ const char * CG4400_application::tipo_attivita()
|
||||
return TMP;
|
||||
}
|
||||
|
||||
const char * CG4400_application::desc_attivita()
|
||||
const char * TReg_print::desc_attivita()
|
||||
{
|
||||
TTable attiv ("%AIS");
|
||||
|
||||
@ -437,7 +435,7 @@ const char * CG4400_application::desc_attivita()
|
||||
return TMP;
|
||||
}
|
||||
|
||||
TRectype& CG4400_application::ricerca_cf(char tipocf, long codcf)
|
||||
TRectype& TReg_print::ricerca_cf(char tipocf, long codcf)
|
||||
{
|
||||
_clifo->zero();
|
||||
_clifo->put(CLI_TIPOCF, tipocf);
|
||||
@ -449,7 +447,7 @@ TRectype& CG4400_application::ricerca_cf(char tipocf, long codcf)
|
||||
return _clifo->curr();
|
||||
}
|
||||
|
||||
TRectype& CG4400_application::ricerca_occ(const char * occ)
|
||||
TRectype& TReg_print::ricerca_occ(const char * occ)
|
||||
{
|
||||
TLocalisamfile occas (LF_OCCAS);
|
||||
occas.zero();
|
||||
@ -461,7 +459,7 @@ TRectype& CG4400_application::ricerca_occ(const char * occ)
|
||||
return occas.curr();
|
||||
}
|
||||
|
||||
bool CG4400_application::year_handler(TMask_field& f, KEY key)
|
||||
bool TReg_print::year_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
if (key == K_TAB && f.focusdirty())
|
||||
{
|
||||
@ -474,7 +472,7 @@ bool CG4400_application::year_handler(TMask_field& f, KEY key)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CG4400_application::build_ditte_sheet()
|
||||
void TReg_print::build_ditte_sheet()
|
||||
{
|
||||
// build sheet
|
||||
_ditte->destroy();
|
||||
@ -495,7 +493,7 @@ void CG4400_application::build_ditte_sheet()
|
||||
|
||||
// --------------------------- handlers per selezione ditte
|
||||
|
||||
bool CG4400_application::to_ditt_handler(TMask_field& f, KEY key)
|
||||
bool TReg_print::to_ditt_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
if (key == K_F9)
|
||||
@ -511,7 +509,7 @@ bool CG4400_application::to_ditt_handler(TMask_field& f, KEY key)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG4400_application::fr_ditt_handler(TMask_field& f, KEY key)
|
||||
bool TReg_print::fr_ditt_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
TMask& m = f.mask();
|
||||
if (key == K_F9)
|
||||
@ -527,7 +525,7 @@ bool CG4400_application::fr_ditt_handler(TMask_field& f, KEY key)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG4400_application::to_butt_handler(TMask_field& f, KEY key)
|
||||
bool TReg_print::to_butt_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
if (key == K_SPACE)
|
||||
{
|
||||
@ -544,7 +542,7 @@ bool CG4400_application::to_butt_handler(TMask_field& f, KEY key)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG4400_application::fr_butt_handler(TMask_field& f, KEY key)
|
||||
bool TReg_print::fr_butt_handler(TMask_field& f, KEY key)
|
||||
{
|
||||
if (key == K_SPACE)
|
||||
{
|
||||
@ -561,24 +559,30 @@ bool CG4400_application::fr_butt_handler(TMask_field& f, KEY key)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CG4400_application::set_choice_limits(TMask& m)
|
||||
void TReg_print::set_choice_limits(TMask& m)
|
||||
{
|
||||
long first = -1l, last = -1l;
|
||||
for (int i = 0; i < _ditte->items(); i++)
|
||||
{
|
||||
if (_selected[i])
|
||||
{
|
||||
long dit = _ditte->row(i).get_long(1);
|
||||
const long dit = _ditte->row(i).get_long(1);
|
||||
if (first == -1l) first = dit;
|
||||
if (last < dit) last = dit;
|
||||
}
|
||||
}
|
||||
if (first != -1) m.field(DA_CODICE).set(format("%ld",first));
|
||||
if (last != -1) m.field(A_CODICE).set(format("%ld",last));
|
||||
if (first != -1)
|
||||
{
|
||||
m.set(DA_CODICE, first);
|
||||
app().set_firm(first);
|
||||
}
|
||||
if (last != -1)
|
||||
m.set(A_CODICE, last);
|
||||
|
||||
m.set(F_SELECT, _selected.ones());
|
||||
}
|
||||
|
||||
long CG4400_application::select_firm_range(long from, long to)
|
||||
long TReg_print::select_firm_range(long from, long to)
|
||||
{
|
||||
if (to == 0l) to = 99999L;
|
||||
for (int i = 0; i < _ditte->items(); i++)
|
||||
@ -606,7 +610,7 @@ long CG4400_application::select_firm_range(long from, long to)
|
||||
return _selected.ones();
|
||||
}
|
||||
|
||||
void CG4400_application::build_nomiditte(TProgind* pnd)
|
||||
void TReg_print::build_nomiditte(TProgind* pnd)
|
||||
{
|
||||
_nomiditte.destroy();
|
||||
// ricostruire _nomiditte e rifare build_ditte_sheet
|
||||
@ -635,7 +639,7 @@ void CG4400_application::build_nomiditte(TProgind* pnd)
|
||||
TApplication::set_firm(__firm);
|
||||
}
|
||||
|
||||
bool CG4400_application::user_create()
|
||||
bool TReg_print::user_create()
|
||||
{
|
||||
TProgind* pnd = NULL;
|
||||
|
||||
@ -695,7 +699,7 @@ bool CG4400_application::user_create()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG4400_application::user_destroy()
|
||||
bool TReg_print::user_destroy()
|
||||
{
|
||||
delete _ditte;
|
||||
delete _nditte;
|
||||
@ -723,7 +727,7 @@ bool CG4400_application::user_destroy()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CG4400_application::calcola_progressivi()
|
||||
void TReg_print::calcola_progressivi()
|
||||
{
|
||||
TTable pim ("PIM");
|
||||
TString80 chiave;
|
||||
@ -834,7 +838,7 @@ void CG4400_application::calcola_progressivi()
|
||||
}
|
||||
}
|
||||
|
||||
int CG4400_application::riga_rmoviva()
|
||||
int TReg_print::riga_rmoviva()
|
||||
{
|
||||
TString codiva;
|
||||
real impo, impos;
|
||||
@ -884,8 +888,8 @@ int CG4400_application::riga_rmoviva()
|
||||
return nrec;
|
||||
}
|
||||
|
||||
int CG4400_application::setta_riga(int r, const TRigaiva& riga, real& tot1,
|
||||
real& tot2, real& tot3, real& tot4)
|
||||
int TReg_print::setta_riga(int r, const TRigaiva& riga, real& tot1,
|
||||
real& tot2, real& tot3, real& tot4)
|
||||
{
|
||||
set_row(r, "%4s", (const char*)riga._codiva);
|
||||
TString descr = descr_iva(riga._codiva);
|
||||
@ -906,7 +910,7 @@ int CG4400_application::setta_riga(int r, const TRigaiva& riga, real& tot1,
|
||||
return r;
|
||||
}
|
||||
|
||||
bool CG4400_application::controlla_liquidazione()
|
||||
bool TReg_print::controlla_liquidazione()
|
||||
{
|
||||
TTable lim ("LIM");
|
||||
TTable pim ("PIM");
|
||||
@ -977,7 +981,7 @@ bool CG4400_application::controlla_liquidazione()
|
||||
|
||||
//controlla che i movimenti con anno data di registrazione < dell'anno indicato a video siano stati gia' stampati in forma definitiva*/
|
||||
//questo controllo viene fatto solo per stampa di bollato (non su libro unico)
|
||||
bool CG4400_application::controlla_mov()
|
||||
bool TReg_print::controlla_mov()
|
||||
{
|
||||
TLocalisamfile mov (LF_MOV);
|
||||
bool ok = TRUE;
|
||||
@ -1007,7 +1011,7 @@ bool CG4400_application::controlla_mov()
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool CG4400_application::cerca_libro_gio(TString& datas)
|
||||
bool TReg_print::cerca_libro_gio(TString& datas)
|
||||
{
|
||||
TString app(4);
|
||||
app = format("%04d", _annoes);
|
||||
@ -1036,7 +1040,7 @@ bool CG4400_application::cerca_libro_gio(TString& datas)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CG4400_application::cerca_reg(const TString& c, byte* t)
|
||||
void TReg_print::cerca_reg(const TString& c, byte* t)
|
||||
{
|
||||
TString16 cod = "";
|
||||
|
||||
@ -1047,7 +1051,7 @@ void CG4400_application::cerca_reg(const TString& c, byte* t)
|
||||
*t = _tabreg->get_int ("I0");
|
||||
}
|
||||
|
||||
bool CG4400_application::ventilazione(const char* iva)
|
||||
bool TReg_print::ventilazione(const char* iva)
|
||||
{
|
||||
TTable tabiva ("%IVA");
|
||||
TString16 chiave = "";
|
||||
@ -1062,7 +1066,7 @@ bool CG4400_application::ventilazione(const char* iva)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int CG4400_application::stampa_prospetto()
|
||||
int TReg_print::stampa_prospetto()
|
||||
{
|
||||
TString riga(_stampa_width);
|
||||
int r=1, rr=0;
|
||||
@ -1158,7 +1162,7 @@ int CG4400_application::stampa_prospetto()
|
||||
}
|
||||
|
||||
//la stampa "tipi di indetraibilita'" viene fatta solo per gli acquisti
|
||||
int CG4400_application::stampa_acquisti(int row)
|
||||
int TReg_print::stampa_acquisti(int row)
|
||||
{
|
||||
real tot_imponib, tot_imposta, tot_imponibp, tot_impostap;
|
||||
row+=2;
|
||||
@ -1246,7 +1250,7 @@ int CG4400_application::stampa_acquisti(int row)
|
||||
}
|
||||
|
||||
/*
|
||||
void CG4400_application::set_page_tot_reg()
|
||||
void TReg_print::set_page_tot_reg()
|
||||
{
|
||||
TString16 codivaprec = "";
|
||||
int row=0, rr=0;
|
||||
@ -1332,7 +1336,7 @@ int CG4400_application::stampa_acquisti(int row)
|
||||
}
|
||||
*/
|
||||
|
||||
void CG4400_application::set_page_tot_reg()
|
||||
void TReg_print::set_page_tot_reg()
|
||||
{
|
||||
int rr=0;
|
||||
|
||||
@ -1395,7 +1399,7 @@ void CG4400_application::set_page_tot_reg()
|
||||
stampa_plafonds(rr);
|
||||
}
|
||||
|
||||
void CG4400_application::stampa_plafonds(int r)
|
||||
void TReg_print::stampa_plafonds(int r)
|
||||
{
|
||||
TTable pla ("PLA");
|
||||
TTable ppa ("PPA");
|
||||
@ -1536,7 +1540,7 @@ void CG4400_application::stampa_plafonds(int r)
|
||||
}
|
||||
}
|
||||
|
||||
real CG4400_application::stampa_valori_plafonds(const real& r1, const int mese, TTable& ppa, const char* tipo)
|
||||
real TReg_print::stampa_valori_plafonds(const real& r1, const int mese, TTable& ppa, const char* tipo)
|
||||
{
|
||||
real r, si8, se8;
|
||||
TString80 chiave;
|
||||
@ -1570,7 +1574,7 @@ real CG4400_application::stampa_valori_plafonds(const real& r1, const int mese,
|
||||
return r;
|
||||
}
|
||||
|
||||
bool CG4400_application::compila_reg(const TMask& m)
|
||||
bool TReg_print::compila_reg(const TMask& m)
|
||||
{
|
||||
int anno;
|
||||
TString16 codtab = "";
|
||||
@ -1677,7 +1681,7 @@ bool CG4400_application::compila_reg(const TMask& m)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG4400_application::compila_lib()
|
||||
bool TReg_print::compila_lib()
|
||||
{
|
||||
TTable tab_lib ("%LBU");
|
||||
TString16 cod;
|
||||
@ -1694,7 +1698,7 @@ bool CG4400_application::compila_lib()
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool CG4400_application::preprocess_print(int file, int counter)
|
||||
bool TReg_print::preprocess_print(int file, int counter)
|
||||
{
|
||||
if (file == LF_MOV)
|
||||
{
|
||||
@ -1716,7 +1720,7 @@ bool CG4400_application::preprocess_print(int file, int counter)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CG4400_application::preprocess_page(int file, int counter)
|
||||
bool TReg_print::preprocess_page(int file, int counter)
|
||||
{
|
||||
if (file == LF_MOV)
|
||||
{
|
||||
@ -2004,7 +2008,7 @@ bool CG4400_application::preprocess_page(int file, int counter)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CG4400_application::aggiorna_reg()
|
||||
void TReg_print::aggiorna_reg()
|
||||
{
|
||||
TString16 codtab;
|
||||
TTable Tabreg ("REG");
|
||||
@ -2108,7 +2112,7 @@ void CG4400_application::aggiorna_reg()
|
||||
}
|
||||
}
|
||||
|
||||
void CG4400_application::aggiorna_lib()
|
||||
void TReg_print::aggiorna_lib()
|
||||
{
|
||||
TString16 cod = "";
|
||||
TTable lbu ("%LBU");
|
||||
@ -2124,7 +2128,7 @@ void CG4400_application::aggiorna_lib()
|
||||
}
|
||||
}
|
||||
|
||||
bool CG4400_application::stampo_liquidazione(int mese)
|
||||
bool TReg_print::stampo_liquidazione(int mese)
|
||||
{
|
||||
if (_tipo_stampa == 1)
|
||||
{
|
||||
@ -2144,7 +2148,7 @@ bool CG4400_application::stampo_liquidazione(int mese)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CG4400_application::stampa_vidi()
|
||||
void TReg_print::stampa_vidi()
|
||||
{
|
||||
TTable TabInl ("%INL");
|
||||
TTable TabVid ("VID");
|
||||
@ -2204,7 +2208,7 @@ void CG4400_application::stampa_vidi()
|
||||
printer().close();
|
||||
}
|
||||
|
||||
print_action CG4400_application::postprocess_page (int file, int counter)
|
||||
print_action TReg_print::postprocess_page (int file, int counter)
|
||||
{
|
||||
if (file == LF_MOV)
|
||||
{
|
||||
@ -2268,7 +2272,7 @@ print_action CG4400_application::postprocess_page (int file, int counter)
|
||||
return NEXT_PAGE;
|
||||
}
|
||||
|
||||
bool CG4400_application::set_print(int n)
|
||||
bool TReg_print::set_print(int n)
|
||||
{
|
||||
TMask m ("cg4400a");
|
||||
int giorni_del_mese;
|
||||
@ -2370,7 +2374,7 @@ bool CG4400_application::set_print(int n)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool CG4400_application::look_lia()
|
||||
bool TReg_print::look_lia()
|
||||
{
|
||||
TString16 y; y << _annoes;
|
||||
|
||||
@ -2384,13 +2388,13 @@ bool CG4400_application::look_lia()
|
||||
return ok;
|
||||
}
|
||||
|
||||
void CG4400_application::clear_stliq()
|
||||
void TReg_print::clear_stliq()
|
||||
{
|
||||
for (int i=0; i < 12; i++)
|
||||
_st_liq[i] = FALSE;
|
||||
}
|
||||
|
||||
bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
||||
bool TReg_print::stampa_registri_IVA(const TMask& m)
|
||||
{
|
||||
bool ok = FALSE;
|
||||
for (int i = 0; i < _ditte->items(); i++)
|
||||
@ -2679,7 +2683,7 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
||||
}
|
||||
|
||||
|
||||
void CG4400_application::stampa_liq_mesi_succ()
|
||||
void TReg_print::stampa_liq_mesi_succ()
|
||||
{
|
||||
int da = _datareg.month() + 1;
|
||||
int a = _data_a.month();
|
||||
@ -2708,7 +2712,7 @@ void CG4400_application::stampa_liq_mesi_succ()
|
||||
if (printer().isopen()) printer().close();
|
||||
}
|
||||
|
||||
void CG4400_application::send_message(char tipo, const TFilename& nome, int mese)
|
||||
void TReg_print::send_message(char tipo, const TFilename& nome, int mese)
|
||||
{
|
||||
//const char* const app = "cg4a -2 -icon";
|
||||
const char* const app = "cg4a -2";
|
||||
@ -2729,7 +2733,7 @@ void CG4400_application::send_message(char tipo, const TFilename& nome, int mese
|
||||
pn.run();
|
||||
}
|
||||
|
||||
bool CG4400_application::set_ditte(TMask& m)
|
||||
bool TReg_print::set_ditte(TMask& m)
|
||||
{
|
||||
/*
|
||||
_selected.reset();
|
||||
@ -2748,7 +2752,7 @@ bool CG4400_application::set_ditte(TMask& m)
|
||||
return tasto == K_ENTER;
|
||||
}
|
||||
|
||||
TRectype& CG4400_application::look_comuni (const char * cod)
|
||||
TRectype& TReg_print::look_comuni (const char * cod)
|
||||
{
|
||||
_com->zero();
|
||||
_com->put(COM_COM, cod);
|
||||
@ -2759,7 +2763,7 @@ TRectype& CG4400_application::look_comuni (const char * cod)
|
||||
return _com->curr();
|
||||
}
|
||||
|
||||
void CG4400_application::get_dati_ditta()
|
||||
void TReg_print::get_dati_ditta()
|
||||
{
|
||||
TLocalisamfile nditte(LF_NDITTE);
|
||||
TLocalisamfile anag(LF_ANAG);
|
||||
@ -2828,7 +2832,7 @@ void CG4400_application::get_dati_ditta()
|
||||
}
|
||||
}
|
||||
|
||||
int CG4400_application::stampa_intestazione()
|
||||
int TReg_print::stampa_intestazione()
|
||||
{
|
||||
int r = 1;
|
||||
TString codice_ditta;
|
||||
@ -2854,7 +2858,7 @@ int CG4400_application::stampa_intestazione()
|
||||
return r;
|
||||
}
|
||||
|
||||
void CG4400_application::preprocess_header()
|
||||
void TReg_print::preprocess_header()
|
||||
{
|
||||
int r=1;
|
||||
char cor, nd1, nd2;
|
||||
@ -3018,7 +3022,7 @@ if (_stampa_ind_comp && !_intesta_vidi)
|
||||
|
||||
int cg4400 (int argc, char * argv[])
|
||||
{
|
||||
CG4400_application a;
|
||||
TReg_print a;
|
||||
a.run(argc, argv, "Stampa registri IVA");
|
||||
return 0;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
const int TABREG = (int)TTable::name2log("REG");
|
||||
|
||||
class CG4400_application : public TPrintapp
|
||||
class TReg_print : public TPrintapp
|
||||
{
|
||||
TCursor * _cur;
|
||||
TRelation *_rel, *_nditte;
|
||||
@ -132,8 +132,8 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
CG4400_application() : TPrintapp(), _ditte(NULL), _selected(10000), _nomiditte(100) {}
|
||||
virtual ~CG4400_application() {}
|
||||
TReg_print() : TPrintapp(), _ditte(NULL), _selected(10000), _nomiditte(100) {}
|
||||
virtual ~TReg_print() {}
|
||||
};
|
||||
|
||||
|
||||
|
@ -15,18 +15,14 @@
|
||||
|
||||
class TRipristina_stampa : public TApplication
|
||||
{
|
||||
TMask* _msk;
|
||||
long _default_firm;
|
||||
|
||||
virtual bool create() ;
|
||||
virtual bool destroy() ;
|
||||
bool menu(MENU_TAG);
|
||||
bool do_restore(long firm, const char * reg, int year, int month,
|
||||
int day, bool giornale);
|
||||
static bool firm_handler(TMask_field& f, KEY key);
|
||||
|
||||
public:
|
||||
TRipristina_stampa() : _msk(NULL) {}
|
||||
TRipristina_stampa() {}
|
||||
};
|
||||
|
||||
bool TRipristina_stampa::firm_handler(TMask_field& f, KEY key)
|
||||
@ -45,8 +41,7 @@ bool TRipristina_stampa::firm_handler(TMask_field& f, KEY key)
|
||||
return f.error_box("Gli archivi della ditta %ld non sono stati ancora generati", firm);
|
||||
else
|
||||
{
|
||||
if (main_app().get_firm() != firm)
|
||||
main_app().set_firm(firm);
|
||||
main_app().set_firm(firm);
|
||||
|
||||
TMask_field& r = f.mask().field(F_REG);
|
||||
r.set_dirty();
|
||||
@ -60,12 +55,12 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist,
|
||||
int year, int month, int day,
|
||||
bool giornale)
|
||||
{
|
||||
bool ok = TRUE;
|
||||
CHECK(firm > 0, "Non posso ripristinare sui dati comuni");
|
||||
CHECKS(regist && *regist && strlen(regist) <= 3, "Registro errato ", regist);
|
||||
CHECKD(month > 0 && month < 13, "Mese errato ", month);
|
||||
set_firm(firm);
|
||||
|
||||
bool ok = TRUE;
|
||||
const char * const fieldname = giornale ? MOV_STAMPATO : MOV_REGST;
|
||||
TRelation rel(LF_MOV);
|
||||
TLocalisamfile & mov = rel.lfile();
|
||||
@ -87,10 +82,7 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist,
|
||||
esc.zero();
|
||||
esc.put("CODTAB", format("%04d", year));
|
||||
if (esc.read() != NOERR)
|
||||
{
|
||||
set_firm(_default_firm);
|
||||
return error_box("Esercizio %s assente", year);
|
||||
}
|
||||
|
||||
TDate wd(esc.get_date("D0"));
|
||||
inizio_anno = wd;
|
||||
@ -141,10 +133,16 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist,
|
||||
}
|
||||
|
||||
--d;
|
||||
if (d > inizio_anno) // Aggiorna data ultima stampa
|
||||
reg.put("D3", d);
|
||||
if (d > inizio_anno) // Aggiorna data ultima stampa
|
||||
{
|
||||
reg.put("D3", d); // Data ultima stampa
|
||||
reg.put("I4", d.month()-1); // Ultimo mese di stampa liquidazione
|
||||
}
|
||||
else
|
||||
{
|
||||
reg.zero("D3");
|
||||
reg.zero("I4");
|
||||
}
|
||||
|
||||
ok = (reg.rewrite() == NOERR);
|
||||
if (!ok)
|
||||
@ -154,36 +152,30 @@ bool TRipristina_stampa::do_restore(long firm, const char * regist,
|
||||
else
|
||||
ok = error_box("Impossibile leggere il registro %s anno %s", (const char *) regist, (const char *) year);
|
||||
|
||||
set_firm(_default_firm);
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TRipristina_stampa::create()
|
||||
{
|
||||
TApplication::create();
|
||||
_msk = new TMask("cg5400a") ;
|
||||
_msk->set_handler(F_FIRM, firm_handler);
|
||||
_default_firm = get_firm();
|
||||
dispatch_e_menu(BAR_ITEM(1));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TRipristina_stampa::destroy()
|
||||
{
|
||||
if (_msk != NULL) delete _msk;
|
||||
return TApplication::destroy();
|
||||
}
|
||||
|
||||
bool TRipristina_stampa::menu(MENU_TAG)
|
||||
{
|
||||
while (_msk->run() == K_ENTER)
|
||||
TMask msk("cg5400a") ;
|
||||
msk.set_handler(F_FIRM, firm_handler);
|
||||
|
||||
while (msk.run() == K_ENTER)
|
||||
{
|
||||
const long firm = _msk->get_long(F_FIRM);
|
||||
const TString16 reg = _msk->get(F_REG);
|
||||
const bool giornale = _msk->get_int(F_TIPO) == 5;
|
||||
const int year = _msk->get_int(giornale ? F_ESER : F_YEAR);
|
||||
const int month = _msk->get_int(F_MESE);
|
||||
int day = giornale ? _msk->get_int(F_DAY) : 1;
|
||||
const long firm = msk.get_long(F_FIRM);
|
||||
const TString16 reg = msk.get(F_REG);
|
||||
const bool giornale = msk.get_int(F_TIPO) == 5;
|
||||
const int year = msk.get_int(giornale ? F_ESER : F_YEAR);
|
||||
const int month = msk.get_int(F_MESE);
|
||||
int day = giornale ? msk.get_int(F_DAY) : 1;
|
||||
if (day < 1) day = 1;
|
||||
|
||||
if (prefhndl->exist(firm))
|
||||
@ -194,13 +186,13 @@ bool TRipristina_stampa::menu(MENU_TAG)
|
||||
|
||||
if (yesno_box((const char *) mess))
|
||||
{
|
||||
mess << "\nSi desidera veramente continuare";
|
||||
mess << "\nSi desidera veramente continuare?";
|
||||
if (yesno_box((const char *) mess))
|
||||
do_restore(firm, reg, year, month, day, giornale);
|
||||
}
|
||||
}
|
||||
else error_box("Gli archivi della ditta %d non sono stati ancora generati",firm);
|
||||
_msk->reset();
|
||||
msk.reset();
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user