Patch level : 10.0 patch ???
Files correlati : lv0400 Ricompilazione Demo : [ ] Commento : Aggiunta la colorazione delle righe per gli articoli bloccati e per gli articoli scaduti git-svn-id: svn://10.65.10.50/branches/R_10_00@21480 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
6a0c18b1d4
commit
fb7b0a2e3d
167
lv/lv0400.cpp
167
lv/lv0400.cpp
@ -1,8 +1,10 @@
|
|||||||
#include <automask.h>
|
#include <automask.h>
|
||||||
|
#include <colmask.h>
|
||||||
#include <defmask.h>
|
#include <defmask.h>
|
||||||
#include <execp.h>
|
#include <execp.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <relapp.h>
|
#include <relapp.h>
|
||||||
|
#include <urldefid.h>
|
||||||
|
|
||||||
#include "../cg/cglib01.h"
|
#include "../cg/cglib01.h"
|
||||||
|
|
||||||
@ -48,6 +50,30 @@ long lv_new_contract(long cliente, int indsped)
|
|||||||
return codcont;
|
return codcont;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class TColor_rule_contract : public TExpression
|
||||||
|
{
|
||||||
|
COLOR _back, _fore, _def_back, _def_fore;
|
||||||
|
TString _desc, _key;
|
||||||
|
|
||||||
|
public:
|
||||||
|
const TString& description() const { return _desc; }
|
||||||
|
const TString& key() const { return _key; }
|
||||||
|
void default_colors(COLOR& back, COLOR& fore) const { back = _def_back; fore = _def_fore; }
|
||||||
|
void colors(COLOR& back, COLOR& fore) const { back = _back; fore = _fore; }
|
||||||
|
void set_colors(COLOR back, COLOR fore) { _back = back; _fore = fore; }
|
||||||
|
|
||||||
|
TColor_rule_contract(const char* desc, const char* expr, TTypeexp type, COLOR back, COLOR fore);
|
||||||
|
};
|
||||||
|
|
||||||
|
TColor_rule_contract::TColor_rule_contract(const char* desc, const char* expr, TTypeexp type, COLOR back, COLOR fore)
|
||||||
|
: TExpression(expr, type), _back(back), _fore(fore), _def_back(back), _def_fore(fore)
|
||||||
|
{
|
||||||
|
_desc = dictionary_translate(desc);
|
||||||
|
_key = desc; _key.trim(); _key.strip_double_spaces();
|
||||||
|
_key.replace(' ', '_');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
//// TCONTRATTI_MSK ////
|
//// TCONTRATTI_MSK ////
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
@ -58,6 +84,7 @@ class TContratti_msk: public TAutomask
|
|||||||
long _post_contr;
|
long _post_contr;
|
||||||
TString80 _artrig;
|
TString80 _artrig;
|
||||||
int _riga;
|
int _riga;
|
||||||
|
TArray _color_rules;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void azzera_conguaglio();
|
void azzera_conguaglio();
|
||||||
@ -65,9 +92,15 @@ protected:
|
|||||||
virtual void on_idle();
|
virtual void on_idle();
|
||||||
virtual bool on_field_event(TOperable_field& o,TField_event e,long jolly);
|
virtual bool on_field_event(TOperable_field& o,TField_event e,long jolly);
|
||||||
|
|
||||||
|
TArray& color_rules() { return _color_rules; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int get_riga();
|
int get_riga();
|
||||||
bool set_riga(const int val);
|
bool set_riga(const int val);
|
||||||
|
|
||||||
|
void sel_color();
|
||||||
|
void highlight();
|
||||||
|
void highlight_row(int row = -1, COLOR back = COLOR_INVALID, COLOR fore = COLOR_INVALID, bool dirty = true, bool update = true);
|
||||||
TContratti_msk();
|
TContratti_msk();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -84,6 +117,97 @@ void TContratti_msk::azzera_conguaglio()
|
|||||||
sheet.force_update();
|
sheet.force_update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TContratti_msk::highlight_row(int row, COLOR back, COLOR fore, bool dirty, bool update)
|
||||||
|
{
|
||||||
|
TSheet_field& sf = sfield(F_RIGHE);
|
||||||
|
|
||||||
|
if (row < 0)
|
||||||
|
row = sf.selected();
|
||||||
|
|
||||||
|
FOR_EACH_ARRAY_ITEM_BACK(color_rules(), rule, o)
|
||||||
|
{
|
||||||
|
TColor_rule& expr = *(TColor_rule*)o;
|
||||||
|
bool on = false;
|
||||||
|
|
||||||
|
// SET VARS
|
||||||
|
|
||||||
|
const int vars = expr.numvar();
|
||||||
|
TString name;
|
||||||
|
for (int i = 0; i < vars; i++)
|
||||||
|
{
|
||||||
|
name = expr.varname(i);
|
||||||
|
if (name.starts_with("DIRTY"))
|
||||||
|
expr.setvar(i, dirty ? UNO : ZERO);
|
||||||
|
else
|
||||||
|
if (name.starts_with("TODAY"))
|
||||||
|
expr.setvar(i, TDate(TODAY).string());
|
||||||
|
else
|
||||||
|
if (name.starts_with("#"))
|
||||||
|
{
|
||||||
|
const short id = atoi(name.mid(1));
|
||||||
|
if (id > 0)
|
||||||
|
{
|
||||||
|
TToken_string& sheet_row = sf.row(row);
|
||||||
|
expr.setvar(i, sheet_row.get(sf.cid2index(id)));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
expr.setvar(i, get(-id));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (name.starts_with("48.") || name.starts_with("ANAMAG."))
|
||||||
|
{
|
||||||
|
TToken_string & row = sf.row(sf.selected());
|
||||||
|
const TRectype & art = cache().get(LF_ANAMAG, row.get(sf.cid2index(S_CODART)));
|
||||||
|
const TString& fldname = name.after('.');
|
||||||
|
|
||||||
|
expr.setvar(i, art.get(fldname));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (expr.as_bool())
|
||||||
|
{
|
||||||
|
expr.colors(back, fore);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sf.set_back_and_fore_color(back, fore, row);
|
||||||
|
if (update)
|
||||||
|
sf.force_update(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TContratti_msk::highlight()
|
||||||
|
{
|
||||||
|
TSheet_field& sf = sfield(F_RIGHE);
|
||||||
|
FOR_EACH_SHEET_ROW(sf, i, r)
|
||||||
|
highlight_row(i, COLOR_INVALID, COLOR_INVALID, false, false);
|
||||||
|
sf.force_update();
|
||||||
|
}
|
||||||
|
void TContratti_msk::sel_color()
|
||||||
|
{
|
||||||
|
TFilename mask(source_file());
|
||||||
|
|
||||||
|
TSelect_color_mask sel(mask.name_only(), "0");
|
||||||
|
|
||||||
|
FOR_EACH_ARRAY_ITEM(color_rules(), i, o)
|
||||||
|
{
|
||||||
|
const TColor_rule& col = *(const TColor_rule*)o;
|
||||||
|
COLOR a, b; col.colors(a, b);
|
||||||
|
COLOR c, d; col.default_colors(c, d);
|
||||||
|
sel.add_color(col.key(), col.description(), a, b, c, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sel.run() != K_ESC)
|
||||||
|
{
|
||||||
|
FOR_EACH_ARRAY_ITEM(color_rules(), i, o)
|
||||||
|
{
|
||||||
|
TColor_rule& col = *(TColor_rule*)o;
|
||||||
|
COLOR back, fore; sel.get_color(col.key(), back, fore);
|
||||||
|
col.set_colors(back, fore);
|
||||||
|
}
|
||||||
|
highlight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//ON_ART_SELECT: metodo che riempie i campi delle dotazioni e del consegnato sullo sheet e sulla maschera
|
//ON_ART_SELECT: metodo che riempie i campi delle dotazioni e del consegnato sullo sheet e sulla maschera
|
||||||
//e riporta i dati dello sheet nel dettaglio sulla maschera (sotto lo sheet)
|
//e riporta i dati dello sheet nel dettaglio sulla maschera (sotto lo sheet)
|
||||||
bool TContratti_msk::on_art_select(TField_event e)
|
bool TContratti_msk::on_art_select(TField_event e)
|
||||||
@ -270,6 +394,8 @@ bool TContratti_msk::on_field_event(TOperable_field& o,TField_event e,long jolly
|
|||||||
f.set_dirty(false);
|
f.set_dirty(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (e == se_enter || e == se_notify_modify || e == se_query_add || e == se_notify_add)
|
||||||
|
highlight_row();
|
||||||
|
|
||||||
//questo pezzo serve per gestire enable e disable dei campi in modo corretto
|
//questo pezzo serve per gestire enable e disable dei campi in modo corretto
|
||||||
//senza massage in maschera, sia sullo sheet che sul dettaglio
|
//senza massage in maschera, sia sullo sheet che sul dettaglio
|
||||||
@ -751,6 +877,29 @@ TContratti_msk::TContratti_msk():TAutomask("lv0400a"), _post_contr(0)
|
|||||||
{
|
{
|
||||||
if (!ini_get_bool(CONFIG_DITTA, "lv", "Useindsp"))
|
if (!ini_get_bool(CONFIG_DITTA, "lv", "Useindsp"))
|
||||||
field(F_INDSPED).hide();
|
field(F_INDSPED).hide();
|
||||||
|
TFilename ininame(source_file());
|
||||||
|
|
||||||
|
ininame.ext("ini");
|
||||||
|
|
||||||
|
TConfig prof(ininame.name(), "Colors");
|
||||||
|
COLOR back;
|
||||||
|
COLOR fore;
|
||||||
|
|
||||||
|
prof.write_protect(true);
|
||||||
|
for (int i = 0; ; i++)
|
||||||
|
{
|
||||||
|
const TString& name = prof.get("RuleName", NULL, i);
|
||||||
|
if (name.full())
|
||||||
|
{
|
||||||
|
const TString& expr = prof.get("Rule", NULL, i);
|
||||||
|
const TTypeexp type = prof.get_char("RuleType", NULL, i, 'N') == 'S' ? _strexpr : _numexpr ;
|
||||||
|
back = prof.get_color("BgCol", NULL, i, NORMAL_BACK_COLOR);
|
||||||
|
fore = prof.get_color("FgCol", NULL, i, NORMAL_COLOR);
|
||||||
|
color_rules().add(new TColor_rule(name, expr, type, back, fore));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
@ -787,6 +936,7 @@ protected:
|
|||||||
virtual void init_modify_mode(TMask& m);
|
virtual void init_modify_mode(TMask& m);
|
||||||
bool elimina_planning(const long& codcont, const long& codcf) const;
|
bool elimina_planning(const long& codcont, const long& codcf) const;
|
||||||
bool kill_planning (TISAM_recordset& selrighe) const;
|
bool kill_planning (TISAM_recordset& selrighe) const;
|
||||||
|
bool menu(MENU_TAG mt);
|
||||||
};
|
};
|
||||||
|
|
||||||
//SAVE_ROWS: questo metodo salva effettivamente le righe vislualizzate sullo sheet sul file
|
//SAVE_ROWS: questo metodo salva effettivamente le righe vislualizzate sullo sheet sul file
|
||||||
@ -1034,7 +1184,7 @@ int TContratti_app::read(TMask& m)
|
|||||||
|
|
||||||
//se non gli ho passato nessun codart, allora dico che voglio dare il focus alla prima riga dello sheet
|
//se non gli ho passato nessun codart, allora dico che voglio dare il focus alla prima riga dello sheet
|
||||||
//aktrimenti dico che volgio dare il focus alla riga dello sheet che contiene l'articolo che gli ho passato
|
//aktrimenti dico che volgio dare il focus alla riga dello sheet che contiene l'articolo che gli ho passato
|
||||||
if (_codart.empty())
|
if (_codart.blank())
|
||||||
_msk->set_riga(0);
|
_msk->set_riga(0);
|
||||||
else
|
else
|
||||||
if (codart == _codart)
|
if (codart == _codart)
|
||||||
@ -1199,6 +1349,7 @@ void TContratti_app::init_modify_mode(TMask& m)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
((TContratti_msk &)m).highlight();
|
||||||
}
|
}
|
||||||
|
|
||||||
//INIT_INSERT_MODE: ridefinizione del metodo init_insert_mode() standard
|
//INIT_INSERT_MODE: ridefinizione del metodo init_insert_mode() standard
|
||||||
@ -1249,6 +1400,20 @@ bool TContratti_app::kill_planning (TISAM_recordset& selrighe) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TContratti_app::menu(MENU_TAG mt)
|
||||||
|
{
|
||||||
|
bool ok = true;
|
||||||
|
if (mt == MENU_ITEM_ID(1))
|
||||||
|
{
|
||||||
|
if (_msk != NULL)
|
||||||
|
_msk->sel_color();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ok = TRelation_application::menu(mt);
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int lv0400(int argc, char* argv[])
|
int lv0400(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
TContratti_app app;
|
TContratti_app app;
|
||||||
|
9
lv/lv0400a.ini
Executable file
9
lv/lv0400a.ini
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
[Colors]
|
||||||
|
RuleName(0) = Dotazione scaduta
|
||||||
|
Rule(0) = (#115!="")&&(ANSI(#115)<ANSI(TODAY))
|
||||||
|
BgCol(0) = 255,0,0
|
||||||
|
FgCol(0) = 0,0,0
|
||||||
|
RuleName(1) = Articolo bloccato
|
||||||
|
Rule(1) = #120!=""
|
||||||
|
BgCol(1) = 255,128,0
|
||||||
|
FgCol(1) = 0,0,0
|
Loading…
x
Reference in New Issue
Block a user