Patch level : 12.0 412
Files correlati : Commento : - Aggiunta eliminazione record non ancora caricati, adesso il programma rileva eventuali trasferimenti in sospeso e in tal caso elimina o abortisce. - Sistemata funzione search, adesso si può passare anche solo 1 chiave - Sistemata funzione loadConfig adesso non da più errori se aperto il programma in configurazioni test (SOLO TEST) - Tolte funzioni non utilizzate - Aggiunto controllo se tutte le funzioni di esportazione vanno a buon fine, se anche solo una fallisce il programma blocca tutto - Aggiunta funzione di svuotamento archivi git-svn-id: svn://10.65.10.50/branches/R_10_00@23892 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
248ea8b39b
commit
8ec6a0d808
@ -438,7 +438,8 @@ bool TTrFa_record::search(const char* k1, const char* k2, const char* k3)
|
||||
_fields.destroy();
|
||||
|
||||
set(_key.get(0), k1);
|
||||
set(_key.get(1), k2);
|
||||
if (k2 && *k2)
|
||||
set(_key.get(1), k2);
|
||||
if (k3 && *k3)
|
||||
set(_key.get(2), k3);
|
||||
|
||||
@ -918,7 +919,9 @@ void TTrFa_mask::loadConfig()
|
||||
// Potrei fare un for su TToken_string ma non darebbe la possibilità di flaggare tutto in caso di prima installazione
|
||||
for(int pos = 0; pos < tipidoc.items(); pos++)
|
||||
{
|
||||
set(getTipoDoc(tipidoc.get(pos)), "X");
|
||||
int field = getTipoDoc(tipidoc.get(pos));
|
||||
if(field != -1)
|
||||
set(field, "X");
|
||||
}
|
||||
}
|
||||
void TTrFa_mask::saveConfig()
|
||||
@ -1252,36 +1255,6 @@ bool TTrFa_app::show_log()
|
||||
return ok;
|
||||
}
|
||||
|
||||
void TTrFa_app::set_IVA(const TString& codiva, TTrFa_record& tff) const
|
||||
{/*
|
||||
const TRectype& ai = cache().get("%IVA", codiva);
|
||||
const real aliquota = ai.get("R0");
|
||||
tff.set("PI_ALIQUOTAIVA", aliquota);
|
||||
if (codiva.full())
|
||||
{
|
||||
if (aliquota.is_zero())
|
||||
tff.set("PI_NATURA", natura(codiva));
|
||||
else
|
||||
tff.set("PI_NATURA", "");
|
||||
}*/
|
||||
}
|
||||
|
||||
void TTrFa_app::set_IVA(const TRiga_documento& rdoc, TTrFa_record& tff) const
|
||||
{/*
|
||||
const TString8 codiva(rdoc.get(RDOC_CODIVA));
|
||||
const TRectype& ai = cache().get("%IVA", codiva);
|
||||
const real aliquota = ai.get("R0");
|
||||
tff.set("PI_ALIQUOTAIVA", aliquota);
|
||||
if (codiva.full())
|
||||
{
|
||||
if (aliquota.is_zero())
|
||||
tff.set("PI_NATURA", natura(codiva));
|
||||
else
|
||||
tff.set("PI_NATURA", "");
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
int TTrFa_app::parse_line(const TString& line, TString& var, TString& val) const
|
||||
{
|
||||
if (line.blank())
|
||||
@ -1461,27 +1434,28 @@ bool TTrFa_app::send(TTrFa_mask* msk)
|
||||
// Mi carico i miei dati
|
||||
TSheet_field& sheet = msk->sfield(F_RIGHE);
|
||||
// Booleano per appendere i record nel db
|
||||
_append = false;
|
||||
// Controllo che non ci sia già una esportazione in attesa
|
||||
|
||||
|
||||
|
||||
/***********************************************************************************************
|
||||
* Esporto
|
||||
***********************************************************************************************/
|
||||
xvt_sql_begin(_db);
|
||||
bool ok;
|
||||
// Testata
|
||||
if(!_append)
|
||||
tff0100(sheet); // Se devo appendere vuol dire che c'è già!
|
||||
// Anagrafica
|
||||
tff0400(sheet);
|
||||
// Documenti
|
||||
tff0700(sheet);
|
||||
ok = tff0100(sheet);
|
||||
if(ok)
|
||||
{
|
||||
// Anagrafica
|
||||
ok = tff0400(sheet);
|
||||
if(ok)
|
||||
// Documenti
|
||||
ok = tff0700(sheet);
|
||||
}
|
||||
|
||||
if(false)
|
||||
if(!ok)
|
||||
{
|
||||
log(-1, "WTF!?");
|
||||
xvt_sql_rollback(_db);
|
||||
//return false;
|
||||
return false;
|
||||
}
|
||||
if(xvt_sql_commit(_db))
|
||||
{
|
||||
@ -1490,7 +1464,7 @@ bool TTrFa_app::send(TTrFa_mask* msk)
|
||||
//setEsportato(sheet);
|
||||
}
|
||||
else
|
||||
message_box("Il commit non è andato a buon fine");
|
||||
message_box("Errore durante il salvataggio delle modifiche");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1579,6 +1553,27 @@ bool TTrFa_app::tff0100(TSheet_field& sheet)
|
||||
if(cli)
|
||||
{
|
||||
TTrFa_record dte("TFF0100F");
|
||||
|
||||
// Controllo la presenza di un caricamento in attesa
|
||||
if(dte.search(DTE_PROVV))
|
||||
{
|
||||
bool sent = dte.get("P1_KEYPRGINVIO").as_string() == DTE_PROVV;
|
||||
if(sent)
|
||||
{
|
||||
TString msg = "É presente un'altra esportazione non ancora elaborata vuoi eliminarla?";
|
||||
if(yesno_box(msg))
|
||||
{
|
||||
if(!emptyTables(DTE_PROVV))
|
||||
{
|
||||
error_box("Fallita eliminazione record!!!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
dte.set("P1_KEYPRGINVIO", DTE_PROVV);
|
||||
dte.set("P1_TRASMITTPAESE", paese);
|
||||
dte.set("P1_TRASMITTCOD", _cofi);
|
||||
@ -1594,6 +1589,27 @@ bool TTrFa_app::tff0100(TSheet_field& sheet)
|
||||
if(fo)
|
||||
{
|
||||
TTrFa_record dtr("TFF0100F");
|
||||
|
||||
// Controllo la presenza di un caricamento in attesa
|
||||
if(dtr.search(DTR_PROVV))
|
||||
{
|
||||
bool sent = dtr.get("P1_KEYPRGINVIO").as_string() == DTR_PROVV;
|
||||
TString msg = "É presente un'altra esportazione non ancora elaborata vuoi eliminarla?";
|
||||
if(sent)
|
||||
{
|
||||
if(yesno_box(msg))
|
||||
{
|
||||
if(!emptyTables(DTE_PROVV))
|
||||
{
|
||||
error_box("Fallita eliminazione record!!!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
dtr.set("P1_KEYPRGINVIO", DTR_PROVV);
|
||||
dtr.set("P1_TRASMITTPAESE", paese);
|
||||
dtr.set("P1_TRASMITTCOD", _cofi);
|
||||
@ -1930,6 +1946,19 @@ bool TTrFa_app::setEsportato(TSheet_field& sheet)
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TTrFa_app::emptyTables(TString key)
|
||||
{
|
||||
TString query;
|
||||
query << "DELETE FROM TFF0100F WHERE P1_KEYPRGINVIO = '" << key << "';\n";
|
||||
query << "DELETE FROM TFF0200F WHERE P2_KEYPRGINVIO = '" << key << "';\n";
|
||||
query << "DELETE FROM TFF0300F WHERE P3_KEYPRGINVIO = '" << key << "';\n";
|
||||
query << "DELETE FROM TFF0400F WHERE P4_KEYPRGINVIO = '" << key << "';\n";
|
||||
query << "DELETE FROM TFF0700F WHERE P7_KEYPRGINVIO = '" << key << "';\n";
|
||||
query << "DELETE FROM TFF2200F WHERE PL_KEYPRGINVIO = '" << key << "';\n";
|
||||
query << "DELETE FROM TFF3100F WHERE PH_KEYPRGINVIO = '" << key << "';\n";
|
||||
return xvt_sql_execute(_db, query, NULL, NULL) >= 0;
|
||||
}
|
||||
|
||||
void TTrFa_app::main_loop()
|
||||
{
|
||||
TTrFa_mask msk("tf0100a");
|
||||
|
@ -128,7 +128,7 @@ public:
|
||||
bool insert();
|
||||
bool remove();
|
||||
bool search();
|
||||
bool search(const char* k1, const char* k2, const char* k3 = NULL);
|
||||
bool search(const char* k1, const char* k2 = NULL, const char* k3 = NULL);
|
||||
|
||||
virtual TObject* dup() const { return new TTrFa_record(*this); }
|
||||
virtual bool ok() const { return _table.not_empty(); }
|
||||
@ -249,17 +249,11 @@ private:
|
||||
bool tff2200(TToken_string* strarr, int nriga); // Riepilogo aliquote
|
||||
bool tff3100(TToken_string* strarr, TRectype r_ana); // Rappresentante fiscale clifo
|
||||
bool setEsportato(TSheet_field& sheet);
|
||||
//const TRectype* find_parent_row(const TRectype& rdoc) const;
|
||||
//int find_ancestors(const TRiga_documento& rdoc, TArray& ancestors) const;
|
||||
bool emptyTables(TString key); // Cancella da tutte le tabelle i record con chiave key
|
||||
|
||||
protected:
|
||||
//const char* descrizione(const TRiga_documento& rdoc) const;
|
||||
//const TRectype& cco(const TRectype& doc) const; // Contratto/Convenzione/Offerta
|
||||
|
||||
void log(int severity, const char* msg);
|
||||
bool show_log();
|
||||
void set_IVA(const TString& codiva, TTrFa_record& TFF) const;
|
||||
void set_IVA(const TRiga_documento& rdoc, TTrFa_record& TFF) const;
|
||||
bool syncronizeDB();
|
||||
bool createDB();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user