Correzione lista movimenti e regstri IVA

git-svn-id: svn://10.65.10.50/trunk@1062 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
nik 1995-03-01 16:47:54 +00:00
parent 200f5c9c95
commit 7a4d13dc5f
3 changed files with 125 additions and 53 deletions

View File

@ -1,11 +1,13 @@
//
//Lista movimenti //Lista movimenti
//
#include "cg3.h"
#include "cg3100.h"
#include <mask.h> #include <mask.h>
#include <printapp.h> #include <printapp.h>
#include <tabutil.h> #include <tabutil.h>
#include <utility.h> #include <utility.h>
#include <urldefid.h> #include <urldefid.h>
#include <mov.h> #include <mov.h>
#include <rmov.h> #include <rmov.h>
#include <rmoviva.h> #include <rmoviva.h>
@ -16,9 +18,6 @@
#include <attiv.h> #include <attiv.h>
#include <causali.h> #include <causali.h>
#include <nditte.h> #include <nditte.h>
#include "cg3.h"
#include "cg3100.h"
#include "cglib03.h" #include "cglib03.h"
#include "cg2103.h" #include "cg2103.h"
@ -75,7 +74,7 @@ class TListaMov_application : public TPrintapp
TRigaiva_array _c; TRigaiva_array _c;
TTable * _tabiva, * _tabtpd, * _tabreg, * _tabes; TTable * _tabiva, * _tabtpd, * _tabreg, * _tabes;
TLocalisamfile * _caus,* _comuni,* _rmoviva, * _clifo, * _pcon, * _attiv, *_nditte, *_saldi; TLocalisamfile * _caus,* _comuni,* _rmoviva, * _clifo, * _pcon, * _attiv, *_nditte, *_saldi;
TRelation * _relmov,* _relmov1,* _relmov2,* _relmov3; TRelation * _relmov1,* _relmov2,* _relmov3;
TCursor * _curr1, * _curr2, * _curr3; TCursor * _curr1, * _curr2, * _curr3;
TBit_array _err; TBit_array _err;
TDate _data_ini, _data_fin, _datareg, _data_prec, _datacomp; TDate _data_ini, _data_fin, _datareg, _data_prec, _datacomp;
@ -612,11 +611,11 @@ void TListaMov_application::stampa_errori_rmov()
_nr++; _nr++;
if (anno != _annoeser || datareg != _datareg) if (anno != _annoeser || datareg != _datareg)
set_row(_nr++, "@11gAnno esercizio o data di registrazione inconsistente tra testata e righe"); set_row(_nr++, "@11gUno o piu' campi non sono costanti nella riga dell' operazione");
if (sez != 'D' && sez != 'A') if (sez != 'D' && sez != 'A')
set_row(_nr++, "@11gIndicato tipo sezione Dare/Avere errato"); set_row(_nr++, "@11gIndicato tipo movimento Dare/Avere errato");
if (tc.empty()) if (tc.empty())
set_row(_nr++, "@11gCodice gruppo/conto/sottoconto non presente"); set_row(_nr++, "@11gNon presente codice gruppo/conto/sottoconto");
if (!tc.ok()) if (!tc.ok())
set_row(_nr++, "@11gCodice gruppo/conto/sottoconto non corrisponde ad un sottoconto"); set_row(_nr++, "@11gCodice gruppo/conto/sottoconto non corrisponde ad un sottoconto");
@ -626,7 +625,7 @@ void TListaMov_application::stampa_errori_rmov()
g = TRUE; g = TRUE;
tc.set(gruppo,conto,0l); tc.set(gruppo,conto,0l);
if (!tc.read(pc)) if (!tc.read(pc))
set_row(_nr++, "@11gCodice gruppo/conto/sottoconto non presente nel Piano dei Conti"); set_row(_nr++, "@11gCodice gruppo/conto/sottoconto non presente in Piano dei Conti");
else else
{ {
t = pc.get_char(PCN_TMCF); t = pc.get_char(PCN_TMCF);
@ -878,7 +877,7 @@ void TListaMov_application::stampa_intestazione()
bool TListaMov_application::preprocess_page(int file,int counter) bool TListaMov_application::preprocess_page(int file,int counter)
{ {
TCursor * cur = current_cursor(); TCursor* cur = current_cursor();
if (counter) return TRUE; if (counter) return TRUE;
@ -1282,8 +1281,9 @@ print_action TListaMov_application::postprocess_page(int file,int count)
if (_registro.not_empty() && _mov_di_sola_iva) if (_registro.not_empty() && _mov_di_sola_iva)
{ {
compila_clifo(); compila_clifo();
set_row(++r, "@1g%3s %-.19s@25g%-35s %6ld %-50s", (const char*)_causale, (const char*)_descr_causale, // set_row(++r, "@1g%3s %-.19s@25g%-35s %6ld %-50s", (const char*)_causale, (const char*)_descr_causale,
(const char*) _descr_doc, _codcf, (const char*)_ragsoc); // (const char*) _descr_doc, _codcf, (const char*)_ragsoc);
set_row(++r, "@1g%3s %-50s %6ld %-50s", (const char*)_causale, (const char*)_descr_causale, _codcf, (const char*)_ragsoc);
} }
if ( _scelta_stampa == 0 && _stampa_parte_iva ) if ( _scelta_stampa == 0 && _stampa_parte_iva )
{ {
@ -2209,7 +2209,12 @@ bool TListaMov_application::user_create()
bool TListaMov_application::user_destroy() // releasev e arrmask bool TListaMov_application::user_destroy() // releasev e arrmask
{ {
delete _relmov; delete _relmov1;
delete _relmov2;
delete _relmov3;
delete _curr1;
delete _curr2;
delete _curr3;
delete _clifo; delete _clifo;
delete _caus; delete _caus;
delete _pcon; delete _pcon;
@ -2218,6 +2223,7 @@ bool TListaMov_application::user_destroy() // releasev e arrmask
delete _tabiva; delete _tabiva;
delete _tabreg; delete _tabreg;
delete _tabtpd; delete _tabtpd;
delete _tabes;
delete _rmoviva; delete _rmoviva;
delete _saldi; delete _saldi;

View File

@ -773,9 +773,9 @@ 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"); TToken_string fatt_rit (pim.get("S1"));
real im = real::ita2eng(fatt_rit.get(0)); real im (fatt_rit.get(0));
real is = real::ita2eng(fatt_rit.get(1)); real is (fatt_rit.get(1));
impo += im; impo += im;
impos += is; impos += is;
implo += im+is; implo += im+is;
@ -813,9 +813,9 @@ 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"); TToken_string fatt_rit (pim.get("S1"));
real im = real::ita2eng(fatt_rit.get(0)); real im (fatt_rit.get(0));
real is = real::ita2eng(fatt_rit.get(1)); real is (fatt_rit.get(1));
impo += im; impo += im;
impos += is; impos += is;
implo += im+is; implo += im+is;
@ -883,12 +883,16 @@ int CG4400_application::setta_riga(int r, const TRigaiva& riga, real& tot1,
set_row(r, "%4s", (const char*)riga._codiva); set_row(r, "%4s", (const char*)riga._codiva);
TString descr = descr_iva(riga._codiva); TString descr = descr_iva(riga._codiva);
set_row(r, "@5g%-.21s",(const char*)descr); set_row(r, "@5g%-.21s",(const char*)descr);
set_row(r, "@25g%r", &riga._imponibile); if (riga._imponibile != ZERO)
set_row(r, "@41g%r", &riga._imposta); set_row(r, "@25g%r", &riga._imponibile);
if (riga._imposta != ZERO)
set_row(r, "@41g%r", &riga._imposta);
if (_tipo_stampa != 1) if (_tipo_stampa != 1)
{ {
set_row(r, "@81g%r", &riga._imponibilep); if (riga._imponibilep != ZERO)
set_row(r++, "@98g%r", &riga._impostap); set_row(r, "@81g%r", &riga._imponibilep);
if (riga._impostap != ZERO)
set_row(r++, "@98g%r", &riga._impostap);
} }
else r++; else r++;
tot1 += riga._imponibile; tot1 += riga._imponibile;
@ -902,7 +906,6 @@ int CG4400_application::setta_riga(int r, const TRigaiva& riga, real& tot1,
messaggio CG4400_application::controlla_liquidazione() messaggio CG4400_application::controlla_liquidazione()
{ {
TTable lim ("LIM"); TTable lim ("LIM");
TTable pim ("PIM");
TString mesi_cal = ""; TString mesi_cal = "";
TString16 chiave = ""; TString16 chiave = "";
TString16 ditta = ""; TString16 ditta = "";
@ -910,13 +913,6 @@ messaggio CG4400_application::controlla_liquidazione()
bool continua; 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 (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
@ -933,8 +929,11 @@ messaggio CG4400_application::controlla_liquidazione()
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")) if (! lim.get_bool("B0"))
mesi_cal << itom(i) << "\n"; mesi_cal << itom(i) << "\n";
}
else mesi_cal << itom(i) << "\n";
} }
} }
if (_frequiva == 'M') if (_frequiva == 'M')
@ -946,8 +945,11 @@ messaggio CG4400_application::controlla_liquidazione()
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")) if (! lim.get_bool("B0"))
mesi_cal << itom(i) << "\n"; mesi_cal << itom(i) << "\n";
}
else mesi_cal << itom(i) << "\n";
} }
} }
if (mesi_cal.not_empty()) if (mesi_cal.not_empty())
@ -967,6 +969,7 @@ messaggio CG4400_application::controlla_liquidazione()
chiave << _annoes << 13; chiave << _annoes << 13;
lim.put("CODTAB", chiave); lim.put("CODTAB", chiave);
if (lim.read() == NOERR) if (lim.read() == NOERR)
{
if (! lim.get_bool("B0")) 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 da stampare sul registro %s. Si desidera ugualmente proseguire?", (const char*)ditta, (const char*) _codreg);
@ -975,6 +978,15 @@ messaggio CG4400_application::controlla_liquidazione()
if (!continua) return prosegui_stampa; if (!continua) return prosegui_stampa;
return prosegui_cal_stampa; return prosegui_cal_stampa;
} }
}
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);
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 B0_settato; return B0_settato;
} }
@ -1168,7 +1180,7 @@ int CG4400_application::stampa_acquisti(int row)
row+=2; row+=2;
int tdetprec = -1; int tdetprec = -1;
int rw = row; int rw = row;
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00; tot_imponib = tot_imposta = tot_imponibp = tot_impostap = ZERO;
_iva_array.sort(compare_fields); _iva_array.sort(compare_fields);
for (int s = 0; s < _iva_array.items(); s++) for (int s = 0; s < _iva_array.items(); s++)
@ -1192,9 +1204,21 @@ int CG4400_application::stampa_acquisti(int row)
break; break;
case 3: if (tdetprec == 1) case 3: if (tdetprec == 1)
{ {
set_row(++rw, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta); //set_row(++rw, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
set_row(++rw, "TOTALE");
if (tot_imponib != ZERO)
set_row(rw, "@25g%r", &tot_imponib);
if (tot_imposta != ZERO)
set_row(rw, "@41g%r", &tot_imposta);
if (_tipo_stampa != 1) if (_tipo_stampa != 1)
set_row(rw, "@81g%r@98g%r", &tot_imponibp, &tot_impostap); {
//set_row(rw, "@81g%r@98g%r", &tot_imponibp, &tot_impostap);
if (tot_imponibp != ZERO)
set_row(rw, "@81g%r", &tot_imponibp);
if (tot_impostap != ZERO)
set_row(rw, "@98g%r", &tot_impostap);
}
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00; tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
rw+=2; rw+=2;
} }
@ -1214,9 +1238,20 @@ int CG4400_application::stampa_acquisti(int row)
break; break;
case 9: if ( (tdetprec == 1) || (tdetprec == 3) ) case 9: if ( (tdetprec == 1) || (tdetprec == 3) )
{ {
set_row(++rw, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta); //set_row(++rw, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
set_row(++rw, "TOTALE");
if (tot_imponib != ZERO)
set_row(rw, "@25g%r", &tot_imponib);
if (tot_imposta != ZERO)
set_row(rw, "@41g%r", &tot_imposta);
if (_tipo_stampa != 1) if (_tipo_stampa != 1)
set_row(rw, "@81g%r@98g%r", &tot_imponibp, &tot_impostap); {
//set_row(rw, "@81g%r@98g%r", &tot_imponibp, &tot_impostap);
if (tot_imponibp != ZERO)
set_row(rw, "@81g%r", &tot_imponibp);
if (tot_impostap != ZERO)
set_row(rw, "@98g%r", &tot_impostap);
}
tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00; tot_imponib = tot_imposta = tot_imponibp = tot_impostap = 0.00;
rw+=2; rw+=2;
} }
@ -1240,9 +1275,20 @@ int CG4400_application::stampa_acquisti(int row)
if (_iva_array.items() > 0) if (_iva_array.items() > 0)
if (tdetprec == 9) if (tdetprec == 9)
{ {
set_row(++rw, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta); //set_row(++rw, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
set_row(++rw, "TOTALE");
if (tot_imponib != ZERO)
set_row(rw, "@25g%r", &tot_imponib);
if (tot_imposta != ZERO)
set_row(rw, "@41g%r", &tot_imposta);
if (_tipo_stampa != 1) if (_tipo_stampa != 1)
set_row(rw, "@81g%r@98g%r", &tot_imponibp, &tot_impostap); {
//set_row(rw, "@81g%r@98g%r", &tot_imponibp, &tot_impostap);
if (tot_imponibp != ZERO)
set_row(rw, "@81g%r", &tot_imponibp);
if (tot_impostap != ZERO)
set_row(rw, "@98g%r", &tot_impostap);
}
} }
_iva_array.destroy(); _iva_array.destroy();
rw++; rw++;
@ -1383,14 +1429,25 @@ void CG4400_application::set_page_tot_reg()
} }
_tot_iva_array.destroy(); _tot_iva_array.destroy();
rr++; rr++;
set_row(rr, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta); //set_row(rr, "TOTALE@25g%r@41g%r", &tot_imponib, &tot_imposta);
set_row(rr, "TOTALE");
if (tot_imponib != ZERO)
set_row(rr, "@25g%r", &tot_imponib);
if (tot_imposta != ZERO)
set_row(rr, "@41g%r", &tot_imposta);
if (_tipo_reg == 1 && _corrispettivi) if (_tipo_reg == 1 && _corrispettivi)
set_row(rr, "@61g%r", &tot_lordo); if (tot_lordo != ZERO)
set_row(rr, "@61g%r", &tot_lordo);
if (_tipo_stampa != 1) if (_tipo_stampa != 1)
{ {
set_row(rr, "@81g%r@98g%r", &tot_imponibp, &tot_impostap); //set_row(rr, "@81g%r@98g%r", &tot_imponibp, &tot_impostap);
if (tot_imponibp != ZERO)
set_row(rr, "@81g%r", &tot_imponibp);
if (tot_impostap != ZERO)
set_row(rr, "@98g%r", &tot_impostap);
if (_tipo_reg == 1 && _corrispettivi) if (_tipo_reg == 1 && _corrispettivi)
set_row(rr, "@115g%r", &tot_lordop); if (tot_lordop != ZERO)
set_row(rr, "@115g%r", &tot_lordop);
} }
if (_tipo_reg == 2) rr = stampa_acquisti(rr); if (_tipo_reg == 2) rr = stampa_acquisti(rr);
@ -2259,6 +2316,12 @@ void CG4400_application::liq_other_case()
app.temp(); app.temp();
send_message('C', app, _datareg.month()); send_message('C', app, _datareg.month());
} }
if (_scelta == no_liquidazione)
{
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)
@ -2549,7 +2612,8 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
_intesta_vidi = FALSE; _intesta_vidi = FALSE;
_ok_vidi = FALSE; _ok_vidi = FALSE;
_stampa_mese = 13; _stampa_mese = 13;
_scelta = prosegui_stampa; _scelta = no_liquidazione;
TApplication::set_firm(_ditta); TApplication::set_firm(_ditta);
look_lia(); look_lia();
ok = compila_reg(m); ok = compila_reg(m);
@ -2657,7 +2721,8 @@ bool CG4400_application::stampa_registri_IVA(const TMask& m)
_intesta_vidi = FALSE; _intesta_vidi = FALSE;
_ok_vidi = FALSE; _ok_vidi = FALSE;
_stampa_mese = 13; _stampa_mese = 13;
_scelta = prosegui_stampa; _scelta = no_liquidazione; //sul registro non va stampata la liq. ma comunque
//va richiamata per il calcolo progressivi
ok = setta_mask(i); ok = setta_mask(i);
if (!ok) continue; if (!ok) continue;

View File

@ -27,6 +27,7 @@
#include "conto.h" #include "conto.h"
enum messaggio { enum messaggio {
no_liquidazione,
B0_settato, B0_settato,
non_proseguire, non_proseguire,
prosegui_stampa, prosegui_stampa,