Patch level : 10.0
Files correlati : fe0100a.msk fetbcon.msk fe0.exe Ricompilazione Demo : [ ] Commento : Prima versione che tenta di rispettare le specifiche in "totalone.pdf" (nome originale del file ministeriale ottenuto tramite copia e incolla casuale) git-svn-id: svn://10.65.10.50/branches/R_10_00@22372 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
fbc795ba4a
commit
b3ac97fea4
384
fe/fe0100.cpp
384
fe/fe0100.cpp
@ -52,6 +52,102 @@ static const TString& provincia_di(const TString& codcom)
|
||||
return cache().get(LF_COMUNI, key, COM_PROVCOM);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TContratti
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
const TRectype& contratto(char tipocf, long codcf, const char* codcont)
|
||||
{
|
||||
TString80 key; key.format("%c%6ld%s", tipocf, codcf, codcont);
|
||||
TRectype& c = (TRectype&)cache().get("&CON", key);
|
||||
if (c.empty())
|
||||
{
|
||||
int primo_anno = c.get_int("I0");
|
||||
if (primo_anno < 2010)
|
||||
{
|
||||
const TDate inizio = c.get("D0");
|
||||
primo_anno = inizio.year();
|
||||
if (primo_anno < 2010)
|
||||
primo_anno = 2010;
|
||||
c.put("I0", primo_anno);
|
||||
}
|
||||
|
||||
real importo = c.get("R0");
|
||||
if (importo <= ZERO)
|
||||
{
|
||||
importo = primo_anno > 2010 ? 3000 : 25000;
|
||||
c.put("R0", importo);
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
bool importo_contratto(const TRectype& c, int anno, real& importo, real& imposta)
|
||||
{
|
||||
if (c.empty() || anno < 2010)
|
||||
return false;
|
||||
|
||||
const int primo_anno = c.get_int("I0");
|
||||
int offset = (anno - primo_anno)*2;
|
||||
if (offset < 0) offset = 0;
|
||||
if (offset > 6) offset = 6;
|
||||
|
||||
for (int r = offset; r >= 0; r-=2)
|
||||
{
|
||||
char erre[3] = { 'R', r+'0', '\0' };
|
||||
importo = c.get_real(erre);
|
||||
if (importo > ZERO)
|
||||
{
|
||||
erre[1]++;
|
||||
imposta = c.get_real(erre);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool importo_figli_contratto(const TRectype& c, int anno, real& importo, real& imposta)
|
||||
{
|
||||
const TString& codtab = c.get("CODTAB");
|
||||
const TString& prefix = codtab.left(7);
|
||||
const TString& suffix = codtab.mid(7);
|
||||
|
||||
TString query;
|
||||
query << "USE &CON SELECT S1=\"" << suffix << '\"'
|
||||
<< "\nFROM CODTAB=\"" << prefix << '\"'
|
||||
<< "\nTO CODTAB=\"" << prefix << '\"';
|
||||
|
||||
TISAM_recordset recset(query);
|
||||
|
||||
importo = imposta = ZERO;
|
||||
for (bool ok = recset.move_first(); ok; ok = recset.move_next())
|
||||
{
|
||||
real imp, iva;
|
||||
importo_figli_contratto(recset.cursor()->curr(), anno, imp, iva);
|
||||
importo += imp;
|
||||
imposta += iva;
|
||||
}
|
||||
if (importo <= ZERO)
|
||||
importo_contratto(c, anno, importo, imposta);
|
||||
|
||||
return !importo.is_zero();
|
||||
}
|
||||
|
||||
real importo_totale_contratto(char tipocf, long codcf, const char* codcont, int anno,
|
||||
real& importo, real& imposta)
|
||||
{
|
||||
importo = imposta = ZERO;
|
||||
const TRectype& c = contratto(tipocf, codcf, codcont);
|
||||
if (!c.empty() && anno >= 2010)
|
||||
{
|
||||
const TString& padre = c.get("S1");
|
||||
if (padre.full())
|
||||
importo_totale_contratto(tipocf, codcf, padre, anno, importo, imposta);
|
||||
else
|
||||
importo_figli_contratto(c, anno, importo, imposta);
|
||||
}
|
||||
return importo > ZERO;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TAnagrafica
|
||||
@ -61,9 +157,10 @@ class TAnagrafica : public TObject
|
||||
{
|
||||
char _tipo; // F o G
|
||||
TString16 _cofi, _paiv;
|
||||
TString80 _key, _ragsoc;
|
||||
TString _ragsoc;
|
||||
TString4 _com_nasc, _com_res;
|
||||
TDate _data_nasc;
|
||||
int _allegato, _stato_estero;
|
||||
|
||||
TAnagrafica(const TAnagrafica&) { CHECK(false, "Can't copy TAnagrafica"); }
|
||||
|
||||
@ -71,7 +168,6 @@ public:
|
||||
virtual bool ok() const { return _tipo=='F' || _tipo == 'G'; }
|
||||
bool fisica() const { return _tipo == 'F'; }
|
||||
bool giuridica() const { return _tipo == 'G'; }
|
||||
const TString& key() const { return _key; }
|
||||
|
||||
const TString& codice_fiscale() const { return _cofi; }
|
||||
const TString& partita_IVA() const { return _paiv; }
|
||||
@ -81,6 +177,8 @@ public:
|
||||
const TString& nome() const { return _ragsoc.mid(30,20); }
|
||||
char sesso() const { return (_cofi[9] >= '4') ? 'F' : 'M'; }
|
||||
const TDate& data_nascita() const { return _data_nasc; }
|
||||
int stato_estero() const { return _stato_estero; }
|
||||
int inserimento_in_allegato() const { return _allegato; }
|
||||
|
||||
const TString& comune_nascita() const { return comune_di(_com_nasc); }
|
||||
const TString& provincia_nascita() const { return provincia_di(_com_nasc); }
|
||||
@ -88,25 +186,27 @@ public:
|
||||
const TString& provincia_residenza() const { return provincia_di(_com_res); }
|
||||
|
||||
bool init(const TRectype& rec);
|
||||
bool init(int num, const char* codice) { return init(cache().get(num, codice)); }
|
||||
bool init(int num, const TString& codice) { return init(cache().get(num, codice)); }
|
||||
bool init(int num, long codice) { return init(cache().get(num, codice)); }
|
||||
bool init(int num, char tipo, long codice);
|
||||
bool init(char tipo, long codice, const TString& ocfpi);
|
||||
|
||||
TAnagrafica() : _tipo('\0') {}
|
||||
TAnagrafica(int num, long codice) { init(num, codice); }
|
||||
TAnagrafica(int num, char tipo, long codice) { init(num, tipo, codice); }
|
||||
TAnagrafica(int lognum, const TString& codice) { init(lognum, codice); }
|
||||
TAnagrafica(int lognum, long codice) { init(lognum, codice); }
|
||||
TAnagrafica(int lognum, char tipo, long codice) { init(lognum, tipo, codice); }
|
||||
TAnagrafica(char tipo, long codice, const TString& ocfpi) { init(tipo, codice, ocfpi); }
|
||||
TAnagrafica(const TRectype& rec) { init(rec); }
|
||||
};
|
||||
|
||||
bool TAnagrafica::init(const TRectype& rec)
|
||||
{
|
||||
_tipo = '\0';
|
||||
_key.cut(0);
|
||||
_stato_estero = 0;
|
||||
_allegato = 0;
|
||||
if (rec.empty())
|
||||
return false;
|
||||
|
||||
_key << rec.num() << '|' << rec.build_key(1);
|
||||
|
||||
switch (rec.num())
|
||||
{
|
||||
case LF_OCCAS:
|
||||
@ -125,6 +225,8 @@ bool TAnagrafica::init(const TRectype& rec)
|
||||
_data_nasc = rec.get(OCC_DNASC);
|
||||
_com_nasc = rec.get(OCC_COMNASC);
|
||||
_com_res = rec.get(OCC_COM);
|
||||
_stato_estero = rec.get_int(OCC_STATO);
|
||||
_allegato = _paiv.blank() ? 6 : 2;
|
||||
break;
|
||||
case LF_ANAG:
|
||||
_tipo = rec.get_char(ANA_TIPOA);
|
||||
@ -144,6 +246,8 @@ bool TAnagrafica::init(const TRectype& rec)
|
||||
_data_nasc = anafis.get(ANF_DATANASC);
|
||||
_com_nasc = rec.get(ANF_COMNASC);
|
||||
}
|
||||
else
|
||||
_tipo = 'G';
|
||||
break;
|
||||
case LF_NDITTE:
|
||||
{
|
||||
@ -156,19 +260,22 @@ bool TAnagrafica::init(const TRectype& rec)
|
||||
_tipo = rec.get_char(CLI_TIPOAPER);
|
||||
if (_tipo == 'F')
|
||||
init(LF_ANAG, _tipo, rec.get_long(CLI_CODANAGPER));
|
||||
else
|
||||
_tipo = 'G';
|
||||
// Assegno codice fiscale e partita IVA se validi, altrimenti mantengo quelli dell'anagrafica
|
||||
if (rec.get(CLI_COFI).not_empty())
|
||||
_cofi = rec.get(CLI_COFI);
|
||||
if (rec.get(CLI_PAIV).not_empty())
|
||||
_paiv = rec.get(CLI_PAIV);
|
||||
_ragsoc = rec.get(CLI_RAGSOC); _ragsoc.upper(); // Prevale sempre la ragione sociale del cliente
|
||||
// Prevale sempre la ragione sociale del cliente: "Il cliente ha sempre ragione".
|
||||
_ragsoc = rec.get(CLI_RAGSOC); _ragsoc.upper();
|
||||
_stato_estero = rec.get_int(CLI_STATOCF);
|
||||
_allegato = rec.get_int(CLI_ALLEG);
|
||||
break;
|
||||
case LF_MOV:
|
||||
{
|
||||
const TString& ocfpi = rec.get(MOV_OCFPI);
|
||||
return ocfpi.full() ? init(LF_OCCAS, ocfpi) : init(LF_CLIFO, rec.get_char(MOV_TIPO), rec.get_long(MOV_CODCF));
|
||||
}
|
||||
break;
|
||||
return init(rec.get_char(MOV_TIPO), rec.get_long(MOV_CODCF), rec.get(MOV_OCFPI));
|
||||
case LF_ALLEG:
|
||||
return init(rec.get_char(ALL_TIPOCF), rec.get_long(ALL_CODCF), rec.get(ALL_OCFPI));
|
||||
default:
|
||||
CHECKD(false, "Record non valido per TAnagrafica ", rec.num());
|
||||
break;
|
||||
@ -183,6 +290,16 @@ bool TAnagrafica::init(int num, char tipo, long codice)
|
||||
return init(cache().get(num, key));
|
||||
}
|
||||
|
||||
bool TAnagrafica::init(char tipo, long codice, const TString& ocfpi)
|
||||
{
|
||||
bool done = false;
|
||||
if (ocfpi.full())
|
||||
done = init(LF_OCCAS, ocfpi);
|
||||
if (!done)
|
||||
done = init(LF_CLIFO, tipo, codice);
|
||||
return done;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TDati_rilevanti_trc
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -374,11 +491,12 @@ protected:
|
||||
void init();
|
||||
|
||||
public:
|
||||
void set(unsigned int n, const TString& v) { TAS400_recordset::set(n-1, TVariant(v)); }
|
||||
void set(unsigned int n, char v) { TString4 str; str << v; TAS400_recordset::set(n-1, TVariant(str)); }
|
||||
void set(unsigned int n, int v) { TAS400_recordset::set(n-1, TVariant(long(v))); }
|
||||
void set(unsigned int n, const real& v) { TAS400_recordset::set(n-1, v.integer()); }
|
||||
void set(unsigned int n, const TDate& v) { TAS400_recordset::set(n-1, TVariant(v)); }
|
||||
bool set(unsigned int n, const TVariant& v) { return TAS400_recordset::set(n-1, v); }
|
||||
bool set(unsigned int n, const TString& v) { return TAS400_recordset::set(n-1, TVariant(v)); }
|
||||
bool set(unsigned int n, char v) { TString4 str; str << v; return TAS400_recordset::set(n-1, TVariant(str)); }
|
||||
bool set(unsigned int n, int v) { return TAS400_recordset::set(n-1, TVariant(long(v))); }
|
||||
bool set(unsigned int n, const real& v) { return TAS400_recordset::set(n-1, v.integer()); }
|
||||
bool set(unsigned int n, const TDate& v) { return TAS400_recordset::set(n-1, TVariant(v)); }
|
||||
void add_control_rec(int zero_o_nove);
|
||||
TDati_rilevanti_set(int anno);
|
||||
};
|
||||
@ -459,6 +577,10 @@ protected:
|
||||
TRecnotype nuovo_progr() const;
|
||||
bool check_rows(bool show_error);
|
||||
|
||||
bool send_nc(const TISAM_recordset& alleg, TDati_rilevanti_set& operaz);
|
||||
bool send_fatt(const TISAM_recordset& alleg, TDati_rilevanti_set& operaz);
|
||||
bool send_rec(const TISAM_recordset& alleg, TDati_rilevanti_set& operaz);
|
||||
|
||||
public:
|
||||
TRecnotype genera_alleg();
|
||||
bool elabora_alleg();
|
||||
@ -466,7 +588,7 @@ public:
|
||||
bool azzera_alleg(bool manual, TRecnotype first) const;
|
||||
bool elabora_movimento(const TRectype& mov, TFast_isamfile& falleg, TRecnotype& progr, TLog_report& log);
|
||||
bool salva_allegato(const TRectype& mov, TFast_isamfile& falleg, TRecnotype& progr,
|
||||
const real& corrispettivo, const real& imposta, int tipimp, int tipope,
|
||||
const real& corrispettivo, const real& imposta, int natope, int tipope,
|
||||
TLog_report& log);
|
||||
bool convalida_clifo(const TRectype& mov, TLog_report& log) const;
|
||||
bool convalida_mov(const TRectype& mov, TLog_report& log) const;
|
||||
@ -562,23 +684,23 @@ bool TDati_rilevanti_msk::convalida_mov(const TRectype& mov, TLog_report& log) c
|
||||
|
||||
|
||||
bool TDati_rilevanti_msk::salva_allegato(const TRectype& mov, TFast_isamfile& falleg, TRecnotype& progr,
|
||||
const real& corrispettivo, const real& imposta, int tipimp, int natope,
|
||||
const real& corrispettivo, const real& imposta, int natope, int tipope,
|
||||
TLog_report& log)
|
||||
{
|
||||
bool update_contract = false;
|
||||
const int anno = mov.get_int(MOV_ANNOIVA);
|
||||
|
||||
falleg.zero();
|
||||
TRectype& alleg = falleg.curr();
|
||||
alleg.put(ALL_ANNO, mov.get(MOV_ANNOIVA));
|
||||
alleg.put(ALL_ANNO, anno);
|
||||
alleg.put(ALL_PROGR, progr);
|
||||
|
||||
TString80 contratto = mov.get(MOV_CONTRATTO);
|
||||
real totale;
|
||||
const TString80 contratto = mov.get(MOV_CONTRATTO);
|
||||
if (contratto.full())
|
||||
{
|
||||
TString80 key;
|
||||
key.format("%c%06ld_%s_%d%d", mov.get_char(MOV_TIPO), mov.get_long(MOV_CODCF),
|
||||
(const char*)contratto, tipimp, natope);
|
||||
(const char*)contratto, natope, tipope);
|
||||
real* first_progr = (real*)_contratti.objptr(key);
|
||||
if (first_progr == NULL) // Primo movimento del contratto
|
||||
{
|
||||
@ -595,7 +717,7 @@ bool TDati_rilevanti_msk::salva_allegato(const TRectype& mov, TFast_isamfile& fa
|
||||
if (falleg.read() != NOERR)
|
||||
{
|
||||
TString msg;
|
||||
msg << "Impossibile aggiornare record da contratto: " << key;
|
||||
msg << TR("Impossibile aggiornare record da contratto: ") << key;
|
||||
log.log_error(msg);
|
||||
return false;
|
||||
}
|
||||
@ -607,6 +729,11 @@ bool TDati_rilevanti_msk::salva_allegato(const TRectype& mov, TFast_isamfile& fa
|
||||
alleg.put(ALL_NUMREG, mov.get(MOV_NUMREG));
|
||||
alleg.put(ALL_DATAREG, mov.get(MOV_DATAREG));
|
||||
|
||||
int modpag = mov.get_int(MOV_MODPAG);
|
||||
if (modpag <= 0)
|
||||
modpag = contratto.full() ? 1 : 3;
|
||||
alleg.put(ALL_MODPAG, modpag);
|
||||
|
||||
int err = 0;
|
||||
if (update_contract)
|
||||
{
|
||||
@ -618,15 +745,24 @@ bool TDati_rilevanti_msk::salva_allegato(const TRectype& mov, TFast_isamfile& fa
|
||||
else
|
||||
{
|
||||
// Registro tutti i dati del cliente e gli importi
|
||||
alleg.put(ALL_TIPOCF, mov.get(MOV_TIPO));
|
||||
alleg.put(ALL_CODCF, mov.get(MOV_CODCF));
|
||||
const char tipocf = mov.get_char(MOV_TIPO);
|
||||
const long codcf = mov.get_long(MOV_CODCF);
|
||||
alleg.put(ALL_TIPOCF, tipocf);
|
||||
alleg.put(ALL_CODCF, codcf);
|
||||
alleg.put(ALL_OCFPI, mov.get(MOV_OCFPI));
|
||||
alleg.put(ALL_TIPOPE, tipimp);
|
||||
alleg.put(ALL_NATOPE, natope);
|
||||
alleg.put(ALL_TIPOPE, tipope);
|
||||
alleg.put(ALL_IMPORTO, corrispettivo);
|
||||
alleg.put(ALL_IMPOSTA, imposta);
|
||||
alleg.put(ALL_CONTRATTO, contratto);
|
||||
alleg.put(ALL_TOTALE, totale);
|
||||
|
||||
if (contratto.full())
|
||||
{
|
||||
alleg.put(ALL_CONTRATTO, contratto);
|
||||
real importotot, impostatot;
|
||||
importo_totale_contratto(tipocf, codcf, contratto, anno, importotot, impostatot);
|
||||
alleg.put(ALL_IMPORTOTOT, importotot);
|
||||
alleg.put(ALL_IMPOSTATOT, impostatot);
|
||||
}
|
||||
|
||||
err = falleg.rewrite_write();
|
||||
if (err == NOERR)
|
||||
@ -787,16 +923,16 @@ bool TDati_rilevanti_msk::azzera_alleg(bool manual, TRecnotype first) const
|
||||
query << "USE " << LF_ALLEG;
|
||||
|
||||
if (manual) // Elimina i record immessi manualmente ed ignorati
|
||||
query << "\nSELECT " << ALL_IGNORA << "=='X'";
|
||||
query << "\nSELECT " << ALL_IGNORA << "!=\"\"";
|
||||
|
||||
if (daprog > 0) query << "\nFROM " << limit << daprog;
|
||||
if (aprog > 0) query << "\nTO " << limit << aprog;
|
||||
if (daprog > 0)query << "\nFROM " << limit << daprog;
|
||||
if (aprog > 0) query << "\nTO " << limit << aprog;
|
||||
|
||||
TISAM_recordset alleg(query);
|
||||
|
||||
const TRecnotype items = alleg.items();
|
||||
TString str_pi;
|
||||
str_pi << TR("Compattazione dati rilevanti ") << anno;
|
||||
str_pi << TR("Compattazione dati ") << anno;
|
||||
|
||||
TProgind pi(items, str_pi);
|
||||
const TRectype& rec = alleg.cursor()->curr();
|
||||
@ -812,19 +948,16 @@ bool TDati_rilevanti_msk::azzera_alleg(bool manual, TRecnotype first) const
|
||||
return items > 0;
|
||||
}
|
||||
|
||||
// Cerca l'ultimo numero di riga immesso manualmente
|
||||
TRecnotype TDati_rilevanti_msk::last_user_progr() const
|
||||
{
|
||||
const int anno = get_int(F_ANNO);
|
||||
|
||||
TString limit;
|
||||
limit << ALL_ANNO << '=' << anno << ' '
|
||||
<< ALL_PROGR << '=';
|
||||
|
||||
TRecnotype progr = MANUAL_ROW;
|
||||
TString query;
|
||||
query << "USE " << LF_ALLEG
|
||||
<< "\nFROM " << limit << MANUAL_ROW
|
||||
<< "\nTO " << limit << (progr+90000);
|
||||
<< "\nFROM " << ALL_ANNO << '=' << anno << ' ' << ALL_PROGR << '=' << MANUAL_ROW
|
||||
<< "\nTO " << ALL_ANNO << '=' << anno;
|
||||
TISAM_recordset alleg(query);
|
||||
if (alleg.move_last())
|
||||
progr = alleg.get(ALL_PROGR).as_int();
|
||||
@ -833,12 +966,6 @@ TRecnotype TDati_rilevanti_msk::last_user_progr() const
|
||||
|
||||
TRecnotype TDati_rilevanti_msk::nuovo_progr() const
|
||||
{
|
||||
const int anno = get_int(F_ANNO);
|
||||
|
||||
TString limit;
|
||||
limit << ALL_ANNO << '=' << anno << ' '
|
||||
<< ALL_PROGR << '=';
|
||||
|
||||
TRecnotype progr = last_user_progr();
|
||||
|
||||
TSheet_field& righe = sfield(F_RIGHE);
|
||||
@ -873,7 +1000,7 @@ TRecnotype TDati_rilevanti_msk::genera_alleg()
|
||||
TFast_isamfile fmov(LF_MOV);
|
||||
|
||||
TString query;
|
||||
query << "USE MOV KEY 2 SELECT TIPO!=''"
|
||||
query << "USE MOV KEY 2 SELECT CODCF!=''"
|
||||
<< "\nFROM DATAREG=01-01-" << anno
|
||||
<< "\nTO DATAREG=31-12-" << anno;
|
||||
TISAM_recordset mov(query);
|
||||
@ -899,7 +1026,7 @@ TRecnotype TDati_rilevanti_msk::genera_alleg()
|
||||
// Analizza tutti i movimenti dell'anno dell'attività corrente e genera i record rilevanti
|
||||
bool TDati_rilevanti_msk::elabora_alleg()
|
||||
{
|
||||
if (!check_fields()) // Controlla che anno ed attività siano validi
|
||||
if (!check_fields()) // Controlla che l'anno sia valido
|
||||
return false;
|
||||
|
||||
_send_all = get_bool(F_SENDALL);
|
||||
@ -909,17 +1036,105 @@ bool TDati_rilevanti_msk::elabora_alleg()
|
||||
return prog > 1;
|
||||
}
|
||||
|
||||
bool TDati_rilevanti_msk::send_nc(const TISAM_recordset& alleg, TDati_rilevanti_set& operaz)
|
||||
{
|
||||
return false; // TBI
|
||||
}
|
||||
|
||||
bool TDati_rilevanti_msk::send_fatt(const TISAM_recordset& alleg, TDati_rilevanti_set& operaz)
|
||||
{
|
||||
const TAnagrafica anag(alleg.cursor()->curr());
|
||||
|
||||
if (anag.stato_estero() > 0)
|
||||
{
|
||||
operaz.new_rec("3"); // Operazioni con soggetti non residenti
|
||||
if (anag.fisica())
|
||||
{
|
||||
operaz.set(2, anag.cognome());
|
||||
operaz.set(3, anag.nome());
|
||||
operaz.set(4, anag.data_nascita());
|
||||
operaz.set(5, anag.comune_nascita());
|
||||
operaz.set(6, anag.provincia_nascita());
|
||||
operaz.set(7, anag.stato_estero());
|
||||
}
|
||||
else
|
||||
{
|
||||
operaz.set(8, anag.ragione_sociale());
|
||||
operaz.set(9, anag.comune_residenza());
|
||||
operaz.set(10, anag.stato_estero());
|
||||
operaz.set(11, EMPTY_STRING); // TBI? Indirizzo estero
|
||||
}
|
||||
operaz.set(12, alleg.get(ALL_DATAREG).as_date());
|
||||
operaz.set(13, alleg.get(ALL_MODPAG).as_int());
|
||||
operaz.set(14, alleg.get(ALL_IMPORTO).as_real());
|
||||
operaz.set(15, alleg.get(ALL_IMPOSTA).as_real());
|
||||
operaz.set(16, alleg.get(ALL_NATOPE).as_int());
|
||||
operaz.set(17, alleg.get(ALL_TIPOPE).as_int());
|
||||
operaz.set(18, alleg.get(ALL_IMPORTOTOT).as_real());
|
||||
operaz.set(19, alleg.get(ALL_IMPOSTATOT).as_real());
|
||||
}
|
||||
else
|
||||
{
|
||||
const TString& paiv = anag.partita_IVA();
|
||||
if (paiv.blank())
|
||||
{
|
||||
operaz.new_rec("1"); // Operazioni con soggetti residenti non titolari di partita IVA
|
||||
operaz.set(2, anag.codice_fiscale());
|
||||
operaz.set(3, alleg.get(ALL_DATAREG).as_date());
|
||||
operaz.set(4, alleg.get(ALL_MODPAG).as_int());
|
||||
real importo = alleg.get(ALL_IMPORTO).as_real();
|
||||
importo += alleg.get(ALL_IMPOSTA).as_real();
|
||||
operaz.set(5, importo);
|
||||
operaz.set(6, alleg.get(ALL_NATOPE).as_int());
|
||||
operaz.set(7, alleg.get(ALL_TIPOPE).as_int());
|
||||
importo = alleg.get(ALL_IMPORTOTOT).as_real();
|
||||
importo += alleg.get(ALL_IMPOSTATOT).as_real();
|
||||
operaz.set(8, importo);
|
||||
}
|
||||
else
|
||||
{
|
||||
operaz.new_rec("2"); // Operazioni con soggetti residenti - titolari di partita IVA
|
||||
operaz.set(2, paiv);
|
||||
operaz.set(3, alleg.get(ALL_DATAREG).as_date());
|
||||
operaz.set(4, alleg.get(ALL_MODPAG).as_int());
|
||||
operaz.set(5, alleg.get(ALL_IMPORTO).as_real());
|
||||
operaz.set(6, alleg.get(ALL_IMPOSTA).as_real());
|
||||
operaz.set(7, alleg.get(ALL_NATOPE).as_int());
|
||||
operaz.set(8, alleg.get(ALL_TIPOPE).as_int());
|
||||
operaz.set(9, alleg.get(ALL_IMPORTOTOT).as_real());
|
||||
operaz.set(10,alleg.get(ALL_IMPOSTATOT).as_real());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TDati_rilevanti_msk::send_rec(const TISAM_recordset& alleg, TDati_rilevanti_set& operaz)
|
||||
{
|
||||
const bool ignora = alleg.get(ALL_IGNORA).as_bool();
|
||||
if (ignora)
|
||||
return false;
|
||||
|
||||
const long numrett = alleg.get(ALL_NUMRETT).as_int();
|
||||
return numrett > 0 ? send_nc(alleg, operaz) : send_fatt(alleg, operaz);
|
||||
}
|
||||
|
||||
// Genera file per invio telematico
|
||||
bool TDati_rilevanti_msk::send_alleg()
|
||||
{
|
||||
const int anno = get_int(F_ANNO);
|
||||
TFilename temp; temp.tempdir();
|
||||
temp.add("datiril.txt");
|
||||
|
||||
TDati_rilevanti_set recset(get_int(F_ANNO));
|
||||
recset.add_control_rec(0);
|
||||
|
||||
TISAM_recordset alleg("");
|
||||
TString query;
|
||||
query << "USE " << LF_ALLEG << " SELECT " << ALL_IGNORA << "==\"\""
|
||||
<< "\nFROM " << ALL_ANNO << '=' << anno
|
||||
<< "\nTO " << ALL_ANNO << '=' << anno;
|
||||
TISAM_recordset alleg(query);
|
||||
for (bool ok = alleg.move_first(); ok; ok = alleg.move_next())
|
||||
send_rec(alleg, recset);
|
||||
|
||||
recset.add_control_rec(9);
|
||||
return recset.save_as(temp);
|
||||
@ -963,7 +1178,9 @@ void TDati_rilevanti_msk::load_sheet()
|
||||
for (bool ok = alleg.move_first(); ok; ok = alleg.move_next())
|
||||
{
|
||||
if (!pi.addstatus(1)) break;
|
||||
s.autoload_line(++rec, curr);
|
||||
s.autoload_line(rec+1, curr);
|
||||
s.check_row(rec);
|
||||
rec++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -993,29 +1210,34 @@ bool TDati_rilevanti_msk::save_sheet()
|
||||
|
||||
TSheet_field& s = sfield(F_RIGHE);
|
||||
const TRecnotype items = s.items();
|
||||
TFast_isamfile alleg(LF_ALLEG);
|
||||
TRectype& rec = alleg.curr();
|
||||
TProgind pi(items, TR("Registrazione righe"), false);
|
||||
|
||||
FOR_EACH_SHEET_ROW(s, r, row)
|
||||
if (items > 0)
|
||||
{
|
||||
if (!pi.addstatus(1))
|
||||
break;
|
||||
TFast_isamfile alleg(LF_ALLEG);
|
||||
TRectype& rec = alleg.curr();
|
||||
TProgind pi(items, TR("Registrazione righe"), false);
|
||||
|
||||
alleg.zero();
|
||||
rec.put(ALL_ANNO, anno);
|
||||
s.autosave_line(r+1, rec);
|
||||
const int err = alleg.rewrite_write();
|
||||
if (err != NOERR)
|
||||
FOR_EACH_SHEET_ROW(s, r, row)
|
||||
{
|
||||
done = cantwrite_box(alleg.name());
|
||||
break;
|
||||
if (!pi.addstatus(1))
|
||||
break;
|
||||
|
||||
alleg.zero();
|
||||
rec.put(ALL_ANNO, anno);
|
||||
s.autosave_line(r+1, rec);
|
||||
const int err = alleg.rewrite_write();
|
||||
if (err != NOERR)
|
||||
{
|
||||
done = cantwrite_box(alleg.name());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (done)
|
||||
{
|
||||
azzera_alleg(true, MANUAL_ROW);
|
||||
// Cancella le righe manuali marcate come da NON inviare
|
||||
azzera_alleg(true, MANUAL_ROW);
|
||||
set_dirty(false);
|
||||
}
|
||||
|
||||
@ -1024,8 +1246,6 @@ bool TDati_rilevanti_msk::save_sheet()
|
||||
|
||||
bool TDati_rilevanti_msk::check_rows(bool show_error)
|
||||
{
|
||||
TSheet_field& s = sfield(F_RIGHE);
|
||||
|
||||
const int anno = get_int(F_ANNO);
|
||||
bool ok = anno >= 2010;
|
||||
if (!ok)
|
||||
@ -1037,13 +1257,14 @@ bool TDati_rilevanti_msk::check_rows(bool show_error)
|
||||
|
||||
long codcf = 0L;
|
||||
TString16 ocfpi;
|
||||
TSheet_field& s = sfield(F_RIGHE);
|
||||
FOR_EACH_SHEET_ROW(s, i, row)
|
||||
{
|
||||
row->get(s.cid2index(A_CODCF), codcf);
|
||||
row->get(s.cid2index(A_OCFPI), ocfpi);
|
||||
if (codcf <= 0L && ocfpi.blank())
|
||||
{
|
||||
ok = show_error && error_box(FR("Soggetto mancante alla riga %d"), i);
|
||||
ok = show_error && error_box(FR("Soggetto mancante alla riga %d"), i+1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1133,6 +1354,32 @@ bool TDati_rilevanti_msk::on_field_event(TOperable_field& o, TField_event e, lon
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case DLG_EXPORT:
|
||||
if (e == fe_button)
|
||||
return sfield(F_RIGHE).esporta();
|
||||
break;
|
||||
case A_CODCF:
|
||||
case A_OCFPI:
|
||||
if (e == fe_modify || (e == fe_init && !o.empty()))
|
||||
{
|
||||
TMask& m = o.mask();
|
||||
const TAnagrafica anag(m.get(A_TIPOCF)[0], m.get_long(A_CODCF), m.get(A_OCFPI));
|
||||
m.set(A_RAGSOC, anag.ragione_sociale());
|
||||
m.set(A_PAIV, anag.partita_IVA());
|
||||
m.set(A_COFI, anag.codice_fiscale());
|
||||
}
|
||||
break;
|
||||
case A_CONTRATTO:
|
||||
if (e == fe_modify || (e == fe_init && !o.empty()))
|
||||
{
|
||||
TMask& m = o.mask();
|
||||
real importo, imposta;
|
||||
importo_totale_contratto(m.get(A_TIPOCF)[0], m.get_long(A_CODCF), m.get(A_CONTRATTO),
|
||||
get_int(F_ANNO), importo, imposta);
|
||||
m.set(A_IMPORTOTOT, importo);
|
||||
m.set(A_IMPOSTATOT, imposta);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1180,3 +1427,4 @@ int fe0100(int argc, char* argv[])
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
58
fe/fe0100a.h
58
fe/fe0100a.h
@ -1,31 +1,37 @@
|
||||
#define F_DITTA 201
|
||||
#define F_RAGSOCD 202
|
||||
#define F_DITTA 301
|
||||
#define F_RAGSOCD 302
|
||||
|
||||
#define F_ANNO 203
|
||||
#define F_DESCATT 205
|
||||
#define F_SENDALL 206
|
||||
#define F_ANNO 303
|
||||
#define F_DESCATT 305
|
||||
#define F_SENDALL 306
|
||||
|
||||
#define F_TIPOCF 210
|
||||
#define F_CODCF 211
|
||||
#define F_OCCAS 212
|
||||
#define F_OCFPI 213
|
||||
#define F_RAGSOC 214
|
||||
#define F_RAGOCC 215
|
||||
#define F_TIPOCF 310
|
||||
#define F_CODCF 311
|
||||
#define F_OCCAS 312
|
||||
#define F_OCFPI 313
|
||||
#define F_RAGSOC 314
|
||||
#define F_RAGOCC 315
|
||||
|
||||
#define F_RIGHE 300
|
||||
#define F_RIGHE 300
|
||||
|
||||
#define A_RIGA 101
|
||||
#define A_IGNORA 102
|
||||
#define A_TIPOCF 103
|
||||
#define A_CODCF 104
|
||||
#define A_OCFPI 105
|
||||
#define A_NUMREG 106
|
||||
#define A_DATAREG 107
|
||||
#define A_MODPAG 108
|
||||
#define A_IMPORTO 109
|
||||
#define A_IMPOSTA 110
|
||||
#define A_NATOPE 111
|
||||
#define A_TIPOPE 112
|
||||
#define A_TOTALE 113
|
||||
#define A_RIGA 101
|
||||
#define A_IGNORA 102
|
||||
#define A_TIPOCF 103
|
||||
#define A_CODCF 104
|
||||
#define A_OCFPI 105
|
||||
#define A_RAGSOC 106
|
||||
#define A_NUMREG 107
|
||||
#define A_DATAREG 108
|
||||
#define A_MODPAG 109
|
||||
#define A_IMPORTO 110
|
||||
#define A_IMPOSTA 111
|
||||
#define A_NATOPE 112
|
||||
#define A_TIPOPE 113
|
||||
#define A_CONTRATTO 114
|
||||
#define A_IMPORTOTOT 115
|
||||
#define A_IMPOSTATOT 116
|
||||
#define A_NUMRETT 117
|
||||
#define A_PAIV 118
|
||||
#define A_COFI 119
|
||||
|
||||
#define A_OCCAS 155
|
||||
#define A_OCCAS 155
|
||||
|
211
fe/fe0100a.uml
211
fe/fe0100a.uml
@ -6,7 +6,7 @@ BUTTON DLG_OK 2 2
|
||||
BEGIN
|
||||
PROMPT 1 1 "Selezione"
|
||||
END
|
||||
|
||||
|
||||
BUTTON DLG_SAVEREC 2 2
|
||||
BEGIN
|
||||
PROMPT 1 1 "Registra"
|
||||
@ -28,10 +28,16 @@ END
|
||||
|
||||
BUTTON DLG_ELABORA 2 2
|
||||
BEGIN
|
||||
PROMPT 1 3 "Genera"
|
||||
PROMPT 1 4 "Genera"
|
||||
PICTURE TOOL_ELABORA
|
||||
END
|
||||
|
||||
BUTTON DLG_EXPORT 2 2
|
||||
BEGIN
|
||||
PROMPT 1 5 "Excel"
|
||||
PICTURE TOOL_EXCEL
|
||||
END
|
||||
|
||||
#include <helpbar.h>
|
||||
|
||||
ENDPAGE
|
||||
@ -40,28 +46,18 @@ PAGE "Dati rilevanti" 0 2 0 0
|
||||
|
||||
GROUPBOX DLG_NULL 78 6
|
||||
BEGIN
|
||||
PROMPT 1 0 "@bAttività"
|
||||
END
|
||||
|
||||
NUMBER F_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 2 1 "Anno "
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "AU"
|
||||
GROUP 1
|
||||
NUM_EXPR #THIS_FIELD>=2010
|
||||
WARNING "Anno non valido"
|
||||
PROMPT 1 0 "@bDitta"
|
||||
END
|
||||
|
||||
NUMBER F_DITTA 5
|
||||
BEGIN
|
||||
PROMPT 2 2 "Ditta "
|
||||
PROMPT 2 1 "Ditta "
|
||||
FLAGS "DF"
|
||||
END
|
||||
|
||||
STRING F_RAGSOCD 50
|
||||
BEGIN
|
||||
PROMPT 26 2 ""
|
||||
PROMPT 15 1 ""
|
||||
USE LF_NDITTE
|
||||
INPUT CODDITTA F_DITTA
|
||||
OUTPUT F_RAGSOCD RAGSOC
|
||||
@ -69,33 +65,19 @@ BEGIN
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
NUMBER F_CODATT 5
|
||||
NUMBER F_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 2 3 "Attività "
|
||||
USE LF_ATTIV
|
||||
INPUT CODDITTA F_DITTA SELECT
|
||||
INPUT CODATT F_CODATT
|
||||
DISPLAY "Ditta" CODDITTA
|
||||
DISPLAY "Codice" CODATT
|
||||
DISPLAY "ATECO@8" CODATECO
|
||||
DISPLAY "Prev.@C" ATTPREV
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
OUTPUT F_CODATT CODATT
|
||||
OUTPUT F_DESCATT DESCR
|
||||
FLAGS "Z"
|
||||
PROMPT 2 2 "Anno "
|
||||
CHECKTYPE REQUIRED
|
||||
FLAGS "AU"
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
STRING F_DESCATT 50
|
||||
BEGIN
|
||||
PROMPT 26 3 ""
|
||||
FLAGS "D"
|
||||
NUM_EXPR #THIS_FIELD>=2010
|
||||
WARNING "Anno non valido"
|
||||
END
|
||||
|
||||
BOOLEAN F_SENDALL
|
||||
BEGIN
|
||||
PROMPT 2 4 "Invia anche le operazioni escluse dall'obbligo di comunicazione"
|
||||
PROMPT 15 2 "Invia anche operazioni escluse dall'obbligo di comunicazione"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 78 4
|
||||
@ -123,6 +105,7 @@ BEGIN
|
||||
OUTPUT F_CODCF CODCF
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHEKTYPE NORMAL
|
||||
ADD RUN CG0 -1
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
@ -140,7 +123,7 @@ END
|
||||
|
||||
STRING F_OCFPI 16
|
||||
BEGIN
|
||||
PROMPT 2 8 "Occ. "
|
||||
PROMPT 2 8 "Occ."
|
||||
USE OCCAS
|
||||
INPUT CFPI F_OCFPI
|
||||
DISPLAY "Codice@16" CFPI
|
||||
@ -168,32 +151,38 @@ BEGIN
|
||||
ITEM "C/F@3F"
|
||||
ITEM "Codice@F"
|
||||
ITEM "Occasionale@16F"
|
||||
ITEM "Numero\nRegistraz.@9"
|
||||
ITEM "Ragione Sociale@24"
|
||||
ITEM "Numero\nRegistr.@7"
|
||||
ITEM "Data\nOperazione@10"
|
||||
ITEM "Mod.\nPag.@4"
|
||||
ITEM "Importo\ndovuto@12"
|
||||
ITEM "Imposta@12"
|
||||
ITEM "Natura\nOperazione@10"
|
||||
ITEM "Tipologia\nOperazione@10"
|
||||
ITEM "Nat.\nOper.@4"
|
||||
ITEM "Tipo.\nOper.@4"
|
||||
ITEM "Contratto@18"
|
||||
ITEM "Importo Totale\nOperazione@12"
|
||||
ITEM "Imposte Totali\nOperazione@12"
|
||||
ITEM "N. Reg.\nrettif.@7"
|
||||
ITEM "Partita IVA@15"
|
||||
ITEM "Codice Fiscale@17"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
PAGE "Riga" -1 -1 74 10
|
||||
PAGE "Riga" -1 -1 69 13
|
||||
|
||||
NUMBER A_RIGA 7
|
||||
BEGIN
|
||||
PROMPT 1 1 "Numero riga "
|
||||
PROMPT 1 1 "Numero progressivo "
|
||||
FLAGS "D"
|
||||
FIELD PROGR
|
||||
END
|
||||
|
||||
BOOLEAN A_IGNORA
|
||||
BEGIN
|
||||
PROMPT 31 1 "Non inviare questa riga"
|
||||
PROMPT 31 1 "Esclusa da invio"
|
||||
FIELD IGNORA
|
||||
END
|
||||
|
||||
@ -207,13 +196,15 @@ END
|
||||
|
||||
NUMBER A_CODCF 6
|
||||
BEGIN
|
||||
PROMPT 16 2 ""
|
||||
PROMPT 17 2 ""
|
||||
USE CLIFO
|
||||
INPUT TIPOCF A_TIPOCF SELECT
|
||||
INPUT CODCF A_CODCF
|
||||
DISPLAY "Codice" CODCF
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
DISPLAY "Occasionale@C" OCCAS
|
||||
DISPLAY "Partita IVA" PAIV
|
||||
DISPLAY "Codice fiscale@16" COFI
|
||||
OUTPUT A_CODCF CODCF
|
||||
CHEKTYPE REQUIRED
|
||||
FIELD CODCF
|
||||
@ -221,78 +212,142 @@ END
|
||||
|
||||
STRING A_OCFPI 16
|
||||
BEGIN
|
||||
PROMPT 32 2 "Occasionale "
|
||||
PROMPT 34 2 "Occasionale "
|
||||
USE OCCAS
|
||||
INPUT CFPI A_OCFPI
|
||||
DISPLAY "Codice@16" CFPI
|
||||
DISPLAY "Ragione Sociale@50" RAGSOC
|
||||
DISPLAY "Partita IVA" PAIV
|
||||
DISPLAY "Codice fiscale@16" COFI
|
||||
OUTPUT A_OCFPI CFPI
|
||||
CHEKTYPE NORMAL
|
||||
GROUP 3
|
||||
FIELD OCFPI
|
||||
END
|
||||
|
||||
STRING A_RAGSOC 50 45
|
||||
BEGIN
|
||||
PROMPT 1 3 "Ragione Sociale "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
STRING A_PAIV 12
|
||||
BEGIN
|
||||
PROMPT 1 4 "P.IVA "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
STRING A_COFI 16
|
||||
BEGIN
|
||||
PROMPT 41 4 "C.F. "
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
DATE A_DATAREG
|
||||
BEGIN
|
||||
PROMPT 1 4 "Data operazione "
|
||||
PROMPT 1 5 "Data operazione "
|
||||
FIELD DATAREG
|
||||
CHEKTYPE REQUIRED
|
||||
END
|
||||
|
||||
NUMBER A_NUMREG 7
|
||||
BEGIN
|
||||
PROMPT 41 4 "N. operazione "
|
||||
PROMPT 41 5 "N. operazione "
|
||||
FIELD NUMREG
|
||||
USE MOV
|
||||
INPUT NUMREG A_NUMREG
|
||||
DISPLAY "Numero@7" NUMREG
|
||||
DISPLAY "Data@10" DATAREG
|
||||
DISPLAY "Descrizione@50" DESCR
|
||||
OUTPUT A_NUMREG NUMREG
|
||||
CHECKTYPE NORMAL
|
||||
ADD RUN cg2 -0
|
||||
END
|
||||
|
||||
LIST A_MODPAG 1 15
|
||||
LIST A_MODPAG 1 20
|
||||
BEGIN
|
||||
PROMPT 1 2 ""
|
||||
ITEM "3|Non frazionato"
|
||||
ITEM "1|Acconto"
|
||||
ITEM "2|Saldo"
|
||||
PROMPT 1 6 "Modalità di pagamento "
|
||||
ITEM "3|3 - Non frazionato"
|
||||
ITEM "1|1 - Acconto"
|
||||
ITEM "2|2 - Saldo"
|
||||
FIELD MODPAG
|
||||
END
|
||||
|
||||
|
||||
CURRENCY A_IMPORTO 12
|
||||
LIST A_NATOPE 1 35
|
||||
BEGIN
|
||||
PROMPT 1 5 "Importo dovuto "
|
||||
FIELD CORRISP
|
||||
END
|
||||
|
||||
CURRENCY A_IMPOSTA 12
|
||||
BEGIN
|
||||
PROMPT 41 5 "Imposta "
|
||||
FIELD IMPOSTA
|
||||
END
|
||||
|
||||
LIST A_NATOPE 1 30
|
||||
BEGIN
|
||||
PROMPT 1 6 "Tipologia imponibile "
|
||||
ITEM "1|Imponibile"
|
||||
ITEM "2|Non imponibile"
|
||||
ITEM "3|Esente"
|
||||
ITEM "4|Imponibile con IVA non esposta"
|
||||
PROMPT 1 7 "Natura operazione "
|
||||
ITEM "1|1 - Imponibile"
|
||||
ITEM "2|2 - Non imponibile"
|
||||
ITEM "3|3 - Esente"
|
||||
ITEM "4|4 - Imponibile con IVA non esposta"
|
||||
ITEM "5|5 - Imponibile con IVA a margine"
|
||||
FIELD NATOPE
|
||||
END
|
||||
|
||||
LIST A_TIPOPE 1 30
|
||||
BEGIN
|
||||
PROMPT 1 7 "Tipologia operazione "
|
||||
ITEM "1|Cessione di beni"
|
||||
ITEM "2|Prestazione di servizi"
|
||||
ITEM "3|Acquisto di beni"
|
||||
ITEM "4|Acquisto di servizi"
|
||||
PROMPT 1 8 "Tipologia operazione "
|
||||
ITEM "1|1 - Cessione di beni"
|
||||
ITEM "2|2 - Prestazione di servizi"
|
||||
ITEM "3|3 - Acquisto di beni"
|
||||
ITEM "4|4 - Acquisto di servizi"
|
||||
FIELD TIPOPE
|
||||
END
|
||||
|
||||
CURRENCY A_TOTALE 12
|
||||
CURRENCY A_IMPORTO 12
|
||||
BEGIN
|
||||
PROMPT 1 8 "Totawe "
|
||||
FIELD TOTALE
|
||||
PROMPT 1 9 "Importo dovuto "
|
||||
FIELD IMPORTO
|
||||
END
|
||||
|
||||
CURRENCY A_IMPOSTA 12
|
||||
BEGIN
|
||||
PROMPT 42 9 "Imposta "
|
||||
FIELD IMPOSTA
|
||||
END
|
||||
|
||||
STRING A_CONTRATTO 18
|
||||
BEGIN
|
||||
PROMPT 1 10 "Contratto "
|
||||
USE &CON
|
||||
INPUT CODTAB[1,1] A_TIPOCF SELECT
|
||||
INPUT CODTAB[2,7] A_CODCF SELECT
|
||||
INPUT CODTAB[8,25] A_CONTRATTO
|
||||
DISPLAY "Contratto@18" CODTAB[8,25]
|
||||
DISPLAY "Descrizione@50" S0
|
||||
OUTPUT A_CONTRATTO CODTAB[8,25]
|
||||
ADD RUN fe0 -1 &CON
|
||||
CHEKCTYPE NORMAL
|
||||
FIELD CONTRATTO
|
||||
MESSAGE EMPTY DISABLE,A_IMPORTOTOT|DISABLE,A_IMPOSTATOT
|
||||
MESSAGE ENABLE,A_IMPORTOTOT|ENABLE,A_IMPOSTATOT
|
||||
END
|
||||
|
||||
CURRENCY A_IMPORTOTOT 12
|
||||
BEGIN
|
||||
PROMPT 1 11 "Totale "
|
||||
FIELD IMPORTOTOT
|
||||
END
|
||||
|
||||
CURRENCY A_IMPOSTATOT 12
|
||||
BEGIN
|
||||
PROMPT 42 11 "Imposte "
|
||||
FIELD IMPOSTATOT
|
||||
END
|
||||
|
||||
NUMBER A_NUMRETT 7
|
||||
BEGIN
|
||||
PROMPT 1 12 "N. operazione da rettificare "
|
||||
FIELD NUMRETT
|
||||
COPY USE A_NUMREG
|
||||
INPUT NUMREG A_NUMRETT
|
||||
COPY DISPLAY A_NUMREG
|
||||
OUTPUT A_NUMRETT NUMREG
|
||||
CHECKTYPE NORMAL
|
||||
ADD RUN cg2 -0
|
||||
NUM_EXPR #A_NUMRETT!=#A_NUMREG
|
||||
WARNING "Inserire un numero registrazione diverso da quello principale"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
|
107
fe/fe0200.cpp
107
fe/fe0200.cpp
@ -4,20 +4,88 @@
|
||||
#include <modtbapp.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Maschera generica di gestione tabelle di modulo CG
|
||||
// Maschera gestione contratti FE
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TFE_table_mask : public TAutomask
|
||||
class TFE_contract_mask : public TAutomask
|
||||
{
|
||||
TSheet_field& rate_sheet() const;
|
||||
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field &o, TField_event e, long jolly);
|
||||
virtual void autoload(const TRelation& rel);
|
||||
virtual void autosave(TRelation& rel) const;
|
||||
|
||||
public:
|
||||
TFE_table_mask(const char* name) : TAutomask(name) {}
|
||||
TFE_contract_mask() : TAutomask("fetbcon") {}
|
||||
};
|
||||
|
||||
bool TFE_table_mask::on_field_event(TOperable_field &o, TField_event e, long jolly)
|
||||
// L'ultimo (e unico) sheet della maschera contiene la rateizzazione delle fatture
|
||||
TSheet_field& TFE_contract_mask::rate_sheet() const
|
||||
{
|
||||
int f;
|
||||
for (f = fields()-1; f > 0 && !fld(f).is_sheet(); f--);
|
||||
CHECK(f > 0, "Rate sheet non found");
|
||||
return (TSheet_field&)fld(f);
|
||||
}
|
||||
|
||||
// carica i normalmente i campi standard e la sequenza degli R* nello sheet
|
||||
void TFE_contract_mask::autoload(const TRelation& rel)
|
||||
{
|
||||
TAutomask::autoload(rel);
|
||||
|
||||
TSheet_field& s = rate_sheet();
|
||||
s.destroy();
|
||||
const TRectype& curr = rel.curr();
|
||||
|
||||
char anno[] = "I0"; // I[0,1,2,3] contengono i 4 anni solari
|
||||
char imp[] = "R0"; // R[0,2,4,6] contengono i 4 importi annuali
|
||||
char iva[] = "R1"; // R[1,3,5,7] contengono le 4 imposte annuali
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
TToken_string& row = s.row(i);
|
||||
row.add(curr.get(anno));
|
||||
row.add(curr.get(imp));
|
||||
row.add(curr.get(iva));
|
||||
anno[1]++; // I0 -> I1
|
||||
imp[1]+=2; // R0 -> R2
|
||||
iva[1]+=2; // R1 -> R3
|
||||
}
|
||||
}
|
||||
|
||||
// salva i normalmente i campi standard e la sequenza degli R* dallo sheet
|
||||
void TFE_contract_mask::autosave(TRelation& rel) const
|
||||
{
|
||||
TAutomask::autosave(rel);
|
||||
TSheet_field& s = rate_sheet();
|
||||
TRectype& curr = rel.curr();
|
||||
|
||||
char anno[] = "I0"; // I[0,1,2,3] contengono i 4 anni solari
|
||||
char imp[] = "R0"; // R[0,2,4,6] contengono i 4 importi annuali
|
||||
char iva[] = "R1"; // R[1,3,5,7] contengono le 4 imposte annuali
|
||||
|
||||
for (int i = 0; i < s.items(); i++)
|
||||
{
|
||||
TToken_string& row = s.row(i);
|
||||
curr.put(anno, row.get(0));
|
||||
curr.put(imp, row.get());
|
||||
curr.put(iva, row.get());
|
||||
anno[1]++; // I0 -> I1
|
||||
imp[1]+=2; // R0 -> R2
|
||||
iva[1]+=2; // R1 -> R3
|
||||
}
|
||||
}
|
||||
|
||||
bool TFE_contract_mask::on_field_event(TOperable_field &o, TField_event e, long jolly)
|
||||
{
|
||||
switch (e)
|
||||
{
|
||||
case se_query_add:
|
||||
case se_query_del:
|
||||
return false; // Non permetto aggiunta/cancellazione di righe
|
||||
default: break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -30,8 +98,6 @@ class TFE_table_app : public TTable_module_application
|
||||
{
|
||||
protected: // TRelation_application
|
||||
virtual TMask* user_create_mask();
|
||||
virtual int write(const TMask& m);
|
||||
virtual int rewrite(const TMask& m);
|
||||
|
||||
public:
|
||||
};
|
||||
@ -40,26 +106,21 @@ public:
|
||||
// che abbiano controlli speciali da effettuare nella on_field_event
|
||||
TMask* TFE_table_app::user_create_mask()
|
||||
{
|
||||
TMask* m = NULL;
|
||||
const TString4 name = get_relation()->file(0).name();
|
||||
if (name == "???")
|
||||
return new TFE_table_mask("???");
|
||||
// Le maschere normali sono gia' gestite dalla TTable_module_application
|
||||
return TTable_module_application::user_create_mask();
|
||||
}
|
||||
if (name == "CON")
|
||||
m = new TFE_contract_mask;
|
||||
else
|
||||
m = TTable_module_application::user_create_mask();
|
||||
|
||||
if (m != NULL)
|
||||
{
|
||||
TString str; m->get_caption(str);
|
||||
if (str.full())
|
||||
main_app().set_title(str);
|
||||
}
|
||||
|
||||
// Ridefinizione del metodo write
|
||||
int TFE_table_app::write(const TMask& m)
|
||||
{
|
||||
const TString4 name = get_relation()->file(0).name();
|
||||
return TTable_module_application::write(m);
|
||||
}
|
||||
|
||||
// Ridefinizione del metodo rewrite
|
||||
int TFE_table_app::rewrite(const TMask& m)
|
||||
{
|
||||
const TString4 name = get_relation()->file(0).name();
|
||||
return TTable_module_application::rewrite(m);
|
||||
return m;
|
||||
}
|
||||
|
||||
int fe0200(int argc, char* argv[])
|
||||
|
22
fe/fetbcon.h
22
fe/fetbcon.h
@ -1,8 +1,14 @@
|
||||
#define F_TIPOCF 101
|
||||
#define F_CODCF 102
|
||||
#define F_RAGSOC 103
|
||||
#define F_CONTRATTO 104
|
||||
#define F_DESCRIZIONE 105
|
||||
#define F_INIZIO 106
|
||||
#define F_FINE 107
|
||||
#define F_IMPORTO 108
|
||||
#define F_TIPOCF 201
|
||||
#define F_CODCF 202
|
||||
#define F_RAGSOC 203
|
||||
#define F_CONTRATTO 204
|
||||
#define F_DESCRIZIONE 205
|
||||
#define F_PADRE 206
|
||||
#define F_DESPADRE 207
|
||||
#define F_INIZIO 220
|
||||
#define F_FINE 221
|
||||
#define F_RATE 250
|
||||
|
||||
#define R_ANNO 101
|
||||
#define R_IMPORTO 102
|
||||
#define R_IMPOSTA 103
|
||||
|
@ -6,7 +6,7 @@ ENDPAGE
|
||||
|
||||
PAGE "Contratti per invio dati rilevanti" 0 2 0 0
|
||||
|
||||
GROUPBOX DLG_NULL 78 5
|
||||
GROUPBOX DLG_NULL 78 6
|
||||
BEGIN
|
||||
PROMPT 1 1 "@bEstremi"
|
||||
END
|
||||
@ -88,38 +88,88 @@ BEGIN
|
||||
KEY 2
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 78 5
|
||||
STRING F_PADRE 18
|
||||
BEGIN
|
||||
PROMPT 1 6 "@bDurata ed importo"
|
||||
PROMPT 2 5 "Contratto principale "
|
||||
FLAGS "U"
|
||||
FIELD S1
|
||||
COPY USE F_CONTRATTO
|
||||
INPUT CODTAB[1,1] F_TIPOCF SELECT
|
||||
INPUT CODTAB[2,7] F_CODCF SELECT
|
||||
INPUT CODTAB[8,25] F_PADRE
|
||||
COPY DISPLAY F_CONTRATTO
|
||||
OUTPUT F_PADRE CODTAB[8,]
|
||||
//OUTPUT F_DESPADRE S0
|
||||
CHECKTYPE NORMAL
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 78 3
|
||||
BEGIN
|
||||
PROMPT 1 7 "@bDurata"
|
||||
END
|
||||
|
||||
DATA F_INIZIO
|
||||
BEGIN
|
||||
PROMPT 2 7 "Inizio "
|
||||
PROMPT 2 8 "Inizio "
|
||||
HELP "Data inizio contratto"
|
||||
FIELD D0
|
||||
END
|
||||
|
||||
DATA F_FINE
|
||||
BEGIN
|
||||
PROMPT 24 7 "Fine "
|
||||
PROMPT 24 8 "Fine "
|
||||
HELP "Data fine contratto"
|
||||
FIELD D1
|
||||
VALIDATE DATE_CMP_FUNC >= #F_INIZIO
|
||||
WARNING "La data finale deve essere successiva a quella iniziale"
|
||||
END
|
||||
|
||||
CURRENCY F_IMPORTO 15
|
||||
SPREADSHEET F_RATE 40 6
|
||||
BEGIN
|
||||
PROMPT 2 8 "Totale "
|
||||
HELP "Inserire un importo non inferiore a 3000 Euro"
|
||||
FIELD R0
|
||||
END
|
||||
|
||||
TEXT DLG_NULL
|
||||
BEGIN
|
||||
PROMPT 2 9 "Importo non inferiore a 3000 Euro (Legge n.122 del 30-07-2010)"
|
||||
PROMPT 2 11 ""
|
||||
ITEM "Anno"
|
||||
ITEM "Importo@12R"
|
||||
ITEM "Imposta@12R"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
ENDMASK
|
||||
|
||||
PAGE "Rateizzazione" -1 -1 25 5
|
||||
|
||||
NUMBER R_ANNO 4
|
||||
BEGIN
|
||||
PROMPT 1 1 "Anno "
|
||||
FIELD I0
|
||||
END
|
||||
|
||||
CURRENCY R_IMPORTO 12
|
||||
BEGIN
|
||||
PROMPT 1 2 "Importo "
|
||||
FIELD R0
|
||||
END
|
||||
|
||||
CURRENCY R_IMPOSTA 12
|
||||
BEGIN
|
||||
PROMPT 1 3 "Imposta "
|
||||
FIELD R1
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
|
||||
BUTTON DLG_OK 2 2
|
||||
BEGIN
|
||||
PROMPT 1 1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 2 2
|
||||
BEGIN
|
||||
PROMPT 1 2 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user