Patch level : 12.0 976
Files correlati : f90.exe Commento : - Modificato pescaggio file docuemnto cartaceo dalla spotlight se esiste. - Modificato guessing movimenti passivi per associazione automatica piu' "intelligente" con FPPRO. - Correzione controllo annessi obligatori. - Correzione controllo movimento collegato (per rev. charge). - Corretto messaggio di errore generazione prospetto integrativo. - Correzione esportazione numero documento per le vendite secondo la regola che viene utilizzata nell'invio fp dove viene fatto il leading di 0 se esiste prefisso/suffisso. - Correzione conferma estratti e segna sul movimento che e' estratto.
This commit is contained in:
parent
6053f847c0
commit
a19d5c67fe
@ -53,7 +53,9 @@ bool TFppro::guess_the_doc(const TLocalisamfile& mov)
|
||||
cli_statopiva << clifo.get(CLI_STATOPAIV);
|
||||
cli_piva << clifo.get(CLI_PAIV);
|
||||
const real tot = mov.get_real(MOV_TOTDOC) + mov.get_real(MOV_RITFIS) + mov.get_real(MOV_RITSOC);
|
||||
|
||||
TString numdoc = mov.get(MOV_NUMDOCEXT);
|
||||
if (numdoc.empty())
|
||||
numdoc = mov.get(MOV_NUMDOC);
|
||||
// Controllo datadoc - numdoc - totdoc - p.iva
|
||||
TString query;
|
||||
query << "SELECT PQ_KEYPRGINVIO AS KEYPRGINVIO, PQ_KEYHEADERFATT AS KEYHEADERFATT, PQ_KEYBODYFATT AS KEYBODYFATT, P7_DATA AS DATA,\n" <<
|
||||
@ -61,9 +63,9 @@ bool TFppro::guess_the_doc(const TLocalisamfile& mov)
|
||||
"JOIN PAA0700F ON PQ_KEYPRGINVIO = P7_KEYPRGINVIO AND PQ_KEYHEADERFATT = P7_KEYHEADERFATT AND PQ_KEYBODYFATT = P7_KEYBODYFATT\n" <<
|
||||
"JOIN PAA0200F ON PQ_KEYPRGINVIO = P2_KEYPRGINVIO AND PQ_KEYHEADERFATT = P2_KEYHEADERFATT AND PQ_KEYBODYFATT = P2_KEYBODYFATT\n" <<
|
||||
"WHERE P7_DATA = '" << mov.get_date(MOV_DATADOC).date2ansi() << "' AND \n" <<
|
||||
"(P7_NUMERO = '" << mov.get(MOV_NUMDOC) << "' OR P7_NUMERO = '" << mov.get(MOV_NUMDOCEXT) << "') AND \n" <<
|
||||
(cli_statopiva.full()? TString("P2_FISCIVAPAESE = '") << cli_statopiva << "' AND P2_FISCIVACOD = '" << cli_piva << "'": TString("P2_FISCIVACOD = '") << cli_piva << "'") << " AND \n" <<
|
||||
"PQ_IMPTOTDOC = '" << tot << "'";
|
||||
"(P7_NUMERO = '" << numdoc << "' OR P7_NUMERO LIKE '%" << numdoc << "%') AND \n" <<
|
||||
(cli_statopiva.full() ? TString("P2_FISCIVAPAESE = '") << cli_statopiva << "' AND " : "") <<
|
||||
"P2_FISCIVACOD = '" << cli_piva << "' AND \n" << "PQ_IMPTOTDOC = " << tot;
|
||||
|
||||
if (_db->sq_set_exec(query) && _db->sq_items() == 1)
|
||||
{
|
||||
|
@ -124,6 +124,25 @@ TDate recset_get_date(const TRecordset& rec, const char* field)
|
||||
// TEstrai_mask
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
TString TEstrai_mask::get_numdoc_exp_fp(const int numreg)
|
||||
{
|
||||
TLocalisamfile mov(LF_MOV);
|
||||
mov.put(MOV_NUMREG, numreg);
|
||||
if (mov.read() == NOERR)
|
||||
{
|
||||
const TString& dprovv = mov.get(MOV_DPROVV);
|
||||
const int danno = mov.get_int(MOV_DANNO);
|
||||
const TString& dcodnum = mov.get(MOV_DCODNUM);
|
||||
const int dndoc = mov.get_int(MOV_DNDOC);
|
||||
if (!dprovv.empty() && danno != 0 && !dcodnum.empty() && dndoc != 0)
|
||||
{
|
||||
const TDocumento doc(dprovv[0], danno, dcodnum, dndoc);
|
||||
return complete_num_fp(doc.codice_numerazione(), doc.numero());
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
int TEstrai_mask::estrai()
|
||||
{
|
||||
const TDate dataini = get_dataini();
|
||||
@ -142,7 +161,7 @@ int TEstrai_mask::estrai()
|
||||
get_descr(), // Descrizione estrazione
|
||||
F9CONF.get_addr_doc(), // Cartella documenti
|
||||
false, // Estrazione di un escluso
|
||||
path,
|
||||
path, // Spotlight path
|
||||
&dataini, // Data estr. mov dal
|
||||
&dataend, // Data estr. mov al
|
||||
F9CONF.get_has_cartexp() // Flag per estrarre anche i doc. cartacei
|
||||
@ -162,16 +181,16 @@ int TEstrai_mask::estrai()
|
||||
{
|
||||
if (!progr->add_status())
|
||||
break;
|
||||
//int numreg = recset_get_int(mov, MOV_NUMREG);
|
||||
|
||||
|
||||
TToken_string elab_f9(recset_get_string(mov, MOV_ELABF9), ';'); // Stringa del campo elaborazione f9 nel file mov
|
||||
const bool escluso = !(elab_f9.items() == 3 && elab_f9.get(2)[0] != 'X' || elab_f9.empty());
|
||||
const TCausale caus(recset_get_string(mov, MOV_CODCAUS, 3), TDate(recset_get_string(mov, MOV_DATAREG)).year());
|
||||
const bool stampato = recset_get_bool(mov, MOV_REGST);
|
||||
const TString& numdoc = recset_get_string(mov, MOV_NUMDOC);
|
||||
const TRegistro& reg = caus.reg();
|
||||
const TipoIVA& iva = reg.iva();
|
||||
TString numdoc = recset_get_string(mov, MOV_NUMDOCEXT);
|
||||
if(numdoc.empty())
|
||||
numdoc = recset_get_string(mov, MOV_NUMDOC);
|
||||
// Se definitivo controllo il flag di stampato REGST
|
||||
if ((flagpro || stampato) && numdoc.full() && iva == tipo)
|
||||
{
|
||||
@ -187,7 +206,10 @@ int TEstrai_mask::estrai()
|
||||
t.datadoc = recset_get_date (mov, MOV_DATADOC);
|
||||
t.codcaus = recset_get_string (mov, MOV_CODCAUS, 3);
|
||||
t.meseliq = recset_get_int (mov, MOV_MESELIQ);
|
||||
t.numdoc = recset_get_string (mov, MOV_NUMDOC);
|
||||
if (tipo == iva_vendite)
|
||||
t.numdoc = get_numdoc_exp_fp(t.numreg);
|
||||
if (t.numdoc.empty())
|
||||
t.numdoc = numdoc;
|
||||
t.tot = recset_get_real (mov, MOV_TOTDOC) + recset_get_real(mov, MOV_RITFIS) + recset_get_real(mov, MOV_RITSOC);
|
||||
t.codcf = recset_get_int (mov, MOV_CODCF);
|
||||
t.ragsoc = clifo.read() == NOERR ? clifo.get(CLI_RAGSOC) : " ";
|
||||
@ -195,8 +217,8 @@ int TEstrai_mask::estrai()
|
||||
t.descr = recset_get_string (mov, MOV_DESCR);
|
||||
if (escluso)
|
||||
{
|
||||
t.estratto = false;
|
||||
t.descr_estr = movimento_t::escluso;
|
||||
t.estratto = false;
|
||||
t.descr_estr = movimento_t::escluso;
|
||||
}
|
||||
|
||||
// Effettivo inserimento del movimento
|
||||
@ -1517,7 +1539,7 @@ bool TF9_app::segna_estratti(const bool escluso, const int numreg)
|
||||
elab.add("X", 0); elab.add(today.date2ansi()); elab.add(" "); // "[flag estratto];[data estrazione];[flag escluso]"
|
||||
for (auto it = movs_v.begin(); it != movs_v.end(); ++it)
|
||||
{
|
||||
TString8 num_reg(it->numreg);
|
||||
TString8 num_reg; num_reg << it->numreg;
|
||||
mov.zero();
|
||||
mov.put(MOV_NUMREG, num_reg);
|
||||
mov.read();
|
||||
|
@ -33,12 +33,13 @@ class TEstrai_mask : public TMask
|
||||
/** Segna su DRD che l'estrazione e' in errore diag. gestionale. */
|
||||
void segna_in_errore() const;
|
||||
|
||||
static bool estrai_handler(TMask_field& f, KEY key);
|
||||
static bool enable_handler(TMask_field& f, KEY key);
|
||||
static bool estrai_handler(TMask_field& f, KEY key);
|
||||
static bool enable_handler(TMask_field& f, KEY key);
|
||||
static bool dataini_handler(TMask_field& f, KEY key);
|
||||
static bool dataend_handler(TMask_field& f, KEY key);
|
||||
|
||||
public:
|
||||
static TString get_numdoc_fp(int numreg);
|
||||
TEstrai_mask();
|
||||
};
|
||||
|
||||
|
@ -353,13 +353,13 @@ void TGestione_doc_cartacei_f9_msk::delete_file()
|
||||
|
||||
if (p == 0)
|
||||
{
|
||||
f9cart.put(F9C_FILENAME, filename);
|
||||
f9cart.put(F9C_NUMREG, numreg);
|
||||
f9cart.put(F9C_FILENAME, filename);
|
||||
f9cart.put(F9C_NUMREG, numreg);
|
||||
f9cart.read();
|
||||
}
|
||||
else
|
||||
{
|
||||
f9annessi.put(F9A_NUMREG, numreg);
|
||||
f9annessi.put(F9A_NUMREG, numreg);
|
||||
f9annessi.put(F9A_FILENAME, filename);
|
||||
f9annessi.read();
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "report.h"
|
||||
|
||||
#include "f9lib.h"
|
||||
#include "f90100.h"
|
||||
|
||||
/**
|
||||
* \brief Some test for F9 classes
|
||||
@ -191,7 +192,7 @@ void TF9_test_app::main_loop()
|
||||
if(categorie_doc().get_ann("INTREVC", annesso))
|
||||
TEstrazione::make_prosp_int_revc(153480, annesso);
|
||||
|
||||
|
||||
TString s = TEstrai_mask::get_numdoc_campo_fp(105396);
|
||||
|
||||
message_box("TESTS COMPLETELY SUCCESSFUL");
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#define MODE_SHEETS 0xC
|
||||
|
||||
statistics _stats = { 0 };
|
||||
statistics _stats = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// TEstrazione
|
||||
@ -59,11 +59,7 @@ void TEstrazione::check_annessi(movimento_t& mov_i, const int numreg)
|
||||
}
|
||||
else
|
||||
{
|
||||
const bool loaded = load_annessi(mov_i);
|
||||
#ifdef DBG
|
||||
if (loaded)
|
||||
bool simo = true;
|
||||
#endif
|
||||
load_annessi(mov_i);
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,7 +70,7 @@ bool TEstrazione::check_annessi_oblig(const TString& catdoc, const int numreg, _
|
||||
const TString_array lista_cat_annessi = categorie.get_array_ann(catdoc); // Lista cat annessi
|
||||
TF9_doccart file_cart;
|
||||
std::vector<annesso_t> list_file_ann; // Lista file annessi
|
||||
file_cart.mov2listann_vect(TString(numreg), list_file_ann);
|
||||
file_cart.mov2listann_vect(TString() << numreg, list_file_ann);
|
||||
bool ok_ann = true;
|
||||
FOR_EACH_ARRAY_ITEM(lista_cat_annessi, nr, ann)
|
||||
{
|
||||
@ -100,7 +96,10 @@ bool TEstrazione::check_annessi_oblig(const TString& catdoc, const int numreg, _
|
||||
else if(ok_cat && annesso.opcee == "RC")
|
||||
{
|
||||
// Generazione prospetto integrativo.
|
||||
ok_ann &= make_prosp_int_revc(numreg, annesso);
|
||||
const bool ok = make_prosp_int_revc(numreg, annesso);
|
||||
if (!ok)
|
||||
ann_nexist.add(TString() << "Prospetto integrativo (" << annesso.catdoc << ")");
|
||||
ok_ann &= ok;
|
||||
}
|
||||
}
|
||||
return ok_ann;
|
||||
@ -257,23 +256,12 @@ bool TEstrazione::is_doc_xml(const TLocalisamfile& mov)
|
||||
bool TEstrazione::find_movcoll(const int numreg, _Out_ TString& numreg_rev_vend)
|
||||
{
|
||||
TLocalisamfile mov(LF_MOV);
|
||||
//TLocalisamfile mov_rev(LF_MOV);
|
||||
mov.put(MOV_NUMREG, numreg);
|
||||
/*mov_rev.put(MOV_NUMREG, numreg + 1);
|
||||
if(mov.read() == NOERR && mov_rev.read() == NOERR)
|
||||
{
|
||||
if(mov.get(MOV_DATADOC) == mov_rev.get(MOV_DATADOC) &&
|
||||
(mov.get(MOV_NUMDOCEXT).full() && mov_rev.get(MOV_NUMDOCEXT).full() ?
|
||||
mov.get(MOV_NUMDOCEXT) == mov_rev.get(MOV_NUMDOCEXT) : mov.get(MOV_NUMDOC) == mov_rev.get(MOV_NUMDOC)))
|
||||
numreg_rev_vend = mov_rev.get(MOV_NUMREG);
|
||||
if(numreg_rev_vend.full()) return true;
|
||||
}*/
|
||||
mov.read();
|
||||
|
||||
const TCausale& cau = cached_causale(mov.get(MOV_CODCAUS), mov.get_int(MOV_ANNOES));
|
||||
const TString4 cau_reg = cau.causale_reg_iva();
|
||||
//TToken_string key(mov.get(MOV_TIPO)); key.add(mov.get_long(MOV_CODCF));
|
||||
const long numdoc = mov.get_long(MOV_NUMDOC);// cache().get(LF_CLIFO, key);
|
||||
const TString numdoc = mov.get(MOV_NUMDOC);
|
||||
TString query("USE ");
|
||||
|
||||
query << LF_MOV << " KEY 1 SELECT " << MOV_CODCAUS << "==\"" << cau_reg << "\"\nFROM " << MOV_NUMREG << "==" << numreg;
|
||||
@ -285,7 +273,7 @@ bool TEstrazione::find_movcoll(const int numreg, _Out_ TString& numreg_rev_vend)
|
||||
TRectype& curr = (TRectype&)mov_rs.cursor()->curr();
|
||||
const long movcoll_found = curr.get_long(MOV_MOVCOLL);
|
||||
|
||||
if ((curr.get_long(MOV_NUMDOC) == numdoc) && ((movcoll_found == 0L) || (movcoll_found == numreg)))
|
||||
if (curr.get(MOV_NUMDOC) == numdoc && (movcoll_found == 0L || movcoll_found == numreg))
|
||||
{
|
||||
movcoll = mov_rs.get(MOV_NUMREG).as_int();
|
||||
curr.put(MOV_MOVCOLL, numreg);
|
||||
@ -397,9 +385,6 @@ bool TEstrazione::make_prosp_int_revc(const int numreg, TCategorie_doc::annesso&
|
||||
tmp_file.ext("pdf");
|
||||
if(prosp.export_pdf(tmp_file))
|
||||
{
|
||||
if (!tmp_file.exist())
|
||||
bool simo = true;
|
||||
|
||||
// Sposto il file nella cartella dei documenti cartacei.
|
||||
const TFilename newfile(TF9_doccart::get_full_path_file_cartaceo(tmp_file.name()));
|
||||
if (!newfile.exist())
|
||||
@ -436,7 +421,7 @@ bool TEstrazione::make_prosp_int_revc(const int numreg, TCategorie_doc::annesso&
|
||||
bool ok = lf_ann.write() == NOERR;
|
||||
ok &= lf_ann.rewrite() == NOERR;
|
||||
if (!ok)
|
||||
ok = yesno_box("Impossibile creare il prospetto integrativo per la registrazione n. %s.\nContinuare con l'estrazione?", (const char*)numreg);
|
||||
ok = yesno_box("Impossibile creare il prospetto integrativo per la registrazione n. %s.\nContinuare con l'estrazione?", (const char*)TString(numreg));
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
@ -487,10 +472,6 @@ bool TEstrazione::insert_into_f9movestr() const
|
||||
query.cut(0) << "INSERT INTO " F9_MOVESTR " (" MES_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())
|
||||
bool simo = true;
|
||||
#endif
|
||||
ok &= fp_db().sq_set_exec(query) && fp_db().sq_commit();
|
||||
if (!ok)
|
||||
{
|
||||
@ -515,13 +496,6 @@ bool TEstrazione::export_error_list() const
|
||||
|
||||
if (it->err)
|
||||
{
|
||||
#ifdef DBG
|
||||
if (count == 25)
|
||||
bool simo = true;
|
||||
if (it->numreg == 187680)
|
||||
bool simo = true;
|
||||
#endif
|
||||
|
||||
dberr.add(_head.cod_soc);
|
||||
dberr.add(_head.id_estr);
|
||||
for (int i = 1; i < 15; i++)
|
||||
@ -782,7 +756,6 @@ const char* TEstrazione::diagnostica_mov()
|
||||
if (!mov_i.err && mov_i.estratto)
|
||||
{
|
||||
mov_i.cartaceo = !is_doc_xml(mov);
|
||||
bool exist_doc;
|
||||
unsigned short skip = 0;
|
||||
if (!_has_cartacei && mov_i.cartaceo) skip |= 0x1;
|
||||
else if (pura_iva(mov)) skip |= 0x2;
|
||||
@ -900,7 +873,7 @@ result_estr TEstrazione::estrai()
|
||||
set_dates(); // Se escluso imposto data inizio e fine uguali
|
||||
|
||||
// Scrivo record estrazione (in stato '01': in diagnostica).
|
||||
bool ok = insert_into_drd();
|
||||
const bool ok = insert_into_drd();
|
||||
if (!ok)
|
||||
{
|
||||
TString msg;
|
||||
@ -912,7 +885,7 @@ result_estr TEstrazione::estrai()
|
||||
|
||||
// Faccio partire la diagnostica e mi salvo il nuovo stato.
|
||||
diagnostica_mov();
|
||||
ok &= insert_into_f9movestr();
|
||||
insert_into_f9movestr();
|
||||
|
||||
if (_head.stato_estr == D_GEST_ERR)
|
||||
{
|
||||
@ -921,7 +894,7 @@ result_estr TEstrazione::estrai()
|
||||
// Se in errore, esporto lista errori sul db
|
||||
if (!export_error_list())
|
||||
warning_box("Errore scrittura db. Controllare log errori.");
|
||||
ok &= update_drd_stato_estr();
|
||||
update_drd_stato_estr();
|
||||
return estr_diag_err; // Errore diagnostica gestionale
|
||||
}
|
||||
|
||||
@ -930,13 +903,13 @@ result_estr TEstrazione::estrai()
|
||||
const result_estr res = estrazione_iva() ? estr_ok : estr_err_db_iva;
|
||||
if (res == estr_err_db_iva)
|
||||
_head.stato_estr = D_GEST_ERR;
|
||||
ok &= update_drd_stato_estr();
|
||||
update_drd_stato_estr();
|
||||
return res;
|
||||
}
|
||||
|
||||
bool TEstrazione::estrazione_iva(bool escluso)
|
||||
{
|
||||
TString numdoc, statopaiv, idfisc, paiv, codfis;
|
||||
TString statopaiv, idfisc, paiv, codfis;
|
||||
bool stato = true;
|
||||
|
||||
TProgress_monitor bar(_movs.size(), "Estrazione dati IVA");
|
||||
@ -959,7 +932,6 @@ bool TEstrazione::estrazione_iva(bool escluso)
|
||||
const char tipodoc = _head.tipo_doc;
|
||||
const TString& name_registro = TRegistro(TCausale(mov.get(MOV_CODCAUS), mov.get_date(MOV_DATAREG).year()).reg()).name();
|
||||
fill_id(cli, statopaiv, idfisc, paiv, codfis);
|
||||
numdoc.cut(0) << (mov.get(MOV_NUMDOCEXT).full() ? mov.get(MOV_NUMDOCEXT) : mov.get(MOV_NUMDOC));
|
||||
TDate datadoc = mov.get_date(MOV_DATADOC);
|
||||
TDate datareg = mov.get_date(MOV_DATAREG);
|
||||
|
||||
@ -982,7 +954,7 @@ bool TEstrazione::estrazione_iva(bool escluso)
|
||||
iva_query.add(IVA_CATDOC, it->catdoc->catdoc, 10);
|
||||
iva_query.add(IVA_CAUSSOS, it->catdoc->caus_sost, 6);
|
||||
|
||||
iva_query.add(IVA_NUMDOC, numdoc, 20);
|
||||
iva_query.add(IVA_NUMDOC, it->numdoc, 20);
|
||||
iva_query.add(IVA_DATADOC, datadoc);
|
||||
iva_query.add(IVA_SEZIVA, mov.get(MOV_REG), 10);
|
||||
iva_query.add(IVA_TIPOREG, "", 6);
|
||||
@ -1201,7 +1173,7 @@ bool TF9_dberr::send()
|
||||
return ok;
|
||||
}
|
||||
|
||||
void TF9_dberr::del_err(const TString& codsoc, const TString& id_estr, int numreg)
|
||||
void TF9_dberr::del_err(const TString& codsoc, const TString& id_estr, const int numreg)
|
||||
{
|
||||
TString query;
|
||||
query << "DELETE FROM " F9_ERR
|
||||
|
@ -489,20 +489,7 @@ TProspetto_recset::TProspetto_recset(const char* numreg_acq, const char* numreg_
|
||||
|
||||
// Calcolo dal rmoviva
|
||||
real s_imponibili, s_imposte;
|
||||
/*TMovimento_contabile movimento_pn;
|
||||
TLocalisamfile mov(LF_MOV);
|
||||
mov.put(MOV_NUMREG, numreg_ven);
|
||||
mov.read();
|
||||
if (movimento_pn.read(mov) != NOERR)
|
||||
bool simo = true;
|
||||
s_imponibili = movimento_pn.imponibile("");
|
||||
s_imposte = movimento_pn.imposta("");*/
|
||||
|
||||
/*TMovimentoPN _movimento_pn;
|
||||
TRectype& rec = _movimento_pn.curr();
|
||||
rec.put(MOV_NUMREG, numreg_ven);
|
||||
if (_movimento_pn.read() != NOERR)
|
||||
bool simo = true;*/
|
||||
|
||||
get_sum_imponibile_imposta(numreg_ven, s_imponibili, s_imposte);
|
||||
|
||||
format_string(*_totale, TString() << s_imponibili + s_imposte);
|
||||
|
Loading…
x
Reference in New Issue
Block a user