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@18772 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
6d7f69f633
commit
21548247a1
114
pe/pe0400.cpp
114
pe/pe0400.cpp
@ -1,4 +1,5 @@
|
|||||||
#include <colors.h>
|
#include <colors.h>
|
||||||
|
#include <urldefid.h>
|
||||||
|
|
||||||
#include "../ve/ve0100.h"
|
#include "../ve/ve0100.h"
|
||||||
#include "../ve/veini.h"
|
#include "../ve/veini.h"
|
||||||
@ -14,6 +15,8 @@
|
|||||||
|
|
||||||
#define F_LIVELLO F_USERFLD+1
|
#define F_LIVELLO F_USERFLD+1
|
||||||
#define F_DETTAGLIO F_USERFLD+2
|
#define F_DETTAGLIO F_USERFLD+2
|
||||||
|
#define F_COPIA F_USERFLD+3
|
||||||
|
#define F_INCOLLA F_USERFLD+4
|
||||||
#define FOR_EACH_DOC_ROW_BACK(d, r, row) const TRiga_documento* row = NULL; for (int r = d.rows(); r > 0 && (row = &d[r]) != NULL; r--)
|
#define FOR_EACH_DOC_ROW_BACK(d, r, row) const TRiga_documento* row = NULL; for (int r = d.rows(); r > 0 && (row = &d[r]) != NULL; r--)
|
||||||
|
|
||||||
//////////////////////////////////////////
|
//////////////////////////////////////////
|
||||||
@ -24,6 +27,7 @@
|
|||||||
class TGestione_preventivo_msk : public TDocumento_mask
|
class TGestione_preventivo_msk : public TDocumento_mask
|
||||||
{
|
{
|
||||||
int _rule;
|
int _rule;
|
||||||
|
int _clipboard_row;
|
||||||
protected:
|
protected:
|
||||||
//hanlder di documento:
|
//hanlder di documento:
|
||||||
static bool pe_data_handler(TMask_field& f, KEY k);
|
static bool pe_data_handler(TMask_field& f, KEY k);
|
||||||
@ -38,7 +42,10 @@ protected:
|
|||||||
virtual void highlight_row(int row, COLOR back = COLOR_INVALID, COLOR fore = COLOR_INVALID, bool dirty = true, bool update = true);
|
virtual void highlight_row(int row, COLOR back = COLOR_INVALID, COLOR fore = COLOR_INVALID, bool dirty = true, bool update = true);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void user_set_handler( short fieldid, int index);
|
static bool pe_copia_handler(TMask_field& f, KEY k);
|
||||||
|
static bool pe_incolla_handler(TMask_field& f, KEY k);
|
||||||
|
|
||||||
|
virtual void user_set_handler( short fieldid, int index);
|
||||||
virtual void user_set_row_handler(TMask& rm, short field, int index);
|
virtual void user_set_row_handler(TMask& rm, short field, int index);
|
||||||
|
|
||||||
virtual TVariable_mask * riga_mask(int numriga);
|
virtual TVariable_mask * riga_mask(int numriga);
|
||||||
@ -270,6 +277,101 @@ bool TGestione_preventivo_msk::pe_data_handler(TMask_field& f, KEY k)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
dmsk._clipboard_row = dmsk.sfield(F_SHEET).selected() + 1;
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
if (dmsk._clipboard_row > 0)
|
||||||
|
{
|
||||||
|
TDocumento & doc = dmsk.doc();
|
||||||
|
TSheet_field & sh = dmsk.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;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = selected_row; !ok && i > 0 ; i--)
|
||||||
|
{
|
||||||
|
const int row_level = doc[i].get_int(RDOC_LEVEL);
|
||||||
|
if (level == row_level)
|
||||||
|
ok = true;
|
||||||
|
else
|
||||||
|
if (level > row_level)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
int start_row = -1;
|
||||||
|
for (i = selected_row; start_row < 0 && i <= rows; i++)
|
||||||
|
{
|
||||||
|
const int row_level = doc[i].get_int(RDOC_LEVEL);
|
||||||
|
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dmsk._clipboard_row = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
// HANDLER DI RIGA //
|
// HANDLER DI RIGA //
|
||||||
///////////////////////
|
///////////////////////
|
||||||
@ -454,7 +556,7 @@ void TGestione_preventivo_msk::user_set_handler( short fieldid, int index)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TGestione_preventivo_msk::TGestione_preventivo_msk(const char* tipodoc) : TDocumento_mask(tipodoc)
|
TGestione_preventivo_msk::TGestione_preventivo_msk(const char* tipodoc) : TDocumento_mask(tipodoc), _clipboard_row(-1)
|
||||||
{
|
{
|
||||||
TConfig* configpe = new TConfig(CONFIG_DITTA, "pe");
|
TConfig* configpe = new TConfig(CONFIG_DITTA, "pe");
|
||||||
sfield(F_SHEET).set_notify( ss_notify );
|
sfield(F_SHEET).set_notify( ss_notify );
|
||||||
@ -490,8 +592,12 @@ TMask* TGestione_preventivo_app::get_mask( int mode )
|
|||||||
TEdit_field & k = m->add_string(F_K, sh.page(), "K ", 2, y, 25);
|
TEdit_field & k = m->add_string(F_K, sh.page(), "K ", 2, y, 25);
|
||||||
|
|
||||||
k.set_field(DOC_K);
|
k.set_field(DOC_K);
|
||||||
m->add_number(F_LIVELLO, sh.page(), "Livello Successivo ", 35, y, 1);
|
m->add_number(F_LIVELLO, sh.page(), "Livello Successivo ", 33, y, 1);
|
||||||
m->add_boolean(F_DETTAGLIO, sh.page(), "Dettaglia ", 60, y);
|
m->add_boolean(F_DETTAGLIO, sh.page(), "Dettaglia ", 58, y);
|
||||||
|
TButton_field & b1 = m->add_button(F_COPIA, sh.page(), "~Copia", 70, y, 1, 1, "", BMP_COPY);
|
||||||
|
m->set_handler(F_COPIA, TGestione_preventivo_msk::pe_copia_handler);
|
||||||
|
TButton_field & b2 = m->add_button(F_INCOLLA, sh.page(), "~Incolla", 76, y, 1, 1, "", BMP_PASTE);
|
||||||
|
m->set_handler(F_INCOLLA, TGestione_preventivo_msk::pe_incolla_handler);
|
||||||
sh.enable_column(sh.cid2index(FR_JOLLY1), false);
|
sh.enable_column(sh.cid2index(FR_JOLLY1), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user