Files correlati : Commento : Aggiornamento Campo/Compass, modificata query O02A, modificato campo CCLIH in O02A/C git-svn-id: svn://10.65.10.50/branches/R_10_00@23465 c028cbd2-c16b-5b4b-a496-9718f37d4682
976 lines
33 KiB
C++
976 lines
33 KiB
C++
#include <applicat.h>
|
||
#include <automask.h>
|
||
#include <progind.h>
|
||
#include <odbcrset.h>
|
||
#include <relation.h>
|
||
#include <utility.h>
|
||
#include <doc.h>
|
||
|
||
#include "mr0600a.h"
|
||
|
||
class TCampass_msk : public TAutomask
|
||
{
|
||
protected:
|
||
virtual long handler(WINDOW task, EVENT* ep);
|
||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||
public:
|
||
TCampass_msk();
|
||
};
|
||
|
||
long TCampass_msk::handler(WINDOW task, EVENT* ep)
|
||
{
|
||
if (ep->type == E_TIMER)
|
||
{
|
||
if (is_running())
|
||
stop_run(K_ENTER);
|
||
}
|
||
return TAutomask::handler(task, ep);
|
||
}
|
||
|
||
bool TCampass_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||
{
|
||
return true;
|
||
}
|
||
|
||
TCampass_msk::TCampass_msk() : TAutomask("mr0600a")
|
||
{
|
||
set(F_DSN, ini_get_string(CONFIG_DITTA, "Campo_Compass", "DSN"));
|
||
set(F_USR, ini_get_string(CONFIG_DITTA, "Campo_Compass", "User"));
|
||
set(F_PWD, ini_get_string(CONFIG_DITTA, "Campo_Compass", "Password"));
|
||
}
|
||
|
||
class TCampass_app : public TSkeleton_application
|
||
{
|
||
protected:
|
||
TToken_string tables;
|
||
TString DSN, usr, psw;
|
||
const TString getTime() const;
|
||
const TString getFam(TString codArt) const {TString app; app << codArt[3] << codArt[4] << codArt[5]; return app; } // Restituisce la famiglia di un prodotto CODART[3,5]
|
||
const TString getGroup(TString codTab) const {TString app; app << codTab[1] << codTab[2] << codTab[3]; return app; } // Restituisce la famiglia di un prodotto CODART[3,5]
|
||
const TString toEscape(TString val) const; // Prende una stringa e sistema i caratteri di escape
|
||
const TString zeroFill(TString val, int n = 6) const; // Riempe di 0 se non ci sono 6 caratteri
|
||
bool setParameters(TString dsn, TString utente, TString password);
|
||
bool checkParameters(const TString& DSN, const TString& usr, const TString& psw) { TODBC_recordset connTest(""); return connTest.connect(DSN, usr, psw) ? setParameters(DSN, usr, psw) : false; }
|
||
//*****************************************************************
|
||
// Funzioni per segnalare a Compass il trasferimento delle tabelle
|
||
TString startExport(TString prefixTables) const;
|
||
void endExport(TString id) const;
|
||
//*****************************************************************
|
||
bool emptyTables(const TString& DSN, const TString& usr, const TString& psw) const;
|
||
TString esporta(const TString& DSN, const TString& usr, const TString& psw) const;
|
||
// Funzioni di esportazione
|
||
bool a01a(const TString id) const;
|
||
bool o01a(const TString id) const;
|
||
bool o01e(const TString id) const;
|
||
bool o02a(const TString CodNum, const TString id) const;
|
||
bool o02c(const TString CodNum, const TString id) const;
|
||
bool o03a(const TString id) const;
|
||
bool p01a(const TString id) const;
|
||
bool p01b(const TString id) const;
|
||
bool p02a(const TString id) const;
|
||
//bool o01b(const TString& DSN) const; Messa in pausa
|
||
|
||
public:
|
||
virtual void main_loop();
|
||
void setTable(TToken_string s) { tables = s; }
|
||
};
|
||
|
||
const TString TCampass_app::getTime() const
|
||
{
|
||
TString app;
|
||
time_t timer = time(0); // Tempo per il file di log
|
||
tm *ltm = localtime(&timer);
|
||
TString hour; hour << 1 + ltm->tm_hour;
|
||
TString min; min << 1 + ltm->tm_min;
|
||
TString sec; sec << 1 + ltm->tm_sec;
|
||
TString day; day << ltm->tm_mday;
|
||
TString month; month << 1 + ltm->tm_mon;
|
||
TString year; year << 1900 + ltm->tm_year;
|
||
app << zeroFill(day, 2) << "/" << zeroFill(month, 2) << "/" << year << " - " << zeroFill(hour, 2) << ":" << zeroFill(min, 2) << ":" << zeroFill(sec, 2);
|
||
return app;
|
||
}
|
||
|
||
const TString TCampass_app::toEscape(TString val) const
|
||
{
|
||
TString app;
|
||
for(int k = 0; k < val.len(); k++)
|
||
{
|
||
switch (val[k])
|
||
{
|
||
case '\'':
|
||
app << "''";
|
||
break;
|
||
default:
|
||
app << val[k];
|
||
break;
|
||
}
|
||
}
|
||
return app;
|
||
}
|
||
|
||
const TString TCampass_app::zeroFill(TString val, int n) const
|
||
{
|
||
TString app;
|
||
if (n - val.len() > 0)
|
||
app.fill('0', n - val.len());
|
||
app << val;
|
||
return app;
|
||
}
|
||
|
||
bool TCampass_app::setParameters(TString dsn, TString utente, TString password)
|
||
{
|
||
// Salvo i parametri
|
||
ini_set_string(CONFIG_DITTA, "Campo_MSSQL_Export", "DSN", dsn);
|
||
ini_set_string(CONFIG_DITTA, "Campo_MSSQL_Export", "User", utente);
|
||
ini_set_string(CONFIG_DITTA, "Campo_MSSQL_Export", "Password", password);
|
||
DSN = dsn;
|
||
usr = utente;
|
||
psw = password;
|
||
return true;
|
||
}
|
||
|
||
|
||
TString TCampass_app::startExport(TString prefixTables) const
|
||
{
|
||
TODBC_recordset sqlset("", true);
|
||
// Controllo la connessione
|
||
if (!sqlset.connect(DSN, usr, psw))
|
||
return "";
|
||
|
||
//Preparo la query
|
||
TString sqlQuery; sqlQuery << "INSERT INTO RunImp (CFLUSSO, DWINI) VALUES ('" << prefixTables << "',CURRENT_TIMESTAMP);";
|
||
TString selectString; selectString << "SELECT TOP 1 IDRUNIMP FROM RunImp ORDER BY IDRUNIMP DESC";
|
||
sqlset.exec(sqlQuery);
|
||
sqlset.commit();
|
||
sqlset.exec(selectString);
|
||
sqlset.move_next();
|
||
TVariant idrunimp = sqlset.get("IDRUNIMP");
|
||
return idrunimp.as_string();
|
||
}
|
||
|
||
void TCampass_app::endExport(TString id) const
|
||
{
|
||
TODBC_recordset sqlset("", true);
|
||
sqlset.connect(DSN, usr, psw);
|
||
//Preparo la query
|
||
TString sqlQuery; sqlQuery << "UPDATE RunImp SET DWEND = CURRENT_TIMESTAMP WHERE IDRUNIMP = '" << id << "'";
|
||
sqlset.exec(sqlQuery);
|
||
sqlset.commit();
|
||
}
|
||
|
||
bool TCampass_app::emptyTables(const TString& DSN, const TString& usr, const TString& psw) const
|
||
{
|
||
TODBC_recordset sqlset("");
|
||
TString table;
|
||
|
||
if (!sqlset.connect(DSN, usr, psw))
|
||
return false;
|
||
|
||
for (int i = 0; i < tables.size(); i++)
|
||
{
|
||
TString theQuery; // The query: una tabella (donna) per cui uccidere
|
||
|
||
tables.get(i, table);
|
||
theQuery << "DELETE FROM "<< table << ";";
|
||
sqlset.exec(theQuery);
|
||
}
|
||
// Committo i cambiamenti
|
||
sqlset.exec("COMMIT;");
|
||
return true;
|
||
}
|
||
|
||
TString TCampass_app::esporta(const TString& DSN, const TString& usr, const TString& psw) const
|
||
{
|
||
TString errors;
|
||
// Funzione disabilitata di debug
|
||
// Innanzitutto svuoto le tabelle
|
||
//if(!emptyTables(DSN)) return false;
|
||
|
||
// Adesso inizio a popolarle
|
||
|
||
// File di Log
|
||
ofstream logFile;
|
||
logFile.open("temp/Campass_log.txt");
|
||
if(!logFile.is_open())
|
||
return "Errore generazione file di Log";
|
||
|
||
logFile << getTime() << " - Test connessione\n";
|
||
|
||
TODBC_recordset sqlset("");
|
||
if (!sqlset.connect(DSN, usr, psw))
|
||
return "Connessione fallita!";
|
||
|
||
logFile << getTime() << " - Connessione effettuata!\n";
|
||
|
||
|
||
// INIZIO O03
|
||
logFile << getTime() << " - Inizio esportazione O03:\n";
|
||
|
||
TString o03; o03 << startExport("O03");
|
||
|
||
if(!o03a(o03)) errors << "ERRORE TABELLA: O03A\n"; // O03A
|
||
else
|
||
logFile << getTime() << " - Esportata tabella O03A\n";
|
||
|
||
endExport(o03);
|
||
logFile << getTime() << " - Fine esportazione O03!\n";
|
||
|
||
|
||
// INIZIO P02
|
||
logFile << getTime() << " - Inizio esportazione P02:\n";
|
||
|
||
TString p02; p02 << startExport("P02");
|
||
|
||
if(!p02a(p02)) errors << "ERRORE TABELLA: P02A\n"; // P02A
|
||
else
|
||
logFile << getTime() << " - Esportata tabella P02A\n";
|
||
|
||
endExport(p02);
|
||
|
||
logFile << getTime() << " - Fine esportazione P02!\n";
|
||
|
||
|
||
// INIZIO P01
|
||
|
||
logFile << getTime() << " - Inizio esportazione P01:\n";
|
||
|
||
TString p01; p01 << startExport("P01");
|
||
|
||
if(!p01a(p01)) errors << "ERRORE TABELLA: P01A\n"; // P01A
|
||
else
|
||
logFile << getTime() << " - Esportata tabella P01A\n";
|
||
|
||
if(!p01b(p01)) errors << "ERRORE TABELLA: P01B\n"; // P01B
|
||
else
|
||
logFile << getTime() << " - Esportata tabella P01B\n";
|
||
|
||
endExport(p01);
|
||
|
||
logFile << getTime() << " - Fine esportazione P01!\n";
|
||
|
||
// INIZIO O01
|
||
|
||
logFile << getTime() << " - Inizio esportazione O01:\n";
|
||
|
||
TString o01; o01 << startExport("O01");
|
||
|
||
if(!o01a(o01)) errors << "ERRORE TABELLA: O01A\n"; // O01A
|
||
else
|
||
logFile << getTime() << " - Esportata tabella O01A\n";
|
||
|
||
if(!o01e(o01)) errors << "ERRORE TABELLA: O01E\n"; // O01E
|
||
else
|
||
logFile << getTime() << " - Esportata tabella O01E\n";
|
||
|
||
endExport(o01);
|
||
|
||
logFile << getTime() << " - Fine esportazione O01!\n";
|
||
|
||
// INIZIO O02
|
||
|
||
logFile << getTime() << " - Inizio esportazione O02:\n";
|
||
|
||
TString o02; o02 << startExport("O02");
|
||
|
||
if(!o02a("ORC", o02)) errors << "ERRORE TABELLA: O02A - ORC\n"; // O02A ORC
|
||
else
|
||
logFile << getTime() << " - Esportata tabella O02A - ORC\n";
|
||
|
||
if(!o02a("PRC", o02)) errors << "ERRORE TABELLA: O02A - PRC\n"; // O02A PRC
|
||
else
|
||
logFile << getTime() << " - Esportata tabella O02A - PRC\n";
|
||
|
||
if(!o02c("ORC", o02)) errors << "ERRORE TABELLA: O02C - ORC\n"; // O02C ORC
|
||
else
|
||
logFile << getTime() << " - Esportata tabella O02C - ORC\n";
|
||
|
||
if(!o02c("PRC", o02)) errors << "ERRORE TABELLA: O02C - PRC\n"; // O02C PRC
|
||
else
|
||
logFile << getTime() << " - Esportata tabella O02C - PRC\n";
|
||
|
||
endExport(o02);
|
||
|
||
logFile << getTime() << " - Fine esportazione O02!\n";
|
||
|
||
|
||
// INIZIO A01
|
||
|
||
logFile << getTime() << " - Inizio esportazione A01:\n";
|
||
|
||
TString a01; a01 << startExport("A01");
|
||
|
||
if(!a01a(a01)) errors << "ERRORE TABELLA: A01A\n"; // O01A
|
||
else
|
||
logFile << getTime() << " - Esportata tabella A01A\n";
|
||
|
||
endExport(a01);
|
||
|
||
logFile << getTime() << " - Fine esportazione A01!\n";
|
||
|
||
logFile.close();
|
||
|
||
return errors;
|
||
}
|
||
|
||
// Non sono molto sicuro del suo funzionamento
|
||
bool TCampass_app::a01a(const TString id) const
|
||
{
|
||
TODBC_recordset sqlset("", true);
|
||
// Controllo la connessione
|
||
if (!sqlset.connect(DSN, usr, psw))
|
||
return false;
|
||
TRelation rilprod(LF_RILPROD),rdoc(LF_RIGHEDOC);
|
||
int items;
|
||
TString msg("Esportazione tabella "); msg << "A01A";
|
||
TCursor curRilprod(&rilprod, "CODNUM = \"ORC\" && QTA >= 0");
|
||
|
||
items = curRilprod.items();
|
||
TProgress_monitor p(items, msg);
|
||
// Adesso inserisco tutta la bella roba
|
||
for (curRilprod = 0; curRilprod.pos() < items && !p.is_cancelled(); ++curRilprod)
|
||
{
|
||
int num = curRilprod.pos();
|
||
// Aggiorno il Progress Monitor
|
||
if (!p.add_status())
|
||
break;
|
||
// Prendo la riga di RILPROD
|
||
TRectype rowRilprod = curRilprod.curr();
|
||
|
||
// Vado a prendere il documento di riferimento
|
||
TRectype filtroFiltro(rdoc.curr());
|
||
filtroFiltro.put("CODNUM", rowRilprod.get("CODNUM"));
|
||
filtroFiltro.put("ANNO", rowRilprod.get("ANNO"));
|
||
filtroFiltro.put("PROVV", rowRilprod.get("PROVV"));
|
||
filtroFiltro.put("NDOC", rowRilprod.get("NDOC"));
|
||
TCursor curFiltro(&rdoc, "RIGAEVASA != \"X\"", 1, &filtroFiltro, &filtroFiltro);
|
||
if(curFiltro.items() > 0)
|
||
{
|
||
curFiltro = 0;
|
||
// Prendo la riga di Filtro
|
||
TRectype rowFiltro = curFiltro.curr();
|
||
// Preparo la riga del documento
|
||
TRectype filtroRDoc(rdoc.curr());
|
||
filtroRDoc.put("DAPROVV", rowFiltro.get("PROVV"));
|
||
filtroRDoc.put("DAANNO", rowFiltro.get("ANNO"));
|
||
filtroRDoc.put("DACODNUM", rowFiltro.get("CODNUM"));
|
||
filtroRDoc.put("DANDOC", rowFiltro.get("NDOC"));
|
||
filtroRDoc.put("DAIDRIGA", rowFiltro.get("NRIGA"));
|
||
TString codartmag; codartmag << "CODARTMAG == \"" << rowRilprod.get("CODART") << "\"";
|
||
TCursor curRdoc(&rdoc, codartmag, 4, &filtroRDoc, &filtroRDoc);
|
||
if(curRdoc.items() > 0)
|
||
{
|
||
curRdoc = 0;
|
||
// Prendo la riga di RDOC
|
||
TRectype rowRDoc = curRdoc.curr();
|
||
// Dichiaro la stringa
|
||
TString sqlQuery;
|
||
sqlQuery << "INSERT INTO A01A ( IKRUNIMP, FAZI, CStr, CPRD, NMOV, CMAC, QPFPRO, FSALDO, NFAS ) \
|
||
VALUES('" << id << "','U','DBS','" << zeroFill(rowRDoc.get("NDOC")) << "." << rowRDoc.get("NRIGA") << "','1','" << rowRilprod.get("LINEA") << "','" << rowRilprod.get("QTA") << "','";
|
||
sqlQuery << (rowRilprod.get("CHIUSO") == "X" ? "1" : "0"); sqlQuery << "','10');";
|
||
if(sqlset.exec(sqlQuery) != 1)
|
||
{
|
||
message_box(sqlQuery);
|
||
return false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return sqlset.commit() == -1 ? false : true;
|
||
}
|
||
|
||
bool TCampass_app::o01a(const TString id) const
|
||
{
|
||
TODBC_recordset sqlset("", true);
|
||
// Controllo la connessione
|
||
if (!sqlset.connect(DSN, usr, psw))
|
||
return false;
|
||
TRelation doc(LF_DOC),rdoc(LF_RIGHEDOC);
|
||
int items;
|
||
TString msg("Esportazione tabella "); msg << "O01A";
|
||
// Creo il filtro per la chiave del cursore, da quel che ho capito le chiavi sono pi<70> veloci di un filtro (come <20> possibile?)
|
||
TRectype filtroRDoc(rdoc.curr()); filtroRDoc.put("CODNUM", "ORP1");
|
||
TCursor curRDoc(&rdoc, "", 1, &filtroRDoc, &filtroRDoc);
|
||
items = curRDoc.items();
|
||
TProgress_monitor p(items, msg);
|
||
// Adesso inserisco tutta la bella roba
|
||
for (curRDoc = 0; curRDoc.pos() < items && !p.is_cancelled(); ++curRDoc)
|
||
{
|
||
int num = curRDoc.pos();
|
||
// Aggiorno il Progress Monitor
|
||
if (!p.add_status())
|
||
break;
|
||
// Prendo la riga del FILTRO
|
||
TRectype rowRDoc = curRDoc.curr();
|
||
|
||
// Vado a prendere il documento di riferimento
|
||
TRectype filtroDoc(doc.curr());
|
||
filtroDoc.put(DOC_PROVV, rowRDoc.get("PROVV"));
|
||
filtroDoc.put(DOC_ANNO, rowRDoc.get("ANNO"));
|
||
filtroDoc.put(DOC_CODNUM, rowRDoc.get("CODNUM"));
|
||
filtroDoc.put(DOC_NDOC, rowRDoc.get("NDOC"));
|
||
TCursor curDoc(&doc, "", 1, &filtroDoc, &filtroDoc);
|
||
if(curDoc.items() > 0)
|
||
{
|
||
// Forzo a 0, senn<6E> ci sono problemi di sporcizia
|
||
curDoc = 0;
|
||
TRectype rowDoc = (curDoc.curr());
|
||
|
||
// Vado a prendere la riga di riferimento
|
||
TRectype filtroFiltro(rdoc.curr());
|
||
if(rowRDoc.get("DACODNUM") == "ORC")
|
||
{
|
||
filtroFiltro.put("CODNUM", rowRDoc.get("DACODNUM"));
|
||
filtroFiltro.put("ANNO", rowRDoc.get("DAANNO"));
|
||
filtroFiltro.put("PROVV", rowRDoc.get("DAPROVV"));
|
||
filtroFiltro.put("NDOC", rowRDoc.get("DANDOC"));
|
||
filtroFiltro.put("NRIGA", rowRDoc.get("DAIDRIGA"));
|
||
TCursor curFiltro(&rdoc, "RIGAEVASA != \"X\"", 1, &filtroFiltro, &filtroFiltro);
|
||
for (curFiltro = 0; curFiltro.pos() < curFiltro.items() && !p.is_cancelled(); ++curFiltro)
|
||
{
|
||
if(rowRDoc.get("RIGAEVASA") == "X") continue; // Controllo ma la query sopra non mi va come al solito
|
||
// Dichiaro la stringa
|
||
TString sqlQuery;
|
||
|
||
// Inserisco IIKRUNIMP, FAZI, CStr, CPRD, CART
|
||
sqlQuery << "INSERT INTO O01A ( IKRUNIMP, FAZI, CStr, CPRD, CART, TIPORD, FLGSTA, CMAG, DPRICHI, DPRICHF, QPORD, XNOTE, CCLI ) \
|
||
VALUES('" << id << "','U','DBS','" << zeroFill(rowDoc.get("NDOC")) << "." << rowRDoc.get("NRIGA") << "','" << rowRDoc.get("CODARTMAG") << "','";
|
||
|
||
// Inserisco TIPORD
|
||
sqlQuery << (rowRDoc.get("DACODNUM") == "ORC" ? "R" : "P");
|
||
|
||
// Inserisco FLGSTA, CMAG, DPRICHI, DPRICHF, QPORD, XNOTE, CCLI
|
||
sqlQuery << "',NULL,'";
|
||
|
||
// Se non ho un codice magazzino metto lo standard, Roberto ha detto di metterlo a mano tanto non cambier<65> mai!
|
||
sqlQuery << rowRDoc.get("CODMAG") == "" ? "001" : rowRDoc.get("CODMAG");
|
||
|
||
sqlQuery << "','" << rowDoc.get_date("DATADOC").date2ansi() << "','" << rowRDoc.get_date("DATACONS").date2ansi() << "','" << zeroFill(rowRDoc.get("QTA")) << "',";
|
||
|
||
// Controllo che il campo DESCEST sia pieno
|
||
TString desc; desc << rowRDoc.get("DESCEST");
|
||
if(desc.len() == 0)
|
||
sqlQuery << "NULL,";
|
||
else
|
||
sqlQuery << "'" << desc << "',";
|
||
sqlQuery << "'" << zeroFill(rowDoc.get("CODCF")) << "');";
|
||
|
||
if(sqlset.exec(sqlQuery) != 1)
|
||
{
|
||
message_box(sqlQuery);
|
||
return false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return sqlset.commit() == -1 ? false : true;
|
||
}
|
||
|
||
bool TCampass_app::o01e(const TString id) const
|
||
{
|
||
TODBC_recordset sqlset("", true);
|
||
// Controllo la connessione
|
||
if (!sqlset.connect(DSN, usr, psw))
|
||
return false;
|
||
TRelation doc(LF_DOC),rdoc(LF_RIGHEDOC);
|
||
int items;
|
||
TString msg("Esportazione tabella "); msg << "O01E";
|
||
// Creo il filtro per la chiave del cursore, da quel che ho capito le chiavi sono pi<70> veloci di un filtro (come <20> possibile?)
|
||
TRectype filtroRDoc(rdoc.curr()); filtroRDoc.put("CODNUM", "ORP1");
|
||
TCursor curRDoc(&rdoc, "", 1, &filtroRDoc, &filtroRDoc);
|
||
items = curRDoc.items();
|
||
TProgress_monitor p(items, msg);
|
||
// Adesso inserisco tutta la bella roba
|
||
for (curRDoc = 0; curRDoc.pos() < items && !p.is_cancelled(); ++curRDoc)
|
||
{
|
||
TRectype rowRDoc = curRDoc.curr();
|
||
|
||
// Vado a prendere la riga di riferimento
|
||
TRectype filtroFiltro(rdoc.curr());
|
||
if(rowRDoc.get("DACODNUM") == "ORC")
|
||
{
|
||
filtroFiltro.put("CODNUM", rowRDoc.get("DACODNUM"));
|
||
filtroFiltro.put("ANNO", rowRDoc.get("DAANNO"));
|
||
filtroFiltro.put("PROVV", rowRDoc.get("DAPROVV"));
|
||
filtroFiltro.put("NDOC", rowRDoc.get("DANDOC"));
|
||
filtroFiltro.put("NRIGA", rowRDoc.get("DAIDRIGA"));
|
||
TCursor curFiltro(&rdoc, "RIGAEVASA != \"X\"", 1, &filtroFiltro, &filtroFiltro);
|
||
for (curFiltro = 0; curFiltro.pos() < curFiltro.items() && !p.is_cancelled(); ++curFiltro)
|
||
{
|
||
TRectype rowFiltro(curFiltro.curr());
|
||
// Dichiaro la stringa
|
||
TString sqlQuery;
|
||
TString codagg; codagg << rowFiltro.get("CODAGG1");
|
||
// Inserisco IIKRUNIMP, FAZI, CStr, CPRD, CART
|
||
sqlQuery << "INSERT INTO O01E ( IKRUNIMP, CPRD, CPARAM, CPARVAL ) \
|
||
VALUES('" << id << "','" << zeroFill(rowRDoc.get("NDOC")) << "." << rowRDoc.get("NRIGA") << "','TONING','" << codagg.sub(0,5) << "');";
|
||
sqlQuery << "INSERT INTO O01E ( IKRUNIMP, CPRD, CPARAM, CPARVAL ) \
|
||
VALUES('" << id << "','" << zeroFill(rowRDoc.get("NDOC")) << "." << rowRDoc.get("NRIGA") << "','CALING','" << codagg.sub(6) << "');";
|
||
codagg = rowFiltro.get("CODAGG2");
|
||
sqlQuery << "INSERT INTO O01E ( IKRUNIMP, CPRD, CPARAM, CPARVAL ) \
|
||
VALUES('" << id << "','" << zeroFill(rowRDoc.get("NDOC")) << "." << rowRDoc.get("NRIGA") << "','TONUSC','" << codagg.sub(0,5) << "');";
|
||
sqlQuery << "INSERT INTO O01E ( IKRUNIMP, CPRD, CPARAM, CPARVAL ) \
|
||
VALUES('" << id << "','" << zeroFill(rowRDoc.get("NDOC")) << "." << rowRDoc.get("NRIGA") << "','CALUSC','" << codagg.sub(6) << "');";
|
||
if(sqlset.exec(sqlQuery) != 1)
|
||
{
|
||
message_box(sqlQuery);
|
||
return false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return sqlset.commit() == -1 ? false : true;
|
||
}
|
||
bool TCampass_app::o02a(const TString CodNum, const TString id) const
|
||
{
|
||
TODBC_recordset sqlset("", true);
|
||
// Controllo la connessione
|
||
if (!sqlset.connect(DSN, usr, psw))
|
||
return false;
|
||
TRelation doc(LF_DOC),rdoc(LF_RIGHEDOC);
|
||
int items;
|
||
TString msg("Esportazione tabella "); msg << "O02A - " << CodNum;
|
||
// Creo il filtro per la chiave del cursore, da quel che ho capito le chiavi sono pi<70> veloci di un filtro (come <20> possibile?)
|
||
TRectype filtroRDoc(rdoc.curr()); filtroRDoc.put("CODNUM", CodNum);
|
||
TCursor curRDoc(&rdoc, "RIGAEVASA != \"X\"", 1, &filtroRDoc, &filtroRDoc);
|
||
items = curRDoc.items();
|
||
|
||
TProgress_monitor p(items, msg);
|
||
// Adesso inserisco tutta la bella roba
|
||
for (curRDoc = 0; curRDoc.pos() < items && !p.is_cancelled(); ++curRDoc)
|
||
{
|
||
int num = curRDoc.pos();
|
||
// Aggiorno il Progress Monitor
|
||
if (!p.add_status())
|
||
break;
|
||
// Dichiaro la stringa
|
||
TString sqlQuery;
|
||
// Prendo la riga di RDOC
|
||
TRectype rowRDoc = curRDoc.curr();
|
||
|
||
// Vado a prendere il documento di riferimento
|
||
TRectype filtroDoc(doc.curr());
|
||
filtroDoc.put(DOC_PROVV, rowRDoc.get("PROVV"));
|
||
filtroDoc.put(DOC_ANNO, rowRDoc.get("ANNO"));
|
||
filtroDoc.put(DOC_CODNUM, rowRDoc.get("CODNUM"));
|
||
filtroDoc.put(DOC_NDOC, rowRDoc.get("NDOC"));
|
||
TCursor curDoc(&doc, "", 1, &filtroDoc, &filtroDoc);
|
||
curDoc.items();
|
||
// Forzo a 0, senn<6E> ci sono problemi di sporcizia
|
||
curDoc = 0;
|
||
TRectype rowDoc = (curDoc.curr());
|
||
|
||
// Inserisco IKRUNIMP, FAZI, CStr, CMAG, CCLIH, CCLIR, CCLI
|
||
sqlQuery << "INSERT INTO O02A ( IKRUNIMP, FAZI, CStr, CMAG, CCLIH, CCLIR, CCLI, FLGSTA, XRIFCLI, XNOTE, CART, QCORD, QCSPE, DCCONF ) \
|
||
VALUES('" << id << "','U','DBS','" << rowRDoc.get("CODMAG") << "','" << rowRDoc.get("ANNO") << "." << CodNum << "." << zeroFill(rowRDoc.get("NDOC")) << "','" << rowRDoc.get("NRIGA") << "','" << zeroFill(rowDoc.get("CODCF")) << "','";
|
||
// Inserisco FLGSTA
|
||
sqlQuery << (rowRDoc.get("RIGAEVASA") == "X" ? "C" : "A");
|
||
// Inserisco XRIFCLI, XNOTE, CART, QCORD, QCSPE, DCCONF
|
||
sqlQuery << "','" << rowDoc.get("NUMDOCRIF") << "-" << rowDoc.get_date("DATADOCRIF").date2ansi() << "','" << toEscape(rowRDoc.get("DESCEST")) << "','" << toEscape(rowRDoc.get("CODARTMAG"))
|
||
<< "','" << rowRDoc.get("QTA") << "','" << rowRDoc.get("QTAEVASA") << "','" << rowRDoc.get_date("DATACONS").date2ansi() << "');";
|
||
|
||
if(sqlset.exec(sqlQuery) != 1)
|
||
{
|
||
message_box(sqlQuery);
|
||
return false;
|
||
}
|
||
}
|
||
return sqlset.commit() == -1 ? false : true;
|
||
}
|
||
bool TCampass_app::o02c(const TString CodNum, const TString id) const
|
||
{
|
||
TODBC_recordset sqlset("", true);
|
||
// Controllo la connessione
|
||
if (!sqlset.connect(DSN, usr, psw))
|
||
return false;
|
||
TRelation doc(LF_DOC),rdoc(LF_RIGHEDOC);
|
||
int items;
|
||
TString msg("Esportazione tabella "); msg << "O02C - " << CodNum;
|
||
// Creo il filtro per la chiave del cursore, da quel che ho capito le chiavi sono pi<70> veloci di un filtro (come <20> possibile?)
|
||
TRectype filtroRDoc(rdoc.curr()); filtroRDoc.put("CODNUM", "ORP1");
|
||
TCursor curRDoc(&rdoc, "", 1, &filtroRDoc, &filtroRDoc);
|
||
items = curRDoc.items();
|
||
|
||
TProgress_monitor p(items, msg);
|
||
// Adesso inserisco tutta la bella roba
|
||
for (curRDoc = 0; curRDoc.pos() < items && !p.is_cancelled(); ++curRDoc)
|
||
{
|
||
int num = curRDoc.pos();
|
||
// Aggiorno il Progress Monitor
|
||
if (!p.add_status())
|
||
break;
|
||
// Prendo la riga del FILTRO
|
||
TRectype rowRDoc = curRDoc.curr();
|
||
|
||
// Vado a prendere la riga di riferimento
|
||
TRectype filtroFiltro(rdoc.curr());
|
||
if(rowRDoc.get("DACODNUM") == CodNum)
|
||
{
|
||
filtroFiltro.put("CODNUM", rowRDoc.get("DACODNUM"));
|
||
filtroFiltro.put("ANNO", rowRDoc.get("DAANNO"));
|
||
filtroFiltro.put("PROVV", rowRDoc.get("DAPROVV"));
|
||
filtroFiltro.put("NDOC", rowRDoc.get("DANDOC"));
|
||
filtroFiltro.put("NRIGA", rowRDoc.get("DAIDRIGA"));
|
||
TCursor curFiltro(&rdoc, "RIGAEVASA != \"X\"", 1, &filtroFiltro, &filtroFiltro);
|
||
for (curFiltro = 0; curFiltro.pos() < curFiltro.items() && !p.is_cancelled(); ++curFiltro)
|
||
{
|
||
// Dichiaro la stringa
|
||
TString sqlQuery;
|
||
|
||
// Inserisco Tutto (yeeeeeeeeeeeeeee)
|
||
sqlQuery << "INSERT INTO O02C ( IKRUNIMP, CStr, CPRD, CCLIH, CCLIR, BVAL) \
|
||
VALUES('" << id << "','DBS','" << zeroFill(rowRDoc.get("NDOC")) << "." << rowRDoc.get("NRIGA") << "','" << rowRDoc.get("ANNO") << "." << CodNum << zeroFill(rowRDoc.get("DANDOC")) << "','" << rowRDoc.get("DAIDRIGA") << "','1');";
|
||
|
||
if(sqlset.exec(sqlQuery) != 1)
|
||
{
|
||
message_box(sqlQuery);
|
||
return false;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
return sqlset.commit() == -1 ? false : true;
|
||
}
|
||
bool TCampass_app::o03a(const TString id) const
|
||
{
|
||
TODBC_recordset sqlset("", true);
|
||
// Controllo la connessione
|
||
if (!sqlset.connect(DSN, usr, psw))
|
||
return false;
|
||
TRelation clifo(LF_CLIFO);
|
||
int items;
|
||
TString msg("Esportazione tabella "); msg << "O03A";
|
||
// Creo il filtro per la chiave del cursore, da quel che ho capito le chiavi sono pi<70> veloci di un filtro (come <20> possibile?)
|
||
TRectype filtro(clifo.curr()); filtro.put("TIPOCF", "C");
|
||
TCursor curClifo(&clifo, "", 1, &filtro, &filtro);
|
||
items = curClifo.items();
|
||
TProgress_monitor p(items, msg);
|
||
// Adesso inserisco tutta la bella roba
|
||
for (curClifo = 0; curClifo.pos() < items && !p.is_cancelled(); ++curClifo)
|
||
{
|
||
int num = curClifo.pos();
|
||
// Aggiorno il Progress Monitor
|
||
if (!p.add_status())
|
||
break;
|
||
// Dichiaro la stringa
|
||
TString sqlQuery;
|
||
// Prendo la riga di RDOC
|
||
TRectype rowClifo = curClifo.curr();
|
||
// Inserisco tutto in un colpo (yeeeeeeeee)
|
||
sqlQuery << "INSERT INTO O03A ( IKRUNIMP, FAZI, CStr, CCLI, RCLI ) \
|
||
VALUES('" << id << "','U','DBS','" << zeroFill(rowClifo.get("CODCF")) << "','" << toEscape(rowClifo.get("RAGSOC")) << "');";
|
||
|
||
if(sqlset.exec(sqlQuery) != 1)
|
||
{
|
||
message_box(sqlQuery);
|
||
return false;
|
||
}
|
||
}
|
||
return sqlset.commit() == -1 ? false : true;
|
||
}
|
||
bool TCampass_app::p01a(const TString id) const
|
||
{
|
||
TODBC_recordset sqlset("", true);
|
||
// Controllo la connessione
|
||
if (!sqlset.connect(DSN, usr, psw))
|
||
return false;
|
||
TRelation anamag(LF_ANAMAG), rdist(LF_RDIST), umart(LF_UMART);
|
||
int items;
|
||
TString msg("Esportazione tabella "); msg << "P01A";
|
||
TCursor curAna(&anamag), curRDist(&rdist), curUmart(&umart);
|
||
items = curAna.items(); curRDist.items();curUmart.items();
|
||
TString artRDist, artUmart;
|
||
TProgress_monitor p(items, msg);
|
||
// Adesso inserisco tutta la bella roba
|
||
for (curAna = 0; curAna.pos() < items && !p.is_cancelled(); ++curAna)
|
||
{
|
||
int num = curAna.pos();
|
||
// Aggiorno il Progress Monitor
|
||
if (!p.add_status())
|
||
break;
|
||
// Dichiaro la stringa
|
||
TString sqlQuery;
|
||
// Prendo la riga di ANAMAG
|
||
TRectype rowAna = curAna.curr();
|
||
// Inserisco IKRUNIMP,CART,RPART,CFAM
|
||
sqlQuery << "INSERT INTO P01A (IKRUNIMP,FAZI,CStr,CART,RART,CFAM,CTART,CUDMP,CUDMM,CUDMA,CUDMV,PCONVPMN,PCONVPMD,PCONVPVN,PCONVPVD,PCONVPAN,PCONVPAD,FOBS) \
|
||
VALUES('" << id << "','U','DBS','" << toEscape(rowAna.get("CODART")) << "','" << toEscape(rowAna.get("DESCR")) << "','" << getFam(rowAna.get("CODART")) <<"','";
|
||
|
||
|
||
/****************************************************************************
|
||
* Senza ricreare il cursore ogni volta lo scorro insieme a DIST e RDIST
|
||
* spostandomi solo quando trovo le righe interessate.
|
||
* Con questo ragionamento risparmio circa 1 secondo
|
||
*****************************************************************************/
|
||
TRectype rowRDist = curRDist.curr();
|
||
// Carico il codice attuale
|
||
artRDist = rowRDist.get("CODDIST");
|
||
// Controllo se il cursore punta allo stesso articolo
|
||
// Inserisco CTART
|
||
if(artRDist == rowAna.get("CODART"))
|
||
{
|
||
bool trovato = false;
|
||
while(rowRDist.get("CODDIST") == rowAna.get("CODART"))
|
||
{
|
||
if(rowRDist.get("CODCOMP") == rowAna.get("CODART"))
|
||
trovato = true;
|
||
++curRDist;
|
||
rowRDist = curRDist.curr();
|
||
}
|
||
sqlQuery << (trovato ? "SL" : "PF");
|
||
}
|
||
else
|
||
sqlQuery << "MP";
|
||
sqlQuery << "','";
|
||
|
||
/****************************************************************************
|
||
* Parto dal presupposto che tutti gli articoli sono presenti in UMART.
|
||
* Senza ricreare il cursore ogni volta lo scorro insieme a ANAMAG
|
||
* spostandomi solo quando trovo le righe interessate.
|
||
* Con questo ragionamento risparmio circa 1 secondo
|
||
*****************************************************************************/
|
||
|
||
TRectype rowUmart = curUmart.curr();
|
||
// Carico il codice attuale
|
||
artUmart = rowUmart.get("CODART");
|
||
// Controllo se il cursore punta allo stesso articolo,
|
||
// siccome a volte possono esserci righe delle distinte senza articolo mi sposto finch<63> non lo trovo
|
||
while(artUmart != rowAna.get("CODART"))
|
||
{
|
||
++curUmart;
|
||
rowUmart = curUmart.curr();
|
||
artUmart = rowUmart.get("CODART");
|
||
}
|
||
TString UM; UM << rowUmart.get("UM");
|
||
TString UM2;
|
||
// Inserisco CUDMP,CUDMM,CUDMA,CUDMV
|
||
sqlQuery << UM <<"','" << UM <<"','" << UM <<"','";
|
||
// Mi sposto per prendere la seconda riga
|
||
++curUmart;
|
||
rowUmart = curUmart.curr();
|
||
if(artUmart == rowUmart.get("CODART")) // Controllo di essere sulla seconda riga
|
||
{
|
||
UM2 << rowUmart.get("UM");
|
||
++curUmart;
|
||
}
|
||
else
|
||
UM2 << UM;
|
||
sqlQuery << UM2 <<"','";
|
||
|
||
// Inserisco PCONVPMN,PCONVPMD,PCONVPVN,PCONVPVD,PCONVPAN,PCONVPAD
|
||
// Se siamo alla riga 2 di UMART prendo il valore, altrimenti passo 1
|
||
TString FC; FC << (curUmart.items() > 1 ? rowUmart.get_real("FC") : "1");
|
||
sqlQuery << "1','1','1','" << FC << "','1','1','";
|
||
|
||
// Inserisco FOBS
|
||
sqlQuery << rowAna.get_bool("SOSPESO") ? "1" : "0";
|
||
// Chiudo la query
|
||
sqlQuery << "');";
|
||
if(sqlset.exec(sqlQuery) != 1)
|
||
{
|
||
message_box(sqlQuery);
|
||
return false;
|
||
}
|
||
}
|
||
return sqlset.commit() == -1 ? false : true;
|
||
}
|
||
bool TCampass_app::p01b(const TString id) const
|
||
{
|
||
TODBC_recordset sqlset("", true);
|
||
// Controllo la connessione
|
||
if (!sqlset.connect(DSN, usr, psw))
|
||
return false;
|
||
TRelation anamag(LF_ANAMAG), tab(LF_TAB);
|
||
int items, itemsTab;
|
||
TString msg("Esportazione tabella "); msg << "P01B";
|
||
// Anamag
|
||
TCursor curAna(&anamag);
|
||
items = curAna.items();
|
||
// Tab
|
||
|
||
|
||
TProgress_monitor p(items, msg);
|
||
|
||
|
||
// Adesso inserisco tutta la bella roba
|
||
for (curAna = 0; curAna.pos() < items && !p.is_cancelled(); ++curAna)
|
||
{
|
||
int num = curAna.pos();
|
||
// Aggiorno il Progress Monitor
|
||
if (!p.add_status())
|
||
break;
|
||
|
||
// Prendo la riga di TAB
|
||
TRectype rowAna = curAna.curr();
|
||
|
||
// Dichiaro la stringa
|
||
TString sqlQuery;
|
||
|
||
if(rowAna.get("USER3") != "")
|
||
{
|
||
// Inserisco Tutto
|
||
sqlQuery << "INSERT INTO P01B ( IKRUNIMP, CStr, CART, CPARAM, CPARVAL ) \
|
||
VALUES('" << id << "','DBS','" << toEscape(rowAna.get("CODART")) << "','MISREA','" << rowAna.get("USER3") << "x"<< rowAna.get("USER4") << "');";
|
||
}
|
||
|
||
TString anamagCod(rowAna.get("CODART")), filtroCodTab;
|
||
filtroCodTab << "3" << anamagCod.sub(6,12);
|
||
// Tab *******************************************************************************************************************************************************
|
||
// Filtri
|
||
TRectype filtroTab(tab.curr());
|
||
filtroTab.put("COD","GCA");
|
||
filtroTab.put("CODTAB",filtroCodTab);
|
||
// Cursore
|
||
TCursor curTab(&tab, "", 1, &filtroTab, &filtroTab);
|
||
// Items
|
||
itemsTab = curTab.items();
|
||
if (itemsTab > 0)
|
||
bool yeah = true;
|
||
for (curTab = 0; curTab.pos() < itemsTab && !p.is_cancelled(); ++curTab)
|
||
{
|
||
TRectype rowTab = curTab.curr();
|
||
sqlQuery << "INSERT INTO P01B ( IKRUNIMP, CStr, CART, CPARAM, CPARVAL ) \
|
||
VALUES('" << id << "','DBS','" << toEscape(rowAna.get("CODART")) << "','FORING','" << rowTab.get("S0") << "');";
|
||
}
|
||
if(sqlQuery != "" && sqlset.exec(sqlQuery) != 1)
|
||
return false;
|
||
}
|
||
|
||
return sqlset.commit() == -1 ? false : true;
|
||
}
|
||
bool TCampass_app::p02a(const TString id) const
|
||
{
|
||
TODBC_recordset sqlset("", true);
|
||
// Controllo la connessione
|
||
if (!sqlset.connect(DSN, usr, psw))
|
||
return false;
|
||
TRelation tab(LF_TAB);
|
||
int items;
|
||
TString msg("Esportazione tabella "); msg << "P02A";
|
||
// Creo il filtro per la chiave del cursore, da quel che ho capito le chiavi sono pi<70> veloci di un filtro (come <20> possibile?)
|
||
TRectype filtroTab(tab.curr()); filtroTab.put("COD", "GCA"); filtroTab.put("CODTAB", "2");
|
||
TCursor curTab(&tab, "", 1, &filtroTab, &filtroTab);
|
||
items = curTab.items();
|
||
TProgress_monitor p(items, msg);
|
||
// Adesso inserisco tutta la bella roba
|
||
for (curTab = 0; curTab.pos() < items && !p.is_cancelled(); ++curTab)
|
||
{
|
||
int num = curTab.pos();
|
||
// Aggiorno il Progress Monitor
|
||
if (!p.add_status())
|
||
break;
|
||
|
||
// Prendo la riga di TAB
|
||
TRectype rowTab = curTab.curr();
|
||
|
||
TString codTab; codTab << rowTab.get("CODTAB");
|
||
// Dichiaro la stringa
|
||
TString sqlQuery;
|
||
|
||
// Inserisco Tutto
|
||
sqlQuery << "INSERT INTO P02A (IKRUNIMP, FAZI, CStr, FGRP, NLIV0, RLIV0, CGRP0, RGRP0 ) \
|
||
VALUES('" << id << "','U','DBS','0','0','0','" << getGroup(rowTab.get("CODTAB")) << "','" << rowTab.get("S0") << "');";
|
||
if(sqlset.exec(sqlQuery) != 1)
|
||
{
|
||
message_box(sqlQuery);
|
||
return false;
|
||
}
|
||
}
|
||
return sqlset.commit() == -1 ? false : true;
|
||
}
|
||
|
||
void TCampass_app::main_loop()
|
||
{
|
||
TCampass_msk m;
|
||
while (m.run() == K_ENTER)
|
||
{
|
||
const TString& DSN = m.get(F_DSN);
|
||
const TString& usr = m.get(F_USR);
|
||
const TString& psw = m.get(F_PWD);
|
||
if(checkParameters(DSN, usr, psw))
|
||
{
|
||
// Chiamo la funzione globale esporta
|
||
TString errors; errors << esporta(DSN, usr, psw);
|
||
if(errors == "")
|
||
{
|
||
message_box("Esportazione effettuata correttamente!");
|
||
// Salvo i parametri
|
||
}
|
||
else message_box(errors);
|
||
}
|
||
else
|
||
message_box("Fallita connessione");
|
||
}
|
||
}
|
||
|
||
|
||
int mr0600(int argc, char* argv[])
|
||
{
|
||
TCampass_app app;
|
||
// Imposto le tabelle da utilizzare
|
||
app.setTable("A01A|O01A|O01B|O01C|O02A|O02C|O03A|P01A|P01B|P02A");
|
||
app.run(argc, argv, TR("Collegamento Campo/Compass"));
|
||
return 0;
|
||
}
|
||
|
||
|
||
|
||
/*
|
||
bool TCampass_app::o01b(const TString& DSN) const
|
||
{
|
||
TODBC_recordset sqlset("", true);
|
||
// Controllo la connessione
|
||
if (!sqlset.connect(DSN, usr, psw))
|
||
return false;
|
||
TRelation rdoc(LF_RIGHEDOC), rdist(LF_RDIST), tab(LF_TAB);
|
||
int items;
|
||
TString msg("Esportazione tabella "); msg << "O01B";
|
||
// Creo il filtro per la chiave del cursore, da quel che ho capito le chiavi sono pi<70> veloci di un filtro (come <20> possibile?)
|
||
TRectype filtroRdoc(rdoc.curr()); filtroRdoc.put("CODNUM", "ORP1");
|
||
TRectype filtroTab(rdoc.curr()); filtroTab.put("CODTAB", "LAV");
|
||
TCursor curRDoc(&rdoc, "RIGAEVASA != \"X\"", 1, &filtroRdoc, &filtroRdoc);
|
||
TCursor curTab(&tab, "", 1, &filtroTab, &filtroTab);
|
||
TCursor curDist(&rdist, "TIPO = \"L\"");
|
||
items = curRDoc.items();
|
||
TProgress_monitor p(items, msg);
|
||
// Adesso inserisco tutta la bella roba
|
||
for (curRDoc = 0; curRDoc.pos() < items && !p.is_cancelled(); ++curRDoc)
|
||
{
|
||
int num = curRDoc.pos();
|
||
// Aggiorno il Progress Monitor
|
||
if (!p.add_status())
|
||
break;
|
||
|
||
// Prendo la riga di RDOC
|
||
TRectype rowRDoc = curRDoc.curr();
|
||
|
||
// Verifico la presenza di un ordine cliente con i valori della riga attuale
|
||
TRectype filtroFiltro(rdoc.curr());
|
||
filtroFiltro.put(RDOC_CODNUM, rowRDoc.get("DACODNUM"));
|
||
filtroFiltro.put(RDOC_ANNO, rowRDoc.get("DAANNO"));
|
||
filtroFiltro.put(RDOC_PROVV, rowRDoc.get("DAPROVV"));
|
||
filtroFiltro.put(RDOC_NDOC, rowRDoc.get("DANDOC"));
|
||
filtroFiltro.put(RDOC_NRIGA, rowRDoc.get("DAIDRIGA"));
|
||
TCursor curFiltro(&rdoc, "RIGAEVASA != \"X\"", 1, &filtroFiltro, &filtroFiltro); // Applico un FILTRO al FILTRO cos<6F> da FILTRARE la tabella per lavorare sui dati FILTRATI che necessito siano FILTRATI
|
||
int itemFiltro = curFiltro.items();
|
||
if(itemFiltro > 0) // Se non ci sono match non ha senso proseguire
|
||
{
|
||
// DA FINIRE, <20> STATA MESSA IN PAUSA
|
||
|
||
// Inserisco IKRUNIMP, CStr
|
||
sqlQuery << "INSERT INTO O01B ( IKRUNIMP, CStr, CPRD, NFAS, RFAS, XNOTE, QPFFAS, CUDMF, XCONVFN, XCONVFD, BSCH, CMAC, EBASE, QBASE, XPINS, XPUTIL ) \
|
||
VALUES('1','DBS','" << rowDoc.get("CODCF") << "','";
|
||
|
||
|
||
if(sqlset.exec(sqlQuery) != 1)
|
||
{
|
||
message_box(sqlQuery);
|
||
return false;
|
||
}
|
||
}
|
||
}
|
||
return sqlset.commit() == -1 ? false : true;
|
||
}
|
||
*/
|
||
|