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
152
ca/ca2100.cpp
152
ca/ca2100.cpp
@ -4,6 +4,7 @@
|
|||||||
#include <postman.h>
|
#include <postman.h>
|
||||||
#include <recset.h>
|
#include <recset.h>
|
||||||
#include <sheet.h>
|
#include <sheet.h>
|
||||||
|
#include <urldefid.h>
|
||||||
|
|
||||||
#include "ca2.h"
|
#include "ca2.h"
|
||||||
#include "ca2100a.h"
|
#include "ca2100a.h"
|
||||||
@ -53,6 +54,7 @@ protected:
|
|||||||
void load_cg_row(const TRectype& row);
|
void load_cg_row(const TRectype& row);
|
||||||
void load_cg_mov();
|
void load_cg_mov();
|
||||||
bool is_ripartible_movcg(bool& has_multirip);
|
bool is_ripartible_movcg(bool& has_multirip);
|
||||||
|
void display_rmov_comp() const;
|
||||||
|
|
||||||
int create_sheet_fields(int lf, int& y, short& dlg, bool required);
|
int create_sheet_fields(int lf, int& y, short& dlg, bool required);
|
||||||
void create_sheet();
|
void create_sheet();
|
||||||
@ -103,6 +105,7 @@ protected:
|
|||||||
virtual void init_insert_mode(TMask& m);
|
virtual void init_insert_mode(TMask& m);
|
||||||
virtual void init_modify_mode(TMask& m);
|
virtual void init_modify_mode(TMask& m);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual TRelation* get_relation() const;
|
virtual TRelation* get_relation() const;
|
||||||
};
|
};
|
||||||
@ -126,6 +129,11 @@ bool TMovanal_msk::on_key(KEY key)
|
|||||||
enable(F_BLOCCATO);
|
enable(F_BLOCCATO);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (key == K_F8)
|
||||||
|
{
|
||||||
|
display_rmov_comp();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return TAutomask::on_key(key);
|
return TAutomask::on_key(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -453,6 +461,145 @@ int TMovanal_msk::get_constant_columns(TToken_string& tok) const
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class TComp_row : public TArray_sheet
|
||||||
|
{
|
||||||
|
TEdit_field& _fld;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual bool get_ini_paragraph(const TEdit_field& f, TString& name) const;
|
||||||
|
|
||||||
|
virtual long handler(WINDOW win, EVENT* ep);
|
||||||
|
TEdit_field& field() { return _fld; }
|
||||||
|
|
||||||
|
public:
|
||||||
|
TComp_row(TEdit_field& f);
|
||||||
|
};
|
||||||
|
|
||||||
|
bool TComp_row::get_ini_paragraph(const TEdit_field& field, TString& parag) const
|
||||||
|
{
|
||||||
|
const bool ok = TSheet::get_ini_paragraph(field, parag);
|
||||||
|
if (ok)
|
||||||
|
parag << "_F80";
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
long TComp_row::handler(WINDOW win, EVENT* ep)
|
||||||
|
{
|
||||||
|
if (ep->type == E_MOUSE_DOWN)
|
||||||
|
{
|
||||||
|
switch (ep->v.mouse.button )
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
MENU_ITEM* menu = xvt_res_get_menu(BROWSE_BAR);
|
||||||
|
if (menu != NULL && menu->child != NULL)
|
||||||
|
{
|
||||||
|
dictionary_translate_menu(menu);
|
||||||
|
const PNT& p = ep->v.mouse.where;
|
||||||
|
RCT cr; xvt_vobj_get_client_rect(win, &cr);
|
||||||
|
XVT_POPUP_ALIGNMENT pa = XVT_POPUP_CENTER;
|
||||||
|
if (p.h < cr.right / 3)
|
||||||
|
pa = XVT_POPUP_LEFT_ALIGN;
|
||||||
|
else
|
||||||
|
if (p.h > 2 * cr.right / 3)
|
||||||
|
pa = XVT_POPUP_RIGHT_ALIGN;
|
||||||
|
|
||||||
|
xvt_menu_popup(menu->child, win, p, pa, NULL);
|
||||||
|
xvt_res_free_menu_tree(menu);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (ep->type == E_COMMAND)
|
||||||
|
{
|
||||||
|
switch (ep->v.cmd.tag)
|
||||||
|
{
|
||||||
|
case BROWSE_BAR + 1:
|
||||||
|
save_columns_order(field());
|
||||||
|
return 0;
|
||||||
|
case BROWSE_BAR + 2:
|
||||||
|
set_columns_order(NULL);
|
||||||
|
return 0;
|
||||||
|
case BROWSE_BAR + 3:
|
||||||
|
fld(0).on_key(K_F11);
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TArray_sheet::handler(win, ep);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TComp_row::TComp_row(TEdit_field& f)
|
||||||
|
: TArray_sheet(0, 3, -1, 16, TR("XX"),
|
||||||
|
HR("Anno|Mese|Data competenza|Data fine competenza|Dare@18|Avere@18"), 0, 1),
|
||||||
|
_fld(f)
|
||||||
|
{
|
||||||
|
load_columns_order(_fld);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TMovanal_msk::display_rmov_comp() const
|
||||||
|
{
|
||||||
|
TSheet_field& rmov_sheet = sfield(F_RIGHE);
|
||||||
|
TComp_row sheet(rmov_sheet.sheet_mask().efield(S_DARE));
|
||||||
|
TString_array & el = sheet.rows_array();
|
||||||
|
const TDate start = get(F_DATACOMP);
|
||||||
|
const TDate stop = get(F_DATAFCOMP);
|
||||||
|
const int r = rmov_sheet.selected();
|
||||||
|
TToken_string & row = rmov_sheet.row(r);
|
||||||
|
const bool dare = *row.get(rmov_sheet.cid2index(S_DARE)) != '\0';
|
||||||
|
const real importo(row.get(rmov_sheet.cid2index(dare ? S_DARE : S_AVERE)));
|
||||||
|
TGeneric_distrib dist(importo, 2);
|
||||||
|
|
||||||
|
for (TDate d = start; d <= stop; ++d)
|
||||||
|
{
|
||||||
|
TDate em(d);
|
||||||
|
if (d.year() == stop.year() && d.month() == stop.month())
|
||||||
|
em = stop;
|
||||||
|
else
|
||||||
|
em.set_end_month();
|
||||||
|
dist.add(em - d + 1L);
|
||||||
|
d = em;
|
||||||
|
}
|
||||||
|
for (TDate d = start; d <= stop; ++d)
|
||||||
|
{
|
||||||
|
TDate em(d);
|
||||||
|
if (d.year() == stop.year() && d.month() == stop.month())
|
||||||
|
em = stop;
|
||||||
|
else
|
||||||
|
em.set_end_month();
|
||||||
|
|
||||||
|
TToken_string detail_row;
|
||||||
|
|
||||||
|
detail_row.add(d.year());
|
||||||
|
detail_row.add(d.month());
|
||||||
|
detail_row.add(d);
|
||||||
|
detail_row.add(em);
|
||||||
|
const TString importo(dist.get().stringa());
|
||||||
|
if (dare)
|
||||||
|
{
|
||||||
|
detail_row.add(importo);
|
||||||
|
detail_row.add("");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
detail_row.add("");
|
||||||
|
detail_row.add(importo);
|
||||||
|
}
|
||||||
|
el.add(detail_row);
|
||||||
|
d = em;
|
||||||
|
}
|
||||||
|
sheet.run();
|
||||||
|
}
|
||||||
|
|
||||||
bool TMovanal_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
bool TMovanal_msk::on_field_event(TOperable_field& o, TField_event e, long jolly)
|
||||||
{
|
{
|
||||||
static TString __codcms;
|
static TString __codcms;
|
||||||
@ -527,8 +674,11 @@ bool TMovanal_msk::on_field_event(TOperable_field& o, TField_event e, long jolly
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case DLG_USER:
|
||||||
|
display_rmov_comp();
|
||||||
|
break;
|
||||||
case F_RIGHE:
|
case F_RIGHE:
|
||||||
if (e == se_enter)
|
if (e == se_enter)
|
||||||
{
|
{
|
||||||
const int r = int(jolly);
|
const int r = int(jolly);
|
||||||
|
|
||||||
|
@ -76,29 +76,33 @@ TBoard_msk::TBoard_msk() : TAutomask("ca2500a")
|
|||||||
class TBoard_app : public TSkeleton_application
|
class TBoard_app : public TSkeleton_application
|
||||||
{
|
{
|
||||||
protected:
|
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;
|
bool esporta(const TString& DSN, TIsam_handle lf, const TDate& datef, const TDate& datet) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void main_loop();
|
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 query(1024);
|
||||||
TString table = prefix().get_filename(lf).name_only(); table.upper();
|
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'",
|
// query.format("SELECT * FROM %s.INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='%s'",
|
||||||
// (const char*)recset.dsn(), (const char*)table);
|
// (const char*)recset.dsn(), (const char*)table);
|
||||||
query.format("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='%s'",
|
query.format("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='%s'",
|
||||||
(const char*)table);
|
(const char*)table);
|
||||||
recset.set(query);
|
set.set(query);
|
||||||
if (recset.items())
|
if (set.items())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
query.cut(0) << "CREATE TABLE " << table << " (\n";
|
query.cut(0) << "CREATE TABLE " << table << " (\n";
|
||||||
const RecDes& rd = prefix().get_recdes(lf);
|
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++)
|
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 << " " << fd.Name;
|
||||||
}
|
}
|
||||||
query << "));";
|
query << "));";
|
||||||
recset.exec(query);
|
set.exec(query);
|
||||||
recset.exec("COMMIT;");
|
set.exec("COMMIT;");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,22 +154,18 @@ bool TBoard_app::esporta(const TString& DSN, TIsam_handle lf, const TDate& datef
|
|||||||
{
|
{
|
||||||
TString sqlquery, dbfquery;
|
TString sqlquery, dbfquery;
|
||||||
TToken_string keyexpr;
|
TToken_string keyexpr;
|
||||||
|
TODBC_recordset sqlset("", true);
|
||||||
|
|
||||||
TODBC_recordset sqlset("");
|
|
||||||
if (!sqlset.connect(DSN))
|
if (!sqlset.connect(DSN))
|
||||||
return false;
|
return false;
|
||||||
|
if (!create_table(DSN, lf))
|
||||||
if (!create_table(sqlset, lf))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TString table = prefix().get_filename(lf).name_only(); table.upper();
|
TString table = prefix().get_filename(lf).name_only(); table.upper();
|
||||||
|
|
||||||
sqlquery.cut(0) << "SELECT * FROM " << table;
|
sqlquery.cut(0) << "SELECT * FROM " << table;
|
||||||
dbfquery << "USE " << lf;
|
dbfquery << "USE " << lf;
|
||||||
// switch (lf)
|
|
||||||
// {
|
|
||||||
// default: break;
|
|
||||||
// }
|
|
||||||
|
|
||||||
sqlset.begin();
|
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;
|
TString msg("Esportazione tabella "); msg << table;
|
||||||
TProgind p(dbfset.items(), msg);
|
TProgind p(dbfset.items(), msg);
|
||||||
|
|
||||||
for (bool go = dbfset.move_first(); go && !p.iscancelled(); go = dbfset.move_next())
|
if (dbfset.items() == 0)
|
||||||
{
|
{
|
||||||
int cmp = 1;
|
if (sqlset.items() > 0L)
|
||||||
|
{
|
||||||
|
TString table = prefix().get_filename(lf).name_only(); table.upper();
|
||||||
|
|
||||||
p.addstatus(1L);
|
TString query("DELETE FROM "); query << table << ";";
|
||||||
if (!sqlset.eof())
|
sqlset.exec(query);
|
||||||
{
|
}
|
||||||
cmp = sqlset.compare_key(dbfset);
|
}
|
||||||
while (cmp > 0)
|
else
|
||||||
{
|
if (sqlset.items() == 0L)
|
||||||
sqlset.remove_rec(dbfset);
|
{
|
||||||
sqlset.move_next();
|
for (bool go = dbfset.move_first(); go&& !p.iscancelled(); go = dbfset.move_next())
|
||||||
sqlset.compare_key(dbfset);
|
{
|
||||||
}
|
p.addstatus(1L);
|
||||||
}
|
sqlset.create_rec(dbfset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (bool go = dbfset.move_first(); go&& !p.iscancelled(); go = dbfset.move_next())
|
||||||
|
{
|
||||||
|
int cmp = 1;
|
||||||
|
|
||||||
if (cmp == 0)
|
p.addstatus(1L);
|
||||||
{
|
if (!sqlset.eof())
|
||||||
if (sqlset.compare_rec(dbfset)) // record modificato
|
{
|
||||||
sqlset.update_rec(dbfset);
|
cmp = sqlset.compare_key(dbfset);
|
||||||
}
|
while (cmp > 0)
|
||||||
else
|
{
|
||||||
sqlset.create_rec(dbfset);
|
sqlset.remove_rec(dbfset);
|
||||||
sqlset.move_next();
|
sqlset.move_next();
|
||||||
}
|
cmp = sqlset.compare_key(dbfset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cmp == 0)
|
||||||
|
{
|
||||||
|
if (sqlset.compare_rec(dbfset)) // record modificato
|
||||||
|
sqlset.update_rec(dbfset);
|
||||||
|
sqlset.move_next();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sqlset.create_rec(dbfset);
|
||||||
|
}
|
||||||
|
}
|
||||||
sqlset.commit();
|
sqlset.commit();
|
||||||
return true;
|
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
|
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)
|
if (!__rmovc)
|
||||||
return EBADMSG;
|
return EBADMSG;
|
||||||
|
|
||||||
@ -2618,7 +2648,10 @@ int TAnal_mov::rewrite(TBaseisamfile& f) const
|
|||||||
update_datacomp();
|
update_datacomp();
|
||||||
const int err = TMultiple_rectype::rewrite(f);
|
const int err = TMultiple_rectype::rewrite(f);
|
||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
|
{
|
||||||
((TAnal_mov*)this)->update_saldi(false);
|
((TAnal_mov*)this)->update_saldi(false);
|
||||||
|
save_rmov_comp();
|
||||||
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2626,7 +2659,10 @@ int TAnal_mov::remove(TBaseisamfile& f) const
|
|||||||
{
|
{
|
||||||
const int err = TMultiple_rectype::remove(f);
|
const int err = TMultiple_rectype::remove(f);
|
||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
|
{
|
||||||
((TAnal_mov*)this)->update_saldi(true);
|
((TAnal_mov*)this)->update_saldi(true);
|
||||||
|
remove_rmov_comp();
|
||||||
|
}
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,8 @@ public:
|
|||||||
void update_totdoc();
|
void update_totdoc();
|
||||||
const char * row_anal_code(int logicnum, int i) const;
|
const char * row_anal_code(int logicnum, int i) const;
|
||||||
const char * row_code(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(long numreg = 0);
|
||||||
TAnal_mov(const TRectype& rec); //accetta LF_MOVANA,LF_RMOVANA,LF_MOV
|
TAnal_mov(const TRectype& rec); //accetta LF_MOVANA,LF_RMOVANA,LF_MOV
|
||||||
|
Loading…
x
Reference in New Issue
Block a user