Vari errori corretti
git-svn-id: svn://10.65.10.50/trunk@1567 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
ef951689fa
commit
e9a48cd2ea
@ -97,6 +97,10 @@ bool TLiquidazione_app::user_create()
|
||||
filename = subj.get(5);
|
||||
headerlen = subj.get_int(6);
|
||||
is_header = subj.items() == 7;
|
||||
//modifica del 5/07/1995
|
||||
int f = printer().formlen();
|
||||
printer().formlen(f - headerlen);
|
||||
//fine
|
||||
}
|
||||
|
||||
if(pnd) pnd->addstatus(1);
|
||||
@ -212,7 +216,8 @@ bool TLiquidazione_app::user_create()
|
||||
TTemp_window w(TASK_WIN);
|
||||
if (recalc_only)
|
||||
_isprint = FALSE;
|
||||
else printer().set_export_file(filename, is_header, headerlen);
|
||||
//else printer().set_export_file(filename, is_header, headerlen);
|
||||
else printer().set_export_file(filename, is_header);
|
||||
|
||||
// calcola liquidazione
|
||||
printer().setdate(printdate);
|
||||
|
@ -147,7 +147,7 @@ bool TLiquidazione_app::update_firm(int month, bool recalc)
|
||||
|
||||
look_lim(liq_month(month), TRUE);
|
||||
|
||||
if (_isregis && _lim->get_bool("B1") && _month != 13)
|
||||
if (_isfinal && _lim->get_bool("B1") && _month != 13)
|
||||
return TRUE;
|
||||
|
||||
TConfig cnf(CONFIG_DITTA, "cg");
|
||||
|
@ -856,19 +856,19 @@ void TLiquidazione_app::set_firm(_DescrItem& d)
|
||||
}
|
||||
|
||||
reset_header();
|
||||
|
||||
int soh = 1;
|
||||
if (!_isregis)
|
||||
{
|
||||
set_header(1,"Ditta %s %s@109gData @<@125gPag. @#",
|
||||
set_header(soh++,"Ditta %s %s@109gData @<@125gPag. @#",
|
||||
(const char*)(d._s0), (const char*)(d._s1));
|
||||
set_header(2,"");
|
||||
set_header(soh++,"");
|
||||
}
|
||||
set_header(3,sep);
|
||||
set_header(4,"%s@102gFrequenza %s",
|
||||
set_header(soh++,sep);
|
||||
set_header(soh++,"%s@102gFrequenza %s",
|
||||
(const char*)tim_title,
|
||||
d._s2 == "T" ? "Trimestrale" : "Mensile");
|
||||
set_header(5,sep);
|
||||
set_header(6,"");
|
||||
set_header(soh++,sep);
|
||||
set_header(soh++,"");
|
||||
|
||||
// notify errors if any
|
||||
int j = 0;
|
||||
@ -937,16 +937,17 @@ void TLiquidazione_app::set_att(_DescrItem& d)
|
||||
(const char*)tipatt);
|
||||
|
||||
reset_header();
|
||||
int soh=1;
|
||||
if (!_isregis)
|
||||
{
|
||||
set_header(1,"Ditta %s %s@109gData @<@125gPag. @#",
|
||||
set_header(soh++,"Ditta %s %s@109gData @<@125gPag. @#",
|
||||
(const char*)(d._s0), (const char*)(d._s1));
|
||||
set_header(2,"");
|
||||
set_header(soh++,"");
|
||||
}
|
||||
set_header(3,sep);
|
||||
set_header(4,"%s@55g%s", (const char*)tim_title, (const char*)att_title);
|
||||
set_header(5,sep);
|
||||
set_header(6,"");
|
||||
set_header(soh++,sep);
|
||||
set_header(soh++,"%s@55g%s", (const char*)tim_title, (const char*)att_title);
|
||||
set_header(soh++,sep);
|
||||
set_header(soh++,"");
|
||||
|
||||
// notify errors if any
|
||||
int j = 0;
|
||||
|
132
cg/cg4400.cpp
132
cg/cg4400.cpp
@ -327,6 +327,7 @@ bool CG4400_application::mask_libun (TMask_field& f, KEY k)
|
||||
can_print = FALSE;
|
||||
return error_box("Ditta %ld: Stampare i registri dei mesi precedenti", ditta);
|
||||
}
|
||||
//modifica del 30/06/1995
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -793,20 +794,28 @@ void CG4400_application::calcola_progressivi()
|
||||
real impo = pim.get_real("R0");
|
||||
real impos = pim.get_real("R1");
|
||||
real implo = pim.get_real("R2");
|
||||
//se il registro e' corrispettivi l'imponibile e l'iva li trovo in S2
|
||||
if (_corrispettivi)
|
||||
{
|
||||
TToken_string cs (pim.get("S2"));
|
||||
impo = cs.get(0);
|
||||
impos = cs.get(1);
|
||||
}
|
||||
TToken_string fatt_rit (pim.get("S1"));
|
||||
real im (fatt_rit.get(0));
|
||||
real is (fatt_rit.get(1));
|
||||
impo += im;
|
||||
impos += is;
|
||||
implo += im+is;
|
||||
if (impo != ZERO || impos != ZERO || implo != ZERO)
|
||||
_tot_iva_array.add_riga(impo,impos,implo,ZERO,ZERO,ZERO,codiva);
|
||||
if (_tipo_reg == 2) //registro acquisti
|
||||
if (impo != ZERO || impos != ZERO)
|
||||
_iva_array.add_riga(impo,impos,ZERO,ZERO,codiva,tipodet,0,TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
//calcolo i totali progressivi
|
||||
|
||||
if (_tipo_stampa == 3)
|
||||
num = _fino_a_mese;
|
||||
if ( _tipo_stampa == 2 || _tipo_stampa == 4 )
|
||||
@ -833,14 +842,23 @@ void CG4400_application::calcola_progressivi()
|
||||
real impo = pim.get_real("R0");
|
||||
real impos = pim.get_real("R1");
|
||||
real implo = pim.get_real("R2");
|
||||
//se il registro e' corrispettivi l'imponibile e l'iva li trovo in S2
|
||||
if (_corrispettivi)
|
||||
{
|
||||
TToken_string cs (pim.get("S2"));
|
||||
impo = cs.get(0);
|
||||
impos = cs.get(1);
|
||||
}
|
||||
TToken_string fatt_rit (pim.get("S1"));
|
||||
real im (fatt_rit.get(0));
|
||||
real is (fatt_rit.get(1));
|
||||
impo += im;
|
||||
impos += is;
|
||||
implo += im+is;
|
||||
if (impo != ZERO || impos != ZERO || implo != ZERO)
|
||||
_tot_iva_array.add_riga(ZERO,ZERO,ZERO,impo,impos,implo,codiva);
|
||||
if (_tipo_reg == 2) //registro acquisti
|
||||
if (impo != ZERO || impos != ZERO)
|
||||
_iva_array.add_riga(ZERO,ZERO,impo,impos,codiva,tipodet,0,TRUE);
|
||||
}
|
||||
}
|
||||
@ -972,7 +990,7 @@ messaggio CG4400_application::controlla_b0()
|
||||
}
|
||||
}
|
||||
else if (_tipo_riepilogativo == 'A')
|
||||
if (_riep_liq)
|
||||
//if (_riep_liq)
|
||||
{
|
||||
chiave = "";
|
||||
chiave << _annoes << 13;
|
||||
@ -1047,7 +1065,7 @@ messaggio CG4400_application::controlla_liquidazione()
|
||||
}
|
||||
}
|
||||
else if (_tipo_riepilogativo == 'A')
|
||||
if (_riep_liq)
|
||||
//if (_riep_liq)
|
||||
{
|
||||
chiave = "";
|
||||
chiave << _annoes << 13;
|
||||
@ -1056,7 +1074,7 @@ messaggio CG4400_application::controlla_liquidazione()
|
||||
{
|
||||
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);
|
||||
continua = yesno_box("Ditta %s: non eseguito calcolo liquidazione annuale 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;
|
||||
@ -1065,7 +1083,7 @@ messaggio CG4400_application::controlla_liquidazione()
|
||||
}
|
||||
else
|
||||
{
|
||||
continua = yesno_box("Ditta %s: non eseguito calcolo liquidazione da stampare sul registro %s. Si desidera ugualmente proseguire?", (const char*)ditta, (const char*) _codreg);
|
||||
continua = yesno_box("Ditta %s: non eseguito calcolo liquidazione annuale 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;
|
||||
@ -1107,11 +1125,12 @@ bool CG4400_application::controlla_mov()
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool CG4400_application::cerca_libro_gio(TString& datas)
|
||||
bool CG4400_application::cerca_libro_gio(TString& datas, bool* good)
|
||||
{
|
||||
TString app(4);
|
||||
app = format("%04d", _annoes);
|
||||
|
||||
*good = TRUE;
|
||||
TRecnotype rec = _tabreg->recno();
|
||||
_tabreg->zero();
|
||||
_tabreg->put ("CODTAB", app);
|
||||
@ -1128,12 +1147,15 @@ bool CG4400_application::cerca_libro_gio(TString& datas)
|
||||
if (data > _data_a)
|
||||
{
|
||||
datas = format("%02/%02d/%4d", data.day(), data.month(), data.year());
|
||||
*good = FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
_tabreg->readat(rec);
|
||||
return TRUE;
|
||||
//return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CG4400_application::cerca_reg(const TString& c, byte* t)
|
||||
@ -1744,7 +1766,7 @@ bool CG4400_application::compila_reg(const TMask& m)
|
||||
anno = atoi(codtab.mid(0,4));
|
||||
if (anno > _annoes)
|
||||
{
|
||||
if (_tipo_stampa != 3) //per il libro unico e' gia' stato controllato
|
||||
if (_tipo_stampa != 3) //per il libro unico e' gia' stato controllato nell'handler
|
||||
warning_box("Non esistono registri IVA della Ditta %ld per l'anno %d",
|
||||
_ditta, _annoes);
|
||||
return FALSE;
|
||||
@ -1774,13 +1796,6 @@ bool CG4400_application::compila_reg(const TMask& m)
|
||||
_u_data = _tabreg->get_date ("D3");
|
||||
if ( _tipo_stampa == 2 || _tipo_stampa == 4 )
|
||||
{
|
||||
if (_u_data.ok())
|
||||
if (_data_a < _u_data)
|
||||
{
|
||||
TString16 datas = format("%02d/%02d/%4d", _u_data.day(), _u_data.month(), _u_data.year());
|
||||
warning_box ("Ditta %ld: la data specificata non deve essere inferiore al %s (ultima data di stampa specificata sul registro)", _ditta, (const char*)datas);
|
||||
return FALSE;
|
||||
}
|
||||
if (cod_lib_un.not_empty())
|
||||
{
|
||||
warning_box ("Ditta %ld: sul registro non deve essere indicato il codice del libro unico", _ditta);
|
||||
@ -1792,12 +1807,21 @@ bool CG4400_application::compila_reg(const TMask& m)
|
||||
warning_box ("Ditta %ld: il mese della data scadenza vidimazione riportata sul registro non deve essere inferiore al mese indicato", _ditta);
|
||||
return FALSE;
|
||||
}
|
||||
if (_u_data.ok())
|
||||
if (_data_a < _u_data)
|
||||
{
|
||||
TString16 datas = format("%02d/%02d/%4d", _u_data.day(), _u_data.month(), _u_data.year());
|
||||
warning_box ("Ditta %ld: la data specificata non deve essere inferiore al %s (ultima data di stampa specificata sul registro)", _ditta, (const char*)datas);
|
||||
return FALSE;
|
||||
}
|
||||
if (_tipo_stampa == 4) //stampa con riferimenti al libro giornale
|
||||
{
|
||||
TString16 datas;
|
||||
bool ok = cerca_libro_gio(datas);
|
||||
bool good;
|
||||
bool ok = cerca_libro_gio(datas,&good);
|
||||
if (!ok)
|
||||
{
|
||||
if (!good)
|
||||
warning_box ("Ditta %ld: la data indicata non deve essere superiore al %s (ultima data di stampa del libro giornale)", _ditta, (const char*)datas);
|
||||
return FALSE;
|
||||
}
|
||||
@ -1913,7 +1937,7 @@ bool CG4400_application::preprocess_page(int file, int counter)
|
||||
if (fexist(t))
|
||||
{
|
||||
_intesta_liq = TRUE;
|
||||
printer().footerlen(0);
|
||||
//printer().footerlen(0);
|
||||
merge_export_file(t,FALSE,TRUE);
|
||||
printer().formfeed();
|
||||
_intesta_liq = FALSE;
|
||||
@ -1932,7 +1956,7 @@ bool CG4400_application::preprocess_page(int file, int counter)
|
||||
{
|
||||
_auto_intraf = FALSE;
|
||||
printer().formfeed();
|
||||
printer().footerlen(5); //devo rimetterlo cosi'
|
||||
//printer().footerlen(5); //devo rimetterlo cosi'
|
||||
}
|
||||
|
||||
_dataregp = _datareg;
|
||||
@ -2231,7 +2255,9 @@ void CG4400_application::aggiorna_reg(const bool aggiorna_vidi)
|
||||
Tabreg.put("I1", _pagine_stampate);
|
||||
|
||||
if (_intesta_liq)
|
||||
Tabreg.put("I4", (long)_datareg.month());
|
||||
if (_tipo_riepilogativo == 'A')
|
||||
Tabreg.put("I4", 13L);
|
||||
else Tabreg.put("I4", (long)_datareg.month());
|
||||
|
||||
if (_tipo_reg == 2 && _stampa_cred_pre)
|
||||
if (_mese_credito == 0 && _credito > ZERO)
|
||||
@ -2327,6 +2353,8 @@ void CG4400_application::aggiorna_lib()
|
||||
|
||||
bool CG4400_application::stampo_liquidazione(int mese)
|
||||
{
|
||||
//test tradotti alla lettera da AS/400
|
||||
//assolutamente incongruenti !!!
|
||||
if (_tipo_stampa == 1)
|
||||
{
|
||||
if ( (_frequiva == 'T' && (mese == 3 || mese == 6 || mese == 9 || mese == 12))
|
||||
@ -2429,7 +2457,7 @@ void CG4400_application::liq_b0_settato()
|
||||
{
|
||||
printer().formfeed();
|
||||
_intesta_liq = TRUE;
|
||||
printer().footerlen(0);
|
||||
//printer().footerlen(0);
|
||||
merge_export_file(f,FALSE,TRUE);
|
||||
_intesta_liq = FALSE;
|
||||
remove(f);
|
||||
@ -2498,7 +2526,7 @@ print_action CG4400_application::postprocess_page (int file, int counter)
|
||||
{
|
||||
printer().formfeed();
|
||||
_intesta_liq = TRUE;
|
||||
printer().footerlen(0);
|
||||
//printer().footerlen(0);
|
||||
merge_export_file(_t,FALSE,TRUE);
|
||||
_intesta_liq = FALSE;
|
||||
remove(_t);
|
||||
@ -2569,7 +2597,7 @@ bool CG4400_application::set_print(int n)
|
||||
m.field(F_SELECT).set(format("%ld",_selected.ones()));
|
||||
set_choice_limits(m);
|
||||
|
||||
printer().footerlen(5);
|
||||
//printer().footerlen(5);
|
||||
set_real_picture("###.###.###.###");
|
||||
|
||||
while (ok = set_ditte(m))
|
||||
@ -2744,13 +2772,10 @@ void CG4400_application::no_movimenti()
|
||||
send_message('L', f, m);
|
||||
else send_message('l', f, m);
|
||||
}
|
||||
//TString80 nomef;
|
||||
//nomef = f.path(); nomef << "\\" << f.name();
|
||||
//if (fexist(nomef))
|
||||
if (fexist(f))
|
||||
{
|
||||
_intesta_liq = TRUE;
|
||||
printer().footerlen(0);
|
||||
//printer().footerlen(0);
|
||||
merge_export_file(f,FALSE,TRUE);
|
||||
printer().formfeed();
|
||||
_intesta_liq = FALSE;
|
||||
@ -2778,7 +2803,6 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
||||
_primast = _u_stampata;
|
||||
_ok_vidi = FALSE;
|
||||
_stampa_mese = 13;
|
||||
//_scelta = controlla_b0();
|
||||
|
||||
TApplication::set_firm(_ditta);
|
||||
look_lia();
|
||||
@ -2799,8 +2823,8 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
||||
if (_liquidazione)
|
||||
{
|
||||
if (_tipo_stampa == 2 || _tipo_stampa == 4)
|
||||
_size_header = _stampa_ind_ditta ? 8 : 6;
|
||||
else _size_header = 8;
|
||||
_size_header = _stampa_ind_ditta ? 3 : 2;
|
||||
else _size_header = 3;
|
||||
clear_stliq();
|
||||
_scelta = controlla_liquidazione();
|
||||
if (_scelta == non_proseguire)
|
||||
@ -2853,27 +2877,30 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
||||
_codreg = codtab.mid(4,3);
|
||||
cod_lib_un = _tabreg->get("S6");
|
||||
sca_vid = _tabreg->get_date("D1");
|
||||
_stampa_ind_ditta = _tabreg->get_bool("B9");
|
||||
_liquidazione = _tabreg->get_bool("B7");
|
||||
if (_tipo_stampa != 1)
|
||||
_u_data = _tabreg->get_date("D3");
|
||||
if (_tipo_stampa == 2 || _tipo_stampa == 4)
|
||||
{
|
||||
if (_u_data.ok())
|
||||
if (_data_a <= _u_data)
|
||||
{
|
||||
message_box("Ditta %ld: Il registro %s e' gia' stato stampato come bollato di %s", _ditta, (const char*) _codreg, itom(_fino_a_mese));
|
||||
continue;
|
||||
}
|
||||
if (cod_lib_un.not_empty())
|
||||
continue;
|
||||
if (sca_vid.ok())
|
||||
if (sca_vid.month() < _fino_a_mese)
|
||||
continue;
|
||||
if (_u_data.ok())
|
||||
if (_data_a < _u_data)
|
||||
{
|
||||
message_box("Ditta %ld: Il registro %s e' gia' stato stampato come bollato di %s", _ditta, (const char*) _codreg, itom(_fino_a_mese));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (_tipo_stampa == 4) //stampa con riferimenti al libro giornale
|
||||
{
|
||||
TString16 d;
|
||||
bool good;
|
||||
TRecnotype rec = _tabreg->recno();
|
||||
bool trovato = cerca_libro_gio(d);
|
||||
bool trovato = cerca_libro_gio(d, &good);
|
||||
_tabreg->readat(rec);
|
||||
if (!trovato)
|
||||
continue;
|
||||
@ -2882,12 +2909,12 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
||||
{
|
||||
if (cod_lib_un != _codlib)
|
||||
continue;
|
||||
if (_u_data.ok())
|
||||
if (_fino_a_mese < _u_data.month())
|
||||
continue;
|
||||
if (sca_vid.ok())
|
||||
if (sca_vid.month() < _fino_a_mese)
|
||||
continue;
|
||||
if (_u_data.ok())
|
||||
if (_fino_a_mese < _u_data.month()) //significa che e' gia'
|
||||
continue;
|
||||
}
|
||||
msg = FALSE;
|
||||
|
||||
@ -2907,8 +2934,8 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
||||
if (_liquidazione)
|
||||
{
|
||||
if (_tipo_stampa == 2 || _tipo_stampa == 4)
|
||||
_size_header = _stampa_ind_ditta ? 8 : 6;
|
||||
else _size_header = 8;
|
||||
_size_header = _stampa_ind_ditta ? 3 : 2;
|
||||
else _size_header = 3;
|
||||
clear_stliq();
|
||||
_scelta = controlla_liquidazione();
|
||||
if (_scelta == non_proseguire)
|
||||
@ -2938,7 +2965,8 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
||||
if (_tipo_stampa != 3 && _liquidazione)
|
||||
stampa_liq_mesi_succ();
|
||||
}
|
||||
else no_movimenti();
|
||||
else
|
||||
no_movimenti();
|
||||
|
||||
if (_tipo_stampa == 3 && _rif_vid)
|
||||
{
|
||||
@ -2981,7 +3009,7 @@ void CG4400_application::stampa_liq_mesi_succ()
|
||||
{
|
||||
_intesta_liq = TRUE;
|
||||
if (m > da) printer().formfeed();
|
||||
printer().footerlen(0);
|
||||
//printer().footerlen(0);
|
||||
merge_export_file(t,FALSE,TRUE);
|
||||
_intesta_liq = FALSE;
|
||||
remove(t);
|
||||
@ -3004,13 +3032,15 @@ void CG4400_application::send_message(char tipo, const TFilename& nome, int mese
|
||||
TToken_string ss(10);
|
||||
|
||||
ss.add(_annoes);
|
||||
ss.add(mese);
|
||||
if (_tipo_riepilogativo == 'A' && mese == 12)
|
||||
ss.add(13);
|
||||
else ss.add(mese);
|
||||
ss.add(_ditta);
|
||||
ss.add(tipo);
|
||||
ss.add(_data_stampa.string());
|
||||
ss.add(nome);
|
||||
ss.add(_size_header);
|
||||
ss.add("x");
|
||||
//ss.add("x");
|
||||
|
||||
TMessage liq (app, "RCL", ss);
|
||||
liq.send();
|
||||
@ -3161,7 +3191,7 @@ void CG4400_application::preprocess_header()
|
||||
mese = _datareg.month();
|
||||
anno = _datareg.year();
|
||||
}
|
||||
else
|
||||
else //se _tipo_stampa == 3 (su libro unico) sto stampando un solo mese
|
||||
{
|
||||
mese = _fino_a_mese;
|
||||
anno = _annoes;
|
||||
@ -3211,15 +3241,23 @@ void CG4400_application::preprocess_header()
|
||||
|
||||
if (_intesta_liq)
|
||||
{
|
||||
/*
|
||||
r++;
|
||||
set_header(r++, "CALCOLO LIQUIDAZIONE IVA");
|
||||
set_header(r++,riga);
|
||||
TString title (80);
|
||||
title << "Liquidazione IVA del periodo: ";
|
||||
title << "Liquidazione IVA ";
|
||||
if (_tipo_riepilogativo == 'A' && mese == 12)
|
||||
title << "Annuale " << format("%d", anno);
|
||||
else
|
||||
{
|
||||
title << "del periodo";
|
||||
title << format(" %s %d", itom(mese), anno);
|
||||
}
|
||||
set_header(r++, "%s@102g Frequenza %s", (const char*) title, _frequiva == 'T' ? "T" : "M");
|
||||
set_header(r++,riga);
|
||||
set_header(r,"");
|
||||
*/
|
||||
}
|
||||
else //non sto stampando la liquidazione
|
||||
{
|
||||
|
@ -109,7 +109,7 @@ public:
|
||||
bool controlla_mov();
|
||||
bool stampo_liquidazione(int);
|
||||
bool ventilazione(const char*);
|
||||
bool cerca_libro_gio(TString&);
|
||||
bool cerca_libro_gio(TString&, bool*);
|
||||
bool look_reg (int, int, TString&, int, const char*, int*, long);
|
||||
bool look_regs(int, TString&, int, int*, long, bool*);
|
||||
bool stampa_totali_finali();
|
||||
|
121
cg/cg4600.cpp
121
cg/cg4600.cpp
@ -73,9 +73,54 @@ public:
|
||||
CG4600_application() {}
|
||||
};
|
||||
|
||||
bool mask_datac (TMask_field& f, KEY k)
|
||||
HIDDEN bool abilita_anni(TMask& m, KEY k)
|
||||
{
|
||||
if (k == K_SHIFT+K_F12)
|
||||
{
|
||||
m.enable(F_ANNOCH);
|
||||
m.enable(F_ANNO);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HIDDEN bool anni_contigui (int annoch, int annoap)
|
||||
{
|
||||
TString16 dep(format("%04d", annoch));
|
||||
|
||||
TTable esc ("ESC");
|
||||
|
||||
esc.zero();
|
||||
esc.put("CODTAB", dep);
|
||||
esc.read();
|
||||
esc.next();
|
||||
int anno = atoi(esc.get("CODTAB"));
|
||||
if (anno != annoap)
|
||||
return warning_box("I due esercizi indicati non risultano contigui");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
HIDDEN TRectype& cerca_esercizio(int anno)
|
||||
{
|
||||
TTable TabEs ("ESC");
|
||||
TString16 dep (format("%04d", anno));
|
||||
|
||||
TabEs.zero();
|
||||
TabEs.put("CODTAB", dep);
|
||||
if (TabEs.read() == NOERR)
|
||||
return TabEs.curr();
|
||||
else
|
||||
warning_box("Esercizio non presente in tabella esercizi");
|
||||
|
||||
TabEs.zero();
|
||||
|
||||
return TabEs.curr();
|
||||
}
|
||||
|
||||
bool mask_datac (TMask_field& f, KEY k)
|
||||
{
|
||||
//TTable TabEs ("ESC");
|
||||
TTable TabReg("REG");
|
||||
TString annos (4);
|
||||
int anno = 0;;
|
||||
@ -83,6 +128,22 @@ bool mask_datac (TMask_field& f, KEY k)
|
||||
|
||||
if ( (k == K_ENTER) && f.to_check(k) )
|
||||
{
|
||||
int annoch = f.mask().get_int(F_ANNOCH);
|
||||
int annoap = f.mask().get_int(F_ANNO);
|
||||
|
||||
if (!anni_contigui(annoch,annoap))
|
||||
return FALSE;
|
||||
|
||||
TRectype TabEsch = cerca_esercizio(annoap);
|
||||
TDate inizio = TabEsch.get_date("D0");
|
||||
TDate fine = TabEsch.get_date("D1");
|
||||
TDate scarico = TabEsch.get_date("D2");
|
||||
|
||||
TRectype TabEsap = cerca_esercizio(annoch);
|
||||
TDate iniziop = TabEsap.get_date("D0");
|
||||
TDate finep = TabEsap.get_date("D1");
|
||||
TDate data = f.get();
|
||||
/*
|
||||
TabEs.last();
|
||||
TDate inizio = TabEs.get_date("D0");
|
||||
TDate fine = TabEs.get_date("D1");
|
||||
@ -91,7 +152,7 @@ bool mask_datac (TMask_field& f, KEY k)
|
||||
TDate iniziop = TabEs.get_date("D0");
|
||||
TDate finep = TabEs.get_date("D1");
|
||||
TDate data = f.get();
|
||||
|
||||
*/
|
||||
TString istr = inizio.string();
|
||||
TString fstr = fine.string();
|
||||
|
||||
@ -161,6 +222,22 @@ bool mask_dataap (TMask_field& f, KEY k)
|
||||
|
||||
if ( (k == K_ENTER) && f.to_check(k) )
|
||||
{
|
||||
int annoch = f.mask().get_int(F_ANNOCH);
|
||||
int annoap = f.mask().get_int(F_ANNO);
|
||||
|
||||
if (!anni_contigui(annoch,annoap))
|
||||
return FALSE;
|
||||
|
||||
TRectype TabEsch = cerca_esercizio(annoap);
|
||||
TDate inizio = TabEsch.get_date("D0");
|
||||
TDate fine = TabEsch.get_date("D1");
|
||||
TDate scarico = TabEsch.get_date("D2");
|
||||
|
||||
TRectype TabEsap = cerca_esercizio(annoch);
|
||||
TDate iniziop = TabEsap.get_date("D0");
|
||||
TDate finep = TabEsap.get_date("D1");
|
||||
TDate data = f.get();
|
||||
/*
|
||||
TabEs.last();
|
||||
TDate inizio = TabEs.get_date("D0");
|
||||
TDate fine = TabEs.get_date("D1");
|
||||
@ -169,7 +246,7 @@ bool mask_dataap (TMask_field& f, KEY k)
|
||||
TDate iniziop = TabEs.get_date("D0");
|
||||
TDate finep = TabEs.get_date("D1");
|
||||
TDate data = f.get();
|
||||
|
||||
*/
|
||||
TString istr = inizio.string();
|
||||
TString fstr = fine.string();
|
||||
|
||||
@ -444,6 +521,7 @@ bool CG4600_application::set()
|
||||
m.set_handler (F_PERDPC, attivo_passivo);
|
||||
m.set_handler (F_UTILEC, costi_ricavi);
|
||||
m.set_handler (F_PERDEC, costi_ricavi);
|
||||
m.set_handler (abilita_anni);
|
||||
|
||||
tasto = m.run();
|
||||
|
||||
@ -676,7 +754,7 @@ void CG4600_application::costi()
|
||||
compila_mov = FALSE;
|
||||
}
|
||||
|
||||
numrig++;
|
||||
//numrig++;
|
||||
s = _saldi->get_long(SLD_SOTTOCONTO);
|
||||
//sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil);
|
||||
sale.ultima_immissione_bilancio(_annoesch,g,c,s,indbil, 1);
|
||||
@ -684,6 +762,8 @@ void CG4600_application::costi()
|
||||
|
||||
if (_saldo.is_zero()) continue;
|
||||
|
||||
numrig++;
|
||||
|
||||
if (j >= MAX || _saldi->eof())
|
||||
{
|
||||
// Aggiungo un ulteriore riga di movimento contenente la somma
|
||||
@ -826,7 +906,7 @@ void CG4600_application::ricavi()
|
||||
compila_mov = FALSE;
|
||||
}
|
||||
|
||||
numrig++;
|
||||
//numrig++;
|
||||
s = _saldi->get_long(SLD_SOTTOCONTO);
|
||||
//sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil);
|
||||
sale.ultima_immissione_bilancio(_annoesch,g,c,s,indbil, 1);
|
||||
@ -834,6 +914,8 @@ void CG4600_application::ricavi()
|
||||
|
||||
if (_saldo.is_zero()) continue;
|
||||
|
||||
numrig++;
|
||||
|
||||
if (j >= MAX || _saldi->eof())
|
||||
{
|
||||
// Aggiungo un ulteriore riga di movimento contenente la somma
|
||||
@ -1034,14 +1116,15 @@ void CG4600_application::chiudi_attivita()
|
||||
_saldi->put(SLD_GRUPPO, g);
|
||||
_saldi->put(SLD_CONTO, c);
|
||||
|
||||
TRectype rec (_saldi->curr());
|
||||
// TRectype rec (_saldi->curr());
|
||||
*_rec = _saldi->curr();
|
||||
|
||||
j = 0;
|
||||
numrig = 0;
|
||||
|
||||
for (_saldi->read(); ; _saldi->next())
|
||||
for (_saldi->read(_isgteq); ; _saldi->next())
|
||||
{
|
||||
if (_saldi->curr() > rec || _saldi->eof())
|
||||
if (_saldi->curr() > (*_rec) || _saldi->eof())
|
||||
{
|
||||
// Aggiungo un ulteriore riga di movimento contenente la somma
|
||||
// di tutti i saldi aventi lo stesso conto, indicandola
|
||||
@ -1065,16 +1148,20 @@ void CG4600_application::chiudi_attivita()
|
||||
compila_mov = FALSE;
|
||||
}
|
||||
|
||||
numrig++;
|
||||
//numrig++;
|
||||
s = _saldi->get_long(SLD_SOTTOCONTO);
|
||||
//sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil);
|
||||
sale.ultima_immissione_bilancio(_annoesch,g,c,s,indbil, 1);
|
||||
_saldo = sale.saldo();
|
||||
|
||||
TString sldstr = _saldo.string();
|
||||
//_saldo = ZERO;
|
||||
const int dbkey = _saldi->getkey();
|
||||
_saldi->setkey(1);
|
||||
// TString sldstr = _saldo.string();
|
||||
|
||||
if (_saldo == ZERO) continue;
|
||||
|
||||
numrig++;
|
||||
|
||||
if (j >= MAX || _saldi->eof())
|
||||
{
|
||||
// Aggiungo un ulteriore riga di movimento contenente la somma
|
||||
@ -1217,7 +1304,7 @@ void CG4600_application::chiudi_passivita()
|
||||
compila_mov = FALSE;
|
||||
}
|
||||
|
||||
numrig++;
|
||||
//numrig++;
|
||||
s = _saldi->get_long(SLD_SOTTOCONTO);
|
||||
//sale.calcola_ultima_immissione(_annoesch,0,g,c,s,indbil);
|
||||
sale.ultima_immissione_bilancio(_annoesch,g,c,s,indbil, 1);
|
||||
@ -1225,6 +1312,8 @@ void CG4600_application::chiudi_passivita()
|
||||
|
||||
if (_saldo.is_zero()) continue;
|
||||
|
||||
numrig++;
|
||||
|
||||
if (j >= MAX || _saldi->eof())
|
||||
{
|
||||
// Aggiungo un ulteriore riga di movimento contenente la somma
|
||||
@ -1418,13 +1507,15 @@ void CG4600_application::apri_attivita()
|
||||
compila_mov = FALSE;
|
||||
}
|
||||
|
||||
numrig++;
|
||||
//numrig++;
|
||||
s = _saldi->get_long(SLD_SOTTOCONTO);
|
||||
sale.ultima_immissione_bilancio(_annoesch,g,c,s,indbil, 1);
|
||||
_saldo = sale.saldo();
|
||||
|
||||
if (_saldo == ZERO) continue;
|
||||
|
||||
numrig++;
|
||||
|
||||
if (j >= MAX || _saldi->eof())
|
||||
{
|
||||
// Aggiungo un ulteriore riga di movimento contenente la somma
|
||||
@ -1562,13 +1653,15 @@ void CG4600_application::apri_passivita()
|
||||
compila_mov = FALSE;
|
||||
}
|
||||
|
||||
numrig++;
|
||||
//numrig++;
|
||||
s = _saldi->get_long(SLD_SOTTOCONTO);
|
||||
sale.ultima_immissione_bilancio(_annoesch,g,c,s,indbil, 1);
|
||||
_saldo = sale.saldo();
|
||||
|
||||
if (_saldo.is_zero()) continue;
|
||||
|
||||
numrig++;
|
||||
|
||||
if (j >= MAX || _saldi->eof())
|
||||
{
|
||||
// Aggiungo un ulteriore riga di movimento contenente la somma
|
||||
|
@ -63,13 +63,30 @@ END
|
||||
NUMBER F_ANNOCH 4
|
||||
BEGIN
|
||||
PROMPT 69 4 ""
|
||||
FLAGS "RZD"
|
||||
USE ESC
|
||||
INPUT CODTAB F_ANNOCH
|
||||
DISPLAY "Anno" CODTAB
|
||||
DISPLAY "Inizio Es.@12" D0
|
||||
DISPLAY "Fine Es.@12" D1
|
||||
DISPLAY "Scarico@12" D2
|
||||
OUTPUT F_ANNOCH CODTAB
|
||||
OUTPUT F_DATAC D1
|
||||
CHECKTYPE REQUIRED
|
||||
WARNING "Anno non presente in tabella esercizi"
|
||||
FLAGS "GRZD"
|
||||
END
|
||||
|
||||
NUMBER F_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 69 5 ""
|
||||
FLAGS "RZD"
|
||||
COPY USE F_ANNOCH
|
||||
INPUT CODTAB F_ANNO
|
||||
COPY DISPLAY F_ANNOCH
|
||||
OUTPUT F_ANNO CODTAB
|
||||
OUTPUT F_DATAAP D0
|
||||
CHECKTYPE REQUIRED
|
||||
WARNING "Anno non presente in tabella esercizi"
|
||||
FLAGS "GRZD"
|
||||
END
|
||||
|
||||
|
||||
|
@ -39,7 +39,7 @@ class TSaldo
|
||||
real _saldo, _saldo_iniziale, _saldoiniziale;
|
||||
real _prg_dare, _prg_avere, _prg_daresca, _prg_averesca;
|
||||
int _indbil;
|
||||
TRectype _saldo_ep;
|
||||
TRectype* _saldo_ep;
|
||||
int _annoes;
|
||||
TDate _inizioEs, _fineEs;
|
||||
TString16 _codcaus;
|
||||
|
@ -138,8 +138,9 @@ TRectype* TSaldi_list::saldi() const
|
||||
return (TRectype*)o;
|
||||
}
|
||||
|
||||
TSaldo::TSaldo() : _saldo_ep(LF_SALDI)
|
||||
TSaldo::TSaldo()
|
||||
{
|
||||
_saldo_ep = new TRectype(LF_SALDI);
|
||||
_saldo_iniziale = ZERO;
|
||||
_saldoiniziale = ZERO;
|
||||
_prg_dare = ZERO;
|
||||
@ -152,7 +153,9 @@ TSaldo::TSaldo() : _saldo_ep(LF_SALDI)
|
||||
}
|
||||
|
||||
TSaldo::~TSaldo()
|
||||
{}
|
||||
{
|
||||
delete _saldo_ep;
|
||||
}
|
||||
|
||||
real TSaldo::saldofin_esprec(int annoes, int g, int c, long s)
|
||||
{
|
||||
@ -570,10 +573,18 @@ TRectype& TSaldo::ricerca_progr_prec (int annoesprec, int g, int c, long s)
|
||||
_rec_presente_ep = FALSE;
|
||||
}
|
||||
|
||||
_saldo_ep = saldi.curr();
|
||||
(*_saldo_ep) = saldi.curr();
|
||||
saldi.setkey(oldkey);
|
||||
|
||||
return _saldo_ep;
|
||||
// riposiziona...
|
||||
saldi.zero();
|
||||
saldi.put(SLD_GRUPPO,g);
|
||||
saldi.put(SLD_CONTO,c);
|
||||
saldi.put(SLD_SOTTOCONTO,s);
|
||||
saldi.put(SLD_ANNOES,annoesprec+1);
|
||||
saldi.read(_isequal);
|
||||
|
||||
return (*_saldo_ep);
|
||||
}
|
||||
|
||||
//calcolo dei progressivi attuali
|
||||
|
Loading…
x
Reference in New Issue
Block a user