Aggiunto codebase 5.1.
- bacnvid e' l'applicazione di conversione. - bacnv contiene l'applicazione di conversione a qualsiasi formato. git-svn-id: svn://10.65.10.50/trunk@1534 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
76a217510a
commit
c880db2a71
124
ba/ba1100.cpp
124
ba/ba1100.cpp
@ -416,7 +416,10 @@ void TManutenzione_app::edit_riga (long riga_sel, TToken_string& riga)
|
||||
if (eox != oldeox)
|
||||
{
|
||||
d.get(logicnum);
|
||||
if (!fexist(d.name())) f.build(eox);
|
||||
TFilename f_name(d.name());
|
||||
f_name.ext("dbf");
|
||||
|
||||
if (!fexist(f_name)) f.build(eox);
|
||||
else f.extend(eox);
|
||||
_browse->dir()->get(logicnum, _nolock, _nordir, _sysdirop);
|
||||
}
|
||||
@ -544,33 +547,91 @@ void TManutenzione_app::update_dir()
|
||||
prefix().set("");
|
||||
d1.get(i);
|
||||
|
||||
const TFilename fd(d1.name());
|
||||
TFilename fd(d1.name());
|
||||
|
||||
prefix().set(pref);
|
||||
d1.get(i);
|
||||
const TFilename fs(d1.name());
|
||||
TFilename fs(d1.name());
|
||||
|
||||
fs.ext("dbf");
|
||||
fd.ext("dbf");
|
||||
|
||||
if (fexist(fs))
|
||||
{
|
||||
TFilename path(fd.path());
|
||||
path.rtrim(1);
|
||||
if (!fexist(path))
|
||||
ok = make_dir(path);
|
||||
ok = make_dir(path);
|
||||
if (ok && fcopy(fs, fd))
|
||||
{
|
||||
const TFilename fsi(CGetIdxName((char *)(const char *)fs));
|
||||
const TFilename fdi(CGetIdxName((char *)(const char *)fd));
|
||||
|
||||
if (fcopy(fsi, fdi))
|
||||
TToken_string ts(10),td(10);
|
||||
td.cut(0);
|
||||
get_idx_names(i,ts); // Get index names of current file in current dir
|
||||
for (int j=1; j<= ts.items() && ok; j++)
|
||||
{
|
||||
remove(fs);
|
||||
remove(fsi);
|
||||
}
|
||||
else
|
||||
{
|
||||
remove(fd);
|
||||
ok = FALSE;
|
||||
}
|
||||
const TFilename fsi(ts.get());
|
||||
TFilename fdi(fd); // Nuovo nome. (Con l'estensione)
|
||||
fdi.ext("");
|
||||
fdi.rtrim(1);
|
||||
if (j > 1) // Means that more indexes are in TToken_string ts
|
||||
{
|
||||
TString xx=fdi.name();
|
||||
if (xx.len() < 8)
|
||||
fdi << ('0' + j);
|
||||
else
|
||||
fdi[8] = ('0' + j);
|
||||
}
|
||||
fdi.ext(fsi.ext());
|
||||
td.add(fdi);
|
||||
if (!fcopy(fsi, fdi))
|
||||
ok = FALSE;
|
||||
}
|
||||
if (ok)
|
||||
{
|
||||
remove(fs); // Rimuove i files sorgenti. Crea un eventuale .cgp
|
||||
fd.ext("cgp");
|
||||
FILE *o;
|
||||
if (ts.items() > 1)
|
||||
{
|
||||
fs.ext("cgp");
|
||||
remove(fs);
|
||||
o=fopen(fd,"w");
|
||||
}
|
||||
ts.restart();
|
||||
td.restart();
|
||||
for (int j=1; j<=ts.items(); j++)
|
||||
{
|
||||
remove(ts.get());
|
||||
if (ts.items() > 1) // Means that fd.cgp must be created
|
||||
{
|
||||
TFilename ff=td.get();
|
||||
ff.ext("");
|
||||
ff.rtrim(1);
|
||||
fprintf(o,"%s\n",ff.name());
|
||||
}
|
||||
}
|
||||
fclose(o);
|
||||
}
|
||||
else
|
||||
{
|
||||
remove(fd); // Remove all destinations written
|
||||
td.restart();
|
||||
for (int j=1; j<=td.items(); j++)
|
||||
remove(td.get());
|
||||
}
|
||||
// const TFilename fsi(CGetIdxName((char *)(const char *)fs));
|
||||
// const TFilename fdi(CGetIdxName((char *)(const char *)fd));
|
||||
//
|
||||
// if (fcopy(fsi, fdi))
|
||||
// {
|
||||
// remove(fs);
|
||||
// remove(fsi);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// remove(fd);
|
||||
// ok = FALSE;
|
||||
// }
|
||||
}
|
||||
else
|
||||
ok = FALSE;
|
||||
@ -638,22 +699,27 @@ void TManutenzione_app::convert_dir()
|
||||
p.addstatus(1);
|
||||
prefix().set("");
|
||||
r.get(i);
|
||||
d.get(i);
|
||||
const int module = abs((int)d.flags());
|
||||
prefix().set(pref);
|
||||
TSystemisamfile f(i);
|
||||
d.get(i);
|
||||
if (d.len() != 0)
|
||||
{
|
||||
const int module = abs((int)d.flags());
|
||||
prefix().set(pref);
|
||||
TSystemisamfile f(i);
|
||||
|
||||
f.update(r);
|
||||
d.get(i, _nolock, _nordir, _sysdirop);
|
||||
bool to_create = (is_com ? d.is_com() : d.is_firm());
|
||||
f.update(r);
|
||||
d.get(i, _nolock, _nordir, _sysdirop);
|
||||
bool to_create = (is_com ? d.is_com() : d.is_firm());
|
||||
|
||||
if (to_create && has_module(module, CHK_DONGLE))
|
||||
{
|
||||
d.get(i);
|
||||
if (!fexist(d.name()))
|
||||
if (to_create && has_module(module, CHK_DONGLE))
|
||||
{
|
||||
TSystemisamfile f(i);
|
||||
f.build(10L);
|
||||
d.get(i);
|
||||
TFilename s(d.name());
|
||||
s.ext("dbf");
|
||||
if (!fexist(s))
|
||||
{
|
||||
TSystemisamfile f(i);
|
||||
f.build(10L);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
143
ba/bacnv.cpp
143
ba/bacnv.cpp
@ -21,6 +21,122 @@
|
||||
|
||||
#define usage "Errore - uso : bacnv [1|2|3|4] ditta"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Applicazione di conversione archivi XBase, valida per tutti e 4 i tipi di DLL
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class TConversione_xbase : public TApplication
|
||||
{
|
||||
|
||||
protected:
|
||||
virtual bool create () ;
|
||||
virtual bool destroy();
|
||||
void update();
|
||||
void convert_dir();
|
||||
int convert_file(int logicnum);
|
||||
|
||||
public:
|
||||
TConversione_xbase() {}
|
||||
~TConversione_xbase() {}
|
||||
|
||||
};
|
||||
|
||||
bool TConversione_xbase::create() // initvar e arrmask
|
||||
|
||||
{
|
||||
TApplication::create();
|
||||
|
||||
update();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool TConversione_xbase::destroy() // releasev e arrmask
|
||||
|
||||
{
|
||||
return TApplication::destroy() ;
|
||||
}
|
||||
|
||||
int TConversione_xbase::convert_file(int logicnum)
|
||||
|
||||
{
|
||||
int err = NOERR;
|
||||
TSystemisamfile f(logicnum);
|
||||
|
||||
err=f.pack(); // Pack data and index, so rebuild indexes according to present DLL, leaving old indexes
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void TConversione_xbase::convert_dir()
|
||||
|
||||
{
|
||||
const TString pref(prefix().name());
|
||||
const bool is_com = prefix().is_com();
|
||||
TDir d;
|
||||
|
||||
d.get(LF_DIR);
|
||||
const int items = (int)d.eod();
|
||||
TString80 s("Aggiornamento archivi ");
|
||||
|
||||
if (pref == "com") s << "comuni";
|
||||
else s << " della ditta " << atol (pref);
|
||||
|
||||
TProgind p((long)(items ? items : 1), s, TRUE, TRUE, 70);
|
||||
|
||||
p.setstatus(1L);
|
||||
|
||||
for (int i = 2; i <= items; i++)
|
||||
{
|
||||
p.setstatus((long)(i+1));
|
||||
d.get(i, _nolock, _nordir, _sysdirop);
|
||||
|
||||
const bool to_convert = (is_com ? d.is_com() : d.is_firm());
|
||||
|
||||
if (to_convert && d.len() > 0)
|
||||
convert_file(i);
|
||||
}
|
||||
}
|
||||
|
||||
void TConversione_xbase::update()
|
||||
|
||||
{
|
||||
long firm = get_firm();
|
||||
TString pref;
|
||||
if (firm == 0) pref = prefix().name();
|
||||
|
||||
do_events();
|
||||
begin_wait();
|
||||
|
||||
prefix().set("com");
|
||||
convert_dir();
|
||||
|
||||
TLocalisamfile ditte(LF_NDITTE);
|
||||
|
||||
set_autoload_new_files(FALSE);
|
||||
for (ditte.first(); !ditte.eof(); ditte.next())
|
||||
{
|
||||
const long codditta = ditte.get_long("CODDITTA");
|
||||
const TRecnotype rec = ditte.recno();
|
||||
|
||||
if (prefix().exist(codditta))
|
||||
{
|
||||
set_firm(codditta);
|
||||
convert_dir();
|
||||
}
|
||||
}
|
||||
if (firm > 0) set_firm(firm);
|
||||
else prefix().set(pref);
|
||||
set_autoload_new_files(TRUE);
|
||||
end_wait();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Applicazione di conversione archivi
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
class TConversione_archivi : public TApplication
|
||||
{
|
||||
int _nconv;
|
||||
@ -203,7 +319,7 @@ void TConversione_archivi::contropartita_rmov()
|
||||
|
||||
void TConversione_archivi::liala(const char* table)
|
||||
{
|
||||
TString16 tab(table);
|
||||
TString16 tab(table);
|
||||
|
||||
TTable lia(tab);
|
||||
tab.insert("%", 0);
|
||||
@ -334,10 +450,14 @@ void TConversione_archivi::convert_patty()
|
||||
}
|
||||
TAssoc_array causarr;
|
||||
|
||||
TLocalisamfile caus(LF_CAUSALI);
|
||||
TDir d;
|
||||
d.get(LF_CAUS,_nolock,_nordir,_sysdirop);
|
||||
if (d.is_com())
|
||||
d.get(LF_CAUS,_nolock,_comdir);
|
||||
|
||||
if (caus.items() > 0L)
|
||||
if (d.eod() > 0L)
|
||||
{
|
||||
TLocalisamfile caus(LF_CAUSALI);
|
||||
for (caus.first(_lock); caus.good(); caus.next(_lock))
|
||||
{
|
||||
const TString16 tpd(caus.get("TIPODOC"));
|
||||
@ -356,7 +476,6 @@ if (caus.items() > 0L)
|
||||
caus.rewrite();
|
||||
}
|
||||
}
|
||||
TDir d;
|
||||
const bool topatch = causarr.items() > 0;
|
||||
|
||||
d.get(LF_MOV);
|
||||
@ -424,14 +543,22 @@ int main(int argc,char** argv)
|
||||
{
|
||||
const int r = (argc > 1) ? atoi(argv[1]) : 0;
|
||||
|
||||
if (r <= 0 || r > 5)
|
||||
if (r < 0 || r > 5)
|
||||
{
|
||||
error_box(usage);
|
||||
return 100;
|
||||
}
|
||||
|
||||
TConversione_archivi a ;
|
||||
a.run(argc, argv, "Conversione archivi");
|
||||
else
|
||||
if (r==0)
|
||||
{
|
||||
TConversione_xbase a;
|
||||
a.run(argc,argv, "Conversione archivi di xBase");
|
||||
}
|
||||
else
|
||||
{
|
||||
TConversione_archivi a ;
|
||||
a.run(argc, argv, "Conversione archivi");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
388
ba/bacnvid.cpp
Executable file
388
ba/bacnvid.cpp
Executable file
@ -0,0 +1,388 @@
|
||||
#include <applicat.h>
|
||||
#include <isam.h>
|
||||
#include <date.h>
|
||||
#include <prefix.h>
|
||||
#include <progind.h>
|
||||
#include <urldefid.h>
|
||||
#include <utility.h>
|
||||
|
||||
#define DAYBIAS 36525L
|
||||
#define DAYYEAR 365
|
||||
|
||||
extern "C" {
|
||||
int CGetFieldBuff(char *, RecDes *, char *, char *);
|
||||
int findfld(RecDes *, const char *);
|
||||
};
|
||||
|
||||
|
||||
byte m1[12] = {31,28,31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
||||
int m2[12] = {31,59,90,120,151,181,212,243,273,304,334,365};
|
||||
|
||||
enum what {_date,_isam};
|
||||
|
||||
HIDDEN int CGetField(const char *fieldname,RecDes* recd,RecType recin,long* d)
|
||||
|
||||
{
|
||||
int p, i;
|
||||
unsigned int off;
|
||||
byte len;
|
||||
char *s1, s[10];
|
||||
|
||||
if ((p = findfld(recd, fieldname)) != -1)
|
||||
{
|
||||
off = recd->Fd[p].RecOff;
|
||||
len = recd->Fd[p].Len;
|
||||
if (recd->Fd[p].TypeF != _datefld)
|
||||
{
|
||||
while ((recin[off] == ' ') && (len))
|
||||
{
|
||||
off++;
|
||||
len--;
|
||||
}
|
||||
}
|
||||
if (len)
|
||||
{
|
||||
s1 = recin + off;
|
||||
for (i = 0; i < len; i++) s[i] = s1[i];
|
||||
s[len] = '\0';
|
||||
while ((len) && (s[len - 1] == ' ')) s[--len] = '\0';
|
||||
}
|
||||
else strcpy(s, "");
|
||||
if (recd->Fd[p].TypeF == _datefld)
|
||||
{
|
||||
if (strlen(s)) *d=atol(s);
|
||||
else *d=0;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
fatal_box("Non esiste il campo %s", fieldname);
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class TIsam_date_converter : public TApplication
|
||||
{
|
||||
|
||||
protected:
|
||||
virtual bool create () ;
|
||||
virtual bool destroy();
|
||||
void update();
|
||||
void Iupdate_dir();
|
||||
void convert_dir(const what conversion);
|
||||
int Iconvert_file(int logicnum);
|
||||
void Dconvert_file(int logicnum);
|
||||
|
||||
public:
|
||||
TIsam_date_converter() {}
|
||||
~TIsam_date_converter() {}
|
||||
|
||||
};
|
||||
|
||||
bool TIsam_date_converter::create() // initvar e arrmask
|
||||
|
||||
{
|
||||
TApplication::create();
|
||||
|
||||
update();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool TIsam_date_converter::destroy() // releasev e arrmask
|
||||
|
||||
{
|
||||
return TApplication::destroy() ;
|
||||
}
|
||||
|
||||
void TIsam_date_converter::update()
|
||||
|
||||
{
|
||||
long firm = get_firm();
|
||||
TString pref;
|
||||
if (firm == 0) pref = prefix().name();
|
||||
|
||||
do_events();
|
||||
begin_wait();
|
||||
// Converte i files in formato DBIII, FOXPRO...
|
||||
prefix().set("");
|
||||
Iupdate_dir();
|
||||
prefix().set("com");
|
||||
Iupdate_dir();
|
||||
convert_dir(_isam);
|
||||
|
||||
TLocalisamfile ditte(LF_NDITTE);
|
||||
|
||||
set_autoload_new_files(FALSE);
|
||||
for (ditte.first(); !ditte.eof(); ditte.next())
|
||||
{
|
||||
const long codditta = ditte.get_long("CODDITTA");
|
||||
const TRecnotype rec = ditte.recno();
|
||||
|
||||
if (prefix().exist(codditta))
|
||||
{
|
||||
set_firm(codditta);
|
||||
Iupdate_dir();
|
||||
convert_dir(_isam);
|
||||
}
|
||||
}
|
||||
|
||||
// Converte le date in ANSI.
|
||||
prefix().set("com");
|
||||
convert_dir(_date);
|
||||
for (ditte.first(); !ditte.eof(); ditte.next())
|
||||
{
|
||||
const long codditta = ditte.get_long("CODDITTA");
|
||||
const TRecnotype rec = ditte.recno();
|
||||
|
||||
if (prefix().exist(codditta))
|
||||
{
|
||||
set_firm(codditta);
|
||||
convert_dir(_date);
|
||||
}
|
||||
}
|
||||
|
||||
if (firm > 0) set_firm(firm);
|
||||
else prefix().set(pref);
|
||||
set_autoload_new_files(TRUE);
|
||||
end_wait();
|
||||
}
|
||||
|
||||
void TIsam_date_converter::Iupdate_dir()
|
||||
|
||||
{
|
||||
TDir d;
|
||||
|
||||
d.get(LF_DIR);
|
||||
const int items = (int)d.eod();
|
||||
TString80 s("Aggiornamento direttorio ");
|
||||
TString pref(prefix().name());
|
||||
|
||||
if (pref.empty()) s << "standard";
|
||||
else
|
||||
if (pref == "com") s << "comune";
|
||||
else s << " della ditta " << atol (pref);
|
||||
|
||||
TProgind p((long)(items ? items : 1), s, TRUE, TRUE, 70);
|
||||
|
||||
p.setstatus(1L);
|
||||
for (int i = 2; i <= items; i++)
|
||||
{
|
||||
p.addstatus(1L);
|
||||
d.get(i, _nolock, _nordir, _sysdirop);
|
||||
|
||||
TFilename s(d.name());
|
||||
|
||||
s.ext("");
|
||||
strcpy((char *) d.name(), s);
|
||||
d.put(i, _nordir, _sysdirop);
|
||||
}
|
||||
}
|
||||
|
||||
void TIsam_date_converter::convert_dir(const what conversion)
|
||||
|
||||
{
|
||||
const TString pref(prefix().name());
|
||||
const bool is_com = prefix().is_com();
|
||||
TDir d;
|
||||
|
||||
d.get(LF_DIR);
|
||||
const int items = (int)d.eod();
|
||||
TString80 s("Aggiornamento archivi ");
|
||||
|
||||
if (pref == "com") s << "comuni";
|
||||
else s << " della ditta " << atol (pref);
|
||||
|
||||
TProgind p((long)(items ? items : 1), s, TRUE, TRUE, 70);
|
||||
|
||||
p.setstatus(1L);
|
||||
|
||||
for (int i = 2; i <= items; i++)
|
||||
{
|
||||
p.setstatus((long)(i+1));
|
||||
d.get(i, _nolock, _nordir, _sysdirop);
|
||||
|
||||
const bool to_convert = (is_com ? d.is_com() : d.is_firm());
|
||||
|
||||
if (to_convert)
|
||||
{
|
||||
if (conversion == _isam)
|
||||
Iconvert_file(i);
|
||||
else
|
||||
Dconvert_file(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int TIsam_date_converter::Iconvert_file(int logicnum)
|
||||
|
||||
{
|
||||
TDir dir;
|
||||
TTrec r;
|
||||
int err = NOERR;
|
||||
|
||||
r.get(logicnum);
|
||||
RecDes *rd=r.rec();
|
||||
const int nflds = r.fields();
|
||||
|
||||
dir.get(logicnum);
|
||||
if (dir.len() == 0) return 0;
|
||||
const char * fp = dir.name();
|
||||
TFilename old(fp);
|
||||
const TRecnotype nitems = dir.eod();
|
||||
TFile f(dir.len());
|
||||
|
||||
old.ext("dta");
|
||||
if (fexist(old))
|
||||
{
|
||||
f.open(old);
|
||||
{
|
||||
TSystemisamfile newfile(logicnum);
|
||||
|
||||
if (newfile.build(10) != NOERR)
|
||||
fatal_box("Non riesco a creare il file %s : errore n. %d", fp, newfile.status());
|
||||
}
|
||||
|
||||
char * _field= new char [r.len()];
|
||||
TString s(80);
|
||||
TToken_string ts(128); // Build token_string with the names of date fields
|
||||
for (int j=0; j<r.fields(); j++)
|
||||
if (rd->Fd[j].TypeF == _datefld)
|
||||
ts.add(rd->Fd[j].Name);
|
||||
|
||||
s.format("Aggiornamento archivio %s", fp);
|
||||
TProgind p((long)(nitems ? nitems : 1), s, TRUE, TRUE, 70);
|
||||
TLocalisamfile newfile(logicnum);
|
||||
TRecnotype i;
|
||||
for (i = 1; newfile.good() && i <= dir.eod(); i++)
|
||||
{
|
||||
f.read(newfile.curr().string(),i);
|
||||
ts.restart();
|
||||
if (newfile.curr().string()[0] == NULL)
|
||||
{
|
||||
for (int j=0; j<ts.items(); j++)
|
||||
{
|
||||
CGetFieldBuff((char*)ts.get(),rd,newfile.curr().string(),_field);
|
||||
newfile.curr().put(ts.get(j),_field);
|
||||
}
|
||||
newfile.curr().recall();
|
||||
}
|
||||
else
|
||||
newfile.curr().discard();
|
||||
if ((i % 50) == 0) p.setstatus((long)(i + 1));
|
||||
if (!newfile.curr().isdeleted())
|
||||
newfile.write();
|
||||
}
|
||||
p.setstatus((long)nitems);
|
||||
f.close();
|
||||
if (_field != NULL)
|
||||
delete _field;
|
||||
if (newfile.good())
|
||||
{
|
||||
old.ext("dta");
|
||||
::remove(old);
|
||||
old.ext("ndx");
|
||||
::remove(old);
|
||||
}
|
||||
else
|
||||
error_box("Errore nella conversione dell' archivio %s : n.ro %d",
|
||||
fp, newfile.status());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Crea il file se non esiste il relativo .DTA.
|
||||
const TString pref(prefix().name());
|
||||
const bool is_com = prefix().is_com();
|
||||
|
||||
prefix().set("");
|
||||
dir.get(logicnum);
|
||||
const int module = abs((int)dir.flags());
|
||||
prefix().set(pref);
|
||||
dir.get(logicnum, _nolock, _nordir, _sysdirop);
|
||||
bool to_create = (is_com ? dir.is_com() : dir.is_firm());
|
||||
if (to_create && has_module(module, CHK_DONGLE))
|
||||
{
|
||||
dir.get(logicnum);
|
||||
TFilename s(dir.name());
|
||||
s.ext("dbf");
|
||||
if (!fexist(s)) // Crea il file solo se non esiste il .DBF
|
||||
{
|
||||
TSystemisamfile f(logicnum);
|
||||
f.build(10L);
|
||||
}
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
void TIsam_date_converter::Dconvert_file(int logicnum)
|
||||
|
||||
{
|
||||
TDir dir;
|
||||
TTrec r;
|
||||
int err = NOERR;
|
||||
|
||||
r.get(logicnum);
|
||||
RecDes *rd=r.rec();
|
||||
const int nflds = r.fields();
|
||||
|
||||
dir.get(logicnum);
|
||||
if (dir.len() == 0) return;
|
||||
const TRecnotype nitems = dir.eod();
|
||||
const char* file_name = dir.name();
|
||||
|
||||
TToken_string ts(128); // Build token_string with the names of date fields and logical fields
|
||||
TToken_string tslog(128);
|
||||
for (int j=0; j<r.fields(); j++)
|
||||
if (rd->Fd[j].TypeF == _datefld)
|
||||
ts.add(rd->Fd[j].Name);
|
||||
else
|
||||
if (rd->Fd[j].TypeF == _boolfld)
|
||||
tslog.add(rd->Fd[j].Name);
|
||||
|
||||
if (ts.items() > 0 || tslog.items() > 0)
|
||||
{
|
||||
TString s(80);
|
||||
s.format("Aggiornamento archivio %s", file_name);
|
||||
TProgind p((long)(nitems ? nitems : 1), s, TRUE, TRUE, 70);
|
||||
TLocalisamfile ifile(logicnum);
|
||||
ifile.readat(1);
|
||||
for (TRecnotype i = 1; ifile.good() && i <= ifile.items(); i++)
|
||||
{
|
||||
ts.restart();
|
||||
tslog.restart();
|
||||
for (int j=1; j <= ts.items(); j++)
|
||||
{
|
||||
const char* field_name=ts.get();
|
||||
long wd;
|
||||
CGetField(field_name,rd,ifile.curr().string(),&wd);
|
||||
TDate d(wd);
|
||||
ifile.curr().put(field_name,d);
|
||||
}
|
||||
for (j=1; j<= tslog.items(); j++)
|
||||
{
|
||||
const char* field_name=tslog.get();
|
||||
TString value;
|
||||
value=ifile.curr().get_str(field_name);
|
||||
ifile.curr().put(field_name,value == "X");
|
||||
}
|
||||
ifile.rewriteat(i);
|
||||
if (i < ifile.items())
|
||||
{
|
||||
ifile.readat(i+1);
|
||||
if ((i %50) == 0) p.setstatus(i+1);
|
||||
}
|
||||
}
|
||||
p.setstatus(nitems);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
TIsam_date_converter a;
|
||||
|
||||
a.run(argc, argv, "Conversione a CodeBase");
|
||||
return 0;
|
||||
}
|
||||
|
7
ba/bacnvid.url
Executable file
7
ba/bacnvid.url
Executable file
@ -0,0 +1,7 @@
|
||||
#include <default.url>
|
||||
|
||||
/* ba1 -0 */
|
||||
MENU TASK_MENUBAR
|
||||
SUBMENU MENU_FILE "~File"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user