Patch level : 10.0 270
Files correlati : ca2.exe ca2500a.msk Ricompilazione Demo : [ ] Commento : Aggiunto programma di invio a Board. Ripristinate funzioni di visualizzazione e salvataggio ripartizione temporale delle righe nella modifica movimenti analitici git-svn-id: svn://10.65.10.50/branches/R_10_00@23202 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
8a7486d866
commit
97062094f0
2728
ca/ca2100.cpp
2728
ca/ca2100.cpp
File diff suppressed because it is too large
Load Diff
@ -76,29 +76,33 @@ TBoard_msk::TBoard_msk() : TAutomask("ca2500a")
|
||||
class TBoard_app : public TSkeleton_application
|
||||
{
|
||||
protected:
|
||||
bool create_table(TODBC_recordset& recset, TIsam_handle lf) const;
|
||||
bool create_table(const TString& DSN, TIsam_handle lf) const;
|
||||
bool esporta(const TString& DSN, TIsam_handle lf, const TDate& datef, const TDate& datet) const;
|
||||
|
||||
public:
|
||||
virtual void main_loop();
|
||||
};
|
||||
|
||||
bool TBoard_app::create_table(TODBC_recordset& recset, TIsam_handle lf) const
|
||||
bool TBoard_app::create_table(const TString& DSN, TIsam_handle lf) const
|
||||
{
|
||||
TString query(1024);
|
||||
TString table = prefix().get_filename(lf).name_only(); table.upper();
|
||||
TODBC_recordset set("");
|
||||
|
||||
if (!set.connect(DSN))
|
||||
return false;
|
||||
|
||||
// query.format("SELECT * FROM %s.INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='%s'",
|
||||
// (const char*)recset.dsn(), (const char*)table);
|
||||
query.format("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='%s'",
|
||||
(const char*)table);
|
||||
recset.set(query);
|
||||
if (recset.items())
|
||||
set.set(query);
|
||||
if (set.items())
|
||||
return true;
|
||||
|
||||
query.cut(0) << "CREATE TABLE " << table << " (\n";
|
||||
const RecDes& rd = prefix().get_recdes(lf);
|
||||
const bool access = recset.driver() == ODBC_access;
|
||||
const bool access = set.driver() == ODBC_access;
|
||||
|
||||
for (int f = 0; f < rd.NFields; f++)
|
||||
{
|
||||
@ -140,8 +144,8 @@ bool TBoard_app::create_table(TODBC_recordset& recset, TIsam_handle lf) const
|
||||
query << " " << fd.Name;
|
||||
}
|
||||
query << "));";
|
||||
recset.exec(query);
|
||||
recset.exec("COMMIT;");
|
||||
set.exec(query);
|
||||
set.exec("COMMIT;");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -150,22 +154,18 @@ bool TBoard_app::esporta(const TString& DSN, TIsam_handle lf, const TDate& datef
|
||||
{
|
||||
TString sqlquery, dbfquery;
|
||||
TToken_string keyexpr;
|
||||
TODBC_recordset sqlset("", true);
|
||||
|
||||
TODBC_recordset sqlset("");
|
||||
if (!sqlset.connect(DSN))
|
||||
return false;
|
||||
|
||||
if (!create_table(sqlset, lf))
|
||||
if (!create_table(DSN, lf))
|
||||
return false;
|
||||
|
||||
TString table = prefix().get_filename(lf).name_only(); table.upper();
|
||||
|
||||
sqlquery.cut(0) << "SELECT * FROM " << table;
|
||||
dbfquery << "USE " << lf;
|
||||
// switch (lf)
|
||||
// {
|
||||
// default: break;
|
||||
// }
|
||||
|
||||
|
||||
sqlset.begin();
|
||||
|
||||
@ -176,31 +176,53 @@ bool TBoard_app::esporta(const TString& DSN, TIsam_handle lf, const TDate& datef
|
||||
TString msg("Esportazione tabella "); msg << table;
|
||||
TProgind p(dbfset.items(), msg);
|
||||
|
||||
for (bool go = dbfset.move_first(); go && !p.iscancelled(); go = dbfset.move_next())
|
||||
{
|
||||
int cmp = 1;
|
||||
if (dbfset.items() == 0)
|
||||
{
|
||||
if (sqlset.items() > 0L)
|
||||
{
|
||||
TString table = prefix().get_filename(lf).name_only(); table.upper();
|
||||
|
||||
p.addstatus(1L);
|
||||
if (!sqlset.eof())
|
||||
{
|
||||
cmp = sqlset.compare_key(dbfset);
|
||||
while (cmp > 0)
|
||||
{
|
||||
sqlset.remove_rec(dbfset);
|
||||
sqlset.move_next();
|
||||
sqlset.compare_key(dbfset);
|
||||
}
|
||||
}
|
||||
TString query("DELETE FROM "); query << table << ";";
|
||||
sqlset.exec(query);
|
||||
}
|
||||
}
|
||||
else
|
||||
if (sqlset.items() == 0L)
|
||||
{
|
||||
for (bool go = dbfset.move_first(); go&& !p.iscancelled(); go = dbfset.move_next())
|
||||
{
|
||||
p.addstatus(1L);
|
||||
sqlset.create_rec(dbfset);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (bool go = dbfset.move_first(); go&& !p.iscancelled(); go = dbfset.move_next())
|
||||
{
|
||||
int cmp = 1;
|
||||
|
||||
p.addstatus(1L);
|
||||
if (!sqlset.eof())
|
||||
{
|
||||
cmp = sqlset.compare_key(dbfset);
|
||||
while (cmp > 0)
|
||||
{
|
||||
sqlset.remove_rec(dbfset);
|
||||
sqlset.move_next();
|
||||
cmp = sqlset.compare_key(dbfset);
|
||||
}
|
||||
}
|
||||
|
||||
if (cmp == 0)
|
||||
{
|
||||
if (sqlset.compare_rec(dbfset)) // record modificato
|
||||
sqlset.update_rec(dbfset);
|
||||
}
|
||||
else
|
||||
sqlset.create_rec(dbfset);
|
||||
sqlset.move_next();
|
||||
}
|
||||
if (cmp == 0)
|
||||
{
|
||||
if (sqlset.compare_rec(dbfset)) // record modificato
|
||||
sqlset.update_rec(dbfset);
|
||||
sqlset.move_next();
|
||||
}
|
||||
else
|
||||
sqlset.create_rec(dbfset);
|
||||
}
|
||||
}
|
||||
sqlset.commit();
|
||||
return true;
|
||||
}
|
||||
|
@ -2512,9 +2512,39 @@ void TAnal_mov::update_datacomp() const
|
||||
}
|
||||
}
|
||||
|
||||
static bool __loaded = false;
|
||||
static bool __rmovc = false;
|
||||
|
||||
int TAnal_mov::remove_rmov_comp() const
|
||||
{
|
||||
if (!__loaded)
|
||||
{
|
||||
__rmovc = ini_get_bool(CONFIG_DITTA, "ca", "AttRmovc", false);
|
||||
__loaded = true;
|
||||
}
|
||||
if (!__rmovc)
|
||||
return EBADMSG;
|
||||
|
||||
TISAM_recordset rmac("USE RMOVANAC\nFROM NUMREG=#NR\nTO NUMREG=#NR");
|
||||
|
||||
rmac.set_var("#NR", get_long(MOVANA_NUMREG));
|
||||
TLocalisamfile & lf = rmac.cursor()->relation()->lfile();
|
||||
for (bool ok = rmac.move_first(); ok; ok = rmac.move_next())
|
||||
{
|
||||
const TRectype& curr = rmac.cursor()->curr();
|
||||
|
||||
curr.remove(lf);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TAnal_mov::save_rmov_comp() const
|
||||
{
|
||||
static bool __rmovc = ini_get_bool(CONFIG_DITTA, "ca", "AttRmovc", false);
|
||||
if (!__loaded)
|
||||
{
|
||||
__rmovc = ini_get_bool(CONFIG_DITTA, "ca", "AttRmovc", false);
|
||||
__loaded = true;
|
||||
}
|
||||
if (!__rmovc)
|
||||
return EBADMSG;
|
||||
|
||||
@ -2618,7 +2648,10 @@ int TAnal_mov::rewrite(TBaseisamfile& f) const
|
||||
update_datacomp();
|
||||
const int err = TMultiple_rectype::rewrite(f);
|
||||
if (err == NOERR)
|
||||
{
|
||||
((TAnal_mov*)this)->update_saldi(false);
|
||||
save_rmov_comp();
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -2626,7 +2659,10 @@ int TAnal_mov::remove(TBaseisamfile& f) const
|
||||
{
|
||||
const int err = TMultiple_rectype::remove(f);
|
||||
if (err == NOERR)
|
||||
{
|
||||
((TAnal_mov*)this)->update_saldi(true);
|
||||
remove_rmov_comp();
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,8 @@ public:
|
||||
void update_totdoc();
|
||||
const char * row_anal_code(int logicnum, int i) const;
|
||||
const char * row_code(int i) const;
|
||||
int save_rmov_comp() const;
|
||||
int remove_rmov_comp() const;
|
||||
int save_rmov_comp() const;
|
||||
|
||||
TAnal_mov(long numreg = 0);
|
||||
TAnal_mov(const TRectype& rec); //accetta LF_MOVANA,LF_RMOVANA,LF_MOV
|
||||
|
Loading…
x
Reference in New Issue
Block a user