Patch level : 12.00 1402
Files correlati : ve01.exe Commento : Corretta abilitazione CIG CUP
This commit is contained in:
parent
649a136a8d
commit
6d9f1529cf
@ -68,6 +68,7 @@ void TParametri_mask::save_all() const
|
||||
set_fp_var(FP_RAGSOCP, get(F_RAGSOCP));
|
||||
set_fp_var(FP_ADDINDSP, get(F_ADDINDSP));
|
||||
set_fp_var(FP_DUMP_VALS, get(F_DUMP_VALS));
|
||||
set_fp_var(FP_RIF_PAG, get(F_RIF_PAG));
|
||||
|
||||
TFP_nota_piede_f().save_sheet(sfield(F_NPFSHEET));
|
||||
|
||||
@ -146,6 +147,7 @@ void TParametri_mask::load_all()
|
||||
set(F_RAGSOCP, get_fp_bool_var(FP_RAGSOCP));
|
||||
set(F_ADDINDSP, get_fp_bool_var(FP_ADDINDSP));
|
||||
set(F_DUMP_VALS, get_fp_bool_var(FP_DUMP_VALS));
|
||||
set(F_RIF_PAG, get_fp_bool_var(FP_RIF_PAG));
|
||||
TFP_nota_piede_f().load_sheet(sfield(F_NPFSHEET));
|
||||
|
||||
TSheet_field & stile = sfield(F_STYLES);
|
||||
@ -322,4 +324,4 @@ int fp0100(int argc, char* argv[])
|
||||
TParametri_ditta appc;
|
||||
appc.run(argc, argv, TR("Configurazione FP"));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -36,11 +36,12 @@ protected:
|
||||
void set_filter_changed();
|
||||
void print();
|
||||
void elabora(bool invia = true, bool reset_name = false, const char * stato = " ");
|
||||
void check();
|
||||
bool on_field_event(TOperable_field& o, TField_event e, long jolly) override;
|
||||
void next_page(int p) override;
|
||||
bool on_key(KEY key) override;
|
||||
bool check_full_fields() const;
|
||||
void fill_docs();
|
||||
void fill_docs(bool clear = false);
|
||||
void init();
|
||||
void fill_sheet();
|
||||
void load_all_fields();
|
||||
@ -138,7 +139,7 @@ int sort_by_num(TSheet_field & s, int r1, int r2)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void TPA_mask::fill_docs()
|
||||
void TPA_mask::fill_docs(bool clear)
|
||||
{
|
||||
TSheet_field& selected_docs = sfield(F_DOCUMENTI_TIPO);
|
||||
TSheet_field& docs = sfield(F_DOCS);
|
||||
@ -150,8 +151,9 @@ void TPA_mask::fill_docs()
|
||||
|
||||
docs.reset();
|
||||
_documenti.destroy();
|
||||
enable(DLG_OK, filter_selected.empty() || filter_selected == "X");
|
||||
enable(DLG_ELABORA, filter_selected.empty() || filter_selected == "X");
|
||||
enable(DLG_FINDREC, filter_selected == "X" || filter_selected == "I" || filter_selected == "E");
|
||||
enable(DLG_CHECK_SDI, fp_has_check() && filter_selected.full());
|
||||
enable(DLG_PDF, filter_selected == "X" || filter_selected == "I" || filter_selected == "E");
|
||||
docs.enable_column(S_SELECTED, filter_selected.empty() || filter_selected == "X" || filter_selected == "I");
|
||||
docs.enable_column(S_CODSDI, filter_selected.empty());
|
||||
@ -169,7 +171,7 @@ void TPA_mask::fill_docs()
|
||||
|
||||
FOR_EACH_TOKEN(stati, r)
|
||||
tipi.add(tipo);
|
||||
sdocs.read('D', dal.year(), codnum, tipi, stati, filter, dal, al);
|
||||
sdocs.read('D' ,dal.year(), codnum, tipi, stati, filter, dal, al);
|
||||
|
||||
const int items = sdocs.items();
|
||||
|
||||
@ -191,7 +193,7 @@ void TPA_mask::fill_docs()
|
||||
{
|
||||
const TDocumento & doc = (TDocumento & )_documenti[i];
|
||||
const TTipo_documento& td = doc.tipo(); //cached_tipodoc(doc.get(DOC_TIPODOC));
|
||||
int row = docs.set_row_cell(S_SELECTED, true);
|
||||
int row = docs.set_row_cell(S_SELECTED, !clear);
|
||||
|
||||
docs.set_row_cell(S_ANNO, doc.get_int(DOC_ANNO), row);
|
||||
docs.set_row_cell(S_CODNUM, doc.get(DOC_CODNUM), row);
|
||||
@ -293,10 +295,7 @@ void TPA_mask::print()
|
||||
}
|
||||
sf.force_update();
|
||||
if (files.full())
|
||||
{
|
||||
goto_url(temp);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void TPA_mask::elabora(bool invia, bool reset_name, const char * stato)
|
||||
@ -304,9 +303,9 @@ void TPA_mask::elabora(bool invia, bool reset_name, const char * stato)
|
||||
int ndocs = 0;
|
||||
TLocalisamfile doc(LF_DOC);
|
||||
TSheet_field & sht = sfield(F_DOCS);
|
||||
TLog_report log;
|
||||
TLog_report log;
|
||||
char sel = get(F_FATTSEL)[0];
|
||||
|
||||
|
||||
{
|
||||
TProgress_monitor pi(sht.items(), "Esportazione Fatture");
|
||||
|
||||
@ -372,6 +371,34 @@ void TPA_mask::elabora(bool invia, bool reset_name, const char * stato)
|
||||
fill_docs();
|
||||
}
|
||||
|
||||
void TPA_mask::check()
|
||||
{
|
||||
int ndocs = 0;
|
||||
TLocalisamfile doc(LF_DOC);
|
||||
TSheet_field & sht = sfield(F_DOCS);
|
||||
|
||||
{
|
||||
TProgress_monitor pi(sht.items(), "Diagnostica Fatture");
|
||||
|
||||
FOR_EACH_SHEET_ROW_LOOP(sht, r)
|
||||
{
|
||||
if (!pi.add_status())
|
||||
break;
|
||||
if (sht.get_bool_row_cell(r, S_SELECTED))
|
||||
{
|
||||
const int anno = sht.get_int_row_cell(r, S_ANNO);
|
||||
const long ndoc = sht.get_long_row_cell(r, S_NDOC);
|
||||
const TFixed_string codnum(sht.get_str_row_cell(r, S_CODNUM)); // lascio sapientemente per ultima la get di una stringa
|
||||
TDocumento doc('D', anno, codnum, ndoc);
|
||||
|
||||
doc.check();
|
||||
sht.set_row_cell(S_SELECTED, false, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
fill_docs(true);
|
||||
}
|
||||
|
||||
bool TPA_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
switch (o.dlg())
|
||||
@ -400,7 +427,7 @@ bool TPA_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
if (e == se_query_add || e == se_query_del)
|
||||
return false;
|
||||
break;
|
||||
case DLG_OK:
|
||||
case DLG_ELABORA:
|
||||
if (e == fe_button)
|
||||
elabora();
|
||||
break;
|
||||
@ -454,11 +481,14 @@ bool TPA_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
descr = "da inviare";
|
||||
stato = "X";
|
||||
}
|
||||
if (yesno_box(FR("Vuoi passare le fatture selezionate in stato da %s"), (const char *) descr))
|
||||
if (yesno_box(FR("Vuoi passare le fatture selezionate in stato da %s"), (const char *)descr))
|
||||
elabora(false, reset_name, stato);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case DLG_CHECK_SDI:
|
||||
if (e == fe_button)
|
||||
check();
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
return true;
|
||||
@ -471,7 +501,10 @@ void TPA_mask::next_page(int p)
|
||||
if (filter_changed())
|
||||
fill_docs();
|
||||
if (p == 1000)
|
||||
{
|
||||
disable(DLG_FINDREC);
|
||||
disable(DLG_CHECK_SDI);
|
||||
}
|
||||
TAutomask::next_page(p);
|
||||
}
|
||||
|
||||
@ -496,8 +529,9 @@ bool TPA_mask::check_full_fields() const
|
||||
|
||||
TPA_mask::TPA_mask() : TAutomask("fp0300a01"), _dirty(true)
|
||||
{
|
||||
disable(DLG_OK);
|
||||
disable(DLG_ELABORA);
|
||||
disable(DLG_FINDREC);
|
||||
disable(DLG_CHECK_SDI);
|
||||
disable(DLG_PDF);
|
||||
load_all_fields();
|
||||
const TDate data_inizio = botime;
|
||||
|
||||
@ -45,6 +45,7 @@ protected:
|
||||
void xml();
|
||||
void elimina();
|
||||
void archivia();
|
||||
void check();
|
||||
void recupera();
|
||||
TDate load_data() const;
|
||||
// bool on_key(KEY key) override;
|
||||
@ -177,6 +178,10 @@ bool TPassive_mask::on_field_event(TOperable_field& o, TField_event e, long joll
|
||||
case DLG_RESTORE:
|
||||
recupera();
|
||||
break;
|
||||
case DLG_CHECK_SDI:
|
||||
if (e == fe_button)
|
||||
check();
|
||||
break;
|
||||
case F_DATAINI:
|
||||
if (e == fe_init)
|
||||
o.set(load_data());
|
||||
@ -261,6 +266,7 @@ void TPassive_mask::next_page(int p)
|
||||
disable(DLG_PDF);
|
||||
disable(DLG_XML);
|
||||
disable(DLG_COPY);
|
||||
disable(DLG_CHECK_SDI);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -275,6 +281,8 @@ void TPassive_mask::next_page(int p)
|
||||
enable(DLG_PDF);
|
||||
enable(DLG_XML);
|
||||
enable(DLG_COPY);
|
||||
enable(DLG_CHECK_SDI, fp_has_check());
|
||||
|
||||
}
|
||||
TAutomask::next_page(p);
|
||||
}
|
||||
@ -313,7 +321,6 @@ void TPassive_mask::fill_docs()
|
||||
|
||||
if (name.full())
|
||||
{
|
||||
int pos = name.find("_");
|
||||
const int anno = d.get_int(DOC_ANNO);
|
||||
TFilename xml_name = get_xml_arc(anno);
|
||||
|
||||
@ -352,11 +359,6 @@ void TPassive_mask::fill_docs()
|
||||
}
|
||||
}
|
||||
|
||||
real diff = sf.get_real_row_cell(r, S_TOTDOCXML) - sf.get_real_row_cell(r, S_TOTDOC);
|
||||
|
||||
sf.set_row_cell(S_DIFF, diff, r);
|
||||
sf.set_back_and_fore_color(diff != ZERO ? COLOR_LTRED : COLOR_LTGREEN, NORMAL_COLOR, r, S_DIFF);
|
||||
|
||||
TDate dataric = datadoc;
|
||||
TFilename ini_name = xml_name;
|
||||
|
||||
@ -379,12 +381,12 @@ void TPassive_mask::fill_docs()
|
||||
sf.disable_cell(r, S_CODFISC);
|
||||
|
||||
TXmlItem * h = xml.FindFirstChild("FatturaElettronicaHeader");
|
||||
TXmlItem * dati_trasmissione = h != nullptr ? h->FindFirstChild("DatiTrasmissione") : nullptr;
|
||||
|
||||
if (dati_trasmissione == nullptr)
|
||||
continue;
|
||||
if (h != nullptr)
|
||||
{
|
||||
|
||||
TXmlItem * dati_trasmissione = h->FindFirstChild("DatiTrasmissione");
|
||||
|
||||
if (dati_trasmissione != nullptr)
|
||||
sf.set_row_cell(S_IDSDI, dati_trasmissione->GetEnclosedText("ProgressivoInvio"), r);
|
||||
|
||||
@ -392,11 +394,11 @@ void TPassive_mask::fill_docs()
|
||||
|
||||
if (cp != nullptr)
|
||||
{
|
||||
TXmlItem * da = cp->FindFirstChild("DatiAnagrafici");
|
||||
TXmlItem * da = fattura_ordinaria(*dati_trasmissione) ? cp->FindFirstChild("DatiAnagrafici") : cp;
|
||||
|
||||
if (da != nullptr)
|
||||
{
|
||||
TXmlItem * anagr = da->FindFirstChild("Anagrafica");
|
||||
TXmlItem * anagr = fattura_ordinaria(*dati_trasmissione) ? da->FindFirstChild("Anagrafica") : cp;
|
||||
TString ragione_sociale;
|
||||
|
||||
if (anagr != nullptr)
|
||||
@ -414,6 +416,25 @@ void TPassive_mask::fill_docs()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fattura_semplificata(*dati_trasmissione))
|
||||
{
|
||||
real totale;
|
||||
int last = 1;
|
||||
|
||||
for (TXmlItem * riga = body->FindFirstChild("DatiBeniServizi"); riga != nullptr; riga = body->FindChild("DatiBeniServizi", last))
|
||||
{
|
||||
TString natura = riga->GetEnclosedText("Natura");
|
||||
TDate inizio = riga->GetEnclosedDate("DataInizioPeriodo");
|
||||
|
||||
totale += riga->GetEnclosedReal("Importo");
|
||||
}
|
||||
sf.set_row_cell(S_TOTDOCXML, totale, r);
|
||||
}
|
||||
|
||||
real diff = sf.get_real_row_cell(r, S_TOTDOCXML) - sf.get_real_row_cell(r, S_TOTDOC);
|
||||
|
||||
sf.set_row_cell(S_DIFF, diff, r);
|
||||
sf.set_back_and_fore_color(diff != ZERO ? COLOR_LTRED : COLOR_LTGREEN, NORMAL_COLOR, r, S_DIFF);
|
||||
}
|
||||
sf.set_row_cell(S_NUMREGCG, d.get_long(DOC_NUMREG), r);
|
||||
}
|
||||
@ -443,7 +464,6 @@ void TPassive_mask::fill_xml()
|
||||
TXmlItem xml(*file, nullptr, "Allegati|ds:Signature");
|
||||
TFilename xml_name = *file;
|
||||
TString name = xml_name.name_only();
|
||||
int pos = name.find("_");
|
||||
|
||||
if (get_fp_bool_var(FP_HIDENOPIVA))
|
||||
{
|
||||
@ -482,14 +502,17 @@ void TPassive_mask::fill_xml()
|
||||
TString cofi;
|
||||
TString8 tipodocsdi;
|
||||
TXmlItem * h = xml.FindFirstChild("FatturaElettronicaHeader");
|
||||
TXmlItem * dati_trasmissione = h->FindFirstChild("DatiTrasmissione");
|
||||
|
||||
if (dati_trasmissione == nullptr)
|
||||
continue;
|
||||
if (h != nullptr)
|
||||
{
|
||||
TXmlItem * c = h->FindFirstChild("CedentePrestatore");
|
||||
|
||||
if (c != nullptr)
|
||||
{
|
||||
TXmlItem * dati_anagr = c->FindFirstChild("DatiAnagrafici");
|
||||
TXmlItem * dati_anagr = fattura_ordinaria(*dati_trasmissione) ? c->FindFirstChild("DatiAnagrafici") : c;
|
||||
|
||||
if (dati_anagr != nullptr)
|
||||
{
|
||||
@ -545,17 +568,56 @@ void TPassive_mask::fill_xml()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TXmlItem * corpo = body->FindFirstChild("DatiBeniServizi");
|
||||
|
||||
if (corpo != nullptr)
|
||||
if (fattura_ordinaria(*dati_trasmissione))
|
||||
{
|
||||
int last = 0;
|
||||
TXmlItem * corpo = body->FindFirstChild("DatiBeniServizi");
|
||||
|
||||
for (TXmlItem * riepilogo = corpo->FindChild("DatiRiepilogo", last); riepilogo != nullptr; riepilogo = corpo->FindChild("DatiRiepilogo", last))
|
||||
if (corpo != nullptr)
|
||||
{
|
||||
TString natura = riepilogo->GetEnclosedText("Natura");
|
||||
int last = 0;
|
||||
|
||||
for (TXmlItem * riepilogo = corpo->FindChild("DatiRiepilogo", last); riepilogo != nullptr; riepilogo = corpo->FindChild("DatiRiepilogo", last))
|
||||
{
|
||||
TString natura = riepilogo->GetEnclosedText("Natura");
|
||||
|
||||
if (natura.starts_with("N6"))
|
||||
{
|
||||
if ((natura == "N6.3") || (natura == "N6.7"))
|
||||
tipodocsdi = "TD19";
|
||||
else
|
||||
tipodocsdi = "TD16";
|
||||
break;
|
||||
}
|
||||
else
|
||||
if ((natura == "N3.2") || (natura == "N3.3"))
|
||||
{
|
||||
tipodocsdi = "TD18";
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (TXmlItem * riga = corpo->FindChild("DettaglioLinee", last); riga != nullptr; riga = corpo->FindChild("DettaglioLinee", last))
|
||||
{
|
||||
TDate inizio = riga->GetEnclosedDate("DataInizioPeriodo");
|
||||
|
||||
if (tipodocsdi == "TD18" && (inizio.ok()))
|
||||
{
|
||||
tipodocsdi = "TD17";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
real totale;
|
||||
int last = 1;
|
||||
|
||||
for (TXmlItem * riga = body->FindFirstChild("DatiBeniServizi"); riga != nullptr; riga = body->FindChild("DatiBeniServizi", last))
|
||||
{
|
||||
TString natura = riga->GetEnclosedText("Natura");
|
||||
TDate inizio = riga->GetEnclosedDate("DataInizioPeriodo");
|
||||
|
||||
totale += riga->GetEnclosedReal("Importo");
|
||||
if (natura.starts_with("N6"))
|
||||
{
|
||||
if ((natura == "N6.3") || (natura == "N6.7"))
|
||||
@ -571,16 +633,7 @@ void TPassive_mask::fill_xml()
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (TXmlItem * riga = corpo->FindChild("DettaglioLinee", last); riga != nullptr; riga = corpo->FindChild("DettaglioLinee", last))
|
||||
{
|
||||
TDate inizio = riga->GetEnclosedDate("Natura");
|
||||
|
||||
if (tipodocsdi == "TD18" && (inizio.ok()))
|
||||
{
|
||||
tipodocsdi = "TD17";
|
||||
break;
|
||||
}
|
||||
}
|
||||
sf.set_row_cell(S_TOTDOCXML, totale, r);
|
||||
}
|
||||
}
|
||||
|
||||
@ -672,8 +725,6 @@ void TPassive_mask::fill_xml()
|
||||
|
||||
if (h != nullptr)
|
||||
{
|
||||
TXmlItem * dati_trasmissione = h->FindFirstChild("DatiTrasmissione");
|
||||
|
||||
if (dati_trasmissione != nullptr)
|
||||
sf.set_row_cell(S_IDSDI, dati_trasmissione->GetEnclosedText("ProgressivoInvio"), r);
|
||||
|
||||
@ -681,11 +732,11 @@ void TPassive_mask::fill_xml()
|
||||
|
||||
if (cp != nullptr)
|
||||
{
|
||||
TXmlItem * da = cp->FindFirstChild("DatiAnagrafici");
|
||||
TXmlItem * da = fattura_ordinaria(*dati_trasmissione) ? cp->FindFirstChild("DatiAnagrafici") : cp;
|
||||
|
||||
if (da != nullptr)
|
||||
{
|
||||
TXmlItem * anagr = da->FindFirstChild("Anagrafica");
|
||||
TXmlItem * anagr = fattura_ordinaria(*dati_trasmissione) ? da->FindFirstChild("Anagrafica") : cp;
|
||||
TString ragione_sociale;
|
||||
|
||||
if (anagr != nullptr)
|
||||
@ -731,7 +782,6 @@ void TPassive_mask::fill_archived()
|
||||
TXmlItem xml(*file, nullptr, "Allegati|ds:Signature");
|
||||
TFilename xml_name = *file;
|
||||
TString name = xml_name.name_only();
|
||||
int pos = name.find("_");
|
||||
|
||||
if (get_fp_bool_var(FP_HIDENOPIVA))
|
||||
{
|
||||
@ -770,14 +820,17 @@ void TPassive_mask::fill_archived()
|
||||
TString cofi;
|
||||
TString8 tipodocsdi;
|
||||
TXmlItem * h = xml.FindFirstChild("FatturaElettronicaHeader");
|
||||
TXmlItem * dati_trasmissione = h->FindFirstChild("DatiTrasmissione");
|
||||
|
||||
if (dati_trasmissione == nullptr)
|
||||
continue;
|
||||
if (h != nullptr)
|
||||
{
|
||||
TXmlItem * c = h->FindFirstChild("CedentePrestatore");
|
||||
|
||||
if (c != nullptr)
|
||||
{
|
||||
TXmlItem * dati_anagr = c->FindFirstChild("DatiAnagrafici");
|
||||
TXmlItem * dati_anagr = fattura_ordinaria(*dati_trasmissione) ? c->FindFirstChild("DatiAnagrafici") : c;
|
||||
|
||||
if (dati_anagr != nullptr)
|
||||
{
|
||||
@ -833,17 +886,56 @@ void TPassive_mask::fill_archived()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TXmlItem * corpo = body->FindFirstChild("DatiBeniServizi");
|
||||
|
||||
if (corpo != nullptr)
|
||||
if (fattura_ordinaria(*dati_trasmissione))
|
||||
{
|
||||
int last = 0;
|
||||
TXmlItem * corpo = body->FindFirstChild("DatiBeniServizi");
|
||||
|
||||
for (TXmlItem * riepilogo = corpo->FindChild("DatiRiepilogo", last); riepilogo != nullptr; riepilogo = corpo->FindChild("DatiRiepilogo", last))
|
||||
if (corpo != nullptr)
|
||||
{
|
||||
TString natura = riepilogo->GetEnclosedText("Natura");
|
||||
int last = 0;
|
||||
|
||||
for (TXmlItem * riepilogo = corpo->FindChild("DatiRiepilogo", last); riepilogo != nullptr; riepilogo = corpo->FindChild("DatiRiepilogo", last))
|
||||
{
|
||||
TString natura = riepilogo->GetEnclosedText("Natura");
|
||||
|
||||
if (natura.starts_with("N6"))
|
||||
{
|
||||
if ((natura == "N6.3") || (natura == "N6.7"))
|
||||
tipodocsdi = "TD19";
|
||||
else
|
||||
tipodocsdi = "TD16";
|
||||
break;
|
||||
}
|
||||
else
|
||||
if ((natura == "N3.2") || (natura == "N3.3"))
|
||||
{
|
||||
tipodocsdi = "TD18";
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (TXmlItem * riga = corpo->FindChild("DettaglioLinee", last); riga != nullptr; riga = corpo->FindChild("DettaglioLinee", last))
|
||||
{
|
||||
TDate inizio = riga->GetEnclosedDate("DataInizioPeriodo");
|
||||
|
||||
if (tipodocsdi == "TD18" && (inizio.ok()))
|
||||
{
|
||||
tipodocsdi = "TD17";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
real totale;
|
||||
int last = 1;
|
||||
|
||||
for (TXmlItem * riga = body->FindFirstChild("DatiBeniServizi"); riga != nullptr; riga = body->FindChild("DatiBeniServizi", last))
|
||||
{
|
||||
TString natura = riga->GetEnclosedText("Natura");
|
||||
TDate inizio = riga->GetEnclosedDate("DataInizioPeriodo");
|
||||
|
||||
totale += riga->GetEnclosedReal("Importo");
|
||||
if (natura.starts_with("N6"))
|
||||
{
|
||||
if ((natura == "N6.3") || (natura == "N6.7"))
|
||||
@ -859,16 +951,7 @@ void TPassive_mask::fill_archived()
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (TXmlItem * riga = corpo->FindChild("DettaglioLinee", last); riga != nullptr; riga = corpo->FindChild("DettaglioLinee", last))
|
||||
{
|
||||
TDate inizio = riga->GetEnclosedDate("Natura");
|
||||
|
||||
if (tipodocsdi == "TD18" && (inizio.ok()))
|
||||
{
|
||||
tipodocsdi = "TD17";
|
||||
break;
|
||||
}
|
||||
}
|
||||
sf.set_row_cell(S_TOTDOCXML, totale, r);
|
||||
}
|
||||
}
|
||||
|
||||
@ -960,8 +1043,6 @@ void TPassive_mask::fill_archived()
|
||||
|
||||
if (h != nullptr)
|
||||
{
|
||||
TXmlItem * dati_trasmissione = h->FindFirstChild("DatiTrasmissione");
|
||||
|
||||
if (dati_trasmissione != nullptr)
|
||||
sf.set_row_cell(S_IDSDI, dati_trasmissione->GetEnclosedText("ProgressivoInvio"), r);
|
||||
|
||||
@ -969,11 +1050,11 @@ void TPassive_mask::fill_archived()
|
||||
|
||||
if (cp != nullptr)
|
||||
{
|
||||
TXmlItem * da = cp->FindFirstChild("DatiAnagrafici");
|
||||
TXmlItem * da = fattura_ordinaria(*dati_trasmissione) ? cp->FindFirstChild("DatiAnagrafici") : cp;
|
||||
|
||||
if (da != nullptr)
|
||||
{
|
||||
TXmlItem * anagr = da->FindFirstChild("Anagrafica");
|
||||
TXmlItem * anagr = fattura_ordinaria(*dati_trasmissione) ? da->FindFirstChild("Anagrafica") : cp;
|
||||
TString ragione_sociale;
|
||||
|
||||
if (anagr != nullptr)
|
||||
@ -1319,6 +1400,35 @@ void TPassive_mask::recupera()
|
||||
return;
|
||||
}
|
||||
|
||||
void TPassive_mask::check()
|
||||
{
|
||||
int ndocs = 0;
|
||||
TLocalisamfile doc(LF_DOC);
|
||||
TSheet_field & sht = sfield(F_DOCS);
|
||||
TLog_report log;
|
||||
|
||||
{
|
||||
TProgress_monitor pi(sht.items(), "Diagnostica Fatture");
|
||||
|
||||
FOR_EACH_SHEET_ROW_LOOP(sht, r)
|
||||
{
|
||||
if (!pi.add_status())
|
||||
break;
|
||||
if (sht.get_bool_row_cell(r, S_SELECTED))
|
||||
{
|
||||
const int anno = sht.get_int_row_cell(r, S_ANNO);
|
||||
const long ndoc = sht.get_long_row_cell(r, S_NDOC);
|
||||
const TFixed_string codnum(sht.get_str_row_cell(r, S_CODNUM)); // lascio sapientemente per ultima la get di una stringa
|
||||
TDocumento doc('D', anno, codnum, ndoc);
|
||||
|
||||
doc.check();
|
||||
sht.set_row_cell(S_SELECTED, false, r);
|
||||
}
|
||||
}
|
||||
fill();
|
||||
}
|
||||
}
|
||||
|
||||
TDate TPassive_mask::load_data() const
|
||||
{
|
||||
TDate date = get_fp_date_var(F1_DATAINI);
|
||||
@ -1436,11 +1546,11 @@ void TPassive_app::main_loop()
|
||||
{
|
||||
TPassive_mask mask;
|
||||
|
||||
load_mask(mask);
|
||||
mask.first_focus(F_DATAINI);
|
||||
check_acquisti();
|
||||
while (mask.run() == K_ENTER) {}
|
||||
save_field(mask);
|
||||
load_mask(mask);
|
||||
mask.first_focus(F_DATAINI);
|
||||
check_acquisti();
|
||||
while (mask.run() == K_ENTER) {}
|
||||
save_field(mask);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ protected:
|
||||
|
||||
void set_filter_changed();
|
||||
void elabora(bool invia = true, bool reset_name = false, const char * stato = " ");
|
||||
void check();
|
||||
void print();
|
||||
void print_reg();
|
||||
bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
@ -40,7 +41,7 @@ protected:
|
||||
virtual bool on_key(KEY key) ;
|
||||
bool check_not_empty();
|
||||
bool check_full_fields() const;
|
||||
void fill();
|
||||
void fill(bool clear = false);
|
||||
void init();
|
||||
void force_reload_sheet();
|
||||
bool filter_changed();
|
||||
@ -151,7 +152,7 @@ bool TPAR_mask::check_full_fields() const
|
||||
return true;
|
||||
}
|
||||
|
||||
void TPAR_mask::fill()
|
||||
void TPAR_mask::fill(bool clear)
|
||||
{
|
||||
const TDate dal = get(F_DATAINI);
|
||||
const TDate al = get(F_DATAEND);
|
||||
@ -182,8 +183,10 @@ void TPAR_mask::fill()
|
||||
filter << "==\"" << filter_selected << "\"";
|
||||
|
||||
TCursor cur(new TRelation(LF_MOV), filter, 2, &from, &to);
|
||||
enable(DLG_OK, filter_selected.empty() || filter_selected == "X");
|
||||
|
||||
enable(DLG_ELABORA, filter_selected.empty() || filter_selected == "X");
|
||||
enable(DLG_FINDREC, filter_selected == "X" || filter_selected == "I" || filter_selected == "E");
|
||||
enable(DLG_CHECK_SDI, fp_has_check() && filter_selected.full());
|
||||
regs.enable_column(S_SELECTED, filter_selected.empty() || filter_selected == "X" || filter_selected == "I");
|
||||
enable(DLG_PDF, filter_selected == "X" || filter_selected == "I" || filter_selected == "E");
|
||||
enable(DLG_ALL, true);
|
||||
@ -214,7 +217,7 @@ void TPAR_mask::fill()
|
||||
const TCausale& caus = cached_causale(mov);
|
||||
const TString& tipodocsdi = caus.tipodocsdi();
|
||||
const TString & prefisso = caus.reg().prefisso();
|
||||
int r = regs.set_row_cell(S_SELECTED, true);
|
||||
int r = regs.set_row_cell(S_SELECTED, !clear);
|
||||
|
||||
regs.set_row_cell(S_ANNO, mov.get_int(MOV_ANNOES), r);
|
||||
regs.set_row_cell(S_NUMREG, mov.get(MOV_NUMREG), r);
|
||||
@ -331,6 +334,32 @@ void TPAR_mask::elabora(bool invia, bool reset_name, const char * stato)
|
||||
fill();
|
||||
}
|
||||
|
||||
void TPAR_mask::check()
|
||||
{
|
||||
int ndocs = 0;
|
||||
TLocalisamfile doc(LF_DOC);
|
||||
TSheet_field & sht = sfield(F_REGS);
|
||||
|
||||
{
|
||||
TProgress_monitor pi(sht.items(), "Diagnostica Fatture");
|
||||
|
||||
FOR_EACH_SHEET_ROW_LOOP(sht, r)
|
||||
{
|
||||
if (!pi.add_status())
|
||||
break;
|
||||
if (sht.get_bool_row_cell(r, S_SELECTED))
|
||||
{
|
||||
const long nreg = sht.get_long_row_cell(r, S_NUMREG);
|
||||
TMovimento_contabile mov(nreg);
|
||||
|
||||
mov.check();
|
||||
sht.set_row_cell(S_SELECTED, false, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
fill(true);
|
||||
}
|
||||
|
||||
void TPAR_mask::print()
|
||||
{
|
||||
|
||||
@ -462,12 +491,9 @@ bool TPAR_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
if (e == fe_modify)
|
||||
load_sheet(o.get());
|
||||
break;
|
||||
case DLG_OK:
|
||||
if (e == fe_button)
|
||||
{
|
||||
if (e == fe_button)
|
||||
elabora();
|
||||
}
|
||||
case DLG_ELABORA:
|
||||
if (e == fe_button)
|
||||
elabora();
|
||||
break;
|
||||
case DLG_PDF:
|
||||
if (e == fe_button)
|
||||
@ -525,6 +551,10 @@ bool TPAR_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
elabora(false, reset_name, stato);
|
||||
}
|
||||
break;
|
||||
case DLG_CHECK_SDI:
|
||||
if (e == fe_button)
|
||||
check();
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
if ((e == fe_modify || e >= se_enter) && jolly == 0)
|
||||
@ -539,7 +569,10 @@ void TPAR_mask::next_page(int p)
|
||||
if (filter_changed())
|
||||
fill();
|
||||
if (p == 1000)
|
||||
{
|
||||
disable(DLG_FINDREC);
|
||||
disable(DLG_CHECK_SDI);
|
||||
}
|
||||
if (ok)
|
||||
TAutomask::next_page(p);
|
||||
}
|
||||
@ -550,17 +583,19 @@ bool TPAR_mask::on_key(KEY key)
|
||||
|
||||
if (ok && curr_page() == 0)
|
||||
{
|
||||
disable(DLG_OK);
|
||||
disable(DLG_ELABORA);
|
||||
disable(DLG_PDF);
|
||||
disable(DLG_ALL);
|
||||
enable(DLG_CHECK_SDI);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
TPAR_mask::TPAR_mask() : TAutomask("fp0700a01"), _dirty(true)
|
||||
{
|
||||
disable(DLG_OK);
|
||||
disable(DLG_ELABORA);
|
||||
disable(DLG_PDF);
|
||||
enable(DLG_CHECK_SDI);
|
||||
load_all_fields();
|
||||
if (!get_fp_bool_var(FP_SEND_TD16))
|
||||
{
|
||||
|
||||
@ -63,6 +63,7 @@
|
||||
#define FP_RAGSOCP "ragsocp"
|
||||
#define FP_ADDINDSP "addindsp"
|
||||
#define FP_DUMP_VALS "dumpvals"
|
||||
#define FP_RIF_PAG "rifpag"
|
||||
// F1
|
||||
#define F1_USEDATARIC "usedataric"
|
||||
#define F1_DATAINI "datainif1"
|
||||
@ -80,7 +81,7 @@ TLog_report * get_xml_log();
|
||||
void show_xml_log();
|
||||
void copy_xml_log(TReport_book & book);
|
||||
const TString & get_numdoc_exp_fp(int numreg);
|
||||
|
||||
bool fp_has_check();
|
||||
// Compila il numero di documento per la scrittura sui paf
|
||||
// TString& complete_num_FP(con// Genera la chiave per i paf
|
||||
// Ritorna cod sdi, pec o vuoto. Chiama get_coddest()
|
||||
|
||||
@ -110,6 +110,7 @@ void check_acquisti()
|
||||
TFiles_array files(true);
|
||||
TFiles_array dest_files(true);
|
||||
TFiles_array elab(true);
|
||||
TFiles_array coded(true);
|
||||
TAnagrafica ditta(LF_NDITTE, prefix().get_codditta());
|
||||
TString paiva(ditta.stato_partita_IVA());
|
||||
TString cofi(ditta.codice_fiscale());
|
||||
@ -120,6 +121,83 @@ void check_acquisti()
|
||||
paiva << ditta.partita_IVA();
|
||||
if (!dexist(mask))
|
||||
make_dir(mask);
|
||||
|
||||
// p7m firmati
|
||||
|
||||
mask.add("*.p7m");
|
||||
if (get_fp_bool_var(FP_RECURSIVE))
|
||||
list_files_recursive(mask, coded);
|
||||
else
|
||||
list_files(mask, coded);
|
||||
FOR_EACH_ARRAY_ROW(coded, r1, riga1)
|
||||
{
|
||||
TFilename & file = coded[r1];
|
||||
TFilename name = file.name();
|
||||
TFilename xml = file;
|
||||
|
||||
xml.ext("");
|
||||
xml.ext("xml");
|
||||
{
|
||||
ifstream cd(file, ios::binary);
|
||||
ofstream xm(xml);
|
||||
bool write = false;
|
||||
long size = fsize(file);
|
||||
|
||||
cd >> std::noskipws;
|
||||
while (cd.tellg() < size)
|
||||
{
|
||||
unsigned char c;
|
||||
|
||||
cd >> c;
|
||||
if (write && c == 4)
|
||||
{
|
||||
cd >> c; // skip four chars
|
||||
cd >> c;
|
||||
cd >> c;
|
||||
cd >> c;
|
||||
}
|
||||
if (!write && c == '<')
|
||||
{
|
||||
write = true;
|
||||
continue;
|
||||
}
|
||||
if (write && c == ':')
|
||||
{
|
||||
int count = 0;
|
||||
const TString cmp("FatturaElettronica>");
|
||||
TString str;
|
||||
|
||||
while (count < cmp.len())
|
||||
{
|
||||
unsigned char c1;
|
||||
|
||||
cd >> c1;
|
||||
str << (char)c1;
|
||||
if (str[count] == cmp[count])
|
||||
count++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (count == cmp.len())
|
||||
{
|
||||
xm << c;
|
||||
xm << str;
|
||||
write = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = count; i >= 0; i--)
|
||||
cd.putback(str[i]);
|
||||
}
|
||||
}
|
||||
if (write)
|
||||
xm << c;
|
||||
}
|
||||
}
|
||||
file.fremove();
|
||||
}
|
||||
// xml e metadati
|
||||
mask = get_ext_acq_src();
|
||||
mask.add("*.xml");
|
||||
if(get_fp_bool_var(FP_RECURSIVE))
|
||||
list_files_recursive(mask, files);
|
||||
@ -129,9 +207,28 @@ void check_acquisti()
|
||||
FOR_EACH_ARRAY_ROW(files, r0, riga)
|
||||
{
|
||||
TFilename & file = files[r0];
|
||||
TFilename name = file.name();
|
||||
|
||||
name.lower();
|
||||
if (name.find("_metadato") > 0)
|
||||
{
|
||||
TFilename ini = file.path();
|
||||
|
||||
file.ext("xml");
|
||||
name = file.name();
|
||||
const int pos = name.find(".");
|
||||
|
||||
if (pos > 0)
|
||||
name.cut(pos);
|
||||
ini.add(name);
|
||||
ini.ext("ini");
|
||||
fmove(file, ini);
|
||||
files.destroy(r0);
|
||||
}
|
||||
else
|
||||
file.ext("xml");
|
||||
}
|
||||
files.pack();
|
||||
|
||||
TFilename dest = get_xml_src();
|
||||
|
||||
if (!dexist(dest))
|
||||
@ -178,7 +275,6 @@ void check_acquisti()
|
||||
{
|
||||
files -= elab;
|
||||
dest_files -= elab;
|
||||
|
||||
}
|
||||
|
||||
TProgind p(files.items(), TR("Recupero fatture di acquisto"));
|
||||
@ -192,9 +288,27 @@ void check_acquisti()
|
||||
break;
|
||||
|
||||
const TFilename & src_file = files[r];
|
||||
TFilename temp_xml_file = src_file;
|
||||
TFilename temp_dest_xml;
|
||||
TFilename temp_dest_ini;
|
||||
|
||||
if (is_remote(temp_xml_file))
|
||||
{
|
||||
TFilename temp_ini_file = temp_xml_file;
|
||||
|
||||
|
||||
temp_dest_xml.tempdir();
|
||||
temp_dest_xml.add(temp_xml_file.name());
|
||||
fcopy(temp_xml_file, temp_dest_xml, false, true);
|
||||
temp_ini_file.ext("ini");
|
||||
temp_dest_ini = temp_dest_xml;
|
||||
temp_dest_ini.ext("ini");
|
||||
fcopy(temp_ini_file, temp_dest_ini, false, true);
|
||||
temp_xml_file = temp_dest_xml;
|
||||
}
|
||||
|
||||
bool found = import_FePA;
|
||||
TXmlItem i(src_file, nullptr, "Allegati|ds:Signature", true, true);
|
||||
TXmlItem i(temp_xml_file, nullptr, "Allegati|ds:Signature", true, true);
|
||||
TString tipodocsdi = "TD01";
|
||||
|
||||
if (!found)
|
||||
@ -248,7 +362,7 @@ void check_acquisti()
|
||||
if (found)
|
||||
{
|
||||
TFilename & dest = (TFilename &) dest_files[r];
|
||||
TFilename ini(src_file);
|
||||
TFilename ini(temp_xml_file);
|
||||
|
||||
i.Write(dest, 0);
|
||||
ini.ext("ini");
|
||||
@ -271,6 +385,8 @@ void check_acquisti()
|
||||
move_xml_acq(dest, anno);
|
||||
}
|
||||
}
|
||||
temp_dest_xml.fremove();
|
||||
temp_dest_ini.fremove();
|
||||
}
|
||||
reset_xml_special_text();
|
||||
reset_xml_preserve_cdata();
|
||||
@ -298,7 +414,7 @@ void move_xml_acq(const TFilename &xml_name, int anno)
|
||||
{
|
||||
dest.ext("ini");
|
||||
if (dest.exist())
|
||||
remove(dest);
|
||||
dest.fremove();
|
||||
fmove(src, dest, false, true);
|
||||
}
|
||||
}
|
||||
@ -317,7 +433,7 @@ void restore_xml_acq(const TFilename &xml_name, int anno)
|
||||
if (src.exist())
|
||||
{
|
||||
if (dest.exist())
|
||||
remove(dest);
|
||||
dest.fremove();
|
||||
fmove(src, dest);
|
||||
}
|
||||
src.ext("ini");
|
||||
@ -325,7 +441,7 @@ void restore_xml_acq(const TFilename &xml_name, int anno)
|
||||
{
|
||||
dest.ext("ini");
|
||||
if (dest.exist())
|
||||
remove(dest);
|
||||
dest.fremove();
|
||||
fmove(src, dest);
|
||||
}
|
||||
}
|
||||
@ -344,7 +460,7 @@ void archive_xml_acq(const TFilename &xml_name, int anno)
|
||||
if (src.exist())
|
||||
{
|
||||
if (dest.exist())
|
||||
remove(dest);
|
||||
dest.fremove();
|
||||
fmove(src, dest, false, true);
|
||||
}
|
||||
src.ext("ini");
|
||||
@ -352,7 +468,7 @@ void archive_xml_acq(const TFilename &xml_name, int anno)
|
||||
{
|
||||
dest.ext("ini");
|
||||
if (dest.exist())
|
||||
remove(dest);
|
||||
dest.fremove();
|
||||
fmove(src, dest, false, true);
|
||||
}
|
||||
}
|
||||
@ -371,7 +487,7 @@ void retrieve_xml_acq(const TFilename &xml_name, int anno)
|
||||
if (src.exist())
|
||||
{
|
||||
if (dest.exist())
|
||||
remove(dest);
|
||||
dest.fremove();
|
||||
fmove(src, dest);
|
||||
}
|
||||
src.ext("ini");
|
||||
@ -379,7 +495,7 @@ void retrieve_xml_acq(const TFilename &xml_name, int anno)
|
||||
{
|
||||
dest.ext("ini");
|
||||
if (dest.exist())
|
||||
remove(dest);
|
||||
dest.fremove();
|
||||
fmove(src, dest);
|
||||
}
|
||||
}
|
||||
@ -510,6 +626,20 @@ const TString & get_ext_acq_src()
|
||||
return get_tmp_string() = dir;
|
||||
}
|
||||
|
||||
bool fp_has_check()
|
||||
{
|
||||
bool ok = false;
|
||||
const TString& tipo = get_fp_string_var(FP_TIPO_CHECK);
|
||||
|
||||
if (tipo == "F")
|
||||
{
|
||||
const TString& api_key = get_fp_string_var(FP_SESSION_ID);
|
||||
|
||||
ok = api_key.full();
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
TString& complete_num_fp(const TCodice_numerazione& codnum, const int numdoc)
|
||||
{
|
||||
static const int len_num_doc = TRectype(LF_DOC).length(DOC_NDOC);
|
||||
|
||||
@ -7,7 +7,7 @@ Item_01 = "Manutenzione modulo", [FPMENUF_002]
|
||||
Item_02 = "Invio fatture", "fp010 -2", ""
|
||||
Item_03 = "Invio Integrazioni", "fp010 -6", ""
|
||||
Item_04 = "Monitor Fatture Passive", "fp010 -3", ""
|
||||
Item_04 = "Ducumenti interattivi (FEPA)", "ve010 -0", ""
|
||||
Item_04 = "Documenti interattivi (FEPA)", "ve010 -0", ""
|
||||
Item_04 = "Prima nota (FEPA)", "cg012 -0", ""
|
||||
Item_05 = "FEPA", "fepa\fepa.exe", ""
|
||||
Item_06 = "Stampe", [FPMENUF_003]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user