Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : Who cares? git-svn-id: svn://10.65.10.50/trunk@7728 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
bcc4013ba1
commit
9ec0e38688
@ -611,6 +611,8 @@ void TPointer_array::copy(const TArray& a)
|
|||||||
// for (int i = a.size()-1; i >= 0; i--)
|
// for (int i = a.size()-1; i >= 0; i--)
|
||||||
// add(a.objptr(i), i);
|
// add(a.objptr(i), i);
|
||||||
memcpy(data(), a.data(), a.size() * sizeof(TObject*));
|
memcpy(data(), a.data(), a.size() * sizeof(TObject*));
|
||||||
|
_items = a._items;
|
||||||
|
_next = a._next;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TPointer_array::add(TObject* object, int index)
|
int TPointer_array::add(TObject* object, int index)
|
||||||
|
@ -366,27 +366,17 @@ static void dumpbuff()
|
|||||||
@(FSV)
|
@(FSV)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* @(!) 2.3.00.112 */
|
static FILE *wopen(char* name) /* nome del file temporaneo */
|
||||||
static FILE *wopen(name)
|
|
||||||
char *name; /* nome del file temporaneo */
|
|
||||||
/* @(:) 2.3.00.112 */
|
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char s[42];
|
char s[42];
|
||||||
/* @(!) 2.3.00.112 */
|
|
||||||
static int n = 0;
|
static int n = 0;
|
||||||
/* @(:) 2.3.00.112 */
|
|
||||||
|
|
||||||
/* @(!) 2.3.00.316 */
|
|
||||||
sprintf(s, "srt%02d", ++n);
|
sprintf(s, "srt%02d", ++n);
|
||||||
/* @(:) 2.3.00.316 */
|
|
||||||
TMPFNAME(name,s);
|
TMPFNAME(name,s);
|
||||||
|
|
||||||
fp = fopen(name, "wb+");
|
fp = fopen(name, "wb+");
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
{
|
|
||||||
fatal_box("Can't open SORT file");
|
fatal_box("Can't open SORT file");
|
||||||
}
|
|
||||||
return fp;
|
return fp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ class TDowJones : public TFile_cache
|
|||||||
real _chg; // Cambio
|
real _chg; // Cambio
|
||||||
int _dec; // Decimali per gli importi normali
|
int _dec; // Decimali per gli importi normali
|
||||||
int _dec_prices; // Decimali per i prezzi unitari
|
int _dec_prices; // Decimali per i prezzi unitari
|
||||||
|
int _dec_change; // Decimali per i cambi
|
||||||
bool _is_euro; // E' l'EURO in persona
|
bool _is_euro; // E' l'EURO in persona
|
||||||
bool _contro_euro; // Il cambio e' espresso contro EURO
|
bool _contro_euro; // Il cambio e' espresso contro EURO
|
||||||
|
|
||||||
@ -76,6 +77,7 @@ TObject* TDowJones::rec2obj(const TRectype& rec) const
|
|||||||
data->_dec_prices = rec.get_int("I1");
|
data->_dec_prices = rec.get_int("I1");
|
||||||
if (data->_dec_prices < data->_dec)
|
if (data->_dec_prices < data->_dec)
|
||||||
data->_dec_prices = data->_dec;
|
data->_dec_prices = data->_dec;
|
||||||
|
data->_dec_change = rec.get_int("I2");
|
||||||
data->_is_euro = rec.get_bool("B0");
|
data->_is_euro = rec.get_bool("B0");
|
||||||
data->_contro_euro = rec.get_bool("B1");
|
data->_contro_euro = rec.get_bool("B1");
|
||||||
}
|
}
|
||||||
@ -371,7 +373,6 @@ bool TCurrency::same_value_as(const TCurrency& cur) const
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TCurrency::TCurrency(const real& num, const char* val, const real& exchg, bool price)
|
TCurrency::TCurrency(const real& num, const char* val, const real& exchg, bool price)
|
||||||
: _num(num), _price(price)
|
: _num(num), _price(price)
|
||||||
{
|
{
|
||||||
|
@ -454,7 +454,7 @@ bool TDate::isdate(const char* s)
|
|||||||
y < 0)
|
y < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return d <= _days_in_month[m - 1] || (m == 2 && (y % 4 == 0) && d == 29);
|
return d <= last_day(m,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,7 +118,6 @@ image BMP_CANCEL QRESDIR"cancel.bmp"
|
|||||||
image BMP_QUIT QRESDIR"quit.bmp"
|
image BMP_QUIT QRESDIR"quit.bmp"
|
||||||
image BMP_QUITDN QRESDIR"quitdn.bmp"
|
image BMP_QUITDN QRESDIR"quitdn.bmp"
|
||||||
image BMP_SELECT QRESDIR"select.bmp"
|
image BMP_SELECT QRESDIR"select.bmp"
|
||||||
image BMP_STOP QRESDIR"stop.bmp"
|
|
||||||
//image BMP_FIRSTREC QRESDIR"firstrec.bmp"
|
//image BMP_FIRSTREC QRESDIR"firstrec.bmp"
|
||||||
//image BMP_PREVREC QRESDIR"prevrec.bmp"
|
//image BMP_PREVREC QRESDIR"prevrec.bmp"
|
||||||
//image BMP_NEXTREC QRESDIR"nextrec.bmp"
|
//image BMP_NEXTREC QRESDIR"nextrec.bmp"
|
||||||
|
@ -2504,12 +2504,12 @@ word TPrint_section::height() const
|
|||||||
{
|
{
|
||||||
h = subsection_above()->effective_height();
|
h = subsection_above()->effective_height();
|
||||||
}
|
}
|
||||||
if (int(h) < 0) // Can't write h < 0!
|
if (short(h) < 0) // Can't write h < 0!
|
||||||
{
|
{
|
||||||
if (section_type() == 'F')
|
if (section_type() == 'F')
|
||||||
{
|
{
|
||||||
h += printer().formlen();
|
h += printer().formlen();
|
||||||
if (int(h) < 0) // Still < 0 ?? get out...
|
if (short(h) < 0) // Still < 0 ?? get out...
|
||||||
h = 0;
|
h = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -70,8 +70,6 @@ protected:
|
|||||||
protected:
|
protected:
|
||||||
// @cmember Segnalazione di un campo inesistente
|
// @cmember Segnalazione di un campo inesistente
|
||||||
virtual void unknown_field(const char* name) const;
|
virtual void unknown_field(const char* name) const;
|
||||||
// @cmember Compara due tipo di record del file (vedi <c TSortable>)
|
|
||||||
virtual int compare(const TSortable& s) const;
|
|
||||||
// @cmember Ritorna il nome dell'ultimo campo chiave identificato da <p key>
|
// @cmember Ritorna il nome dell'ultimo campo chiave identificato da <p key>
|
||||||
const char* last_key_field(int key) const;
|
const char* last_key_field(int key) const;
|
||||||
// @cmember Ritorna il contenuto del campo <p nf>-esimo
|
// @cmember Ritorna il contenuto del campo <p nf>-esimo
|
||||||
@ -89,6 +87,8 @@ protected:
|
|||||||
public:
|
public:
|
||||||
// @cmember Duplica il tipo di record
|
// @cmember Duplica il tipo di record
|
||||||
virtual TObject* dup() const;
|
virtual TObject* dup() const;
|
||||||
|
// @cmember Compara due tipo di record del file (vedi <c TSortable>)
|
||||||
|
virtual int compare(const TSortable& s) const;
|
||||||
|
|
||||||
// @cmember Legge il file <p f> con il tipo di record
|
// @cmember Legge il file <p f> con il tipo di record
|
||||||
virtual int read(TBaseisamfile& f, word op = _isequal, word lockop = _nolock);
|
virtual int read(TBaseisamfile& f, word op = _isequal, word lockop = _nolock);
|
||||||
|
@ -1632,6 +1632,32 @@ TReal_field& TMask::add_number (
|
|||||||
|
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
|
|
||||||
|
// @mfunc Aggiunge runtime un campo importo alla maschera
|
||||||
|
//
|
||||||
|
// @rdesc Ritorna l'handle del campo creato
|
||||||
|
TCurrency_field& TMask::add_currency (
|
||||||
|
short id, // @parm Numero identificatore del campo da aggiungere
|
||||||
|
int page, // @parm Pagina nel quale aggiungere il campo
|
||||||
|
const char* prompt, // @parm Prompt del campo
|
||||||
|
int x, // @parm Coordinata x (in caratteri)
|
||||||
|
int y, // @parm Coordinata y (in caratteri)
|
||||||
|
int dim, // @parm Lunghezza del campo sulla maschera
|
||||||
|
const char* flags, // @parm Flag di controllo del campo (default "")
|
||||||
|
short driver) // @parm Numero di decimali (default 0)
|
||||||
|
|
||||||
|
// @xref <mf TMask::add_static> <mf TMask::add_string> <mf TMask::add_date>
|
||||||
|
// <mf TMask::add_button> <mf TMask::add_radio> <mf TMask::add_memo>
|
||||||
|
{
|
||||||
|
TCurrency_field* f = new TCurrency_field(this);
|
||||||
|
f->construct(id, prompt, x, y, dim, _pagewin[page], flags, 0);
|
||||||
|
if (driver != 0)
|
||||||
|
f->add_driver(driver);
|
||||||
|
add_field(f);
|
||||||
|
return *f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @doc EXTERNAL
|
||||||
|
|
||||||
// @mfunc Aggiunge runtime un campo data alla maschera
|
// @mfunc Aggiunge runtime un campo data alla maschera
|
||||||
//
|
//
|
||||||
// @rdesc Ritorna l'handle del campo creato
|
// @rdesc Ritorna l'handle del campo creato
|
||||||
|
@ -189,6 +189,8 @@ public:
|
|||||||
|
|
||||||
// @cmember Aggiunge runtime un campo numerico alla maschera
|
// @cmember Aggiunge runtime un campo numerico alla maschera
|
||||||
TReal_field& add_number (short id, int page, const char* prompt, int x, int y, int dim, const char* flags = "", int ndec = 0);
|
TReal_field& add_number (short id, int page, const char* prompt, int x, int y, int dim, const char* flags = "", int ndec = 0);
|
||||||
|
// @cmember Aggiunge runtime un campo importo alla maschera
|
||||||
|
TCurrency_field& add_currency (short id, int page, const char* prompt, int x, int y, int dim, const char* flags = "", short driver = 0);
|
||||||
// @cmember Aggiunge runtime un campo data alla maschera
|
// @cmember Aggiunge runtime un campo data alla maschera
|
||||||
TDate_field& add_date (short id, int page, const char* prompt, int x, int y, const char* flags = "");
|
TDate_field& add_date (short id, int page, const char* prompt, int x, int y, const char* flags = "");
|
||||||
// @cmember Aggiunge runtime un campo bottone alla maschera
|
// @cmember Aggiunge runtime un campo bottone alla maschera
|
||||||
|
@ -1145,6 +1145,43 @@ const char* TEditable_field::prompt() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TOperable_field* TEditable_field::add_driver(short id)
|
||||||
|
{
|
||||||
|
TOperable_field* driver = NULL;
|
||||||
|
if (id < 0)
|
||||||
|
{
|
||||||
|
TSheet_field* sheet = mask().get_sheet();
|
||||||
|
if (sheet)
|
||||||
|
{
|
||||||
|
const int pos = sheet->mask().id2pos(-id);
|
||||||
|
if (pos >= 0)
|
||||||
|
driver = &(TOperable_field&)sheet->mask().fld(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TOperable_field* driver = NULL;
|
||||||
|
const int pos = mask().id2pos(id);
|
||||||
|
if (pos >= 0)
|
||||||
|
{
|
||||||
|
driver = &(TOperable_field&)mask().fld(pos);
|
||||||
|
TString16 msg;
|
||||||
|
msg.format("CHECK,%d", dlg());
|
||||||
|
driver->message(0, TRUE)->add(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (driver != NULL)
|
||||||
|
{
|
||||||
|
CHECKD(driver->is_kind_of(CLASS_OPERABLE_FIELD), "Field not operable ", id);
|
||||||
|
if (_drivers == NULL)
|
||||||
|
_drivers = new TPointer_array;
|
||||||
|
_drivers->add(driver);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
NFCHECK("Non esiste ancora il campo driver %d", id);
|
||||||
|
return driver;
|
||||||
|
}
|
||||||
|
|
||||||
// Ritorna il messaggio d'errore associato al campo
|
// Ritorna il messaggio d'errore associato al campo
|
||||||
const char* TEditable_field::get_warning() const
|
const char* TEditable_field::get_warning() const
|
||||||
{ return _warning ? (const char*)*_warning : ""; }
|
{ return _warning ? (const char*)*_warning : ""; }
|
||||||
@ -1170,45 +1207,11 @@ bool TEditable_field::parse_item(TScanner& scanner)
|
|||||||
|
|
||||||
if (k == "DR") // DRIVENBY
|
if (k == "DR") // DRIVENBY
|
||||||
{
|
{
|
||||||
if (_drivers == NULL)
|
|
||||||
_drivers = new TPointer_array;
|
|
||||||
TToken_string lista(scanner.line(), ' ');
|
TToken_string lista(scanner.line(), ' ');
|
||||||
FOR_EACH_TOKEN(lista, tok)
|
FOR_EACH_TOKEN(lista, tok)
|
||||||
{
|
{
|
||||||
const int id = atoi(tok);
|
const short id = atoi(tok);
|
||||||
if (id > 0)
|
add_driver(id);
|
||||||
{
|
|
||||||
const int pos = mask().id2pos(id);
|
|
||||||
if (pos >= 0)
|
|
||||||
{
|
|
||||||
TOperable_field& driver = (TOperable_field&)mask().fld(pos);
|
|
||||||
CHECKD(driver.is_kind_of(CLASS_OPERABLE_FIELD), "Field not operable ", id);
|
|
||||||
_drivers->add(&driver);
|
|
||||||
TString16 msg;
|
|
||||||
msg.format("CHECK,%d", dlg());
|
|
||||||
driver.message(0, TRUE)->add(msg);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
NFCHECK("Non esiste ancora il campo driver %d", id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TSheet_field* sheet = mask().get_sheet();
|
|
||||||
if (sheet)
|
|
||||||
{
|
|
||||||
const int pos = sheet->mask().id2pos(-id);
|
|
||||||
if (pos >= 0)
|
|
||||||
{
|
|
||||||
TMask_field& driver = sheet->mask().fld(pos);
|
|
||||||
CHECKD(driver.is_kind_of(CLASS_OPERABLE_FIELD), "Field not operable ", -id);
|
|
||||||
_drivers->add(&driver);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
NFCHECK("Non esiste il campo driver %d nella maschera principale", id);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
NFCHECK("Non esiste il campo driver %d", id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -3817,6 +3820,9 @@ const char* TCurrency_field::win2raw(const char* data) const
|
|||||||
else
|
else
|
||||||
num = real(str);
|
num = real(str);
|
||||||
|
|
||||||
|
if (num.is_zero())
|
||||||
|
str.cut(0);
|
||||||
|
else
|
||||||
str = num.string();
|
str = num.string();
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -651,6 +651,9 @@ public:
|
|||||||
// @cmember Ritorna TRUE se il campo e' di tipo editable
|
// @cmember Ritorna TRUE se il campo e' di tipo editable
|
||||||
virtual bool is_editable() const { return TRUE; }
|
virtual bool is_editable() const { return TRUE; }
|
||||||
|
|
||||||
|
// @cmember Aggiunge un campo driver
|
||||||
|
TOperable_field* add_driver(short id);
|
||||||
|
|
||||||
// @cmember Ritorna un eventuale campo driver
|
// @cmember Ritorna un eventuale campo driver
|
||||||
TOperable_field* driver(int n) const
|
TOperable_field* driver(int n) const
|
||||||
{ return _drivers ? (TOperable_field*)_drivers->objptr(n) : NULL; }
|
{ return _drivers ? (TOperable_field*)_drivers->objptr(n) : NULL; }
|
||||||
|
@ -264,7 +264,7 @@ TMultiple_rectype & TMultiple_rectype::copy(const TMultiple_rectype& r)
|
|||||||
int TMultiple_rectype::loaded_rows(int logicnum) const
|
int TMultiple_rectype::loaded_rows(int logicnum) const
|
||||||
{
|
{
|
||||||
const int index = log2ind(logicnum);
|
const int index = log2ind(logicnum);
|
||||||
TRecord_array * r = (TRecord_array *) ((TMultiple_rectype *) this)->_files.objptr(index);
|
TRecord_array* r = (TRecord_array*) ((TMultiple_rectype *) this)->_files.objptr(index);
|
||||||
|
|
||||||
if (_changed[index] || r == NULL)
|
if (_changed[index] || r == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
@ -276,6 +276,7 @@ int TMultiple_rectype::compare(const TSortable& s) const
|
|||||||
{
|
{
|
||||||
int res = TRectype::compare(s);
|
int res = TRectype::compare(s);
|
||||||
TMultiple_rectype & m = (TMultiple_rectype &) s;
|
TMultiple_rectype & m = (TMultiple_rectype &) s;
|
||||||
|
|
||||||
for (int i = 0 ; res == 0 && i < _logicnums.items(); i++)
|
for (int i = 0 ; res == 0 && i < _logicnums.items(); i++)
|
||||||
{
|
{
|
||||||
const int logicnum = lognum(i);
|
const int logicnum = lognum(i);
|
||||||
@ -286,9 +287,9 @@ int TMultiple_rectype::compare(const TSortable& s) const
|
|||||||
{
|
{
|
||||||
for (int j = r.last_row(), k = r1.last_row(); res == 0 && j > 0 && k > 0; j = r.pred_row(j), k = r1.pred_row(k))
|
for (int j = r.last_row(), k = r1.last_row(); res == 0 && j > 0 && k > 0; j = r.pred_row(j), k = r1.pred_row(k))
|
||||||
{
|
{
|
||||||
res = j - k;
|
res = j - k; // Controlla che non ci siano salti
|
||||||
if (res == 0)
|
if (res == 0)
|
||||||
res = r[j] != r1[j];
|
res = r[j].compare(r1[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -448,7 +448,7 @@ public:
|
|||||||
{ return (_formlen=fl); }
|
{ return (_formlen=fl); }
|
||||||
// @cmember Setta la dimensione del footer
|
// @cmember Setta la dimensione del footer
|
||||||
int footerlen (int fl)
|
int footerlen (int fl)
|
||||||
{ return (_footersize=fl); }
|
{ CHECKD(fl >= 0 && fl < 1024, "Bad footerlen ", fl); return _footersize = fl; }
|
||||||
// @cmember Setta la dimensione dell'header
|
// @cmember Setta la dimensione dell'header
|
||||||
int headerlen (int hl)
|
int headerlen (int hl)
|
||||||
{ return (_headersize=hl); }
|
{ return (_headersize=hl); }
|
||||||
|
@ -683,3 +683,44 @@ const TString& TRecord_cache::get(const char* key, const char* field)
|
|||||||
return get(key).get(field);
|
return get(key).get(field);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// TDB_cache
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
TRecord_cache& TDB_cache::cache(int file)
|
||||||
|
{
|
||||||
|
CHECKD(file >= LF_USER && file < LF_EXTERNAL, "Invalid file ", file);
|
||||||
|
TRecord_cache* rc = (TRecord_cache*)objptr(file);
|
||||||
|
if (rc == NULL)
|
||||||
|
{
|
||||||
|
rc = new TRecord_cache(file);
|
||||||
|
rc->set_items_limit(file==LF_TAB || file==LF_TABCOM ? 1024 : 256);
|
||||||
|
rc->test_file_changes();
|
||||||
|
add(rc, file);
|
||||||
|
}
|
||||||
|
return *rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
const TRectype& TDB_cache::get(const char* table, const char* key)
|
||||||
|
{
|
||||||
|
CHECK(table && *table, "Invalid Table code");
|
||||||
|
|
||||||
|
int file = LF_TAB;
|
||||||
|
if (*table == '%')
|
||||||
|
{
|
||||||
|
file = LF_TABCOM;
|
||||||
|
table++;
|
||||||
|
}
|
||||||
|
TString80 tabkey;
|
||||||
|
tabkey << table << '|' << key;
|
||||||
|
return get(file, key);
|
||||||
|
}
|
||||||
|
|
||||||
|
TDB_cache& cache()
|
||||||
|
{
|
||||||
|
static TDB_cache* _frate_cercone = NULL;
|
||||||
|
if (_frate_cercone == NULL)
|
||||||
|
_frate_cercone = new TDB_cache;
|
||||||
|
return *_frate_cercone;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -217,11 +217,33 @@ public:
|
|||||||
// @cmember ritorna il record con una determinata chiave
|
// @cmember ritorna il record con una determinata chiave
|
||||||
virtual const TRectype& get(const char* chiave);
|
virtual const TRectype& get(const char* chiave);
|
||||||
|
|
||||||
|
// @cmember ritorna il record con una determinata chiave numerica
|
||||||
|
const TRectype& get(long chiave)
|
||||||
|
{ char str[24]; sprintf(str, "%ld", chiave); return get(str); }
|
||||||
|
|
||||||
TRecord_cache(int num, int key = 1);
|
TRecord_cache(int num, int key = 1);
|
||||||
TRecord_cache(TLocalisamfile *f, int key = 1);
|
TRecord_cache(TLocalisamfile *f, int key = 1);
|
||||||
TRecord_cache(const char* table, int key = 1);
|
TRecord_cache(const char* table, int key = 1);
|
||||||
virtual ~TRecord_cache() { }
|
virtual ~TRecord_cache() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class TDB_cache : public TArray
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
TRecord_cache& cache(int file);
|
||||||
|
|
||||||
|
public:
|
||||||
|
const TRectype& get(int file, const char* key)
|
||||||
|
{ return cache(file).get(key); }
|
||||||
|
|
||||||
|
const TRectype& get(int file, long key)
|
||||||
|
{ return cache(file).get(key); }
|
||||||
|
|
||||||
|
const TRectype& get(const char* table, const char* key);
|
||||||
|
};
|
||||||
|
|
||||||
|
TDB_cache& cache();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -657,13 +657,17 @@ int TRelation_application::delete_mode()
|
|||||||
bool can_delete = FALSE;
|
bool can_delete = FALSE;
|
||||||
if (find(1))
|
if (find(1))
|
||||||
{
|
{
|
||||||
|
TRelation& r = *get_relation();
|
||||||
_autodelete = 0x3;
|
_autodelete = 0x3;
|
||||||
if (!protected_record(get_relation()->curr()))
|
if (!protected_record(r.curr()))
|
||||||
{
|
{
|
||||||
if (modify_mode())
|
if (modify_mode())
|
||||||
|
{
|
||||||
|
r.restore_status();
|
||||||
can_delete = remove();
|
can_delete = remove();
|
||||||
}
|
}
|
||||||
query_mode();
|
query_mode();
|
||||||
|
}
|
||||||
_autodelete = FALSE;
|
_autodelete = FALSE;
|
||||||
}
|
}
|
||||||
if (!can_delete)
|
if (!can_delete)
|
||||||
|
@ -1049,14 +1049,23 @@ TRecnotype TCursor::buildcursor(TRecnotype rp)
|
|||||||
|
|
||||||
int TCursor::filtercursor(int pagecnt, TRecnotype* page)
|
int TCursor::filtercursor(int pagecnt, TRecnotype* page)
|
||||||
{
|
{
|
||||||
int np=0; /*, handle = file().handle(); */
|
TLocalisamfile& fil = file();
|
||||||
TRectype& rec=file().curr();
|
TRectype& rec = fil.curr();
|
||||||
for (int i=0; i< pagecnt; i++)
|
int np = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < pagecnt; i++)
|
||||||
{
|
{
|
||||||
file().readat(rec,page[i]);
|
rec.readat(fil,page[i]);
|
||||||
if (update_relation()) _if->update();
|
if (update_relation())
|
||||||
if ((_filterfunction ? _filterfunction(_if) : TRUE ) &&
|
_if->update();
|
||||||
(_fexpr ? __evalcondition(*_if, _fexpr, _frefs) : TRUE))
|
|
||||||
|
bool ok = TRUE;
|
||||||
|
if (_filterfunction)
|
||||||
|
ok = _filterfunction(_if);
|
||||||
|
if (ok && _fexpr)
|
||||||
|
ok = __evalcondition(*_if, _fexpr, _frefs);
|
||||||
|
|
||||||
|
if (ok)
|
||||||
{
|
{
|
||||||
if (np < i) page[np] = page[i];
|
if (np < i) page[np] = page[i];
|
||||||
np++;
|
np++;
|
||||||
@ -1232,16 +1241,17 @@ void TCursor::setkey(int nkey)
|
|||||||
int TCursor::test(TIsamop op, TReclock lockop) const
|
int TCursor::test(TIsamop op, TReclock lockop) const
|
||||||
{
|
{
|
||||||
TLocalisamfile& curfile = file();
|
TLocalisamfile& curfile = file();
|
||||||
|
const TRectype& currec = curfile.curr();
|
||||||
curfile.setkey(_nkey);
|
curfile.setkey(_nkey);
|
||||||
|
|
||||||
int err = NOERR;
|
int err = NOERR;
|
||||||
if (op == _isequal)
|
if (op == _isequal)
|
||||||
{
|
{
|
||||||
const TString match(curfile.curr().key(_nkey));
|
const TString match(currec.key(_nkey));
|
||||||
bool trovato = FALSE;
|
bool trovato = FALSE;
|
||||||
|
|
||||||
for (err = curfile.read(op, lockop);
|
for (err = curfile.read(op, lockop);
|
||||||
err == NOERR && match == curfile.curr().key(_nkey);
|
err == NOERR && match == currec.key(_nkey);
|
||||||
err = curfile.next(lockop))
|
err = curfile.next(lockop))
|
||||||
{
|
{
|
||||||
if (ok())
|
if (ok())
|
||||||
@ -1273,6 +1283,17 @@ int TCursor::test(TIsamop op, TReclock lockop) const
|
|||||||
{
|
{
|
||||||
if (lockop != _nolock)
|
if (lockop != _nolock)
|
||||||
curfile.reread(_unlock);
|
curfile.reread(_unlock);
|
||||||
|
|
||||||
|
const TString& kto = to();
|
||||||
|
if (kto.not_empty())
|
||||||
|
{
|
||||||
|
const TFixed_string curkey(currec.key(_nkey));
|
||||||
|
if (kto.compare(curkey, kto.len()) < 0)
|
||||||
|
{
|
||||||
|
err = _iseof;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ class TSort;
|
|||||||
//
|
//
|
||||||
// @base public | TObject
|
// @base public | TObject
|
||||||
class TRelation : public TObject
|
class TRelation : public TObject
|
||||||
// @author:(INTERNAL) Sandro
|
// @author:(INTERNAL) Alex
|
||||||
{
|
{
|
||||||
// @cfriend TRelationdef
|
// @cfriend TRelationdef
|
||||||
friend class TRelationdef;
|
friend class TRelationdef;
|
||||||
|
@ -31,7 +31,7 @@ typedef unsigned short UINT16;
|
|||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
|
|
||||||
// @type UINT32 | Altro nome di assegnazione per gli unsigned long
|
// @type UINT32 | Altro nome di assegnazione per gli unsigned long
|
||||||
#ifdef WIN32
|
#if XVT_OS==XVT_OS_WIN32
|
||||||
typedef unsigned int UINT32;
|
typedef unsigned int UINT32;
|
||||||
#else
|
#else
|
||||||
typedef unsigned long UINT32;
|
typedef unsigned long UINT32;
|
||||||
@ -46,7 +46,7 @@ typedef short INT16;
|
|||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
|
|
||||||
// @type INT32 | Altro nome di assegnazione per i long
|
// @type INT32 | Altro nome di assegnazione per i long
|
||||||
#ifdef WIN32
|
#if XVT_OS==XVT_OS_WIN32
|
||||||
typedef int INT32;
|
typedef int INT32;
|
||||||
#else
|
#else
|
||||||
typedef long INT32;
|
typedef long INT32;
|
||||||
@ -56,7 +56,7 @@ typedef long INT32;
|
|||||||
// @type bool | Tipo booleano che puo' assumere i valori TRUE (definito come 1)
|
// @type bool | Tipo booleano che puo' assumere i valori TRUE (definito come 1)
|
||||||
// e FALSE (definito come 0).
|
// e FALSE (definito come 0).
|
||||||
|
|
||||||
#ifdef WIN32
|
#if XVT_OS==XVT_OS_WIN32
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
typedef unsigned short bool;
|
typedef unsigned short bool;
|
||||||
|
@ -1514,6 +1514,8 @@ bool TToken_string::get(
|
|||||||
*p = _separator;
|
*p = _separator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
tok.cut(0);
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
@ -3,34 +3,34 @@
|
|||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
|
|
||||||
// @cmember Costruttore
|
// @cmember Costruttore
|
||||||
Tab_application::Tab_application()
|
TTable_application::TTable_application()
|
||||||
: _msk(NULL), _rel(NULL)
|
: _msk(NULL), _rel(NULL)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
// @cmember Distruttore
|
// @cmember Distruttore
|
||||||
Tab_application::~Tab_application()
|
TTable_application::~TTable_application()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
// @cmember Indica se la futura <mf Tab_application::get_mask> ritornera' una maschera diversa
|
// @cmember Indica se la futura <mf TTable_application::get_mask> ritornera' una maschera diversa
|
||||||
// dalla corrente.
|
// dalla corrente.
|
||||||
bool Tab_application::changing_mask(int mode)
|
bool TTable_application::changing_mask(int mode)
|
||||||
{ return FALSE; }
|
{ return FALSE; }
|
||||||
|
|
||||||
// @cmember Richiede la maschera da usare
|
// @cmember Richiede la maschera da usare
|
||||||
TMask* Tab_application::get_mask(int mode)
|
TMask* TTable_application::get_mask(int mode)
|
||||||
{
|
{
|
||||||
CHECK(_msk, "Null mask");
|
CHECK(_msk, "Null mask");
|
||||||
return _msk;
|
return _msk;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @cmember Ritorna la relazione da modificare
|
// @cmember Ritorna la relazione da modificare
|
||||||
TRelation* Tab_application::get_relation() const
|
TRelation* TTable_application::get_relation() const
|
||||||
{
|
{
|
||||||
CHECK(_rel, "Null relation");
|
CHECK(_rel, "Null relation");
|
||||||
return _rel;
|
return _rel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tab_application::print()
|
void TTable_application::print()
|
||||||
{
|
{
|
||||||
TString16 cmd;
|
TString16 cmd;
|
||||||
cmd << "ba3 -1 " << get_tabname();
|
cmd << "ba3 -1 " << get_tabname();
|
||||||
@ -38,28 +38,28 @@ void Tab_application::print()
|
|||||||
stampa.run();
|
stampa.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tab_application::init_query_mode(TMask& m)
|
void TTable_application::init_query_mode(TMask& m)
|
||||||
{
|
{
|
||||||
m.enable(-GR_MODIFY_PROTECTED);
|
m.enable(-GR_MODIFY_PROTECTED);
|
||||||
m.enable(-GR_RECORD_PROTECTED);
|
m.enable(-GR_RECORD_PROTECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tab_application::init_modify_mode(TMask& m)
|
void TTable_application::init_modify_mode(TMask& m)
|
||||||
{
|
{
|
||||||
m.disable(-GR_MODIFY_PROTECTED);
|
m.disable(-GR_MODIFY_PROTECTED);
|
||||||
const bool enable = !(_rel->curr().get_bool(FPC));
|
const bool enable = !(_rel->curr().get_bool(FPC));
|
||||||
m.enable(-GR_RECORD_PROTECTED,enable);
|
m.enable(-GR_RECORD_PROTECTED,enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Tab_application::protected_record(TRectype& rec)
|
bool TTable_application::protected_record(TRectype& rec)
|
||||||
{
|
{
|
||||||
return rec.get_bool(FPC);
|
return rec.get_bool(FPC);
|
||||||
}
|
}
|
||||||
|
|
||||||
TString& Tab_application::get_mask_name(TString& t) const
|
TString& TTable_application::get_mask_name(TString& t) const
|
||||||
{
|
{
|
||||||
CHECK(_rel,"Can't use a NULL relation to retrieve table module");
|
CHECK(_rel,"Can't use a NULL relation to retrieve table module");
|
||||||
TTable& tab = (TTable&) _rel->lfile(_tabname);
|
TTable& tab = (TTable&) _rel->lfile();
|
||||||
|
|
||||||
TString16 m = _tabname;
|
TString16 m = _tabname;
|
||||||
if (m[0] == '%') m.ltrim(1);
|
if (m[0] == '%') m.ltrim(1);
|
||||||
@ -67,10 +67,11 @@ TString& Tab_application::get_mask_name(TString& t) const
|
|||||||
t = tab.module();
|
t = tab.module();
|
||||||
t << "tb" << m;
|
t << "tb" << m;
|
||||||
t.upper();
|
t.upper();
|
||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
TMask* Tab_application::set_mask(TMask* m)
|
TMask* TTable_application::set_mask(TMask* m)
|
||||||
{
|
{
|
||||||
if (_msk != NULL)
|
if (_msk != NULL)
|
||||||
delete _msk;
|
delete _msk;
|
||||||
@ -90,7 +91,7 @@ TMask* Tab_application::set_mask(TMask* m)
|
|||||||
return _msk;
|
return _msk;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Tab_application::user_create()
|
bool TTable_application::user_create()
|
||||||
{
|
{
|
||||||
if (argc() < 3)
|
if (argc() < 3)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -124,7 +125,7 @@ bool Tab_application::user_create()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Tab_application::user_destroy()
|
bool TTable_application::user_destroy()
|
||||||
{
|
{
|
||||||
if (_msk) delete _msk;
|
if (_msk) delete _msk;
|
||||||
if (_rel) delete _rel;
|
if (_rel) delete _rel;
|
||||||
|
@ -11,14 +11,12 @@
|
|||||||
|
|
||||||
#define FPC "FPC"
|
#define FPC "FPC"
|
||||||
|
|
||||||
#define TTable_application Tab_application
|
|
||||||
|
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
|
|
||||||
// @class Tab_application | Classe per la definizione della <c TRelation_application> per le tabelle
|
// @class Tab_application | Classe per la definizione della <c TRelation_application> per le tabelle
|
||||||
//
|
//
|
||||||
// @base public | TRelation_application
|
// @base public | TRelation_application
|
||||||
class Tab_application : public TRelation_application
|
class TTable_application : public TRelation_application
|
||||||
|
|
||||||
// @author:(INTERNAL) Nicola
|
// @author:(INTERNAL) Nicola
|
||||||
// @access:(INTERNAL) Private Member
|
// @access:(INTERNAL) Private Member
|
||||||
@ -65,9 +63,9 @@ public:
|
|||||||
{ return _tabname; }
|
{ return _tabname; }
|
||||||
|
|
||||||
// @cmember Costruttore
|
// @cmember Costruttore
|
||||||
Tab_application();
|
TTable_application();
|
||||||
// @cmember Distruttore
|
// @cmember Distruttore
|
||||||
virtual ~Tab_application();
|
virtual ~TTable_application();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -145,8 +145,8 @@ void TTable::load_module_description()
|
|||||||
n.lower();
|
n.lower();
|
||||||
if (fexist(n))
|
if (fexist(n))
|
||||||
{
|
{
|
||||||
TConfig des(n);
|
TConfig des(n, "TabDescr");
|
||||||
_module = des.get("Module","TabDescr");
|
_module = des.get("Module");
|
||||||
}
|
}
|
||||||
n = "??tb";
|
n = "??tb";
|
||||||
n << _tabname;
|
n << _tabname;
|
||||||
@ -157,10 +157,6 @@ void TTable::load_module_description()
|
|||||||
if (list_files(n, f) == 1)
|
if (list_files(n, f) == 1)
|
||||||
{
|
{
|
||||||
n = f.row(0);
|
n = f.row(0);
|
||||||
if (!n.exist())
|
|
||||||
n.overwrite("ba",0);
|
|
||||||
if (n.exist())
|
|
||||||
{
|
|
||||||
if (_module.empty())
|
if (_module.empty())
|
||||||
{
|
{
|
||||||
_module = n.left(2);
|
_module = n.left(2);
|
||||||
@ -186,9 +182,6 @@ void TTable::load_module_description()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
_module = "ba";
|
_module = "ba";
|
||||||
}
|
|
||||||
else
|
|
||||||
_module = "ba";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* TTable::module()
|
const char* TTable::module()
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
#include <defmask.h>
|
||||||
#include <expr.h>
|
#include <expr.h>
|
||||||
#include <isam.h>
|
|
||||||
#include <mask.h>
|
#include <mask.h>
|
||||||
#include <prefix.h>
|
#include <prefix.h>
|
||||||
|
#include <recarray.h>
|
||||||
#include <validate.h>
|
#include <validate.h>
|
||||||
#include <defmask.h>
|
|
||||||
|
|
||||||
#include <nditte.h>
|
#include <nditte.h>
|
||||||
|
|
||||||
@ -72,18 +72,25 @@ bool pi_check(
|
|||||||
const char* st, // @parm Stato di assegnazione della Partita IVA
|
const char* st, // @parm Stato di assegnazione della Partita IVA
|
||||||
const char* paiva) // @parm Codice della Partita IVA da controllare
|
const char* paiva) // @parm Codice della Partita IVA da controllare
|
||||||
{
|
{
|
||||||
|
const TFixed_string stato(st);
|
||||||
|
const TFixed_string pi(paiva);
|
||||||
|
|
||||||
|
if (pi.empty())
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
bool ok = TRUE; // Assumiamo ottimisticamente che tutto va be'
|
||||||
|
|
||||||
|
if (stato.blank() || stato == "IT")
|
||||||
|
{
|
||||||
|
// Testa partita iva italiana
|
||||||
|
ok = pi.len() == 11;
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
int tot = 0, y;
|
int tot = 0, y;
|
||||||
TString16 stato (st);
|
|
||||||
TString16 pi (paiva);
|
|
||||||
|
|
||||||
if ((stato.not_empty()) && (stato != "IT")) return TRUE;
|
|
||||||
if (pi.empty()) return TRUE;
|
|
||||||
if (pi.len() != 11)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
for (int i = 0; i <= 9; i++)
|
for (int i = 0; i <= 9; i++)
|
||||||
{
|
{
|
||||||
if ((i + 1) & 0x0001) tot += (pi[i] - '0');
|
if ((i + 1) & 0x0001)
|
||||||
|
tot += (pi[i] - '0');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
y = (pi[i] - '0') * 2;
|
y = (pi[i] - '0') * 2;
|
||||||
@ -97,28 +104,39 @@ bool pi_check(
|
|||||||
}
|
}
|
||||||
y = 10 - (tot % 10);
|
y = 10 - (tot % 10);
|
||||||
if (y == 10) y = 0;
|
if (y == 10) y = 0;
|
||||||
bool ok = (pi[10] == (y + '0'));
|
ok = (pi[10] == (y + '0'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const char* stpi[] = { "BE09", "DE09", "DK08", "EL08", "ES09",
|
||||||
|
"FR11", "GB09", "GB12", "IE08", "IT11",
|
||||||
|
"LU08", "NL12", "PT09", NULL };
|
||||||
|
TString16 test;
|
||||||
|
test.format("%s%02d", (const char*)stato, pi.len());
|
||||||
|
|
||||||
|
ok = FALSE;
|
||||||
|
for (int g = 0; stpi[g]; g++)
|
||||||
|
{
|
||||||
|
ok = (test == stpi[g]);
|
||||||
|
if (ok)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Controlla la partita iva se e' non vuota
|
||||||
// Controlla la partita iva se e' non vuota ed italiana
|
|
||||||
HIDDEN bool _pi_val(TMask_field& f, KEY)
|
HIDDEN bool _pi_val(TMask_field& f, KEY)
|
||||||
{
|
{
|
||||||
if (f.mask().query_mode()) return TRUE;
|
TMask& m = f.mask();
|
||||||
|
if (m.query_mode())
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
TString16 stato(f.mask().get(atoi(get_val_param(0)))), pi(f.get());
|
const TString& stato = m.get(atoi(get_val_param(0)));
|
||||||
|
const TString& pi = f.get();
|
||||||
if (stato.not_empty() && stato != "IT") return TRUE;
|
bool ok = pi_check(stato, pi);
|
||||||
if (pi.empty()) return TRUE;
|
|
||||||
if (pi.len() != 11)
|
|
||||||
{
|
|
||||||
f.error_box("Lunghezza partita IVA diversa da 11");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ok = pi_check (stato, pi);
|
|
||||||
if (!ok)
|
if (!ok)
|
||||||
{
|
{
|
||||||
if(f.dirty())
|
if(f.dirty())
|
||||||
@ -126,7 +144,8 @@ HIDDEN bool _pi_val(TMask_field& f, KEY)
|
|||||||
ok = f.yesno_box("Partita IVA errata, la accetto ugualmente?");
|
ok = f.yesno_box("Partita IVA errata, la accetto ugualmente?");
|
||||||
if (ok) f.set_dirty(FALSE);
|
if (ok) f.set_dirty(FALSE);
|
||||||
}
|
}
|
||||||
else ok = TRUE; // Era gia' errata e la ho accettata
|
else
|
||||||
|
ok = TRUE; // Era gia' errata e la ho accettata
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
@ -242,34 +261,31 @@ HIDDEN bool _cf_val(TMask_field& f, KEY key)
|
|||||||
|
|
||||||
|
|
||||||
HIDDEN bool _xt_pi_val(TMask_field& f, KEY key)
|
HIDDEN bool _xt_pi_val(TMask_field& f, KEY key)
|
||||||
|
|
||||||
{
|
{
|
||||||
TMask& m = f.mask();
|
TMask& m = f.mask();
|
||||||
if (m.query_mode()) return TRUE;
|
if (m.query_mode())
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
TString16 value(f.get());
|
TString16 value = f.get();
|
||||||
if (value.empty()) return f.error_box("Partita IVA obbligatoria");
|
if (value.empty())
|
||||||
|
return f.error_box("Partita IVA obbligatoria");
|
||||||
|
|
||||||
const TString16 stato(m.get(atoi(get_val_param(0))));
|
if (!_pi_val(f, key))
|
||||||
if (stato.not_empty() && stato != "IT") return TRUE;
|
return FALSE;
|
||||||
|
|
||||||
if (!_pi_val(f, key)) return FALSE;
|
|
||||||
|
|
||||||
TLocalisamfile c(LF_COMUNI);
|
|
||||||
|
|
||||||
|
const TString& stato = m.get(atoi(get_val_param(0)));
|
||||||
|
// if (stato.not_empty() && stato != "IT") return TRUE;
|
||||||
|
if (stato.empty() || stato == "IT")
|
||||||
|
{
|
||||||
const int pi = atoi(value.mid(7,3));
|
const int pi = atoi(value.mid(7,3));
|
||||||
|
|
||||||
for (int i = 1 ; i < 3; i++)
|
for (int i = 1 ; i < 3; i++)
|
||||||
{
|
{
|
||||||
const int comune = atoi(get_val_param(i));
|
const short id_comune = short(atoi(get_val_param(i)));
|
||||||
if (comune)
|
if (id_comune > 0 && !m.field(id_comune).empty())
|
||||||
{
|
{
|
||||||
const TString16 com(m.get(comune)); // Comune residenza fiscale e residenza
|
TString16 codcom; codcom << " |" << m.get(id_comune);
|
||||||
if (com.not_empty())
|
const TRectype& c = cache().get(LF_COMUNI, codcom);
|
||||||
{
|
if (!c.empty())
|
||||||
c.zero();
|
|
||||||
c.put("COM", com);
|
|
||||||
if (c.read() == NOERR)
|
|
||||||
{
|
{
|
||||||
const int s1 = c.get_int("UFFIVA1");
|
const int s1 = c.get_int("UFFIVA1");
|
||||||
const int s2 = c.get_int("UFFIVA2");
|
const int s2 = c.get_int("UFFIVA2");
|
||||||
@ -292,12 +308,10 @@ HIDDEN bool _xt_pi_val(TMask_field& f, KEY key)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HIDDEN bool _xtz_pi_val(TMask_field& f, KEY key)
|
HIDDEN bool _xtz_pi_val(TMask_field& f, KEY key)
|
||||||
{
|
{
|
||||||
if (f.mask().query_mode()) return TRUE;
|
if (f.empty() || f.mask().query_mode())
|
||||||
TString16 pi(f.get());
|
return TRUE;
|
||||||
if (pi.empty()) return TRUE;
|
|
||||||
return _xt_pi_val(f, key);
|
return _xt_pi_val(f, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,7 +320,7 @@ HIDDEN bool _xt_cf_val(TMask_field& f, KEY key)
|
|||||||
{
|
{
|
||||||
if (f.mask().query_mode()) return TRUE;
|
if (f.mask().query_mode()) return TRUE;
|
||||||
|
|
||||||
TString16 cf(f.get());
|
TString16 cf = f.get();
|
||||||
if (cf.empty()) return f.error_box("Codice fiscale obbligatorio");
|
if (cf.empty()) return f.error_box("Codice fiscale obbligatorio");
|
||||||
|
|
||||||
if (!_cf_val(f, key)) return FALSE;
|
if (!_cf_val(f, key)) return FALSE;
|
||||||
@ -403,26 +417,25 @@ HIDDEN bool _xt_cf_val(TMask_field& f, KEY key)
|
|||||||
|
|
||||||
|
|
||||||
HIDDEN bool _xtz_cf_val(TMask_field& f, KEY key)
|
HIDDEN bool _xtz_cf_val(TMask_field& f, KEY key)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (f.mask().query_mode()) return TRUE;
|
if (f.empty() || f.mask().query_mode())
|
||||||
const char* cf = f.get();
|
return TRUE;
|
||||||
return (*cf == '\0') ? TRUE : _xt_cf_val(f, key);
|
return _xt_cf_val(f, key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HIDDEN bool _notempty_val(TMask_field& f, KEY)
|
HIDDEN bool _notempty_val(TMask_field& f, KEY)
|
||||||
{
|
{
|
||||||
return f.mask().query_mode() || f.get().not_empty();
|
return f.mask().query_mode() || !f.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HIDDEN bool _date_cmp(TMask_field& f, KEY)
|
HIDDEN bool _date_cmp(TMask_field& f, KEY)
|
||||||
{
|
{
|
||||||
TFixed_string s(f.get());
|
if (f.empty())
|
||||||
if (s.empty()) return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
TDate d0(s), d1(f.mask().get(atoi(get_val_param(1))));
|
TDate d0(f.get()), d1(f.mask().get(atoi(get_val_param(1))));
|
||||||
TFixed_string op(get_val_param(0));
|
TFixed_string op(get_val_param(0));
|
||||||
|
|
||||||
if (op == "==") return d0 == d1;
|
if (op == "==") return d0 == d1;
|
||||||
@ -442,13 +455,14 @@ HIDDEN bool _date_cmp(TMask_field& f, KEY)
|
|||||||
|
|
||||||
HIDDEN bool _fixlen_val(TMask_field& f, KEY)
|
HIDDEN bool _fixlen_val(TMask_field& f, KEY)
|
||||||
{
|
{
|
||||||
const TFixed_string s(f.get());
|
if (f.empty())
|
||||||
|
return TRUE;
|
||||||
if (s.empty()) return TRUE;
|
|
||||||
|
|
||||||
|
const TString& s = f.get();
|
||||||
const int length = atoi(get_val_param(0));
|
const int length = atoi(get_val_param(0));
|
||||||
const bool ok = s.len() == length;
|
const bool ok = s.len() == length;
|
||||||
if (!ok) f.error_box("Lunghezza errata: deve essere %d", length);
|
if (!ok)
|
||||||
|
f.error_box("Lunghezza errata: deve essere %d", length);
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,28 +470,36 @@ HIDDEN bool _fixlen_val(TMask_field& f, KEY)
|
|||||||
HIDDEN bool _mtcheck_val(TMask_field& f, KEY)
|
HIDDEN bool _mtcheck_val(TMask_field& f, KEY)
|
||||||
{
|
{
|
||||||
const int month = atoi(f.get());
|
const int month = atoi(f.get());
|
||||||
if (month < 1 || month > 13) return FALSE;
|
if (month < 1 || month > 13)
|
||||||
|
return FALSE;
|
||||||
|
/*
|
||||||
TLocalisamfile d(LF_NDITTE);
|
TLocalisamfile d(LF_NDITTE);
|
||||||
d.zero();
|
d.zero();
|
||||||
d.put(NDT_CODDITTA, prefix().get_codditta());
|
d.put(NDT_CODDITTA, prefix().get_codditta());
|
||||||
d.read();
|
d.read();
|
||||||
if (d.bad()) return TRUE;
|
if (d.bad())
|
||||||
if (d.get_char(NDT_FREQVIVA) == 'M') return TRUE;
|
return TRUE;
|
||||||
|
if (d.get_char(NDT_FREQVIVA) == 'M')
|
||||||
|
return TRUE;
|
||||||
return month == 13 || (month % 3) == 0;
|
return month == 13 || (month % 3) == 0;
|
||||||
|
*/
|
||||||
|
const TRectype& d = cache().get(LF_NDITTE, prefix().get_codditta());
|
||||||
|
if (d.get_char(NDT_FREQVIVA) == 'T')
|
||||||
|
return month == 13 || (month % 3) == 0;
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
HIDDEN bool _reqif_val(TMask_field& f, KEY k)
|
HIDDEN bool _reqif_val(TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
if (k == K_ENTER)
|
if (k == K_ENTER && f.empty())
|
||||||
{
|
{
|
||||||
if (f.get().not_empty()) return TRUE;
|
const TMask& m = f.mask();
|
||||||
const int nparms = get_val_param_num();
|
const int nparms = get_val_param_num();
|
||||||
for (int i = 0 ; i < nparms; i++)
|
for (int i = 0; i < nparms; i++)
|
||||||
{
|
{
|
||||||
const short id = atoi(get_val_param(i));
|
const short id = f.atodlg(get_val_param(i));
|
||||||
if (id > 0 && f.mask().get(id).not_empty())
|
if (id > 0 && !m.field(id).empty())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -487,9 +509,8 @@ HIDDEN bool _reqif_val(TMask_field& f, KEY k)
|
|||||||
|
|
||||||
HIDDEN bool _autoexit_val(TMask_field& f, KEY key)
|
HIDDEN bool _autoexit_val(TMask_field& f, KEY key)
|
||||||
{
|
{
|
||||||
TMask& m = f.mask();
|
const TMask& m = f.mask();
|
||||||
|
if (key == K_ENTER || !m.query_mode() )
|
||||||
if (!m.query_mode() || key == K_ENTER)
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -545,7 +566,7 @@ HIDDEN bool _numcalc_val(TMask_field& f, KEY k)
|
|||||||
const int fldid = atoi(s);
|
const int fldid = atoi(s);
|
||||||
e.setvar(i, fldid == 0 ? f.get() : f.mask().get(fldid));
|
e.setvar(i, fldid == 0 ? f.get() : f.mask().get(fldid));
|
||||||
}
|
}
|
||||||
const TFixed_string s(e.as_string());
|
const TString& s = e.as_string();
|
||||||
f.set(s);
|
f.set(s);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -568,7 +589,7 @@ HIDDEN bool _strcalc_val(TMask_field& f, KEY k)
|
|||||||
const int fldid = atoi(s);
|
const int fldid = atoi(s);
|
||||||
e.setvar(i, fldid == 0 ? f.get() : f.mask().get(fldid));
|
e.setvar(i, fldid == 0 ? f.get() : f.mask().get(fldid));
|
||||||
}
|
}
|
||||||
TFixed_string s( e.as_string());
|
const TString& s = e.as_string();
|
||||||
f.set(s);
|
f.set(s);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -576,11 +597,11 @@ HIDDEN bool _strcalc_val(TMask_field& f, KEY k)
|
|||||||
|
|
||||||
HIDDEN bool _onereq_val(TMask_field& f, KEY k)
|
HIDDEN bool _onereq_val(TMask_field& f, KEY k)
|
||||||
{
|
{
|
||||||
if (k != K_ENTER) return TRUE;
|
|
||||||
const TMask& m = f.mask();
|
const TMask& m = f.mask();
|
||||||
if (m.mode() == MODE_QUERY) return TRUE;
|
if (k != K_ENTER || m.query_mode())
|
||||||
const int nparms = get_val_param_num();
|
return TRUE;
|
||||||
|
|
||||||
|
const int nparms = get_val_param_num();
|
||||||
for (int i = 0; i < nparms ; i++)
|
for (int i = 0; i < nparms ; i++)
|
||||||
{
|
{
|
||||||
const char* s = m.get(atoi(get_val_param(i)));
|
const char* s = m.get(atoi(get_val_param(i)));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user