Patch level : 10.0 332

Files correlati     : pe0.exe
Ricompilazione Demo : [ ]
Commento

Preventivazione gestione k


git-svn-id: svn://10.65.10.50/trunk@19041 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2009-06-16 15:56:21 +00:00
parent 5ca55b153e
commit c86cef853f

View File

@ -45,6 +45,7 @@ protected:
static bool pe_qta_handler(TMask_field& f, KEY k);
static bool pe_k_handler(TMask_field& f, KEY k);
static bool pe_prezzo_handler(TMask_field& f, KEY k);
static bool pe_costo_handler(TMask_field& f, KEY k);
static bool ss_notify(TSheet_field& ss, int r, KEY key);
@ -227,7 +228,6 @@ bool TGestione_preventivo_msk::ss_notify(TSheet_field& ss, int r, KEY key)
short id;
sh.enable_cell(r, sh.cid2index(FR_PREZZO), price_enabled);
// sh.enable_cell(r, sh.cid2index(FR_JOLLY2), price_enabled && mask.get_bool(F_USEK));
sh.enable_cell(r, sh.cid2index(FR_JOLLY3), price_enabled);
for (id = FR_CDC1; id < FR_CDC12; id++)
sh.enable_cell(r, sh.cid2index(id), prodfin);
@ -265,7 +265,6 @@ bool TGestione_preventivo_msk::ss_notify(TSheet_field& ss, int r, KEY key)
if (level > father_row.get_int(RDOC_LEVEL))
{
sh.disable_cell(father_sheet_row, sh.cid2index(FR_PREZZO));
// sh.disable_cell(father_sheet_row, sh.cid2index(FR_JOLLY2) || !mask.get_bool(F_USEK));
sh.disable_cell(father_sheet_row, sh.cid2index(FR_JOLLY3));
father_row.zero(RDOC_COSTO);
father_row.zero(RDOC_PREZZO);
@ -357,6 +356,7 @@ TVariable_mask * TGestione_preventivo_msk::riga_mask(int numriga)
m->set_handler(FR_QTA, pe_qta_handler);
m->set_handler(FR_PREZZO, pe_prezzo_handler);
m->set_handler(FR_JOLLY2, pe_k_handler);
m->set_handler(FR_JOLLY3, pe_costo_handler);
tree.set_field(RDOC_TREE);
k.set_field(RDOC_K);
v.set_field(RDOC_COSTO);
@ -383,7 +383,6 @@ void TGestione_preventivo_msk::doc2mask(bool reload_clifo, bool force_load, bool
const bool price_enabled = (i + 1 == d.physical_rows()) || (level >= d[i + 2].get_int(RDOC_LEVEL));
s.enable_cell(i, s.cid2index(FR_PREZZO), price_enabled);
// s.enable_cell(i, s.cid2index(FR_JOLLY2), price_enabled && has_k);
s.enable_cell(i, s.cid2index(FR_JOLLY3), price_enabled);
for (short id = FR_CDC1; id < FR_CDC12; id++)
s.enable_cell(i, s.cid2index(id), prodfin);
@ -842,21 +841,47 @@ bool TGestione_preventivo_msk::pe_prezzo_handler(TMask_field& f, KEY k)
TMask& row_mask = f.mask();
const bool last_level = row_mask.field(FR_JOLLY3).enabled();
if (last_level && k == K_F8)
if (last_level)
{
TSheet_field * sh = row_mask.get_sheet();
if (sh != NULL)
if (k == K_F8)
{
TGestione_preventivo_msk & mask = (TGestione_preventivo_msk &) sh->mask();
TDocumento & doc = mask.doc();
const int row = sh->selected();
TCond_vendita & condv = mask.condv();
TSheet_field * sh = row_mask.get_sheet();
condv.set_testa(&mask);
condv.set_riga(&row_mask);
condv.ricerca();
doc[row].put(RDOC_PREZZO, row_mask.get(FR_PREZZO));
if (sh != NULL)
{
TGestione_preventivo_msk & mask = (TGestione_preventivo_msk &) sh->mask();
TDocumento & doc = mask.doc();
const int row = sh->selected();
TCond_vendita & condv = mask.condv();
condv.set_testa(&mask);
condv.set_riga(&row_mask);
condv.ricerca();
doc[row + 1].put(RDOC_PREZZO, row_mask.get(FR_PREZZO));
row_mask.reset(FR_JOLLY2);
row_mask.field(FR_JOLLY2).set_focusdirty(false);
}
}
if (k == K_TAB && f.focusdirty())
{
row_mask.reset(FR_JOLLY2);
row_mask.field(FR_JOLLY2).set_focusdirty(false);
}
}
return true;
}
bool TGestione_preventivo_msk::pe_costo_handler(TMask_field& f, KEY k)
{
TMask& row_mask = f.mask();
const bool last_level = row_mask.field(FR_JOLLY3).enabled();
if (last_level)
{
if (k == K_TAB && f.focusdirty())
{
row_mask.reset(FR_JOLLY2);
row_mask.field(FR_JOLLY2).set_focusdirty(false);
}
}
return true;
@ -964,9 +989,6 @@ int TGestione_preventivo_app::write( const TMask& m )
TDocumento& doc = mask.doc();
const int rows = doc.physical_rows();
const TString k = doc.get(DOC_K);
int max_level = 0;
TArray valori;
TArray costi;
for (int i = rows ; i > 0; i--)
{
@ -985,11 +1007,8 @@ int TGestione_preventivo_app::rewrite( const TMask& m )
{
TGestione_preventivo_msk & mask = (TGestione_preventivo_msk &) m;
TDocumento& doc = ((TDocumento_mask&) m).doc();
const TString k = doc.get(DOC_K);
int max_level = 0;
const int rows = doc.physical_rows();
TArray valori;
TArray costi;
const TString k = doc.get(DOC_K);
for (int i = rows ; i > 0; i--)
{
@ -1013,10 +1032,15 @@ int TGestione_preventivo_app::read(TMask& m)
TDocumento_mask& mask = (TDocumento_mask&) m;
TDocumento& doc = mask.doc();
const TString k = doc.get(DOC_K);
TSheet_field & sh = mask.sfield(F_SHEET);
for (int i = 1 ; i <= doc.physical_rows(); i++)
if (k == doc[i].get(RDOC_K))
{
doc[i].zero(RDOC_K);
TToken_string & r = sh.row(i - 1);
r.add("", sh.cid2index(FR_JOLLY2));
}
}
return err;
}