Patch level : 10.0 316

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

Preventivazione  (CRPA)


git-svn-id: svn://10.65.10.50/trunk@18888 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2009-05-20 11:33:33 +00:00
parent c443f2f214
commit 798a82df2a
2 changed files with 42 additions and 9 deletions

View File

@ -513,7 +513,8 @@ bool TGestione_preventivo_msk::pe_codart_handler(TMask_field& f, KEY k)
}
row_mask.set(FR_JOLLY3, costo);
}
if (mask.get(F_USEK).full() || !row_mask.field(FR_PREZZO).enabled())
const bool has_k = mask.get_bool(F_USEK);
if (has_k || !row_mask.field(FR_PREZZO).enabled())
row_mask.set(FR_PREZZO, "");
if (row_mask.field(FR_JOLLY3).enabled())
@ -534,11 +535,14 @@ bool TGestione_preventivo_msk::pe_codart_handler(TMask_field& f, KEY k)
TDocumento & doc = mask.doc();
const int rows = doc.physical_rows();
const bool has_k = mask.get_bool(F_USEK);
const int start_level = doc[sh->selected() + 1].get_int(RDOC_LEVEL);
for (int i = 1; i <= rows; i++)
for (int i = sh->selected() + 2; i <= rows; i++)
{
TRiga_documento & row = doc[i];
const int level = row.get_int(RDOC_LEVEL);
if (level <= start_level)
break;
const bool prodfin = level == 0;
const bool price_enabled = (i == doc.physical_rows()) || (level >= doc[i + 1].get_int(RDOC_LEVEL));
short id;
@ -546,16 +550,45 @@ 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 && has_k);
sh->enable_cell(i - 1, sh->cid2index(FR_JOLLY3), price_enabled);
const TString& codart = row.get(RDOC_CODARTMAG);
const TArticolo_giacenza & art = cached_article(codart);
const bool has_k = mask.get_bool(F_USEK);
if (has_k || ! price_enabled)
row.zero(RDOC_PREZZO);
if (price_enabled && has_k)
{
const real ric = art.get(ANAMAG_PERCRIC);
TString80 k;
if (ric != ZERO)
k = ric.string();
if (k.blank())
{
const TString catmer = art.get(ANAMAG_GRMERC);
k = cache().get("GMC", catmer, "S2");
if (k.blank())
k = cache().get("GMC", catmer.left(3), "S2");
}
if (k.full())
row.put(RDOC_K, k);
}
if (price_enabled)
{
const real costo = art.get_real(mask._field_costo);
row.put(RDOC_COSTO, costo);
}
for (id = FR_CDC1; id < FR_CDC12; id++)
sh->enable_cell(i - 1, id, prodfin);
for (id = FR_DESCDC1; id < FR_DESCDC12; id++)
sh->enable_cell(i - 1, id, prodfin);
if (row.get(RDOC_TREE).blank())
{
row.put(RDOC_TREE, mask.build_tree_string(level));
row.autoload(*sh);
mask.highlight_row(i -1, COLOR_INVALID, COLOR_INVALID, true, false);
}
row.put(RDOC_TREE, mask.build_tree_string(level));
row.autoload(*sh);
mask.highlight_row(i -1, COLOR_INVALID, COLOR_INVALID, true, false);
}
sh->force_update();
}

View File

@ -1780,7 +1780,7 @@ bool codart_handler(TMask_field& f, KEY key )
curr_row.autoload(sh);
}
sh.force_update();
sh.select(row-1);
sh.select(current_doc_row-1);
}
}
mask.update_giacenza();