Merge branch 'R12.00' of http://10.65.20.33/sirio/CAMPO/campo into R12.00
This commit is contained in:
commit
545d90a1b6
@ -646,6 +646,8 @@ bool TDir::is_active () const
|
||||
return main_app().has_module(module, CHK_DONGLE);
|
||||
}
|
||||
|
||||
// riimplementare nella 13
|
||||
|
||||
void TTrec::update_fielddef (int nfld, TToken_string& s)
|
||||
{
|
||||
RecFieldDes& rfd = _rec.Fd[nfld];
|
||||
@ -655,6 +657,59 @@ void TTrec::update_fielddef (int nfld, TToken_string& s)
|
||||
rfd.Dec = s.get_int ();
|
||||
}
|
||||
|
||||
void TTrec::update_fielddef(int nfld, const char * name, int type, int len, int dec)
|
||||
{
|
||||
if (nfld < 0)
|
||||
nfld = _rec.NFields++;
|
||||
|
||||
RecFieldDes& rfd = _rec.Fd[nfld];
|
||||
|
||||
strcpy(rfd.Name, name);
|
||||
rfd.TypeF = type;
|
||||
if (len <= 0)
|
||||
{
|
||||
switch (rfd.TypeF)
|
||||
{
|
||||
case _datefld:
|
||||
rfd.Len = 8;
|
||||
rfd.Dec = 0;
|
||||
break;
|
||||
case _charfld:
|
||||
case _boolfld:
|
||||
rfd.Len = 1;
|
||||
rfd.Dec = 0;
|
||||
break;
|
||||
case _memofld:
|
||||
rfd.Len = 10;
|
||||
rfd.Dec = 0;
|
||||
break;
|
||||
default:
|
||||
message_box("Lunghezza errata");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rfd.Len = len;
|
||||
rfd.Dec = dec;
|
||||
}
|
||||
}
|
||||
|
||||
void TTrec::update_fielddef(int nfld, const RecDes & rd, const char * name)
|
||||
{
|
||||
int i = -1;
|
||||
|
||||
for (i = 0; i < rd.NFields; i++)
|
||||
if (strcmp(rd.Fd[i].Name, name) == 0)
|
||||
break;
|
||||
if (i >= 0)
|
||||
update_fielddef(nfld, rd.Fd[i].Name, rd.Fd[i].TypeF, rd.Fd[i].Len, rd.Fd[i].Dec);
|
||||
}
|
||||
|
||||
|
||||
// riimplementare nella 13
|
||||
|
||||
|
||||
void TTrec::update_keydef (int key, TToken_string& s)
|
||||
{
|
||||
TExpression expr ("", _strexpr);
|
||||
@ -704,6 +759,56 @@ void TTrec::update_keydef (int key, TToken_string& s)
|
||||
}
|
||||
}
|
||||
|
||||
void TTrec::update_keydef(int key, const char * e, const bool dup)
|
||||
{
|
||||
TExpression expr ("", _strexpr);
|
||||
TString ke (e);
|
||||
|
||||
if (key < 0)
|
||||
key = _rec.NKeys++;
|
||||
if (expr.set(ke, _strexpr))
|
||||
{
|
||||
_rec.Ky[key].DupKeys = dup;
|
||||
TCodearray & c = expr.code ();
|
||||
c.begin ();
|
||||
int n = 0;
|
||||
while (!c.end ())
|
||||
{
|
||||
TCode & inst = c.step ();
|
||||
TCodesym sym = inst.getsym ();
|
||||
|
||||
if (sym == _variable)
|
||||
{
|
||||
const char *s = inst.string ();
|
||||
int i;
|
||||
|
||||
for (i = 0; i < _rec.NFields; i++)
|
||||
if (strcmp (_rec.Fd[i].Name, s) == 0)
|
||||
break;
|
||||
|
||||
_rec.Ky[key].FieldSeq[n] = i;
|
||||
_rec.Ky[key].FromCh[n] = INVFLD;
|
||||
_rec.Ky[key].ToCh[n] = INVFLD;
|
||||
inst = c.step ();
|
||||
sym = inst.getsym ();
|
||||
if (sym == _upper)
|
||||
_rec.Ky[key].FieldSeq[n] += MaxFields;
|
||||
else if (sym == _number)
|
||||
{
|
||||
_rec.Ky[key].FromCh[n] = (int)inst.number().integer() - 1;
|
||||
inst = c.step ();
|
||||
_rec.Ky[key].ToCh[n] = _rec.Ky[key].FromCh[n] + (int)inst.number ().integer () - 1;
|
||||
inst = c.step ();
|
||||
}
|
||||
else
|
||||
c.backtrace ();
|
||||
n++;
|
||||
}
|
||||
}
|
||||
_rec.Ky[key].NkFields = n;
|
||||
}
|
||||
}
|
||||
|
||||
void TTrec::print_on(ostream & out) const
|
||||
{
|
||||
const int n = num();
|
||||
@ -779,5 +884,14 @@ void TTrec::read_from(istream & in)
|
||||
_des = NULL;
|
||||
_tab = "";
|
||||
}
|
||||
void TTrec::set_name(const char * name, int nfld)
|
||||
{
|
||||
if (nfld < 0)
|
||||
nfld = _rec.NFields - 1;
|
||||
|
||||
RecFieldDes& rfd = _rec.Fd[nfld];
|
||||
|
||||
strcpy(rfd.Name, name);
|
||||
}
|
||||
|
||||
#endif // FOXPRO
|
||||
|
@ -230,15 +230,33 @@ public:
|
||||
int len() const;
|
||||
|
||||
#ifndef FOXPRO
|
||||
// @cmember Aggiorna la chiave. <p desc> e' una token string
|
||||
void update_keydef(int key, TToken_string& desc);
|
||||
// @cmember Aggiorna il campo. <p desc> e' una token string
|
||||
void update_fielddef(int nfld, TToken_string& desc);
|
||||
// @cmember Aggiorna la chiave. <p desc> e' una token string
|
||||
void update_keydef(int key, const char * e, const bool dup);
|
||||
// @cmember Aggiorna la chiave. <p desc> e' una token string
|
||||
void update_keydef(int key, TToken_string& desc);
|
||||
// @cmember Aggiunge una chiave. <p desc> e' una token string
|
||||
void add_keydef(TToken_string& desc) { update_keydef(-1, desc); }
|
||||
// @cmember Aggiunge una chiave. <p desc> e' una token string
|
||||
void add_keydef(const char * e, const bool dup) { update_keydef(-1, e, dup); }
|
||||
// @cmember Aggiorna il campo.
|
||||
void update_fielddef(int nfld, const char * name, int type, int len = 0, int dec = 0);
|
||||
// @cmember Aggiorna il campo. <p desc> e' una token string
|
||||
void update_fielddef(int nfld, TToken_string& desc);
|
||||
// @cmember Aggiorna il campo.
|
||||
void update_fielddef(int nfld, const RecDes & rd, const char * name);
|
||||
// @cmember Aggiunge un campo. <p desc> e' una token string
|
||||
void add_fielddef(TToken_string& desc) { update_fielddef(-1, desc); }
|
||||
// @cmember Aggiunge un campo.
|
||||
void add_fielddef(const char * name, int type, int len = 0, int dec = 0) { update_fielddef(-1, name, type, len, dec); }
|
||||
// @cmember Aggiunge un campo.
|
||||
void add_fielddef(const RecDes & rd, const char * name) { update_fielddef(-1, rd, name); }
|
||||
// @cmember Stampa il tracciato record sull'output selezionato
|
||||
virtual void print_on(ostream& out) const;
|
||||
// @cmember Legge il tracciato record da input selezionato
|
||||
virtual void read_from(istream& in);
|
||||
void set_des(TConfig* c = NULL, const char* tab = "") { _des = c; _tab = tab;}
|
||||
void set_name(const char * name, int pos = -1);
|
||||
|
||||
#endif
|
||||
// @cmember Duplica il descrittore di file
|
||||
virtual TObject* dup() const { return new TTrec(*this);}
|
||||
|
@ -680,7 +680,7 @@ int TMask::id2pos(
|
||||
TMask_field& TMask::field(short id) const
|
||||
{
|
||||
TMask_field* f = find_by_id(id);
|
||||
if (f == NULL)
|
||||
if (f == nullptr)
|
||||
{
|
||||
if (_mask_num == 0)
|
||||
yesnofatal_box("Non esiste il campo %d sulla maschera %s", id, (const char*)_source_file);
|
||||
@ -1042,114 +1042,134 @@ bool TMask::on_key(
|
||||
return false;
|
||||
}
|
||||
|
||||
switch(key)
|
||||
{
|
||||
case K_AUTO_ENTER:
|
||||
case K_CTRL_ENTER:
|
||||
case K_QUIT:
|
||||
case K_ESC:
|
||||
stop_run(key);
|
||||
break;
|
||||
case K_PREV:
|
||||
if (fld(_focus).on_key(K_TAB))
|
||||
next_page(-1);
|
||||
break;
|
||||
case K_NEXT:
|
||||
if (fld(_focus).on_key(K_TAB))
|
||||
next_page(+1);
|
||||
break;
|
||||
case K_F1:
|
||||
{
|
||||
const char* key = source_file().name_only();
|
||||
EVENT e; memset(&e, 0, sizeof(e));
|
||||
e.type = E_HELP;
|
||||
e.v.help.tag = M_HELP_ONCONTEXT;
|
||||
e.v.help.obj = win();
|
||||
e.v.help.tid = (long)key;
|
||||
switch (key)
|
||||
{
|
||||
case K_AUTO_ENTER:
|
||||
case K_CTRL_ENTER:
|
||||
case K_QUIT:
|
||||
case K_ESC:
|
||||
stop_run(key);
|
||||
break;
|
||||
case K_PREV:
|
||||
if (fld(_focus).on_key(K_TAB))
|
||||
next_page(-1);
|
||||
break;
|
||||
case K_NEXT:
|
||||
if (fld(_focus).on_key(K_TAB))
|
||||
next_page(+1);
|
||||
break;
|
||||
case K_F1:
|
||||
{
|
||||
const char* key = source_file().name_only();
|
||||
EVENT e; memset(&e, 0, sizeof(e));
|
||||
e.type = E_HELP;
|
||||
e.v.help.tag = M_HELP_ONCONTEXT;
|
||||
e.v.help.obj = win();
|
||||
e.v.help.tid = (long)key;
|
||||
|
||||
TFilename n = "campo";
|
||||
TString4 module; module.strncpy(key, 2); module.lower();
|
||||
if (module != "ba")
|
||||
n.insert(module);
|
||||
FILE_SPEC fs; xvt_fsys_convert_str_to_fspec(n, &fs);
|
||||
XVT_HELP_INFO hi = xvt_help_open_helpfile(&fs, 0);
|
||||
xvt_help_process_event(hi, win(), &e);
|
||||
}
|
||||
break;
|
||||
case K_F12:
|
||||
TFilename n = "campo";
|
||||
TString4 module; module.strncpy(key, 2); module.lower();
|
||||
if (module != "ba")
|
||||
n.insert(module);
|
||||
FILE_SPEC fs; xvt_fsys_convert_str_to_fspec(n, &fs);
|
||||
XVT_HELP_INFO hi = xvt_help_open_helpfile(&fs, 0);
|
||||
xvt_help_process_event(hi, win(), &e);
|
||||
}
|
||||
break;
|
||||
case K_F12:
|
||||
send_key(K_F12, focus_field().dlg());
|
||||
break;
|
||||
case K_SHIFT+K_F11:
|
||||
break;
|
||||
case K_SHIFT + K_F11:
|
||||
if (is_power_station())
|
||||
{
|
||||
_bShowGrid = !_bShowGrid;
|
||||
xvt_dwin_invalidate_rect(curr_win(), NULL);
|
||||
}
|
||||
break;
|
||||
case K_CTRL+'+':
|
||||
if (is_running())
|
||||
{
|
||||
// Cerco nella pagina corrente il primo spreadsheet a partire dal campo col focus
|
||||
if (_focus < 0) _focus = 0;
|
||||
const WINDOW myparent = fld(_focus).parent();
|
||||
for (int fire = _focus; fire < fields(); fire++)
|
||||
{
|
||||
TMask_field& f = fld(fire);
|
||||
if (f.parent() != myparent)
|
||||
break;
|
||||
if (f.is_sheet())
|
||||
{
|
||||
{
|
||||
_bShowGrid = !_bShowGrid;
|
||||
xvt_dwin_invalidate_rect(curr_win(), NULL);
|
||||
}
|
||||
break;
|
||||
case K_CTRL + '+':
|
||||
if (is_running())
|
||||
{
|
||||
// Cerco nella pagina corrente il primo spreadsheet a partire dal campo col focus
|
||||
if (_focus < 0) _focus = 0;
|
||||
const WINDOW myparent = fld(_focus).parent();
|
||||
for (int fire = _focus; fire < fields(); fire++)
|
||||
{
|
||||
TMask_field& f = fld(fire);
|
||||
if (f.parent() != myparent)
|
||||
break;
|
||||
if (f.is_sheet())
|
||||
{
|
||||
send_key(key, f.dlg());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
/*
|
||||
case K_CTRL+'-':
|
||||
if (is_running() && focus_field().is_sheet())
|
||||
send_key(key, focus_field().dlg());
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
if (key > K_CTRL)
|
||||
{
|
||||
key -= K_CTRL;
|
||||
if (key >= K_F1 && key <= K_F12)
|
||||
{
|
||||
const int page = key - K_F1;
|
||||
if (page < _pages && fld(_focus).on_key(K_TAB))
|
||||
show_page(page);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = fields()-1; i >= 0; i--)
|
||||
{
|
||||
TMask_field& f = fld(i);
|
||||
if (f.is_operable() && !f.is_editable() && f.active())
|
||||
{
|
||||
KEY vk = 0;
|
||||
if (f.is_kind_of(CLASS_BUTTON_FIELD))
|
||||
{
|
||||
TButton_field& b = (TButton_field&)f;
|
||||
vk = b.virtual_key();
|
||||
} else
|
||||
if (f.is_kind_of(CLASS_BUTTON_TOOL))
|
||||
{
|
||||
TButton_tool& t = (TButton_tool&)f;
|
||||
vk = t.virtual_key();
|
||||
}
|
||||
if (vk > 0 && vk == key)
|
||||
{
|
||||
f.on_key(K_SPACE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
/*
|
||||
case K_CTRL+'-':
|
||||
if (is_running() && focus_field().is_sheet())
|
||||
send_key(key, focus_field().dlg());
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
if (key > K_CTRL)
|
||||
{
|
||||
key -= K_CTRL;
|
||||
if (key >= K_F1 && key <= K_F12)
|
||||
{
|
||||
const int page = key - K_F1;
|
||||
|
||||
if (page < _pages && fld(_focus).on_key(K_TAB))
|
||||
show_page(page);
|
||||
}
|
||||
else
|
||||
if (UPCASE(key) == 'S')
|
||||
{
|
||||
TFilename fname;
|
||||
|
||||
if (fname.input(false))
|
||||
save(fname);
|
||||
}
|
||||
else
|
||||
if (UPCASE(key) == 'L')
|
||||
{
|
||||
TFilename fname;
|
||||
|
||||
if (fname.input())
|
||||
load(fname);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = fields() - 1; i >= 0; i--)
|
||||
{
|
||||
TMask_field& f = fld(i);
|
||||
|
||||
if (f.is_operable() && !f.is_editable() && f.active())
|
||||
{
|
||||
KEY vk = 0;
|
||||
|
||||
if (f.is_kind_of(CLASS_BUTTON_FIELD))
|
||||
{
|
||||
TButton_field& b = (TButton_field&)f;
|
||||
vk = b.virtual_key();
|
||||
}
|
||||
else
|
||||
if (f.is_kind_of(CLASS_BUTTON_TOOL))
|
||||
{
|
||||
TButton_tool& t = (TButton_tool&)f;
|
||||
|
||||
vk = t.virtual_key();
|
||||
}
|
||||
if (vk > 0 && vk == key)
|
||||
{
|
||||
f.on_key(K_SPACE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2511,11 +2531,14 @@ TButton_tool& TMask::add_button_tool(short id, const char* prompt, short bmpup)
|
||||
//
|
||||
// @flag true | Se l'operazione e' avvenuta corretamente
|
||||
// @flag false | Se non si riesce a creare il file di salvataggio
|
||||
bool TMask::save(
|
||||
bool TMask::save(const TFilename & fname, // @parm nome del file, se vuoto usa _workfile
|
||||
bool append) const // @parm Indica se creare il file o appendere (true) le informazioni
|
||||
// ad uno gia' esistente (false, default).
|
||||
|
||||
{
|
||||
if (fname.full())
|
||||
((TMask *)this)->set_workfile(fname);
|
||||
|
||||
FILE* f = fopen(_workfile, append ? "a" : "w");
|
||||
|
||||
if (f == nullptr)
|
||||
@ -2542,13 +2565,16 @@ bool TMask::save(
|
||||
//
|
||||
// @flag true | Se l'operazione e' avvenuta corretamente
|
||||
// @flag false | Se non si riesce a leggere il file di salvataggio
|
||||
bool TMask::load(
|
||||
bool TMask::load(const TFilename & fname, // @parm nome del file, se vuoto usa _workfile
|
||||
bool reset) // @parm Indica la posizione di lettura del file:
|
||||
//
|
||||
// @flag true | Comincia la lettura dell'inizio
|
||||
// @flag false | Comincia la lettura dalla posizione corrente dell'offset
|
||||
|
||||
{
|
||||
if (fname.full())
|
||||
((TMask *)this)->set_workfile(fname);
|
||||
|
||||
FILE* f = fopen(_workfile, "r");
|
||||
|
||||
if (f == nullptr)
|
||||
|
@ -449,9 +449,9 @@ public:
|
||||
void set_workfile(const char* workfile)
|
||||
{ _workfile = workfile; _lastpos = 0L;}
|
||||
// @cmember Salva i valori dei campi della maschera sul file di salvataggio
|
||||
bool save(bool append = false) const;
|
||||
bool save(const TFilename & fname = EMPTY_STRING, bool append = false) const;
|
||||
// @cmember Legge i valori dei campi della maschera da file di salvataggio
|
||||
bool load(bool reset = false);
|
||||
bool load(const TFilename & fname = EMPTY_STRING, bool reset = false);
|
||||
// @cmember Copia i valori dei campi dalla maschera <p m>
|
||||
void copy_values(const TMask &m);
|
||||
|
||||
|
@ -2811,16 +2811,19 @@ bool TEdit_field::on_key(KEY key)
|
||||
{
|
||||
ok = !(check_type() == CHECK_REQUIRED && empty());
|
||||
// check consistency
|
||||
if (!ok && _browse != nullptr && _browse->is_kind_of(CLASS_RSELECT_BUTTON))
|
||||
if (!ok && _browse != nullptr && _browse->is_reportsel())
|
||||
ok = true;
|
||||
if (ok && _browse)
|
||||
if (ok && _browse != nullptr)
|
||||
{
|
||||
if (browse() && !_browse->is_kind_of(CLASS_RSELECT_BUTTON))
|
||||
if (browse() != nullptr && !_browse->is_reportsel())
|
||||
{
|
||||
if (ok && check_enabled() && vf != 21) // 21 = NOT_EMPTY_CHECK_FIELD
|
||||
if (ok && check_enabled() && vf != 21 && !_browse->is_filesel() && !_browse->is_profile()) // 21 = NOT_EMPTY_CHECK_FIELD
|
||||
{
|
||||
if (dirty()) ok = browse()->check(FINAL_CHECK); // Check consistency
|
||||
else ok = browse()->empty_check();
|
||||
|
||||
if (dirty())
|
||||
ok = browse()->check(FINAL_CHECK); // Check consistency
|
||||
else
|
||||
ok = browse()->empty_check();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -934,18 +934,18 @@ public:
|
||||
virtual bool check(CheckTime = RUNNING_CHECK);
|
||||
|
||||
// @cmember Ritorna l'oggetto browse
|
||||
TBrowse* browse() const
|
||||
{ return (_browse && _browse->is_browse()) ? (TBrowse*)_browse : NULL; }
|
||||
TBrowse * browse() const { return (_browse && _browse->is_browse()) ? (TBrowse *)_browse : NULL; }
|
||||
|
||||
// @cmember Ritorna l'oggetto sheet
|
||||
TList_sheet* sheet() const
|
||||
{ return (_browse && _browse->is_sheet()) ? (TList_sheet*)_browse : NULL;}
|
||||
TList_sheet * sheet() const { return (_browse && _browse->is_sheet()) ? (TList_sheet *)_browse : NULL;}
|
||||
|
||||
// @cmember Ritorna l'oggetto dirsheet
|
||||
TFile_select* filesel() const
|
||||
{ return (_browse && _browse->is_filesel()) ? (TFile_select*)_browse : NULL;}
|
||||
// @cmember Ritorna l'oggetto dir sheet
|
||||
TFile_select * filesel() const { return (_browse && _browse->is_filesel()) ? (TFile_select*)_browse : NULL;}
|
||||
|
||||
// @cmember Permette di abilitare/disabilitare il campo
|
||||
// @cmember Ritorna l'oggetto report sheet
|
||||
TReport_select * reportsel() const{ return (_browse && _browse->is_reportsel()) ? (TReport_select *)_browse : NULL;
|
||||
}
|
||||
// @cmember Permette di abilitare/disabilitare il campo
|
||||
virtual void enable(bool on = true);
|
||||
|
||||
// @cmember Permette di abilitare/disabilitare il check del campo
|
||||
|
@ -171,6 +171,7 @@ public:
|
||||
{ return is_zero(); }
|
||||
// @cmember Ritorna il risultato della differenza tra due reali
|
||||
real operator -() const;
|
||||
//bool between(const real& a, const real& b) const { return (*this >= a) && (*this <= b || b <= ZERO);}
|
||||
|
||||
// @cmember Costruttore
|
||||
real();
|
||||
|
@ -92,6 +92,7 @@ void TReport_application::mask2ini(const TMask& m, TConfig& ini)
|
||||
// @cmember Esegue la stampa
|
||||
void TReport_application::execute_print(TReport_book & book, TAutomask & mask, TReport & rep, export_type type)
|
||||
{
|
||||
rep.set_export_sections(type);
|
||||
book.add(rep, type);
|
||||
}
|
||||
|
||||
|
@ -2990,6 +2990,33 @@ void TReport::reset_export_sections()
|
||||
|
||||
sect->show(section_shown);
|
||||
}
|
||||
set_dbase_fixed_fields(false);
|
||||
}
|
||||
|
||||
|
||||
void TReport::set_export4excel()
|
||||
{
|
||||
TToken_string header_section(get_excel_header_section());
|
||||
|
||||
FOR_EACH_ASSOC_OBJECT(_sections, os, sec_key, sec_item)
|
||||
{
|
||||
const TString4 sec_id(sec_key);
|
||||
TReport_section * sect = (TReport_section *)sec_item;
|
||||
const bool on = sect->shown() && (header_section.find(sec_id) >= 0 || sec_id.starts_with("B"));
|
||||
|
||||
sect->show(on);
|
||||
}
|
||||
}
|
||||
|
||||
void TReport::set_export4dbase()
|
||||
{
|
||||
FOR_EACH_ASSOC_OBJECT(_sections, os, sec_key, sec_item)
|
||||
{
|
||||
const TString4 sec_id(sec_key);
|
||||
TReport_section * sect = (TReport_section *)sec_item;
|
||||
|
||||
sect->show(sect->shown() && sec_id.starts_with("B"));
|
||||
}
|
||||
}
|
||||
|
||||
void TReport::set_export_sections(export_type type)
|
||||
@ -2997,37 +3024,26 @@ void TReport::set_export_sections(export_type type)
|
||||
switch (type)
|
||||
{
|
||||
case _export_printer :
|
||||
break;
|
||||
set_export4print();
|
||||
break;
|
||||
case _export_visualize :
|
||||
set_export4visualize();
|
||||
break;
|
||||
case _export_excel :
|
||||
{
|
||||
FOR_EACH_ASSOC_OBJECT(_sections, os, sec_key, sec_item)
|
||||
{
|
||||
const TString4 sec_id(sec_key);
|
||||
TReport_section * sect = (TReport_section *)sec_item;
|
||||
|
||||
sect->show(sect->shown() && (sec_id == "H0" || sec_id.starts_with("B")));
|
||||
}
|
||||
}
|
||||
set_export4excel();
|
||||
break;
|
||||
case _export_dbase:
|
||||
{
|
||||
FOR_EACH_ASSOC_OBJECT(_sections, os, sec_key, sec_item)
|
||||
{
|
||||
const TString4 sec_id(sec_key);
|
||||
TReport_section * sect = (TReport_section *)sec_item;
|
||||
|
||||
sect->show(sect->shown() && sec_id.starts_with("B"));
|
||||
}
|
||||
}
|
||||
set_export4dbase();
|
||||
break;
|
||||
case _export_pdf :
|
||||
set_export4pdf();
|
||||
break;
|
||||
case _export_text :
|
||||
set_export4text();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
set_dbase_fixed_fields(type == _export_dbase);
|
||||
}
|
||||
|
||||
KEY TReport::run_form(TMask& m)
|
||||
|
@ -598,8 +598,16 @@ public:
|
||||
bool kill_section(char type, int level);
|
||||
int find_max_level(char type) const;
|
||||
|
||||
virtual void reset_export_sections();
|
||||
virtual void set_export_sections(export_type type);
|
||||
virtual const char * get_excel_header_section() { return "H0"; }
|
||||
virtual void set_dbase_fixed_fields(bool on = true) {}
|
||||
void reset_export_sections();
|
||||
void set_export_sections(export_type type);
|
||||
virtual void set_export4print() {};
|
||||
virtual void set_export4visualize() {};
|
||||
virtual void set_export4excel();
|
||||
virtual void set_export4pdf() {};
|
||||
virtual void set_export4text() {};
|
||||
virtual void set_export4dbase();
|
||||
|
||||
virtual bool on_link(const TReport_link& link);
|
||||
virtual bool use_mask() { return true;}
|
||||
|
@ -1875,7 +1875,6 @@ bool TBook::export_dbase(TFilename& fname, TTrec * desc, bool signature, bool go
|
||||
desc->update_fielddef(i, TToken_string(format("FLD%03d|1|80|0", i)));
|
||||
desc->update_keydef(0, TToken_string("FLD001|"));
|
||||
}
|
||||
|
||||
if (fname.exist())
|
||||
{
|
||||
TFilename f(fname);
|
||||
@ -1883,11 +1882,10 @@ bool TBook::export_dbase(TFilename& fname, TTrec * desc, bool signature, bool go
|
||||
f.ext("*");
|
||||
remove_files(f, false);
|
||||
}
|
||||
TExternisamfile dbf(fname, *desc);
|
||||
|
||||
temp.temp("exp", "xls");
|
||||
export_excel(temp, signature);
|
||||
|
||||
TExternisamfile dbf(fname, *desc);
|
||||
ifstream ifstream(temp);
|
||||
|
||||
while (!ifstream.eof())
|
||||
@ -1977,7 +1975,7 @@ bool TBook::export_excel(TFilename& fname, bool signature, bool goto_url, bool a
|
||||
{
|
||||
// <text owner=B1>
|
||||
const char* section = str.get(1);
|
||||
if ((section[0] == 'B'||section[0]=='F') && section[1]>'0')
|
||||
if ((section[0] == 'B'||section[0]=='F' || section[0] == 'H') && section[1]>'0')
|
||||
tab.add_field(col, wid);
|
||||
// Raggiunge fine del testo
|
||||
while (str != "</text>" && !ifs.eof())
|
||||
@ -3033,12 +3031,14 @@ bool TReport_book::add(TReport& rep, export_type type, bool progind)
|
||||
|
||||
TString msg; msg << TR("Report ") << _report->filename();
|
||||
|
||||
TProgind* pi = NULL;
|
||||
if (progind && rex_items > 1)
|
||||
TPrintind* pi = nullptr;
|
||||
|
||||
if (progind)
|
||||
pi = new TPrintind(rex_items, msg);
|
||||
|
||||
TString_array oldgroup, newgroup;
|
||||
const int max_group = _report->find_max_level('H');
|
||||
|
||||
if (max_group >= 2)
|
||||
{
|
||||
for (int g = 2; g <= max_group; g++)
|
||||
@ -3128,7 +3128,7 @@ bool TReport_book::add(TReport& rep, export_type type, bool progind)
|
||||
}
|
||||
}
|
||||
|
||||
if (pi != NULL)
|
||||
if (pi != nullptr)
|
||||
{
|
||||
if (!pi->addstatus(1))
|
||||
_print_aborted = true;
|
||||
@ -3190,10 +3190,8 @@ bool TReport_book::add(TReport& rep, export_type type, bool progind)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pi != NULL)
|
||||
delete pi;
|
||||
|
||||
safe_delete(pi);
|
||||
_report->reset_export_sections();
|
||||
return !_print_aborted;
|
||||
}
|
||||
|
||||
|
@ -1466,9 +1466,9 @@ bool TFilename::search_in_path(TFilename& path) const
|
||||
return path.full();
|
||||
}
|
||||
|
||||
bool TFilename::input()
|
||||
bool TFilename::input(bool existent)
|
||||
{
|
||||
return input_filename(*this);
|
||||
return input_filename(*this, existent);
|
||||
}
|
||||
|
||||
bool TFilename::custom_path(const char* path_list)
|
||||
|
@ -592,7 +592,7 @@ public:
|
||||
// @cmember Cerca nel path il nome del file corrente e scrive il path assoluto in path
|
||||
bool search_in_path(TFilename& path) const;
|
||||
// @cmember Richiede all'utente il nome di un file
|
||||
bool input();
|
||||
bool input(bool existent = true);
|
||||
// @cmember Ritorna il nome del file con estensione
|
||||
const char* name() const;
|
||||
// @cmember Ritorna il nome del file senza estensione
|
||||
|
@ -352,13 +352,19 @@ int list_files(
|
||||
return count;
|
||||
}
|
||||
|
||||
bool input_filename(TFilename& file)
|
||||
bool input_filename(TFilename& file, bool existent)
|
||||
{
|
||||
DIRECTORY dir; xvt_fsys_get_curr_dir(&dir);
|
||||
|
||||
FILE_SPEC fs;
|
||||
xvt_fsys_convert_str_to_fspec(file, &fs);
|
||||
const bool good = xvt_dm_post_file_open(&fs, TR("Selezionare il file")) == FL_OK;
|
||||
|
||||
bool good;
|
||||
|
||||
if (existent)
|
||||
good = xvt_dm_post_file_open(&fs, TR("Selezionare il file")) == FL_OK;
|
||||
else
|
||||
good = xvt_dm_post_file_save(&fs, TR("Indicare il file")) == FL_OK;
|
||||
|
||||
xvt_fsys_set_dir(&dir);
|
||||
|
||||
|
@ -77,7 +77,8 @@ bool remove_file(const char* file);
|
||||
int remove_files(const char* mask, bool subdirs);
|
||||
int count_files(const char* dir, bool subdirs);
|
||||
int list_files(const char* mask, TString_array& result);
|
||||
bool input_filename(TFilename& file);
|
||||
bool input_filename(TFilename& file, bool existent = true);
|
||||
|
||||
const char * get_system_dir(TSystem_dirs what);
|
||||
const char * standard_path_list();
|
||||
|
||||
@ -122,5 +123,6 @@ void split_IBAN(const char * iban, TString & iso, TString & icin,
|
||||
void set_test_mail(const TString & email);
|
||||
bool send_mail(TToken_string & to, TToken_string & cc, TToken_string & ccn,
|
||||
const char * subj, const char * text, TToken_string & attachment, bool ui, bool receipt);
|
||||
inline bool between(const long val, const long a, const long b) { return ((a == 0 ||val >= a) && (b == 0 || val <= b)); }
|
||||
|
||||
#endif /* __UTILITY_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user