Patch level : 12.0 1026
Files correlati : fp0.exe fp0200a.msk Commento : Corretto ricreazione annesso con stesso nome in differente categoria, corretto copia annessi cartacei
This commit is contained in:
parent
94e9a29680
commit
a65b7e20a0
@ -23,7 +23,7 @@ public:
|
||||
add_button_tool (DLG_OK, "~Conferma", TOOL_OK);
|
||||
add_button_tool (DLG_NULL, "", 0);
|
||||
add_button_tool (DLG_CANCEL, "~Annulla", TOOL_CANCEL);
|
||||
add_string (101, 0, "Nome tipo annesso:", 1, 1, 10);
|
||||
add_string (101, 0, "Nome tipo annesso:", 1, 1, 10,"U");
|
||||
add_string (102, 0, "Descrizione: ", 1, 2, 30);
|
||||
add_list (103, 0, "Tipologia annesso:", 1, 3, 21, "", "DC|RC", "Annesso Cartaceo|Prospetto Rev. Charge");
|
||||
add_boolean (104, 0, "Obbligatorio: ", 1, 4);
|
||||
@ -171,9 +171,10 @@ void TF9_categorie_doc_msk::delete_annesso(const TString& catdoc_padre)
|
||||
if (_annessi_sheet->items() > 0)
|
||||
{
|
||||
const int r = _annessi_sheet->selected();
|
||||
if (yesno_box("Eliminare l'annesso N. %d?", r + 1))
|
||||
const TString & cod_annesso = _annessi_sheet->row(r).get(0);
|
||||
if (yesno_box("Eliminare l'annesso : %s", (const char*) cod_annesso))
|
||||
{
|
||||
_categorie_doc.del_annesso(catdoc_padre, _annessi_sheet->row(r).get(0));
|
||||
_categorie_doc.del_annesso(catdoc_padre, cod_annesso);
|
||||
fill_annessi(catdoc_padre);
|
||||
}
|
||||
}
|
||||
@ -194,8 +195,7 @@ void TF9_categorie_doc_msk::edit_annesso(const TString& catdoc_padre)
|
||||
const TString& descr = new_ann.get(102);
|
||||
const TString& tipo = new_ann.get(103);
|
||||
const bool obblig = new_ann.get_bool(104);
|
||||
_categorie_doc.del_annesso(catdoc_padre, catann);
|
||||
_categorie_doc.add_annesso(catdoc_padre, catann, descr, tipo, obblig);
|
||||
_categorie_doc.edit_annesso(catdoc_padre, catann, descr, tipo, obblig);
|
||||
fill_annessi(catdoc_padre);
|
||||
}
|
||||
}
|
||||
@ -203,9 +203,8 @@ void TF9_categorie_doc_msk::edit_annesso(const TString& catdoc_padre)
|
||||
|
||||
void TF9_categorie_doc_msk::fill_annessi(const TString& catdoc)
|
||||
{
|
||||
TCategorie_doc d;
|
||||
d.set_mode_sheet(0x1E);
|
||||
_annessi_sheet = d.get_sheet_ann(catdoc);
|
||||
_categorie_doc.set_mode_sheet(0x1E);
|
||||
_annessi_sheet = _categorie_doc.get_sheet_ann(catdoc);
|
||||
_annessi_sheet->add_button(DLG_EDIT, TR("~Modifica"), K_ENTER, TOOL_EDIT);
|
||||
}
|
||||
|
||||
@ -244,7 +243,7 @@ void TF9_categorie_doc_msk::new_annesso(const TString& catdoc_padre)
|
||||
continue;
|
||||
}
|
||||
TCategorie_doc::annesso ann;
|
||||
if (!_categorie_doc.get_ann(catann, ann))
|
||||
if (!_categorie_doc.annesso_exist(catdoc_padre,catann))
|
||||
{
|
||||
const TString& descr = new_ann.get(102);
|
||||
const TString& tipo = new_ann.get(103);
|
||||
|
@ -78,6 +78,7 @@ END
|
||||
STRING F_CATDOC 10
|
||||
BEGIN
|
||||
PROMPT 1 2 "Categoria Documento"
|
||||
FLAGS "U" /*mette maiuscolo forzandolo*/
|
||||
END
|
||||
|
||||
STRING F_DESCRDOC 30
|
||||
|
@ -112,8 +112,9 @@ bool TImport_msk::catdocann_handler(TMask_field& field, KEY key)
|
||||
}
|
||||
}
|
||||
if (key == K_F9)
|
||||
{
|
||||
if (msk.get(F_CATANNPADRE).full())
|
||||
{
|
||||
const TString & catdoc_padre = msk.get(F_CATANNPADRE);
|
||||
if (catdoc_padre.full())
|
||||
{
|
||||
TArray_sheet* annessi = cd.get_sheet_ann(msk.get(F_CATANNPADRE)).get();
|
||||
|
||||
@ -123,7 +124,8 @@ bool TImport_msk::catdocann_handler(TMask_field& field, KEY key)
|
||||
{
|
||||
const char* s = annessi->row(annessi->selected()).get(0);
|
||||
TCategorie_doc::annesso annesso;
|
||||
if (cd.get_ann(s, annesso))
|
||||
|
||||
if (cd.get_ann(catdoc_padre,s, annesso))
|
||||
{
|
||||
if (annesso.opcee != "RC")
|
||||
msk.set(F_CATDOCANN, annesso.catdoc);
|
||||
@ -305,27 +307,11 @@ void TGestione_doc_cartacei_f9_msk::check_deleted()
|
||||
FOR_EACH_ARRAY_ITEM(result, nr, file)
|
||||
{
|
||||
const char* deletedfile = *(TString*)(file);
|
||||
HANDLE h_file = CreateFile(deletedfile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
FILETIME last_access_time;
|
||||
SYSTEMTIME time;
|
||||
bool flag = false;
|
||||
if (h_file != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
if (GetFileTime(h_file, NULL, &last_access_time, NULL))
|
||||
{
|
||||
FileTimeToSystemTime(&last_access_time, &time);
|
||||
TDate today = TDate(TODAY);
|
||||
if (time.wMonth < (unsigned short)today.month() - 1 ||
|
||||
time.wMonth == (unsigned short)today.month() - 1 && time.wDay <= (unsigned short)today.day())
|
||||
{
|
||||
flag = true;
|
||||
CloseHandle(h_file);
|
||||
DeleteFile(deletedfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag)
|
||||
CloseHandle(h_file);
|
||||
tm *time = altime(deletedfile);
|
||||
|
||||
if (time->tm_mon < (unsigned short)today.month() - 1 ||
|
||||
time->tm_mon == (unsigned short)today.month() - 1 && time->tm_mday <= (unsigned short)today.day())
|
||||
remove_file(deletedfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -371,9 +357,9 @@ void TGestione_doc_cartacei_f9_msk::delete_file()
|
||||
make_dir(deleted);
|
||||
deleted << filename;
|
||||
if (deleted.exist())
|
||||
DeleteFile(deleted);
|
||||
remove_file(deleted);
|
||||
// Se il file non esiste vuol dire che sto cercando di rimuovere un record che non ha il file nella cartella dei cartacei quindi non mi lamento.
|
||||
if (filecart.exist() && !MoveFile(filecart, deleted))
|
||||
if (filecart.exist() && !fmove(filecart, deleted))
|
||||
warning_box(TString("Attenzione:") << " non e' stato possibile rimuovere questo file: " << filecart);
|
||||
|
||||
if (p == 0)
|
||||
|
@ -82,7 +82,7 @@ void TF9_test_app::main_loop()
|
||||
|
||||
CHECK(preload.get_array_rows().items() > 0, "Errore aggiunta o caricamento categorie documentali.");
|
||||
TCategorie_doc::annesso annesso;
|
||||
if (preload.get_ann("GENACQ", annesso))
|
||||
if (preload.get_ann("FATTACQ","GENACQ", annesso))
|
||||
{ }
|
||||
TCategorie_doc::classe_doc get_classe_doc_right{ "ACQREV", "Fattura acq. con rev. charge", "FTA", "TD01", "052", "FA" };
|
||||
std::shared_ptr<TCategorie_doc::classe_doc> get_classe_doc = preload.get_classe_doc("ACQREV");
|
||||
@ -201,7 +201,8 @@ void TF9_test_app::main_loop()
|
||||
|
||||
TCategorie_doc::annesso annesso;
|
||||
TCategorie_doc categorie_doc;
|
||||
if(categorie_doc.get_ann("INTREVC", annesso))
|
||||
|
||||
if(categorie_doc.get_ann("FATTACQ","INTREVC", annesso))
|
||||
TEstrazione::make_prosp_int_revc(153480, annesso);
|
||||
|
||||
TString s = TEstrai_mask::get_numdoc_exp_fp(105396);
|
||||
|
@ -177,10 +177,15 @@ protected:
|
||||
public:
|
||||
void add_annesso(const TString& catdoc_padre, const TString& catdoc_ann, const TString& descr,
|
||||
const TString& class_ann, bool obblig = false);
|
||||
void edit_annesso(const TString& catdoc_padre, const TString& catdoc_ann, const TString& descr,
|
||||
const TString& class_ann, bool obblig = false);
|
||||
void add_categoria(const TString& catdoc, const TString& descr, const TString& class_sost,
|
||||
const TString& caus_sost, const TString& causcont, const TString& tipocaus);
|
||||
|
||||
bool annesso_exist(const TString& catdoc_padre, const char* catdoc_ann) { return find_annesso(catdoc_padre, catdoc_ann) != _rows_annessi.end();}
|
||||
|
||||
void del_annesso(const TString& catdoc, const char* catdoc_ann);
|
||||
bool get_ann(const TString& catann, _Out_ annesso& _Annesso_out);
|
||||
bool get_ann(const TString & catdoc, const TString& catann, _Out_ annesso& _Annesso_out);
|
||||
TString_array get_array_ann(const TString& catdoc);
|
||||
TString_array get_array_rows(bool traduci = false);
|
||||
std::shared_ptr<classe_doc> get_classe_doc(const TString& catdoc);
|
||||
|
@ -68,7 +68,7 @@ bool TEstrazione::check_annessi_oblig(const TString& catdoc, const int numreg, _
|
||||
FOR_EACH_ARRAY_ITEM(lista_cat_annessi, nr, ann)
|
||||
{
|
||||
TCategorie_doc::annesso annesso;
|
||||
const bool ok_cat = categorie_doc().get_ann(*(TToken_string*)ann, annesso);
|
||||
const bool ok_cat = categorie_doc().get_ann(catdoc,*(TToken_string*)ann, annesso);
|
||||
// Ignoro il flag obbligatorio per il prospetto di reverse charge
|
||||
if (ok_cat && annesso.obblig && annesso.opcee != "RC")
|
||||
{
|
||||
@ -201,7 +201,7 @@ void TEstrazione::copy_file_to_webapp_fld(const movimento_t& movimento) const
|
||||
TFilename dest(base);
|
||||
dest.add(categorie.get(i)).add(file.name());
|
||||
make_dir(dest.path());
|
||||
const bool f = CopyFile(file, dest, false);
|
||||
const bool f = fcopy(file, dest);
|
||||
if (!f)
|
||||
error_box("Errore nel copiare il file nella cartella di destinazione: %s", (const char*)dest);
|
||||
}
|
||||
@ -398,15 +398,9 @@ bool TEstrazione::make_prosp_int_revc(const int numreg, TCategorie_doc::annesso&
|
||||
{
|
||||
// Sposto il file nella cartella dei documenti cartacei.
|
||||
const TFilename newfile(TF9_doccart::get_full_path_file_cartaceo(tmp_file.name()));
|
||||
if (!newfile.exist())
|
||||
CopyFile(tmp_file, newfile, false);
|
||||
else
|
||||
{
|
||||
// Rimpiazzo il file
|
||||
DeleteFile(newfile);
|
||||
CopyFile(tmp_file, newfile, false);
|
||||
}
|
||||
|
||||
// if (newfile.exist())
|
||||
// DeleteFile(newfile);
|
||||
fcopy(tmp_file, newfile);
|
||||
// Controllo che non esista gia' altrimenti elimino il record
|
||||
TF9_doccart doccart;
|
||||
bool a;
|
||||
@ -1340,7 +1334,9 @@ void TCategorie_doc::load_all()
|
||||
break;
|
||||
TToken_string row(appo);
|
||||
annesso ann{ row.get(0), row.get(), row.get(), row.get(), row.get_bool() };
|
||||
_rows_annessi.insert({ row.get(1), ann });
|
||||
TToken_string key = row.get(0);
|
||||
key.add(row.get(1));
|
||||
_rows_annessi.insert({ key, ann }); //da sistemare
|
||||
}
|
||||
}
|
||||
|
||||
@ -1435,8 +1431,10 @@ const char* TCategorie_doc::traduci_class_sost(const TString& class_sost)
|
||||
|
||||
std::map<TString, TCategorie_doc::annesso>::iterator TCategorie_doc::find_annesso(const TString& catdoc_padre, const char* catdoc_ann)
|
||||
{
|
||||
auto it = _rows_annessi.find(catdoc_ann);
|
||||
if (it->second.catdocpadre == catdoc_padre)
|
||||
TToken_string key = catdoc_padre;
|
||||
key.add(catdoc_ann);
|
||||
auto it = _rows_annessi.find(key);
|
||||
if (it != _rows_annessi.end())
|
||||
return it;
|
||||
return _rows_annessi.end();
|
||||
}
|
||||
@ -1447,11 +1445,28 @@ void TCategorie_doc::add_annesso(const TString& catdoc_padre, const TString& cat
|
||||
if(!(catdoc_padre && *catdoc_padre && catdoc_ann && *catdoc_ann && class_ann && *class_ann))
|
||||
fatal_box("add_annesso failed: some parameters are NULL or keys are empty");
|
||||
annesso ann{ catdoc_padre, catdoc_ann, descr, class_ann, obblig };
|
||||
_rows_annessi.insert({ catdoc_padre, ann });
|
||||
TToken_string key = catdoc_padre;
|
||||
key.add(catdoc_ann);
|
||||
_rows_annessi.insert({ key, ann });
|
||||
|
||||
save_ann();
|
||||
}
|
||||
|
||||
void TCategorie_doc::edit_annesso(const TString& catdoc_padre, const TString& catdoc_ann, const TString& descr,
|
||||
const TString& class_ann, const bool obblig)
|
||||
{
|
||||
if (!(catdoc_padre && *catdoc_padre && catdoc_ann && *catdoc_ann && class_ann && *class_ann))
|
||||
fatal_box("add_annesso failed: some parameters are NULL or keys are empty");
|
||||
annesso ann{ catdoc_padre, catdoc_ann, descr, class_ann, obblig };
|
||||
if (find_annesso(catdoc_padre,catdoc_ann) != _rows_annessi.end())
|
||||
del_annesso(catdoc_padre,catdoc_ann);
|
||||
TToken_string key = catdoc_padre;
|
||||
key.add(catdoc_ann);
|
||||
_rows_annessi.insert({ key, ann });
|
||||
|
||||
save_ann();
|
||||
}
|
||||
|
||||
void TCategorie_doc::add_categoria(const TString& catdoc, const TString& descr, const TString& class_sost, const TString& caus_sost,
|
||||
const TString& causcont, const TString& tipocaus)
|
||||
{
|
||||
@ -1472,13 +1487,18 @@ void TCategorie_doc::del_annesso(const TString& catdoc, const char* catdoc_ann)
|
||||
}
|
||||
}
|
||||
|
||||
bool TCategorie_doc::get_ann(const TString& catann, _Out_ annesso& _Annesso_out)
|
||||
bool TCategorie_doc::get_ann(const TString & catdoc ,const TString& catann, _Out_ annesso& _Annesso_out)
|
||||
{
|
||||
const map<TString, annesso>::iterator it = _rows_annessi.find(catann);
|
||||
if (it != _rows_annessi.end())
|
||||
TToken_string key = catdoc;
|
||||
key.add(catann);
|
||||
const map<TString, annesso>::iterator it = _rows_annessi.find(key);
|
||||
if (it != _rows_annessi.end() )
|
||||
{
|
||||
_Annesso_out = it->second;
|
||||
return true;
|
||||
if (it->first == catdoc)
|
||||
{
|
||||
_Annesso_out = it->second;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1543,6 +1563,10 @@ std::shared_ptr<TArray_sheet> TCategorie_doc::get_sheet_catdocs()
|
||||
std::shared_ptr<TArray_sheet> TCategorie_doc::get_sheet_ann(const TString& catdoc)
|
||||
{
|
||||
auto it = find_sheet_annessi(catdoc);
|
||||
if (it != _sheets_annessi.end())
|
||||
_sheets_annessi.erase(it);
|
||||
|
||||
it = find_sheet_annessi(catdoc);
|
||||
if (it == _sheets_annessi.end())
|
||||
{
|
||||
TString title; title << "Annessi della Categoria " << catdoc;
|
||||
@ -1551,23 +1575,21 @@ std::shared_ptr<TArray_sheet> TCategorie_doc::get_sheet_ann(const TString& catdo
|
||||
"Classificazione\nAnnesso@14|Obbligatorio@8",
|
||||
_mode_sheet);
|
||||
const auto inserted = _sheets_annessi.insert(_sheets_annessi.end(), { catdoc, sheet });
|
||||
const TString_array aann = get_array_ann(catdoc);
|
||||
if (!aann.empty())
|
||||
{
|
||||
FOR_EACH_ARRAY_ITEM(aann, nr, r)
|
||||
const TString_array & aann = get_array_ann(catdoc);
|
||||
|
||||
FOR_EACH_ARRAY_ITEM(aann, nr, r)
|
||||
{
|
||||
TToken_string& row = *(TToken_string*)r;
|
||||
std::map<TString, annesso>::iterator it_ann = find_annesso(catdoc, row.get(0));
|
||||
if(it_ann != _rows_annessi.end())
|
||||
{
|
||||
TToken_string& row = *(TToken_string*)r;
|
||||
std::map<TString, annesso>::iterator it_ann = find_annesso(catdoc, row.get(0));
|
||||
if(it_ann != _rows_annessi.end())
|
||||
{
|
||||
const annesso& ann = it_ann->second;
|
||||
TToken_string t;
|
||||
t.add(ann.catdoc);
|
||||
t.add(ann.descr);
|
||||
t.add(ann.opcee);
|
||||
t.add(ann.obblig ? "X" : "");
|
||||
sheet->add(t);
|
||||
}
|
||||
const annesso& ann = it_ann->second;
|
||||
TToken_string t;
|
||||
t.add(ann.catdoc);
|
||||
t.add(ann.descr);
|
||||
t.add(ann.opcee);
|
||||
t.add(ann.obblig ? "X" : "");
|
||||
sheet->add(t);
|
||||
}
|
||||
}
|
||||
it = inserted; // Per restituirlo anche vuoto.
|
||||
|
@ -136,16 +136,16 @@ bool TF9_doccart::add_cart(const TFilename& file, const TString& numreg, const b
|
||||
TFilename fdestin = F9CONF.get_addr_cart();
|
||||
const TString filename = file.name();
|
||||
fdestin << filename;
|
||||
const bool ok = CopyFile(file, fdestin, true);
|
||||
bool ok = true;
|
||||
if ((!suppress_errors) && ( fdestin.exist() ))
|
||||
ok = yesno_box("Esiste già un file con questo nome, devo continuare?");
|
||||
|
||||
if (ok)
|
||||
ok = fcopy(file, fdestin);
|
||||
if (!ok)
|
||||
{
|
||||
if (!suppress_errors)
|
||||
{
|
||||
if (fdestin.exist())
|
||||
warning_box("Errore nel copiare il file nella cartella di destinazione.\nEsiste gia' un file con questo nome.");
|
||||
else
|
||||
warning_box("Errore nel copiare il file nella cartella di destinazione. Ritentare.");
|
||||
}
|
||||
f9docs.zero();
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user