Patch level : 4.0

Files correlati     :  ve7.exe ve7700a.msk ve7701a.ini
Ricompilazione Demo : [ ]
Commento            : Versione funzionante di trasferimento da Galileo (clifor)


git-svn-id: svn://10.65.10.50/trunk@14578 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 2006-11-30 11:07:05 +00:00
parent 68fa3f8ec0
commit 3003681ab8
6 changed files with 119 additions and 81 deletions

View File

@ -485,40 +485,41 @@ void TTrasferimentoGalileo_mask::serialize(bool bSave)
void TTrasferimentoGalileo_mask::trasferisci() void TTrasferimentoGalileo_mask::trasferisci()
{ {
TString query_header;
query_header << "ODBC(" << get(F_DSN) << ',' << get(F_USR) << ',' << get(F_PWD) << ")\n";
TReport_book book; TReport_book book;
TReport rep; rep.load("ve7700a"); TReport rep; rep.load("ve7700a");
TGalileo_log* log = new TGalileo_log; TGalileo_log* log = new TGalileo_log;
rep.set_recordset(log); rep.set_recordset(log);
TDate data = get(F_DATA);
bool rep_to_print = false; bool rep_to_print = false;
bool go_on = true; 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 (get_bool(F_CLIFO))
{
TString query_header;
query_header << "ODBC(" << get(F_DSN1) << ',' << get(F_USR1) << ',' << get(F_PWD1) << ")\n";
TGalileo_clifo pc;
pc.set_data_limite(get_date(F_DATA));
pc.init(TR("Clienti/Fornitori"), query_header, log);
go_on = pc.trasferisci();
book.add(rep);
if (go_on)
pc.dump();
rep_to_print = true;
}
if (go_on && get_bool(F_ARTICOLI))
{
TString query_header;
query_header << "ODBC(" << get(F_DSN2) << ',' << get(F_USR2) << ',' << get(F_PWD2) << ")\n";
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) if (rep_to_print && book.pages() > 0)
book.preview(); book.preview();
} }

View File

@ -120,6 +120,8 @@ public:
class TGalileo_clifo : public TGalileo_transfer class TGalileo_clifo : public TGalileo_transfer
{ {
TDate _data;
protected: protected:
int cancella_clifo(TLocalisamfile& clifo) const; int cancella_clifo(TLocalisamfile& clifo) const;
long get_next_key(const char tipocf) const; long get_next_key(const char tipocf) const;
@ -129,6 +131,7 @@ protected:
public: public:
virtual bool trasferisci(); virtual bool trasferisci();
virtual bool dump(); virtual bool dump();
void set_data_limite(const TDate& data) { _data = data; }
TGalileo_clifo(); TGalileo_clifo();
~TGalileo_clifo(); ~TGalileo_clifo();
}; };
@ -136,14 +139,16 @@ public:
class TGalileo_articoli : public TGalileo_transfer class TGalileo_articoli : public TGalileo_transfer
{ {
TDate _data;
protected: protected:
int cancella_articolo(TLocalisamfile& clifo) const; 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); bool aggiorna_record(TLocalisamfile& file, const TString_array& lista_campi);
public: public:
virtual bool trasferisci(); virtual bool trasferisci();
virtual bool dump(); virtual bool dump();
void set_data_limite(const TDate& data) { _data = data; }
TGalileo_articoli(); TGalileo_articoli();
~TGalileo_articoli(); ~TGalileo_articoli();
}; };

View File

@ -6,9 +6,13 @@
#define F_CLIFO 111 #define F_CLIFO 111
#define F_ARTICOLI 112 #define F_ARTICOLI 112
#define F_DATA 113
#define F_DSN 201 #define F_DSN1 201
#define F_USR 202 #define F_USR1 202
#define F_PWD 203 #define F_PWD1 203
#define F_DSN2 204
#define F_USR2 205
#define F_PWD2 206
#endif #endif

View File

@ -53,32 +53,59 @@ BEGIN
PROMPT 2 6 "Articoli" PROMPT 2 6 "Articoli"
END END
DATE F_DATA
BEGIN
PROMPT 2 8 "Record modificati dal "
END
ENDPAGE ENDPAGE
PAGE "Configurazione" -1 -1 78 18 PAGE "Configurazione" -1 -1 78 18
GROUPBOX DLG_NULL 48 5 GROUPBOX DLG_NULL 48 5
BEGIN BEGIN
PROMPT 1 1 "@bDatabase" PROMPT 1 1 "@bParametri database per clienti/fornitori"
END END
STRING F_DSN 30 STRING F_DSN1 30
BEGIN BEGIN
PROMPT 2 2 "DSN " PROMPT 2 2 "DSN "
CHECKTYPE REQUIRED CHECKTYPE REQUIRED
END END
STRING F_USR 16 STRING F_USR1 16
BEGIN BEGIN
PROMPT 2 3 "User " PROMPT 2 3 "User "
END END
STRING F_PWD 16 STRING F_PWD1 16
BEGIN BEGIN
PROMPT 2 4 "Password " PROMPT 2 4 "Password "
FLAGS "*" FLAGS "*"
END END
GROUPBOX DLG_NULL 48 5
BEGIN
PROMPT 1 7 "@bParametri database per articoli"
END
STRING F_DSN2 30
BEGIN
PROMPT 2 8 "DSN "
CHECKTYPE REQUIRED
END
STRING F_USR2 16
BEGIN
PROMPT 2 9 "User "
END
STRING F_PWD2 16
BEGIN
PROMPT 2 10 "Password "
FLAGS "*"
END
ENDPAGE ENDPAGE
ENDMASK ENDMASK

View File

@ -45,7 +45,6 @@ long TGalileo_clifo::get_next_key(const char tipocf) const
return codcf; return codcf;
} }
long TGalileo_clifo::get_codcf(const char tipocf, const char* ricalt) const long TGalileo_clifo::get_codcf(const char tipocf, const char* ricalt) const
{ {
TLocalisamfile clifo(LF_CLIFO); TLocalisamfile clifo(LF_CLIFO);
@ -64,6 +63,9 @@ bool TGalileo_clifo::dump()
TString_array lista_clifo; TString_array lista_clifo;
ini.list_variables(lista_clifo, true, "CLIFO", true); ini.list_variables(lista_clifo, true, "CLIFO", true);
TToken_string lista_dump; TToken_string lista_dump;
lista_dump.add(CLI_TIPOCF);
lista_dump.add(CLI_CODCF);
lista_dump.add(CLI_COMCF);
TString16 campo_dest, campo_orig; TString16 campo_dest, campo_orig;
FOR_EACH_ARRAY_ROW(lista_clifo,i,row) FOR_EACH_ARRAY_ROW(lista_clifo,i,row)
{ {
@ -72,9 +74,6 @@ bool TGalileo_clifo::dump()
if (!campo_orig.blank()) if (!campo_orig.blank())
lista_dump.add(campo_dest); lista_dump.add(campo_dest);
} }
lista_dump.add(CLI_TIPOCF);
lista_dump.add(CLI_CODCF);
lista_dump.add(CLI_COMCF);
TSystemisamfile clifo(LF_CLIFO); TSystemisamfile clifo(LF_CLIFO);
return (clifo.dump("clifo.txt", lista_dump) == NOERR); return (clifo.dump("clifo.txt", lista_dump) == NOERR);
} }
@ -82,21 +81,15 @@ bool TGalileo_clifo::dump()
bool TGalileo_clifo::trasferisci() bool TGalileo_clifo::trasferisci()
{ {
TString query = TString query =
"SELECT CLFOCP, CONTCA, DSCOCP, DSULCP, INDICA, LOCACA, PROVCA, CAPOCA, "
"NAZICA, CISOCA, PIVACA, CDFICA, NTELCA, NFAXCA \n"
"FROM CGANA01J \n";
if (!_data.empty())
{
query << "WHERE DTMNCA >= '";
query << _data.string() << "'";
}
"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); TRecordset& recset = create_recordset(query);
TString str; TString str;
@ -112,14 +105,13 @@ bool TGalileo_clifo::trasferisci()
TGalileo_iterator pi(this); TGalileo_iterator pi(this);
while (++pi) while (++pi)
{ {
const TString& contca = get_str("Contca"); const TString& contca = get_str("CONTCA");
const char tipocf = get_str("Clfocp")[0]; 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 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 needs_creation = codcf <= 0;
bool good = true; bool good = true;
if (!needs_creation) if (!needs_creation)
{ {
// il cliente/fornitore va aggiornato // il cliente/fornitore va aggiornato
@ -145,7 +137,7 @@ bool TGalileo_clifo::trasferisci()
if (good) if (good)
{ {
// aggiormento comune // aggiormento comune
TString80 dencom = get_str("Locaca"); TString80 dencom = get_str("LOCACA");
dencom.trim(); dencom.upper(); dencom.trim(); dencom.upper();
const TRectype& reccom = cache_comuni.get(dencom); const TRectype& reccom = cache_comuni.get(dencom);
if (dencom == reccom.get(COM_DENCOM)) if (dencom == reccom.get(COM_DENCOM))
@ -237,36 +229,29 @@ bool TGalileo_articoli::dump()
bool TGalileo_articoli::trasferisci() bool TGalileo_articoli::trasferisci()
{ {
TString query = TString query =
"SELECT BRISO00F.RICOD, BRISO00F.RDES1, BRISO00F.RDES2, "
"SELECT BRISO00F.RICOD, BRISO00F.RDES1, BRISO00F.RDES2, BRISO00F.RDES3, BRISO00F.RSUMS, BRISO00F.RITIP, Mid([TBDAT],9,1) AS Espr1" "BRISO00F.RDES3, BRISO00F.RSUMS, BRISO00F.RITIP, "
"Mid([TBDAT],9,1) AS Espr1 \n"
"FROM BRISO00F, BTABE00F" "FROM BRISO00F, BTABE00F"
"WHERE (((Mid([TBDAT],9,1))=[RITIP]) AND ((BTABE00F.TBTIP)='COD') AND ((BTABE00F.TBELE)='RIS'))"; "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); TRecordset& recset = create_recordset(query);
TString str; TString str;
TConfig& ini = config(); TConfig& ini = config();
TString_array lista_anamag; TString_array lista_anamag, lista_umart;
ini.list_variables(lista_anamag, true, "ANAMAG", true); ini.list_variables(lista_anamag, true, "ANAMAG", true);
ini.list_variables(lista_umart, true, "UMART", true);
TLocalisamfile anamag(LF_ANAMAG); TLocalisamfile anamag(LF_ANAMAG);
TLocalisamfile umart(LF_UMART);
TRectype& rec_anamag = anamag.curr(); TRectype& rec_anamag = anamag.curr();
TRectype& rec_umart = umart.curr();
TGalileo_iterator pi(this); TGalileo_iterator pi(this);
while (++pi) while (++pi)
{ {
const TString& codart = get_str("Ricod"); const TString& codart = get_str("BRISO00F.RICOD");
rec_anamag.zero(); rec_anamag.zero();
rec_anamag.put(ANAMAG_CODART, codart); rec_anamag.put(ANAMAG_CODART, codart);
bool good = anamag.read() == NOERR; bool good = anamag.read() == NOERR;
@ -277,7 +262,10 @@ bool TGalileo_articoli::trasferisci()
good &= test_write(anamag); good &= test_write(anamag);
} }
if (good) if (good)
{
aggiorna_record(anamag, lista_anamag); aggiorna_record(anamag, lista_anamag);
aggiorna_record(umart, lista_umart);
}
} }
return write_enabled(); return write_enabled();
} }

View File

@ -1,14 +1,14 @@
[CLIFO] [CLIFO]
RAGSOC = Dscocp RAGSOC = DSCOCP
INDCF = Indica INDCF = INDICA
CIVCF = CIVCF =
LOCALITACF = LOCALITACF =
STATOCF = STATOCF =
COMCF = COMCF =
CAPCF = Capoca CAPCF = CAPOCA
COFI = Cdfica COFI = CDFICA
STATOPAIV = STATOPAIV =
PAIV = Pivaca PAIV = PIVACA
TIPOPERS = TIPOPERS =
ALLEG = ALLEG =
CODALLEG = CODALLEG =
@ -20,13 +20,13 @@ SOTTOCRIC =
TIPOAPER = TIPOAPER =
CODANAGPER = CODANAGPER =
PTEL = PTEL =
TEL = Ntelca TEL = NTELCA
PTEL2 = PTEL2 =
TEL2 = TEL2 =
PTEL3 = PTEL3 =
TEL3 = TEL3 =
PFAX = PFAX =
FAX = Nfaxca FAX = NFAXCA
PTELEX = PTELEX =
TELEX = TELEX =
MAIL = MAIL =
@ -44,9 +44,22 @@ CODVAL =
CODLIN = CODLIN =
FIDO = FIDO =
CODPAG = CODPAG =
RICALT = Contca RICALT = CONTCA
OGGETTI = OGGETTI =
SOSPESO = SOSPESO =
DIRTY = DIRTY =
REFERENTE = REFERENTE =
VALINTRA = VALINTRA =
[ANAMAG]
CODART =
DESCR =
DESCRAGG =
CODARTALT =
[UMART]
CODART =
NRIGA = _FISSO,1
UM =
FC = _FISSO,1
PREZZO =