Correzioni al giornale e i registri
git-svn-id: svn://10.65.10.50/trunk@1053 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
51c04ee21b
commit
2f412eacd8
@ -127,20 +127,21 @@ class CG3400_application : public TPrintapp
|
|||||||
static bool filtra_reg (const TRelation * r);
|
static bool filtra_reg (const TRelation * r);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TRelation * _rel;
|
TRelation* _rel;
|
||||||
TCursor * _cur;
|
TCursor* _cur;
|
||||||
TRectype * _RecPartoDa, *_RecArrivoA;
|
TRectype* _RecPartoDa, *_RecArrivoA;
|
||||||
int _ae; // anno esercizio di ALLA_DATA
|
int _ae; // anno esercizio di ALLA_DATA
|
||||||
int _tipo; // tipo del registro
|
int _tipo; // tipo del registro
|
||||||
int _annoEsMov; // anno esercizio letto da mov
|
int _annoEsMov; // anno esercizio letto da mov
|
||||||
TString16 _reg;
|
TString16 _reg;
|
||||||
int _anno_iva;
|
int _anno_iva;
|
||||||
bool _stampa_definitiva;
|
bool _stampa_definitiva;
|
||||||
bool _MovGiaStampato;
|
bool _MovGiaStampato;
|
||||||
bool _gia_settato_ariportare;
|
bool _gia_settato_ariportare;
|
||||||
long _num_rig;
|
bool _nuovo_mese; // Finito il mese ?
|
||||||
real _importo;
|
long _num_rig;
|
||||||
char _sezione;
|
real _importo;
|
||||||
|
char _sezione;
|
||||||
// TParagraph_string* _descr_conto;
|
// TParagraph_string* _descr_conto;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -428,14 +429,14 @@ void CG3400_application::aggiorna_mov()
|
|||||||
_cur->setregion(da, a);
|
_cur->setregion(da, a);
|
||||||
(*_cur) = 0L;
|
(*_cur) = 0L;
|
||||||
|
|
||||||
#ifndef DBG2
|
#ifndef DBG
|
||||||
TProgind prnd (_cur->items(), "Aggiornamento movimenti ...", FALSE, TRUE);
|
TProgind prnd (_cur->items(), "Aggiornamento movimenti ...", FALSE, TRUE);
|
||||||
#endif
|
#endif
|
||||||
// for (mov.read(_isgteq, _lock); mov.curr() < *_RecArrivoA && !mov.eof(); mov.next(_lock))
|
// for (mov.read(_isgteq, _lock); mov.curr() < *_RecArrivoA && !mov.eof(); mov.next(_lock))
|
||||||
|
|
||||||
for ( ; _cur->pos() < _cur->items(); ++(*_cur))
|
for ( ; _cur->pos() < _cur->items(); ++(*_cur))
|
||||||
{
|
{
|
||||||
#ifdef DBG2
|
#ifdef DBG
|
||||||
long numreg = _cur->file(LF_MOV).get_long("NUMREG");
|
long numreg = _cur->file(LF_MOV).get_long("NUMREG");
|
||||||
TString datareg(_cur->file(LF_MOV).get("DATAREG"));
|
TString datareg(_cur->file(LF_MOV).get("DATAREG"));
|
||||||
|
|
||||||
@ -450,7 +451,7 @@ void CG3400_application::aggiorna_mov()
|
|||||||
nprog++;
|
nprog++;
|
||||||
}
|
}
|
||||||
// else mov.reread(_unlock);
|
// else mov.reread(_unlock);
|
||||||
#ifndef DBG2
|
#ifndef DBG
|
||||||
prnd.addstatus(1);
|
prnd.addstatus(1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -553,15 +554,16 @@ void CG3400_application::preprocess_footer()
|
|||||||
ap = TRUE;
|
ap = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_cur->pos() < _cur->items()-1 && !_gia_settato_ariportare) // se sono sull'ultimo
|
if (_cur->pos() < _cur->items()-1 && !_gia_settato_ariportare)
|
||||||
{
|
{
|
||||||
dt = _tot_dare_progr + _tot_dare_progr_ap;
|
dt = _tot_dare_progr + _tot_dare_progr_ap;
|
||||||
at = _tot_avere_progr + _tot_avere_progr_ap;
|
at = _tot_avere_progr + _tot_avere_progr_ap;
|
||||||
dts = dt.string(REAL_PICTURE);
|
dts = dt.string(REAL_PICTURE);
|
||||||
ats = at.string(REAL_PICTURE);
|
ats = at.string(REAL_PICTURE);
|
||||||
|
|
||||||
riga.format ("@b@%dgA riportare @%dg%c %s %c @%dg%s",
|
riga.format ("@b@%dg%s@%dg%c %s %c @%dg%s",
|
||||||
_stampa_width == 132 ? DARE132-STUMB : DARE198-STUMB,
|
_stampa_width == 132 ? DARE132-STUMB : DARE198-STUMB,
|
||||||
|
_nuovo_mese ? "Totale progressivi generali " : "A riportare ",
|
||||||
_stampa_width == 132 ? DARE132-3 : DARE198,
|
_stampa_width == 132 ? DARE132-3 : DARE198,
|
||||||
'D',
|
'D',
|
||||||
(const char *) dts,
|
(const char *) dts,
|
||||||
@ -607,7 +609,7 @@ int CG3400_application::set_totali_pagina(int righe)
|
|||||||
'D',
|
'D',
|
||||||
(const char *) progr_dare,
|
(const char *) progr_dare,
|
||||||
'A',
|
'A',
|
||||||
_stampa_width == 132 ? AVERE132-1 : AVERE198,
|
_stampa_width == 132 ? AVERE132 : AVERE198,
|
||||||
(const char *) progr_avere
|
(const char *) progr_avere
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -626,7 +628,7 @@ int CG3400_application::set_totali_pagina(int righe)
|
|||||||
);
|
);
|
||||||
set_row (r++, (const char*) riga);
|
set_row (r++, (const char*) riga);
|
||||||
}
|
}
|
||||||
}
|
} // !stampa_definitiva
|
||||||
|
|
||||||
_tot_dare_generale = _tot_dare_progr + _tot_dare_progr_ap;
|
_tot_dare_generale = _tot_dare_progr + _tot_dare_progr_ap;
|
||||||
_tot_avere_generale = _tot_avere_progr + _tot_avere_progr_ap;
|
_tot_avere_generale = _tot_avere_progr + _tot_avere_progr_ap;
|
||||||
@ -649,6 +651,7 @@ int CG3400_application::set_totali_pagina(int righe)
|
|||||||
{
|
{
|
||||||
// Se il movimento ha righe che continuano nella pagina successiva
|
// Se il movimento ha righe che continuano nella pagina successiva
|
||||||
// "A riportare" viene stampato dalla preprocess_footer senno' qui
|
// "A riportare" viene stampato dalla preprocess_footer senno' qui
|
||||||
|
|
||||||
_gia_settato_ariportare = TRUE;
|
_gia_settato_ariportare = TRUE;
|
||||||
|
|
||||||
dt = _tot_dare_progr + _tot_dare_progr_ap;
|
dt = _tot_dare_progr + _tot_dare_progr_ap;
|
||||||
@ -656,14 +659,17 @@ int CG3400_application::set_totali_pagina(int righe)
|
|||||||
dts = dt.string(REAL_PICTURE);
|
dts = dt.string(REAL_PICTURE);
|
||||||
ats = at.string(REAL_PICTURE);
|
ats = at.string(REAL_PICTURE);
|
||||||
|
|
||||||
riga.format ("@b@%dgA riportare @%dg%c %s %c @%dg%s",
|
// "Se il mese e' finito devo scrivere Totale progressivi generali
|
||||||
_stampa_width == 132 ? DARE132-STUMB : DARE198-STUMB,
|
// invece che A riportare"
|
||||||
_stampa_width == 132 ? DARE132-3 : DARE198-2,
|
|
||||||
'D',
|
riga.format ("@b@%dgTotale progressivi generali @%dg%c %s %c @%dg%s",
|
||||||
(const char *) dts,
|
_stampa_width == 132 ? DARE132-STUMB : DARE198-STUMB,
|
||||||
'A',
|
_stampa_width == 132 ? DARE132-3 : DARE198-2,
|
||||||
_stampa_width == 132 ? AVERE132 : AVERE198,
|
'D',
|
||||||
(const char *) ats);
|
(const char *) dts,
|
||||||
|
'A',
|
||||||
|
_stampa_width == 132 ? AVERE132 : AVERE198,
|
||||||
|
(const char *) ats);
|
||||||
set_row (r++, (const char*) riga);
|
set_row (r++, (const char*) riga);
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
@ -831,16 +837,10 @@ bool CG3400_application::preprocess_print(int file, int counter)
|
|||||||
switch (file)
|
switch (file)
|
||||||
{
|
{
|
||||||
case LF_MOV:
|
case LF_MOV:
|
||||||
|
_nuovo_mese = FALSE;
|
||||||
// _gia_settata_riga_mov = FALSE; // Stampa o no la riga di mov (solo se
|
|
||||||
// NO stampa giornale_iva_unico
|
|
||||||
|
|
||||||
_iva_array.destroy();
|
_iva_array.destroy();
|
||||||
|
|
||||||
_nprog_mov = _nprog_da;
|
_nprog_mov = _nprog_da;
|
||||||
|
|
||||||
*_RecPartoDa = _cur->file(LF_MOV).curr();
|
*_RecPartoDa = _cur->file(LF_MOV).curr();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -869,7 +869,7 @@ void CG3400_application::fill_page(int riga)
|
|||||||
// char frm[4];
|
// char frm[4];
|
||||||
word r_l = 0;
|
word r_l = 0;
|
||||||
|
|
||||||
r_l = printer().rows_left();
|
r_l = printer().rows_left() - RIGHE_FOOTER;
|
||||||
// Se sono rimaste righe da riempire
|
// Se sono rimaste righe da riempire
|
||||||
if (r_l)
|
if (r_l)
|
||||||
{
|
{
|
||||||
@ -896,14 +896,13 @@ void CG3400_application::fill_page(int riga)
|
|||||||
print_action CG3400_application::postprocess_page(int file, int counter)
|
print_action CG3400_application::postprocess_page(int file, int counter)
|
||||||
{
|
{
|
||||||
int righe_iva_settate=0;
|
int righe_iva_settate=0;
|
||||||
static bool nuovo_mese = FALSE;
|
|
||||||
bool FINITO = FALSE;
|
bool FINITO = FALSE;
|
||||||
|
|
||||||
if (counter)
|
if (counter)
|
||||||
{
|
{
|
||||||
if (nuovo_mese) {
|
if (_nuovo_mese) {
|
||||||
printer().formfeed();
|
printer().formfeed();
|
||||||
nuovo_mese = FALSE;
|
_nuovo_mese = FALSE;
|
||||||
}
|
}
|
||||||
return NEXT_PAGE;
|
return NEXT_PAGE;
|
||||||
}
|
}
|
||||||
@ -934,9 +933,9 @@ print_action CG3400_application::postprocess_page(int file, int counter)
|
|||||||
if (_data_corr != _data_succ || _cur->pos() == _cur->items())
|
if (_data_corr != _data_succ || _cur->pos() == _cur->items())
|
||||||
// if (_data_corr != _data_succ || FINITO)
|
// if (_data_corr != _data_succ || FINITO)
|
||||||
{
|
{
|
||||||
nuovo_mese = (_mese_succ != _mese_corr);
|
_nuovo_mese = (_mese_succ != _mese_corr);
|
||||||
int righe = set_totali_giorno(_data_corr, righe_iva_settate);
|
int righe = set_totali_giorno(_data_corr, righe_iva_settate);
|
||||||
if (nuovo_mese)
|
if (_nuovo_mese)
|
||||||
{
|
{
|
||||||
righe = set_totali_pagina(righe);
|
righe = set_totali_pagina(righe);
|
||||||
// Nella stampa su bollato metto un segno su tutte le righe
|
// Nella stampa su bollato metto un segno su tutte le righe
|
||||||
@ -1942,7 +1941,7 @@ bool CG3400_application::set_print(int)
|
|||||||
ma.set_handler (DATA_A, data_a_hndl);
|
ma.set_handler (DATA_A, data_a_hndl);
|
||||||
ma.set_handler (DATA_DA,data_da_hndl);
|
ma.set_handler (DATA_DA,data_da_hndl);
|
||||||
|
|
||||||
_pagina_da = 0; // Parto dall'inizio
|
_pagina_da = 0; // Parto dall'inizio
|
||||||
|
|
||||||
while ((tasto = ma.run()) != K_QUIT)
|
while ((tasto = ma.run()) != K_QUIT)
|
||||||
{
|
{
|
||||||
|
545
cg/cg4400.cpp
545
cg/cg4400.cpp
@ -140,18 +140,6 @@ bool CG4400_application::mask_tipo_stampa(TMask_field& f, KEY k)
|
|||||||
|
|
||||||
bool CG4400_application::mask_mese (TMask_field& f, KEY k)
|
bool CG4400_application::mask_mese (TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (k == K_ENTER)
|
|
||||||
{
|
|
||||||
if (id == MESE) //Per stampa su libro unico
|
|
||||||
{
|
|
||||||
int umese = f.mask().get_int(ULTIMO_MESE);
|
|
||||||
if (mese != umese+1)
|
|
||||||
return f.warning_box ("Le stampe devono essere richieste mese per mese!\n"
|
|
||||||
"I mesi successivi a %s non sono ancora stati stampati.", itom(umese));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (k == K_SPACE)
|
if (k == K_SPACE)
|
||||||
{
|
{
|
||||||
const short id = f.dlg();
|
const short id = f.dlg();
|
||||||
@ -161,6 +149,7 @@ bool CG4400_application::mask_mese (TMask_field& f, KEY k)
|
|||||||
if (id == FINO_A_MESE)
|
if (id == FINO_A_MESE)
|
||||||
mese = f.mask().get_int(FINO_A_MESE); //Per stampa su bollato
|
mese = f.mask().get_int(FINO_A_MESE); //Per stampa su bollato
|
||||||
if (id == MESE)
|
if (id == MESE)
|
||||||
|
{
|
||||||
if (mese == 12)
|
if (mese == 12)
|
||||||
{
|
{
|
||||||
f.mask().show (TIPO_RIEPILOGATIVO);
|
f.mask().show (TIPO_RIEPILOGATIVO);
|
||||||
@ -170,14 +159,23 @@ bool CG4400_application::mask_mese (TMask_field& f, KEY k)
|
|||||||
{
|
{
|
||||||
f.mask().hide (TIPO_RIEPILOGATIVO);
|
f.mask().hide (TIPO_RIEPILOGATIVO);
|
||||||
f.mask().hide (RIF_VID);
|
f.mask().hide (RIF_VID);
|
||||||
}
|
}
|
||||||
|
//TMask_field& cc = f.mask().field(CODICE_LIBRO_IVA);
|
||||||
|
//cc.set_dirty();
|
||||||
|
}
|
||||||
if (id == FINO_A_MESE)
|
if (id == FINO_A_MESE)
|
||||||
{
|
{
|
||||||
if (mese == 12)
|
if (mese == 12)
|
||||||
f.mask().show (TIPO_RIEPILOGATIVO);
|
f.mask().show (TIPO_RIEPILOGATIVO);
|
||||||
else f.mask().hide (TIPO_RIEPILOGATIVO);
|
else f.mask().hide (TIPO_RIEPILOGATIVO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (k==K_TAB && f.mask().is_running())
|
||||||
|
{
|
||||||
|
const short id = f.dlg();
|
||||||
|
if (id == MESE)
|
||||||
|
f.mask().send_key(K_TAB, CODICE_LIBRO_IVA);
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +221,7 @@ bool CG4400_application::look_reg(int i, int anno, TString& codlib, int m, const
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CG4400_application::look_regs(int anno, TString& codlib, int m, int* umese, long ditta)
|
bool CG4400_application::look_regs(int anno, TString& codlib, int m, int* umese, long ditta, bool* st)
|
||||||
{
|
{
|
||||||
int a, tipo;
|
int a, tipo;
|
||||||
TString16 codtab;
|
TString16 codtab;
|
||||||
@ -258,6 +256,7 @@ bool CG4400_application::look_regs(int anno, TString& codlib, int m, int* umese,
|
|||||||
if (u_data.month() < m - 1)
|
if (u_data.month() < m - 1)
|
||||||
{
|
{
|
||||||
app().set_firm(__firm);
|
app().set_firm(__firm);
|
||||||
|
*st = FALSE;
|
||||||
return error_box("Ditta %ld: Stampare i registri dei mesi precedenti", ditta);
|
return error_box("Ditta %ld: Stampare i registri dei mesi precedenti", ditta);
|
||||||
}
|
}
|
||||||
ok = TRUE;
|
ok = TRUE;
|
||||||
@ -312,9 +311,11 @@ bool CG4400_application::mask_libun (TMask_field& f, KEY k)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ok = app().look_regs(anno,codlib,fino_a_mese,&mese,ditta);
|
ok = app().look_regs(anno,codlib,fino_a_mese,&mese,ditta,&can_print);
|
||||||
if ( app()._selected[i] && !ok )
|
if ( app()._selected[i] && !ok )
|
||||||
{
|
{
|
||||||
|
if (!can_print)
|
||||||
|
return FALSE;
|
||||||
f.message_box("Ditta %ld: nessun registro soddisfa i parametri indicati", ditta);
|
f.message_box("Ditta %ld: nessun registro soddisfa i parametri indicati", ditta);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -744,11 +745,13 @@ void CG4400_application::calcola_progressivi()
|
|||||||
if ( _tipo_stampa == 2 || _tipo_stampa == 4 )
|
if ( _tipo_stampa == 2 || _tipo_stampa == 4 )
|
||||||
num = _datareg.month();
|
num = _datareg.month();
|
||||||
|
|
||||||
//calcolo i totali del periodo: il discorso e' indipendente dalla frequenza!
|
//il discorso e' indipendente dalla frequenza!
|
||||||
//if (_frequiva == 'T')
|
//if (_frequiva == 'T')
|
||||||
// if (num%3 != 0)
|
// if (num%3 != 0)
|
||||||
// num = num - (num%3);
|
// num = num - (num%3);
|
||||||
|
|
||||||
|
//calcolo i totali del periodo
|
||||||
|
|
||||||
chiave = "";
|
chiave = "";
|
||||||
//_codatt e' gia' Z perche' lo leggo dal registro
|
//_codatt e' gia' Z perche' lo leggo dal registro
|
||||||
chiave << _annoes << _codatt;
|
chiave << _annoes << _codatt;
|
||||||
@ -770,50 +773,25 @@ void CG4400_application::calcola_progressivi()
|
|||||||
real impo = pim.get_real("R0");
|
real impo = pim.get_real("R0");
|
||||||
real impos = pim.get_real("R1");
|
real impos = pim.get_real("R1");
|
||||||
real implo = pim.get_real("R2");
|
real implo = pim.get_real("R2");
|
||||||
|
TToken_string& fatt_rit = (TToken_string&)pim.get("S1");
|
||||||
|
real im = real::ita2eng(fatt_rit.get(0));
|
||||||
|
real is = real::ita2eng(fatt_rit.get(1));
|
||||||
|
impo += im;
|
||||||
|
impos += is;
|
||||||
|
implo += im+is;
|
||||||
_tot_iva_array.add_riga(impo,impos,implo,ZERO,ZERO,ZERO,codiva);
|
_tot_iva_array.add_riga(impo,impos,implo,ZERO,ZERO,ZERO,codiva);
|
||||||
if (_tipo_reg == 2) //registro acquisti
|
if (_tipo_reg == 2) //registro acquisti
|
||||||
_iva_array.add_riga(impo,impos,ZERO,ZERO,codiva,tipodet,0,TRUE);
|
_iva_array.add_riga(impo,impos,ZERO,ZERO,codiva,tipodet,0,TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//calcolo i totali progressivi
|
||||||
|
|
||||||
if (_tipo_stampa == 3)
|
if (_tipo_stampa == 3)
|
||||||
num = _fino_a_mese;
|
num = _fino_a_mese;
|
||||||
if ( _tipo_stampa == 2 || _tipo_stampa == 4 )
|
if ( _tipo_stampa == 2 || _tipo_stampa == 4 )
|
||||||
num = _datareg.month();
|
num = _datareg.month();
|
||||||
|
|
||||||
//calcolo i totali progressivi
|
|
||||||
/*
|
|
||||||
if (_frequiva == 'T')
|
|
||||||
for (i=3; i<num+3; i+=3)
|
|
||||||
{
|
|
||||||
chiave = "";
|
|
||||||
chiave << _annoes << _codatt;
|
|
||||||
pim.zero();
|
|
||||||
pim.put ("CODTAB", chiave);
|
|
||||||
TRectype r (pim.curr());
|
|
||||||
pim.read(_isgteq);
|
|
||||||
for (; !pim.eof(); pim.next())
|
|
||||||
{
|
|
||||||
if (pim.curr() != r) break;
|
|
||||||
|
|
||||||
TString80 codtab = pim.get("CODTAB");
|
|
||||||
TString16 codreg = codtab.mid(10,3);
|
|
||||||
int mese = atoi(codtab.mid(13,2));
|
|
||||||
if (_codreg == codreg && mese == i)
|
|
||||||
{
|
|
||||||
TString16 codiva = codtab.mid(16,4);
|
|
||||||
int tipodet = atoi(codtab.mid(20,1));
|
|
||||||
real impo = pim.get_real("R0");
|
|
||||||
real impos = pim.get_real("R1");
|
|
||||||
real implo = pim.get_real("R2");
|
|
||||||
_tot_iva_array.add_riga(ZERO,ZERO,ZERO,impo,impos,implo,codiva);
|
|
||||||
if (_tipo_reg == 2) //registro acquisti
|
|
||||||
_iva_array.add_riga(ZERO,ZERO,impo,impos,codiva,tipodet,0,TRUE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else //frequenza mensile
|
|
||||||
*/
|
|
||||||
for (i=1; i<=num; i++)
|
for (i=1; i<=num; i++)
|
||||||
{
|
{
|
||||||
chiave = "";
|
chiave = "";
|
||||||
@ -825,7 +803,6 @@ void CG4400_application::calcola_progressivi()
|
|||||||
for (; !pim.eof(); pim.next())
|
for (; !pim.eof(); pim.next())
|
||||||
{
|
{
|
||||||
if (pim.curr() != r) break;
|
if (pim.curr() != r) break;
|
||||||
|
|
||||||
TString80 codtab = pim.get("CODTAB");
|
TString80 codtab = pim.get("CODTAB");
|
||||||
TString16 codreg = codtab.mid(10,3);
|
TString16 codreg = codtab.mid(10,3);
|
||||||
int mese = atoi(codtab.mid(13,2));
|
int mese = atoi(codtab.mid(13,2));
|
||||||
@ -835,8 +812,13 @@ void CG4400_application::calcola_progressivi()
|
|||||||
int tipodet = atoi(codtab.mid(20,1));
|
int tipodet = atoi(codtab.mid(20,1));
|
||||||
real impo = pim.get_real("R0");
|
real impo = pim.get_real("R0");
|
||||||
real impos = pim.get_real("R1");
|
real impos = pim.get_real("R1");
|
||||||
real implo = pim.get_real("R2");
|
real implo = pim.get_real("R2");
|
||||||
|
TToken_string& fatt_rit = (TToken_string&)pim.get("S1");
|
||||||
|
real im = real::ita2eng(fatt_rit.get(0));
|
||||||
|
real is = real::ita2eng(fatt_rit.get(1));
|
||||||
|
impo += im;
|
||||||
|
impos += is;
|
||||||
|
implo += im+is;
|
||||||
_tot_iva_array.add_riga(ZERO,ZERO,ZERO,impo,impos,implo,codiva);
|
_tot_iva_array.add_riga(ZERO,ZERO,ZERO,impo,impos,implo,codiva);
|
||||||
if (_tipo_reg == 2) //registro acquisti
|
if (_tipo_reg == 2) //registro acquisti
|
||||||
_iva_array.add_riga(ZERO,ZERO,impo,impos,codiva,tipodet,0,TRUE);
|
_iva_array.add_riga(ZERO,ZERO,impo,impos,codiva,tipodet,0,TRUE);
|
||||||
@ -917,7 +899,7 @@ int CG4400_application::setta_riga(int r, const TRigaiva& riga, real& tot1,
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CG4400_application::controlla_liquidazione()
|
messaggio CG4400_application::controlla_liquidazione()
|
||||||
{
|
{
|
||||||
TTable lim ("LIM");
|
TTable lim ("LIM");
|
||||||
TTable pim ("PIM");
|
TTable pim ("PIM");
|
||||||
@ -925,14 +907,16 @@ bool CG4400_application::controlla_liquidazione()
|
|||||||
TString16 chiave = "";
|
TString16 chiave = "";
|
||||||
TString16 ditta = "";
|
TString16 ditta = "";
|
||||||
int i, mese;
|
int i, mese;
|
||||||
|
bool continua;
|
||||||
ditta << get_firm();
|
ditta << get_firm();
|
||||||
|
|
||||||
if (lim.empty())
|
/*
|
||||||
return yesno_box("Ditta %s: non esiste la tabella liquidazione iva mensile! Vuoi ugualmente continuare la stampa?", (const char*) ditta);
|
if (lim.empty())
|
||||||
if (pim.empty())
|
return yesno_box("Ditta %s: non esiste la tabella liquidazione iva mensile! Vuoi ugualmente continuare la stampa?", (const char*) ditta);
|
||||||
return yesno_box("Ditta %s: non esiste la tabella progressivi iva mensile! Vuoi ugualmente continuare la stampa?", (const char*) ditta);
|
if (pim.empty())
|
||||||
|
return yesno_box("Ditta %s: non esiste la tabella progressivi iva mensile! Vuoi ugualmente continuare la stampa?", (const char*) ditta);
|
||||||
|
*/
|
||||||
|
|
||||||
if (_tipo_stampa == 1) //stampa di prova
|
if (_tipo_stampa == 1) //stampa di prova
|
||||||
mese = _data_a.month();
|
mese = _data_a.month();
|
||||||
else
|
else
|
||||||
@ -948,11 +932,9 @@ bool CG4400_application::controlla_liquidazione()
|
|||||||
TString16 m (format("%02d", i));
|
TString16 m (format("%02d", i));
|
||||||
chiave << _annoes << m;
|
chiave << _annoes << m;
|
||||||
lim.put("CODTAB", chiave);
|
lim.put("CODTAB", chiave);
|
||||||
if (lim.read() != NOERR)
|
if (lim.read() == NOERR)
|
||||||
{
|
if (! lim.get_bool("B0"))
|
||||||
mesi_cal << itom(i) << "\n";
|
mesi_cal << itom(i) << "\n";
|
||||||
_st_liq[i] = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_frequiva == 'M')
|
if (_frequiva == 'M')
|
||||||
@ -963,17 +945,19 @@ bool CG4400_application::controlla_liquidazione()
|
|||||||
TString16 m (format("%02d", i));
|
TString16 m (format("%02d", i));
|
||||||
chiave << _annoes << m;
|
chiave << _annoes << m;
|
||||||
lim.put("CODTAB", chiave);
|
lim.put("CODTAB", chiave);
|
||||||
if (lim.read() != NOERR)
|
if (lim.read() == NOERR)
|
||||||
{
|
if (! lim.get_bool("B0"))
|
||||||
mesi_cal << itom(i) << "\n";
|
mesi_cal << itom(i) << "\n";
|
||||||
_st_liq[i] = TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mesi_cal.not_empty())
|
if (mesi_cal.not_empty())
|
||||||
{
|
{
|
||||||
warning_box ("Ditta %s: la liquidazione da stampare sul registro %s relativa ai mesi di \n %s non e' stata ancora calcolata", (const char*)ditta, (const char*) _codreg, (const char *)mesi_cal);
|
warning_box ("Ditta %s: la liquidazione da stampare sul registro %s relativa ai mesi di \n %s non e' stata ancora calcolata", (const char*)ditta, (const char*) _codreg, (const char *)mesi_cal);
|
||||||
return yesno_box("Vuoi ugualmente continuare la stampa?");
|
continua = yesno_box("Si desidera ugualmente proseguire?");
|
||||||
|
if (!continua) return non_proseguire;
|
||||||
|
continua = yesno_box("Si desidera proseguire con il calcolo e la stampa di liquidazione? \n (altrimenti si prosegue con la sola stampa di liquidazione)");
|
||||||
|
if (!continua) return prosegui_stampa;
|
||||||
|
return prosegui_cal_stampa;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_tipo_riepilogativo == 'A')
|
else if (_tipo_riepilogativo == 'A')
|
||||||
@ -982,10 +966,17 @@ bool CG4400_application::controlla_liquidazione()
|
|||||||
chiave = "";
|
chiave = "";
|
||||||
chiave << _annoes << 13;
|
chiave << _annoes << 13;
|
||||||
lim.put("CODTAB", chiave);
|
lim.put("CODTAB", chiave);
|
||||||
if (lim.read() != NOERR)
|
if (lim.read() == NOERR)
|
||||||
return yesno_box("Ditta %s: non eseguito calcolo liquidazione da stampare sul registro %s. Vuoi ugualmente continuare la stampa?", (const char*)ditta, (const char*) _codreg);
|
if (! lim.get_bool("B0"))
|
||||||
|
{
|
||||||
|
continua = yesno_box("Ditta %s: non eseguito calcolo liquidazione da stampare sul registro %s. Si desidera ugualmente proseguire?", (const char*)ditta, (const char*) _codreg);
|
||||||
|
if (!continua) return non_proseguire;
|
||||||
|
continua = yesno_box("Si desidera proseguire con il calcolo e la stampa di liquidazione? \n (altrimenti si prosegue con la sola stampa di liquidazione)");
|
||||||
|
if (!continua) return prosegui_stampa;
|
||||||
|
return prosegui_cal_stampa;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return B0_settato;
|
||||||
}
|
}
|
||||||
|
|
||||||
//controlla che i movimenti con anno data di registrazione < dell'anno indicato a video siano stati gia' stampati in forma definitiva*/
|
//controlla che i movimenti con anno data di registrazione < dell'anno indicato a video siano stati gia' stampati in forma definitiva*/
|
||||||
@ -1726,8 +1717,6 @@ bool CG4400_application::preprocess_print(int file, int counter)
|
|||||||
_auto_intraf = FALSE;
|
_auto_intraf = FALSE;
|
||||||
_intesta_liq = FALSE;
|
_intesta_liq = FALSE;
|
||||||
set_print_zero();
|
set_print_zero();
|
||||||
if (_tipo_stampa == 3)
|
|
||||||
calcola_progressivi(); //va fatto una volta sola, in questo caso
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -1767,8 +1756,8 @@ bool CG4400_application::preprocess_page(int file, int counter)
|
|||||||
TFilename t;
|
TFilename t;
|
||||||
t.temp("reg");
|
t.temp("reg");
|
||||||
if (_tipo_stampa == 1)
|
if (_tipo_stampa == 1)
|
||||||
send_message('L', t, m);
|
send_message('S', t, m);
|
||||||
else send_message('l', t, m);
|
else send_message('s', t, m);
|
||||||
TString80 nomef; nomef = t.path(); nomef << "\\" << t.name();
|
TString80 nomef; nomef = t.path(); nomef << "\\" << t.name();
|
||||||
if (fexist(nomef))
|
if (fexist(nomef))
|
||||||
{
|
{
|
||||||
@ -2007,6 +1996,36 @@ bool CG4400_application::preprocess_page(int file, int counter)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CG4400_application::scrivi_reg()
|
||||||
|
{
|
||||||
|
TString16 codtab;
|
||||||
|
TTable Tabreg ("REG");
|
||||||
|
|
||||||
|
codtab << _annoes << _codreg;
|
||||||
|
Tabreg.zero();
|
||||||
|
Tabreg.put("CODTAB", codtab);
|
||||||
|
if (Tabreg.read() == NOERR)
|
||||||
|
{
|
||||||
|
TDate d = Tabreg.get_date("D3");
|
||||||
|
if (!_mov_empty) //cioe' se e' stata stampata almeno una pagina
|
||||||
|
{
|
||||||
|
TDate ultima_data = format("%02d/%02d/%4d", _datareg.last_day(_datareg.month(), _annoes), _datareg.month(), _annoes);
|
||||||
|
if (ultima_data > d)
|
||||||
|
Tabreg.put("D3", ultima_data);
|
||||||
|
}
|
||||||
|
else if (_data_a > d)
|
||||||
|
Tabreg.put("D3", _data_a);
|
||||||
|
|
||||||
|
if (_tipo_reg == 2 && _stampa_cred_pre)
|
||||||
|
if (_mese_credito == 0 && _credito > ZERO)
|
||||||
|
if (_mov_empty)
|
||||||
|
Tabreg.put("I8", (long)_fino_a_mese);
|
||||||
|
else Tabreg.put("I8", (long)_datareg.month());
|
||||||
|
|
||||||
|
Tabreg.rewrite();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CG4400_application::aggiorna_reg(const bool aggiorna_vidi)
|
void CG4400_application::aggiorna_reg(const bool aggiorna_vidi)
|
||||||
{
|
{
|
||||||
TString16 codtab;
|
TString16 codtab;
|
||||||
@ -2203,32 +2222,72 @@ void CG4400_application::stampa_vidi()
|
|||||||
printer().close();
|
printer().close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CG4400_application::liq_b0_settato()
|
||||||
|
{
|
||||||
|
TFilename f;
|
||||||
|
f.temp("rg");
|
||||||
|
if (_tipo_stampa == 1)
|
||||||
|
send_message('S',f, _datareg.month());
|
||||||
|
else send_message('s',f, _datareg.month());
|
||||||
|
TString80 nomef;
|
||||||
|
nomef = f.path(); nomef << "\\" << f.name();
|
||||||
|
if (fexist(nomef))
|
||||||
|
{
|
||||||
|
printer().formfeed();
|
||||||
|
_intesta_liq = TRUE;
|
||||||
|
merge_export_file(f,FALSE,TRUE);
|
||||||
|
_intesta_liq = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CG4400_application::liq_other_case()
|
||||||
|
{
|
||||||
|
if (_scelta == prosegui_cal_stampa)
|
||||||
|
{
|
||||||
|
_t.temp("reg");
|
||||||
|
if (_tipo_stampa == 1)
|
||||||
|
send_message('L', _t, _datareg.month());
|
||||||
|
else send_message('l', _t, _datareg.month());
|
||||||
|
}
|
||||||
|
if (_scelta == prosegui_stampa)
|
||||||
|
{
|
||||||
|
_t.temp("reg");
|
||||||
|
if (_tipo_stampa == 1)
|
||||||
|
send_message('S', _t, _datareg.month());
|
||||||
|
else send_message('s', _t, _datareg.month());
|
||||||
|
TFilename app;
|
||||||
|
app.temp();
|
||||||
|
send_message('C', app, _datareg.month());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print_action CG4400_application::postprocess_page (int file, int counter)
|
print_action CG4400_application::postprocess_page (int file, int counter)
|
||||||
{
|
{
|
||||||
if (file == LF_MOV)
|
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
|
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
|
||||||
{
|
{
|
||||||
reset_print();
|
reset_print();
|
||||||
if (_liquidazione)
|
if (_liquidazione)
|
||||||
if (!_st_liq[_datareg.month()] && stampo_liquidazione(_datareg.month()))
|
if (!_st_liq[_datareg.month()] && stampo_liquidazione(_datareg.month()))
|
||||||
{
|
{
|
||||||
_st_liq[_datareg.month()] = TRUE;
|
_st_liq[_datareg.month()] = TRUE;
|
||||||
TFilename t;
|
if (_scelta == B0_settato)
|
||||||
t.temp("rg");
|
liq_b0_settato();
|
||||||
if (_tipo_stampa == 1)
|
if (_scelta == prosegui_stampa || _scelta == prosegui_cal_stampa)
|
||||||
send_message('L',t, _datareg.month());
|
{
|
||||||
else send_message('l',t, _datareg.month());
|
TString80 nomef;
|
||||||
TString80 nomef;
|
nomef = _t.path(); nomef << "\\" << _t.name();
|
||||||
nomef = t.path(); nomef << "\\" << t.name();
|
if (fexist(nomef))
|
||||||
if (fexist(nomef))
|
{
|
||||||
{
|
printer().formfeed();
|
||||||
printer().formfeed();
|
_intesta_liq = TRUE;
|
||||||
_intesta_liq = TRUE;
|
merge_export_file(_t,FALSE,TRUE);
|
||||||
merge_export_file(t,FALSE,TRUE);
|
_intesta_liq = FALSE;
|
||||||
_intesta_liq = FALSE;
|
}
|
||||||
}
|
_t = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!counter)
|
if (!counter)
|
||||||
{
|
{
|
||||||
@ -2240,7 +2299,8 @@ print_action CG4400_application::postprocess_page (int file, int counter)
|
|||||||
|
|
||||||
if ( FINITO )
|
if ( FINITO )
|
||||||
{
|
{
|
||||||
if (_tipo_stampa == 2 || _tipo_stampa == 4)
|
liq_other_case();
|
||||||
|
if (_tipo_stampa != 1)
|
||||||
calcola_progressivi();
|
calcola_progressivi();
|
||||||
set_page_tot_reg();
|
set_page_tot_reg();
|
||||||
return REPEAT_PAGE;
|
return REPEAT_PAGE;
|
||||||
@ -2256,7 +2316,8 @@ print_action CG4400_application::postprocess_page (int file, int counter)
|
|||||||
|
|
||||||
if (_dataregs.month() != _dataregp.month())
|
if (_dataregs.month() != _dataregp.month())
|
||||||
{
|
{
|
||||||
if (_tipo_stampa == 2 || _tipo_stampa == 4)
|
liq_other_case();
|
||||||
|
if (_tipo_stampa != 1)
|
||||||
calcola_progressivi();
|
calcola_progressivi();
|
||||||
set_page_tot_reg();
|
set_page_tot_reg();
|
||||||
return REPEAT_PAGE;
|
return REPEAT_PAGE;
|
||||||
@ -2274,7 +2335,6 @@ bool CG4400_application::set_print(int n)
|
|||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
m.set_handler (TIPO_STAMPA, mask_tipo_stampa);
|
m.set_handler (TIPO_STAMPA, mask_tipo_stampa);
|
||||||
//m.set_handler (A_CODICE, mask_firm_to);
|
|
||||||
m.set_handler (DA_DATA, mask_data);
|
m.set_handler (DA_DATA, mask_data);
|
||||||
m.set_handler (A_DATA, mask_data);
|
m.set_handler (A_DATA, mask_data);
|
||||||
m.set_handler (MESE, mask_mese);
|
m.set_handler (MESE, mask_mese);
|
||||||
@ -2384,12 +2444,97 @@ bool CG4400_application::look_lia(long ditta)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CG4400_application::look_reg()
|
||||||
|
{
|
||||||
|
_liquidazione = _tabreg->get_bool("B7");
|
||||||
|
_riep_liq = _tabreg->get_bool("B6");
|
||||||
|
_corrispettivi = _tabreg->get_bool("B0");
|
||||||
|
_pagine_stampate = _tabreg->get_long("I1");
|
||||||
|
_numini = _pagine_stampate;
|
||||||
|
_cod_un_loc = _tabreg->get_int("I7");
|
||||||
|
_mese_ultima_liq = _tabreg->get_int("I4");
|
||||||
|
_mese_credito = _tabreg->get_int("I8");
|
||||||
|
_codatt = _tabreg->get("S8");
|
||||||
|
_tipoatt = tipo_attivita();
|
||||||
|
_attivita = desc_attivita();
|
||||||
|
_desc_lib = _tabreg->get ("S0");
|
||||||
|
_stampa_ind_ditta = _tabreg->get_bool ("B9");
|
||||||
|
_stampa_ind_comp = _tabreg->get_bool ("B5");
|
||||||
|
_stampa_cred_pre = _tabreg->get_bool ("B4");
|
||||||
|
}
|
||||||
|
|
||||||
void CG4400_application::clear_stliq()
|
void CG4400_application::clear_stliq()
|
||||||
{
|
{
|
||||||
for (int i=0; i < 12; i++)
|
for (int i=0; i < 12; i++)
|
||||||
_st_liq[i] = FALSE;
|
_st_liq[i] = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CG4400_application::setta_mask(long i)
|
||||||
|
{
|
||||||
|
if (_stampa_mese == 13) _stampa_mese = 0;
|
||||||
|
if (_tipo_stampa == 2 || _tipo_stampa == 4)
|
||||||
|
{
|
||||||
|
TMask mb("cg4400b");
|
||||||
|
mb.set(F_CODDITTA, _ditta);
|
||||||
|
mb.set(F_RAGSOC, _ditte->row(i).get(2));
|
||||||
|
mb.set(COD_LIB, _codreg);
|
||||||
|
const char* m = "";
|
||||||
|
m = format("%02d", _stampa_mese);
|
||||||
|
mb.set(U_MESE, m);
|
||||||
|
mb.set(U_PAGINA, _pagine_stampate);
|
||||||
|
if (_u_data.ok())
|
||||||
|
mb.set(U_DATA, _u_data.string());
|
||||||
|
KEY tasto = mb.run();
|
||||||
|
if (tasto != K_ENTER) return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CG4400_application::no_movimenti()
|
||||||
|
{
|
||||||
|
_mov_empty = TRUE;
|
||||||
|
if (_liquidazione)
|
||||||
|
{
|
||||||
|
int da, a;
|
||||||
|
//stampo la liquidazione per tutti i mesi fino a _fino_a_mese
|
||||||
|
if (_tipo_stampa == 2 || _tipo_stampa == 4)
|
||||||
|
da = 1;
|
||||||
|
if (_tipo_stampa == 3)
|
||||||
|
da = _fino_a_mese;
|
||||||
|
if (_tipo_stampa == 1)
|
||||||
|
da = _data_da.month();
|
||||||
|
if (_tipo_stampa == 1)
|
||||||
|
a = _data_a.month();
|
||||||
|
else a = _fino_a_mese;
|
||||||
|
for (int m = da; m <= a; m++)
|
||||||
|
{
|
||||||
|
if (! printer().isopen())
|
||||||
|
printer().open();
|
||||||
|
if (stampo_liquidazione(m))
|
||||||
|
{
|
||||||
|
_datareg = format("01/%02d/%4d", m, _annoes); //serve per la preprocess_header
|
||||||
|
TFilename t;
|
||||||
|
t.temp("rgp");
|
||||||
|
if (_tipo_stampa == 1)
|
||||||
|
send_message('L',t, m);
|
||||||
|
else send_message('l',t, m);
|
||||||
|
TString80 nomef;
|
||||||
|
nomef = t.path(); nomef << "\\" << t.name();
|
||||||
|
if (fexist(nomef))
|
||||||
|
{
|
||||||
|
_intesta_liq = TRUE;
|
||||||
|
//if (m > da) printer().formfeed();
|
||||||
|
merge_export_file(t,FALSE,TRUE);
|
||||||
|
printer().formfeed();
|
||||||
|
_intesta_liq = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (printer().isopen()) printer().close();
|
||||||
|
}
|
||||||
|
scrivi_reg(); //aggiorno il registro anche se non ho stampato proprio nulla per quel mese!
|
||||||
|
}
|
||||||
|
|
||||||
bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
||||||
{
|
{
|
||||||
bool ok = FALSE;
|
bool ok = FALSE;
|
||||||
@ -2402,8 +2547,9 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
|||||||
_frequiva = _ditte->row(i).get_char(3);
|
_frequiva = _ditte->row(i).get_char(3);
|
||||||
_intesta_liq = FALSE;
|
_intesta_liq = FALSE;
|
||||||
_intesta_vidi = FALSE;
|
_intesta_vidi = FALSE;
|
||||||
_ok_vidi = FALSE;
|
_ok_vidi = FALSE;
|
||||||
_stampa_mese = 13;
|
_stampa_mese = 13;
|
||||||
|
_scelta = prosegui_stampa;
|
||||||
TApplication::set_firm(_ditta);
|
TApplication::set_firm(_ditta);
|
||||||
look_lia();
|
look_lia();
|
||||||
ok = compila_reg(m);
|
ok = compila_reg(m);
|
||||||
@ -2418,39 +2564,21 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
|||||||
_cur->set_filterfunction(filter_func);
|
_cur->set_filterfunction(filter_func);
|
||||||
if (!_stampa_tutti_i_registri)
|
if (!_stampa_tutti_i_registri)
|
||||||
{
|
{
|
||||||
|
ok = setta_mask(i);
|
||||||
|
if (!ok) continue;
|
||||||
if (_liquidazione)
|
if (_liquidazione)
|
||||||
{
|
{
|
||||||
clear_stliq();
|
clear_stliq();
|
||||||
ok = controlla_liquidazione();
|
_scelta = controlla_liquidazione();
|
||||||
if (!ok) continue;
|
if (_scelta == non_proseguire)
|
||||||
}
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
(*_cur) = 0L; //la filter function viene chiamata quando posiziono il cursore
|
(*_cur) = 0L; //la filter function viene chiamata quando posiziono il cursore
|
||||||
if (_stampa_mese == 13) _stampa_mese = 0;
|
|
||||||
const long item = _cur->items();
|
const long item = _cur->items();
|
||||||
if (_tipo_stampa == 2 || _tipo_stampa == 4)
|
|
||||||
{
|
|
||||||
TMask mb("cg4400b");
|
|
||||||
mb.set(F_CODDITTA, _ditta);
|
|
||||||
mb.set(F_RAGSOC, _ditte->row(i).get(2));
|
|
||||||
mb.set(COD_LIB, _codreg);
|
|
||||||
const char* m = "";
|
|
||||||
m = format("%02d", _stampa_mese);
|
|
||||||
mb.set(U_MESE, m);
|
|
||||||
mb.set(U_PAGINA, _pagine_stampate);
|
|
||||||
if (_u_data.ok())
|
|
||||||
mb.set(U_DATA, _u_data.string());
|
|
||||||
KEY tasto = mb.run();
|
|
||||||
if (tasto != K_ENTER) continue;
|
|
||||||
}
|
|
||||||
if (item > 0l)
|
if (item > 0l)
|
||||||
{
|
{
|
||||||
if (_tipo_stampa != 1)
|
|
||||||
{
|
|
||||||
TFilename t;
|
|
||||||
t.temp();
|
|
||||||
send_message('C',t, _fino_a_mese);
|
|
||||||
}
|
|
||||||
|
|
||||||
print();
|
print();
|
||||||
|
|
||||||
if (is_cancelled()) return FALSE;
|
if (is_cancelled()) return FALSE;
|
||||||
@ -2458,50 +2586,9 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
|||||||
if (_tipo_stampa != 3 && _liquidazione)
|
if (_tipo_stampa != 3 && _liquidazione)
|
||||||
stampa_liq_mesi_succ();
|
stampa_liq_mesi_succ();
|
||||||
}
|
}
|
||||||
else //non ci sono movimenti da stampare nel periodo richiesto!
|
//non ci sono movimenti da stampare nel periodo richiesto!
|
||||||
{
|
else no_movimenti();
|
||||||
_mov_empty = TRUE;
|
|
||||||
if (_liquidazione)
|
|
||||||
{
|
|
||||||
int da, a;
|
|
||||||
//stampo la liquidazione per tutti i mesi fino a _fino_a_mese
|
|
||||||
if (_tipo_stampa == 2 || _tipo_stampa == 4)
|
|
||||||
//da = _stampa_mese;
|
|
||||||
da = 1;
|
|
||||||
if (_tipo_stampa == 3)
|
|
||||||
da = _fino_a_mese;
|
|
||||||
if (_tipo_stampa == 1)
|
|
||||||
da = _data_da.month();
|
|
||||||
if (_tipo_stampa == 1)
|
|
||||||
a = _data_a.month();
|
|
||||||
else a = _fino_a_mese;
|
|
||||||
for (int m = da; m <= a; m++)
|
|
||||||
{
|
|
||||||
if (! printer().isopen())
|
|
||||||
printer().open();
|
|
||||||
if (stampo_liquidazione(m))
|
|
||||||
{
|
|
||||||
_datareg = format("01/%02d/%4d", m, _annoes); //serve per la preprocess_header
|
|
||||||
TFilename t;
|
|
||||||
t.temp("rgp");
|
|
||||||
if (_tipo_stampa == 1)
|
|
||||||
send_message('L',t, m);
|
|
||||||
else send_message('l',t, m);
|
|
||||||
TString80 nomef;
|
|
||||||
nomef = t.path(); nomef << "\\" << t.name();
|
|
||||||
if (fexist(nomef))
|
|
||||||
{
|
|
||||||
_intesta_liq = TRUE;
|
|
||||||
//if (m > da) printer().formfeed();
|
|
||||||
merge_export_file(t,FALSE,TRUE);
|
|
||||||
printer().formfeed();
|
|
||||||
_intesta_liq = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (printer().isopen()) printer().close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (_tipo_stampa == 3 && _rif_vid)
|
if (_tipo_stampa == 3 && _rif_vid)
|
||||||
{
|
{
|
||||||
_intesta_vidi = TRUE;
|
_intesta_vidi = TRUE;
|
||||||
@ -2563,64 +2650,34 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
msg = FALSE;
|
msg = FALSE;
|
||||||
_liquidazione = _tabreg->get_bool("B7");
|
|
||||||
_riep_liq = _tabreg->get_bool("B6");
|
look_reg();
|
||||||
_corrispettivi = _tabreg->get_bool("B0");
|
|
||||||
_pagine_stampate = _tabreg->get_long("I1");
|
|
||||||
_numini = _pagine_stampate;
|
|
||||||
_cod_un_loc = _tabreg->get_int("I7");
|
|
||||||
_mese_ultima_liq = _tabreg->get_int("I4");
|
|
||||||
_mese_credito = _tabreg->get_int("I8");
|
|
||||||
_codatt = _tabreg->get("S8");
|
|
||||||
_tipoatt = tipo_attivita();
|
|
||||||
_attivita = desc_attivita();
|
|
||||||
_desc_lib = _tabreg->get ("S0");
|
|
||||||
_stampa_ind_ditta = _tabreg->get_bool ("B9");
|
|
||||||
_stampa_ind_comp = _tabreg->get_bool ("B5");
|
|
||||||
_stampa_cred_pre = _tabreg->get_bool ("B4");
|
|
||||||
|
|
||||||
_intesta_liq = FALSE;
|
_intesta_liq = FALSE;
|
||||||
_intesta_vidi = FALSE;
|
_intesta_vidi = FALSE;
|
||||||
_ok_vidi = FALSE;
|
_ok_vidi = FALSE;
|
||||||
_stampa_mese = 13;
|
_stampa_mese = 13;
|
||||||
|
_scelta = prosegui_stampa;
|
||||||
|
ok = setta_mask(i);
|
||||||
|
if (!ok) continue;
|
||||||
|
|
||||||
|
if (_liquidazione)
|
||||||
|
{
|
||||||
|
clear_stliq();
|
||||||
|
_scelta = controlla_liquidazione();
|
||||||
|
if (_scelta == non_proseguire)
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
_cur->set_filterfunction(NULL);
|
_cur->set_filterfunction(NULL);
|
||||||
_cur->set_filterfunction(filter_func);
|
_cur->set_filterfunction(filter_func);
|
||||||
|
|
||||||
// Vado a vedere se ci sono movimenti
|
// Vado a vedere se ci sono movimenti
|
||||||
(*_cur) = 0L;
|
(*_cur) = 0L;
|
||||||
if (_stampa_mese == 13) _stampa_mese = 0;
|
|
||||||
const long items = _cur->items();
|
const long items = _cur->items();
|
||||||
if (_tipo_stampa == 2 || _tipo_stampa == 4)
|
|
||||||
{
|
|
||||||
TMask mb("cg4400b");
|
|
||||||
mb.set(F_CODDITTA, _ditta);
|
|
||||||
mb.set(F_RAGSOC, _ditte->row(i).get(2));
|
|
||||||
mb.set(COD_LIB, _codreg);
|
|
||||||
const char* m = "";
|
|
||||||
m = format("%02d", _stampa_mese);
|
|
||||||
mb.set(U_MESE, m);
|
|
||||||
mb.set(U_PAGINA, _pagine_stampate);
|
|
||||||
if (_u_data.ok())
|
|
||||||
mb.set(U_DATA, _u_data.string());
|
|
||||||
KEY tasto = mb.run();
|
|
||||||
if (tasto != K_ENTER) continue;
|
|
||||||
}
|
|
||||||
if (items > 0l)
|
if (items > 0l)
|
||||||
{
|
{
|
||||||
if (_tipo_stampa != 1)
|
|
||||||
{
|
|
||||||
if (_liquidazione) //per i registri "validi" eseguo il controllo liquidazione
|
|
||||||
{
|
|
||||||
clear_stliq();
|
|
||||||
ok = controlla_liquidazione();
|
|
||||||
if (!ok) continue;
|
|
||||||
}
|
|
||||||
TFilename t;
|
|
||||||
t.temp();
|
|
||||||
send_message('C',t, _fino_a_mese);
|
|
||||||
}
|
|
||||||
|
|
||||||
print();
|
print();
|
||||||
|
|
||||||
if (is_cancelled()) return FALSE;
|
if (is_cancelled()) return FALSE;
|
||||||
@ -2628,49 +2685,8 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
|||||||
if (_tipo_stampa != 3 && _liquidazione)
|
if (_tipo_stampa != 3 && _liquidazione)
|
||||||
stampa_liq_mesi_succ();
|
stampa_liq_mesi_succ();
|
||||||
}
|
}
|
||||||
else //anche se non ho dei movimenti devo stampare la liq. sotto certe ipotesi.
|
else no_movimenti();
|
||||||
{
|
|
||||||
_mov_empty = TRUE;
|
|
||||||
//stampo la liquidazione per tutti i mesi fino a _fino_a_mese (in caso di stampa = 2/3/4)
|
|
||||||
if (_liquidazione)
|
|
||||||
{
|
|
||||||
int da, a;
|
|
||||||
if (_tipo_stampa == 2 || _tipo_stampa == 4)
|
|
||||||
da = 1;
|
|
||||||
if (_tipo_stampa == 3)
|
|
||||||
da = _fino_a_mese;
|
|
||||||
if (_tipo_stampa == 1)
|
|
||||||
da = _data_da.month();
|
|
||||||
if (_tipo_stampa == 1)
|
|
||||||
a = _data_a.month();
|
|
||||||
else a = _fino_a_mese;
|
|
||||||
for (int m = da; m <= a; m++)
|
|
||||||
{
|
|
||||||
if (!printer().isopen())
|
|
||||||
printer().open();
|
|
||||||
if (stampo_liquidazione(m))
|
|
||||||
{
|
|
||||||
//ok = controlla_liquidazione();
|
|
||||||
//if (!ok) break;
|
|
||||||
_datareg = format("01/%02d/%4d", m, _annoes); //serve per la preprocess_header
|
|
||||||
TFilename t;
|
|
||||||
t.temp("rgi");
|
|
||||||
TString80 nomef; nomef = t.path(); nomef << "\\" << t.name();
|
|
||||||
if (_tipo_stampa == 1)
|
|
||||||
send_message('L',t, m);
|
|
||||||
else send_message('l',t, m);
|
|
||||||
if (fexist(nomef))
|
|
||||||
{
|
|
||||||
_intesta_liq = TRUE;
|
|
||||||
merge_export_file(t,FALSE,TRUE);
|
|
||||||
printer().formfeed();
|
|
||||||
_intesta_liq = FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (printer().isopen()) printer().close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (_tipo_stampa == 3 && _rif_vid)
|
if (_tipo_stampa == 3 && _rif_vid)
|
||||||
{
|
{
|
||||||
_intesta_vidi = TRUE;
|
_intesta_vidi = TRUE;
|
||||||
@ -2681,7 +2697,7 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
|||||||
if (msg)
|
if (msg)
|
||||||
message_box("Ditta %ld: Nessun registro soddisfa i parametri indicati", _ditta);
|
message_box("Ditta %ld: Nessun registro soddisfa i parametri indicati", _ditta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TApplication::set_firm(__firm);
|
TApplication::set_firm(__firm);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -2702,8 +2718,8 @@ void CG4400_application::stampa_liq_mesi_succ()
|
|||||||
TFilename t;
|
TFilename t;
|
||||||
t.temp("iva");
|
t.temp("iva");
|
||||||
if (_tipo_stampa == 1)
|
if (_tipo_stampa == 1)
|
||||||
send_message('L',t, m);
|
send_message('S',t, m);
|
||||||
else send_message('l',t,m);
|
else send_message('s',t,m);
|
||||||
TString80 nomef; nomef = t.path(); nomef << "\\" << t.name();
|
TString80 nomef; nomef = t.path(); nomef << "\\" << t.name();
|
||||||
if (fexist(nomef))
|
if (fexist(nomef))
|
||||||
{
|
{
|
||||||
@ -2720,18 +2736,25 @@ void CG4400_application::stampa_liq_mesi_succ()
|
|||||||
void CG4400_application::send_message(char tipo, const TFilename& nome, int mese)
|
void CG4400_application::send_message(char tipo, const TFilename& nome, int mese)
|
||||||
{
|
{
|
||||||
//const char* const app = "cg4a -2 -icon";
|
//const char* const app = "cg4a -2 -icon";
|
||||||
const char* const app = "cg4a -2";
|
const char* app;
|
||||||
|
|
||||||
|
if (tipo == 'S' || tipo == 's')
|
||||||
|
app = "cg4a -2 -S";
|
||||||
|
else if (tipo == 'C')
|
||||||
|
app = "cg4a -2 -C";
|
||||||
|
else app = "cg4a -2";
|
||||||
|
|
||||||
TToken_string ss(10);
|
TToken_string ss(10);
|
||||||
|
|
||||||
ss.add(_annoes);
|
ss.add(_annoes);
|
||||||
ss.add(mese);
|
ss.add(mese);
|
||||||
ss.add(_ditta);
|
ss.add(_ditta);
|
||||||
ss.add(tipo);
|
ss.add(tipo);
|
||||||
ss.add(_data_stampa.string());
|
ss.add(_data_stampa.string());
|
||||||
ss.add(nome);
|
ss.add(nome);
|
||||||
ss.add("x");
|
ss.add("x");
|
||||||
|
|
||||||
TMessage liq ("cg4a -2", "RCL", ss);
|
TMessage liq (app, "RCL", ss);
|
||||||
liq.send();
|
liq.send();
|
||||||
|
|
||||||
TExternal_app pn(app);
|
TExternal_app pn(app);
|
||||||
|
127
cg/cg4400.h
127
cg/cg4400.h
@ -26,7 +26,12 @@
|
|||||||
#include "cglib03.h"
|
#include "cglib03.h"
|
||||||
#include "conto.h"
|
#include "conto.h"
|
||||||
|
|
||||||
const int TABREG = (int)TTable::name2log("REG");
|
enum messaggio {
|
||||||
|
B0_settato,
|
||||||
|
non_proseguire,
|
||||||
|
prosegui_stampa,
|
||||||
|
prosegui_cal_stampa
|
||||||
|
};
|
||||||
|
|
||||||
class CG4400_application : public TPrintapp
|
class CG4400_application : public TPrintapp
|
||||||
{
|
{
|
||||||
@ -57,65 +62,14 @@ class CG4400_application : public TPrintapp
|
|||||||
real _totale_doc, _credito;
|
real _totale_doc, _credito;
|
||||||
TString _codreg, _desc_lib, _codatt, _attivita, _tipoatt;
|
TString _codreg, _desc_lib, _codatt, _attivita, _tipoatt;
|
||||||
TString _tipodoc, _descr_doc, _codlib, _codice_vidi;
|
TString _tipodoc, _descr_doc, _codlib, _codice_vidi;
|
||||||
TString _cofi,_cap,_paiva,_ragsoc,_comunefis,_provfis,_viafis;
|
TString _cofi,_cap,_paiva,_ragsoc,_comunefis,_provfis,_viafis;
|
||||||
|
TFilename _t;
|
||||||
|
messaggio _scelta;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
protected:
|
|
||||||
const char* desc_attivita ();
|
|
||||||
const char* tipo_attivita ();
|
|
||||||
const char* descr_doc ();
|
|
||||||
const char* descr_iva (const char *);
|
|
||||||
TRectype& ricerca_occ(const char*);
|
|
||||||
TRectype& ricerca_cf (char, long);
|
|
||||||
TRectype& look_comuni(const char*);
|
|
||||||
TArray_sheet* get_ditte_sheet() { return _ditte; }
|
|
||||||
int setta_riga (int, const TRigaiva&, real&, real&, real&, real&);
|
|
||||||
int riga_rmoviva();
|
|
||||||
bool set_print(int);
|
|
||||||
bool set_ditte(TMask&);
|
|
||||||
bool compila_reg(const TMask&);
|
|
||||||
bool compila_lib();
|
|
||||||
bool controlla_liquidazione();
|
|
||||||
bool controlla_mov();
|
|
||||||
bool stampo_liquidazione(int);
|
|
||||||
bool ventilazione(const char*);
|
|
||||||
bool cerca_libro_gio(TString&);
|
|
||||||
bool look_reg (int, int, TString&, int, const char*, int*, long);
|
|
||||||
bool look_regs(int, TString&, int, int*, long);
|
|
||||||
bool stampa_totali_finali();
|
|
||||||
bool stampa_datareg();
|
|
||||||
bool stampa_registri_IVA(const TMask&);
|
|
||||||
bool look_lia(long ditta = 0l);
|
|
||||||
void set_choice_limits(TMask&);
|
|
||||||
void build_ditte_sheet();
|
|
||||||
void cerca_reg(const TString&, byte*);
|
|
||||||
void set_page_tot_reg();
|
|
||||||
void send_message(char, const TFilename&,int);
|
|
||||||
void aggiorna_reg(const bool aggiorna_vidi);
|
|
||||||
void aggiorna_lib();
|
|
||||||
void calcola_progressivi();
|
|
||||||
void stampa_liq_mesi_succ();
|
|
||||||
bool user_create();
|
|
||||||
bool user_destroy();
|
|
||||||
bool preprocess_page(int, int);
|
|
||||||
int stampa_intestazione();
|
|
||||||
int stampa_prospetto();
|
|
||||||
long select_firm_range(long,long);
|
|
||||||
void stampa_plafonds(int);
|
|
||||||
void get_dati_ditta();
|
|
||||||
void stampa_vidi();
|
|
||||||
int stampa_acquisti(int);
|
|
||||||
real stampa_valori_plafonds(const real&, const int, TTable&, const char*);
|
|
||||||
bool preprocess_print(int, int);
|
|
||||||
print_action postprocess_page (int, int);
|
|
||||||
void preprocess_header();
|
|
||||||
void build_nomiditte(TProgind* pnd = NULL);
|
|
||||||
void set_year(int y) { _annoes = y; }
|
|
||||||
void clear_stliq();
|
|
||||||
|
|
||||||
static bool filter_func (const TRelation * r);
|
static bool filter_func (const TRelation * r);
|
||||||
|
|
||||||
static bool mask_tipo_stampa (TMask_field&, KEY);
|
static bool mask_tipo_stampa (TMask_field&, KEY);
|
||||||
//static bool mask_firm_to (TMask_field&, KEY);
|
|
||||||
static bool to_ditt_handler (TMask_field&, KEY);
|
static bool to_ditt_handler (TMask_field&, KEY);
|
||||||
static bool fr_ditt_handler (TMask_field&, KEY);
|
static bool fr_ditt_handler (TMask_field&, KEY);
|
||||||
static bool to_butt_handler (TMask_field&, KEY);
|
static bool to_butt_handler (TMask_field&, KEY);
|
||||||
@ -131,6 +85,65 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
const char* desc_attivita ();
|
||||||
|
const char* tipo_attivita ();
|
||||||
|
const char* descr_doc ();
|
||||||
|
const char* descr_iva (const char *);
|
||||||
|
TRectype& ricerca_occ(const char*);
|
||||||
|
TRectype& ricerca_cf (char, long);
|
||||||
|
TRectype& look_comuni(const char*);
|
||||||
|
TArray_sheet* get_ditte_sheet() { return _ditte; }
|
||||||
|
int setta_riga (int, const TRigaiva&, real&, real&, real&, real&);
|
||||||
|
int riga_rmoviva();
|
||||||
|
bool set_print(int);
|
||||||
|
bool set_ditte(TMask&);
|
||||||
|
bool compila_reg(const TMask&);
|
||||||
|
bool compila_lib();
|
||||||
|
messaggio controlla_liquidazione();
|
||||||
|
bool controlla_mov();
|
||||||
|
bool stampo_liquidazione(int);
|
||||||
|
bool ventilazione(const char*);
|
||||||
|
bool cerca_libro_gio(TString&);
|
||||||
|
bool look_reg (int, int, TString&, int, const char*, int*, long);
|
||||||
|
bool look_regs(int, TString&, int, int*, long, bool*);
|
||||||
|
bool stampa_totali_finali();
|
||||||
|
bool stampa_datareg();
|
||||||
|
bool stampa_registri_IVA(const TMask&);
|
||||||
|
bool look_lia(long ditta = 0l);
|
||||||
|
bool ricerca_mese(TString&,TString&,int,int,TMask_field&);
|
||||||
|
void set_choice_limits(TMask&);
|
||||||
|
void build_ditte_sheet();
|
||||||
|
void cerca_reg(const TString&, byte*);
|
||||||
|
void set_page_tot_reg();
|
||||||
|
void send_message(char, const TFilename&,int);
|
||||||
|
void aggiorna_reg(const bool aggiorna_vidi);
|
||||||
|
void aggiorna_lib();
|
||||||
|
void calcola_progressivi();
|
||||||
|
void stampa_liq_mesi_succ();
|
||||||
|
void look_reg();
|
||||||
|
void no_movimenti();
|
||||||
|
void liq_b0_settato();
|
||||||
|
void liq_other_case();
|
||||||
|
bool setta_mask(long);
|
||||||
|
bool preprocess_page(int, int);
|
||||||
|
int stampa_intestazione();
|
||||||
|
int stampa_prospetto();
|
||||||
|
long select_firm_range(long,long);
|
||||||
|
void stampa_plafonds(int);
|
||||||
|
void get_dati_ditta();
|
||||||
|
void stampa_vidi();
|
||||||
|
void scrivi_reg();
|
||||||
|
int stampa_acquisti(int);
|
||||||
|
real stampa_valori_plafonds(const real&, const int, TTable&, const char*);
|
||||||
|
void build_nomiditte(TProgind* pnd = NULL);
|
||||||
|
void set_year(int y) { _annoes = y; }
|
||||||
|
void clear_stliq();
|
||||||
|
virtual bool preprocess_print(int, int);
|
||||||
|
virtual bool user_create();
|
||||||
|
virtual bool user_destroy();
|
||||||
|
virtual print_action postprocess_page (int, int);
|
||||||
|
virtual void preprocess_header();
|
||||||
|
|
||||||
CG4400_application() : TPrintapp(), _ditte(NULL), _selected(10000), _nomiditte(100) {}
|
CG4400_application() : TPrintapp(), _ditte(NULL), _selected(10000), _nomiditte(100) {}
|
||||||
virtual ~CG4400_application() {}
|
virtual ~CG4400_application() {}
|
||||||
};
|
};
|
||||||
|
@ -133,7 +133,6 @@ BEGIN
|
|||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
WARNING "Inserire il codice del libro unico"
|
WARNING "Inserire il codice del libro unico"
|
||||||
VALIDATE ZEROFILL_FUNC 3
|
VALIDATE ZEROFILL_FUNC 3
|
||||||
MESSAGE K_TAB, CODICE_LIBRO_IVA
|
|
||||||
GROUP 2
|
GROUP 2
|
||||||
END
|
END
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user