Patch level : 4.0 no patch
Files correlati : Ricompilazione Demo : [ ] Commento : prima versione trasferimento galileo git-svn-id: svn://10.65.10.50/trunk@14577 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4428975ba2
commit
68fa3f8ec0
@ -8,6 +8,8 @@ int main( int argc, char** argv )
|
|||||||
|
|
||||||
switch (r)
|
switch (r)
|
||||||
{
|
{
|
||||||
|
case 6:
|
||||||
|
ve7700(argc, argv); break; // importazione da Galileo Cantieri
|
||||||
case 5:
|
case 5:
|
||||||
ve7600(argc, argv); break; // trasferimento JBI
|
ve7600(argc, argv); break; // trasferimento JBI
|
||||||
case 4:
|
case 4:
|
||||||
|
1
ve/ve7.h
1
ve/ve7.h
@ -7,5 +7,6 @@ int ve7300 (int, char**);
|
|||||||
int ve7400 (int, char**);
|
int ve7400 (int, char**);
|
||||||
int ve7500 (int, char**);
|
int ve7500 (int, char**);
|
||||||
int ve7600 (int, char**);
|
int ve7600 (int, char**);
|
||||||
|
int ve7700 (int, char**);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
571
ve/ve7700.cpp
Executable file
571
ve/ve7700.cpp
Executable file
@ -0,0 +1,571 @@
|
|||||||
|
#include "ve7700.h"
|
||||||
|
#include "ve7700a.h"
|
||||||
|
|
||||||
|
#include <applicat.h>
|
||||||
|
#include <automask.h>
|
||||||
|
#include <progind.h>
|
||||||
|
#include <reprint.h>
|
||||||
|
#include <tabutil.h>
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// TGalileo_log
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class TGalileo_log : public TRecordset
|
||||||
|
{
|
||||||
|
struct TGalileo_row : public TObject
|
||||||
|
{
|
||||||
|
TVariant _sev, _msg;
|
||||||
|
};
|
||||||
|
|
||||||
|
TRecnotype _cur;
|
||||||
|
TArray _log;
|
||||||
|
TRecordset_column_info _info[2];
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual TRecnotype items() const;
|
||||||
|
virtual bool move_to(TRecnotype pos);
|
||||||
|
virtual TRecnotype current_row() const;
|
||||||
|
virtual void requery();
|
||||||
|
virtual const TString& query_text() const { return EMPTY_STRING; }
|
||||||
|
virtual unsigned int columns() const;
|
||||||
|
virtual const TRecordset_column_info& column_info(unsigned int column) const;
|
||||||
|
virtual const TVariant& get(unsigned int column) const;
|
||||||
|
|
||||||
|
void reset(const char* header);
|
||||||
|
void log(long sev, const char* msg);
|
||||||
|
|
||||||
|
TGalileo_log();
|
||||||
|
virtual ~TGalileo_log();
|
||||||
|
};
|
||||||
|
|
||||||
|
TRecnotype TGalileo_log::items() const
|
||||||
|
{ return _log.items(); }
|
||||||
|
|
||||||
|
bool TGalileo_log::move_to(TRecnotype pos)
|
||||||
|
{
|
||||||
|
_cur = pos;
|
||||||
|
return pos >= 0 && pos < items();
|
||||||
|
}
|
||||||
|
|
||||||
|
TRecnotype TGalileo_log::current_row() const
|
||||||
|
{ return _cur; }
|
||||||
|
|
||||||
|
void TGalileo_log::requery()
|
||||||
|
{ _cur = -1; }
|
||||||
|
|
||||||
|
unsigned int TGalileo_log::columns() const
|
||||||
|
{ return 2; }
|
||||||
|
|
||||||
|
const TRecordset_column_info& TGalileo_log::column_info(unsigned int i) const
|
||||||
|
{ return _info[i % columns()]; }
|
||||||
|
|
||||||
|
const TVariant& TGalileo_log::get(unsigned int column) const
|
||||||
|
{
|
||||||
|
if (_cur >= 0 && _cur < items())
|
||||||
|
{
|
||||||
|
const TGalileo_row& row = (const TGalileo_row&)_log[_cur];
|
||||||
|
switch(column)
|
||||||
|
{
|
||||||
|
case 0: return row._sev;
|
||||||
|
case 1: return row._msg;
|
||||||
|
default: return NULL_VARIANT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL_VARIANT;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TGalileo_log::reset(const char* header)
|
||||||
|
{
|
||||||
|
set_var("#HEADER", header, true);
|
||||||
|
_log.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TGalileo_log::log(long sev, const char* msg)
|
||||||
|
{
|
||||||
|
TGalileo_row* row = new TGalileo_row;
|
||||||
|
row->_sev = sev;
|
||||||
|
row->_msg = msg;
|
||||||
|
_log.add(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
TGalileo_log::TGalileo_log() : _log(NULL)
|
||||||
|
{
|
||||||
|
_info[0]._name = "SEVERITY";
|
||||||
|
_info[0]._width = 1;
|
||||||
|
_info[0]._type = _intfld;
|
||||||
|
|
||||||
|
_info[1]._name = "MESSAGE";
|
||||||
|
_info[1]._width = 80;
|
||||||
|
_info[1]._type = _alfafld;
|
||||||
|
}
|
||||||
|
|
||||||
|
TGalileo_log::~TGalileo_log()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// TGalileo_iteretor
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
bool TGalileo_iterator::cancelled() const
|
||||||
|
{
|
||||||
|
return _pi != NULL && _pi->iscancelled();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TGalileo_iterator::ok() const
|
||||||
|
{
|
||||||
|
if (cancelled())
|
||||||
|
return _pt->log_cancelled();
|
||||||
|
return _rec >= 0 && _rec < _pt->recordset().items();
|
||||||
|
}
|
||||||
|
|
||||||
|
TGalileo_iterator& TGalileo_iterator::operator=(TRecnotype n)
|
||||||
|
{
|
||||||
|
if (_pi != NULL)
|
||||||
|
_pi->setstatus(n+1);
|
||||||
|
_pt->recordset().move_to(_rec = n);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
TGalileo_iterator& TGalileo_iterator::operator++()
|
||||||
|
{
|
||||||
|
return *this = ++_rec;
|
||||||
|
}
|
||||||
|
|
||||||
|
TGalileo_iterator::TGalileo_iterator(TGalileo_transfer* pt) : _pt(pt), _pi(NULL)
|
||||||
|
{
|
||||||
|
const TRecnotype tot = _pt->recordset().items();
|
||||||
|
TString title;
|
||||||
|
title << _pt->title() << ": " << tot << ' ' << TR("righe");
|
||||||
|
if (tot > 1)
|
||||||
|
_pi = new TProgind(tot, title, true, true);
|
||||||
|
else
|
||||||
|
::begin_wait();
|
||||||
|
|
||||||
|
if (tot > 0)
|
||||||
|
_pt->log(title);
|
||||||
|
|
||||||
|
_rec = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
TGalileo_iterator::~TGalileo_iterator()
|
||||||
|
{
|
||||||
|
if (_pi != NULL)
|
||||||
|
delete _pi;
|
||||||
|
else
|
||||||
|
::end_wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// Cache tabelle
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class TCache_tab : public TCache_tp
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
virtual TObject* key2obj(const char* key);
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual const TString& decode(const TToken_string& cod_codtab);
|
||||||
|
TCache_tab(TGalileo_transfer* pt) : TCache_tp(pt) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
const TString& TCache_tab::decode(const TToken_string& cod_codtab)
|
||||||
|
{
|
||||||
|
TString4 cod; cod_codtab.get(0, cod);
|
||||||
|
if (cod.full())
|
||||||
|
{
|
||||||
|
const TRectype& rec = *(const TRectype*)objptr(cod_codtab);
|
||||||
|
if (!rec.empty())
|
||||||
|
{
|
||||||
|
const char* field = "CODTAB";
|
||||||
|
if (cod == "%TPM" || cod == "%TPP" || cod == "%TPI") // Tipo trasporto e porto
|
||||||
|
field = "S6";
|
||||||
|
return rec.get(field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return EMPTY_STRING;
|
||||||
|
}
|
||||||
|
|
||||||
|
TObject* TCache_tab::key2obj(const char* key)
|
||||||
|
{
|
||||||
|
TToken_string tok(key);
|
||||||
|
TString4 tab = tok.get(); tab.upper();
|
||||||
|
TString80 cod = tok.get(); cod.upper();
|
||||||
|
|
||||||
|
if (tab == "%IVA")
|
||||||
|
{
|
||||||
|
// Campo non digerisce i codici IVA numerici di un solo carattere
|
||||||
|
if (isdigit(cod[0]))
|
||||||
|
cod.right_just(2, '0'); // per cui aggiungo uno 0 iniziale
|
||||||
|
}
|
||||||
|
|
||||||
|
TTable table(tab);
|
||||||
|
table.put("CODTAB", cod);
|
||||||
|
if (table.read() != NOERR)
|
||||||
|
{
|
||||||
|
table.zero();
|
||||||
|
table.put("CODTAB", cod);
|
||||||
|
table.put("S0", cod);
|
||||||
|
test_write(table);
|
||||||
|
}
|
||||||
|
return table.curr().dup();
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// TGalileo_transfer
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
void TGalileo_transfer::init(const char* title, const char* qry_hdr, TGalileo_log* log)
|
||||||
|
{
|
||||||
|
_log = log;
|
||||||
|
_log->reset(title);
|
||||||
|
_query_header = qry_hdr;
|
||||||
|
_write_enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TString& TGalileo_transfer::title() const
|
||||||
|
{
|
||||||
|
return _log->get_var("#HEADER").as_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TGalileo_transfer::log(const char* msg, int sev) const
|
||||||
|
{
|
||||||
|
_log->log(sev, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
TRecordset& TGalileo_transfer::create_recordset(const char* query)
|
||||||
|
{
|
||||||
|
if (_recset != NULL)
|
||||||
|
{
|
||||||
|
delete _recset;
|
||||||
|
_recset = NULL;
|
||||||
|
}
|
||||||
|
if (_outset != NULL)
|
||||||
|
{
|
||||||
|
_outset->exec("COMMIT TRANS");
|
||||||
|
delete _outset;
|
||||||
|
_outset = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
TString qry = query;
|
||||||
|
if (!qry.starts_with("US") && !qry.starts_with("ODBC"))
|
||||||
|
qry.insert(query_header());
|
||||||
|
_recset = ::create_recordset(qry);
|
||||||
|
return *_recset;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TRecordset& TGalileo_transfer::recordset() const
|
||||||
|
{
|
||||||
|
CHECK(_recset != NULL, "NULL recordset");
|
||||||
|
return *_recset;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRecordset& TGalileo_transfer::recordset()
|
||||||
|
{
|
||||||
|
CHECK(_recset != NULL, "NULL recordset");
|
||||||
|
return *_recset;
|
||||||
|
}
|
||||||
|
|
||||||
|
long TGalileo_transfer::odbc_exec(const char* cmd)
|
||||||
|
{
|
||||||
|
long err = 0;
|
||||||
|
if (_write_enabled)
|
||||||
|
{
|
||||||
|
if (_outset == NULL)
|
||||||
|
{
|
||||||
|
_outset = new TODBC_recordset(query_header());
|
||||||
|
_outset->exec("BEGIN TRANS");
|
||||||
|
}
|
||||||
|
err = _outset->exec(cmd);
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TGalileo_transfer::log_error(const char* msg)
|
||||||
|
{
|
||||||
|
log(msg, 2);
|
||||||
|
if (_write_enabled)
|
||||||
|
{
|
||||||
|
_write_enabled = false;
|
||||||
|
log("");
|
||||||
|
log(TR("LA SCRITTURA SUGLI ARCHIVI VIENE DISABILITATA DA QUESTO MOMENTO IN POI"), 2);
|
||||||
|
log("");
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TGalileo_transfer::log_cancelled()
|
||||||
|
{
|
||||||
|
return log_error(TR("Procedura interrotta dall'utente"));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TGalileo_transfer::test_write(TLocalisamfile& file, bool re)
|
||||||
|
{
|
||||||
|
int err = NOERR;
|
||||||
|
if (_write_enabled)
|
||||||
|
{
|
||||||
|
if (re)
|
||||||
|
err = file.rewrite();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TString80 code, desc;
|
||||||
|
if (file.num() == LF_TAB || file.num() == LF_TABCOM)
|
||||||
|
{
|
||||||
|
code = file.get("CODTAB");
|
||||||
|
desc = file.get("S0");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
code = file.curr().build_key(1);
|
||||||
|
desc = file.curr().build_key(2);
|
||||||
|
}
|
||||||
|
TString msg;
|
||||||
|
msg << TR("Inserimento ") << code << " (" << desc << ')'
|
||||||
|
<< TR(" nel file ") << file.num() << ' ' << file.description();
|
||||||
|
log(msg, 1);
|
||||||
|
|
||||||
|
err = file.write();
|
||||||
|
if (err == _isreinsert)
|
||||||
|
{
|
||||||
|
msg.format(FR("Errore %d durante la scrittura sul file"), err);
|
||||||
|
log(msg, 1);
|
||||||
|
err = NOERR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (err != NOERR)
|
||||||
|
{
|
||||||
|
TString msg;
|
||||||
|
msg.format(FR("Errore %d durante la scrittura sul file %d (%s)"),
|
||||||
|
err, file.num(), file.description());
|
||||||
|
log_error(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return err == NOERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TString& TGalileo_transfer::get_str(const char* field) const
|
||||||
|
{
|
||||||
|
return recordset().get(field).as_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
const TString& TGalileo_transfer::get_real_str(const char* campo) const
|
||||||
|
{
|
||||||
|
const real val = recordset().get(campo).as_real();
|
||||||
|
if (val.is_zero())
|
||||||
|
return EMPTY_STRING;
|
||||||
|
return get_tmp_string() = val.string();
|
||||||
|
}
|
||||||
|
|
||||||
|
long TGalileo_transfer::get_long(const char* field) const
|
||||||
|
{
|
||||||
|
return recordset().get(field).as_int();
|
||||||
|
}
|
||||||
|
|
||||||
|
const TString& TGalileo_transfer::decode_value(const char* tab, const TString& cod)
|
||||||
|
{
|
||||||
|
if (cod.full())
|
||||||
|
{
|
||||||
|
if (_tab == NULL)
|
||||||
|
_tab = new TCache_tab(this);
|
||||||
|
TToken_string tok; tok.add(tab); tok.add(cod);
|
||||||
|
return _tab->decode(tok);
|
||||||
|
}
|
||||||
|
return EMPTY_STRING;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TString& TGalileo_transfer::decode_field(const char* tab, const char* field)
|
||||||
|
{
|
||||||
|
const TString& cod = get_str(field);
|
||||||
|
return decode_value(tab, cod);
|
||||||
|
}
|
||||||
|
|
||||||
|
const TString& TGalileo_transfer::build_insert_query(const char* table, const char* f, const char* v) const
|
||||||
|
{
|
||||||
|
TString& qry = get_tmp_string();
|
||||||
|
|
||||||
|
qry << "INSERT INTO " << table;
|
||||||
|
|
||||||
|
TAuto_token_string fields(f);
|
||||||
|
TToken_string values(v);
|
||||||
|
if (fields.items() > 0)
|
||||||
|
{
|
||||||
|
qry << " (";
|
||||||
|
FOR_EACH_TOKEN(fields, tok)
|
||||||
|
qry << tok << ',';
|
||||||
|
qry.rtrim(1);
|
||||||
|
qry << ')';
|
||||||
|
}
|
||||||
|
qry << " VALUES (";
|
||||||
|
|
||||||
|
TString tmp;
|
||||||
|
FOR_EACH_TOKEN(values, tok)
|
||||||
|
{
|
||||||
|
tmp = tok;
|
||||||
|
if (tmp.full() && !tmp.starts_with("0") && real::is_natural(tmp))
|
||||||
|
qry << tok;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (tmp[0] != '\'')
|
||||||
|
{
|
||||||
|
for (int i = tmp.len()-1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
if (tmp[i] == '\'')
|
||||||
|
tmp.insert("'", i);
|
||||||
|
}
|
||||||
|
qry << '\'' << tmp << '\'';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
qry << tmp;
|
||||||
|
}
|
||||||
|
qry << ',';
|
||||||
|
}
|
||||||
|
qry.rtrim(1);
|
||||||
|
qry << ')';
|
||||||
|
|
||||||
|
return qry;
|
||||||
|
}
|
||||||
|
|
||||||
|
TGalileo_transfer::TGalileo_transfer()
|
||||||
|
: _log(NULL), _config("ve7701a.ini"), _recset(NULL), _outset(NULL), _tab(NULL)
|
||||||
|
{}
|
||||||
|
|
||||||
|
TGalileo_transfer::~TGalileo_transfer()
|
||||||
|
{
|
||||||
|
if (_tab != NULL)
|
||||||
|
delete _tab;
|
||||||
|
if (_outset != NULL)
|
||||||
|
{
|
||||||
|
_outset->exec("COMMIT TRANS");
|
||||||
|
delete _outset;
|
||||||
|
}
|
||||||
|
if (_recset != NULL)
|
||||||
|
delete _recset;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// TTrasferimentoGalileo_mask
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class TTrasferimentoGalileo_mask : public TAutomask
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||||
|
void serialize(bool bSave);
|
||||||
|
|
||||||
|
public:
|
||||||
|
void trasferisci();
|
||||||
|
|
||||||
|
TTrasferimentoGalileo_mask();
|
||||||
|
virtual ~TTrasferimentoGalileo_mask();
|
||||||
|
};
|
||||||
|
|
||||||
|
// Funzione di tarsferimento dati da/verso file .ini con lo stesso nome della maschera
|
||||||
|
// Andrebbe messo in libreria
|
||||||
|
void TTrasferimentoGalileo_mask::serialize(bool bSave)
|
||||||
|
{
|
||||||
|
TFilename n = source_file(); n.ext("ini"); // Construisce il nome del .ini in base al .msk
|
||||||
|
TConfig cfg(n, "Main"); // Crea il file di configurazione
|
||||||
|
TString4 id;
|
||||||
|
for (int i = fields()-1; i >= 0; i--) // Scandisce tutti i campi della maschera ...
|
||||||
|
{
|
||||||
|
TMask_field& f = fld(i);
|
||||||
|
if (f.active() && f.is_loadable()) // ... selezionando solo quelli editabili
|
||||||
|
{
|
||||||
|
id.format("%d", f.dlg());
|
||||||
|
if (bSave) // A seconda del flag di scrittura ...
|
||||||
|
cfg.set(id, f.get()); // ... o scrive sul .ini
|
||||||
|
else
|
||||||
|
f.set(cfg.get(id)); // ... o legge dal .ini
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TTrasferimentoGalileo_mask::trasferisci()
|
||||||
|
{
|
||||||
|
TString query_header;
|
||||||
|
query_header << "ODBC(" << get(F_DSN) << ',' << get(F_USR) << ',' << get(F_PWD) << ")\n";
|
||||||
|
|
||||||
|
TReport_book book;
|
||||||
|
TReport rep; rep.load("ve7700a");
|
||||||
|
TGalileo_log* log = new TGalileo_log;
|
||||||
|
rep.set_recordset(log);
|
||||||
|
bool rep_to_print = false;
|
||||||
|
|
||||||
|
bool go_on = true;
|
||||||
|
|
||||||
|
if (go_on && get_bool(F_CLIFO))
|
||||||
|
{
|
||||||
|
if (go_on)
|
||||||
|
{
|
||||||
|
TGalileo_clifo pc;
|
||||||
|
pc.init(TR("Clienti/Fornitori"), query_header, log);
|
||||||
|
go_on = pc.trasferisci();
|
||||||
|
book.add(rep);
|
||||||
|
if (go_on)
|
||||||
|
pc.dump();
|
||||||
|
}
|
||||||
|
if (go_on && get_bool(F_ARTICOLI))
|
||||||
|
{
|
||||||
|
TGalileo_articoli pc;
|
||||||
|
pc.init(TR("Articoli"), query_header, log);
|
||||||
|
go_on = pc.trasferisci();
|
||||||
|
book.add(rep);
|
||||||
|
if (go_on)
|
||||||
|
pc.dump();
|
||||||
|
}
|
||||||
|
rep_to_print = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rep_to_print && book.pages() > 0)
|
||||||
|
book.preview();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TTrasferimentoGalileo_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||||
|
{
|
||||||
|
switch (o.dlg())
|
||||||
|
{
|
||||||
|
case DLG_OK:
|
||||||
|
if (e == fe_button)
|
||||||
|
serialize(true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
TTrasferimentoGalileo_mask::TTrasferimentoGalileo_mask() : TAutomask("ve7700a")
|
||||||
|
{
|
||||||
|
serialize(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
TTrasferimentoGalileo_mask::~TTrasferimentoGalileo_mask()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// TTrasferimentoGalileo
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class TTrasferimentoGalileo : public TSkeleton_application
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
virtual void main_loop();
|
||||||
|
};
|
||||||
|
|
||||||
|
void TTrasferimentoGalileo::main_loop()
|
||||||
|
{
|
||||||
|
TTrasferimentoGalileo_mask mask;
|
||||||
|
while (mask.run() == K_ENTER)
|
||||||
|
mask.trasferisci();
|
||||||
|
}
|
||||||
|
|
||||||
|
int ve7700(int argc, char** argv)
|
||||||
|
{
|
||||||
|
TTrasferimentoGalileo tg;
|
||||||
|
tg.run(argc, argv, TR("Trasferimento Galileo"));
|
||||||
|
return 0;
|
||||||
|
}
|
156
ve/ve7700.h
Executable file
156
ve/ve7700.h
Executable file
@ -0,0 +1,156 @@
|
|||||||
|
#ifndef __VE7700_H
|
||||||
|
#define __VE7700_H
|
||||||
|
|
||||||
|
#ifndef __CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __DICTION_H
|
||||||
|
#include <diction.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __ISAM_H
|
||||||
|
#include <isam.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __ODBCRECSET_H
|
||||||
|
#include <odbcrset.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __PROGIND_H
|
||||||
|
class TProgind;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class TGalileo_log;
|
||||||
|
class TCache_tp;
|
||||||
|
|
||||||
|
class TGalileo_transfer : public TObject
|
||||||
|
{
|
||||||
|
TString _query_header;
|
||||||
|
TGalileo_log* _log;
|
||||||
|
TConfig _config;
|
||||||
|
|
||||||
|
TRecordset* _recset;
|
||||||
|
bool _write_enabled;
|
||||||
|
TODBC_recordset* _outset;
|
||||||
|
TCache_tp* _tab;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
const TString& build_insert_query(const char* table, const char* f, const char* v) const;
|
||||||
|
|
||||||
|
TRecordset& create_recordset(const char* query);
|
||||||
|
long odbc_exec(const char* command);
|
||||||
|
|
||||||
|
const TString& decode_value(const char* tab, const TString& field_value);
|
||||||
|
const TString& decode_field(const char* tab, const char* recset_field);
|
||||||
|
|
||||||
|
TGalileo_transfer();
|
||||||
|
virtual bool trasferisci() pure;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void init(const char* rh, const char* qh, TGalileo_log* log);
|
||||||
|
const TString& title() const;
|
||||||
|
TConfig& config() { return _config; }
|
||||||
|
const TString& query_header() const { return _query_header; }
|
||||||
|
|
||||||
|
void log(const char* msg, int sev = 0) const;
|
||||||
|
bool log_error(const char* msg);
|
||||||
|
bool log_cancelled();
|
||||||
|
const TRecordset& recordset() const;
|
||||||
|
TRecordset& recordset();
|
||||||
|
|
||||||
|
const TString& get_str(const char* campo) const; // Get string from current recordset
|
||||||
|
const TString& get_real_str(const char* campo) const; // Get eventually empty string from numeric field
|
||||||
|
long get_long(const char* campo) const;
|
||||||
|
|
||||||
|
bool write_enabled() const { return _write_enabled; }
|
||||||
|
|
||||||
|
bool test_write(TLocalisamfile& file, bool re = false);
|
||||||
|
bool test_rewrite(TLocalisamfile& file) { return test_write(file, true); }
|
||||||
|
|
||||||
|
virtual ~TGalileo_transfer();
|
||||||
|
};
|
||||||
|
|
||||||
|
// Classe candidata alla libreria
|
||||||
|
class TGalileo_iterator
|
||||||
|
{
|
||||||
|
TGalileo_transfer* _pt;
|
||||||
|
TProgind* _pi;
|
||||||
|
TRecnotype _rec;
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool ok() const;
|
||||||
|
bool cancelled() const;
|
||||||
|
TGalileo_iterator& operator=(TRecnotype n);
|
||||||
|
TGalileo_iterator& operator++();
|
||||||
|
operator int() const { return ok(); }
|
||||||
|
|
||||||
|
TGalileo_iterator(TGalileo_transfer* pt);
|
||||||
|
~TGalileo_iterator();
|
||||||
|
};
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// Cache generica per il trasferimento DDT di Pack
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class TCache_tp : public TCache
|
||||||
|
{
|
||||||
|
TGalileo_transfer* _pt;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void log(const char* msg, int sev) const { _pt->log(msg, sev); }
|
||||||
|
bool test_write(TLocalisamfile& file) const { return _pt->test_write(file); }
|
||||||
|
const TRecordset& recordset() const { return _pt->recordset(); }
|
||||||
|
TConfig& config() const { return _pt->config(); }
|
||||||
|
const TString& query_header() const { return _pt->query_header(); }
|
||||||
|
|
||||||
|
public:
|
||||||
|
const TString& get_str(const char* campo) const { return _pt->get_str(campo); }
|
||||||
|
const TString& get_real_str(const char* campo) const { return _pt->get_real_str(campo); }
|
||||||
|
long get_long(const char* campo) const { return _pt->get_long(campo); }
|
||||||
|
virtual const TString& decode(const TToken_string& tokens) pure;
|
||||||
|
|
||||||
|
TCache_tp(TGalileo_transfer* pt) : _pt(pt) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// Trasferimenti veri e propri
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
class TGalileo_clifo : public TGalileo_transfer
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int cancella_clifo(TLocalisamfile& clifo) const;
|
||||||
|
long get_next_key(const char tipocf) const;
|
||||||
|
long get_codcf(const char tipocf, const char* ricalt) const;
|
||||||
|
bool aggiorna_record(TLocalisamfile& file, const TString_array& lista_campi);
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual bool trasferisci();
|
||||||
|
virtual bool dump();
|
||||||
|
TGalileo_clifo();
|
||||||
|
~TGalileo_clifo();
|
||||||
|
};
|
||||||
|
|
||||||
|
class TGalileo_articoli : public TGalileo_transfer
|
||||||
|
{
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int cancella_articolo(TLocalisamfile& clifo) const;
|
||||||
|
//long get_codcf(const char tipocf, const char* ricalt) const;
|
||||||
|
bool aggiorna_record(TLocalisamfile& file, const TString_array& lista_campi);
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual bool trasferisci();
|
||||||
|
virtual bool dump();
|
||||||
|
TGalileo_articoli();
|
||||||
|
~TGalileo_articoli();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class TCache_art;
|
||||||
|
class TCache_umart;
|
||||||
|
class TDocumento;
|
||||||
|
|
||||||
|
#endif
|
14
ve/ve7700a.h
Executable file
14
ve/ve7700a.h
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#ifndef __VE7700A_H
|
||||||
|
#define __VE7700A_H
|
||||||
|
|
||||||
|
#define F_FIRM 101
|
||||||
|
#define F_RAGSOC 102
|
||||||
|
|
||||||
|
#define F_CLIFO 111
|
||||||
|
#define F_ARTICOLI 112
|
||||||
|
|
||||||
|
#define F_DSN 201
|
||||||
|
#define F_USR 202
|
||||||
|
#define F_PWD 203
|
||||||
|
|
||||||
|
#endif
|
84
ve/ve7700a.uml
Executable file
84
ve/ve7700a.uml
Executable file
@ -0,0 +1,84 @@
|
|||||||
|
#include "ve7700a.h"
|
||||||
|
|
||||||
|
TOOLBAR "" 0 -3 0 3
|
||||||
|
|
||||||
|
BUTTON DLG_OK 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -12 -11 "~Elabora"
|
||||||
|
PICTURE BMP_ELABORA
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_QUIT 10 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT -22 -11 "Fine"
|
||||||
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
PAGE "Trasferimento da Galileo Cantieri" -1 -1 78 18
|
||||||
|
|
||||||
|
GROUPBOX DLG_NULL 78 3
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 1 "@bDitta"
|
||||||
|
END
|
||||||
|
|
||||||
|
NUMBER F_FIRM 5
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 2 ""
|
||||||
|
USE LF_NDITTE
|
||||||
|
INPUT CODDITTA F_FIRM
|
||||||
|
OUTPUT F_RAGSOC RAGSOC
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
FLAGS "DF"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_RAGSOC 60
|
||||||
|
BEGIN
|
||||||
|
PROMPT 17 2 ""
|
||||||
|
FLAGS "D"
|
||||||
|
END
|
||||||
|
|
||||||
|
GROUPBOX DLG_NULL 58 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 4 "@bTabelle"
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_CLIFO
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 5 "Clienti/Fornitori"
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_ARTICOLI
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 6 "Articoli"
|
||||||
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
PAGE "Configurazione" -1 -1 78 18
|
||||||
|
|
||||||
|
GROUPBOX DLG_NULL 48 5
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 1 "@bDatabase"
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_DSN 30
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 2 "DSN "
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_USR 16
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 3 "User "
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_PWD 16
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 4 "Password "
|
||||||
|
FLAGS "*"
|
||||||
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
ENDMASK
|
325
ve/ve7701.cpp
Executable file
325
ve/ve7701.cpp
Executable file
@ -0,0 +1,325 @@
|
|||||||
|
#include "ve7700.h"
|
||||||
|
|
||||||
|
#include <recarray.h>
|
||||||
|
#include <tabutil.h>
|
||||||
|
#include <utility.h>
|
||||||
|
|
||||||
|
#include <..\mg\anamag.h>
|
||||||
|
#include <clifo.h>
|
||||||
|
#include <comuni.h>
|
||||||
|
#include <doc.h>
|
||||||
|
#include <mov.h>
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// TGalileo_clifo
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
int TGalileo_clifo::cancella_clifo(TLocalisamfile& clifo) const
|
||||||
|
{
|
||||||
|
return NOERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
long TGalileo_clifo::get_next_key(const char tipocf) const
|
||||||
|
{
|
||||||
|
TLocalisamfile clifo(LF_CLIFO);
|
||||||
|
long codcf = 1L;
|
||||||
|
if (!clifo.empty())
|
||||||
|
{
|
||||||
|
if (tipocf == 'C')
|
||||||
|
{
|
||||||
|
clifo.put(CLI_TIPOCF, 'F');
|
||||||
|
clifo.read(_isgteq);
|
||||||
|
if (clifo.good())
|
||||||
|
clifo.prev();
|
||||||
|
clifo.setstatus(NOERR);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
clifo.last();
|
||||||
|
if (clifo.good())
|
||||||
|
{
|
||||||
|
const char tipo = clifo.get(CLI_TIPOCF)[0];
|
||||||
|
if (tipocf == tipo)
|
||||||
|
codcf += clifo.get_long(CLI_CODCF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return codcf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
long TGalileo_clifo::get_codcf(const char tipocf, const char* ricalt) const
|
||||||
|
{
|
||||||
|
TLocalisamfile clifo(LF_CLIFO);
|
||||||
|
long codcf = -1;
|
||||||
|
clifo.setkey(6);
|
||||||
|
clifo.put(CLI_TIPOCF, tipocf);
|
||||||
|
clifo.put(CLI_RICALT, ricalt);
|
||||||
|
if (clifo.read() == NOERR)
|
||||||
|
codcf = clifo.get_long(CLI_CODCF);
|
||||||
|
return codcf;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TGalileo_clifo::dump()
|
||||||
|
{
|
||||||
|
TConfig& ini = config();
|
||||||
|
TString_array lista_clifo;
|
||||||
|
ini.list_variables(lista_clifo, true, "CLIFO", true);
|
||||||
|
TToken_string lista_dump;
|
||||||
|
TString16 campo_dest, campo_orig;
|
||||||
|
FOR_EACH_ARRAY_ROW(lista_clifo,i,row)
|
||||||
|
{
|
||||||
|
row->get(0, campo_dest);
|
||||||
|
row->get(1, campo_orig);
|
||||||
|
if (!campo_orig.blank())
|
||||||
|
lista_dump.add(campo_dest);
|
||||||
|
}
|
||||||
|
lista_dump.add(CLI_TIPOCF);
|
||||||
|
lista_dump.add(CLI_CODCF);
|
||||||
|
lista_dump.add(CLI_COMCF);
|
||||||
|
TSystemisamfile clifo(LF_CLIFO);
|
||||||
|
return (clifo.dump("clifo.txt", lista_dump) == NOERR);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TGalileo_clifo::trasferisci()
|
||||||
|
{
|
||||||
|
TString query =
|
||||||
|
|
||||||
|
"SELECT CGANA01J.CLFOCP, CGANA01J.CONTCA, CGANA01J.DSCOCP, CGANA01J.DSULCP, CGANA01J.INDICA, CGANA01J.LOCACA, CGANA01J.PROVCA, CGANA01J.CAPOCA, CGANA01J.NAZICA, CGANA01J.CISOCA, CGANA01J.PIVACA, CGANA01J.CDFICA, CGANA01J.NTELCA, CGANA01J.NFAXCA"
|
||||||
|
"FROM CGANA01J";
|
||||||
|
|
||||||
|
/*
|
||||||
|
"SELECT Customers_Suppliers.*, Unit_Measure.UMDesc "
|
||||||
|
"FROM Customers_Suppliers "
|
||||||
|
"LEFT JOIN Unit_Measure "
|
||||||
|
"ON (CurrencyCode = Unit_Measure.UMCode AND Unit_Measure.UMType='9') "
|
||||||
|
"WHERE (StatusFlag=1 OR StatusFlag=2 OR StatusFlag=3) AND ";
|
||||||
|
if (_only_agenti)
|
||||||
|
query << "(FlagCustSupp='A')";
|
||||||
|
else
|
||||||
|
query << "(FlagCustSupp='C' OR FlagCustSupp='S')";
|
||||||
|
*/
|
||||||
|
TRecordset& recset = create_recordset(query);
|
||||||
|
|
||||||
|
TString str;
|
||||||
|
|
||||||
|
TConfig& ini = config();
|
||||||
|
TString_array lista_clifo;
|
||||||
|
ini.list_variables(lista_clifo, true, "CLIFO", true);
|
||||||
|
TLocalisamfile clifo(LF_CLIFO);
|
||||||
|
TRectype& rec_clifo = clifo.curr();
|
||||||
|
|
||||||
|
TRecord_cache cache_comuni(LF_COMUNI, 2);
|
||||||
|
|
||||||
|
TGalileo_iterator pi(this);
|
||||||
|
while (++pi)
|
||||||
|
{
|
||||||
|
const TString& contca = get_str("Contca");
|
||||||
|
const char tipocf = get_str("Clfocp")[0];
|
||||||
|
|
||||||
|
|
||||||
|
long codcf = get_codcf(tipocf, contca); // mi restiuisce il codice del clinete se esiste oppure -1 se da aggiungere
|
||||||
|
|
||||||
|
bool needs_creation = codcf <= 0;
|
||||||
|
bool good = true;
|
||||||
|
if (!needs_creation)
|
||||||
|
{
|
||||||
|
// il cliente/fornitore va aggiornato
|
||||||
|
rec_clifo.zero();
|
||||||
|
rec_clifo.put(CLI_TIPOCF, tipocf);
|
||||||
|
rec_clifo.put(CLI_CODCF, codcf);
|
||||||
|
good = clifo.read() == NOERR;
|
||||||
|
if (!good)
|
||||||
|
needs_creation = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needs_creation)
|
||||||
|
{
|
||||||
|
// il cliente/fornitore va inserito in campo
|
||||||
|
if (codcf <= 0)
|
||||||
|
codcf = get_next_key(tipocf);
|
||||||
|
rec_clifo.zero();
|
||||||
|
rec_clifo.put(CLI_TIPOCF, tipocf);
|
||||||
|
rec_clifo.put(CLI_CODCF, codcf);
|
||||||
|
good &= test_write(clifo);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (good)
|
||||||
|
{
|
||||||
|
// aggiormento comune
|
||||||
|
TString80 dencom = get_str("Locaca");
|
||||||
|
dencom.trim(); dencom.upper();
|
||||||
|
const TRectype& reccom = cache_comuni.get(dencom);
|
||||||
|
if (dencom == reccom.get(COM_DENCOM))
|
||||||
|
rec_clifo.put(CLI_COMCF, reccom.get(COM_COM));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rec_clifo.zero(CLI_COMCF);
|
||||||
|
rec_clifo.put(CLI_LOCCF, dencom);
|
||||||
|
|
||||||
|
log("");
|
||||||
|
str.format(FR("Cliente/Fornitore %c %ld: comune non trovato %s"), tipocf, codcf, (const char*)dencom);
|
||||||
|
log(str);
|
||||||
|
}
|
||||||
|
aggiorna_record(clifo, lista_clifo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return write_enabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TGalileo_clifo::aggiorna_record(TLocalisamfile& file, const TString_array& lista_campi)
|
||||||
|
{
|
||||||
|
TRectype& rec = file.curr();
|
||||||
|
TString campo_dest, campo_orig, valore, str;
|
||||||
|
FOR_EACH_ARRAY_ROW(lista_campi,i,row)
|
||||||
|
{
|
||||||
|
row->get(0, campo_dest);
|
||||||
|
row->get(1, campo_orig);
|
||||||
|
if (!campo_orig.blank())
|
||||||
|
{
|
||||||
|
if (campo_orig[0] == '_')
|
||||||
|
{
|
||||||
|
TToken_string elabora(campo_orig.mid(1),',');
|
||||||
|
const TString& str = elabora.get();
|
||||||
|
if (str == "TAB") // formato _TAB, <tabella da leggere>,<valore CODTAB>, <campo da leggere>
|
||||||
|
{
|
||||||
|
const TString4 tab = elabora.get(); // tabella da leggere
|
||||||
|
const TString80 campo = elabora.get();
|
||||||
|
const TString16 codtab = get_str(campo);
|
||||||
|
const TString80 campotab = elabora.get();
|
||||||
|
valore = cache().get(tab, codtab, campotab);
|
||||||
|
}
|
||||||
|
else if (str == "FISSO")
|
||||||
|
valore = elabora.get(); // valore fisso indicato in configurazione
|
||||||
|
}
|
||||||
|
else
|
||||||
|
valore = get_str(campo_orig);
|
||||||
|
rec.put(campo_dest, valore);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return test_rewrite(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
TGalileo_clifo::TGalileo_clifo()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
TGalileo_clifo::~TGalileo_clifo()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// TGalileo_articoli
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
int TGalileo_articoli::cancella_articolo(TLocalisamfile& anamag) const
|
||||||
|
{
|
||||||
|
return NOERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TGalileo_articoli::dump()
|
||||||
|
{
|
||||||
|
TConfig& ini = config();
|
||||||
|
TString_array lista_anamag;
|
||||||
|
ini.list_variables(lista_anamag, true, "ANAMAG", true);
|
||||||
|
TToken_string lista_dump;
|
||||||
|
TString16 campo_dest, campo_orig;
|
||||||
|
FOR_EACH_ARRAY_ROW(lista_anamag,i,row)
|
||||||
|
{
|
||||||
|
row->get(0, campo_dest);
|
||||||
|
row->get(1, campo_orig);
|
||||||
|
if (!campo_orig.blank())
|
||||||
|
lista_dump.add(campo_dest);
|
||||||
|
}
|
||||||
|
lista_dump.add(ANAMAG_CODART);
|
||||||
|
TSystemisamfile anamag(LF_ANAMAG);
|
||||||
|
return (anamag.dump("anamag.txt", lista_dump) == NOERR);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TGalileo_articoli::trasferisci()
|
||||||
|
{
|
||||||
|
TString query =
|
||||||
|
|
||||||
|
"SELECT BRISO00F.RICOD, BRISO00F.RDES1, BRISO00F.RDES2, BRISO00F.RDES3, BRISO00F.RSUMS, BRISO00F.RITIP, Mid([TBDAT],9,1) AS Espr1"
|
||||||
|
"FROM BRISO00F, BTABE00F"
|
||||||
|
"WHERE (((Mid([TBDAT],9,1))=[RITIP]) AND ((BTABE00F.TBTIP)='COD') AND ((BTABE00F.TBELE)='RIS'))";
|
||||||
|
|
||||||
|
/*
|
||||||
|
"SELECT Customers_Suppliers.*, Unit_Measure.UMDesc "
|
||||||
|
"FROM Customers_Suppliers "
|
||||||
|
"LEFT JOIN Unit_Measure "
|
||||||
|
"ON (CurrencyCode = Unit_Measure.UMCode AND Unit_Measure.UMType='9') "
|
||||||
|
"WHERE (StatusFlag=1 OR StatusFlag=2 OR StatusFlag=3) AND ";
|
||||||
|
if (_only_agenti)
|
||||||
|
query << "(FlagCustSupp='A')";
|
||||||
|
else
|
||||||
|
query << "(FlagCustSupp='C' OR FlagCustSupp='S')";
|
||||||
|
*/
|
||||||
|
TRecordset& recset = create_recordset(query);
|
||||||
|
|
||||||
|
TString str;
|
||||||
|
|
||||||
|
TConfig& ini = config();
|
||||||
|
TString_array lista_anamag;
|
||||||
|
ini.list_variables(lista_anamag, true, "ANAMAG", true);
|
||||||
|
TLocalisamfile anamag(LF_ANAMAG);
|
||||||
|
TRectype& rec_anamag = anamag.curr();
|
||||||
|
|
||||||
|
TGalileo_iterator pi(this);
|
||||||
|
while (++pi)
|
||||||
|
{
|
||||||
|
const TString& codart = get_str("Ricod");
|
||||||
|
rec_anamag.zero();
|
||||||
|
rec_anamag.put(ANAMAG_CODART, codart);
|
||||||
|
bool good = anamag.read() == NOERR;
|
||||||
|
if (!good)
|
||||||
|
{
|
||||||
|
rec_anamag.zero();
|
||||||
|
rec_anamag.put(ANAMAG_CODART, codart);
|
||||||
|
good &= test_write(anamag);
|
||||||
|
}
|
||||||
|
if (good)
|
||||||
|
aggiorna_record(anamag, lista_anamag);
|
||||||
|
}
|
||||||
|
return write_enabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TGalileo_articoli::aggiorna_record(TLocalisamfile& file, const TString_array& lista_campi)
|
||||||
|
{
|
||||||
|
TRectype& rec = file.curr();
|
||||||
|
TString campo_dest, campo_orig, valore, str;
|
||||||
|
FOR_EACH_ARRAY_ROW(lista_campi,i,row)
|
||||||
|
{
|
||||||
|
row->get(0, campo_dest);
|
||||||
|
row->get(1, campo_orig);
|
||||||
|
if (!campo_orig.blank())
|
||||||
|
{
|
||||||
|
if (campo_orig[0] == '_')
|
||||||
|
{
|
||||||
|
TToken_string elabora(campo_orig.mid(1),',');
|
||||||
|
const TString& str = elabora.get();
|
||||||
|
if (str == "TAB") // formato _TAB, <tabella da leggere>,<valore CODTAB>, <campo da leggere>
|
||||||
|
{
|
||||||
|
const TString4 tab = elabora.get(); // tabella da leggere
|
||||||
|
const TString80 campo = elabora.get();
|
||||||
|
const TString16 codtab = get_str(campo);
|
||||||
|
const TString80 campotab = elabora.get();
|
||||||
|
valore = cache().get(tab, codtab, campotab);
|
||||||
|
}
|
||||||
|
else if (str == "FISSO")
|
||||||
|
valore = elabora.get(); // valore fisso indicato in configurazione
|
||||||
|
}
|
||||||
|
else
|
||||||
|
valore = get_str(campo_orig);
|
||||||
|
rec.put(campo_dest, valore);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return test_rewrite(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
TGalileo_articoli::TGalileo_articoli()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
TGalileo_articoli::~TGalileo_articoli()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
52
ve/ve7701a.ini
Executable file
52
ve/ve7701a.ini
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
[CLIFO]
|
||||||
|
RAGSOC = Dscocp
|
||||||
|
INDCF = Indica
|
||||||
|
CIVCF =
|
||||||
|
LOCALITACF =
|
||||||
|
STATOCF =
|
||||||
|
COMCF =
|
||||||
|
CAPCF = Capoca
|
||||||
|
COFI = Cdfica
|
||||||
|
STATOPAIV =
|
||||||
|
PAIV = Pivaca
|
||||||
|
TIPOPERS =
|
||||||
|
ALLEG =
|
||||||
|
CODALLEG =
|
||||||
|
GRUPPO =
|
||||||
|
CONTO =
|
||||||
|
GRUPPORIC =
|
||||||
|
CONTORIC =
|
||||||
|
SOTTOCRIC =
|
||||||
|
TIPOAPER =
|
||||||
|
CODANAGPER =
|
||||||
|
PTEL =
|
||||||
|
TEL = Ntelca
|
||||||
|
PTEL2 =
|
||||||
|
TEL2 =
|
||||||
|
PTEL3 =
|
||||||
|
TEL3 =
|
||||||
|
PFAX =
|
||||||
|
FAX = Nfaxca
|
||||||
|
PTELEX =
|
||||||
|
TELEX =
|
||||||
|
MAIL =
|
||||||
|
DATANASC =
|
||||||
|
STATONASC =
|
||||||
|
COMNASC =
|
||||||
|
CODSTAT =
|
||||||
|
CODABI =
|
||||||
|
CODCAB =
|
||||||
|
NUMCC =
|
||||||
|
IBAN =
|
||||||
|
OCCAS =
|
||||||
|
STATO =
|
||||||
|
CODVAL =
|
||||||
|
CODLIN =
|
||||||
|
FIDO =
|
||||||
|
CODPAG =
|
||||||
|
RICALT = Contca
|
||||||
|
OGGETTI =
|
||||||
|
SOSPESO =
|
||||||
|
DIRTY =
|
||||||
|
REFERENTE =
|
||||||
|
VALINTRA =
|
Loading…
x
Reference in New Issue
Block a user