Patch level : 10.0 patch 439
Files correlati : lv0 Ricompilazione Demo : [ ] Commento : Quando viene chiamato da lv3, adesso propone il focus sulla riga con quel codart Corretti gli enable - disable del campo conguaglio sullo sheet git-svn-id: svn://10.65.10.50/trunk@19282 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
4ef19dcf20
commit
ff82650d34
109
lv/lv0400.cpp
109
lv/lv0400.cpp
@ -55,6 +55,7 @@ class TContratti_msk: public TAutomask
|
||||
{
|
||||
long _post_contr;
|
||||
TString80 _artrig;
|
||||
int _riga;
|
||||
|
||||
protected:
|
||||
bool on_art_select();
|
||||
@ -62,6 +63,8 @@ protected:
|
||||
virtual bool on_field_event(TOperable_field& o,TField_event e,long jolly);
|
||||
|
||||
public:
|
||||
int get_riga();
|
||||
bool set_riga(const int val);
|
||||
TContratti_msk();
|
||||
};
|
||||
|
||||
@ -129,8 +132,9 @@ bool TContratti_msk::on_art_select()
|
||||
//instanzio una cache sull'anagrafica di magazzino
|
||||
//per leggere il valore di PPCONF corretto e sempre aggiornato
|
||||
const TRectype& anamag = cache().get(LF_ANAMAG, codart);
|
||||
rowmask.set(S_PPCONF, anamag.get_int(ANAMAG_PPCONF));
|
||||
row.add(anamag.get(ANAMAG_PPCONF), ss.cid2index(S_PPCONF));
|
||||
int ppconf = anamag.get_int(ANAMAG_PPCONF);
|
||||
rowmask.set(S_PPCONF, ppconf);
|
||||
row.add(ppconf, ss.cid2index(S_PPCONF));
|
||||
|
||||
//ciclo i dati di interesse della riga selezionata nel dettaglio
|
||||
//sulla maschera principale
|
||||
@ -151,19 +155,19 @@ bool TContratti_msk::on_art_select()
|
||||
}
|
||||
}
|
||||
|
||||
if (field(F_PPCONF).empty())
|
||||
if (ppconf <= 0)
|
||||
{
|
||||
set(F_CALCCONS, "0");
|
||||
disable(F_CALCCONS);
|
||||
rowmask.field(S_CALCCONS).disable();
|
||||
rowmask.field(S_CONG).disable();
|
||||
rowmask.field(S_CALCCONS).disable();
|
||||
rowmask.field(S_CONG).disable();
|
||||
}
|
||||
else
|
||||
{
|
||||
enable(F_CALCCONS);
|
||||
rowmask.field(S_CALCCONS).enable();
|
||||
rowmask.field(S_CONG).enable();
|
||||
TToken_string row = ss.row(ss.selected());
|
||||
TToken_string row = ss.row(ss.selected());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -173,13 +177,22 @@ bool TContratti_msk::on_art_select()
|
||||
//nel posto desiderato
|
||||
void TContratti_msk::on_idle()
|
||||
{
|
||||
if (_post_contr > 0)
|
||||
{
|
||||
set(F_CODCONT, _post_contr);
|
||||
_post_contr = 0;
|
||||
efield(F_CODCONT).set_focus();
|
||||
}
|
||||
TAutomask::on_idle();
|
||||
|
||||
TSheet_field& s = sfield(F_RIGHE);
|
||||
if (_riga >= 0)
|
||||
{
|
||||
field(F_RIGHE).set_focus();
|
||||
s.set_focus_cell_id(_riga, S_CODART);
|
||||
_riga = -1;
|
||||
}
|
||||
else
|
||||
if (_post_contr > 0)
|
||||
{
|
||||
set(F_CODCONT, _post_contr);
|
||||
_post_contr = 0;
|
||||
efield(F_CODCONT).set_focus();
|
||||
}
|
||||
}
|
||||
|
||||
//ON_FIELD_EVENT: definizione del metodo che setta i comportamenti dei vari campi della mashera
|
||||
@ -230,13 +243,20 @@ bool TContratti_msk::on_field_event(TOperable_field& o,TField_event e,long jolly
|
||||
|
||||
//questo pezzo serve per gestire enable e disable dei campi in modo corretto
|
||||
//senza massage in maschera, sia sullo sheet che sul dettaglio
|
||||
TMask& rowmask = ss.sheet_mask();
|
||||
if (field(F_PPCONF).empty())
|
||||
{
|
||||
set(F_CALCCONS, "0");
|
||||
disable(F_CALCCONS);
|
||||
disable(F_CALCCONS);
|
||||
rowmask.field(S_CALCCONS).disable();
|
||||
rowmask.field(S_CONG).disable();
|
||||
}
|
||||
else
|
||||
{
|
||||
enable(F_CALCCONS);
|
||||
rowmask.field(S_CALCCONS).enable();
|
||||
rowmask.field(S_CONG).enable();
|
||||
}
|
||||
|
||||
_artrig=row.get(0); //salvo nella variabile globale il codart della riga selezionata
|
||||
}
|
||||
@ -348,6 +368,25 @@ bool TContratti_msk::on_field_event(TOperable_field& o,TField_event e,long jolly
|
||||
}
|
||||
}
|
||||
break;
|
||||
case F_CALCCONS:
|
||||
//questo pezzo gestisce in maniera corretta gli enable e disable del campo conguaglio sullo sheet
|
||||
if (e == fe_modify)
|
||||
{
|
||||
TSheet_field& ss = sfield(F_RIGHE);
|
||||
const int sel = ss.selected();
|
||||
if (sel >= 0)
|
||||
{
|
||||
TToken_string& riga = ss.row(sel);
|
||||
riga.add(o.get(), ss.cid2index(F_CALCCONS));
|
||||
if (field(F_PPCONF).empty())
|
||||
ss.disable_cell(sel, ss.cid2index(S_CONG));
|
||||
else
|
||||
if (atoi(o.get()) == 1)
|
||||
ss.enable_cell(sel, ss.cid2index(S_CONG));
|
||||
}
|
||||
ss.force_update(sel);
|
||||
}
|
||||
break;
|
||||
case S_CODART:
|
||||
if (!o.empty()) //se il campo risulta pieno
|
||||
{
|
||||
@ -517,10 +556,21 @@ bool TContratti_msk::on_field_event(TOperable_field& o,TField_event e,long jolly
|
||||
return true;
|
||||
}
|
||||
|
||||
int TContratti_msk::get_riga()
|
||||
{
|
||||
return _riga;
|
||||
}
|
||||
|
||||
bool TContratti_msk::set_riga(const int val)
|
||||
{
|
||||
_riga = val;
|
||||
return true;
|
||||
}
|
||||
|
||||
//Costruttore; nasconde o mostra il campo F_INDSPED a seconda di cosa è scritto in configurazione
|
||||
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();
|
||||
}
|
||||
|
||||
@ -533,6 +583,7 @@ class TContratti_app: public TRelation_application
|
||||
{
|
||||
TContratti_msk* _msk;
|
||||
TRelation* _rel;
|
||||
TString80 _codart;
|
||||
|
||||
private:
|
||||
void save_rows(const TMask& m);
|
||||
@ -684,13 +735,25 @@ int TContratti_app::find_art(TSheet_field& s, const TString& art) const
|
||||
//e che setta i comportamenti sulle righe aggiunte agli sheet
|
||||
bool TContratti_app:: user_create()
|
||||
{
|
||||
TDate datasc(TODAY);
|
||||
//se gli sono stati passati più parametri, allora setto la variabile globale _codart...
|
||||
//...con il parametro desiderato, se no lo setto a stringa vuota
|
||||
if (argc() > 2)
|
||||
{
|
||||
_codart = argv(3);
|
||||
_codart.ltrim(2);
|
||||
}
|
||||
else
|
||||
_codart = "";
|
||||
|
||||
TDate datasc(TODAY);
|
||||
if (esercizi().date2esc(datasc) == 0)
|
||||
return error_box("Attenzione non esiste l'esercizio corrispondente al %s", datasc.string());
|
||||
|
||||
_rel=new TRelation (LF_LVCONDV);
|
||||
_msk= new TContratti_msk;
|
||||
|
||||
_msk->set_riga(-1);
|
||||
|
||||
TSheet_field& ss = _msk->sfield(F_RIGHE);
|
||||
|
||||
ss.set_auto_append();
|
||||
@ -755,8 +818,10 @@ int TContratti_app::read(TMask& m)
|
||||
righe.destroy();
|
||||
|
||||
//per ogni riga dello sheet
|
||||
int pos = -1;
|
||||
for (bool ok = righeset.move_first(); ok; ok = righeset.move_next())
|
||||
{
|
||||
++pos;
|
||||
TToken_string& row = righe.row(-1);
|
||||
//per ogni campo della maschera scrivi setta all'interno del record corrente di file
|
||||
//il valore di quei campi che hanno un field
|
||||
@ -768,6 +833,12 @@ int TContratti_app::read(TMask& m)
|
||||
}
|
||||
|
||||
const TString80 codart(row.get(righe.cid2index(S_CODART)));
|
||||
|
||||
if (codart == _codart)
|
||||
{
|
||||
_msk->set_riga(pos);
|
||||
_codart = "";
|
||||
}
|
||||
|
||||
//estraggo il record corrispondente su LF_CLIFOGIAC
|
||||
TArticolo_lavanderie& artrec = cached_article_laundry(codart, 'C', clifo, indsp);
|
||||
@ -792,8 +863,6 @@ int TContratti_app::read(TMask& m)
|
||||
//forzo una check_row
|
||||
righe.check_row(righe.items()-1, 3);
|
||||
}
|
||||
//forzo l'update dello sheet
|
||||
//righe.force_update();
|
||||
}
|
||||
return err;
|
||||
}
|
||||
@ -891,9 +960,9 @@ void TContratti_app::init_modify_mode(TMask& m)
|
||||
{
|
||||
//setto alcune variabili di interesse
|
||||
const TDate oggi(TODAY);
|
||||
const int year=oggi.year();
|
||||
const long clifo=m.get_long(F_CODCF);
|
||||
const int indsp=m.get_int(F_INDSPED);
|
||||
const int year = oggi.year();
|
||||
const long clifo = m.get_long(F_CODCF);
|
||||
const int indsp = m.get_int(F_INDSPED);
|
||||
|
||||
//instanzio un TLocaisamfile su LF_CLIFOGIAC
|
||||
TLocalisamfile magcli(LF_CLIFOGIAC);
|
||||
|
Loading…
x
Reference in New Issue
Block a user