Patch level : 10.0 288
Files correlati : ve0.exe pe0.exe Ricompilazione Demo : [ ] Commento : Salvato l'ultimo documento nel pragrafo di modulo in moodo che i es. documenti lavanderia non vengagano richiamati da ve0 Preventivi/incarichi (Dinamica) (copia righe) git-svn-id: svn://10.65.10.50/trunk@18774 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
7fb7ef6878
commit
f307a08df9
236
pe/pe0400.cpp
236
pe/pe0400.cpp
@ -40,6 +40,7 @@ protected:
|
||||
|
||||
virtual void on_idle();
|
||||
virtual void highlight_row(int row, COLOR back = COLOR_INVALID, COLOR fore = COLOR_INVALID, bool dirty = true, bool update = true);
|
||||
const TString & build_tree_string(int level);
|
||||
|
||||
public:
|
||||
static bool pe_copia_handler(TMask_field& f, KEY k);
|
||||
@ -78,8 +79,25 @@ inline TGestione_preventivo_app& peapp() { return (TGestione_preventivo_app &)ma
|
||||
|
||||
//////////////////////////////////////////
|
||||
//// CLASSE TGestione_preventivo_MSK ////
|
||||
|
||||
//////////////////////////////////////////
|
||||
|
||||
const TString & TGestione_preventivo_msk::build_tree_string(int level)
|
||||
{
|
||||
TString & tree = get_tmp_string(20);
|
||||
|
||||
if (level < 10)
|
||||
{
|
||||
if (level > 0)
|
||||
tree.fill(' ', level);
|
||||
tree << '+';
|
||||
tree.rpad(10, '-');
|
||||
}
|
||||
else
|
||||
tree = " +";
|
||||
return tree;
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
// HANDLER DI DOCUMENTO //
|
||||
////////////////////////////
|
||||
@ -94,9 +112,9 @@ void TGestione_preventivo_msk:: on_idle()
|
||||
//..standard e non questo qui ridefinito. Allah!
|
||||
bool TGestione_preventivo_msk::ss_notify(TSheet_field& ss, int r, KEY key)
|
||||
{
|
||||
TGestione_preventivo_msk& dmsk = (TGestione_preventivo_msk&) ss.mask();
|
||||
TSheet_field & sh = dmsk.sfield(F_SHEET);
|
||||
TDocumento& doc = dmsk.doc();
|
||||
TGestione_preventivo_msk& mask = (TGestione_preventivo_msk&) ss.mask();
|
||||
TSheet_field & sh = mask.sfield(F_SHEET);
|
||||
TDocumento& doc = mask.doc();
|
||||
|
||||
switch (key)
|
||||
{
|
||||
@ -131,11 +149,11 @@ bool TGestione_preventivo_msk::ss_notify(TSheet_field& ss, int r, KEY key)
|
||||
const int rows = doc.physical_rows();
|
||||
|
||||
level = father_row.get_int(RDOC_LEVEL);
|
||||
const int next_level = dmsk.get_int(F_LIVELLO);
|
||||
const int next_level = mask.get_int(F_LIVELLO);
|
||||
if ( next_level > 0 && (doc_row == rows || level > doc[doc_row + 1].get_int(RDOC_LEVEL)))
|
||||
level = (doc_row == rows || next_level - 1 >= doc[doc_row + 1].get_int(RDOC_LEVEL)) ? next_level - 1 : doc[doc_row + 1].get_int(RDOC_LEVEL);
|
||||
else
|
||||
if (dmsk.get_bool(F_DETTAGLIO) || (doc_row < rows && level < doc[doc_row + 1].get_int(RDOC_LEVEL)))
|
||||
if (mask.get_bool(F_DETTAGLIO) || (doc_row < rows && level < doc[doc_row + 1].get_int(RDOC_LEVEL)))
|
||||
level++;
|
||||
if (level > 0)
|
||||
{
|
||||
@ -156,21 +174,10 @@ bool TGestione_preventivo_msk::ss_notify(TSheet_field& ss, int r, KEY key)
|
||||
}
|
||||
}
|
||||
row.put(RDOC_LEVEL, level);
|
||||
TString tree;
|
||||
|
||||
if (level < 10)
|
||||
{
|
||||
if (level > 0)
|
||||
tree.fill(' ', level);
|
||||
tree << '+';
|
||||
tree.rpad(10, '-');
|
||||
}
|
||||
else
|
||||
tree = " +";
|
||||
row.put(RDOC_TREE, tree);
|
||||
row.put(RDOC_TREE, mask.build_tree_string(level));
|
||||
row.autoload(sh);
|
||||
dmsk.reset(F_LIVELLO);
|
||||
dmsk.reset(F_DETTAGLIO);
|
||||
mask.reset(F_LIVELLO);
|
||||
mask.reset(F_DETTAGLIO);
|
||||
}
|
||||
break;
|
||||
case K_DEL: // Cancellazione
|
||||
@ -272,7 +279,7 @@ void TGestione_preventivo_msk::doc2mask(bool reload_clifo, bool force_load, bool
|
||||
bool TGestione_preventivo_msk::pe_data_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
bool ok = true;
|
||||
TGestione_preventivo_msk& dmsk = (TGestione_preventivo_msk&)f.mask();
|
||||
TGestione_preventivo_msk& mask = (TGestione_preventivo_msk&)f.mask();
|
||||
|
||||
return ok;
|
||||
}
|
||||
@ -282,9 +289,9 @@ bool TGestione_preventivo_msk::pe_copia_handler(TMask_field& f, KEY k)
|
||||
bool ok = true;
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
TGestione_preventivo_msk& dmsk = (TGestione_preventivo_msk&)f.mask();
|
||||
TGestione_preventivo_msk& mask = (TGestione_preventivo_msk&)f.mask();
|
||||
|
||||
dmsk._clipboard_row = dmsk.sfield(F_SHEET).selected() + 1;
|
||||
mask._clipboard_row = mask.sfield(F_SHEET).selected() + 1;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
@ -294,79 +301,72 @@ bool TGestione_preventivo_msk::pe_incolla_handler(TMask_field& f, KEY k)
|
||||
bool ok = true;
|
||||
if (k == K_SPACE)
|
||||
{
|
||||
TGestione_preventivo_msk& dmsk = (TGestione_preventivo_msk&)f.mask();
|
||||
TGestione_preventivo_msk& mask = (TGestione_preventivo_msk&)f.mask();
|
||||
|
||||
if (dmsk._clipboard_row > 0)
|
||||
if (mask._clipboard_row > 0)
|
||||
{
|
||||
TDocumento & doc = dmsk.doc();
|
||||
TSheet_field & sh = dmsk.sfield(F_SHEET);
|
||||
TDocumento & doc = mask.doc();
|
||||
TSheet_field & sh = mask.sfield(F_SHEET);
|
||||
const int selected_row = sh.selected() + 1;
|
||||
const int rows = doc.physical_rows();
|
||||
const int level = doc[dmsk._clipboard_row].get_int(RDOC_LEVEL);
|
||||
bool ok = false;
|
||||
const int next_level = mask.get_int(F_LIVELLO);
|
||||
const int orig_level = doc[mask._clipboard_row].get_int(RDOC_LEVEL);
|
||||
const int level = next_level > 0 ? next_level - 1 : orig_level;
|
||||
const int level_offset = level - orig_level;
|
||||
int i;
|
||||
int start_row = -1;
|
||||
|
||||
for (i = selected_row; !ok && i > 0 ; i--)
|
||||
for (i = selected_row; start_row < 0 && i <= rows; i++)
|
||||
{
|
||||
const int row_level = doc[i].get_int(RDOC_LEVEL);
|
||||
|
||||
if (level == row_level)
|
||||
ok = true;
|
||||
else
|
||||
if (level > row_level)
|
||||
break;
|
||||
start_row = i;
|
||||
}
|
||||
if (ok)
|
||||
if (start_row > 0)
|
||||
{
|
||||
int start_row = -1;
|
||||
for (i = selected_row; start_row < 0 && i <= rows; i++)
|
||||
const bool shift_source_rows = start_row <= mask._clipboard_row;
|
||||
|
||||
for (i = mask._clipboard_row; i <= doc.physical_rows(); i++)
|
||||
{
|
||||
int row_level = doc[i].get_int(RDOC_LEVEL);
|
||||
|
||||
if (i > mask._clipboard_row && orig_level >= row_level)
|
||||
break;
|
||||
const TRiga_documento & row = doc[i];
|
||||
TRiga_documento & new_row = doc.insert_row(start_row, row.get(RDOC_TIPORIGA));
|
||||
|
||||
sh.insert(start_row - 1);
|
||||
doc.copy_data(new_row, row);
|
||||
row_level += level_offset;
|
||||
new_row.put(RDOC_LEVEL, row_level);
|
||||
new_row.put(RDOC_TREE, mask.build_tree_string(level));
|
||||
|
||||
new_row.autoload(sh);
|
||||
start_row++;
|
||||
if (shift_source_rows)
|
||||
i++;
|
||||
}
|
||||
|
||||
for (i = 1; i <= doc.physical_rows(); i++)
|
||||
{
|
||||
const int row_level = doc[i].get_int(RDOC_LEVEL);
|
||||
const bool prodfin = row_level == 0;
|
||||
const bool price_enabled = (i == doc.physical_rows()) || (row_level >= doc[i + 1].get_int(RDOC_LEVEL));
|
||||
short id;
|
||||
|
||||
if (level >= row_level)
|
||||
start_row = i;
|
||||
}
|
||||
if (start_row > 0)
|
||||
{
|
||||
const bool shift_source_rows = start_row <= dmsk._clipboard_row;
|
||||
|
||||
for (i = dmsk._clipboard_row; i <= doc.physical_rows(); i++)
|
||||
{
|
||||
const int row_level = doc[i].get_int(RDOC_LEVEL);
|
||||
|
||||
if (i > dmsk._clipboard_row && level >= row_level)
|
||||
break;
|
||||
const TRiga_documento & row = doc[i];
|
||||
TRiga_documento & new_row = doc.insert_row(start_row, row.get(RDOC_TIPORIGA));
|
||||
|
||||
sh.insert(start_row - 1);
|
||||
doc.copy_data(new_row, row);
|
||||
new_row.put(RDOC_LEVEL, row.get(RDOC_LEVEL));
|
||||
new_row.put(RDOC_TREE, row.get(RDOC_TREE));
|
||||
new_row.autoload(sh);
|
||||
start_row++;
|
||||
if (shift_source_rows)
|
||||
i++;
|
||||
}
|
||||
|
||||
for (i = 1; i <= doc.physical_rows(); i++)
|
||||
{
|
||||
const int row_level = doc[i].get_int(RDOC_LEVEL);
|
||||
const bool prodfin = row_level == 0;
|
||||
const bool price_enabled = (i == doc.physical_rows()) || (row_level >= doc[i + 1].get_int(RDOC_LEVEL));
|
||||
short id;
|
||||
|
||||
sh.enable_cell(i - 1, sh.cid2index(FR_PREZZO), price_enabled);
|
||||
sh.enable_cell(i - 1, sh.cid2index(FR_JOLLY2), 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++)
|
||||
sh.enable_cell(i - 1, id, prodfin);
|
||||
dmsk.highlight_row(i - 1, COLOR_INVALID, COLOR_INVALID, true, false);
|
||||
}
|
||||
sh.force_update();
|
||||
sh.enable_cell(i - 1, sh.cid2index(FR_PREZZO), price_enabled);
|
||||
sh.enable_cell(i - 1, sh.cid2index(FR_JOLLY2), 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++)
|
||||
sh.enable_cell(i - 1, id, prodfin);
|
||||
mask.highlight_row(i - 1, COLOR_INVALID, COLOR_INVALID, true, false);
|
||||
}
|
||||
sh.force_update();
|
||||
}
|
||||
dmsk._clipboard_row = -1;
|
||||
mask._clipboard_row = -1;
|
||||
mask.reset(F_LIVELLO);
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
@ -380,52 +380,46 @@ bool TGestione_preventivo_msk::pe_codart_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
TMask& row_mask = f.mask();
|
||||
bool ok = codart_handler( f, k );
|
||||
TSheet_field * sh = row_mask.get_sheet();
|
||||
|
||||
if (ok && (k == K_ENTER || k == K_TAB))
|
||||
{
|
||||
if (f.to_check(k, true))
|
||||
if (ok && sh != NULL && k == K_TAB && f.focusdirty())
|
||||
{
|
||||
TDocumento_mask & mask = (TDocumento_mask &) sh->mask();
|
||||
TDocumento & doc = mask.doc();
|
||||
bool update = false;
|
||||
const int r = sh->selected();
|
||||
TRiga_documento & row = doc[r + 1];
|
||||
|
||||
if (row_mask.field(FR_JOLLY2).active())
|
||||
{
|
||||
TSheet_field * sh = row_mask.get_sheet();
|
||||
if (sh != NULL)
|
||||
const TString& codart = row.get(RDOC_CODARTMAG);
|
||||
|
||||
if (codart.full())
|
||||
{
|
||||
TDocumento_mask & mask = (TDocumento_mask &) sh->mask();
|
||||
TDocumento & doc = mask.doc();
|
||||
bool update = false;
|
||||
const int r = sh->selected();
|
||||
TRiga_documento & row = doc[r + 1];
|
||||
const TArticolo_giacenza & art = cached_article(codart);
|
||||
TString80 k = art.get(ANAMAG_PERCRIC);
|
||||
|
||||
if (row_mask.field(FR_JOLLY2).active())
|
||||
if (k.blank())
|
||||
{
|
||||
const TString& codart = mask.get(FR_CODARTMAG);
|
||||
|
||||
if (codart.full())
|
||||
{
|
||||
const TArticolo_giacenza & art = cached_article(codart);
|
||||
TString80 k = art.get(ANAMAG_PERCRIC);
|
||||
|
||||
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_mask.set(FR_JOLLY2, k);
|
||||
}
|
||||
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 (!row_mask.field(FR_PREZZO).active())
|
||||
row_mask.set(FR_PREZZO, "");
|
||||
if (k.full())
|
||||
row_mask.set(FR_JOLLY2, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!row_mask.field(FR_PREZZO).active())
|
||||
row_mask.set(FR_PREZZO, "");
|
||||
}
|
||||
if (k == K_F8)
|
||||
{
|
||||
TSheet_field * sh = row_mask.get_sheet();
|
||||
|
||||
if (sh != NULL)
|
||||
{
|
||||
TDocumento_mask & mask = (TDocumento_mask &) sh->mask();
|
||||
TGestione_preventivo_msk & mask = (TGestione_preventivo_msk &) sh->mask();
|
||||
TDocumento & doc = mask.doc();
|
||||
const int rows = doc.physical_rows();
|
||||
|
||||
@ -433,7 +427,6 @@ bool TGestione_preventivo_msk::pe_codart_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
TRiga_documento & row = doc[i];
|
||||
const int level = row.get_int(RDOC_LEVEL);
|
||||
TString16 tree = row.get(RDOC_TREE);
|
||||
const bool prodfin = level == 0;
|
||||
const bool price_enabled = (i == doc.physical_rows()) || (level >= doc[i + 1].get_int(RDOC_LEVEL));
|
||||
short id;
|
||||
@ -444,18 +437,9 @@ bool TGestione_preventivo_msk::pe_codart_handler(TMask_field& f, KEY k)
|
||||
sh->enable_cell(i - 1, id, prodfin);
|
||||
for (id = FR_DESCDC1; id < FR_DESCDC12; id++)
|
||||
sh->enable_cell(i - 1, id, prodfin);
|
||||
if (tree.blank())
|
||||
if (row.get(RDOC_TREE).blank())
|
||||
{
|
||||
if (level < 10)
|
||||
{
|
||||
if (level > 0)
|
||||
tree.fill(' ', level);
|
||||
tree << '+';
|
||||
tree.rpad(10, '-');
|
||||
}
|
||||
else
|
||||
tree = " +";
|
||||
row.put(RDOC_TREE, tree);
|
||||
row.put(RDOC_TREE, mask.build_tree_string(level));
|
||||
row.autoload(*sh);
|
||||
mask.highlight_row(i -1, COLOR_INVALID, COLOR_INVALID, true, false);
|
||||
}
|
||||
@ -490,7 +474,11 @@ bool TGestione_preventivo_msk::pe_qta_handler(TMask_field& f, KEY k)
|
||||
|
||||
if (level > 0)
|
||||
{
|
||||
TRiga_documento & row = doc[r];
|
||||
int father_row = r;
|
||||
while (r > 1 && level == doc[father_row].get_int(RDOC_LEVEL))
|
||||
father_row--;
|
||||
|
||||
TRiga_documento & row = doc[father_row];
|
||||
const real qta_prec = row.get_real(RDOC_QTA);
|
||||
real qta(f.get());
|
||||
TToken_string & shrow = sh->row(r);
|
||||
|
@ -266,6 +266,7 @@ void TGenEsecutivo_app::main_loop()
|
||||
doc_in.add(srcdoc);
|
||||
e.elabora(doc_in, doc_out, data);
|
||||
doc_in.rewrite();
|
||||
doc_out[0].put(DOC_K, doc_in[0].get(DOC_K));
|
||||
doc_out.write();
|
||||
doc_in.destroy(-1);
|
||||
TDocumento esecutivo((const TRectype &)doc_out[0]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user