Patch level : 12.0 no-patch

Files correlati     : f90.exe f90300a.msk build
Commento            :
- F9 ARCHIVIAZIONE SOSTITUTIVA:
- Aggiunto programma gestione file documenti cartacei da importare
- Corrette query con codsoc
- Corretta diagnostica sia per acquisti e soprattutto per vendite
- Corretta esportazione lista mov in errore
- Aggiunta a esportazione IVA categorie documentali vere e proprie
This commit is contained in:
Simone Palacino 2020-04-21 18:53:15 +02:00
parent 96161ea90b
commit 9387543414
12 changed files with 371 additions and 91 deletions

View File

@ -189,6 +189,7 @@
<ItemGroup>
<ClCompile Include="..\src\f9\f90.cpp" />
<ClCompile Include="..\src\f9\f90100.cpp" />
<ClCompile Include="..\src\f9\f90300.cpp" />
<ClCompile Include="..\src\f9\f9lib01.cpp" />
<ClCompile Include="..\src\f9\f90200.cpp" />
</ItemGroup>
@ -199,6 +200,7 @@
<ClInclude Include="..\src\f9\f90100b.h" />
<ClInclude Include="..\src\f9\f90100c.h" />
<ClInclude Include="..\src\f9\f90100d.h" />
<ClInclude Include="..\src\f9\f90300a.h" />
<ClInclude Include="..\src\f9\f9lib01.h" />
<ClInclude Include="..\src\f9\f901tab.h" />
<ClInclude Include="..\src\f9\f90200a.h" />
@ -209,6 +211,7 @@
<MskCompiler Include="..\src\f9\f90100c.uml" />
<MskCompiler Include="..\src\f9\f90100d.uml" />
<MskCompiler Include="..\src\f9\f90200a.uml" />
<MskCompiler Include="..\src\f9\f90300a.uml" />
</ItemGroup>
<ItemGroup>
<SqlCompiler Include="..\src\f9\sql\f90100.sql">

View File

@ -51,6 +51,9 @@
<ClInclude Include="..\src\f9\f9lib01.h">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="..\src\f9\f90300a.h">
<Filter>Headers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\f9\f90.cpp">
@ -65,6 +68,9 @@
<ClCompile Include="..\src\f9\f9lib01.cpp">
<Filter>Sources</Filter>
</ClCompile>
<ClCompile Include="..\src\f9\f90300.cpp">
<Filter>Sources</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<MskCompiler Include="..\src\f9\f90100a.uml">
@ -82,6 +88,9 @@
<MskCompiler Include="..\src\f9\f90200a.uml">
<Filter>Masks</Filter>
</MskCompiler>
<MskCompiler Include="..\src\f9\f90300a.uml">
<Filter>Masks</Filter>
</MskCompiler>
</ItemGroup>
<ItemGroup>
<SqlCompiler Include="..\src\f9\sql\f90100.sql">

View File

@ -11,6 +11,7 @@ int main(int argc, char** argv)
default:
case 0: rt = f90100(argc, argv); break; // Programma estrazione pacchetti
case 1: rt = f90200(argc, argv); break; // Tabella categorie documentali
case 2: rt = f90300(argc, argv); break; // Gestione documenti cartacei
}
return rt;
}

View File

@ -3,5 +3,6 @@
int f90100(int argc, char* argv[]);
int f90200(int argc, char* argv[]);
int f90300(int argc, char* argv[]);
#endif // __F90_H

View File

@ -22,12 +22,19 @@
#define TAB_BASE_VERSION 100 // Versione base delle tabelle
#define SQL_VERSION 104 // Utilizzo questo per controllare la versione attuale delle tabelle e nel caso aggiornarle
/* MD5 Check Sums dei file aggiornamento tabelle todo: possibile aggiunta: controllo del cheksum dei file (anche per FP)
* Aggiungo scritta in testa cosi da poter trovare la stringa anche da programma compilato e cambiare a mano il checksum se mi servisse. Attenzione! */
#define CHECKSUMSQL0100 "SUMFILE0100eed185fa8f122010f426d99a23f26c88"
#define CHECKSUMSQL0102 "SUMFILE010235333a5e3b49ed31980851243f83b94d"
#define CHECKSUMSQL0104 "SUMFILE01040affe32741cd741814ce2cab2d992f6b"
/* MD5 Check Sums dei file aggiornamento tabelle todo: possibile aggiunta: controllo del cheksum dei file (anche per FP) */
const TString v_check_sums[] = {
"SUMFILE0100e e d 1 8 5 f a 8 f 1 2 2 0 1 0 f 4 2 6 d 9 9 a 2 3 f 2 6 c 8 8",
"SUMFILE01023 5 3 3 3 a 5 e 3 b 4 9 e d 3 1 9 8 0 8 5 1 2 4 3 f 8 3 b 9 4 d",
"SUMFILE01040 a f f e 3 2 7 4 1 c d 7 4 1 8 1 4 c e 2 c a b 2 d 9 9 2 f 6 b" };
TString get_checksum(const int version)
{
TString cs = v_check_sums[(version - 100) / 2];
cs.ltrim(11);
cs.replace(" ", "");
return cs;
}
////////////////////////////////////////////////////////
// Utilities
@ -574,7 +581,8 @@ void TControllo_mask::conferma_esclusi() const
movs.rewrite();
row->add("Si", cid2index(F_CESCLUSO));
TString query;
query << "UPDATE " F9_ERR " SET ESCLUSO = 'Si' WHERE IDESTR = '" << _id_estr << "' AND NUMREG = '" << row->get(cid2index(F_CNUMREG)) << "';";
query << "UPDATE " F9_ERR " SET ESCLUSO = 'Si' WHERE " ERR_CODSOC " = '" << _cod_soc << "' AND IDESTR = '" <<
_id_estr << "' AND NUMREG = '" << row->get(cid2index(F_CNUMREG)) << "';";
fp_db().sq_set_exec(query);
}
else
@ -585,7 +593,8 @@ void TControllo_mask::conferma_esclusi() const
row->add("", cid2index(F_CESCLUSO));
movs.rewrite();
TString query;
query << "UPDATE " F9_ERR " SET ESCLUSO = NULL WHERE IDESTR = '" << _id_estr << "' AND NUMREG = '" << row->get(cid2index(F_CNUMREG)) << "';";
query << "UPDATE " F9_ERR " SET ESCLUSO = NULL WHERE " ERR_CODSOC " = '" << _cod_soc << "' AND IDESTR = '" <<
_id_estr << "' AND NUMREG = '" << row->get(cid2index(F_CNUMREG)) << "';";
fp_db().sq_set_exec(query);
}
}
@ -965,9 +974,8 @@ void TF9_app::open_esclusi()
_flagprov_escl = ym_msk->get(504)[0];
_tipodoc_escl = ym_msk->get(505)[0];
// Caricamento esclusi
/* LOADING DI QUEL MESE E ANNO
*/
/* Caricamento esclusi
* LOADING DI QUEL MESE E ANNO */
f9_app()._esclusi_vect.clear();
const int anno = ym_msk->get_int(501);
const int mese = ym_msk->get_int(502);
@ -1019,9 +1027,7 @@ void TF9_app::open_esclusi()
// Esclusi mask ////////////////////////////////
fill_esclusi();
while (esclusi_mask().run() == K_ENTER)
{
}
{ }
}
void TF9_app::fill_esclusi()
@ -1411,7 +1417,7 @@ TF9_app& f9_app()
return *app;
}
int f90100(int argc, char* argv[])
int f90100(const int argc, char* argv[])
{
TF9_app app;
app.run(argc, argv, TR("Archiviazione Sostitutiva"));

View File

@ -11,7 +11,7 @@
* Parametro su f9pwa + ambiente + idlancio(ID drd) + categoria_documento(drt) + nome_documento
*
* esempio:
* (/softwaresirio/siaggf9) + '/001' + '/idlancio001' + '/Fatture'/ + nomedoc.pdf
* 'C:/Campo/DATIE/doc_archiviazione' + '/CORTEL' + '/20200421PN00000013' + '/FATTACQ'/ + mov5423.pdf
*/
#define WA_CODSOC "F9PCSOC" // A(10) [K] - Codice societa'
@ -127,6 +127,7 @@
#define ERR_DATADOC "DATADOC"
#define ERR_CODCAUS "CODCAUS"
#define ERR_MESELIQ "MESELIQ"
#define ERR_NUMDOC "NUMDOC"
#define ERR_IMPTDOC "IMPTOTDOC"
#define ERR_FORN "FORN"
#define ERR_RAGSOC "RAGSOC"

54
src/f9/f90300.cpp Normal file
View File

@ -0,0 +1,54 @@
#include "f90.h"
#include "applicat.h"
#include "automask.h"
///////////////////////////////////////////////////////////////////////////////
// TGestione_doc_cartacei_f9_msk
///////////////////////////////////////////////////////////////////////////////
class TGestione_doc_cartacei_f9_msk : public TAutomask
{
bool on_field_event(TOperable_field& o, TField_event e, long jolly) override;
public:
TGestione_doc_cartacei_f9_msk() : TAutomask("f90300a") { }
};
bool TGestione_doc_cartacei_f9_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
if(e == se_query_add || e == se_query_del || e == se_query_modify)
return false;
switch(o.dlg())
{
default:
break;
}
return true;
}
///////////////////////////////////////////////////////////////////////////////
// TGestione_doc_cartacei_f9_app
///////////////////////////////////////////////////////////////////////////////
class TGestione_doc_cartacei_f9_app : public TSkeleton_application
{
void main_loop() override;
public:
TGestione_doc_cartacei_f9_app() = default;
};
void TGestione_doc_cartacei_f9_app::main_loop()
{
TGestione_doc_cartacei_f9_msk msk;
while(msk.run() == K_ENTER)
{ }
}
int f90300(const int argc, char* argv[])
{
TGestione_doc_cartacei_f9_app app;
app.run(argc, argv, "Gestione documenti cartacei");
return 0;
}

16
src/f9/f90300a.h Normal file
View File

@ -0,0 +1,16 @@
#define B_IMPORT 201
#define B_DELETE 202
#define S_IMPORTED 301
// Campi Sheet S_IMPORTED
#define F_SEL 101
#define F_FILENAME 102
#define F_DATACARIC 103
#define F_NUMREG 104
#define F_DATAMOV 105
#define F_CAUS 106
#define F_NUMDOC 107
#define F_NPROTOCOL 108
#define F_DESCRMOV 109

122
src/f9/f90300a.uml Normal file
View File

@ -0,0 +1,122 @@
#include "f90300a.h"
TOOLBAR "topbar" 0 0 0 2
BUTTON B_IMPORT 2 2
BEGIN
PROMPT 1 1 "Impo~rta"
PICTURE TOOL_SAVEREC
END
BUTTON B_DELETE 2 2
BEGIN
PROMPT 1 1 "Eli~mina"
PICTURE TOOL_DELREC
END
BUTTON DLG_NULL 2 2
BEGIN
PROMPT -1 1 ""
PICTURE 0
END
BUTTON DLG_INFO 2 2
BEGIN
PROMPT 1 1 "Info"
MESSAGE EXIT,K_F2
PICTURE TOOL_INFO
END
BUTTON DLG_HELP 2 2
BEGIN
PROMPT 2 1 "Help"
MESSAGE EXIT,K_F1
PICTURE TOOL_HELP
FLAG "H"
END
BUTTON DLG_NULL 2 2
BEGIN
PROMPT -1 0 ""
PICTURE 0
END
BUTTON DLG_CANCEL 2 2
BEGIN
PROMPT 3 1 "Annulla"
MESSAGE EXIT,K_ESC
PICTURE TOOL_CANCEL
END
ENDPAGE
PAGE "Lista File Importati" 0 2 0 0
SPREADSHEET S_IMPORTED -1 -1
BEGIN
PROMPT 0 0 "Doc Importati"
ITEM ""
ITEM "FILENAME"
ITEM "DATACARIC"
ITEM "NUMREG"
ITEM "DATAMOV"
ITEM "CAUS"
ITEM "NUMDOC"
ITEM "NPROTOCOL"
ITEM "DESCRMOV"
END
ENDPAGE
ENDMASK
PAGE "SHEET_IMPORTATI" -1 -1 78 13
BOOLEAN F_SEL
BEGIN
PROMPT 0 0 "Selezionato"
END
STRING F_FILENAME 256
BEGIN
PROMPT 0 1 "Nome del file"
END
DATE F_DATACARIC
BEGIN
PROMPT 0 2 "Data Caricamento File"
END
NUMBER F_NUMREG 7
BEGIN
PROMPT 0 3 "Numero registrazione"
END
DATE F_DATAMOV
BEGIN
PROMPT 0 4 "Data movimento"
END
STRING F_CAUS 3
BEGIN
PROMPT 0 5 "Codice causale"
END
STRING F_NUMDOC 18
BEGIN
PROMPT 0 6 "Numero documento"
END
NUMBER F_NPROTOCOL 6
BEGIN
PROMPT 0 7 "Numero Protocollo IVA"
END
STRING F_DESCRMOV 50
BEGIN
PROMPT 0 8 "Descrizione mov."
END
ENDPAGE
ENDMASK

View File

@ -132,8 +132,8 @@ bool TEstrazione::insert_into_f9movestr() const
bool ok = true;
for(auto it = _movs.begin(); it != _movs.end(); ++it)
{
query.cut(0) << "INSERT INTO " F9_MOVESTR " (IDESTR, NUMREG, DATAREG, ESTRATTO, DESCR_ERR)\nVALUES " <<
" ('" << _head.id_estr << "', '" << it->numreg << "', '" << it->datareg.date2ansi() << "', " <<
query.cut(0) << "INSERT INTO " F9_MOVESTR " (" MOV_CODSOC ", IDESTR, NUMREG, DATAREG, ESTRATTO, DESCR_ERR)\nVALUES " <<
" ('" << _head.cod_soc << "', '" << _head.id_estr << "', '" << it->numreg << "', '" << it->datareg.date2ansi() << "', " <<
(it->estratto ? "1" : "0") << ", '" << check_str(it->get_descr_estr()) << "')";
#ifdef DBG
if (TString(check_str(it->get_descr_estr())).empty())
@ -294,16 +294,18 @@ const char* TEstrazione::diagnostica_mov()
case guessed:
ok &= fppro_db().associa_mov(numreg);
case correct:
/*ok &= true;
ok &= true;
mov_i.err = false;
mov_i.state = res;
break;*/
break;
// ERRORS
// Errore non bloccante
case not_fa:
ok &= true;
mov_i.err = false;
mov_i.estratto = false;
mov_i.descr_estr = movimento_t::no_fa;
mov_i.state = res;
break;
@ -346,12 +348,6 @@ const char* TEstrazione::diagnostica_mov()
{
// Controlli per le fatture di vendita
// Vendite senza controlli.
// C'e' chi se le importa da altri gestionali!!! Sad :(
// Li mortacci loro!
// Bisogna pensare i casi in cui le fatture sono da escludere e non le posso escludere
// Ripensare esclusione vendite
TProgress_monitor bar(_movs.size(), "Controllo stato movimenti di vendita");
for (auto it = _movs.begin(); it != _movs.end(); ++it)
{
@ -364,50 +360,108 @@ const char* TEstrazione::diagnostica_mov()
mov.put(MOV_NUMREG, numreg);
mov.read();
/* Categorie documentali. Come per gli acquisti. */
/* Qui la situazione e' bruttina.
* Se non hai il flag di documenti esterni, sono in grado di capire se il movimento corrisponde a un documento elettronico
* che effettivamente e' stato inviato.
* - Quindi prima di tutto se non ho il flag attivo, controllo che esista il documento "generatore". Altrimenti lo escludo.
* - Guardo se ha il flag di invio xml e controllo sui PAF, altrimento la considero come cartacea.
*/
if (!mov_i.err && mov_i.estratto)
{
bool cartacea = false;
if (!_has_vendext)
{
if (!mov.get(MOV_DPROVV).empty() && !mov.get(MOV_DANNO).empty() && !mov.get(MOV_DCODNUM).empty() && !mov.get(MOV_DNDOC).empty())
{
if (!is_doc_xml(mov))
cartacea = true;
// Nel caso in cui non ha l'invio xml e non trovo la categoria vendite cartacea escludo come nella versione precedente,
// non trovo la fattura elettronica.
std::shared_ptr<TCategorie_doc::classe_doc> cd = categorie_doc().causcont2cat(mov_i.codcaus, cartacea);
mov_i.estratto = cd.get();
mov_i.descr_estr = cd ? movimento_t::no_err : movimento_t::no_catdoc;
mov_i.catdoc = cd;
if(!cd->catdoc)
{
mov_i.err = true;
mov_i.descr_err = "Movimento collegato a un documento senza fatturazione elettronica. Escludere? O aggiungere cat. doc.";
mov_i.descr_estr = movimento_t::notfound_elet;
}
else
mov_i.err = false;
}
else
{
// Escludo
mov_i.err = true;
mov_i.estratto = false;
mov_i.descr_estr = movimento_t::no_doc;
mov_i.descr_err = "Movimento non collegato a un documento originale. Impossibile estrarre. Escludere?";
}
}
else
{
// Ricerca cat. doc. senza controllare documento originale e quindi perdendo anche la possbilita' di distinguere se
// semplicemente una vendita cartacea.
std::shared_ptr<TCategorie_doc::classe_doc> cd = categorie_doc().causcont2cat(mov_i.codcaus);
mov_i.estratto = cd.get();
mov_i.descr_estr = cd ? movimento_t::no_err : movimento_t::no_catdoc;
mov_i.catdoc = cd;
}
if (mov_i.catdoc && !mov_i.catdoc->is_cartaceo())
{
// Che controlli devo fare per essere sicuro di tirare fuori mov di vendita che siano corretti (sicuramente da estrarre)?
// Dovrei essere sicuro che sia un documento che abbia bisogno della fatturazione e che sia stato spedito.
// Nel caso in cui la fatturazione/invio/contabilita' venga fatta in Campo/WebApp posso capire se e' una fattura elettronica,
// nel caso in cui le fatture vengono fatte da un altro gestionale e importate nella webapp dopo, non ho modo di capire dal mov
// se deriva da un vero documento di fatturazione elettronica.
// E se il movimento fosse per qualche motivo esente dalla fatturazione elettronica? Nel caso in cui venga fatto in campo avrei
// il documento generatore e, o da questo vedo che il numeratore non ha il flag di fattura xml (salto),
// o non lo trovo sui paf (devi escludere), ma nell'altro caso non so dir nulla, ma a questo punto io lo estrarrei normalmente, e
// poi la WebApp mi darebbe errore, ma io non sono in grado di escludere la fattura al prossimo tentativo.
// Possibili soluzioni:
// - Fare in modo di escludere anche movimenti che apparentemente sono passati per buoni;
// - In corso di estrazione mostrare la lista dei movimenti che sarebbero estratti e casellare quelli da escludere.
ok &= !mov_i.err;
}
//else Salto il mov
// Controllo che abbia il riferimento al documento originale generatore del movimento solo se non ha flag di vendite esterne
if (!_has_vendext)
{
if (mov.get(MOV_DPROVV).empty() || mov.get(MOV_DANNO).empty() || mov.get(MOV_DCODNUM).empty() || mov.get(MOV_DNDOC).empty())
{
mov_i.err = true;
mov_i.estratto = false;
mov_i.descr_estr = movimento_t::no_doc;
mov_i.descr_err = "Movimento non collegato a un documento originale. Impossibile estrarre. Escludere?";
ok &= mov_i.estratto;
}
else if (!is_doc_xml(mov)) // Quindi controllo che sia un documento xml, se no lo metto in errore e te lo escludi a mano, se e' da escludere
{
mov_i.err = true;
mov_i.descr_err = "Movimento collegato a un documento senza fatturazione elettronica. Escludere?";
mov_i.estratto = false;
mov_i.descr_estr = movimento_t::notfound_elet;
ok &= mov_i.estratto;
}
}
}
///* Categorie documentali. Come per gli acquisti. */
//if (!mov_i.err && mov_i.estratto)
//{
// std::shared_ptr<TCategorie_doc::classe_doc> cd = categorie_doc().causcont2cat(mov_i.codcaus);
// mov_i.estratto = cd.get();
// mov_i.descr_estr = cd ? movimento_t::no_err : movimento_t::no_catdoc;
// mov_i.catdoc = cd;
//}
//if (mov_i.catdoc && !mov_i.catdoc->is_cartaceo())
//{
// // Che controlli devo fare per essere sicuro di tirare fuori mov di vendita che siano corretti (sicuramente da estrarre)?
// // Dovrei essere sicuro che sia un documento che abbia bisogno della fatturazione e che sia stato spedito.
// // Nel caso in cui la fatturazione/invio/contabilita' venga fatta in Campo/WebApp posso capire se e' una fattura elettronica,
// // nel caso in cui le fatture vengono fatte da un altro gestionale e importate nella webapp dopo, non ho modo di capire dal mov
// // se deriva da un vero documento di fatturazione elettronica.
// // E se il movimento fosse per qualche motivo esente dalla fatturazione elettronica? Nel caso in cui venga fatto in campo avrei
// // il documento generatore e, o da questo vedo che il numeratore non ha il flag di fattura xml (salto),
// // o non lo trovo sui paf (devi escludere), ma nell'altro caso non so dir nulla, ma a questo punto io lo estrarrei normalmente, e
// // poi la WebApp mi darebbe errore, ma io non sono in grado di escludere la fattura al prossimo tentativo.
// // Possibili soluzioni:
// // - Fare in modo di escludere anche movimenti che apparentemente sono passati per buoni;
// // - In corso di estrazione mostrare la lista dei movimenti che sarebbero estratti e casellare quelli da escludere.
//
// // Controllo che abbia il riferimento al documento originale generatore del movimento solo se non ha flag di vendite esterne
// if (!_has_vendext)
// {
// if (mov.get(MOV_DPROVV).empty() || mov.get(MOV_DANNO).empty() || mov.get(MOV_DCODNUM).empty() || mov.get(MOV_DNDOC).empty())
// {
// mov_i.err = true;
// mov_i.estratto = false;
// mov_i.descr_estr = movimento_t::no_doc;
// mov_i.descr_err = "Movimento non collegato a un documento originale. Impossibile estrarre. Escludere?";
// ok &= mov_i.estratto;
// }
// else if (!is_doc_xml(mov)) // Quindi controllo che sia un documento xml, se no lo metto in errore e te lo escludi a mano, se e' da escludere
// {
// mov_i.err = true;
// mov_i.descr_err = "Movimento collegato a un documento senza fatturazione elettronica. Escludere?";
// mov_i.estratto = false;
// mov_i.descr_estr = movimento_t::notfound_elet;
// ok &= mov_i.estratto;
// }
// }
//}
}
}
_head.stato_estr = ok ? D_GEST_OK : D_GEST_ERR;
@ -533,7 +587,8 @@ bool TEstrazione::estrazione_iva(bool escluso)
IVA_FORNOR ", " IVA_REGOR ", " IVA_NUMOR ", " IVA_DATAOR;
}*/
query << ",\n"
IVA_CLASDOC ", " IVA_USERELA ", " IVA_TIMEELA;
IVA_CLASDOC ", " IVA_USERELA ", " IVA_TIMEELA ", " IVA_NOMF1;
if (_head.tipo_doc == 'A')
{
query << ",\n"
@ -543,13 +598,19 @@ bool TEstrazione::estrazione_iva(bool escluso)
const long datareg = mov.get_date(MOV_DATAREG).date2ansi();
const TString& name_reg = TRegistro(TCausale(mov.get(MOV_CODCAUS)).reg()).name();
const TString classdoc = it->catdoc->class_sost;
const TString nomefile = it->catdoc->is_cartaceo() ? "nomefile.pdf" : ""; // todo:
// todo usare per categorie documentali caus_sos(mov, get_tipoiva());
query << "\n)\n" <<
"VALUES (\n" <<
"'" << _head.cod_soc << "', '" << _head.id_estr << "', '" << (_head.flag_prov ? "P" : "D") << "',\n" <<
"'" << mov.get(MOV_ANNOES) << "', '" << _head.tipo_doc << "', '" << name_reg << "',\n" <<
"'" << 'S' << "', '" << mov.get(MOV_TIPO) << "', '" << mov.get(MOV_CODCF) << "',\n" <<
"'" << check_str(cli.get(CLI_RAGSOC)) << "', '" << idfisc << "', '" << cli.get(CLI_PAIV) << "',\n" <<
"'" << cli.get(CLI_COFI) << "', '" << categoria_doc() << "', '" << caus_sos(mov, get_tipoiva()) << "',\n" <<
"'" << cli.get(CLI_COFI) << "', '" << it->catdoc->catdoc << "', '" << it->catdoc->caus_sost << "',\n" <<
"'" << numdoc << "', '" << datadoc << "', '" << mov.get(MOV_REG) << "',\n" <<
"'" << "" << "', '" << mov.get(MOV_PROTIVA) << "', '" << datareg << "'";
//if (is_autofattura(mov))
@ -558,7 +619,10 @@ bool TEstrazione::estrazione_iva(bool escluso)
// "'" << "" << "', '" << "" << "', '" << "N ORI" << "', '" << "20010101" << "'";
//}
query << ",\n" <<
"'" << (_head.tipo_doc == 'A' ? "FTA" : "FTV") << "', '" << user() << "', " << "GETDATE()";
"'" << classdoc << "', '" << user() << "', " << "GETDATE()" << ", '" << nomefile << "'";
// If cartaceo mettere nome file
if (_head.tipo_doc == 'A')
{
TToken_string keys(mov.get(MOV_KEYFPPRO), ';');
@ -579,8 +643,8 @@ bool TEstrazione::estrazione_iva(bool escluso)
bool TEstrazione::exist_prov() const
{
TString query; query << "SELECT * FROM " F9_DRD "\n" <<
"WHERE " DRD_DATADA " = '" << _head.dal.date2ansi() << "' AND " DRD_DATAA " = '" << _head.al.date2ansi() << "'"
"AND " DRD_FLAG_PD " = 'P' AND " DRD_TIPODOC " = '" << _head.tipo_doc << "'";
"WHERE " DRD_CODSOC " = '" << _head.cod_soc << "' AND " DRD_DATADA " = '" << _head.dal.date2ansi() << "'"
" AND " DRD_DATAA " = '" << _head.al.date2ansi() << "' AND " DRD_FLAG_PD " = 'P' AND " DRD_TIPODOC " = '" << _head.tipo_doc << "'";
const bool ok = fp_db().sq_set_exec(query);
return ok && fp_db().sq_items() > 0;
}
@ -678,6 +742,7 @@ bool TF9_dberr::send()
ERR_DATADOC ", "
ERR_CODCAUS ", "
ERR_MESELIQ ", "
ERR_NUMDOC ", "
ERR_IMPTDOC ", "
ERR_FORN ", "
ERR_RAGSOC ", "
@ -735,6 +800,7 @@ TF9_dberr::TF9_dberr()
ERR_DATADOC ", "
ERR_CODCAUS ", "
ERR_MESELIQ ", "
ERR_NUMDOC ", "
ERR_IMPTDOC ", "
ERR_FORN ", "
ERR_RAGSOC ", "
@ -789,7 +855,7 @@ void TCategorie_doc::load_all()
}
}
std::shared_ptr<TCategorie_doc::classe_doc> TCategorie_doc::causcont2cat(const char* caus)
std::shared_ptr<TCategorie_doc::classe_doc> TCategorie_doc::causcont2cat(const char* caus, bool force_cartacea) // todo: force_cartacea per le vendite
{
const TCausale c(caus);
const TString& tipodoc = c.tipo_doc();

View File

@ -51,8 +51,8 @@ public:
{
TString catdoc;
TString descr;
TString class_sost;
TString caus_sost;
TString class_sost; // { FTA | FTV } - classe documentale sostitutiva
TString caus_sost; // causale per sostitutiva(TD01…)
TString causcont;
TString tipocaus;
TString tipomov;
@ -66,7 +66,7 @@ private:
vector<classe_doc>::iterator find(const TString& class_sost, const TString& caus_sost, const TString& op_cee);
void load_all();
public:
std::shared_ptr<classe_doc> causcont2cat(const char* caus);
std::shared_ptr<classe_doc> causcont2cat(const char* caus, bool force_cartacea = false);
void reload()
{
_rows.clear();
@ -94,7 +94,8 @@ struct movimento_t
escluso, // Movimento con flag escluso
no_catdoc, // Nessuna cat. doc. riconosciuta per questo movimento, o non e' una fattura
no_doc, // Il mov. di vendita non ha un documento generatore
notfound_elet // Non trovata fatt. elettronica mov vendita
notfound_elet, // Non trovata fatt. elettronica mov vendita
no_fa // Movimento di acquisto non e' una fattura
};
bool err;