Aggiunti ad elenco moduli IC

git-svn-id: svn://10.65.10.50/branches/R_10_00@22742 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2012-10-26 08:34:07 +00:00
parent b7b44916a5
commit 54fad7d162
14 changed files with 521 additions and 444 deletions

View File

@ -1645,14 +1645,11 @@ static void clean_string(TString& str)
str.upper(); str.upper();
} }
TRecnotype TFuzzy_browse::find(const TString& raw_val) TRecnotype TFuzzy_browse::find_magic(const TString& magic_val, double& best)
{ {
const TBrowse& b = *field().browse(); const TBrowse& b = *field().browse();
TCursor& c = cursor(); TCursor& c = cursor();
TString80 magic_val = raw_val;
clean_string(magic_val);
c = 0L; c = 0L;
TRecnotype recno = -1; TRecnotype recno = -1;
TRectype& curr = c.curr(); TRectype& curr = c.curr();
@ -1663,11 +1660,11 @@ TRecnotype TFuzzy_browse::find(const TString& raw_val)
return recno; return recno;
recno = -1; recno = -1;
best = 0.66;
const int testlen = magic_val.len()+1; const int testlen = magic_val.len()+1;
if (testlen > 3) if (testlen > 3)
{ {
double best = 0.66;
for (c = 0L; c.ok(); ++c) for (c = 0L; c.ok(); ++c)
{ {
TString80 val = curr.get(_altfld); TString80 val = curr.get(_altfld);
@ -1690,6 +1687,40 @@ TRecnotype TFuzzy_browse::find(const TString& raw_val)
if (recno >= 0) if (recno >= 0)
c = recno; c = recno;
else
best = 0;
return recno;
}
TRecnotype TFuzzy_browse::find(const TString& raw_val)
{
TString80 magic_val = raw_val;
clean_string(magic_val);
double best = 0;
TRecnotype recno = find_magic(magic_val, best);
if (best < 0.8 && raw_val.find(' ') > 0)
{
magic_val = raw_val;
magic_val.strip_double_spaces();
const int spc = magic_val.find(' ');
if (spc > 0)
{
const TString& left = magic_val.left(spc);
const TString& right = magic_val.mid(spc+1);
magic_val.cut(0) << right << ' ' << left;
clean_string(magic_val);
double altbest = 0;
const TRecnotype altrecno = find_magic(magic_val, altbest);
if (altbest > best)
{
best = altbest;
recno = altrecno;
}
}
}
return recno; return recno;
} }
@ -1760,7 +1791,8 @@ KEY TFuzzy_browse::run()
if (k == K_ENTER) if (k == K_ENTER)
{ {
c = sheet.selected(); c = sheet.selected();
field().set(c.curr().get(_outfld)); const TFieldref fr(_outfld, 0);
field().set(fr.read(*c.relation()));
} }
return k; return k;
} }

View File

@ -299,6 +299,7 @@ class TFuzzy_browse : public TBrowse_button
protected: protected:
virtual void parse_input(TScanner& scanner) {} virtual void parse_input(TScanner& scanner) {}
virtual void parse_output(TScanner& scanner) {} virtual void parse_output(TScanner& scanner) {}
long find_magic(const TString& magic_val, double& best);
protected: protected:
const int _altkey; const int _altkey;

View File

@ -22,7 +22,7 @@ ab Analisi di bilancio
gv Gestione versamenti F24 gv Gestione versamenti F24
ca Contabilita' Analitica ca Contabilita' Analitica
vd Vendita al dettaglio vd Vendita al dettaglio
af Autoformazione ic IVA per cassa
pe Preventivazione pe Preventivazione
ep Effetti Passivi ep Effetti Passivi
tc Trasferimento altre Contabilita' tc Trasferimento altre Contabilita'

View File

@ -4,7 +4,6 @@
#include <config.h> #include <config.h>
#include <dongle.h> #include <dongle.h>
#include <isamrpc.h> #include <isamrpc.h>
#include <modaut.h>
#include <scanner.h> #include <scanner.h>
#include <utility.h> #include <utility.h>
#include <xvtility.h> #include <xvtility.h>
@ -383,8 +382,8 @@ bool TDongle::ssa_login(const char* mod)
_last_update = TDate(TODAY); _last_update = TDate(TODAY);
_year_assist = _last_update.year(); _year_assist = _last_update.year();
_module.reset(); // Disattiva tutti i moduli _module.reset(); // Disattiva tutti i moduli ...
_module.set(0L); // Attiva la base _module.set(long(BAAUT)); // ... tranne la base
const int err = xvt_dongle_sa_login(NULL); const int err = xvt_dongle_sa_login(NULL);
_serno = (err >= 0) ? err : 0xFFFF; _serno = (err >= 0) ? err : 0xFFFF;
@ -403,7 +402,7 @@ bool TDongle::ssa_login(const char* mod)
{ {
const TString& name = module_code2name(m); const TString& name = module_code2name(m);
if (xvt_dongle_sa_test(name) == 0) if (xvt_dongle_sa_test(name) == 0)
_module.set(m); _module.set(long(m));
} }
} }
else else

View File

@ -188,6 +188,7 @@
#define LF_LVCONDV 168 #define LF_LVCONDV 168
#define LF_LVRCONDV 169 #define LF_LVRCONDV 169
#define LF_CONTACT 170 #define LF_CONTACT 170
#define LF_IVADIFF 171
#define LF_EXTERNAL 1000 // Files with id >= are considered to be externals #define LF_EXTERNAL 1000 // Files with id >= are considered to be externals

View File

@ -25,7 +25,7 @@
#define GVAUT 21 #define GVAUT 21
#define CAAUT 22 #define CAAUT 22
#define VDAUT 23 #define VDAUT 23
#define AFAUT 24 #define ICAUT 24
#define PEAUT 25 #define PEAUT 25
#define EPAUT 26 #define EPAUT 26
#define TCAUT 27 #define TCAUT 27

View File

@ -47,6 +47,7 @@
#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_IVAXCASSA "IVAXCASSA"
#define MOV_MODPAG "MODPAG" #define MOV_MODPAG "MODPAG"
#define MOV_CONTRATTO "CONTRATTO" #define MOV_CONTRATTO "CONTRATTO"
#define MOV_DATARETT "DATARETT" #define MOV_DATARETT "DATARETT"

View File

@ -2534,6 +2534,8 @@ bool TSpreadsheet::notify(int rec, KEY k)
KEY TSpreadsheet::edit(int n) KEY TSpreadsheet::edit(int n)
{ {
str2mask(n); str2mask(n);
if (_needs_update == n) // Altrimenti grossi problemi chiamando edit() durante editing cella
_needs_update = -1;
KEY k = owner().run_editmask(n); KEY k = owner().run_editmask(n);
if (active()) if (active())
{ {

View File

@ -119,7 +119,7 @@ void TRecord_info::translate_key(TToken_string& t) const// Traduce l'espressione
int paren2,last,from = 0,to = 0; int paren2,last,from = 0,to = 0;
if (paren1 >= 0 && is_sub && is_upper) if (paren1 >= 0 && is_sub && is_upper)
paren1 = ws.find('('); // Trova la seconda parentesi (in questo caso c'e' per forza) paren1 = ws.find('(', paren1+1); // Trova la seconda parentesi (in questo caso c'e' per forza)
if (paren1 >= 0) // Trova la prima virgola o parentesi chiusa (per qualsiasi espressione) if (paren1 >= 0) // Trova la prima virgola o parentesi chiusa (per qualsiasi espressione)
{ {
@ -170,7 +170,7 @@ void TRecord_info::compute_len()
for (int f = _recdes.NFields-1; f >= 0; f--) for (int f = _recdes.NFields-1; f >= 0; f--)
_len += _recdes.Fd[f].Len; _len += _recdes.Fd[f].Len;
if (_len > 0) if (_len > 0)
_len++; _len++; // Deleted record flag
} }
TToken_string & TRecord_info::relation(int logicnum) TToken_string & TRecord_info::relation(int logicnum)

View File

@ -227,6 +227,11 @@ bool TIndwin::setstatus(long l)
_status = l > _max ? _max : l; _status = l > _max ? _max : l;
if (_can_cancel && !xvt_vobj_is_valid(win()))
{
_gauge = NULL_WIN;
on_key(K_ESC);
}
if (_gauge != NULL_WIN) if (_gauge != NULL_WIN)
xvt_sbar_set_pos(_gauge, HVGAUGE, _status); xvt_sbar_set_pos(_gauge, HVGAUGE, _status);

View File

@ -83,8 +83,9 @@ const TToken_string& TRecordset::sheet_head() const
case _boolfld: head << 'C'; break; case _boolfld: head << 'C'; break;
case _wordfld: case _wordfld:
case _intfld: case _intfld:
case _longfld: case _longfld: head << 'R'; break;
case _realfld: head << 'R'; break; case _datefld: head << 'D'; break;
case _realfld: head << 'V'; break;
default: break; default: break;
} }
} }
@ -136,6 +137,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;
case _datefld: out << "style=\"mso-number-format:\\Short Date\""; break;
default : out << "style=\"mso-number-format:\\@\""; break; // Stringa! default : out << "style=\"mso-number-format:\\@\""; break; // Stringa!
} }
out << " />" << endl; out << " />" << endl;

View File

@ -166,7 +166,9 @@ TSheet_control::TSheet_control(
if (wi.find('M') >= 0) if (wi.find('M') >= 0)
_type[i] = 'M'; else _type[i] = 'M'; else
if (wi.find('C') >= 0) if (wi.find('C') >= 0)
_type[i] = 'C'; _type[i] = 'C'; else
if (wi.find('D') >= 0)
_type[i] = 'D';
if (i == 0 && v <= 1) if (i == 0 && v <= 1)
{ {
@ -1390,6 +1392,7 @@ bool TSheet::export_handler(TMask_field& f, KEY k)
switch (ct) switch (ct)
{ {
case 'C': col.SetAttr("align", "center"); break; case 'C': col.SetAttr("align", "center"); break;
case 'D': col.SetAttr("style", "mso-number-format:\\Short Date"); break;
case 'P': case 'P':
case 'R': case 'R':
case 'V': col.SetAttr("align", "right"); break; case 'V': col.SetAttr("align", "right"); break;
@ -1426,8 +1429,22 @@ bool TSheet::export_handler(TMask_field& f, KEY k)
if (str.full()) if (str.full())
{ {
const char ct = s._sheet->column_type(idx); const char ct = s._sheet->column_type(idx);
if (ct == 'P' || ct == 'V') switch (ct)
{
case 'D':
if (str.len() == 8)
{
const TDate d(atol(str));
str = d.stringa();
}
break;
case 'P':
case 'V':
xvt_str_number_format(str.get_buffer(), str.size()); xvt_str_number_format(str.get_buffer(), str.size());
break;
default:
break;
}
xls << str; xls << str;
} }
xls << "</td>" << endl; xls << "</td>" << endl;
@ -1564,7 +1581,7 @@ TCursor_sheet::TCursor_sheet(TCursor* cursor, const char* fields,
const TFieldtypes tipo = rf->type(); const TFieldtypes tipo = rf->type();
if (tipo == _intfld || tipo == _longfld || tipo == _realfld) if (tipo == _intfld || tipo == _longfld || tipo == _realfld)
{ {
byte c = sheet().column_type(campo); const byte c = sheet().column_type(campo);
if (c == ' ') if (c == ' ')
sheet().align_column(campo, TRUE); sheet().align_column(campo, TRUE);
} }

View File

@ -429,7 +429,19 @@ int TSQL_recordset::on_get_items(int argc, char** values, char** columns)
{ {
const int len = strlen(values[i]); const int len = strlen(values[i]);
if (len > info._width) if (len > info._width)
{
info._width = len; info._width = len;
if (info._type == _alfafld)
{
if (len == 8 && atol(values[i]) > 19000000)
{
info._type = _datefld;
info._width = 10;
} else
if (real::is_real(values[i]))
info._type = _realfld;
}
}
} }
} }
} }

View File

@ -779,23 +779,25 @@ COLOR trans_color(
// @doc INTERNAL // @doc INTERNAL
// @func HIDDEN void | set_cursor | Cambia il cursore del mouse // @func HIDDEN void | set_cursor | Cambia il cursore del mouse
HIDDEN void set_cursor( HIDDEN void set_wait_cursor(
bool w) // @parm Indica il tipo di cursore da utilizzare: bool w) // @parm Indica il tipo di cursore da utilizzare:
// //
// @flag TRUE | Cursore a clessidra per le wait // @flag TRUE | Cursore a clessidra per le wait
// @flag FALSE | Cursore a frecca normale // @flag FALSE | Cursore a frecca normale
{ {
static int _count = 0; static int _count = 0;
static WINDOW _win = NULL_WIN; // static WINDOW _win = NULL_WIN;
if (w) if (w)
{ {
if (_count == 0) if (_count == 0)
{ {
_win = cur_win(); /* _win = cur_win();
if (_win == NULL_WIN) if (_win == NULL_WIN)
_win = TASK_WIN; _win = TASK_WIN;
xvt_win_set_cursor(_win, CURSOR_WAIT); xvt_win_set_cursor(_win, CURSOR_WAIT);
*/
xvt_win_set_cursor(TASK_WIN, CURSOR_WAIT);
} }
_count++; _count++;
} }
@ -805,20 +807,23 @@ HIDDEN void set_cursor(
CHECK(_count >= 0, "end_wait without matching begin_wait"); CHECK(_count >= 0, "end_wait without matching begin_wait");
if (_count == 0) if (_count == 0)
{ {
/*
WINDOW cur = cur_win(); WINDOW cur = cur_win();
if (cur == _win) if (cur == _win)
xvt_win_set_cursor(_win, CURSOR_ARROW); xvt_win_set_cursor(_win, CURSOR_ARROW);
else else
xvt_win_set_cursor(TASK_WIN, CURSOR_ARROW); xvt_win_set_cursor(TASK_WIN, CURSOR_ARROW);
*/
xvt_win_set_cursor(TASK_WIN, CURSOR_ARROW);
} }
} }
} }
void begin_wait() void begin_wait()
{ set_cursor(TRUE); } { set_wait_cursor(true); }
void end_wait() void end_wait()
{ set_cursor(FALSE); } { set_wait_cursor(false); }
// @doc INTERNAL // @doc INTERNAL