Correzione ai registri
git-svn-id: svn://10.65.10.50/trunk@1073 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
c8aeee59e6
commit
924b51bfae
144
cg/cg4400.cpp
144
cg/cg4400.cpp
@ -680,7 +680,7 @@ bool CG4400_application::user_create()
|
||||
_cur = new TCursor(_rel, "", 2);
|
||||
|
||||
_ditte = new TArray_sheet(-1, -1, 0, 0, "Selezione Ditte",
|
||||
"@1|Cod.@5|Ragione Sociale@50|Vers.");
|
||||
"@1|Cod.@5R|Ragione Sociale@50|Vers.");
|
||||
|
||||
if (pnd) pnd->addstatus(1);
|
||||
|
||||
@ -903,6 +903,70 @@ int CG4400_application::setta_riga(int r, const TRigaiva& riga, real& tot1,
|
||||
return r;
|
||||
}
|
||||
|
||||
messaggio CG4400_application::controlla_b0()
|
||||
{
|
||||
TTable lim ("LIM");
|
||||
TString16 chiave = "";
|
||||
TString16 ditta = "";
|
||||
int i, mese;
|
||||
ditta << get_firm();
|
||||
|
||||
if (_tipo_stampa == 1) //stampa di prova
|
||||
mese = _data_a.month();
|
||||
else
|
||||
mese = _fino_a_mese;
|
||||
|
||||
if (_tipo_riepilogativo == ' ' || _tipo_riepilogativo == 'P')
|
||||
{
|
||||
if (_frequiva == 'T') //nella tabella LIM ho solo i mesi 3, 6, 9, 12
|
||||
{
|
||||
for (i=3; i<=mese; i+=3)
|
||||
{
|
||||
chiave = "";
|
||||
TString16 m (format("%02d", i));
|
||||
chiave << _annoes << m;
|
||||
lim.put("CODTAB", chiave);
|
||||
if (lim.read() == NOERR)
|
||||
{
|
||||
if (! lim.get_bool("B0"))
|
||||
return no_liquidazione;
|
||||
}
|
||||
else return no_liquidazione;
|
||||
}
|
||||
}
|
||||
if (_frequiva == 'M')
|
||||
{
|
||||
for (i=1 ; i<=mese; i++)
|
||||
{
|
||||
chiave = "";
|
||||
TString16 m (format("%02d", i));
|
||||
chiave << _annoes << m;
|
||||
lim.put("CODTAB", chiave);
|
||||
if (lim.read() == NOERR)
|
||||
{
|
||||
if (! lim.get_bool("B0"))
|
||||
return no_liquidazione;
|
||||
}
|
||||
else return no_liquidazione;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_tipo_riepilogativo == 'A')
|
||||
if (_riep_liq)
|
||||
{
|
||||
chiave = "";
|
||||
chiave << _annoes << 13;
|
||||
lim.put("CODTAB", chiave);
|
||||
if (lim.read() == NOERR)
|
||||
{
|
||||
if (! lim.get_bool("B0"))
|
||||
return no_liquidazione;
|
||||
}
|
||||
else return no_liquidazione;
|
||||
}
|
||||
return B0_settato;
|
||||
}
|
||||
|
||||
messaggio CG4400_application::controlla_liquidazione()
|
||||
{
|
||||
TTable lim ("LIM");
|
||||
@ -2131,7 +2195,8 @@ void CG4400_application::aggiorna_reg(const bool aggiorna_vidi)
|
||||
if (!aggiorna_vidi)
|
||||
{
|
||||
bool trovato = FALSE;
|
||||
|
||||
//long ditta = get_firm();
|
||||
|
||||
IndBil.zero();
|
||||
|
||||
TRectype nuovo (IndBil.curr());
|
||||
@ -2144,8 +2209,19 @@ void CG4400_application::aggiorna_reg(const bool aggiorna_vidi)
|
||||
{
|
||||
if (IndBil.curr() != rec) break;
|
||||
|
||||
trovato = TRUE;
|
||||
numero_riga = IndBil.get_long("NUMREG") + 1;
|
||||
int annoreg = IndBil.get_int("ANNOREG");
|
||||
int mesereg = IndBil.get_int("MESEREG");
|
||||
long cditta = IndBil.get_long("CODDITTA");
|
||||
TString16 codreg = IndBil.get("CODREG");
|
||||
TString16 codvid = IndBil.get("CODVID");
|
||||
if (_annoes == annoreg && _fino_a_mese == mesereg
|
||||
&& _ditta == cditta && codreg == _codreg && _codice_vidi == codvid)
|
||||
{
|
||||
trovato = TRUE;
|
||||
numero_riga = IndBil.get_long("NUMREG");
|
||||
break;
|
||||
}
|
||||
else numero_riga = IndBil.get_long("NUMREG") + 1;
|
||||
// cosi' mi posiziono su quel mese (altrimenti rischio di generare
|
||||
// due righe per lo stesso mese e registro => la stampa di vidimazione
|
||||
// mi sballa tutta!!!
|
||||
@ -2158,17 +2234,17 @@ void CG4400_application::aggiorna_reg(const bool aggiorna_vidi)
|
||||
nuovo.put("MESEREG", _fino_a_mese); // su libro unico ho un solo mese in gioco!
|
||||
nuovo.put("PAGINI", _primast + 1); // numero iniziale pagina libro unico
|
||||
nuovo.put("PAGFIN", _u_stampata); // numero finale pagina libro unico
|
||||
nuovo.put("CODDITTA", get_firm());
|
||||
nuovo.put("CODDITTA", _ditta);
|
||||
nuovo.put("CODREG", _codreg);
|
||||
nuovo.put("CODVID", _codice_vidi);
|
||||
nuovo.put("PAGINIUT", _numini + 1);
|
||||
nuovo.put("PAGFINUT", _pagine_stampate);
|
||||
|
||||
IndBil.write(nuovo);
|
||||
|
||||
// _primast = _u_stampata; //per la numerazione dei registri successivi
|
||||
if (!trovato)
|
||||
IndBil.write(nuovo);
|
||||
else IndBil.rewrite(nuovo);
|
||||
}
|
||||
_primast = _u_stampata; //per la numerazione dei registri successivi
|
||||
//_primast = _u_stampata; //per la numerazione dei registri successivi
|
||||
aggiorna_lib();
|
||||
}
|
||||
}
|
||||
@ -2234,7 +2310,7 @@ void CG4400_application::stampa_vidi()
|
||||
if (IndBil.curr() != rec) break;
|
||||
ditta = IndBil.get_long("CODDITTA");
|
||||
codreg = IndBil.get("CODREG");
|
||||
if (ditta == get_firm() && codreg == _codreg)
|
||||
if (ditta == _ditta && codreg == _codreg)
|
||||
{
|
||||
if (!_ok_vidi)
|
||||
{
|
||||
@ -2308,10 +2384,13 @@ void CG4400_application::liq_other_case()
|
||||
}
|
||||
if (_scelta == prosegui_stampa)
|
||||
{
|
||||
_t.temp("reg");
|
||||
if (_tipo_stampa == 1)
|
||||
send_message('S', _t, _datareg.month());
|
||||
else send_message('s', _t, _datareg.month());
|
||||
if (stampo_liquidazione(_datareg.month()))
|
||||
{
|
||||
_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());
|
||||
@ -2339,9 +2418,7 @@ print_action CG4400_application::postprocess_page (int file, int counter)
|
||||
liq_b0_settato();
|
||||
if (_scelta == prosegui_stampa || _scelta == prosegui_cal_stampa)
|
||||
{
|
||||
TString80 nomef;
|
||||
nomef = _t.path(); nomef << "\\" << _t.name();
|
||||
if (fexist(nomef))
|
||||
if (fexist(_t))
|
||||
{
|
||||
printer().formfeed();
|
||||
_intesta_liq = TRUE;
|
||||
@ -2528,7 +2605,7 @@ void CG4400_application::look_reg()
|
||||
|
||||
void CG4400_application::clear_stliq()
|
||||
{
|
||||
for (int i=0; i < 12; i++)
|
||||
for (int i=0; i <= 12; i++)
|
||||
_st_liq[i] = FALSE;
|
||||
}
|
||||
|
||||
@ -2575,19 +2652,28 @@ void CG4400_application::no_movimenti()
|
||||
printer().open();
|
||||
if (stampo_liquidazione(m))
|
||||
{
|
||||
TFilename f;
|
||||
f.temp("rgp");
|
||||
_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);
|
||||
if (_scelta == B0_settato || _scelta == prosegui_stampa)
|
||||
{
|
||||
if (_tipo_stampa == 1)
|
||||
send_message('S',f, m);
|
||||
else send_message('s',f, m);
|
||||
}
|
||||
else //_scelta == prosegui_cal_stampa
|
||||
{
|
||||
if (_tipo_stampa == 1)
|
||||
send_message('L', f, m);
|
||||
else send_message('l', f, m);
|
||||
}
|
||||
TString80 nomef;
|
||||
nomef = t.path(); nomef << "\\" << t.name();
|
||||
nomef = f.path(); nomef << "\\" << f.name();
|
||||
if (fexist(nomef))
|
||||
{
|
||||
_intesta_liq = TRUE;
|
||||
//if (m > da) printer().formfeed();
|
||||
merge_export_file(t,FALSE,TRUE);
|
||||
merge_export_file(f,FALSE,TRUE);
|
||||
printer().formfeed();
|
||||
_intesta_liq = FALSE;
|
||||
}
|
||||
@ -2610,9 +2696,10 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
||||
_frequiva = _ditte->row(i).get_char(3);
|
||||
_intesta_liq = FALSE;
|
||||
_intesta_vidi = FALSE;
|
||||
_primast = _u_stampata;
|
||||
_ok_vidi = FALSE;
|
||||
_stampa_mese = 13;
|
||||
_scelta = no_liquidazione;
|
||||
_scelta = controlla_b0();
|
||||
|
||||
TApplication::set_firm(_ditta);
|
||||
look_lia();
|
||||
@ -2719,10 +2806,11 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
|
||||
|
||||
_intesta_liq = FALSE;
|
||||
_intesta_vidi = FALSE;
|
||||
_primast = _u_stampata; //per la numerazione dei registri successivi
|
||||
_ok_vidi = FALSE;
|
||||
_stampa_mese = 13;
|
||||
_scelta = no_liquidazione; //sul registro non va stampata la liq. ma comunque
|
||||
//va richiamata per il calcolo progressivi
|
||||
_scelta = controlla_b0(); //sul registro non va stampata la liq. ma comunque
|
||||
//va richiamata per il calcolo progressivi (a seconda di b0)
|
||||
ok = setta_mask(i);
|
||||
if (!ok) continue;
|
||||
|
||||
|
@ -47,7 +47,7 @@ class CG4400_application : public TPrintapp
|
||||
TBit_array _selected;
|
||||
TArray_sheet *_ditte;
|
||||
TArray _nomiditte;
|
||||
bool _st_liq[12];
|
||||
bool _st_liq[13];
|
||||
TRecnotype _nrec;
|
||||
bool _mov_empty, _stampa_ind_ditta, _stampa_tutti_i_registri, _auto_intraf, _stampa;
|
||||
bool _corrispettivi, _liquidazione, _riep_liq, _stampa_ind_comp, _esiste_riga_iva, _stampa_cred_pre;
|
||||
@ -101,6 +101,7 @@ public:
|
||||
bool compila_reg(const TMask&);
|
||||
bool compila_lib();
|
||||
messaggio controlla_liquidazione();
|
||||
messaggio controlla_b0();
|
||||
bool controlla_mov();
|
||||
bool stampo_liquidazione(int);
|
||||
bool ventilazione(const char*);
|
||||
|
Loading…
x
Reference in New Issue
Block a user