Patch level :
Files correlati : fe0.exe fe0100a.msk Ricompilazione Demo : [ ] Commento : Corretto caricamento contratti git-svn-id: svn://10.65.10.50/branches/R_10_00@22465 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
9263ff08f0
commit
ccbcb4cee3
350
fe/fe0100.cpp
350
fe/fe0100.cpp
@ -26,7 +26,9 @@
|
||||
#include "fe0100a.h"
|
||||
#include "../cg/cglib01.h"
|
||||
|
||||
const long INVALID_NUMREG = 9999999L;
|
||||
const char* const INVALID_NUMDOC = "???????";
|
||||
const long MANUAL_ROW = 900000L;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Utility
|
||||
@ -104,12 +106,14 @@ protected:
|
||||
|
||||
public:
|
||||
virtual bool ok() const { return !_rec.empty(); }
|
||||
const TString& codice() const { return _rec.get("CODTAB").mid(7); }
|
||||
bool totale_annuale(int anno, real& importo, real& imposta) const;
|
||||
int modalita_pagamento() const;
|
||||
|
||||
bool init(char tipocf, long codcf, const TString& codcont);
|
||||
bool init(const TRectype& rec);
|
||||
TContratto(char tipocf, long codcf, const char* codcont);
|
||||
TContratto(const TRectype& rec) : _rec(rec) { init(rec); }
|
||||
TContratto(char tipocf, long codcf, const char* codcont) : _rec(LF_TABMOD) { init(tipocf, codcf, codcont); }
|
||||
TContratto(const TRectype& rec) : _rec(LF_TABMOD) { init(rec); }
|
||||
};
|
||||
|
||||
bool TContratto::importo_annuale(int anno, real& importo, real& imposta) const
|
||||
@ -192,35 +196,65 @@ int TContratto::modalita_pagamento() const
|
||||
return modpag;
|
||||
}
|
||||
|
||||
bool TContratto::init(const TRectype& rec)
|
||||
bool TContratto::init(char tipocf, long codcf, const TString& codcont)
|
||||
{
|
||||
_rec = rec;
|
||||
if (!_rec.empty())
|
||||
if (tipocf >= 'C' && codcf > 0 && codcont.full())
|
||||
{
|
||||
int primo_anno = _rec.get_int("I0");
|
||||
if (primo_anno < 2010)
|
||||
{
|
||||
const TDate inizio = _rec.get("D0");
|
||||
primo_anno = inizio.year();
|
||||
if (primo_anno < 2010)
|
||||
primo_anno = 2010;
|
||||
_rec.put("I0", primo_anno);
|
||||
}
|
||||
|
||||
real importo = _rec.get("R0");
|
||||
if (importo <= ZERO)
|
||||
{
|
||||
importo = primo_anno > 2010 ? 3000 : 25000;
|
||||
_rec.put("R0", importo);
|
||||
}
|
||||
}
|
||||
TString80 key; key.format("%c%6ld%s", tipocf, codcf, (const char*)codcont);
|
||||
init(cache().get("&CON", key));
|
||||
}
|
||||
else
|
||||
_rec.zero();
|
||||
return ok();
|
||||
}
|
||||
|
||||
TContratto::TContratto(char tipocf, long codcf, const char* codcont) : _rec(LF_TABMOD)
|
||||
bool TContratto::init(const TRectype& rec)
|
||||
{
|
||||
TString80 key; key.format("%c%6ld%s", tipocf, codcf, codcont);
|
||||
init(cache().get("&CON", key));
|
||||
switch (rec.num())
|
||||
{
|
||||
case LF_TABMOD:
|
||||
_rec = rec;
|
||||
if (!_rec.empty())
|
||||
{
|
||||
int primo_anno = _rec.get_int("I0");
|
||||
if (primo_anno < 2010)
|
||||
{
|
||||
const TDate inizio = _rec.get("D0");
|
||||
primo_anno = inizio.year();
|
||||
if (primo_anno < 2010)
|
||||
primo_anno = 2010;
|
||||
_rec.put("I0", primo_anno);
|
||||
}
|
||||
|
||||
real importo = _rec.get("R0");
|
||||
if (importo <= ZERO)
|
||||
{
|
||||
importo = primo_anno > 2010 ? 3000 : 25000;
|
||||
_rec.put("R0", importo);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LF_ALLEG:
|
||||
{
|
||||
const char tipocf = rec.get_char(ALL_TIPOCF);
|
||||
const long codcf = rec.get_long(ALL_CODCF);
|
||||
const TString& contr = rec.get(ALL_CONTRATTO);
|
||||
init(tipocf, codcf, contr);
|
||||
}
|
||||
break;
|
||||
case LF_MOV:
|
||||
{
|
||||
const char tipocf = rec.get_char(MOV_TIPO);
|
||||
const long codcf = rec.get_long(MOV_CODCF);
|
||||
const TString& contr = rec.get(MOV_CONTRATTO);
|
||||
init(tipocf, codcf, contr);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
CHECKD(false, "Record non valido per contratto FE", rec.num());
|
||||
break;
|
||||
}
|
||||
return ok();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -248,8 +282,8 @@ public:
|
||||
|
||||
const TString& ragione_sociale() const { return _ragsoc; }
|
||||
const TString& cognome() const { return _ragsoc.left(24); }
|
||||
const TString& nome() const { return _ragsoc.mid(30,20); }
|
||||
char sesso() const { return (_cofi[9] >= '4') ? 'F' : 'M'; }
|
||||
const TString& nome() const { CHECK(fisica(), "Non chiedere nome giuridico!"); return _ragsoc.mid(30,20); }
|
||||
char sesso() const { CHECK(fisica(), "Solo sesso fisico!"); 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; }
|
||||
@ -354,6 +388,9 @@ bool TAnagrafica::init(const TRectype& rec)
|
||||
CHECKD(false, "Record non valido per TAnagrafica ", rec.num());
|
||||
break;
|
||||
}
|
||||
|
||||
if (_tipo == 'G')
|
||||
_ragsoc.strip_double_spaces();
|
||||
|
||||
return _tipo == 'F' || _tipo == 'G';
|
||||
}
|
||||
@ -614,7 +651,6 @@ void TDati_rilevanti_set::add_control_rec(int zon, int num_inv, int tot_inv)
|
||||
|
||||
if (ditta.giuridica())
|
||||
{
|
||||
TString den;
|
||||
set( 9, ditta.ragione_sociale());
|
||||
set(10, ditta.comune_residenza());
|
||||
set(11, ditta.provincia_residenza());
|
||||
@ -753,7 +789,16 @@ bool TDati_rilevanti_array::add(const TRectype& alleg, bool send_all)
|
||||
if (old_mode <= 1)
|
||||
{
|
||||
const int anno = sum->get_int(ALL_ANNO);
|
||||
const int new_mode = sum->get_real(ALL_IMPORTO) < importo_limite(anno);
|
||||
int new_mode = sum->get_real(ALL_IMPORTO) < importo_limite(anno);
|
||||
|
||||
if (new_mode && contratto.full())
|
||||
{
|
||||
const TContratto c(alleg);
|
||||
real imp, iva;
|
||||
if (c.totale_annuale(anno, imp, iva))
|
||||
new_mode = imp < importo_limite(anno);
|
||||
}
|
||||
|
||||
if (old_mode != new_mode)
|
||||
sum->put(ALL_IGNORA, new_mode);
|
||||
}
|
||||
@ -798,12 +843,10 @@ void TDati_rilevanti_array::add(const TArray& note, bool send_all)
|
||||
// TDati_rilevanti_msk
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
#define MANUAL_ROW 900000L
|
||||
|
||||
enum TExclusion_mode { em_incluso, em_importo_limite, em_no_allegato,
|
||||
em_fiscalita_agevolata, em_estero, em_intra,
|
||||
em_data_limite, em_art8, em_passaggi_interni,
|
||||
em_forzato, em_inviato, em_altro };
|
||||
em_fiscalita_agevolata, em_estero, em_intra,
|
||||
em_art8, em_data_limite, em_passaggi_interni,
|
||||
em_inviato, em_altro };
|
||||
|
||||
class TDati_rilevanti_msk : public TAutomask
|
||||
{
|
||||
@ -840,7 +883,8 @@ public:
|
||||
TRecnotype genera_alleg();
|
||||
bool elabora_alleg();
|
||||
bool send_alleg();
|
||||
|
||||
bool recall_alleg() const;
|
||||
|
||||
TExclusion_mode elabora_movimento(const TRectype& mov, TBaseisamfile& falleg);
|
||||
|
||||
bool salva_allegato(const TRectype& mov, TBaseisamfile& falleg, TRecnotype& progr,
|
||||
@ -871,7 +915,6 @@ TExclusion_mode TDati_rilevanti_msk::segnala_movimento(const TRectype& mov, TExc
|
||||
case em_data_limite : msg << TR("Data movimento fuori dal limite della comunicazione"); break;
|
||||
case em_art8 : msg << TR("Soggetto all'articolo 8 (del dpr 26-10-1972)"); break;
|
||||
case em_passaggi_interni : msg << TR("Passaggi interni"); break;
|
||||
case em_forzato : msg << TR("Forzato manualmente"); break;
|
||||
case em_inviato : msg << TR("Inviato l'anno precedente"); break;
|
||||
default : msg << TR("Altri motivi"); break;
|
||||
}
|
||||
@ -888,7 +931,7 @@ TExclusion_mode TDati_rilevanti_msk::validate_clifo(const TRectype& mov)
|
||||
const long codcf = mov.get_long(MOV_CODCF);
|
||||
const TString16 ocfpi = mov.get(MOV_OCFPI);
|
||||
if (tipocf <= ' ' || (codcf <= 0 && ocfpi.blank()))
|
||||
return segnala_movimento(mov, em_altro);
|
||||
return segnala_movimento(mov, em_no_allegato);
|
||||
|
||||
TString4 stato;
|
||||
if (ocfpi.full())
|
||||
@ -1064,70 +1107,78 @@ TExclusion_mode TDati_rilevanti_msk::elabora_movimento(const TRectype& mov, TBas
|
||||
return _why;
|
||||
}
|
||||
|
||||
// Test di coerenza tra MODPAG
|
||||
// Test di coerenza tra MODPAG, CONTRATTO e NUMRETT
|
||||
bool TDati_rilevanti_msk::controlla_mov(TRectype& mrec) const
|
||||
{
|
||||
const long numreg = mrec.get_long(MOV_NUMREG);
|
||||
int modpag = mrec.get_int(MOV_MODPAG);
|
||||
TString80 contratto = mrec.get(MOV_CONTRATTO);
|
||||
TDate datarett = mrec.get(MOV_DATARETT);
|
||||
TString8 numrett = mrec.get(MOV_NUMRETT);
|
||||
|
||||
int old_modpag = mrec.get_int(MOV_MODPAG);
|
||||
int new_modpag = 1;
|
||||
|
||||
bool update = false;
|
||||
|
||||
if (is_nota_variazione(mrec))
|
||||
{
|
||||
TDate datarett = mrec.get(MOV_DATARETT);
|
||||
TString8 numrett = mrec.get(MOV_NUMRETT);
|
||||
if (contratto.full())
|
||||
{
|
||||
mrec.put(MOV_CONTRATTO, contratto.cut(0));
|
||||
update = true;
|
||||
mrec.put(MOV_CONTRATTO, contratto.cut(0));
|
||||
update = true; // Peccato veniale
|
||||
}
|
||||
if (modpag != 1)
|
||||
{
|
||||
mrec.put(MOV_MODPAG, modpag = 1);
|
||||
update = true;
|
||||
}
|
||||
if (numrett.blank() && fattura_associata(numreg, datarett, numrett))
|
||||
if (numrett.blank())
|
||||
{
|
||||
if (!fattura_associata(numreg, datarett, numrett))
|
||||
numrett = INVALID_NUMDOC;
|
||||
mrec.put(MOV_DATARETT, datarett);
|
||||
mrec.put(MOV_NUMRETT, numrett);
|
||||
update = true;
|
||||
}
|
||||
if (numrett.full())
|
||||
const TAnagrafica a(mrec);
|
||||
TString msg;
|
||||
if (numrett != INVALID_NUMDOC)
|
||||
{
|
||||
const TAnagrafica a(mrec);
|
||||
TString msg;
|
||||
msg.format(FR("Nota n. %ld di %s associata al doc. %s del %s"),
|
||||
numreg, (const char*)a.ragione_sociale(), (const char*)numrett, datarett.string());
|
||||
numreg, (const char*)a.ragione_sociale(), (const char*)numrett, datarett.string());
|
||||
_log->log(0, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.format(FR("Nota n. %ld di %s non associata ad una fattura"),
|
||||
numreg, (const char*)a.ragione_sociale());
|
||||
_log->log(1, msg);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (contratto.full())
|
||||
{
|
||||
if (modpag < 2)
|
||||
{
|
||||
const TContratto c(mrec.get_char(MOV_TIPO), mrec.get_long(MOV_CODCF), contratto);
|
||||
mrec.put(MOV_MODPAG, modpag = c.modalita_pagamento());
|
||||
update = true;
|
||||
}
|
||||
if (numrett.full())
|
||||
{
|
||||
mrec.zero(MOV_DATARETT);
|
||||
mrec.zero(MOV_NUMRETT);
|
||||
update = true;
|
||||
}
|
||||
const TContratto c(mrec);
|
||||
if (c.codice() == "3")
|
||||
int pippo = 1;
|
||||
new_modpag = c.modalita_pagamento();
|
||||
}
|
||||
else
|
||||
if (get(MOV_NUMRETT).full() || get(MOV_DATARETT).full())
|
||||
{
|
||||
if (modpag != 1)
|
||||
{
|
||||
mrec.put(MOV_MODPAG, modpag = 1);
|
||||
update = true;
|
||||
}
|
||||
mrec.zero(MOV_DATARETT);
|
||||
mrec.zero(MOV_NUMRETT);
|
||||
update = true; // Peccato veniale
|
||||
}
|
||||
}
|
||||
if (old_modpag != new_modpag)
|
||||
{
|
||||
if (old_modpag > 0) // I vecchi movimenti hanno per forza 0: li perdoniamo!
|
||||
{
|
||||
const TAnagrafica a(mrec);
|
||||
TString msg;
|
||||
msg.format(FR("Movimento n. %ld di %s con modalità di pagamento incongruente: %d->%d"),
|
||||
numreg, (const char*)a.ragione_sociale(), old_modpag, new_modpag);
|
||||
_log->log(0, msg);
|
||||
}
|
||||
mrec.put(MOV_MODPAG, new_modpag);
|
||||
update = true;
|
||||
}
|
||||
|
||||
return update;
|
||||
}
|
||||
@ -1160,22 +1211,16 @@ bool TDati_rilevanti_msk::azzera_alleg(int anno, TAssoc_array& manuali) const
|
||||
|
||||
const long progr = arec.get_long(ALL_PROGR);
|
||||
const long numreg = mrec.get_long(MOV_NUMREG);
|
||||
const int annoiva = mrec.get_long(MOV_ANNOIVA);
|
||||
|
||||
bool kill = numreg != progr;
|
||||
const bool kill = numreg != progr || annoiva < anno; // Riga generata dalla vecchia versione
|
||||
if (!kill)
|
||||
{
|
||||
const bool forzata = alleg.get(ALL_FORZATURA).as_bool();
|
||||
if (forzata)
|
||||
manuali.add(arec.get(ALL_PROGR));
|
||||
else
|
||||
{
|
||||
if (controlla_mov(mrec))
|
||||
{
|
||||
// fmov.rewrite(); // Non mi fido tanto
|
||||
}
|
||||
}
|
||||
}
|
||||
if (kill)
|
||||
else
|
||||
falleg.remove();
|
||||
}
|
||||
return !manuali.empty();
|
||||
@ -1217,6 +1262,32 @@ TRecnotype TDati_rilevanti_msk::nuovo_progr() const
|
||||
return progr+1;
|
||||
}
|
||||
|
||||
static int sort_alleg(const TSortable& s1, const TSortable& s2, void* jolly)
|
||||
{
|
||||
const TRectype& a1 = (const TRectype&)s1;
|
||||
const TRectype& a2 = (const TRectype&)s2;
|
||||
|
||||
const TString& c1 = a1.get(ALL_CONTRATTO);
|
||||
const TString& c2 = a2.get(ALL_CONTRATTO);
|
||||
int cmp = c1.compare(c2, -1, true);
|
||||
|
||||
if (cmp == 0 && c1.blank())
|
||||
{
|
||||
const int n1 = is_nota_variazione(a1);
|
||||
const int n2 = is_nota_variazione(a2);
|
||||
cmp = n1 - n2;
|
||||
}
|
||||
|
||||
if (cmp == 0)
|
||||
{
|
||||
const TDate d1 = a1.get(ALL_DATAREG);
|
||||
const TDate d2 = a2.get(ALL_DATAREG);
|
||||
cmp = d1 - d2;
|
||||
}
|
||||
|
||||
return cmp;
|
||||
}
|
||||
|
||||
TRecnotype TDati_rilevanti_msk::genera_alleg()
|
||||
{
|
||||
const int anno = get_int(F_ANNO);
|
||||
@ -1240,7 +1311,7 @@ TRecnotype TDati_rilevanti_msk::genera_alleg()
|
||||
query << "USE MOV KEY 3 SELECT BETWEEN(DATAREG," << anno << "0101," << get_date(F_DATA).date2ansi() << ")"
|
||||
<< "\nFROM TIPO=C\nTO TIPO=F";
|
||||
TISAM_recordset mov(query);
|
||||
const TRectype& mov_rec = mov.cursor()->curr();
|
||||
TRectype& mov_rec = mov.cursor()->curr();
|
||||
const TRecnotype items = mov.items();
|
||||
|
||||
TProgind pi(items, str_pi);
|
||||
@ -1257,30 +1328,23 @@ TRecnotype TDati_rilevanti_msk::genera_alleg()
|
||||
continue;
|
||||
}
|
||||
|
||||
const TString8 key = mov_rec.get(MOV_NUMREG);
|
||||
const TString& key = mov_rec.get(MOV_NUMREG);
|
||||
if (manuali.is_key(key))
|
||||
{
|
||||
segnala_movimento(mov_rec, em_forzato);
|
||||
manuali.remove(key);
|
||||
continue;
|
||||
}
|
||||
|
||||
const TDate datareg = mov_rec.get(MOV_DATAREG);
|
||||
controlla_mov(mov_rec);
|
||||
if (is_nota_variazione(mov_rec))
|
||||
{
|
||||
TDate datarett = mov_rec.get(MOV_DATARETT);
|
||||
TString8 numrett = mov_rec.get(MOV_NUMRETT);
|
||||
if (!datarett.ok() || numrett.blank())
|
||||
fattura_associata(atol(key), datarett, numrett);
|
||||
if (numrett.blank())
|
||||
numrett = "???????";
|
||||
if (!datarett.ok())
|
||||
datarett = TDate(31, 12, anno);
|
||||
if (datarett.year() == anno)
|
||||
const TDate datarett = mov_rec.get(MOV_DATARETT);
|
||||
if (!datarett.ok() || datarett.year() == anno)
|
||||
elabora_movimento(mov_rec, falleg); // Elabora nota di variazione
|
||||
}
|
||||
else
|
||||
{
|
||||
const TDate datareg = mov_rec.get(MOV_DATAREG);
|
||||
if (datareg.year() == anno) // Scarta fatture dell'anno dopo
|
||||
elabora_movimento(mov_rec, falleg);
|
||||
}
|
||||
@ -1475,7 +1539,7 @@ bool TDati_rilevanti_msk::send_rec(const TRectype& alleg, TDati_rilevanti_set& o
|
||||
{
|
||||
const TString& numrett = alleg.get(ALL_NUMRETT);
|
||||
const TDate datarett = alleg.get(ALL_DATARETT);
|
||||
if (numrett.full() && numrett[0] != '?' && datarett.year() == alleg.get_int(ALL_ANNO))
|
||||
if (numrett.full() && numrett != INVALID_NUMDOC && datarett.year() == alleg.get_int(ALL_ANNO))
|
||||
done = send_nota_variazione(alleg, operaz);
|
||||
}
|
||||
else
|
||||
@ -1485,6 +1549,32 @@ bool TDati_rilevanti_msk::send_rec(const TRectype& alleg, TDati_rilevanti_set& o
|
||||
return done;
|
||||
}
|
||||
|
||||
bool TDati_rilevanti_msk::recall_alleg() const
|
||||
{
|
||||
const int anno = get_int(F_ANNO);
|
||||
if (!yesno_box(FR("Si desidera annullare l'invio definitivo dei movimenti del %d?"), anno))
|
||||
return false;
|
||||
|
||||
TFast_isamfile mov(LF_MOV);
|
||||
|
||||
TString query;
|
||||
query << "USE MOV KEY 2 SELECT ANNOFE=" << anno;
|
||||
query << "\nFROM DATAREG=01-01-" << anno;
|
||||
TISAM_recordset recset(query);
|
||||
TLocalisamfile& file = recset.cursor()->file();
|
||||
|
||||
TProgind pi(recset.items(), TR("Aggiornamento movimenti di prima nota"));
|
||||
for (bool ok = recset.move_first(); ok; ok = recset.move_next())
|
||||
{
|
||||
if (!pi.addstatus(1))
|
||||
break;
|
||||
file.zero(MOV_ANNOFE);
|
||||
file.rewrite();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Genera file per invio telematico
|
||||
bool TDati_rilevanti_msk::send_alleg()
|
||||
{
|
||||
@ -1510,7 +1600,7 @@ bool TDati_rilevanti_msk::send_alleg()
|
||||
{
|
||||
const TRectype& rec = alleg.cursor()->curr();
|
||||
|
||||
long last_clifo = 0;
|
||||
TString16 last_clifo;
|
||||
TArray note;
|
||||
|
||||
TProgind pi(tot_alleg, TR("Elaborazione file"));
|
||||
@ -1518,7 +1608,10 @@ bool TDati_rilevanti_msk::send_alleg()
|
||||
{
|
||||
if (!pi.addstatus(1))
|
||||
break;
|
||||
const long clifo = rec.get_long(ALL_CODCF);
|
||||
|
||||
TString16 clifo = rec.get(ALL_OCFPI);
|
||||
if (clifo.blank())
|
||||
clifo = rec.get(ALL_CODCF);
|
||||
if (clifo != last_clifo)
|
||||
{
|
||||
data.add(note, send_all);
|
||||
@ -1539,7 +1632,7 @@ bool TDati_rilevanti_msk::send_alleg()
|
||||
const int tot = data.items();
|
||||
if (tot > 0)
|
||||
{
|
||||
TProgind pi(tot, TR("Generazione file"));
|
||||
TProgind pi(tot, TR("Generazione file per Agenzia delle Entrate"));
|
||||
for (int a = 0; a < tot; a++)
|
||||
{
|
||||
if (!pi.addstatus(1))
|
||||
@ -1556,6 +1649,37 @@ bool TDati_rilevanti_msk::send_alleg()
|
||||
if (recset.items() > maxalleg)
|
||||
done = recset.split(temp, maxalleg);
|
||||
|
||||
if (done && get_bool(F_DEFINITIVO) && yesno_box(TR("Si desidera confermare l'invio definitivo della comunicazione?")))
|
||||
{
|
||||
TFast_isamfile mov(LF_MOV);
|
||||
TProgind pi(data.items(), TR("Aggiornamento movimenti di prima nota"), false);
|
||||
for (int i = data.items()-1; i >= 0; i--)
|
||||
{
|
||||
pi.addstatus(1);
|
||||
const TRectype& alleg = data[i];
|
||||
const long numreg = alleg.get_long(ALL_PROGR);
|
||||
if (numreg > 0 && numreg < MANUAL_ROW)
|
||||
{
|
||||
mov.put(MOV_NUMREG, numreg);
|
||||
int err = mov.read(_isequal, _lock);
|
||||
if (err == NOERR)
|
||||
{
|
||||
mov.put(MOV_MODPAG, alleg.get(ALL_MODPAG));
|
||||
mov.put(MOV_CONTRATTO, alleg.get(ALL_CONTRATTO));
|
||||
mov.put(MOV_DATARETT, alleg.get(ALL_DATARETT));
|
||||
mov.put(MOV_NUMRETT, alleg.get(ALL_NUMRETT));
|
||||
mov.put(MOV_ANNOFE, anno);
|
||||
err = mov.rewrite();
|
||||
}
|
||||
if (err != NOERR)
|
||||
{
|
||||
error_box(FR("Impossibile aggiornare il movimento %ld: errore %d.\nSi desidera ritentare?"), numreg, err);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
@ -1732,6 +1856,8 @@ bool TDati_rilevanti_msk::save_sheet()
|
||||
alleg.zero();
|
||||
rec.put(ALL_ANNO, anno);
|
||||
s.autosave_line(r+1, rec);
|
||||
// Il tipo operazione non è più visibile, per cui lo calcolo ora
|
||||
rec.put(ALL_TIPOPE, rec.get_char(ALL_TIPOCF) == 'F' ? 2 : 1);
|
||||
const int err = alleg.rewrite_write();
|
||||
if (err != NOERR)
|
||||
{
|
||||
@ -1830,6 +1956,13 @@ bool TDati_rilevanti_msk::on_field_event(TOperable_field& o, TField_event e, lon
|
||||
if (e == fe_button && check_fields())
|
||||
send_alleg();
|
||||
break;
|
||||
case DLG_DELREC:
|
||||
if (e == fe_button)
|
||||
{
|
||||
recall_alleg();
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case F_ANNO:
|
||||
if (e == fe_init || e == fe_modify)
|
||||
{
|
||||
@ -1845,6 +1978,18 @@ bool TDati_rilevanti_msk::on_field_event(TOperable_field& o, TField_event e, lon
|
||||
d = TDate(30,4,anno+1);
|
||||
set(F_DATA, d);
|
||||
}
|
||||
|
||||
bool one_sent = false;
|
||||
if (anno >= 2010)
|
||||
{
|
||||
// Abilita azzeramento FE se necessario
|
||||
TString query;
|
||||
query << "USE MOV KEY 2 SELECT ANNOFE=" << anno;
|
||||
query << "\nFROM DATAREG=01-01-" << anno;
|
||||
TISAM_recordset movfe(query);
|
||||
one_sent = movfe.move_first();
|
||||
}
|
||||
enable(DLG_DELREC, one_sent);
|
||||
}
|
||||
break;
|
||||
case F_OUTFOLDER:
|
||||
@ -1880,19 +2025,10 @@ bool TDati_rilevanti_msk::on_field_event(TOperable_field& o, TField_event e, lon
|
||||
row.add(nuovo_progr(), s.cid2index(A_RIGA));
|
||||
row.add(TDate(TODAY), s.cid2index(A_DATAREG));
|
||||
row.add(1, s.cid2index(A_MODPAG));
|
||||
row.add(1, s.cid2index(A_TIPOPE));
|
||||
} else
|
||||
if (e == se_query_del)
|
||||
return false;
|
||||
break;
|
||||
case DLG_DELREC:
|
||||
if (e == fe_button)
|
||||
{
|
||||
// La cancellazione fisica non si puo' fare subito
|
||||
o.mask().set(A_IGNORA, "X");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case DLG_EXPORT:
|
||||
if (e == fe_button)
|
||||
return sfield(F_RIGHE).esporta();
|
||||
|
42
fe/fe0100a.h
42
fe/fe0100a.h
@ -1,16 +1,17 @@
|
||||
#define F_ANNO 301
|
||||
#define F_DATA 302
|
||||
#define F_SHOWALL 303
|
||||
#define F_SENDALL 304
|
||||
#define F_OUTFOLDER 305
|
||||
#define F_MAXREC 306
|
||||
#define F_ANNO 301
|
||||
#define F_DATA 302
|
||||
#define F_SHOWALL 303
|
||||
#define F_SENDALL 304
|
||||
#define F_OUTFOLDER 305
|
||||
#define F_MAXREC 306
|
||||
#define F_DEFINITIVO 307
|
||||
|
||||
#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_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
|
||||
|
||||
@ -23,14 +24,13 @@
|
||||
#define A_RAGSOC 107
|
||||
#define A_DATAREG 108
|
||||
#define A_NUMDOC 109
|
||||
#define A_MODPAG 110
|
||||
#define A_IMPORTO 111
|
||||
#define A_IMPOSTA 112
|
||||
#define A_TIPOPE 113
|
||||
#define A_CONTRATTO 114
|
||||
#define A_DATARETT 115
|
||||
#define A_NUMRETT 116
|
||||
#define A_PAIV 117
|
||||
#define A_COFI 118
|
||||
#define A_IMPORTO 110
|
||||
#define A_IMPOSTA 111
|
||||
#define A_MODPAG 112
|
||||
#define A_CONTRATTO 113
|
||||
#define A_DATARETT 114
|
||||
#define A_NUMRETT 115
|
||||
#define A_PAIV 116
|
||||
#define A_COFI 117
|
||||
|
||||
#define A_OCCAS 155
|
||||
|
@ -20,6 +20,10 @@ BEGIN
|
||||
PROMPT 1 2 "Annulla"
|
||||
END
|
||||
|
||||
BUTTON DLG_NULL 2 2
|
||||
BEGIN
|
||||
END
|
||||
|
||||
BUTTON DLG_RECALC 2 2
|
||||
BEGIN
|
||||
PROMPT 1 3 "Ricalcola"
|
||||
@ -27,17 +31,23 @@ BEGIN
|
||||
GROUP 1
|
||||
END
|
||||
|
||||
BUTTON DLG_EXPORT 2 2
|
||||
BEGIN
|
||||
PROMPT 1 4 "Excel"
|
||||
PICTURE TOOL_EXCEL
|
||||
MODULE rs
|
||||
END
|
||||
|
||||
BUTTON DLG_ELABORA 2 2
|
||||
BEGIN
|
||||
PROMPT 1 4 "Invia"
|
||||
PROMPT 1 5 "Invia"
|
||||
PICTURE TOOL_EXPORT
|
||||
END
|
||||
|
||||
BUTTON DLG_EXPORT 2 2
|
||||
BUTTON DLG_DELREC 2 2
|
||||
BEGIN
|
||||
PROMPT 1 5 "Excel"
|
||||
PICTURE TOOL_EXCEL
|
||||
MODULE rs
|
||||
PROMPT 1 6 "Azzera Invio"
|
||||
PICTURE TOOL_RESET
|
||||
END
|
||||
|
||||
#include <helpbar.h>
|
||||
@ -150,10 +160,9 @@ BEGIN
|
||||
ITEM "Ragione Sociale@24"
|
||||
ITEM "Data\nOperazione@10"
|
||||
ITEM "Numero\nFattura@7"
|
||||
ITEM "Mod.\nPag.@4"
|
||||
ITEM "Importo\ndovuto@12"
|
||||
ITEM "Imposta@12"
|
||||
ITEM "Tipo.\nOper.@4"
|
||||
ITEM "Mod.\nPag.@4"
|
||||
ITEM "Contratto@18"
|
||||
ITEM "Data Doc.\nrettif.@10"
|
||||
ITEM "N. Doc.\nrettif.@7"
|
||||
@ -166,9 +175,9 @@ ENDPAGE
|
||||
|
||||
PAGE "Opzioni" 0 2 0 0
|
||||
|
||||
GROUPBOX DLG_NULL 78 5
|
||||
GROUPBOX DLG_NULL 78 6
|
||||
BEGIN
|
||||
PROMPT 1 1 "@bFiltri per invio"
|
||||
PROMPT 1 1 "@bP[zioni per invio"
|
||||
END
|
||||
|
||||
LIST F_SENDALL 1 25
|
||||
@ -178,6 +187,11 @@ BEGIN
|
||||
ITEM "7|Tutti"
|
||||
END
|
||||
|
||||
BOOLEAN F_DEFINITIVO
|
||||
BEGIN
|
||||
PROMPT 50 2 "Invio definitivo"
|
||||
END
|
||||
|
||||
STRING F_OUTFOLDER 255 50
|
||||
BEGIN
|
||||
PROMPT 2 3 "Cartella "
|
||||
@ -219,15 +233,15 @@ BEGIN
|
||||
PROMPT 1 1 "Non inv."
|
||||
ITEM "| 0. Rilevante al fine della dichiarazione"
|
||||
ITEM "1| 1. Importo inferiore al limite della comunicazione"
|
||||
ITEM "2| 2. Soggetto con codice nullo"
|
||||
ITEM "3| 3. Soggetto da non inserire in allegato"
|
||||
ITEM "4| 4. Soggetto residente in stato a fiscalità agevolata"
|
||||
ITEM "5| 5. Soggetto residente all'estero"
|
||||
ITEM "6| 6. Movimento intra"
|
||||
ITEM "2| 2. Soggetto da non inserire in allegato"
|
||||
ITEM "3| 3. Soggetto residente in stato a fiscalità agevolata"
|
||||
ITEM "4| 4. Soggetto residente all'estero"
|
||||
ITEM "5| 5. Movimento intra"
|
||||
ITEM "6| 6. Soggetto all'articolo 8 (del dpr 26-10-1972)"
|
||||
ITEM "7| 7. Data movimento fuori dai limiti della comunicazione"
|
||||
ITEM "8| 8. Soggetto all'articolo 8 (del dpr 26-10-1972)"
|
||||
ITEM "9| 9. Passaggi interni"
|
||||
ITEM "10|10. Altri motivi"
|
||||
ITEM "8| 8. Passaggi interni"
|
||||
ITEM "9| 9. Già inviato"
|
||||
ITEM "10|10.Altri motivi"
|
||||
FIELD IGNORA
|
||||
END
|
||||
|
||||
@ -235,9 +249,7 @@ LIST A_TIPOCF 1 10
|
||||
BEGIN
|
||||
PROMPT 1 2 ""
|
||||
ITEM "C|Cliente"
|
||||
MESSAGE "1",A_TIPOPE
|
||||
ITEM "F|Fornitore"
|
||||
MESSAGE "2",A_TIPOPE
|
||||
FIELD TIPOCF
|
||||
END
|
||||
|
||||
@ -330,10 +342,9 @@ BEGIN
|
||||
MESSAGE DISABLE,A_CONTRATTO|ENABLE,A_DATARETT|ENABLE,A_NUMRETT
|
||||
ITEM "2|2 - Frazionato"
|
||||
MESSAGE ENABLE,A_CONTRATTO|DISABLE,A_DATARETT|DISABLE,A_NUMRETT
|
||||
ITEM "2|3 - Periodico"
|
||||
ITEM "3|3 - Periodico"
|
||||
MESSAGE ENABLE,A_CONTRATTO|DISABLE,A_DATARETT|DISABLE,A_NUMRETT
|
||||
FIELD MODPAG
|
||||
FLAGS "G"
|
||||
END
|
||||
|
||||
STRING A_CONTRATTO 18
|
||||
@ -377,15 +388,6 @@ BEGIN
|
||||
WARNING "Inserire il numero della fattura rettificata"
|
||||
END
|
||||
|
||||
LIST A_TIPOPE 1 41
|
||||
BEGIN
|
||||
PROMPT 1 9 "Tipologia operazione "
|
||||
ITEM "1|1-Cessione e/o prestazione"
|
||||
ITEM "2|2-Acquisto e/o prestazione ricevuta"
|
||||
FIELD TIPOPE
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
CURRENCY A_IMPORTO 12
|
||||
BEGIN
|
||||
PROMPT 1 10 "Importo dovuto "
|
||||
@ -413,11 +415,6 @@ BEGIN
|
||||
PICTURE TOOL_LINK
|
||||
END
|
||||
|
||||
BUTTON DLG_DELREC 2 2
|
||||
BEGIN
|
||||
PROMPT 3 1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_CANCEL 2 2
|
||||
BEGIN
|
||||
PROMPT 4 1 ""
|
||||
|
Loading…
x
Reference in New Issue
Block a user