Patch level : 12.0 nopatch
Files correlati : Commento: Modificata get_mask in _get_mask
This commit is contained in:
parent
289079d833
commit
6a161e705f
@ -230,7 +230,7 @@ protected:
|
||||
virtual bool user_destroy();
|
||||
virtual TRelation* get_relation() const { return _therel; }
|
||||
virtual bool changing_mask(int mode);
|
||||
virtual TMask* get_mask(int mode);
|
||||
virtual TMask* _get_mask(int mode);
|
||||
virtual void init_query_mode(TMask& m);
|
||||
virtual int read(TMask& m);
|
||||
virtual int write(const TMask& m);
|
||||
@ -972,7 +972,7 @@ private:
|
||||
|
||||
protected:
|
||||
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
|
||||
bool test_row(const TToken_string& row);
|
||||
bool test_row(int nrow);
|
||||
void load_um();
|
||||
|
||||
static void sheetrighe_get(TSheet_field &fld_righe, int item);
|
||||
@ -1071,12 +1071,13 @@ void TDistinta_mask::load_um()
|
||||
}
|
||||
|
||||
|
||||
bool TDistinta_mask::test_row(const TToken_string& row)
|
||||
bool TDistinta_mask::test_row(int nrow)
|
||||
{
|
||||
TSheet_field& sheet = sfield(F_SHEET);
|
||||
const TCodice_articolo father = get(F_CODICE);
|
||||
|
||||
TCodice_articolo code; row.get(1, code);
|
||||
TCodice_articolo code = sheet.get_str_row_cell(nrow, F_CODART);
|
||||
bool ok = code != father;
|
||||
|
||||
if (ok && _tree.find_node(father) > 0)
|
||||
{
|
||||
TToken_string path; _tree.curr_id(path);
|
||||
@ -1088,12 +1089,9 @@ bool TDistinta_mask::test_row(const TToken_string& row)
|
||||
"in quanto la distinta risulterebbe ciclica."), (const char*)code);
|
||||
|
||||
// Se e' una lavorazione
|
||||
if (get(F_TIPO)[0] == 'L')
|
||||
{
|
||||
ok = row[0] == 'L' && _tree.is_lav(code);
|
||||
if (!ok)
|
||||
error_box(FR("Il codice '%s' non e' una lavorazione"), (const char*)code);
|
||||
}
|
||||
if ((get(F_TIPO) == "L") &&
|
||||
!(sheet.get_str_row_cell(nrow, F_TIPOCOMP) == "L" && _tree.is_lav(code)))
|
||||
return error_box(FR("Il codice '%s' non e' una lavorazione"), (const char*)code);
|
||||
return ok;
|
||||
}
|
||||
|
||||
@ -1170,41 +1168,47 @@ bool TDistinta_mask::on_unitsheet_event(TOperable_field& o, TField_event e, long
|
||||
bool TDistinta_mask::on_distsheet_event(TOperable_field& o, TField_event e, long jolly)
|
||||
{
|
||||
const short id = o.dlg();
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case F_SHEET:
|
||||
if (e == se_notify_add || e == se_notify_modify || e == fe_close)
|
||||
if (e == se_notify_add || e == se_notify_modify || e == fe_close)
|
||||
{
|
||||
TSheet_field& sheet = (TSheet_field&)o;
|
||||
const int nrig = int(jolly);
|
||||
TToken_string& row = sheet.row(nrig);
|
||||
|
||||
|
||||
switch(e)
|
||||
{
|
||||
case se_notify_add:
|
||||
row.add("A", F_TIPOCOMP-FIRST_FIELD); // Forza il listbox ad articolo
|
||||
row.add("", F_EXPR-FIRST_FIELD); // Forza la quantita' ad 1
|
||||
row.add(nrig+1, F_SORT0-FIRST_FIELD); // Inizializza numero riga
|
||||
sheet.select(nrig);
|
||||
{
|
||||
TSheet_field& sheet = (TSheet_field&)o;
|
||||
const int nrig = int(jolly);
|
||||
|
||||
sheet.set_row_cell(F_TIPOCOMP, "A", nrig); // Forza il listbox ad articolo
|
||||
sheet.set_row_cell(F_EXPR, 1, nrig); // Forza la quantita' ad 1
|
||||
sheet.set_row_cell(F_SORT0, nrig + 1, nrig); // Inizializza numero riga
|
||||
sheet.select(nrig);
|
||||
sheet.force_update(nrig);
|
||||
}
|
||||
break;
|
||||
case se_notify_modify:
|
||||
return test_row(row);
|
||||
return test_row(int(jolly));
|
||||
break;
|
||||
case fe_close:
|
||||
{
|
||||
TSheet_field& sheet = (TSheet_field&)o;
|
||||
const int nrig = int(jolly);
|
||||
TString80 code;
|
||||
TString80 code1;
|
||||
|
||||
for (int n = sheet.items()-1; n >= 0; n--)
|
||||
{
|
||||
const TToken_string& row = sheet.row(n);
|
||||
row.get(F_CODART-FIRST_FIELD, code);
|
||||
if (!code.blank())
|
||||
code = sheet.get_str_row_cell(n, F_CODART);
|
||||
if (code.full())
|
||||
{
|
||||
if (!test_row(row))
|
||||
if (!test_row(nrig))
|
||||
return false;
|
||||
for (int m = n - 1; m >= 0; m--)
|
||||
{
|
||||
const TToken_string& row = sheet.row(m);
|
||||
row.get(F_CODART-FIRST_FIELD, code1);
|
||||
if (code == code1)
|
||||
if (code == sheet.get_str_row_cell(m, F_CODART))
|
||||
{
|
||||
int k = noyesall_box("Il codice %s e' ripetuto alla riga %d,\ncontinuare ugualmente ?", (const char *) code, n + 1);
|
||||
if (k == K_NO)
|
||||
@ -1219,7 +1223,7 @@ bool TDistinta_mask::on_distsheet_event(TOperable_field& o, TField_event e, long
|
||||
sheet.destroy(n);
|
||||
}
|
||||
}
|
||||
if (sheet.items() == 0)
|
||||
if (((TSheet_field&)o).items() == 0)
|
||||
message_box(TR("E' necessario inserire almeno una riga nella distinta"));
|
||||
break;
|
||||
default:
|
||||
@ -1740,7 +1744,7 @@ bool TDistinta_app::changing_mask(int mode)
|
||||
return was_query != is_query;
|
||||
}
|
||||
|
||||
TMask* TDistinta_app::get_mask(int mode)
|
||||
TMask* TDistinta_app::_get_mask(int mode)
|
||||
{
|
||||
const bool is_query = mode == MODE_QUERY || mode == MODE_QUERYINS;
|
||||
_mode = mode;
|
||||
|
Loading…
x
Reference in New Issue
Block a user