Patch level : 10.0 572
Files correlati : tc0.exe l Ricompilazione Demo : [ ] Commento : Conversione archivi CAMPO 1a versione git-svn-id: svn://10.65.10.50/trunk@19882 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
75c119d96d
commit
f1eae000b1
BIN
tc/A400TS/Domande sul trasferimento del transfer.doc
Executable file
BIN
tc/A400TS/Domande sul trasferimento del transfer.doc
Executable file
Binary file not shown.
1357
tc/A400TS/tc0900.cpp
Executable file
1357
tc/A400TS/tc0900.cpp
Executable file
File diff suppressed because it is too large
Load Diff
8
tc/A400TS/tc0900a.h
Executable file
8
tc/A400TS/tc0900a.h
Executable file
@ -0,0 +1,8 @@
|
||||
// invio dati da ebc ad teamsystem
|
||||
|
||||
#define F_CODDITTA 101
|
||||
#define F_RAGSOC 102
|
||||
#define F_INPATH 103
|
||||
#define F_INFILET 107
|
||||
#define F_PATH 105
|
||||
#define F_FILE 106
|
77
tc/A400TS/tc0900a.uml
Executable file
77
tc/A400TS/tc0900a.uml
Executable file
@ -0,0 +1,77 @@
|
||||
#include "tc0900a.h"
|
||||
|
||||
PAGE "Invio a TeamSystem da transfer AS400" -1 -1 78 20
|
||||
|
||||
GROUPBOX DLG_NULL 76 3
|
||||
BEGIN
|
||||
PROMPT 2 1 "@bDitta corrente"
|
||||
END
|
||||
|
||||
NUMBER F_CODDITTA 5
|
||||
BEGIN
|
||||
PROMPT 3 2 "Codice "
|
||||
FLAGS "FD"
|
||||
USE LF_NDITTE
|
||||
INPUT CODDITTA F_CODDITTA
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
PROMPT 23 2 ""
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 76 4
|
||||
BEGIN
|
||||
PROMPT 2 4 "Sorgente"
|
||||
END
|
||||
|
||||
STRING F_INPATH 256 39
|
||||
BEGIN
|
||||
PROMPT 3 5 "Cartella "
|
||||
DSELECT
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD TSTAInPath
|
||||
END
|
||||
|
||||
STRING F_INFILET 18
|
||||
BEGIN
|
||||
PROMPT 3 6 "File transfer "
|
||||
FIELD TSTAInFile
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 76 4
|
||||
BEGIN
|
||||
PROMPT 2 8 "Destinazione"
|
||||
END
|
||||
|
||||
STRING F_PATH 256 39
|
||||
BEGIN
|
||||
PROMPT 3 9 "Cartella "
|
||||
DSELECT
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD TSTADestPath
|
||||
END
|
||||
|
||||
STRING F_FILE 18
|
||||
BEGIN
|
||||
PROMPT 3 10 "File "
|
||||
FIELD TSTADestFile
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -1 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -1 ""
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
BIN
tc/Tracciati conversione a TeamSystem.doc
Executable file
BIN
tc/Tracciati conversione a TeamSystem.doc
Executable file
Binary file not shown.
@ -14,7 +14,7 @@ int main(int argc, char** argv)
|
||||
case 5: tc0600(argc,argv); break; //importazione PCon, Cuas, CodIVA
|
||||
case 6: tc0700(argc,argv); break; //esportazione contabilita' a TeamSystem
|
||||
case 7: tc0800(argc,argv); break; // Riclassificazione conti TeamSystem
|
||||
// case 8: tc0900(argc,argv); break; // esportazione contabilita' a TeamSystem dat transfer AS400
|
||||
case 8: tc0900(argc,argv); break; // COnverione archivi CAMPO
|
||||
default: ; tc0100(argc,argv); break;
|
||||
}
|
||||
exit(0);
|
||||
|
@ -23,18 +23,9 @@
|
||||
// TRiclassifica_cache
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TRiclassifica_cache : public TCache
|
||||
{
|
||||
TLocalisamfile _multirel;
|
||||
protected:
|
||||
virtual TObject* key2obj(const char* key);
|
||||
public:
|
||||
const char * sdecode(const char* tab, const TString& cod);
|
||||
long decode(const char* tab, const TString& cod);
|
||||
TRiclassifica_cache() : _multirel(LF_MULTIREL) { _multirel.setkey(2);}
|
||||
};
|
||||
HIDDEN const char* const __tiporicconti = "TSCONTI";
|
||||
|
||||
TObject* TRiclassifica_cache::key2obj(const char* key)
|
||||
TObject* TTSRiclassifica_cache::key2obj(const char* key)
|
||||
{
|
||||
TToken_string tok(key);
|
||||
TString8 tab, cod;
|
||||
@ -48,7 +39,7 @@ TObject* TRiclassifica_cache::key2obj(const char* key)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
long TRiclassifica_cache::decode(const char* tab, const TString& cod)
|
||||
long TTSRiclassifica_cache::decode(const char* tab, const TString& cod)
|
||||
{
|
||||
TToken_string tok;
|
||||
tok.add(tab);
|
||||
@ -57,7 +48,7 @@ long TRiclassifica_cache::decode(const char* tab, const TString& cod)
|
||||
return (ric ? atol(*ric) : 0);
|
||||
}
|
||||
|
||||
const char * TRiclassifica_cache::sdecode(const char* tab, const TString& cod)
|
||||
const char * TTSRiclassifica_cache::sdecode(const char* tab, const TString& cod)
|
||||
{
|
||||
TToken_string tok;
|
||||
tok.add(tab);
|
||||
@ -67,6 +58,34 @@ const char * TRiclassifica_cache::sdecode(const char* tab, const TString& cod)
|
||||
}
|
||||
|
||||
|
||||
const long TSbill2ricl(char & t, int gr, int co, long so)
|
||||
{
|
||||
TRecord_cache * __conti = NULL;
|
||||
|
||||
if (__conti == NULL)
|
||||
__conti = new TRecord_cache(LF_RICLPDC, 1);
|
||||
|
||||
long codricl = 0;
|
||||
if (gr > 0)
|
||||
{
|
||||
TToken_string cod;
|
||||
cod.add(__tiporicconti);
|
||||
cod.add(gr);
|
||||
cod.add(co);
|
||||
if (t <= ' ')
|
||||
cod.add(so);
|
||||
|
||||
// Provo il sottoconto ma se non riesco provo con conto e poi anche gruppo
|
||||
for (int c = 3; c > 0 && codricl <= 0; c--)
|
||||
{
|
||||
codricl = atol(__conti->get(cod, "CODICE"));
|
||||
cod.add(0, c);
|
||||
}
|
||||
}
|
||||
return codricl;
|
||||
}
|
||||
|
||||
|
||||
TTS_sender& app() { return (TTS_sender&)main_app(); }
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
@ -1243,24 +1262,12 @@ const long TTS_sender::bill2ricl(char & t, int gr, int co, long so, const bool h
|
||||
long codricl = 0;
|
||||
if (gr > 0)
|
||||
{
|
||||
const char* const tiporic = "TSCONTI";
|
||||
const bool ricl = _riclassifica.is_key(tiporic);
|
||||
const bool ricl = _riclassifica.is_key(__tiporicconti);
|
||||
|
||||
if (ricl)
|
||||
{
|
||||
TToken_string cod;
|
||||
cod.add(tiporic);
|
||||
cod.add(gr);
|
||||
cod.add(co);
|
||||
if (t <= ' ')
|
||||
cod.add(so);
|
||||
codricl = ::TSbill2ricl(t, gr, co, so);
|
||||
|
||||
// Provo il sottoconto ma se non riesco provo con conto e poi anche gruppo
|
||||
for (int c = 3; c > 0 && codricl <= 0; c--)
|
||||
{
|
||||
codricl = atol(_conti->get(cod, "CODICE"));
|
||||
cod.add(0, c);
|
||||
}
|
||||
if (codricl <= 0)
|
||||
{
|
||||
TString msg;
|
||||
@ -1435,15 +1442,13 @@ void TTS_sender::set_parameters()
|
||||
|
||||
bool TTS_sender::create()
|
||||
{
|
||||
_tabelle = new TRiclassifica_cache;
|
||||
_conti = new TRecord_cache(LF_RICLPDC, 1);
|
||||
_tabelle = new TTSRiclassifica_cache;
|
||||
set_parameters();
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
|
||||
bool TTS_sender::destroy()
|
||||
{
|
||||
delete _conti;
|
||||
delete _tabelle;
|
||||
return TSkeleton_application::destroy();
|
||||
}
|
||||
|
29
tc/tc0701.h
29
tc/tc0701.h
@ -4,16 +4,34 @@
|
||||
#include <reputils.h>
|
||||
#include <textset.h>
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TRiclassifica_cache
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TTSRiclassifica_cache : public TCache
|
||||
{
|
||||
TLocalisamfile _multirel;
|
||||
protected:
|
||||
virtual TObject* key2obj(const char* key);
|
||||
public:
|
||||
const char * sdecode(const char* tab, const TString& cod);
|
||||
long decode(const char* tab, const TString& cod);
|
||||
TTSRiclassifica_cache() : _multirel(LF_MULTIREL) { _multirel.setkey(2);}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TTS_sender
|
||||
///////////////////////////////////////////////////////////
|
||||
const long TSbill2ricl(char & t, int gr, int co, long so);
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TTS_sender
|
||||
///////////////////////////////////////////////////////////
|
||||
class TRiclassifica_cache;
|
||||
class TTS_textset;
|
||||
|
||||
class TTS_sender : public TSkeleton_application
|
||||
{
|
||||
TRiclassifica_cache* _tabelle;
|
||||
TRecord_cache* _conti;
|
||||
TTSRiclassifica_cache* _tabelle;
|
||||
TAssoc_array _riclassifica;
|
||||
TTS_textset* _tsfile;
|
||||
TLog_report* _log;
|
||||
@ -59,7 +77,8 @@ protected:
|
||||
const TString & scod2ricl(const char* tab, const TVariant& cod);
|
||||
const long cod2ricl(const char* tab, const TString& cod);
|
||||
const long cod2ricl(const char* tab, const TVariant& cod);
|
||||
const long bill2ricl(char & t, int gr, int co, long so, const bool header_cli = true);
|
||||
const long bill2ricl(char & t, int gr, int co, long so, const bool header_cli = true);
|
||||
|
||||
virtual void get_citta_provincia(const TRecordset& cli, TString & dencom, TString & provcom, bool nascita = false);
|
||||
virtual const char * decode_causale(const TRecordset& mov) { return EMPTY_STRING; }
|
||||
virtual bool test_swap(const TRecordset& mov) { return false;}
|
||||
@ -90,5 +109,5 @@ public:
|
||||
virtual bool create();
|
||||
virtual void main_loop();
|
||||
virtual bool destroy();
|
||||
TTS_sender() : _tabelle(NULL), _conti(NULL), _tsfile(NULL), _log(NULL) {}
|
||||
TTS_sender() : _tabelle(NULL), _tsfile(NULL), _log(NULL) {}
|
||||
};
|
||||
|
740
tc/tc0900.cpp
Executable file
740
tc/tc0900.cpp
Executable file
@ -0,0 +1,740 @@
|
||||
#include "tc0.h"
|
||||
#include "tc0900a.h"
|
||||
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <config.h>
|
||||
#include <lffiles.h>
|
||||
#include <progind.h>
|
||||
#include <relation.h>
|
||||
#include <reprint.h>
|
||||
#include <reputils.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
#include <clifo.h>
|
||||
#include <causali.h>
|
||||
#include <pconti.h>
|
||||
#include "tc0701.h"
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TConvert_mask
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
class TConvert_mask : public TAutomask
|
||||
{
|
||||
private:
|
||||
void serialize(bool bSave);
|
||||
protected:
|
||||
bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
public:
|
||||
TConvert_mask();
|
||||
virtual ~TConvert_mask();
|
||||
};
|
||||
|
||||
enum TConv_funcs { _conti, _tabella, _clifor, _contanal } ;
|
||||
|
||||
class TField_info : public TObject
|
||||
{
|
||||
TToken_string _fieldname;
|
||||
TConv_funcs _func;
|
||||
TString8 _table;
|
||||
TString8 _TStable;
|
||||
|
||||
public:
|
||||
TToken_string & fieldname() { return _fieldname;}
|
||||
TConv_funcs func() const { return _func;}
|
||||
const TString & table() const { return _table;}
|
||||
const TString & TStable() const { return _TStable;}
|
||||
TField_info(const char * fieldname, TConv_funcs func = _conti, const char * table = "", const char * TStable = "") :
|
||||
_fieldname(fieldname), _func(func), _table(table), _TStable(TStable) {}
|
||||
virtual ~TField_info() {}
|
||||
};
|
||||
|
||||
class TConvert_archives : public TSkeleton_application
|
||||
{
|
||||
TTSRiclassifica_cache* _tabelle;
|
||||
TLog_report _log;
|
||||
long _offsetcli;
|
||||
long _offsetfor;
|
||||
|
||||
virtual bool create();
|
||||
virtual bool destroy();
|
||||
void convert(bool comtables);
|
||||
const TString & scod2ricl(const char* tab, const TString& cod);
|
||||
const long bill2ricl(char t, int gr, int co, long so) { return TSbill2ricl(t, gr, co, so); }
|
||||
bool convert_clifo(char t, long & codcf);
|
||||
bool convert_field(TRectype & rec, TField_info & finfo);
|
||||
void convert_file(int logicnum, TArray & fieldlist);
|
||||
void convert_table(const char * tablename, TArray & fieldlist);
|
||||
|
||||
protected:
|
||||
virtual void main_loop();
|
||||
|
||||
public:
|
||||
TConvert_archives() : _log("Conversione Archivi CAMPO"), _offsetcli(0L), _offsetfor(0L) {}
|
||||
};
|
||||
|
||||
TConvert_archives& app() { return (TConvert_archives&)main_app(); }
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TConvert_mask
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
TConvert_mask::TConvert_mask() : TAutomask("tc0900a")
|
||||
{
|
||||
serialize(false);
|
||||
}
|
||||
|
||||
TConvert_mask::~TConvert_mask()
|
||||
{
|
||||
serialize(true);
|
||||
}
|
||||
|
||||
bool TConvert_mask::on_field_event(TOperable_field& f, TField_event e, long jolly)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void TConvert_mask::serialize(bool bSave)
|
||||
{
|
||||
const char* defpar = "tc";
|
||||
TConfig ini(CONFIG_DITTA, defpar);
|
||||
for (int i = fields()-1; i >= 0; i--)
|
||||
{
|
||||
TMask_field& f = fld(i);
|
||||
const TFieldref* fr = f.field();
|
||||
if (fr != NULL)
|
||||
{
|
||||
if (bSave)
|
||||
fr->write(ini, defpar, f.get());
|
||||
else
|
||||
f.set(fr->read(ini, defpar));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// TConvert_archives
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
bool TConvert_archives::create()
|
||||
{
|
||||
TLocalisamfile clifo(LF_CLIFO);
|
||||
|
||||
_tabelle = new TTSRiclassifica_cache ;
|
||||
clifo.put(CLI_TIPOCF, "C");
|
||||
clifo.put(CLI_CODCF, 1000000L);
|
||||
if (clifo.read() == NOERR)
|
||||
{
|
||||
_offsetcli = clifo.get_long(CLI_CODCF);
|
||||
clifo.prev();
|
||||
long firstcli = clifo.get_long(CLI_CODCF) + 1;
|
||||
if (firstcli > _offsetcli)
|
||||
firstcli = 1;
|
||||
_offsetcli -= firstcli;
|
||||
}
|
||||
clifo.put(CLI_TIPOCF, "F");
|
||||
clifo.put(CLI_CODCF, 1000000L);
|
||||
if (clifo.read() == NOERR)
|
||||
{
|
||||
_offsetfor = clifo.get_long(CLI_CODCF);
|
||||
clifo.prev();
|
||||
long firstfor = clifo.get_long(CLI_CODCF) + 1;
|
||||
if (firstfor > _offsetcli)
|
||||
firstfor = 1;
|
||||
_offsetcli -= firstfor;
|
||||
}
|
||||
return TSkeleton_application::create();
|
||||
}
|
||||
|
||||
bool TConvert_archives::destroy()
|
||||
{
|
||||
delete _tabelle;
|
||||
return TSkeleton_application::destroy();
|
||||
}
|
||||
|
||||
const TString & TConvert_archives::scod2ricl(const char* tab, const TString& cod)
|
||||
{
|
||||
TString & codricl = get_tmp_string();
|
||||
if (cod.full())
|
||||
codricl = _tabelle->sdecode(tab, cod);
|
||||
return codricl;
|
||||
}
|
||||
|
||||
bool TConvert_archives::convert_clifo(char t, long & codcf)
|
||||
{
|
||||
bool converted = false;
|
||||
|
||||
if (codcf >= 1000000L)
|
||||
codcf -= t == 'C' ? _offsetcli : _offsetfor;
|
||||
return converted;
|
||||
}
|
||||
bool TConvert_archives::convert_field(TRectype & rec, TField_info & finfo)
|
||||
{
|
||||
bool converted = false;
|
||||
if (finfo.fieldname().full())
|
||||
{
|
||||
TToken_string & fname = finfo.fieldname();
|
||||
switch (finfo.func())
|
||||
{
|
||||
case _conti :
|
||||
{
|
||||
const char * ftipo = fname.get(0);
|
||||
char t = 'X';
|
||||
|
||||
if (ftipo && *ftipo)
|
||||
t = rec.get(ftipo)[0];
|
||||
int gr = rec.get_int(fname.get());
|
||||
int co = rec.get_int(fname.get());
|
||||
if (t == 'X')
|
||||
{
|
||||
TToken_string key;
|
||||
|
||||
key.add(gr);
|
||||
key.add(co);
|
||||
t = cache().get(LF_PCON, key, PCN_TMCF)[0];
|
||||
}
|
||||
const char * fso = fname.get();
|
||||
long so = 0L;
|
||||
if (fso && *fso)
|
||||
rec.get_long(fso);
|
||||
long ricl = bill2ricl(t, gr, co, so);
|
||||
|
||||
if (ricl > 0)
|
||||
{
|
||||
so = ricl % 1000;
|
||||
if (fso && *fso)
|
||||
{
|
||||
if (t <= ' ' || convert_clifo(t, so))
|
||||
rec.put(fso, so);
|
||||
}
|
||||
if (rec.num() == LF_PCON)
|
||||
{
|
||||
const TRectype & tab = cache().get("&TCO", format("&07ld", ricl));
|
||||
if (!tab.empty())
|
||||
rec.put(PCN_DESCR, tab.get("S0"));
|
||||
}
|
||||
ricl /= 1000;
|
||||
co = ricl % 100;
|
||||
gr = ricl / 100;
|
||||
rec.put(fname.get(1), gr);
|
||||
rec.put(fname.get(), co);
|
||||
converted = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TString msg; msg.format(FR("Campi %s - %s - %s : valore %d - &d - &ld decodifica assente"),
|
||||
(const char *) fname.get(1),
|
||||
(const char *) fname.get(2),
|
||||
(const char *) fname.get(3),
|
||||
gr, co, so);
|
||||
_log.log(2, msg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case _tabella :
|
||||
{
|
||||
const bool s3 = fname == "S3[1,4]";
|
||||
const bool reg = finfo.table() == "REG";
|
||||
const bool rpg = finfo.table() == "%RPG";
|
||||
|
||||
TString val = rec.get(s3 ? "S3" : fname);
|
||||
|
||||
if (s3 || rpg)
|
||||
{
|
||||
TString4 v = val.left(4);
|
||||
|
||||
scod2ricl(finfo.table(), v);
|
||||
if (v.full())
|
||||
val.overwrite(v, 0, 4);
|
||||
else
|
||||
val.cut(0);
|
||||
}
|
||||
else
|
||||
if (reg)
|
||||
{
|
||||
TString4 v = val.mid(4);
|
||||
|
||||
scod2ricl(finfo.table(), v);
|
||||
if (v.full())
|
||||
{
|
||||
val = val.left(4);
|
||||
val << v;
|
||||
}
|
||||
else
|
||||
val.cut(0);
|
||||
}
|
||||
else
|
||||
scod2ricl(finfo.table(), val);
|
||||
|
||||
if (val.full())
|
||||
{
|
||||
rec.put(fname, val);
|
||||
converted = true;
|
||||
}
|
||||
if (finfo.TStable().full())
|
||||
{
|
||||
const TRectype & tab = cache().get(finfo.TStable(), val);
|
||||
|
||||
if (!tab.empty())
|
||||
{
|
||||
if (rec.num() == LF_CAUSALI)
|
||||
rec.put(CAU_DESCR, tab.get("S0"));
|
||||
else
|
||||
rec.put("S0", tab.get("S0"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TString msg; msg.format(FR("Campo %s : valore %s decodifica assente"), (const char *) fname, (const char *) val);
|
||||
_log.log(2, msg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case _clifor :
|
||||
{
|
||||
char t = ' ';
|
||||
const TString& ftipo = fname.get(0);
|
||||
if (ftipo.starts_with("\""))
|
||||
t = ftipo[1];
|
||||
else
|
||||
t = rec.get(ftipo)[0];
|
||||
const TString & fcod = fname.get(1);
|
||||
long codcf = rec.get_long(fcod);
|
||||
const long oldcf = codcf;
|
||||
converted = convert_clifo(t, codcf);
|
||||
|
||||
if (converted)
|
||||
{
|
||||
rec.put(fcod, codcf);
|
||||
if (rec.num() == LF_CLIFO)
|
||||
{
|
||||
TString msg; msg.format(FR("Convertito il cliente %ld in %ld"), oldcf, codcf);
|
||||
_log.log(0, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case _contanal :
|
||||
{
|
||||
TString val = rec.get(fname);
|
||||
int gr = atoi(val.left(3));
|
||||
int co = atoi(val.mid(3,3));
|
||||
long so = atol(val.mid(6,6));
|
||||
char t = ' ';
|
||||
long ricl = bill2ricl(t, gr, co, so);
|
||||
|
||||
if (ricl > 0)
|
||||
{
|
||||
so = ricl % 1000;
|
||||
ricl /= 1000;
|
||||
co = ricl % 100;
|
||||
gr = ricl / 100;
|
||||
val.format("%03d%03d%06ld", gr, co ,so);
|
||||
rec.put(fname, val);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
}
|
||||
return converted;
|
||||
}
|
||||
|
||||
void TConvert_archives::convert_file(int logicnum, TArray & fieldlist)
|
||||
{
|
||||
TLocalisamfile f(logicnum);
|
||||
TRectype rec(f.curr());
|
||||
TRectype old(rec);
|
||||
TString key;
|
||||
TString msg;
|
||||
|
||||
msg.format(FR("Conversione file %d - %s"), logicnum, f.description());
|
||||
_log.log(0, msg);
|
||||
TProgind p(f.items(), msg);
|
||||
for (int err = f.first(); !p.iscancelled() && err == NOERR; err = f.next())
|
||||
{
|
||||
p.addstatus(1L);
|
||||
bool converted = false;
|
||||
|
||||
rec = f.curr();
|
||||
key = rec.key();
|
||||
msg.format(FR("Record %ld - Chiave %s"), f.recno(), (const char *) key);
|
||||
_log.log(0, msg);
|
||||
FOR_EACH_ARRAY_ITEM(fieldlist, r, obj)
|
||||
{
|
||||
TField_info & finfo = (TField_info &) *obj;
|
||||
converted |= convert_field(rec, finfo);
|
||||
}
|
||||
if (converted)
|
||||
{
|
||||
if (key != f.curr().key())
|
||||
{
|
||||
old = f.curr();
|
||||
f.curr() = rec;
|
||||
f.write();
|
||||
f.curr() = old;
|
||||
f.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
f.curr() = rec;
|
||||
f.rewrite();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TConvert_archives::convert_table(const char * tablename, TArray & fieldlist)
|
||||
{
|
||||
TTable t(tablename);
|
||||
TRectype rec(t.curr());
|
||||
TRectype old(rec);
|
||||
TString key;
|
||||
TString msg;
|
||||
|
||||
msg.format(FR("Conversione Tabella %d - %s"), tablename, t.description());
|
||||
_log.log(0, msg);
|
||||
TProgind p(t.items(), msg);
|
||||
for (int err = t.first(); !p.iscancelled() && err == NOERR; err = t.next())
|
||||
{
|
||||
p.addstatus(1L);
|
||||
bool converted = false;
|
||||
|
||||
rec = t.curr();
|
||||
key = rec.key();
|
||||
msg.format(FR("Record %ld - Chiave %s"), t.recno(), (const char *) key);
|
||||
_log.log(0, msg);
|
||||
FOR_EACH_ARRAY_ITEM(fieldlist, r, obj)
|
||||
{
|
||||
TField_info & finfo = (TField_info &) *obj;
|
||||
converted |= convert_field(rec, finfo);
|
||||
}
|
||||
if (converted)
|
||||
{
|
||||
if (key != t.curr().key())
|
||||
{
|
||||
old = t.curr();
|
||||
t.curr() = rec;
|
||||
t.write();
|
||||
t.curr() = old;
|
||||
t.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
t.curr() = rec;
|
||||
t.rewrite();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TConvert_archives::convert(bool comtables)
|
||||
{
|
||||
TArray field_infos;
|
||||
TConfig d(CONFIG_DITTA, "ca");
|
||||
const bool usepdcc = d.get_bool("UsePdcc");
|
||||
|
||||
field_infos.add(new TField_info("VALUTA", _tabella, "TSVAL"));
|
||||
convert_file(LF_NDITTE, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("TIPOCF|CODCF", _clifor));
|
||||
convert_file(LF_INDSP, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("TIPOCF|CODCF", _clifor));
|
||||
field_infos.add(new TField_info("ASSFIS", _tabella, "TSIVA"));
|
||||
convert_file(LF_CFVEN, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("|GRUPPO|CONTO|SOTTOCONTO"));
|
||||
convert_file(LF_PCON, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("TIPOCF|CODCF", _clifor));
|
||||
field_infos.add(new TField_info("|GRUPPO|CONTO"));
|
||||
field_infos.add(new TField_info("TIPOCF|CODCFASS", _clifor));
|
||||
field_infos.add(new TField_info("TIPOCF|CODCFFATT", _clifor));
|
||||
field_infos.add(new TField_info("|GRUPPORIC|CONTORIC|SOTTOCRIC"));
|
||||
field_infos.add(new TField_info("STATO", _tabella, "TSNAZ"));
|
||||
field_infos.add(new TField_info("CODVAL", _tabella, "TSVAL"));
|
||||
field_infos.add(new TField_info("CODPAG", _tabella, "TSCDP"));
|
||||
convert_file(LF_CLIFO, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("|GRUPPO|CONTO|SOTTOCONTO")); // ???
|
||||
convert_file(LF_SALDI, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("TIPOCF|CODCF", _clifor));
|
||||
convert_file(LF_ALLEG, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("CODCAUS", _tabella, "TSCAU"));
|
||||
field_infos.add(new TField_info("REG", _tabella, "TSREG"));
|
||||
field_infos.add(new TField_info("TIPOCF|CODCF", _clifor));
|
||||
field_infos.add(new TField_info("CODPAG", _tabella, "TSCDP"));
|
||||
convert_file(LF_MOV, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("TIPOC|GRUPPO|CONTO|SOTTOCONTO"));
|
||||
field_infos.add(new TField_info("TIPOCC|GRUPPOC|CONTOC|SOTTOCONTOC"));
|
||||
convert_file(LF_RMOV, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("CODIVA", _tabella, "TSIVA"));
|
||||
field_infos.add(new TField_info("TIPOC|GRUPPO|CONTO|SOTTOCONTO"));
|
||||
convert_file(LF_RMOVIVA, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("CODCAUS", _tabella, "TSCAU", "&TCA"));
|
||||
field_infos.add(new TField_info("REG", _tabella, "TSREG"));
|
||||
convert_file(LF_CAUSALI, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("CODCAUS", _tabella, "TSCAU"));
|
||||
field_infos.add(new TField_info("REG", _tabella, "TSREG"));
|
||||
field_infos.add(new TField_info("TIPOCF|GRUPPO|CONTO|SOTTOCONTO"));
|
||||
field_infos.add(new TField_info("CODIVA", _tabella, "TSIVA"));
|
||||
convert_file(LF_RCAUSALI, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("REG", _tabella, "TSREG"));
|
||||
field_infos.add(new TField_info("CODCAUS", _tabella, "TSCAU"));
|
||||
field_infos.add(new TField_info("CODVAL", _tabella, "TSVAL"));
|
||||
field_infos.add(new TField_info("TIPOC|GRUPPO|CONTO|SOTTOCONTO"));
|
||||
field_infos.add(new TField_info("TIPOC|GRUPPOCL|CONTOCL"));
|
||||
convert_file(LF_PARTITE, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("CODPAG", _tabella, "TSCDP"));
|
||||
field_infos.add(new TField_info("TIPOC|GRUPPO|CONTO|SOTTOCONTO"));
|
||||
convert_file(LF_SCADENZE, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("TIPOC|GRUPPO|CONTO|SOTTOCONTO"));
|
||||
convert_file(LF_PAGSCA, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("TIPOCF|CODCF", _clifor));
|
||||
field_infos.add(new TField_info("CODVAL", _tabella, "TSVAL"));
|
||||
convert_file(LF_EFFETTI, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("STATO", _tabella, "TSNAZ"));
|
||||
field_infos.add(new TField_info("CODPAG", _tabella, "TSCDP"));
|
||||
convert_file(LF_CESS, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("TIPOCF|CODCF", _clifor));
|
||||
field_infos.add(new TField_info("CODVAL", _tabella, "TSVAL"));
|
||||
field_infos.add(new TField_info("CODPAG", _tabella, "TSCDP"));
|
||||
field_infos.add(new TField_info("TIPOCF|CODCFFATT", _clifor));
|
||||
convert_file(LF_DOC, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("CODIVA", _tabella, "TSIVA"));
|
||||
convert_file(LF_RIGHEDOC, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("|GRUPPOA|CONTOA|SOTTOCA"));
|
||||
field_infos.add(new TField_info("|GRUPPOV|CONTOV|SOTTOCV"));
|
||||
field_infos.add(new TField_info("CODIVA", _tabella, "TSIVA"));
|
||||
field_infos.add(new TField_info("\"F\"|CODFORN", _clifor));
|
||||
field_infos.add(new TField_info("CODIVAR", _tabella, "TSIVA"));
|
||||
convert_file(LF_ANAMAG, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("TIPOCF|CODCF", _clifor));
|
||||
field_infos.add(new TField_info("CODVAL", _tabella, "TSVAL"));
|
||||
convert_file(LF_CONDV, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("TIPOCF|CODCF", _clifor));
|
||||
field_infos.add(new TField_info("CODIVA", _tabella, "TSIVA"));
|
||||
convert_file(LF_RCONDV, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("CODREG", _tabella, "TSREG"));
|
||||
convert_file(LF_TABREG, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("CODCAUS", _tabella, "TSCAU"));
|
||||
convert_file(LF_MOVANA, field_infos);
|
||||
|
||||
if (usepdcc)
|
||||
{
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("CODCONTO", _contanal));
|
||||
field_infos.add(new TField_info("CODCCORI", _contanal));
|
||||
convert_file(LF_RMOVANA, field_infos);
|
||||
}
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("TIPOCF|CODFORN", _clifor));
|
||||
convert_file(LF_MOVMAG, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("\"F\"|CODCF", _clifor));
|
||||
convert_file(LF_AGENTI, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("\"C\"|CODCLI", _clifor));
|
||||
convert_file(LF_PROVV, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("TIPOCF|CODCF", _clifor));
|
||||
field_infos.add(new TField_info("CODVAL", _tabella, "TSVAL"));
|
||||
convert_file(LF_INTRA, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("CODVAL", _tabella, "TSVAL"));
|
||||
convert_file(LF_RIEPRETT, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("CODVALUTA", _tabella, "TSVAL"));
|
||||
convert_file(LF_CESPI, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("|GRUPPO|CONTO|SOTTOC"));
|
||||
field_infos.add(new TField_info("|GRUPPOQNO|CONTOQNO|SOTTOCQNO"));
|
||||
field_infos.add(new TField_info("|GRUPPOQAN|CONTOQAN|SOTTOCQAN"));
|
||||
field_infos.add(new TField_info("|GRUPPOQAC|CONTOQAC|SOTTOCQAC"));
|
||||
field_infos.add(new TField_info("|GRUPPOQFN|CONTOQFN|SOTTOCQFN"));
|
||||
field_infos.add(new TField_info("|GRUPPOQFA|CONTOQFA|SOTTOCQFA"));
|
||||
field_infos.add(new TField_info("|GRUPPOQACC|CONTOQACC|SOTTOCQACC"));
|
||||
convert_file(LF_COLLCES, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("|GRUPPO|CONTO|SOTTOCONTO"));
|
||||
convert_file(LF_RIP, field_infos);
|
||||
|
||||
if (usepdcc)
|
||||
{
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("CODCONTO", _contanal));
|
||||
convert_file(LF_RRIP, field_infos);
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("CONTO", _contanal));
|
||||
convert_file(LF_SALDANA, field_infos);
|
||||
}
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("\"C\"|CODCLI", _clifor));
|
||||
convert_file(LF_LETINT, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("|GRUPPO|CONTO|SOTTOCONTO"));
|
||||
convert_file(LF_PANAPDC, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("|GRUPPO|CONTO|SOTTOCONTO"));
|
||||
convert_file(LF_RICLPDC, field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("TIPOCF|CODCF", _clifor));
|
||||
convert_file(LF_CLIFOGIAC, field_infos);
|
||||
|
||||
// Tabelle
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("|I0|I1|I2"));
|
||||
field_infos.add(new TField_info("|I3|I4|I5"));
|
||||
field_infos.add(new TField_info("S3[1,4]", _tabella, "TSIVA"));
|
||||
field_infos.add(new TField_info("S4", _tabella, "TSVAL"));
|
||||
convert_table("SPP", field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("|I0|I1|I2"));
|
||||
field_infos.add(new TField_info("|I3|I4|I5"));
|
||||
field_infos.add(new TField_info("S3[1,4]", _tabella, "TSIVA"));
|
||||
field_infos.add(new TField_info("S4", _tabella, "TSVAL"));
|
||||
convert_table("PRS", field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("|I3|I4|I5"));
|
||||
field_infos.add(new TField_info("S3[1,4]", _tabella, "TSIVA"));
|
||||
field_infos.add(new TField_info("S4", _tabella, "TSVAL"));
|
||||
convert_table("ATR", field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("|I3|I4|I5"));
|
||||
field_infos.add(new TField_info("S3[1,4]", _tabella, "TSIVA"));
|
||||
field_infos.add(new TField_info("S4", _tabella, "TSVAL"));
|
||||
convert_table("RSS", field_infos);
|
||||
field_infos.destroy();
|
||||
|
||||
field_infos.add(new TField_info("|I0|I1|I2"));
|
||||
field_infos.add(new TField_info("|I3|I4|I5"));
|
||||
field_infos.add(new TField_info("S7", _tabella, "TSIVA"));
|
||||
convert_table("GMC", field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("|I0|I1|I2"));
|
||||
field_infos.add(new TField_info("|I3|I4|I5"));
|
||||
convert_table("RFA", field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("|I0|I1|I2"));
|
||||
convert_table("CFA", field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("|I0|I1|I2"));
|
||||
convert_table("CRA", field_infos); // ???
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("|I0|I1|I2"));
|
||||
field_infos.add(new TField_info("|I3|I4|I5"));
|
||||
field_infos.add(new TField_info("|I6|I7|I8"));
|
||||
field_infos.add(new TField_info("|I9|I10|I11"));
|
||||
convert_table("BNP", field_infos);
|
||||
|
||||
if (comtables)
|
||||
{
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("CODTAB", _tabella, "TSIVA", "&TIV"));
|
||||
convert_table("%IVA", field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("CODTAB", _tabella, "TSNAZ", "&TNA"));
|
||||
convert_table("%STA", field_infos);
|
||||
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("CODTAB", _tabella, "TSCDP", "&TPG"));
|
||||
convert_table("%CPG", field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("CODTAB", _tabella, "TSCDP"));
|
||||
convert_table("%RPG", field_infos);
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("CODTAB", _tabella, "TSVAL", "&TVA"));
|
||||
convert_table("%VAL", field_infos);
|
||||
}
|
||||
|
||||
field_infos.destroy();
|
||||
field_infos.add(new TField_info("CODTAB", _tabella, "TSREG", "&TRE"));
|
||||
convert_table("REG", field_infos);
|
||||
|
||||
TReport_book b;
|
||||
|
||||
b.add(_log);
|
||||
b.print_or_preview();
|
||||
}
|
||||
|
||||
void TConvert_archives::main_loop()
|
||||
{
|
||||
TConvert_mask m;
|
||||
if (m.run() == K_ENTER)
|
||||
convert(m.get_bool(F_CONVCOM));
|
||||
}
|
||||
|
||||
int tc0900(int argc, char* argv[])
|
||||
{
|
||||
TConvert_archives app;
|
||||
app.run(argc, argv, "Conversione archivi CAMPO");
|
||||
return 0;
|
||||
}
|
5
tc/tc0900a.h
Executable file
5
tc/tc0900a.h
Executable file
@ -0,0 +1,5 @@
|
||||
// invio dati da ebc ad teamsystem
|
||||
|
||||
#define F_CODDITTA 101
|
||||
#define F_RAGSOC 102
|
||||
#define F_CONVCOM 103
|
45
tc/tc0900a.uml
Executable file
45
tc/tc0900a.uml
Executable file
@ -0,0 +1,45 @@
|
||||
#include "tc0900a.h"
|
||||
|
||||
TOOLBAR "topbar" 0 0 0 2
|
||||
|
||||
BUTTON DLG_ELABORA 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -11 "~Elabora"
|
||||
PICTURE BMP_ELABORA
|
||||
MESSAGE EXIT,K_ENTER
|
||||
END
|
||||
|
||||
#include <helpbar.h>
|
||||
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Conversione archivi CAMPO" -1 -1 78 20
|
||||
|
||||
GROUPBOX DLG_NULL 76 3
|
||||
BEGIN
|
||||
PROMPT 2 1 "@bDitta corrente"
|
||||
END
|
||||
|
||||
NUMBER F_CODDITTA 5
|
||||
BEGIN
|
||||
PROMPT 3 2 "Codice "
|
||||
FLAGS "FD"
|
||||
USE LF_NDITTE
|
||||
INPUT CODDITTA F_CODDITTA
|
||||
OUTPUT F_RAGSOC RAGSOC
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_RAGSOC 50
|
||||
BEGIN
|
||||
PROMPT 23 2 ""
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
BOOLEAN F_CONVCOM 256 39
|
||||
BEGIN
|
||||
PROMPT 23 5 "Conversione tabelle comuni"
|
||||
END
|
||||
ENDPAGE
|
||||
|
||||
ENDMASK
|
Loading…
x
Reference in New Issue
Block a user