Patch level : 10.0 290

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

Aggiunta colonna prezzo di vendita


git-svn-id: svn://10.65.10.50/trunk@18817 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2009-05-05 15:27:01 +00:00
parent 50b67c3ab3
commit b20fa21420

View File

@ -40,6 +40,7 @@ protected:
static bool pe_ritirato_handler(TMask_field& f, KEY k);
static bool pe_codart_handler(TMask_field& f, KEY k);
static bool pe_qta_handler(TMask_field& f, KEY k);
static bool pe_k_handler(TMask_field& f, KEY k);
static bool ss_notify(TSheet_field& ss, int r, KEY key);
@ -56,6 +57,9 @@ public:
virtual void user_set_handler( short fieldid, int index);
virtual void user_set_row_handler(TMask& rm, short field, int index);
void update_prezzo_vendita(TMask & row_mask);
virtual TVariable_mask * riga_mask(int numriga);
virtual void doc2mask(bool reload_clifo = true, bool force_load = false, bool update = true);
@ -136,6 +140,7 @@ bool TGestione_preventivo_msk::ss_notify(TSheet_field& ss, int r, KEY key)
row_mask.enable(FR_PREZZO, price_enabled);
row_mask.enable(FR_JOLLY2, price_enabled);
row_mask.enable(FR_JOLLY3, price_enabled);
for (id = FR_CDC1; id < FR_CDC12; id++)
row_mask.enable(id, prodfin);
for (id = FR_DESCDC1; id < FR_DESCDC12; id++)
@ -168,14 +173,18 @@ bool TGestione_preventivo_msk::ss_notify(TSheet_field& ss, int r, KEY key)
row.put(RDOC_CODCMS, father_row.get(RDOC_CODCMS));
row.put(RDOC_FASCMS, father_row.get(RDOC_FASCMS));
if (next_level > level)
{
sh.disable_cell(father_sheet_row, sh.cid2index(FR_PREZZO));
sh.disable_cell(father_sheet_row, sh.cid2index(FR_JOLLY2));
sh.disable_cell(father_sheet_row, sh.cid2index(FR_JOLLY3));
father_row.zero(RDOC_PREZZO);
father_row.zero(RDOC_K);
father_row.autoload(sh);
sh.force_update(father_sheet_row);
}
short id;
sh.disable_cell(father_sheet_row, sh.cid2index(FR_PREZZO));
sh.disable_cell(father_sheet_row, sh.cid2index(FR_JOLLY2));
father_row.zero(RDOC_PREZZO);
father_row.zero(RDOC_K);
father_row.autoload(sh);
sh.force_update(father_sheet_row);
for (id = FR_CDC1; id < FR_CDC12; id++)
sh.disable_cell(r, sh.cid2index(id));
}
@ -247,11 +256,15 @@ TVariable_mask * TGestione_preventivo_msk::riga_mask(int numriga)
const TRiga_documento& riga = doc()[numriga + 1];
TEdit_field & tree = m->add_string(FR_JOLLY1, 0, "Albero ", 2, 20, 10, "D_");
TEdit_field & k = m->add_string(FR_JOLLY2, 0, "K ", 25, 20, 25);
TEdit_field & v = m->add_currency(FR_JOLLY3, 0, "Vendita ", 50, 20, 15, "U");
m->set_handler(FR_CODART, pe_codart_handler);
m->set_handler(FR_QTA, pe_qta_handler);
m->set_handler(FR_PREZZO, pe_k_handler);
m->set_handler(FR_JOLLY2, pe_k_handler);
tree.set_field(RDOC_TREE);
k.set_field(RDOC_K);
v.set_field(RDOC_PREZZOV);
}
return m;
@ -275,6 +288,7 @@ void TGestione_preventivo_msk::doc2mask(bool reload_clifo, bool force_load, bool
s.enable_cell(i, s.cid2index(FR_PREZZO), price_enabled);
s.enable_cell(i, s.cid2index(FR_JOLLY2), price_enabled);
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);
}
@ -437,7 +451,7 @@ bool TGestione_preventivo_msk::pe_codart_handler(TMask_field& f, KEY k)
if (ok && sh != NULL && k == K_TAB && f.focusdirty())
{
TDocumento_mask & mask = (TDocumento_mask &) sh->mask();
TGestione_preventivo_msk & mask = (TGestione_preventivo_msk &) sh->mask();
TDocumento & doc = mask.doc();
bool update = false;
const int r = sh->selected();
@ -465,6 +479,9 @@ bool TGestione_preventivo_msk::pe_codart_handler(TMask_field& f, KEY k)
}
if (!row_mask.field(FR_PREZZO).active())
row_mask.set(FR_PREZZO, "");
else
if (row_mask.field(FR_JOLLY3).active())
mask.update_prezzo_vendita(row_mask);
}
if (k == K_F8)
{
@ -486,6 +503,7 @@ bool TGestione_preventivo_msk::pe_codart_handler(TMask_field& f, KEY k)
sh->enable_cell(i - 1, sh->cid2index(FR_PREZZO), price_enabled);
sh->enable_cell(i - 1, sh->cid2index(FR_JOLLY2), price_enabled);
sh->enable_cell(i - 1, sh->cid2index(FR_JOLLY3), price_enabled);
for (id = FR_CDC1; id < FR_CDC12; id++)
sh->enable_cell(i - 1, id, prodfin);
for (id = FR_DESCDC1; id < FR_DESCDC12; id++)
@ -576,6 +594,39 @@ bool TGestione_preventivo_msk::pe_qta_handler(TMask_field& f, KEY k)
}
return ok;
}
void TGestione_preventivo_msk::update_prezzo_vendita(TMask & row_mask)
{
real prezzo = row_mask.get_real(FR_PREZZO);
TString k(row_mask.get(FR_JOLLY2));
TString ge;
real perc;
TSheet_field * sh = row_mask.get_sheet();
const int r = sh->selected();
if (k.blank())
k = get(F_K);
if (scontoexpr2perc(k, false, ge, perc))
prezzo *= (2 - perc);
TCurrency_documento c(prezzo, doc(), true);
row_mask.set(FR_JOLLY3, c.get_num().string());
}
bool TGestione_preventivo_msk::pe_k_handler(TMask_field& f, KEY k)
{
TMask& row_mask = f.mask();
TSheet_field * sh = row_mask.get_sheet();
if (row_mask.field(FR_JOLLY3).active() && sh != NULL && k == K_TAB && f.focusdirty())
{
TGestione_preventivo_msk & mask = (TGestione_preventivo_msk &) sh->mask();
mask.update_prezzo_vendita(row_mask);
}
return TRUE;
}
//metodo che setta gli handler sui campi di riga
void TGestione_preventivo_msk::user_set_row_handler(TMask& rm, short field, int index)
{