Patch level : nopatch
Files correlati : Commento : Implementazione FP
This commit is contained in:
parent
e7d51d8c07
commit
8164f087e2
@ -33,6 +33,12 @@ bool run_fp_psw_mask();
|
||||
bool check_tables();
|
||||
// Compila il numero di documento per la scrittura sui paf
|
||||
TString& complete_num_fp(const TCodice_numerazione& codnum, const int numdoc);
|
||||
// Ritorna i nomi delle tabelle paa
|
||||
const char * get_pa_field_name(const TString & table, const char * name);
|
||||
// Ritorna i nomi delle tabelle paa
|
||||
TString_array & get_paa_names();
|
||||
// Ritorna i nomi delle tabelle paf
|
||||
TString_array & get_paf_names();
|
||||
|
||||
|
||||
// Genera la chiave per i paf
|
||||
@ -44,7 +50,10 @@ TString get_dest_sdi(char tipocf, long codcf, const TString& cod_ind_sped);
|
||||
// Valorizza codice sdi e pec in base alle configurazioni del monitor
|
||||
bool get_coddest(char tipocf, long codcf, TString& coddest, TString& pec, const TString& cod_ind_sped = EMPTY_STRING);
|
||||
const TString& tipo_doc_sdi(const TDocumento& doc);
|
||||
|
||||
// rimuove un movimento contabile dai paf
|
||||
void remove_paf_mov(const TRectype& mov, const char* tipo_doc_sdi);
|
||||
// rimuove un documento dai paf
|
||||
void remove_paf_doc(const TDocumento & doc, const char* tipo_doc_sdi);
|
||||
// Controlli comuni
|
||||
bool is_fattura(const TRectype& doc);
|
||||
// Si potrebbe standardizzare in TISAM_recordset
|
||||
|
@ -160,6 +160,62 @@ TString& complete_num_fp(const TCodice_numerazione& codnum, const int numdoc)
|
||||
return ret;
|
||||
}
|
||||
|
||||
// 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
||||
// P1 P2 P3 P4 P5 P6 P7 P8 P9 P0 PA PB PC PD PE PF PG PI PY PJ PK PL PM PN PO PP PQ PR PS PT PH PU PZ P7 r
|
||||
// Ritorna i nomi delle tabelle paa
|
||||
const char * get_pa_field_name(const TString & table, const char * name)
|
||||
{
|
||||
const char prefix[] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 'A', 'B', 'C', 'D', 'E',
|
||||
'F', 'G', 'I', 'Y', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
|
||||
'H', 'U', '\0', 'Z', '7' };
|
||||
const char suffix[] = { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
|
||||
'F', 'G', 'I', 'Y', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', '\0',
|
||||
'\0', '\0', '\0', '\0', 'r' };
|
||||
TString & fname = get_tmp_string();
|
||||
int pos = atoi(table.mid(3, 2));
|
||||
|
||||
fname << 'P' << prefix[pos] << name << suffix[pos];
|
||||
return fname;
|
||||
}
|
||||
|
||||
// Ritorna i nomi delle tabelle paa
|
||||
TString_array & get_paa_names()
|
||||
{
|
||||
static TString_array __paa_names;
|
||||
|
||||
if (__paa_names.items() == 0)
|
||||
{
|
||||
const char * names[] = { "PAF0100F", "PAA0200F", "PAA0400F", "PAA0700F", "PAA0800F", "PAA0900F", "PAA1000F", "PAA1100F",
|
||||
"PAA1200F", "PAA1300F", "PAA1400F", "PAA1500F", "PAA1600F", "PAA1700F", "PAA1800F", "PAA1900F",
|
||||
"PAA2000F", "PAA2100F", "PAA2200F", "PAA2400F", "PAA2500F", "PAA2600F", "PAA2700F", "PAA2800F",
|
||||
"PAA2900F", "PAA3000F", "PAA3100F", "PAA3200F", "PAA3400F", "PAAW300F", nullptr };
|
||||
int i = 0;
|
||||
|
||||
while (names[i] != nullptr)
|
||||
__paa_names.add(names[i++]);
|
||||
}
|
||||
return __paa_names;
|
||||
}
|
||||
|
||||
// Ritorna i nomi delle tabelle paf
|
||||
TString_array & get_paf_names()
|
||||
{
|
||||
static TString_array __paf_names;
|
||||
|
||||
if (__paf_names.items() == 0)
|
||||
{
|
||||
const char * names[] = { "PAF0100F", "PAF0200F", "PAF0400F", "PAF0700F", "PAF0800F", "PAF1000F", "PAF1100F", "PAF1200F",
|
||||
"PAF1400F", "PAF1600F", "PAF1700F", "PAF1800F", "PAF1900F", "PAF2000F", "PAF2100F", "PAF2200F",
|
||||
"PAF2400F", "PAF2500F", "PAF2600F", "PAF2700F", "PAF3000F", "PAF3200F", "PAF3400F", "PAF3400F",
|
||||
"PAFW300F", nullptr };
|
||||
int i = 0;
|
||||
|
||||
while (names[i] != nullptr)
|
||||
__paf_names.add(names[i++]);
|
||||
}
|
||||
return __paf_names;
|
||||
}
|
||||
|
||||
/*
|
||||
* HFATT: tipocf(1) + codcf(6)
|
||||
* BFATT: datadoc(8) + tipodoc_SDI(4) + numdoc(7)
|
||||
@ -275,6 +331,46 @@ const TString& tipo_doc_sdi(const TDocumento& doc)
|
||||
return doc.tipo().tipo_doc_sdi();
|
||||
}
|
||||
|
||||
// rimuove i record da un paf
|
||||
void remove_from_table(const TString & table, const char * hfatt, const char * bfatt)
|
||||
{
|
||||
TString query("DELETE FROM ");
|
||||
|
||||
query << table << " WHERE (" << get_pa_field_name(table, "KEYHEADERFATT") << "=" << hfatt << ") AND ("
|
||||
<< get_pa_field_name(table, "KEYBODYFATT") << "=" << bfatt;
|
||||
const bool ok = fp_db().sq_set_exec(query);
|
||||
if (!ok)
|
||||
{
|
||||
ofstream fout;
|
||||
fout.open("fperror_remove.txt");
|
||||
fout << query << "\n" << fp_db().sq_get_text_error(false) << "\n" << fp_db().sq_get_string_error(false);
|
||||
}
|
||||
}
|
||||
|
||||
// rimuove un movimento contabile dai paf
|
||||
void remove_paf_mov(const TRectype& mov, const char* tipo_doc_sdi)
|
||||
{
|
||||
TString hfatt;
|
||||
TString bfatt;
|
||||
TString_array & tables = get_paf_names();
|
||||
|
||||
chiave_paf_mov(mov, tipo_doc_sdi, hfatt, bfatt);
|
||||
FOR_EACH_ARRAY_ROW(tables, r, table)
|
||||
remove_from_table(*table, hfatt, bfatt);
|
||||
}
|
||||
|
||||
// rimuove un documento dai paf
|
||||
void remove_paf_doc(const TDocumento & doc, const char* tipo_doc_sdi)
|
||||
{
|
||||
TString hfatt;
|
||||
TString bfatt;
|
||||
TString_array & tables = get_paf_names();
|
||||
|
||||
chiave_paf_doc(doc, hfatt, bfatt);
|
||||
FOR_EACH_ARRAY_ROW(tables, r, table)
|
||||
remove_from_table(*table, hfatt, bfatt);
|
||||
}
|
||||
|
||||
bool is_fattura(const TRectype& doc)
|
||||
{
|
||||
const TTipo_documento& td = cached_tipodoc(doc.get(DOC_TIPODOC));
|
||||
|
Loading…
x
Reference in New Issue
Block a user