Errore MI4310
git-svn-id: svn://10.65.10.50/trunk@3556 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e2556e6d78
commit
6fdf2fd7f4
108
cg/cg1400.cpp
108
cg/cg1400.cpp
@ -1,7 +1,7 @@
|
||||
#include <applicat.h>
|
||||
#include <config.h>
|
||||
#include <form.h>
|
||||
#include <mask.h>
|
||||
#include <mask.h>
|
||||
#include <printer.h>
|
||||
#include <relation.h>
|
||||
#include <sheet.h>
|
||||
@ -26,7 +26,7 @@ class TStampa_deleghe_IVA : public TApplication
|
||||
|
||||
bool _stampa_distinte, _aggiorna_codici, _definitiva;
|
||||
TDate _pd;
|
||||
|
||||
|
||||
protected:
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
@ -50,15 +50,15 @@ bool TStampa_deleghe_IVA::create()
|
||||
_nditte = new TRelation(LF_NDITTE);
|
||||
_nditte->add(LF_ANAG, "TIPOA=TIPOA|CODANAGR=CODANAGR");
|
||||
_nditte->add(LF_COMUNI, "COM=COMRF(COMRES)", 1, LF_ANAG);
|
||||
|
||||
|
||||
_banche = new TTable("%BAN");
|
||||
|
||||
_ditte = new TArray_sheet(-1, -1, -4, -4, "Selezione Deleghe da stampare",
|
||||
"@1|Cod.@5|Ragione Sociale@30|Importo@15r|Interessi@15r|ABI@5|CAB@5|Concessione|Tit. Conto Fis.");
|
||||
|
||||
"@1|Cod.@5|Ragione Sociale@30|Importo@15R|Interessi@15R|ABI@5|CAB@5|Concessione|Tit. Conto Fis.");
|
||||
|
||||
_azienda = "" ;
|
||||
_dipendenza = "" ;
|
||||
|
||||
|
||||
dispatch_e_menu(BAR_ITEM(1));
|
||||
return TRUE;
|
||||
}
|
||||
@ -79,9 +79,9 @@ int TStampa_deleghe_IVA::select()
|
||||
m.set(F_CONCESSIONE, _concessione);
|
||||
m.set(F_ABI, _azienda);
|
||||
m.set(F_CAB, _dipendenza);
|
||||
if (m.run() != K_ENTER)
|
||||
if (m.run() != K_ENTER)
|
||||
return 0;
|
||||
|
||||
|
||||
_azienda = m.get(F_ABI);
|
||||
_dipendenza = m.get(F_CAB);
|
||||
|
||||
@ -92,21 +92,21 @@ int TStampa_deleghe_IVA::select()
|
||||
_definitiva = m.get_bool(F_DEFINITIVA);
|
||||
_stampa_distinte = m.get_bool(F_DISTINTA);
|
||||
_aggiorna_codici = m.get_bool(F_AGGIORNA);
|
||||
|
||||
|
||||
_profilo = m.get(F_PROFILO);
|
||||
_codice = m.get_long(F_CODICE);
|
||||
const bool contofis = _profilo.right(2) == "CF";
|
||||
|
||||
|
||||
int del_dis_bol=0;
|
||||
if (_profilo.left(3) == "DIS") del_dis_bol = 2;
|
||||
else
|
||||
else
|
||||
if (_profilo.left(3) == "BOL") del_dis_bol = 1;
|
||||
//const TDate pd(m.get(F_DATA));
|
||||
//printer().setdate(pd);
|
||||
|
||||
|
||||
_pd = m.get(F_DATA);
|
||||
printer().setdate(_pd);
|
||||
|
||||
|
||||
_concessione = m.get(F_CONCESSIONE);
|
||||
const long soloabi = m.get_long(F_SOLO_ABI);
|
||||
const long solocab = m.get_long(F_SOLO_CAB);
|
||||
@ -122,16 +122,16 @@ int TStampa_deleghe_IVA::select()
|
||||
{
|
||||
TLocalisamfile& anag = _nditte->lfile(LF_ANAG);
|
||||
TLocalisamfile& com = _nditte->lfile(LF_COMUNI); // Comune residenza fiscale
|
||||
|
||||
|
||||
const TString16 con = com.get("UFFCONC");
|
||||
if (_concessione.not_empty() && _concessione != con) continue;
|
||||
|
||||
const bool cf = anag.get_bool("TITCF");
|
||||
if (contofis != cf) continue;
|
||||
|
||||
|
||||
const int tstdel = anag.get_int("TIPOSTDEL");
|
||||
if (tstdel != del_dis_bol) continue;
|
||||
|
||||
|
||||
const long dit = _nditte->lfile().get_long("CODDITTA");
|
||||
chiave.format("%05ld%04d%02d%d", dit, _anno, _mese, _tipo);
|
||||
deleghe.put("CODTAB", chiave);
|
||||
@ -141,7 +141,7 @@ int TStampa_deleghe_IVA::select()
|
||||
const long abi = deleghe.get_long("S7");
|
||||
const long cab = deleghe.get_long("S8");
|
||||
if ((soloabi == 0 || soloabi == abi) && (solocab == 0 || solocab == cab))
|
||||
{
|
||||
{
|
||||
d = " "; // Selezione
|
||||
d.add(dit); // Codice ditta
|
||||
d.add(_nditte->lfile().get("RAGSOC").left(30)); // Cognome
|
||||
@ -152,23 +152,23 @@ int TStampa_deleghe_IVA::select()
|
||||
d.add(con); // Concessione
|
||||
d.add(cf ? "X" : " "); // Conto fiscale
|
||||
_ditte->add(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
end_wait();
|
||||
|
||||
int res = 1;
|
||||
int res = 1;
|
||||
if (_ditte->items() > 0)
|
||||
{
|
||||
const bool ok = _ditte->run() == K_ENTER && _ditte->one_checked();
|
||||
if (!ok) res = 2;
|
||||
if (!ok) res = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
warning_box("Nessuna ditta ha deleghe del tipo specificato");
|
||||
res = 2;
|
||||
}
|
||||
|
||||
|
||||
enable_menu_item(M_FILE_PRINT, res == 1);
|
||||
return res;
|
||||
}
|
||||
@ -185,7 +185,7 @@ void TStampa_deleghe_IVA::print()
|
||||
{
|
||||
bool ok = yesno_box("Inserire il modulo prefincato nella stampante "
|
||||
"e confermare la stampa delle deleghe");
|
||||
if (ok)
|
||||
if (ok)
|
||||
{
|
||||
print_deleghe();
|
||||
if (_stampa_distinte)
|
||||
@ -193,7 +193,7 @@ void TStampa_deleghe_IVA::print()
|
||||
ok = yesno_box("Inserire il modulo in carta bianca nella stampante "
|
||||
"e confermare la stampa della distinta");
|
||||
if (ok) print_distinta();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -229,15 +229,15 @@ void TStampa_deleghe_IVA::print_distinta()
|
||||
TString256 t("Dichiarazione ");
|
||||
switch (_tipo)
|
||||
{
|
||||
case 2:
|
||||
case 2:
|
||||
t << "annuale :"; break;
|
||||
case 3:
|
||||
case 3:
|
||||
t << "articolo 74 : " << itom(_mese); break;
|
||||
case 4:
|
||||
case 4:
|
||||
t << "cessazione attivita' : " << itom(_mese); break;
|
||||
case 5:
|
||||
case 5:
|
||||
t << "integrativa : " << itom(_mese); break;
|
||||
default:
|
||||
default:
|
||||
t << "periodica : " << itom(_mese); break;
|
||||
}
|
||||
t << ' ' << _anno;
|
||||
@ -263,11 +263,11 @@ void TStampa_deleghe_IVA::print_distinta()
|
||||
|
||||
for (int i = 0; i < _ditte->items(); i++)
|
||||
if (_ditte->checked(i))
|
||||
{
|
||||
{
|
||||
TToken_string& riga = _ditte->row(i);
|
||||
const TString16 cod(riga.get(1));
|
||||
_nditte->lfile().put("CODDITTA", cod);
|
||||
_nditte->read();
|
||||
_nditte->read();
|
||||
|
||||
TParagraph_string dencom(com.get("DENCOM"), 18);
|
||||
|
||||
@ -303,25 +303,25 @@ void TStampa_deleghe_IVA::print_distinta()
|
||||
// Calcola frequenza dei versamenti IVA di una ditta
|
||||
// Certified 99%
|
||||
char TStampa_deleghe_IVA::frequenza_versamenti(long firm, int year) const
|
||||
{
|
||||
{
|
||||
char freq = 'M';
|
||||
|
||||
|
||||
TString16 key; key.format("%05ld%d", firm, year);
|
||||
TTable lia("%LIA");
|
||||
lia.put("CODTAB", key);
|
||||
if (lia.read() != NOERR)
|
||||
{
|
||||
{
|
||||
TLocalisamfile nditte(LF_NDITTE);
|
||||
nditte.put("CODDITTA", firm);
|
||||
nditte.read();
|
||||
freq = nditte.get_char("FREQVIVA");
|
||||
}
|
||||
else
|
||||
else
|
||||
freq = lia.get_char("S7");
|
||||
CHECK(freq == 'M' || freq == 'T', "Frequenza versamenti IVA assurda");
|
||||
|
||||
|
||||
return freq;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool TStampa_deleghe_IVA::print_deleghe()
|
||||
@ -332,11 +332,11 @@ bool TStampa_deleghe_IVA::print_deleghe()
|
||||
|
||||
TCursor& cur = *f.cursor();
|
||||
TLocalisamfile& delega = cur.file();
|
||||
TString16 chiave;
|
||||
TString16 chiave;
|
||||
|
||||
for (int i = 0; ok && i < _ditte->items(); i++)
|
||||
if (_ditte->checked(i))
|
||||
{
|
||||
{
|
||||
TToken_string& r = _ditte->row(i);
|
||||
|
||||
const long firm = r.get_long(1);
|
||||
@ -344,10 +344,10 @@ bool TStampa_deleghe_IVA::print_deleghe()
|
||||
delega.put("CODTAB", chiave);
|
||||
|
||||
cur.read(); // Posiziona il cursore
|
||||
|
||||
|
||||
if (_pd.ok())
|
||||
delega.put("D0",_pd);
|
||||
|
||||
|
||||
const bool cera_abi = _azienda.empty() || _dipendenza.empty();
|
||||
if (!cera_abi)
|
||||
{
|
||||
@ -359,19 +359,19 @@ bool TStampa_deleghe_IVA::print_deleghe()
|
||||
const bool cera_conc = (*r.get(7) <= ' ') || delega.get("S9").not_empty();
|
||||
if (!cera_conc)
|
||||
delega.put("S9", r.get(7)); // Concessione
|
||||
|
||||
|
||||
const bool cera_tribu = delega.get("S6").not_empty();
|
||||
if (!cera_tribu) // Metti codice tributo
|
||||
{
|
||||
{
|
||||
TString16 tributo;
|
||||
switch(_tipo)
|
||||
switch(_tipo)
|
||||
{
|
||||
case 1:
|
||||
if (frequenza_versamenti(firm, _anno) == 'T')
|
||||
tributo << "603" << ((_mese-1)/3+1);
|
||||
else
|
||||
tributo << "60" << format("%02d", _mese);
|
||||
break;
|
||||
break;
|
||||
case 2:
|
||||
tributo = "6099"; // Annuale
|
||||
break;
|
||||
@ -380,14 +380,14 @@ bool TStampa_deleghe_IVA::print_deleghe()
|
||||
tributo = "6035";
|
||||
else
|
||||
tributo = "6013";
|
||||
break;
|
||||
default:
|
||||
tributo = "";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
tributo = "";
|
||||
break;
|
||||
}
|
||||
delega.put("S6", tributo);
|
||||
}
|
||||
|
||||
|
||||
ok = f.print(-1); // Stampa solo il record corrente
|
||||
if (!arng)
|
||||
{ // Scopo di cio' e' far si' che esegua il
|
||||
@ -405,23 +405,23 @@ bool TStampa_deleghe_IVA::print_deleghe()
|
||||
scrivi = TRUE;
|
||||
}
|
||||
if (!_aggiorna_codici) // Cancella codici se non richiesti
|
||||
{
|
||||
{
|
||||
if (!cera_abi)
|
||||
{
|
||||
delega.zero("S7");
|
||||
delega.zero("S8");
|
||||
scrivi = TRUE;
|
||||
}
|
||||
}
|
||||
if (!cera_conc)
|
||||
{
|
||||
delega.zero("S9");
|
||||
scrivi = TRUE;
|
||||
}
|
||||
}
|
||||
if (!cera_tribu)
|
||||
{
|
||||
delega.zero("S6");
|
||||
scrivi = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (scrivi)
|
||||
delega.rewrite();
|
||||
@ -435,6 +435,6 @@ bool TStampa_deleghe_IVA::print_deleghe()
|
||||
int cg1400(int argc, char* argv[])
|
||||
{
|
||||
TStampa_deleghe_IVA a;
|
||||
a.run(argc, argv, "Stampa Deleghe IVA");
|
||||
a.run(argc, argv, "Stampa Versamenti");
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user