git-svn-id: svn://10.65.10.50/branches/R_10_00@23188 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
c950212962
commit
5977b9d122
@ -522,7 +522,9 @@ bool TSEPA_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||
break;
|
||||
case F_SHEET:
|
||||
if (e == fe_init)
|
||||
fill_sheet();
|
||||
fill_sheet();
|
||||
if (e == se_query_add || e == se_query_del)
|
||||
return false;
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
@ -553,8 +555,8 @@ protected:
|
||||
real genera_RID(const TString& PmtInfId, const TEffetto& eff, TLog_report& log);
|
||||
bool genera_dist_RID(char td, long nd, TLog_report& log);
|
||||
bool genera_SEPA_RID(const TMask& m, TLog_report& log);
|
||||
|
||||
bool genera_xml(int tipo);
|
||||
bool convert_apos(const TString& xml) const;
|
||||
bool genera_xml(int tipo, bool tuttapost);
|
||||
void completa(TDistinta& dist) const;
|
||||
|
||||
public:
|
||||
@ -1280,8 +1282,54 @@ bool TSEPA_app::genera_SEPA_RID(const TMask& msk, TLog_report& log)
|
||||
return nd > 0;
|
||||
}
|
||||
|
||||
bool TSEPA_app::convert_apos(const TString& xml) const
|
||||
{
|
||||
TString line(1024);
|
||||
char* buf = line.get_buffer();
|
||||
|
||||
TString_array text;
|
||||
|
||||
FILE* txt = NULL; fopen_s(&txt, xml, "r");
|
||||
if (!txt)
|
||||
return false;
|
||||
|
||||
bool converted = false;
|
||||
while (!feof(txt))
|
||||
{
|
||||
fgets(buf, line.size(), txt);
|
||||
for(char* a = buf; a;)
|
||||
{
|
||||
char* apos = strstr(a, "'");
|
||||
if (apos)
|
||||
{
|
||||
memcpy(apos, "'", 6);
|
||||
converted = true;
|
||||
a = apos+6;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
text.add(line);
|
||||
}
|
||||
fclose(txt);
|
||||
txt = NULL;
|
||||
|
||||
if (converted)
|
||||
{
|
||||
fopen_s(&txt, xml, "w");
|
||||
if (txt)
|
||||
{
|
||||
FOR_EACH_ARRAY_ROW(text, i, row)
|
||||
fputs(*row, txt);
|
||||
fclose(txt);
|
||||
}
|
||||
}
|
||||
|
||||
return txt != NULL;
|
||||
}
|
||||
|
||||
|
||||
bool TSEPA_app::genera_xml(int tipo)
|
||||
bool TSEPA_app::genera_xml(int tipo, bool tuttapost)
|
||||
{
|
||||
#define SEPABASE "SIAGGSE"
|
||||
|
||||
@ -1322,6 +1370,8 @@ bool TSEPA_app::genera_xml(int tipo)
|
||||
|
||||
tmp.make_absolute_path();
|
||||
|
||||
const time_t tStart = ::time(NULL);
|
||||
|
||||
DIRECTORY old_dir; xvt_fsys_get_dir(&old_dir);
|
||||
DIRECTORY new_dir; xvt_fsys_convert_str_to_dir(tmp.path(), &new_dir);
|
||||
xvt_fsys_set_dir(&new_dir);
|
||||
@ -1336,6 +1386,19 @@ bool TSEPA_app::genera_xml(int tipo)
|
||||
error_box(FR("Impossibile eseguire %s"), (const char*)tmp);
|
||||
xvt_fsys_set_dir(&old_dir);
|
||||
|
||||
if (good && tuttapost)
|
||||
{
|
||||
TString_array xmls;
|
||||
TFilename f = tipo == 8 ? _drid : _dbon; f.add("*.xml");
|
||||
list_files(f, xmls);
|
||||
FOR_EACH_ARRAY_ROW(xmls, r, xml)
|
||||
{
|
||||
const time_t tXml = xvt_fsys_file_attr(*xml, XVT_FILE_ATTR_MTIME);
|
||||
if (tXml >= tStart)
|
||||
convert_apos(*xml);
|
||||
}
|
||||
}
|
||||
|
||||
return good;
|
||||
}
|
||||
|
||||
@ -1346,6 +1409,8 @@ void TSEPA_app::main_loop()
|
||||
while (m.run() == K_ENTER)
|
||||
{
|
||||
const int tipo = m.get_int(F_TIPO);
|
||||
const bool tuttapost = m.get_bool(F_APOS);
|
||||
|
||||
TLog_report log(tipo == 8 ? "RID SEPA" : "Bonifici SEPA");
|
||||
|
||||
if (_cuc.blank())
|
||||
@ -1358,7 +1423,7 @@ void TSEPA_app::main_loop()
|
||||
genera_SEPA_BON(m, log);
|
||||
else
|
||||
genera_SEPA_RID(m, log);
|
||||
genera_xml(tipo);
|
||||
genera_xml(tipo, tuttapost);
|
||||
|
||||
log.preview();
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
#define F_PRO 207
|
||||
#define F_BANCA 208
|
||||
#define F_SHOWALL 209
|
||||
#define F_APOS 210
|
||||
#define F_SHEET 300
|
||||
|
||||
#define S_SELECT 101
|
||||
|
@ -82,6 +82,11 @@ BEGIN
|
||||
PROMPT 2 3 "Mostra anche le distinte già elaborate"
|
||||
END
|
||||
|
||||
BOOLEAN F_APOS
|
||||
BEGIN
|
||||
PROMPT 45 3 "Controlla caratteri speciali SEPA"
|
||||
END
|
||||
|
||||
SPREADSHEET F_SHEET 0 -1
|
||||
BEGIN
|
||||
PROMPT 1 5 ""
|
||||
|
Loading…
x
Reference in New Issue
Block a user