Patch level : 12.0 no-patch

Files correlati     : f90.exe f90200a.msk
Commento            :
- F9 ARCHIVIAZIONE SOSTITUTIVA:
- Aggiunta classe per gestione categorie documentali
- Corretto salvataggio tabella cat. doc.
- Inizio aggiunte tipologie per categorie diverse da quelle non elettroniche
This commit is contained in:
Simone Palacino 2020-04-08 14:28:26 +02:00
parent 64919101a4
commit e3fe3e0718
7 changed files with 154 additions and 25 deletions

View File

@ -1199,7 +1199,7 @@ bool TF9_app::segna_estratti(const bool escluso, const int numreg)
vector<movimento_t> escl;
if (escluso)
escl.insert(escl.begin(), movimento_t{ false, numreg });
escl.insert(escl.begin(), movimento_t{ false, numreg }); // todo: datareg?
vector<movimento_t>& movs_v = escluso ? escl : _movs;
TLocalisamfile mov(LF_MOV);
@ -1217,7 +1217,7 @@ bool TF9_app::segna_estratti(const bool escluso, const int numreg)
return ok;
}
void TF9_app::segna_in_errore() const
void TF9_app::segna_in_errore()
{
TString query;
query << "UPDATE " F9_DRD "\n"

View File

@ -112,7 +112,7 @@ public:
void add_sqlerror_msg_log(const char* query);
bool segna_estratti(bool escluso = false, int numreg = 0); /**< Segna su mov che il movimento e' stato estratto */
void segna_in_errore() const;
static void segna_in_errore();
static bool is_autofattura(const TLocalisamfile& mov);

View File

@ -95,9 +95,9 @@
#define DRT_CODSOC "F9TCSOC" // A(10) [K] - COD.SOCIETŔ
#define DRT_CATDOC "F9TCADO" // A(10) [K] - Categoria documento
#define DRT_DESCR "F9TDDES" // A(30) - Descrizione documento
#define DRT_CLASSO "F9TCLDC" // A(10) - classe documentale sostitutiva
#define DRT_CLASSO "F9TCLDC" // A(10) - { FTA | FTV } - classe documentale sostitutiva
#define DRT_CAUSSO "F9TCSOS" // A(6) - causale per sostitutiva(TD01…)
#define DRT_CAUSCON "F9TCCAU" // A(6) - causale contabile
#define DRT_TIPOCAU "F9TTCAU" // A(6) - tipo causale contabile
#define DRT_TIMOMOV "F9TTMOV" // A(6) - tipo movimento contabile
#define DRT_TIPOMOV "F9TTMOV" // A(6) - tipo movimento contabile
#define DRT_OPCEE "F9TFCEE" // A(6) - operatore CEE

View File

@ -7,6 +7,8 @@
#include "f901tab.h"
#include "f90100.h"
TString escape(const char* str);
///////////////////////////////////////////////////////////////
// TF9_categorie_doc_msk
///////////////////////////////////////////////////////////////
@ -128,7 +130,7 @@ void TF9_categorie_doc_msk::salva_tabella() const
TSheet_field& sf = sfield(S_CLASSDOC);
FOR_EACH_SHEET_ROW(sf, nr, row)
{
if(!((TString*)row)->empty())
if(row->get(1) && TString(row->get(1)).full())
ini_set_string(CONFIG_DITTA, "F9", "CATDOC", *row, idx++);
}
ini_set_string(CONFIG_DITTA, "F9", "CATDOC", "STOP", idx); // Riga terminatrice
@ -180,17 +182,17 @@ void TF9_categorie_doc::main_loop()
DRT_CAUSSO ", "
DRT_CAUSCON ", "
DRT_TIPOCAU ", "
DRT_TIMOMOV ", "
DRT_TIPOMOV ", "
DRT_OPCEE ")\nVALUES('" <<
ini_get_string(CONFIG_DITTA, PAR_MOD, AMBIENTE_F9) << "', '" <<
row->get(1) << "', '" <<
row->get(2) << "', '" <<
row->get(3) << "', '" <<
row->get(4) << "', '" <<
row->get(5) << "', '" <<
row->get(6) << "', '" <<
row->get(7) << "', '" <<
row->get(8) << "');\n";
row->get(1) << "', '" << // Catdoc
escape(row->get(2)) << "', '" << // Descr
row->get(3) << "', '" << // Classe doc sost.
row->get(4) << "', '" << // Causale sost.
escape(row->get(5)) << "', '" << // Causale cont
escape(row->get(6)) << "', '" << // Tipo caus. cont
escape(row->get(7)) << "', '" << // Tipo mov.
row->get(8) << "');\n"; // "Operat. CEE"
ok &= fp_db().sq_set_exec(query, false) && fp_db().sq_commit();
if (!ok)
break;
@ -208,6 +210,14 @@ void TF9_categorie_doc::main_loop()
}
}
TString escape(const char* str)
{
TString string; string << str;
for (int pos = string.find('\''); pos != -1; pos = string.find('\'', pos + 2))
string.insert("'", pos);
return string;
}
int f90200(const int argc, char* argv[])
{
TF9_categorie_doc app;

View File

@ -56,14 +56,14 @@ SPREADSHEET S_CLASSDOC -1 -1
BEGIN
PROMPT 0 0 "Classi Documentali"
ITEM " "
ITEM "Categoria\nDocumento (Codice)@18"
ITEM "Descrizione\nDocumento"
ITEM "Categoria\nDocumento (Codice)@15"
ITEM "Descrizione\nDocumento@26"
ITEM "Classe Documentale\nSostitutiva@18"
ITEM "Causale per\nSostitutiva (TD01...)@12"
ITEM "Causale\nContabile"
ITEM "Tipo Causale\nContabile"
ITEM "Tipo Movimento\nContabile"
ITEM "Operatore CEE"
ITEM "Causale\nContabile@8"
ITEM "Tipo Causale\nContabile@8"
ITEM "Tipo Movimento\nContabile@10"
ITEM "Classificazione\nCategoria@14"
END
ENDPAGE
@ -124,9 +124,12 @@ BEGIN
PROMPT 0 0 "Tipo Movimento Contabile"
END
STRING F_OPERCEE 6
LIST F_OPERCEE 2 14
BEGIN
PROMPT 0 0 "Operatore CEE"
ITEM "|"
ITEM "BD|Bolla Doganale"
ITEM "RC|Reverse Charge"
END
ENDPAGE

View File

@ -577,6 +577,82 @@ TF9_dberr::TF9_dberr()
_fout->open("f9_dberr.txt");
}
///////////////////////////////////////////////////////////////////////////////////////////
// TCategorie_doc
///////////////////////////////////////////////////////////////////////////////////////////
vector<TCategorie_doc::classe_doc>::iterator TCategorie_doc::find(const TString& class_sost, const TString& caus_sost,
const TString& op_cee)
{
vector<classe_doc>::iterator a = _rows.end();
for(auto it = _rows.begin(); it != _rows.end(); ++it)
{
classe_doc& cd = *it;
if(cd.class_sost == class_sost && cd.caus_sost == caus_sost && cd.opcee == op_cee)
{
a = it;
break;
}
}
return a;
}
void TCategorie_doc::load_all()
{
int idx = 0;
while (true)
{
const TString& appo = ini_get_string(CONFIG_DITTA, "F9", "CATDOC", "", idx++);
if (appo == "STOP" || appo.empty()) /* STOP: Riga terminatrice */
break;
TToken_string row(appo);
classe_doc cd = { row.get(1), row.get(), row.get(), row.get(), row.get(), row.get(), row.get(), row.get() };
_rows.emplace_back(cd);
}
}
TCategorie_doc::classe_doc* TCategorie_doc::causcont2cat(const char* caus)
{
const TCausale c(caus);
const TString& tipodoc = c.tipo_doc();
const tipo_movimento tipomov = c.tipomov();
const int reg_speciva = c.regime_speciale();
const bool op_intra = c.intra();
TString class_sost, caus_sost, op_cee;
if(tipodoc == "FA")
{
class_sost = "FTA";
}
else if(tipodoc == "FV")
{
class_sost = "FTV";
}
else if(tipodoc == "BD")
{
class_sost = "FTA";
op_cee = "BD";
}
if(tipomov == tm_fattura)
{
caus_sost = "TD01";
}
else if(tipomov == tm_nota_credito)
{
caus_sost = "TD04";
}
const vector<classe_doc>::iterator it = find(class_sost, caus_sost, op_cee);
classe_doc* cd = nullptr;
if (it != _rows.end())
cd = &*it; // todo: Test it!
return cd;
}
///////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////

View File

@ -1,5 +1,5 @@
#ifndef __F901001H__
#define __F901001H__
#ifndef __F901001_H__
#define __F901001_H__
#include "strings.h"
#include "date.h"
@ -199,4 +199,44 @@ public:
TF9_dberr();
};
#endif // #ifndef __F901001H__
class TCategorie_doc
{
public:
struct classe_doc
{
TString catdoc;
TString descr;
TString class_sost;
TString caus_sost;
TString causcont;
TString tipocaus;
TString tipomov;
TString opcee;
};
private:
vector<classe_doc> _rows;
vector<classe_doc>::iterator find(const TString& class_sost, const TString& caus_sost, const TString& op_cee);
void load_all();
public:
classe_doc* causcont2cat(const char* caus);
void reload()
{
_rows.clear();
load_all();
}
TCategorie_doc() { load_all(); }
};
inline TCategorie_doc& categorie_doc()
{
static unique_ptr<TCategorie_doc> cd = nullptr;
if(cd == nullptr)
cd = make_unique<TCategorie_doc>();
else
cd->reload();
return *cd;
}
#endif // #ifndef __F901001_H__