Patch level : 10.0
Files correlati : cg2.exe Ricompilazione Demo : [ ] Commento : Aggiunta gestione campi di modulo: scompaiono in assenza del relativo modulo git-svn-id: svn://10.65.10.50/branches/R_10_00@22302 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
baa17cebd6
commit
6c4e5a6086
@ -2,15 +2,15 @@
|
|||||||
#include <automask.h>
|
#include <automask.h>
|
||||||
#include <colors.h>
|
#include <colors.h>
|
||||||
#include <controls.h>
|
#include <controls.h>
|
||||||
#include <diction.h>
|
#include <dongle.h>
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
#include <expr.h>
|
#include <expr.h>
|
||||||
|
#include <modaut.h>
|
||||||
#include <msksheet.h>
|
#include <msksheet.h>
|
||||||
#include <recarray.h>
|
#include <recarray.h>
|
||||||
#include <recset.h>
|
#include <recset.h>
|
||||||
#include <relapp.h>
|
#include <relapp.h>
|
||||||
#include <sheet.h>
|
#include <sheet.h>
|
||||||
#include <relation.h>
|
|
||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
#include <text.h>
|
#include <text.h>
|
||||||
#include <toolfld.h>
|
#include <toolfld.h>
|
||||||
@ -209,7 +209,7 @@ void TMask_field::update_flags(const char* f, bool reset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TMask_field::TMask_field(TMask* m)
|
TMask_field::TMask_field(TMask* m)
|
||||||
: _mask(m), _groups(NULL), _ctl(NULL)
|
: _mask(m), _groups(NULL), _modules(NULL), _ctl(NULL)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
// Certified 100%
|
// Certified 100%
|
||||||
@ -217,6 +217,7 @@ TMask_field::~TMask_field()
|
|||||||
{
|
{
|
||||||
if (_ctl) delete _ctl;
|
if (_ctl) delete _ctl;
|
||||||
if (_groups) delete _groups;
|
if (_groups) delete _groups;
|
||||||
|
if (_modules) delete _modules;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Certified 100%
|
// Certified 100%
|
||||||
@ -383,7 +384,7 @@ void TMask_field::construct(TScanner& scanner, WINDOW parent)
|
|||||||
_ctl_data._dlg, (const char*)m.source_file());
|
_ctl_data._dlg, (const char*)m.source_file());
|
||||||
scanner.push();
|
scanner.push();
|
||||||
}
|
}
|
||||||
if (_ctl_data._dlg > 0)
|
if (_ctl_data._dlg > DLG_NULL)
|
||||||
{
|
{
|
||||||
FOR_EACH_MASK_FIELD(m, i, mf)
|
FOR_EACH_MASK_FIELD(m, i, mf)
|
||||||
{
|
{
|
||||||
@ -396,14 +397,23 @@ void TMask_field::construct(TScanner& scanner, WINDOW parent)
|
|||||||
while(scanner.popkey() != "EN") // END of control
|
while(scanner.popkey() != "EN") // END of control
|
||||||
parse_item(scanner);
|
parse_item(scanner);
|
||||||
|
|
||||||
if (class_id() == CLASS_EDIT_FIELD)
|
if (is_edit())
|
||||||
{
|
{
|
||||||
TBrowse * b = ((TEdit_field *) this)->browse();
|
TBrowse* b = ((TEdit_field*)this)->browse();
|
||||||
|
|
||||||
if (b != NULL)
|
if (b != NULL)
|
||||||
b->custom_display();
|
b->custom_display();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Controllo se il campo (anche non operable) e' visibile solo con certi moduli
|
||||||
|
if (in_module(0) && _ctl_data._flags.find('H') < 0)
|
||||||
|
{
|
||||||
|
long mod = _modules->last_one();
|
||||||
|
for (; mod > BAAUT; mod--)
|
||||||
|
if (main_app().has_module(mod))
|
||||||
|
break;
|
||||||
|
if (mod <= 0)
|
||||||
|
_ctl_data._flags << 'H';
|
||||||
|
}
|
||||||
|
|
||||||
create(parent);
|
create(parent);
|
||||||
}
|
}
|
||||||
@ -422,6 +432,28 @@ void TMask_field::set_group(byte group)
|
|||||||
_groups->set(0L);
|
_groups->set(0L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TMask_field::set_module(word m)
|
||||||
|
{
|
||||||
|
if (m > BAAUT && m < ENDAUT)
|
||||||
|
{
|
||||||
|
if (_modules == NULL)
|
||||||
|
_modules = new TBit_array;
|
||||||
|
_modules->set(long(m));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TMask_field::in_module(word m) const
|
||||||
|
{
|
||||||
|
if (_modules != NULL)
|
||||||
|
{
|
||||||
|
if (m == BAAUT || m >= ENDAUT)
|
||||||
|
return _modules->first_one() > BAAUT;
|
||||||
|
else
|
||||||
|
return (*_modules)[m];
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool TMask_field::parse_item(TScanner& scanner)
|
bool TMask_field::parse_item(TScanner& scanner)
|
||||||
{
|
{
|
||||||
if (scanner.key() == "PR") // PROMPT
|
if (scanner.key() == "PR") // PROMPT
|
||||||
@ -440,7 +472,7 @@ bool TMask_field::parse_item(TScanner& scanner)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scanner.key() == "GR")
|
if (scanner.key() == "GR") // GROUPS
|
||||||
{
|
{
|
||||||
if (_groups == NULL)
|
if (_groups == NULL)
|
||||||
_groups = new TBit_array;
|
_groups = new TBit_array;
|
||||||
@ -449,6 +481,19 @@ bool TMask_field::parse_item(TScanner& scanner)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (scanner.key() == "MO") // MODULES
|
||||||
|
{
|
||||||
|
TToken_string m(scanner.line(), ',');
|
||||||
|
FOR_EACH_TOKEN(m, mod)
|
||||||
|
{
|
||||||
|
const word cod = dongle().module_name2code(mod);
|
||||||
|
set_module(cod);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NFCHECK("'%s' Token non riconosciuto nel campo %d: %s",
|
NFCHECK("'%s' Token non riconosciuto nel campo %d: %s",
|
||||||
(const char*)scanner.token(), (int)dlg(), (const char*)_ctl_data._prompt);
|
(const char*)scanner.token(), (int)dlg(), (const char*)_ctl_data._prompt);
|
||||||
return false;
|
return false;
|
||||||
@ -512,6 +557,8 @@ void TMask_field::show(
|
|||||||
{
|
{
|
||||||
if (_ctl)
|
if (_ctl)
|
||||||
{
|
{
|
||||||
|
if (on && !_flags.show_default && in_module(0))
|
||||||
|
on = false; // Nego la visibiltà in assenza del modulo opportuno
|
||||||
_ctl->show(on);
|
_ctl->show(on);
|
||||||
_flags.shown = on;
|
_flags.shown = on;
|
||||||
}
|
}
|
||||||
@ -1707,8 +1754,9 @@ word TEditable_field::create_prompt(
|
|||||||
{
|
{
|
||||||
if (_ctl_data._prompt.not_empty())
|
if (_ctl_data._prompt.not_empty())
|
||||||
{
|
{
|
||||||
TString flags;
|
TString4 flags;
|
||||||
if (hidden()) flags << 'H';
|
if (hidden() || _ctl_data._flags.find('H') >= 0)
|
||||||
|
flags << 'H';
|
||||||
|
|
||||||
if (height < 3)
|
if (height < 3)
|
||||||
{
|
{
|
||||||
@ -1732,6 +1780,10 @@ word TEditable_field::create_prompt(
|
|||||||
|
|
||||||
void TEditable_field::show(bool on)
|
void TEditable_field::show(bool on)
|
||||||
{
|
{
|
||||||
|
// Cerco di mostrare un campo di un modulo proibito?
|
||||||
|
if (on && !_flags.show_default && in_module(0))
|
||||||
|
on = false; // Ho detto di Nooo!
|
||||||
|
|
||||||
TOperable_field::show(on);
|
TOperable_field::show(on);
|
||||||
if (_prompt) _prompt->show(on);
|
if (_prompt) _prompt->show(on);
|
||||||
}
|
}
|
||||||
@ -2212,24 +2264,32 @@ void TBrowse::custom_display()
|
|||||||
{
|
{
|
||||||
switch(_cursor->file().num())
|
switch(_cursor->file().num())
|
||||||
{
|
{
|
||||||
case LF_ANAMAG :
|
case LF_ANAMAG:
|
||||||
if (_cursor->key() == 2 && ini_get_bool(CONFIG_DITTA, "Main", "CUSTOM_SEARCH_" TOSTRING(LF_ANAMAG), false, 2))
|
if (_cursor->key() == 2 && ini_get_bool(CONFIG_DITTA, "Main", "CUSTOM_SEARCH_" TOSTRING(LF_ANAMAG), false, 2))
|
||||||
|
{
|
||||||
|
TToken_string & it = (TToken_string &) items();
|
||||||
|
if (it.find(ANAMAG_DESCRAGG) < 0)
|
||||||
{
|
{
|
||||||
TToken_string & it = (TToken_string &) items();
|
const char * s = it.get(0);
|
||||||
if (it.find(ANAMAG_DESCRAGG) < 0)
|
for (int i = 0; s && *s; s = it.get(++i))
|
||||||
{
|
if (strcmp(s, ANAMAG_DESCR) == 0)
|
||||||
const char * s = it.get(0);
|
{
|
||||||
for (int i = 0; s && *s; s = it.get(++i))
|
add_display_field("Descrizione aggiuntiva@50", ANAMAG_DESCRAGG, i + 1);
|
||||||
if (strcmp(s, ANAMAG_DESCR) == 0)
|
break;
|
||||||
{
|
}
|
||||||
add_display_field("Descrizione aggiuntiva@50", ANAMAG_DESCRAGG, i + 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
default:
|
break;
|
||||||
break;
|
case LF_TABMOD:
|
||||||
|
{
|
||||||
|
_cursor->file().zero(); // Azzera il record corrente in modo da impostare "MOD"
|
||||||
|
const TString& mod =_cursor->curr().get("MOD");
|
||||||
|
const word cod = dongle().module_name2code(mod);
|
||||||
|
field().set_module(cod);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2559,6 +2619,8 @@ int TBrowse::do_input(
|
|||||||
|
|
||||||
for (const char* fld = _inp_id.get(); fld; fld = _inp_id.get())
|
for (const char* fld = _inp_id.get(); fld; fld = _inp_id.get())
|
||||||
{
|
{
|
||||||
|
const TFieldref fldref(_inp_fn.get(), 0); // Output field
|
||||||
|
|
||||||
if (*fld == '"')
|
if (*fld == '"')
|
||||||
{
|
{
|
||||||
val = (fld+1);
|
val = (fld+1);
|
||||||
@ -2588,11 +2650,28 @@ int TBrowse::do_input(
|
|||||||
{
|
{
|
||||||
const TMask_field& f = *campf;
|
const TMask_field& f = *campf;
|
||||||
val = f.get();
|
val = f.get();
|
||||||
|
|
||||||
if (f.class_id() == CLASS_DATE_FIELD && f.right_justified())
|
switch (f.class_id())
|
||||||
{
|
{
|
||||||
const TDate d(val);
|
case CLASS_REAL_FIELD:
|
||||||
val = d.string(ANSI);
|
// Cerco di allineare correttamente i campi numerici salvati parzialmente su codtab
|
||||||
|
if (fldref.to() > 1 && f.size() > 1 && val.full() &&
|
||||||
|
((TReal_field&)f).decimals() == 0 && fldref.name() == "CODTAB")
|
||||||
|
{
|
||||||
|
const int len = fldref.len(cur);
|
||||||
|
if (f.size() == len && val.len() < len)
|
||||||
|
val.right_just(len);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CLASS_DATE_FIELD:
|
||||||
|
if (f.right_justified())
|
||||||
|
{
|
||||||
|
const TDate d(val);
|
||||||
|
val = d.string(ANSI);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool filter_flag = strchr(fld, '@') != NULL;
|
const bool filter_flag = strchr(fld, '@') != NULL;
|
||||||
@ -2601,7 +2680,6 @@ int TBrowse::do_input(
|
|||||||
ne++; // Increment not empty fields count
|
ne++; // Increment not empty fields count
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const TFieldref fldref(_inp_fn.get(), 0); // Output field
|
|
||||||
fldref.write(val, *_cursor->relation());
|
fldref.write(val, *_cursor->relation());
|
||||||
if (tofilter)
|
if (tofilter)
|
||||||
{
|
{
|
||||||
@ -4457,10 +4535,9 @@ bool TDate_field::on_key(KEY key)
|
|||||||
|
|
||||||
bool TDate_field::autosave(TRelation& r)
|
bool TDate_field::autosave(TRelation& r)
|
||||||
{
|
{
|
||||||
if (field())
|
if (field() != NULL)
|
||||||
{
|
{
|
||||||
const char* td = get();
|
const char* td = get();
|
||||||
|
|
||||||
if (right_justified())
|
if (right_justified())
|
||||||
{
|
{
|
||||||
TDate d(td);
|
TDate d(td);
|
||||||
@ -4745,6 +4822,25 @@ void TReal_field::set_decimals(int d)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TReal_field::autosave(TRelation& r)
|
||||||
|
{
|
||||||
|
// Qundo salvo un intero in un sottocampo (ad esempio CODTAB[2,7]) lo allineo a destra
|
||||||
|
if (field() != NULL && field()->to() > 1 && decimals() == 0 &&
|
||||||
|
size() > 1 && !empty() && field()->name() == "CODTAB")
|
||||||
|
{
|
||||||
|
const int len = field()->len(r.curr(field()->file()));
|
||||||
|
if (size() == len && get().len() < len)
|
||||||
|
{
|
||||||
|
TString16 val = get();
|
||||||
|
val.right_just(len);
|
||||||
|
field()->write(val, r);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TEditable_field::autosave(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Currency_field
|
// Currency_field
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
@ -77,6 +77,9 @@ class TMask_field : public TObject
|
|||||||
// @cmember:(INTERNAL) Gruppi cui appartiene il campo
|
// @cmember:(INTERNAL) Gruppi cui appartiene il campo
|
||||||
TBit_array* _groups;
|
TBit_array* _groups;
|
||||||
|
|
||||||
|
// @cmember:(INTERNAL) Moduli cui appartiene il campo
|
||||||
|
TBit_array* _modules;
|
||||||
|
|
||||||
// @access Protected Member
|
// @access Protected Member
|
||||||
protected:
|
protected:
|
||||||
// @cmember Controllo vero e proprio
|
// @cmember Controllo vero e proprio
|
||||||
@ -383,6 +386,10 @@ public:
|
|||||||
|
|
||||||
// @cmember Assegna il campo al gruppo <p group>
|
// @cmember Assegna il campo al gruppo <p group>
|
||||||
void set_group(byte group);
|
void set_group(byte group);
|
||||||
|
|
||||||
|
// @cmember Assegna il campo al modulo <p module>
|
||||||
|
void set_module(word module);
|
||||||
|
bool in_module(word m) const;
|
||||||
|
|
||||||
// @cmember Setta il focus al campo
|
// @cmember Setta il focus al campo
|
||||||
virtual void set_focus() const;
|
virtual void set_focus() const;
|
||||||
@ -1344,6 +1351,8 @@ protected: // TEditable_field
|
|||||||
|
|
||||||
// @cmember Gestisce la pressione del tasto (true se la gestione ha avuto successo)
|
// @cmember Gestisce la pressione del tasto (true se la gestione ha avuto successo)
|
||||||
virtual bool on_key(KEY key);
|
virtual bool on_key(KEY key);
|
||||||
|
|
||||||
|
virtual bool autosave(TRelation& r);
|
||||||
|
|
||||||
// @access Public Member
|
// @access Public Member
|
||||||
public:
|
public:
|
||||||
|
@ -47,6 +47,8 @@
|
|||||||
#define MOV_DNDOC "DNDOC"
|
#define MOV_DNDOC "DNDOC"
|
||||||
#define MOV_DATAINC "DATAINC"
|
#define MOV_DATAINC "DATAINC"
|
||||||
#define MOV_LIQDIFF "LIQDIFF"
|
#define MOV_LIQDIFF "LIQDIFF"
|
||||||
|
#define MOV_CONTRATTO "CONTRATTO"
|
||||||
|
#define MOV_NOPROFIT "NOPROFIT"
|
||||||
|
|
||||||
#define NUMREG_PROVVISORIO 999999L
|
#define NUMREG_PROVVISORIO 999999L
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#define PCN_CODCMS "CODCMS"
|
#define PCN_CODCMS "CODCMS"
|
||||||
#define PCN_FASCMS "FASCMS"
|
#define PCN_FASCMS "FASCMS"
|
||||||
#define PCN_ANALITICA "ANALITICA"
|
#define PCN_ANALITICA "ANALITICA"
|
||||||
|
#define PCN_SERVIZI "SERVIZI"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -108,13 +108,14 @@ bool TRecordset::save_as_html(const char* path)
|
|||||||
save_html_head(out, main_app().title());
|
save_html_head(out, main_app().title());
|
||||||
out << "<body>" << endl;
|
out << "<body>" << endl;
|
||||||
|
|
||||||
|
/* More annoyng than useful
|
||||||
TString qry; parsed_text(qry);
|
TString qry; parsed_text(qry);
|
||||||
if (qry.full())
|
if (qry.full())
|
||||||
{
|
{
|
||||||
for (int i = qry.find('\n'); i > 0; i = qry.find('\n', i+1))
|
for (int i = qry.find('\n'); i > 0; i = qry.find('\n', i+1))
|
||||||
qry.insert("<br/>", i+1);
|
qry.insert("<br/>", i+1);
|
||||||
out << "<p><b>" << qry << "</b></p>" << endl;
|
out << "<p><b>" << qry << "</b></p>" << endl;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
out << "<table border=\"1\">";
|
out << "<table border=\"1\">";
|
||||||
out << " <caption>" << main_app().title() << "</caption>" << endl;
|
out << " <caption>" << main_app().title() << "</caption>" << endl;
|
||||||
@ -135,7 +136,7 @@ bool TRecordset::save_as_html(const char* path)
|
|||||||
case _longfld:
|
case _longfld:
|
||||||
case _realfld: out << "align=\"right\""; break;
|
case _realfld: out << "align=\"right\""; break;
|
||||||
case _boolfld: out << "align=\"center\""; break;
|
case _boolfld: out << "align=\"center\""; break;
|
||||||
default : out << "style=\"mso-number-format:\\@\""; break;
|
default : out << "style=\"mso-number-format:\\@\""; break; // Stringa!
|
||||||
}
|
}
|
||||||
out << " />" << endl;
|
out << " />" << endl;
|
||||||
}
|
}
|
||||||
|
@ -2407,7 +2407,7 @@ void TFieldref::write(TConfig& ini, const char* defpar, const char* val) const
|
|||||||
if ((val == NULL || *val == '\0') && !ini.exist(_name))
|
if ((val == NULL || *val == '\0') && !ini.exist(_name))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const char* para = _id.empty() ? defpar : (const char *) _id;
|
const char* para = _id.empty() ? defpar : (const char*)_id;
|
||||||
if (_from > 0 || _to > 0)
|
if (_from > 0 || _to > 0)
|
||||||
{
|
{
|
||||||
buffer = ini.get(_name, para);
|
buffer = ini.get(_name, para);
|
||||||
|
@ -90,6 +90,8 @@ int TText_recordset::find_column(const char* column) const
|
|||||||
{
|
{
|
||||||
if (real::is_natural(column))
|
if (real::is_natural(column))
|
||||||
n = atoi(column);
|
n = atoi(column);
|
||||||
|
if (strlen(column) > 2)
|
||||||
|
n = TRecordset::find_column(column);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
n = 0;
|
n = 0;
|
||||||
|
@ -114,7 +114,7 @@ protected:
|
|||||||
virtual bool save_as_text(const char* path);
|
virtual bool save_as_text(const char* path);
|
||||||
|
|
||||||
TAS400_column_info* parse_field(const char* column, int& c, bool create);
|
TAS400_column_info* parse_field(const char* column, int& c, bool create);
|
||||||
bool set_field(const TAS400_column_info& fi, const TVariant& var);
|
virtual bool set_field(const TAS400_column_info& fi, const TVariant& var);
|
||||||
virtual const TVariant& get_field(const TAS400_column_info& fi) const;
|
virtual const TVariant& get_field(const TAS400_column_info& fi) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user